Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit c5b522e

Browse files
authored
Merge pull request #183 from asigloo/feature/readonly-attr
feat(input): added readonly attr
2 parents 7d7fd1c + 20dba55 commit c5b522e

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

dev/typescript/App.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export default defineComponent({
9797
'color',
9898
'customField1',
9999
'customStyles',
100+
'readonly',
100101
],
101102
fields: {
102103
name: {
@@ -109,16 +110,10 @@ export default defineComponent({
109110
label: 'Email',
110111
type: 'email',
111112
validations: [emailValidator],
112-
/* customClass: 'active text-red', */
113113
customClass: {
114114
active: true,
115115
'text-blue': true,
116116
},
117-
/* customClass: {
118-
active: true,
119-
'text-blue': true,
120-
}, */
121-
/* customClass: ['active', 'text-red'], */
122117
} as EmailInput,
123118
password: {
124119
label: 'Password',
@@ -208,6 +203,12 @@ export default defineComponent({
208203
border: '1px solid teal',
209204
},
210205
} as TextInput,
206+
readonly: {
207+
label: 'Readonly',
208+
type: 'text',
209+
value: 'Alvaro',
210+
readonly: true,
211+
} as TextInput,
211212
},
212213
});
213214

src/components/number-input/NumberInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default defineComponent({
2626
disabled: props?.control?.disabled,
2727
placeholder: props?.control?.placeholder,
2828
required: props.control.required,
29+
readonly: props?.control.readonly,
2930
autocomplete: props.control.autocomplete,
3031
ariaLabel: props.control.ariaLabel,
3132
ariaLabelledBy: props.control.ariaLabelledBy,

src/components/select-input/SelectInput.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ export default defineComponent({
2222
{
2323
id: props.control.name,
2424
name: props?.control?.name || '',
25+
class: ['form-control'],
26+
value: props?.control?.value,
2527
disabled: props?.control?.disabled,
2628
placeholder: props?.control?.placeholder,
2729
required: props.control.required,
30+
readonly: props?.control.readonly,
31+
ariaLabel: props.control.ariaLabel,
32+
ariaLabelledBy: props.control.ariaLabelledBy,
2833
ariaRequired: props.control.required,
29-
class: ['form-control'],
30-
value: props?.control?.value,
3134
onFocus,
3235
onBlur,
3336
onChange,

src/components/text-area-input/TextAreaInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default defineComponent({
2424
placeholder: props?.control?.placeholder,
2525
required: props.control.required,
2626
autocomplete: props.control.autocomplete,
27+
readonly: props?.control.readonly,
2728
ariaLabel: props.control.ariaLabel,
2829
ariaLabelledBy: props.control.ariaLabelledBy,
2930
ariaRequired: props.control.required,

src/components/text-input/TextInput.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default defineComponent({
3232
disabled: props.control.disabled,
3333
placeholder: props.control.placeholder,
3434
required: props.control.required,
35+
readonly: props?.control.readonly,
3536
autocomplete: props.control.autocomplete,
3637
ariaRequired: props.control.required,
3738
ariaLabel: props.control.ariaLabel,

src/core/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface InputBase {
5454
customStyles?: string | string[] | BindingObject | BindingObject[] | unknown;
5555
placeholder?: string;
5656
autocomplete?: string;
57+
readonly?: boolean;
5758
validations?: FormValidation[];
5859
}
5960

0 commit comments

Comments
 (0)