@sfxcode/formkit-primevue 3.3.5 → 3.3.7
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 +21 -0
- package/README.md +138 -13
- package/components.d.ts +1 -0
- package/dist/components/FormKitDataDebug.d.vue.ts +24 -0
- package/dist/components/FormKitDataDebug.vue +9 -5
- package/dist/components/FormKitDataDebug.vue.d.ts +24 -0
- package/dist/components/FormKitDataEdit.d.vue.ts +180 -0
- package/dist/components/FormKitDataEdit.vue +46 -53
- package/dist/components/FormKitDataEdit.vue.d.ts +180 -0
- package/dist/components/FormKitDataView.d.vue.ts +73 -0
- package/dist/components/FormKitDataView.vue +27 -20
- package/dist/components/FormKitDataView.vue.d.ts +73 -0
- package/dist/components/FormKitIcon.d.vue.ts +39 -0
- package/dist/components/FormKitIcon.vue +13 -6
- package/dist/components/FormKitIcon.vue.d.ts +39 -0
- package/dist/components/FormKitPrefix.d.vue.ts +7 -0
- package/dist/components/FormKitPrefix.vue +3 -3
- package/dist/components/FormKitPrefix.vue.d.ts +7 -0
- package/dist/components/FormKitSuffix.d.vue.ts +7 -0
- package/dist/components/FormKitSuffix.vue +3 -3
- package/dist/components/FormKitSuffix.vue.d.ts +7 -0
- package/dist/components/PrimeAutoComplete.d.vue.ts +31 -0
- package/dist/components/PrimeAutoComplete.vue +86 -41
- package/dist/components/PrimeAutoComplete.vue.d.ts +31 -0
- package/dist/components/PrimeCascadeSelect.d.vue.ts +28 -0
- package/dist/components/PrimeCascadeSelect.vue +26 -7
- package/dist/components/PrimeCascadeSelect.vue.d.ts +28 -0
- package/dist/components/PrimeCheckbox.d.vue.ts +27 -0
- package/dist/components/PrimeCheckbox.vue +29 -9
- package/dist/components/PrimeCheckbox.vue.d.ts +27 -0
- package/dist/components/PrimeColorPicker.d.vue.ts +24 -0
- package/dist/components/PrimeColorPicker.vue +22 -7
- package/dist/components/PrimeColorPicker.vue.d.ts +24 -0
- package/dist/components/PrimeDatePicker.d.vue.ts +63 -0
- package/dist/components/PrimeDatePicker.vue +73 -17
- package/dist/components/PrimeDatePicker.vue.d.ts +63 -0
- package/dist/components/PrimeInputMask.d.vue.ts +28 -0
- package/dist/components/PrimeInputMask.vue +29 -10
- package/dist/components/PrimeInputMask.vue.d.ts +28 -0
- package/dist/components/PrimeInputNumber.d.vue.ts +36 -0
- package/dist/components/PrimeInputNumber.vue +56 -21
- package/dist/components/PrimeInputNumber.vue.d.ts +36 -0
- package/dist/components/PrimeInputOtp.d.vue.ts +26 -0
- package/dist/components/PrimeInputOtp.vue +24 -7
- package/dist/components/PrimeInputOtp.vue.d.ts +26 -0
- package/dist/components/PrimeInputText.d.vue.ts +24 -0
- package/dist/components/PrimeInputText.vue +25 -10
- package/dist/components/PrimeInputText.vue.d.ts +24 -0
- package/dist/components/PrimeKnob.d.vue.ts +31 -0
- package/dist/components/PrimeKnob.vue +37 -12
- package/dist/components/PrimeKnob.vue.d.ts +31 -0
- package/dist/components/PrimeListbox.d.vue.ts +42 -0
- package/dist/components/PrimeListbox.vue +39 -7
- package/dist/components/PrimeListbox.vue.d.ts +42 -0
- package/dist/components/PrimeMultiSelect.d.vue.ts +53 -0
- package/dist/components/PrimeMultiSelect.vue +52 -7
- package/dist/components/PrimeMultiSelect.vue.d.ts +53 -0
- package/dist/components/PrimeOutputBoolean.d.vue.ts +16 -0
- package/dist/components/PrimeOutputBoolean.vue +27 -28
- package/dist/components/PrimeOutputBoolean.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDate.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDate.vue +33 -33
- package/dist/components/PrimeOutputDate.vue.d.ts +16 -0
- package/dist/components/PrimeOutputDuration.d.vue.ts +16 -0
- package/dist/components/PrimeOutputDuration.vue +19 -23
- package/dist/components/PrimeOutputDuration.vue.d.ts +16 -0
- package/dist/components/PrimeOutputLink.d.vue.ts +16 -0
- package/dist/components/PrimeOutputLink.vue +27 -29
- package/dist/components/PrimeOutputLink.vue.d.ts +16 -0
- package/dist/components/PrimeOutputList.d.vue.ts +23 -0
- package/dist/components/PrimeOutputList.vue +42 -26
- package/dist/components/PrimeOutputList.vue.d.ts +23 -0
- package/dist/components/PrimeOutputNumber.d.vue.ts +16 -0
- package/dist/components/PrimeOutputNumber.vue +39 -36
- package/dist/components/PrimeOutputNumber.vue.d.ts +16 -0
- package/dist/components/PrimeOutputReference.d.vue.ts +16 -0
- package/dist/components/PrimeOutputReference.vue +30 -32
- package/dist/components/PrimeOutputReference.vue.d.ts +16 -0
- package/dist/components/PrimeOutputText.d.vue.ts +22 -0
- package/dist/components/PrimeOutputText.vue +53 -53
- package/dist/components/PrimeOutputText.vue.d.ts +22 -0
- package/dist/components/PrimePassword.d.vue.ts +33 -0
- package/dist/components/PrimePassword.vue +32 -11
- package/dist/components/PrimePassword.vue.d.ts +33 -0
- package/dist/components/PrimeRadioButton.d.vue.ts +28 -0
- package/dist/components/PrimeRadioButton.vue +29 -19
- package/dist/components/PrimeRadioButton.vue.d.ts +28 -0
- package/dist/components/PrimeRating.d.vue.ts +24 -0
- package/dist/components/PrimeRating.vue +22 -7
- package/dist/components/PrimeRating.vue.d.ts +24 -0
- package/dist/components/PrimeSelect.d.vue.ts +50 -0
- package/dist/components/PrimeSelect.vue +49 -7
- package/dist/components/PrimeSelect.vue.d.ts +50 -0
- package/dist/components/PrimeSelectButton.d.vue.ts +28 -0
- package/dist/components/PrimeSelectButton.vue +27 -7
- package/dist/components/PrimeSelectButton.vue.d.ts +28 -0
- package/dist/components/PrimeSlider.d.vue.ts +26 -0
- package/dist/components/PrimeSlider.vue +28 -10
- package/dist/components/PrimeSlider.vue.d.ts +26 -0
- package/dist/components/PrimeTextarea.d.vue.ts +25 -0
- package/dist/components/PrimeTextarea.vue +23 -7
- package/dist/components/PrimeTextarea.vue.d.ts +25 -0
- package/dist/components/PrimeToggleButton.d.vue.ts +26 -0
- package/dist/components/PrimeToggleButton.vue +25 -7
- package/dist/components/PrimeToggleButton.vue.d.ts +26 -0
- package/dist/components/PrimeToggleSwitch.d.vue.ts +23 -0
- package/dist/components/PrimeToggleSwitch.vue +23 -8
- package/dist/components/PrimeToggleSwitch.vue.d.ts +23 -0
- package/dist/components/PrimeTreeSelect.d.vue.ts +32 -0
- package/dist/components/PrimeTreeSelect.vue +30 -7
- package/dist/components/PrimeTreeSelect.vue.d.ts +32 -0
- package/dist/components/index.d.ts +23 -23
- package/dist/composables/index.d.ts +8 -8
- package/dist/composables/index.js +8 -8
- package/dist/composables/index.mjs +8 -8
- package/dist/composables/useFormKitInput.js +1 -5
- package/dist/composables/useFormKitInput.mjs +1 -13
- package/dist/composables/useFormKitRepeater.js +1 -1
- package/dist/composables/useFormKitRepeater.mjs +17 -45
- package/dist/composables/useFormKitSchema.mjs +2 -10
- package/dist/composables/useInputEditor.js +4 -4
- package/dist/composables/useInputEditor.mjs +24 -52
- package/dist/composables/useInputEditorSchema.js +3 -3
- package/dist/composables/useInputEditorSchema.mjs +17 -25
- package/dist/composables/useOutputDuration.mjs +6 -3
- package/dist/definitions/index.js +2 -2
- package/dist/definitions/index.mjs +2 -2
- package/dist/definitions/input.d.ts +1 -1
- package/dist/definitions/input.mjs +15 -301
- package/dist/definitions/output.d.ts +1 -1
- package/dist/index.d.ts +48 -48
- package/dist/index.js +12 -12
- package/dist/index.mjs +3 -9
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.mjs +27 -31
- package/dist/sass/formkit-primevue.scss +101 -99
- package/package.json +80 -45
- package/dist/vue.d.ts +0 -5
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { useFormKitSection } from '../composables'
|
|
7
|
+
import FormKitIcon from './FormKitIcon.vue'
|
|
8
|
+
import FormKitPrefix from './FormKitPrefix.vue'
|
|
9
|
+
import FormKitSuffix from './FormKitSuffix.vue'
|
|
10
|
+
|
|
7
11
|
const props = defineProps({
|
|
8
12
|
context: {
|
|
9
|
-
type: Object,
|
|
10
|
-
required: true
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
|
|
13
|
+
type: Object as PropType<FormKitFrameworkContext> & FormKitIconProps,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
19
|
+
|
|
14
20
|
const url = computed(() => {
|
|
15
21
|
if (props.context?._value)
|
|
16
|
-
return props.context?._value.indexOf(
|
|
17
|
-
else
|
|
18
|
-
|
|
22
|
+
return props.context?._value.indexOf('http') > -1 ? props.context?._value : `https://${props.context?._value}`
|
|
23
|
+
else
|
|
24
|
+
return ''
|
|
25
|
+
})
|
|
26
|
+
|
|
19
27
|
const title = computed(() => {
|
|
20
|
-
const value = props.context?._value ??
|
|
21
|
-
return props.context?.title ?? value
|
|
22
|
-
})
|
|
28
|
+
const value = props.context?._value ?? ''
|
|
29
|
+
return props.context?.title ?? value
|
|
30
|
+
})
|
|
23
31
|
</script>
|
|
24
32
|
|
|
25
33
|
<template>
|
|
26
34
|
<div class="p-formkit p-output-link">
|
|
27
|
-
<FormKitIcon
|
|
28
|
-
v-if="hasPrefixIcon"
|
|
29
|
-
:icon-class="context?.iconPrefix as string"
|
|
30
|
-
:on-click="context?.onIconPrefixClicked as () => void"
|
|
31
|
-
position="prefix"
|
|
32
|
-
/>
|
|
35
|
+
<FormKitIcon v-if="hasPrefixIcon" :icon-class="context?.iconPrefix as string" :on-click="context?.onIconPrefixClicked as (() => void)" position="prefix" />
|
|
33
36
|
<FormKitPrefix v-if="hasPrefix" :prefix="context?.prefix as string" />
|
|
34
37
|
<a
|
|
35
38
|
v-if="context?.value"
|
|
@@ -42,11 +45,6 @@ const title = computed(() => {
|
|
|
42
45
|
<span>{{ title }}</span>
|
|
43
46
|
</a>
|
|
44
47
|
<FormKitSuffix v-if="hasSuffix" :suffix="context?.suffix as string" />
|
|
45
|
-
<FormKitIcon
|
|
46
|
-
v-if="hasSuffixIcon"
|
|
47
|
-
:icon-class="context?.iconSuffix as string"
|
|
48
|
-
:on-click="context?.onIconSuffixClicked as () => void"
|
|
49
|
-
position="suffix"
|
|
50
|
-
/>
|
|
48
|
+
<FormKitIcon v-if="hasSuffixIcon" :icon-class="context?.iconSuffix as string" :on-click="context?.onIconSuffixClicked as (() => void)" position="suffix" />
|
|
51
49
|
</div>
|
|
52
50
|
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
context: {
|
|
6
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
context: {
|
|
11
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { SelectProps } from 'primevue/select';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
5
|
+
export interface PrimeOutputListProps {
|
|
6
|
+
options?: SelectProps['options'];
|
|
7
|
+
optionLabel?: SelectProps['optionLabel'];
|
|
8
|
+
optionValue?: SelectProps['optionValue'];
|
|
9
|
+
convertValue?: (array: []) => [];
|
|
10
|
+
}
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
context: {
|
|
13
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & PrimeOutputListProps;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & PrimeOutputListProps;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -1,36 +1,52 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
|
+
import type { SelectProps } from 'primevue/select'
|
|
4
|
+
import type { PropType } from 'vue'
|
|
5
|
+
import type { FormKitIconProps } from './FormKitIcon.vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { useFormKitSection } from '../composables/index.ts'
|
|
8
|
+
import FormKitIcon from './FormKitIcon.vue'
|
|
9
|
+
import FormKitPrefix from './FormKitPrefix.vue'
|
|
10
|
+
import FormKitSuffix from './FormKitSuffix.vue'
|
|
11
|
+
|
|
12
|
+
export interface PrimeOutputListProps {
|
|
13
|
+
options?: SelectProps['options']
|
|
14
|
+
optionLabel?: SelectProps['optionLabel']
|
|
15
|
+
optionValue?: SelectProps['optionValue']
|
|
16
|
+
convertValue?: (array: []) => []
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
const props = defineProps({
|
|
9
20
|
context: {
|
|
10
|
-
type: Object,
|
|
11
|
-
required: true
|
|
12
|
-
}
|
|
13
|
-
})
|
|
21
|
+
type: Object as PropType<FormKitFrameworkContext> & FormKitIconProps & PrimeOutputListProps,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
14
26
|
const listStyle = computed(() => {
|
|
15
|
-
return props.context?.listStyle ||
|
|
16
|
-
})
|
|
17
|
-
|
|
27
|
+
return props.context?.listStyle || 'span'
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
31
|
+
|
|
18
32
|
const getListValues = computed(() => {
|
|
19
|
-
const values = Array.isArray(props.context?._value) ? props.context._value : []
|
|
33
|
+
const values = Array.isArray(props.context?._value) ? props.context._value : []
|
|
20
34
|
if (props.context?.options && props.context?.optionValue) {
|
|
21
|
-
const key =
|
|
35
|
+
const key: string = `${props.context.optionValue}`
|
|
22
36
|
return values.map((value) => {
|
|
23
|
-
const foundOption = props.context?.options?.find(
|
|
24
|
-
return foundOption ? foundOption[props.context?.optionLabel] : value
|
|
25
|
-
})
|
|
26
|
-
} else if (typeof props.context?.convertValue === "function") {
|
|
27
|
-
return props.context.convertValue([...values]);
|
|
37
|
+
const foundOption = props.context?.options?.find(option => option[key] === value)
|
|
38
|
+
return foundOption ? foundOption[props.context?.optionLabel as string] : value
|
|
39
|
+
})
|
|
28
40
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
else if (typeof props.context?.convertValue === 'function') {
|
|
42
|
+
return props.context.convertValue([...values])
|
|
43
|
+
}
|
|
44
|
+
return values
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const dividerClass = computed(() => props.context?.dividerClass || '')
|
|
48
|
+
const itemClass = computed(() => props.context?.itemClass || '')
|
|
49
|
+
const listItemsClass = computed(() => props.context?.attrs?.class || '')
|
|
34
50
|
</script>
|
|
35
51
|
|
|
36
52
|
<template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { SelectProps } from 'primevue/select';
|
|
3
|
+
import type { PropType } from 'vue';
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
5
|
+
export interface PrimeOutputListProps {
|
|
6
|
+
options?: SelectProps['options'];
|
|
7
|
+
optionLabel?: SelectProps['optionLabel'];
|
|
8
|
+
optionValue?: SelectProps['optionValue'];
|
|
9
|
+
convertValue?: (array: []) => [];
|
|
10
|
+
}
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
context: {
|
|
13
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & PrimeOutputListProps;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & PrimeOutputListProps;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
context: {
|
|
6
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
context: {
|
|
11
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue'
|
|
5
|
+
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { useI18n } from 'vue-i18n'
|
|
8
|
+
import { useFormKitSection } from '../composables'
|
|
9
|
+
import FormKitIcon from './FormKitIcon.vue'
|
|
10
|
+
import FormKitPrefix from './FormKitPrefix.vue'
|
|
11
|
+
import FormKitSuffix from './FormKitSuffix.vue'
|
|
12
|
+
|
|
8
13
|
const props = defineProps({
|
|
9
14
|
context: {
|
|
10
|
-
type: Object,
|
|
11
|
-
required: true
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const {
|
|
15
|
+
type: Object as PropType<FormKitFrameworkContext> & FormKitIconProps,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
21
|
+
|
|
22
|
+
const { n } = useI18n()
|
|
23
|
+
|
|
16
24
|
const converted = computed(() => {
|
|
17
|
-
const value = props?.context?._value
|
|
25
|
+
const value = props?.context?._value
|
|
18
26
|
if (value) {
|
|
19
|
-
let result =
|
|
20
|
-
const format = props?.context?.attrs?.format ? props?.context?.attrs?.format :
|
|
27
|
+
let result = ''
|
|
28
|
+
const format = props?.context?.attrs?.format ? props?.context?.attrs?.format : 'short'
|
|
21
29
|
try {
|
|
22
|
-
result = n(value, format)
|
|
23
|
-
}
|
|
30
|
+
result = n(value, format)
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
33
|
+
catch (e) {
|
|
24
34
|
try {
|
|
25
|
-
result = n(+value, format)
|
|
26
|
-
}
|
|
35
|
+
result = n(+value, format)
|
|
36
|
+
}
|
|
37
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
38
|
+
catch (e) {
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
|
-
return result
|
|
30
|
-
}
|
|
31
|
-
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return ''
|
|
32
45
|
}
|
|
33
|
-
})
|
|
46
|
+
})
|
|
34
47
|
</script>
|
|
35
48
|
|
|
36
49
|
<template>
|
|
37
50
|
<div class="p-formkit p-output-number">
|
|
38
|
-
<FormKitIcon
|
|
39
|
-
v-if="hasPrefixIcon"
|
|
40
|
-
:icon-class="context?.iconPrefix as string"
|
|
41
|
-
:on-click="context?.onIconPrefixClicked as () => void"
|
|
42
|
-
position="prefix"
|
|
43
|
-
/>
|
|
51
|
+
<FormKitIcon v-if="hasPrefixIcon" :icon-class="context?.iconPrefix as string" :on-click="context?.onIconPrefixClicked as (() => void)" position="prefix" />
|
|
44
52
|
<FormKitPrefix v-if="hasPrefix" :prefix="context?.prefix as string" />
|
|
45
53
|
<span :id="context?.id" :style="context?.attrs?.style" :class="context?.attrs?.class">
|
|
46
54
|
{{ converted }}
|
|
47
55
|
</span>
|
|
48
56
|
<FormKitSuffix v-if="hasSuffix" :suffix="context?.suffix as string" />
|
|
49
|
-
<FormKitIcon
|
|
50
|
-
v-if="hasSuffixIcon"
|
|
51
|
-
:icon-class="context?.iconSuffix as string"
|
|
52
|
-
:on-click="context?.onIconSuffixClicked as () => void"
|
|
53
|
-
position="suffix"
|
|
54
|
-
/>
|
|
57
|
+
<FormKitIcon v-if="hasSuffixIcon" :icon-class="context?.iconSuffix as string" :on-click="context?.onIconSuffixClicked as (() => void)" position="suffix" />
|
|
55
58
|
</div>
|
|
56
59
|
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
context: {
|
|
6
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
context: {
|
|
11
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
context: {
|
|
6
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
context: {
|
|
11
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { useFormKitSection } from '../composables'
|
|
7
|
+
import FormKitIcon from './FormKitIcon.vue'
|
|
8
|
+
import FormKitPrefix from './FormKitPrefix.vue'
|
|
9
|
+
import FormKitSuffix from './FormKitSuffix.vue'
|
|
10
|
+
|
|
7
11
|
const props = defineProps({
|
|
8
12
|
context: {
|
|
9
|
-
type: Object,
|
|
10
|
-
required: true
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
|
|
13
|
+
type: Object as PropType<FormKitFrameworkContext> & FormKitIconProps,
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
19
|
+
|
|
14
20
|
const reference = computed(() => {
|
|
15
|
-
const value = props.context?._value ??
|
|
16
|
-
let result = props.context?.reference ? `${props.context?.reference}` :
|
|
17
|
-
if (!props.context?.internal && !result.includes(
|
|
18
|
-
|
|
19
|
-
})
|
|
21
|
+
const value = props.context?._value ?? ''
|
|
22
|
+
let result = props.context?.reference ? `${props.context?.reference}` : 'reference-must-be-set'
|
|
23
|
+
if (!props.context?.internal && !result.includes('http'))
|
|
24
|
+
result = `https://${result}`
|
|
25
|
+
return result.replace(/\{\{.*\}\}/, value)
|
|
26
|
+
})
|
|
27
|
+
|
|
20
28
|
const title = computed(() => {
|
|
21
|
-
const value = props.context?._value ??
|
|
22
|
-
const result = props.context?.title ?? value
|
|
23
|
-
return `${result}`.replace(/\{\{.*\}\}/, value)
|
|
24
|
-
})
|
|
29
|
+
const value = props.context?._value ?? ''
|
|
30
|
+
const result = props.context?.title ?? value
|
|
31
|
+
return `${result}`.replace(/\{\{.*\}\}/, value)
|
|
32
|
+
})
|
|
25
33
|
</script>
|
|
26
34
|
|
|
27
35
|
<template>
|
|
28
36
|
<div class="p-formkit p-output-reference">
|
|
29
|
-
<FormKitIcon
|
|
30
|
-
v-if="hasPrefixIcon"
|
|
31
|
-
:icon-class="context?.iconPrefix as string"
|
|
32
|
-
:on-click="context?.onIconPrefixClicked as () => void"
|
|
33
|
-
position="prefix"
|
|
34
|
-
/>
|
|
37
|
+
<FormKitIcon v-if="hasPrefixIcon" :icon-class="context?.iconPrefix as string" :on-click="context?.onIconPrefixClicked as (() => void)" position="prefix" />
|
|
35
38
|
<FormKitPrefix v-if="hasPrefix" :prefix="context?.prefix as string" />
|
|
36
39
|
<component
|
|
37
40
|
:is="context?.linkComponentName ? context?.linkComponentName : 'RouterLink'"
|
|
@@ -54,11 +57,6 @@ const title = computed(() => {
|
|
|
54
57
|
{{ title }}
|
|
55
58
|
</a>
|
|
56
59
|
<FormKitSuffix v-if="hasSuffix" :suffix="context?.suffix as string" />
|
|
57
|
-
<FormKitIcon
|
|
58
|
-
v-if="hasSuffixIcon"
|
|
59
|
-
:icon-class="context?.iconSuffix as string"
|
|
60
|
-
:on-click="context?.onIconSuffixClicked as () => void"
|
|
61
|
-
position="suffix"
|
|
62
|
-
/>
|
|
60
|
+
<FormKitIcon v-if="hasSuffixIcon" :icon-class="context?.iconSuffix as string" :on-click="context?.onIconSuffixClicked as (() => void)" position="suffix" />
|
|
63
61
|
</div>
|
|
64
62
|
</template>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
|
+
context: {
|
|
6
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
context: {
|
|
11
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps;
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
export interface FormKitOutputTextProps {
|
|
5
|
+
html?: boolean;
|
|
6
|
+
isTranslationKey?: boolean;
|
|
7
|
+
convertValue?: (value: string) => string;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
context: {
|
|
12
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & FormKitOutputTextProps;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
context: {
|
|
17
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & FormKitOutputTextProps;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
|
+
import type { PropType } from 'vue'
|
|
4
|
+
import type { FormKitIconProps } from './FormKitIcon.vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { useI18n } from 'vue-i18n'
|
|
7
|
+
import { useFormKitSection } from '../composables'
|
|
8
|
+
import FormKitIcon from './FormKitIcon.vue'
|
|
9
|
+
import FormKitPrefix from './FormKitPrefix.vue'
|
|
10
|
+
import FormKitSuffix from './FormKitSuffix.vue'
|
|
11
|
+
|
|
12
|
+
export interface FormKitOutputTextProps {
|
|
13
|
+
html?: boolean
|
|
14
|
+
isTranslationKey?: boolean
|
|
15
|
+
convertValue?: (value: string) => string
|
|
16
|
+
maxLength?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
8
19
|
const props = defineProps({
|
|
9
20
|
context: {
|
|
10
|
-
type: Object,
|
|
11
|
-
required: true
|
|
12
|
-
}
|
|
13
|
-
})
|
|
21
|
+
type: Object as PropType<FormKitFrameworkContext> & FormKitIconProps & FormKitOutputTextProps,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
14
26
|
const textValue = computed(() => {
|
|
15
|
-
const value = props.context?._value
|
|
16
|
-
const { t } = useI18n()
|
|
17
|
-
let result =
|
|
27
|
+
const value = props.context?._value
|
|
28
|
+
const { t } = useI18n()
|
|
29
|
+
let result = ''
|
|
18
30
|
if (value) {
|
|
19
31
|
if (props.context?.isTranslationKey) {
|
|
20
|
-
result = t(value)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
result = t(value)
|
|
33
|
+
}
|
|
34
|
+
else if (typeof props.context?.convertValue === 'function') {
|
|
35
|
+
result = props.context?.convertValue(value)
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result = value
|
|
25
39
|
}
|
|
26
40
|
}
|
|
27
|
-
|
|
41
|
+
|
|
42
|
+
// Apply maxLength truncation if specified
|
|
43
|
+
const maxLength = props.context?.maxLength as number | undefined
|
|
28
44
|
if (result && maxLength && !props.context?.html && result.length > maxLength) {
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
// Try to truncate at word boundary
|
|
46
|
+
let truncated = result.substring(0, maxLength)
|
|
47
|
+
const lastSpaceIndex = truncated.lastIndexOf(' ')
|
|
48
|
+
|
|
49
|
+
// Only truncate at word boundary if there's a space, and it's not too far back
|
|
50
|
+
// (at least 80% of maxLength to avoid cutting too much)
|
|
31
51
|
if (lastSpaceIndex > maxLength * 0.8) {
|
|
32
|
-
truncated = truncated.substring(0, lastSpaceIndex)
|
|
52
|
+
truncated = truncated.substring(0, lastSpaceIndex)
|
|
33
53
|
}
|
|
34
|
-
result = `${truncated}
|
|
54
|
+
result = `${truncated}...`
|
|
35
55
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
|
|
57
|
+
return result
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
39
61
|
</script>
|
|
40
62
|
|
|
41
63
|
<template>
|
|
42
64
|
<div class="p-formkit p-output-text">
|
|
43
|
-
<FormKitIcon
|
|
44
|
-
v-if="hasPrefixIcon"
|
|
45
|
-
:icon-class="context?.iconPrefix as string"
|
|
46
|
-
:on-click="context?.onIconPrefixClicked as () => void"
|
|
47
|
-
position="prefix"
|
|
48
|
-
/>
|
|
65
|
+
<FormKitIcon v-if="hasPrefixIcon" :icon-class="context?.iconPrefix as string" :on-click="context?.onIconPrefixClicked as (() => void)" position="prefix" />
|
|
49
66
|
<FormKitPrefix v-if="hasPrefix" :prefix="context?.prefix as string" />
|
|
50
|
-
<span
|
|
51
|
-
|
|
52
|
-
:id="context?.id"
|
|
53
|
-
:class="context?.attrs?.class"
|
|
54
|
-
:style="context?.attrs?.style"
|
|
55
|
-
v-html="textValue"
|
|
56
|
-
/>
|
|
57
|
-
<span
|
|
58
|
-
v-else
|
|
59
|
-
:id="context?.id"
|
|
60
|
-
:class="context?.attrs?.class"
|
|
61
|
-
:style="context?.attrs?.style"
|
|
62
|
-
v-text="textValue"
|
|
63
|
-
/>
|
|
67
|
+
<span v-if="context?.html" :id="context?.id" :class="context?.attrs?.class" :style="context?.attrs?.style" v-html="textValue" />
|
|
68
|
+
<span v-else :id="context?.id" :class="context?.attrs?.class" :style="context?.attrs?.style" v-text="textValue" />
|
|
64
69
|
<FormKitSuffix v-if="hasSuffix" :suffix="context?.suffix as string" />
|
|
65
|
-
<FormKitIcon
|
|
66
|
-
v-if="hasSuffixIcon"
|
|
67
|
-
:icon-class="context?.iconSuffix as string"
|
|
68
|
-
:on-click="context?.onIconSuffixClicked as () => void"
|
|
69
|
-
position="suffix"
|
|
70
|
-
/>
|
|
70
|
+
<FormKitIcon v-if="hasSuffixIcon" :icon-class="context?.iconSuffix as string" :on-click="context?.onIconSuffixClicked as (() => void)" position="suffix" />
|
|
71
71
|
</div>
|
|
72
72
|
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FormKitIcon.vue';
|
|
4
|
+
export interface FormKitOutputTextProps {
|
|
5
|
+
html?: boolean;
|
|
6
|
+
isTranslationKey?: boolean;
|
|
7
|
+
convertValue?: (value: string) => string;
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
context: {
|
|
12
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & FormKitOutputTextProps;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
context: {
|
|
17
|
+
type: PropType<FormKitFrameworkContext> & FormKitIconProps & FormKitOutputTextProps;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|