image: add repeat option; add docs
text: fix default value (retreive value prop)
This commit is contained in:
parent
c403d22fdf
commit
97101f80fe
5 changed files with 71 additions and 11 deletions
|
|
@ -122,10 +122,11 @@ var Parser = class Parser {
|
|||
widgetContainer.find('> .label').html(label)
|
||||
}
|
||||
|
||||
// parse scoped css
|
||||
// parse css
|
||||
var css = ';' + widgetInner.getProp('css'),
|
||||
scopedCss = ''
|
||||
|
||||
// parse scoped css
|
||||
css = css.replace(/[;\}\s]*([^;\{]*\{[^\}]*\})/g, (m)=>{
|
||||
m = m.replace(/^[;\}\s]*/,'')
|
||||
if (m[0]=='&') {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ module.exports = class Led extends _widgets_base {
|
|||
|
||||
size: 'cover',
|
||||
position: 'center',
|
||||
repeat: 'no-repeat',
|
||||
border: true,
|
||||
cache: true,
|
||||
value:'',
|
||||
|
|
@ -51,26 +52,35 @@ module.exports = class Led extends _widgets_base {
|
|||
|
||||
this.widget[0].style.setProperty('background-size', this.getProp('size'))
|
||||
this.widget[0].style.setProperty('background-position', this.getProp('position'))
|
||||
this.widget[0].style.setProperty('background-repeat', this.getProp('repeat'))
|
||||
|
||||
|
||||
}
|
||||
|
||||
setValue(v) {
|
||||
|
||||
var s = '' + v
|
||||
var s = v==null ? '' : '' + v,
|
||||
cache_query = ''
|
||||
|
||||
this.value = s
|
||||
if (!s.length) {
|
||||
|
||||
this.value = this.getProp('value')
|
||||
|
||||
} else if (s != 'reload') {
|
||||
|
||||
if (s.length > 1) this.value = s
|
||||
|
||||
}
|
||||
|
||||
if (this.value.length) {
|
||||
|
||||
var cache_query = this.getProp('cache') || s.indexOf('base64') != -1 ? '' : (s.indexOf('?') != -1 ? '&' : '?') + Date.now()
|
||||
this.widget[0].style.setProperty('background-image', `url(${s}${cache_query})`)
|
||||
|
||||
} else {
|
||||
|
||||
this.widget[0].style.setProperty('background-image', '')
|
||||
cache_query = this.getProp('cache') || this.value.indexOf('base64') != -1 ?
|
||||
'' : (this.value.indexOf('?') != -1 ? '&' : '?') + Date.now()
|
||||
|
||||
}
|
||||
|
||||
this.widget[0].style.setProperty('background-image', `url(${this.value}${cache_query})`)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ module.exports = class Text extends _widgets_base {
|
|||
|
||||
if (this.getProp('vertical')) this.widget.addClass('vertical')
|
||||
|
||||
this.defaultValue = this.getProp('label')===false?
|
||||
this.defaultValue = this.getProp('value') || ( this.getProp('label')===false ?
|
||||
this.getProp('id'):
|
||||
this.getProp('label')=='auto'?
|
||||
this.getProp('id'):
|
||||
this.getProp('label')
|
||||
this.getProp('label') )
|
||||
|
||||
this.value = this.defaultValue
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue