1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2015-08-22 11:54:29 -04:00
parent c3069b933f
commit bc4468cb40
56 changed files with 290 additions and 145 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.11",
"version": "1.0.12",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"
@ -44,11 +44,11 @@
"iron-icon": "PolymerElements/iron-icon#^1.0.0",
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0"
},
"_release": "1.0.11",
"_release": "1.0.12",
"_resolution": {
"type": "version",
"tag": "v1.0.11",
"commit": "a7af749e55fff7599d2ad9da47c86b286e9e2d6f"
"tag": "v1.0.12",
"commit": "bcfc2998c1e83d0c2ad7206e84717ae98145c45a"
},
"_source": "git://github.com/polymerelements/paper-input.git",
"_target": "^1.0.9",

View file

@ -1,6 +1,6 @@
{
"name": "paper-input",
"version": "1.0.11",
"version": "1.0.12",
"description": "Material design text fields",
"authors": [
"The Polymer Authors"

View file

@ -73,6 +73,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<h4>Validation</h4>
<div class="vertical-section">
<paper-input label="input validates on blur (required, auto-validate)" required auto-validate error-message="needs some text!"></paper-input>
<paper-input label="only type letters (auto-validate)" auto-validate pattern="[a-zA-Z]*" error-message="letters only!"></paper-input>
<paper-input id="inputForValidation" required label="only type letters (no auto validate)" pattern="[a-zA-Z]*" error-message="letters only, required input!"></paper-input>

View file

@ -321,10 +321,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Validates the input element and sets an error style if needed.
*
* @return {boolean}
*/
validate: function() {
return this.inputElement.validate();
},
validate: function() {
return this.inputElement.validate();
},
/**
* If `autoValidate` is true, then validates the element.
*/
_handleAutoValidate: function() {
if (this.autoValidate)
this.validate();
},
/**
* Restores the cursor to its original position after updating the value.

View file

@ -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;
},

View file

@ -33,6 +33,11 @@ style this element.
<dom-module id="paper-textarea">
<template>
<style>
:host {
display: block;
}
</style>
<paper-input-container no-label-float$="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">