input/text: add align & wrap props (feature request #176)
This commit is contained in:
parent
3dd4dae84c
commit
97d495647b
7 changed files with 49 additions and 5 deletions
|
|
@ -28,6 +28,7 @@ module.exports = class Input extends Canvas {
|
|||
_input:'input',
|
||||
|
||||
vertical:false,
|
||||
align: '',
|
||||
unit: '',
|
||||
editable:true,
|
||||
|
||||
|
|
@ -59,9 +60,10 @@ module.exports = class Input extends Canvas {
|
|||
this.stringValue = ''
|
||||
this.focused = false
|
||||
|
||||
if (this.getProp('vertical')) {
|
||||
this.widget.classList.add('vertical')
|
||||
}
|
||||
if (this.getProp('vertical')) this.widget.classList.add('vertical')
|
||||
if (this.getProp('align') === 'left') this.widget.classList.add('left')
|
||||
if (this.getProp('align') === 'right') this.widget.classList.add('right')
|
||||
|
||||
|
||||
if (this.getProp('editable')) {
|
||||
this.canvas.setAttribute('tabindex', 0)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ module.exports = class Text extends Widget {
|
|||
_text: 'text',
|
||||
|
||||
vertical:false,
|
||||
wrap:false,
|
||||
align:'',
|
||||
|
||||
_value: 'value',
|
||||
default: '',
|
||||
|
|
@ -50,6 +52,9 @@ module.exports = class Text extends Widget {
|
|||
super({...options, html: '<div class="text"></div>'})
|
||||
|
||||
if (this.getProp('vertical')) this.widget.classList.add('vertical')
|
||||
if (this.getProp('align') === 'left') this.widget.classList.add('left')
|
||||
if (this.getProp('align') === 'right') this.widget.classList.add('right')
|
||||
if (this.getProp('wrap')) this.widget.classList.add('wrap')
|
||||
|
||||
this.defaultValue = this.getProp('value') || ( this.getProp('label')===false ?
|
||||
this.getProp('id'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue