Skip to content

Commit 8037d57

Browse files
committed
chore: fix some minor issues
1 parent 173e2b7 commit 8037d57

21 files changed

+47
-43
lines changed

src/components/PrimeCascadeSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3838
<CascadeSelect
3939
:id="context.id"
4040
v-model="context._value"
41-
v-bind="context.attrs"
41+
v-bind="context?.attrs"
4242
:disabled="!!context?.disabled"
4343
:readonly="context?.attrs._readonly ?? false"
4444
:class="styleClass"

src/components/PrimeChips.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3131
<div class="p-formkit">
3232
<Chips
3333
v-model="context._value"
34-
v-bind="context.attrs"
34+
v-bind="context?.attrs"
3535
:input-id="context.id"
3636
:disabled="!!context?.disabled"
3737
:readonly="context?.attrs._readonly ?? false"

src/components/PrimeColorPicker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function handleChange(e: any) {
2828
<div class="p-formkit">
2929
<ColorPicker
3030
v-model="context._value"
31-
v-bind="context.attrs"
31+
v-bind="context?.attrs"
3232
:disabled="!!context?.disabled"
3333
:readonly="context?.attrs._readonly ?? false"
3434
:style="context?.attrs.style"

src/components/PrimeDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
5959
<div class="p-formkit">
6060
<Dropdown
6161
v-model="context._value"
62-
v-bind="context.attrs"
62+
v-bind="context?.attrs"
6363
:input-id="context.id"
6464
:disabled="!!context?.disabled"
6565
:readonly="context?.attrs._readonly ?? false"

src/components/PrimeEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3636
<Editor
3737
:id="context.id"
3838
v-model="context._value"
39-
v-bind="context.attrs"
39+
v-bind="context?.attrs"
4040
:disabled="!!context?.disabled"
4141
:readonly="context?.attrs._readonly ?? false"
4242
:editor-style="context?.attrs.style"

src/components/PrimeInputMask.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
5757
<InputMask
5858
:id="context.id"
5959
v-model="context._value"
60-
v-bind="context.attrs"
60+
v-bind="context?.attrs"
6161
:disabled="!!context?.disabled"
6262
:readonly="context?.attrs._readonly ?? false"
6363
:class="styleClass"

src/components/PrimeInputNumber.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
4444
<div class="p-formkit">
4545
<InputNumber
4646
v-model="context._value"
47-
v-bind="context.attrs"
47+
v-bind="context?.attrs"
4848
:input-id="context.id"
4949
:disabled="!!context?.disabled"
5050
:readonly="context?.attrs._readonly ?? false"

src/components/PrimeInputSwitch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
3636
<span v-if="context.attrs.labelLeft" class="formkit-prime-left">{{ context.labelLeft }}</span>
3737
<InputSwitch
3838
v-model="context._value"
39-
v-bind="context.attrs"
39+
v-bind="context?.attrs"
4040
:input-id="context.id"
4141
:disabled="!!context?.disabled"
4242
:readonly="context?.attrs._readonly ?? false"

src/components/PrimeInputText.vue

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ export interface FormKitPrimeInputTextProps {
88
ptOptions?: InputTextProps['ptOptions']
99
unstyled?: InputTextProps['unstyled']
1010
placeholder?: InputTextProps['placeholder']
11-
iconLeft?: string
12-
iconRight?: string
11+
icon?: string
1312
}
1413
1514
const props = defineProps({
@@ -19,21 +18,8 @@ const props = defineProps({
1918
},
2019
})
2120
22-
function hasLeftIcon() {
23-
return props.context?.iconLeft && props.context?.iconLeft.length > 0
24-
}
25-
26-
function hasRightIcon() {
27-
return props.context?.iconRight && props.context?.iconRight.length > 0
28-
}
29-
30-
function spanClass() {
31-
let result = ''
32-
if (hasLeftIcon())
33-
result = `p-formkit-icon ${result}p-input-icon-left `
34-
if (hasRightIcon())
35-
result = `p-formkit-icon ${result}p-input-icon-right `
36-
return result
21+
function hasIcon() {
22+
return props.context?.attrs?.icon && props.context?.attrs?.icon.length > 0
3723
}
3824
3925
function handleBlur(e: Event) {
@@ -49,13 +35,13 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
4935

5036
<template>
5137
<div class="p-formkit">
52-
<span :class="spanClass()">
53-
<i v-if="hasLeftIcon()" :class="context?.iconLeft" />
54-
38+
{{ context.attrs.icon }}
39+
<IconField v-if="hasIcon()" :icon-position="context?.attrs.iconPosition">
40+
<InputIcon :class="context.attrs.icon" />
5541
<InputText
5642
:id="context.id"
5743
v-model="context._value"
58-
v-bind="context.attrs"
44+
v-bind="context?.attrs"
5945
:disabled="!!context?.disabled"
6046
:readonly="context?.attrs._readonly ?? false"
6147
:style="context?.attrs.style"
@@ -70,7 +56,25 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
7056
@input="handleInput"
7157
@blur="handleBlur"
7258
/>
73-
<i v-if="hasRightIcon()" :class="context?.iconRight" />
74-
</span>
59+
</IconField>
60+
<InputText
61+
v-else
62+
:id="context.id"
63+
v-model="context._value"
64+
v-bind="context?.attrs"
65+
:disabled="!!context?.disabled"
66+
:readonly="context?.attrs._readonly ?? false"
67+
:style="context?.attrs.style"
68+
:class="styleClass"
69+
:tabindex="context?.attrs.tabindex"
70+
:aria-label="context?.attrs.ariaLabel"
71+
:aria-labelledby="context?.attrs.ariaLabelledby"
72+
:placeholder="context.placeholder"
73+
:pt="context.pt"
74+
:pt-options="context.ptOptions"
75+
:unstyled="context.unstyled ?? false"
76+
@input="handleInput"
77+
@blur="handleBlur"
78+
/>
7579
</div>
7680
</template>

src/components/PrimeKnob.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const styleClass = computed(() => (props.context?.state.validationVisible && !pr
4343
<Knob
4444
:id="context.id"
4545
v-model="context._value"
46-
v-bind="context.attrs"
46+
v-bind="context?.attrs"
4747
:disabled="!!context?.disabled"
4848
:readonly="context?.attrs._readonly ?? false"
4949
:style="context?.attrs.style"

0 commit comments

Comments
 (0)