Skip to content

Commit 3b1579a

Browse files
committed
refactor(Outputs): Add prefix, prefixIcon, suffix, suffixIcon to definition
1 parent 68c7950 commit 3b1579a

File tree

7 files changed

+48
-14
lines changed

7 files changed

+48
-14
lines changed

src/components/PrimeOutputBoolean.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
<script setup lang='ts'>
22
import { useI18n } from 'vue-i18n'
3-
import { computed } from 'vue'
3+
import { type PropType, computed } from 'vue'
4+
import type { FormKitFrameworkContext } from '@formkit/core'
45
import { useFormKitSection } from '../composables'
56
67
const props = defineProps({
7-
context: Object,
8+
context: {
9+
type: Object as PropType<FormKitFrameworkContext>,
10+
required: true,
11+
},
812
})
13+
914
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
1015
1116
const { t } = useI18n()
@@ -22,13 +27,13 @@ const translated = computed(() => {
2227
<div class="p-formkit p-output-boolean">
2328
<i v-if="hasPrefixIcon" class="formkit-prefix-icon" :class="context?.prefixIcon" />
2429
<span v-if="hasPrefix" class="formkit-prefix">
25-
{{ context?.attrs?.prefix }}
30+
{{ context?.prefix }}
2631
</span>
2732
<span :id="context?.id" :style="context?.attrs?.style" :class="context?.attrs?.class">
2833
{{ translated }}
2934
</span>
3035
<span v-if="hasSuffix" class="formkit-suffix">
31-
{{ context?.attrs?.suffix }}
36+
{{ context?.suffix }}
3237
</span>
3338
<i v-if="hasSuffixIcon" class="formkit-suffix-icon" :class="context?.suffixIcon" />
3439
</div>

src/components/PrimeOutputDate.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<script setup lang='ts'>
22
import { useI18n } from 'vue-i18n'
3-
import { computed } from 'vue'
3+
import { type PropType, computed } from 'vue'
4+
import type { FormKitFrameworkContext } from '@formkit/core'
45
import { useFormKitSection } from '../composables'
56
67
const props = defineProps({
7-
context: Object,
8+
context: {
9+
type: Object as PropType<FormKitFrameworkContext>,
10+
required: true,
11+
},
812
})
913
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
1014

src/components/PrimeOutputDuration.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<script setup lang='ts'>
2+
import type { PropType } from 'vue'
3+
import type { FormKitFrameworkContext } from '@formkit/core'
24
import { useFormKitSection, useOutputDuration } from '../composables'
35
46
const props = defineProps({
5-
context: Object,
7+
context: {
8+
type: Object as PropType<FormKitFrameworkContext>,
9+
required: true,
10+
},
611
})
7-
812
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
913
1014
const { formattedDuration } = useOutputDuration()

src/components/PrimeOutputLink.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<script setup lang='ts'>
2-
import { computed } from 'vue'
2+
import { type PropType, computed } from 'vue'
3+
import type { FormKitFrameworkContext } from '@formkit/core'
34
import { useFormKitSection } from '../composables'
45
56
const props = defineProps({
6-
context: Object,
7+
context: {
8+
type: Object as PropType<FormKitFrameworkContext>,
9+
required: true,
10+
},
711
})
12+
813
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
914
1015
const url = computed(() => props.context?._value.indexOf('http') > -1 ? props.context?._value : `https://${props.context?._value}`)

src/components/PrimeOutputList.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<script setup lang='ts'>
2+
import type { PropType } from 'vue'
3+
import type { FormKitFrameworkContext } from '@formkit/core'
24
import { useFormKitSection } from '../composables'
35
46
const props = defineProps({
5-
context: Object,
7+
context: {
8+
type: Object as PropType<FormKitFrameworkContext>,
9+
required: true,
10+
},
611
})
12+
713
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
814
915
function listValue(index: number, value: string): string {

src/components/PrimeOutputNumber.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<script setup lang='ts'>
22
import { useI18n } from 'vue-i18n'
3-
import { computed } from 'vue'
3+
import { type PropType, computed } from 'vue'
44
5+
import type { FormKitFrameworkContext } from '@formkit/core'
56
import { useFormKitSection } from '../composables'
67
78
const props = defineProps({
8-
context: Object,
9+
context: {
10+
type: Object as PropType<FormKitFrameworkContext>,
11+
required: true,
12+
},
913
})
1014
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
1115

src/components/PrimeOutputText.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<script setup lang='ts'>
2+
import type { PropType } from 'vue'
3+
import type { FormKitFrameworkContext } from '@formkit/core'
24
import { useFormKitSection } from '../composables'
35
46
const props = defineProps({
5-
context: Object,
7+
context: {
8+
type: Object as PropType<FormKitFrameworkContext>,
9+
required: true,
10+
},
611
})
12+
713
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
814
</script>
915

0 commit comments

Comments
 (0)