Skip to content

Commit

Permalink
add textAlign option
Browse files Browse the repository at this point in the history
  • Loading branch information
neferin12 committed Feb 19, 2021
1 parent 027050b commit 8af367a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ pnpm-debug.log*
/demoDist.zip
/demo/
/demo.zip
/test-results.xml
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export default {
});
},
isWizardSelected() {
return this.form === forms["Showcase"];
return this.form === forms["Wizard"];
}
},
data() {
return {
form: forms["5 Sicherheitsregeln"]
form: forms["Showcase"]
}
},
created() {
Expand Down
10 changes: 9 additions & 1 deletion src/components/FormFields/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<component :is="type" :isInteger="item.type === 'integer'" :json="json" :name="title"
:required="required"
:ui="ui" @changedData="loopUp" ref="child" :filledData="filledData"
:autocomplete="(ui.options ||{}).autocomplete || 'on'"/>
:autocomplete="(ui.options ||{}).autocomplete || 'on'"
:style="cssStyle"/>
<b-input-group-append :is-text="!noText" v-if="hasSlot()">
<!-- Content is appended to the input field-->
<slot></slot>
Expand Down Expand Up @@ -99,6 +100,13 @@ export default {
default:
return defaultField;
}
},
cssStyle() {
if (this.ui.options?.textAlign) {
return 'text-align: ' + this.ui.options?.textAlign;
} else {
return '';
}
}
},
}
Expand Down
5 changes: 4 additions & 1 deletion src/exampleSchemas/showcase/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@
},
{
"type": "Control",
"scope": "#/properties/recurrence_interval"
"scope": "#/properties/recurrence_interval",
"options": {
"textAlign": "right"
}
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions src/schemas/ui/control.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@
"autocomplete": {
"type": "string",
"description": "Specifies what should be autocompleted by the browser. Possible values are listed here: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values"
},
"textAlign": {
"type": "string",
"enum": ["left", "right", "center", "start", "end"],
"description": "Set the text-align of input fields"
}
}
},
Expand Down

0 comments on commit 8af367a

Please sign in to comment.