mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
c3069b933f
commit
bc4468cb40
56 changed files with 290 additions and 145 deletions
|
@ -350,7 +350,8 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
focused: {
|
||||
readOnly: true,
|
||||
type: Boolean,
|
||||
value: false
|
||||
value: false,
|
||||
notify: true
|
||||
},
|
||||
|
||||
_addons: {
|
||||
|
@ -417,6 +418,10 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
return Polymer.dom(this).querySelector(this._inputSelector);
|
||||
},
|
||||
|
||||
get _inputElementValue() {
|
||||
return this._inputElement[this._propertyForValue] || this._inputElement.value;
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
if (!this._addons) {
|
||||
this._addons = [];
|
||||
|
@ -431,7 +436,12 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
},
|
||||
|
||||
attached: function() {
|
||||
this._handleValue(this._inputElement);
|
||||
// Only validate when attached if the input already has a value.
|
||||
if (this._inputElementValue != '') {
|
||||
this._handleValueAndAutoValidate(this._inputElement);
|
||||
} else {
|
||||
this._handleValue(this._inputElement);
|
||||
}
|
||||
},
|
||||
|
||||
_onAddonAttached: function(event) {
|
||||
|
@ -453,28 +463,19 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
|
||||
_onBlur: function() {
|
||||
this._setFocused(false);
|
||||
this._handleValueAndAutoValidate(this._inputElement);
|
||||
},
|
||||
|
||||
_onInput: function(event) {
|
||||
this._handleValue(event.target);
|
||||
this._handleValueAndAutoValidate(event.target);
|
||||
},
|
||||
|
||||
_onValueChanged: function(event) {
|
||||
this._handleValue(event.target);
|
||||
this._handleValueAndAutoValidate(event.target);
|
||||
},
|
||||
|
||||
_handleValue: function(inputElement) {
|
||||
var value = inputElement[this._propertyForValue] || inputElement.value;
|
||||
|
||||
if (this.autoValidate) {
|
||||
var valid;
|
||||
if (inputElement.validate) {
|
||||
valid = inputElement.validate(value);
|
||||
} else {
|
||||
valid = inputElement.checkValidity();
|
||||
}
|
||||
this.invalid = !valid;
|
||||
}
|
||||
var value = this._inputElementValue;
|
||||
|
||||
// type="number" hack needed because this.value is empty until it's valid
|
||||
if (value || value === 0 || (inputElement.type === 'number' && !inputElement.checkValidity())) {
|
||||
|
@ -490,6 +491,21 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
});
|
||||
},
|
||||
|
||||
_handleValueAndAutoValidate: function(inputElement) {
|
||||
if (this.autoValidate) {
|
||||
var valid;
|
||||
if (inputElement.validate) {
|
||||
valid = inputElement.validate(this._inputElementValue);
|
||||
} else {
|
||||
valid = inputElement.checkValidity();
|
||||
}
|
||||
this.invalid = !valid;
|
||||
}
|
||||
|
||||
// Call this last to notify the add-ons.
|
||||
this._handleValue(inputElement);
|
||||
},
|
||||
|
||||
_onIronInputValidate: function(event) {
|
||||
this.invalid = this._inputElement.invalid;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue