Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: third_party/polymer/v0_8/components-chromium/paper-input/paper-input-container-extracted.js

Issue 1155683008: Rename polymer and cr_elements v0_8 to v1_0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v1
Patch Set: fix a merge mistake Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v0_8/components-chromium/paper-input/paper-input-container-extracted.js
diff --git a/third_party/polymer/v0_8/components-chromium/paper-input/paper-input-container-extracted.js b/third_party/polymer/v0_8/components-chromium/paper-input/paper-input-container-extracted.js
deleted file mode 100644
index 3b30b2cc5e100df0df99cdffda81ff67c431c592..0000000000000000000000000000000000000000
--- a/third_party/polymer/v0_8/components-chromium/paper-input/paper-input-container-extracted.js
+++ /dev/null
@@ -1,249 +0,0 @@
-
-(function() {
-
- Polymer({
-
- is: 'paper-input-container',
-
- properties: {
-
- /**
- * Set to true to disable the floating label. The label disappears when the input value is
- * not null.
- */
- noLabelFloat: {
- type: Boolean,
- value: false
- },
-
- /**
- * Set to true to always float the floating label.
- */
- alwaysFloatLabel: {
- type: Boolean,
- value: false
- },
-
- /**
- * The attribute to listen for value changes on.
- */
- attrForValue: {
- type: String,
- value: 'bind-value'
- },
-
- /**
- * Set to true to auto-validate the input value when it changes.
- */
- autoValidate: {
- type: Boolean,
- value: false
- },
-
- /**
- * True if the input is invalid. This property is set automatically when the input value
- * changes if auto-validating, or when the `iron-input-valid` event is heard from a child.
- */
- invalid: {
- observer: '_invalidChanged',
- type: Boolean,
- value: false
- },
-
- /**
- * True if the input has focus.
- */
- focused: {
- readOnly: true,
- type: Boolean,
- value: false
- },
-
- _addons: {
- type: Array,
- value: function() {
- return [];
- }
- },
-
- _inputHasContent: {
- type: Boolean,
- value: false
- },
-
- _inputSelector: {
- type: String,
- value: 'input,textarea,.paper-input-input'
- },
-
- _boundOnFocus: {
- type: Function,
- value: function() {
- return this._onFocus.bind(this);
- }
- },
-
- _boundOnBlur: {
- type: Function,
- value: function() {
- return this._onBlur.bind(this);
- }
- },
-
- _boundOnInput: {
- type: Function,
- value: function() {
- this._onInput.bind(this)
- }
- },
-
- _boundValueChanged: {
- type: Function,
- value: function() {
- return this._onValueChanged.bind(this);
- }
- }
-
- },
-
- listeners: {
- 'addon-attached': '_onAddonAttached',
- 'iron-input-validate': '_onIronInputValidate'
- },
-
- get _valueChangedEvent() {
- return this.attrForValue + '-changed';
- },
-
- get _propertyForValue() {
- return Polymer.CaseMap.dashToCamelCase(this.attrForValue);
- },
-
- get _inputElement() {
- return Polymer.dom(this).querySelector(this._inputSelector);
- },
-
- ready: function() {
- this.addEventListener('focus', this._boundOnFocus, true);
- this.addEventListener('blur', this._boundOnBlur, true);
- if (this.attrForValue) {
- this._inputElement.addEventListener(this._valueChangedEvent, this._boundValueChanged);
- } else {
- this.addEventListener('input', this._onInput);
- }
- },
-
- attached: function() {
- this._handleValue(this._inputElement);
- },
-
- _onAddonAttached: function(event) {
- this._addons.push(event.target);
- this._handleValue(this._inputElement);
- },
-
- _onFocus: function() {
- this._setFocused(true);
- },
-
- _onBlur: function() {
- this._setFocused(false);
- },
-
- _onInput: function(event) {
- this._handleValue(event.target);
- },
-
- _onValueChanged: function(event) {
- this._handleValue(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;
- }
-
- // type="number" hack needed because this.value is empty until it's valid
- if (value || (inputElement.type === 'number' && !inputElement.checkValidity())) {
- this._inputHasContent = true;
- } else {
- this._inputHasContent = false;
- }
-
- this.updateAddons({
- inputElement: inputElement,
- value: value,
- invalid: this.invalid
- });
- },
-
- _onIronInputValidate: function(event) {
- this.invalid = this._inputElement.invalid;
- },
-
- _invalidChanged: function() {
- if (this._addons) {
- this.updateAddons({invalid: this.invalid});
- }
- },
-
- /**
- * Call this to update the state of add-ons.
- * @param {Object} state Add-on state.
- */
- updateAddons: function(state) {
- for (var addon, index = 0; addon = this._addons[index]; index++) {
- addon.update(state);
- }
- },
-
- _computeInputContentClass: function(noLabelFloat, alwaysFloatLabel, focused, invalid, _inputHasContent) {
- var cls = 'input-content';
- if (!noLabelFloat) {
- if (alwaysFloatLabel || _inputHasContent) {
- cls += ' label-is-floating';
- if (invalid) {
- cls += ' is-invalid';
- } else if (focused) {
- cls += " label-is-highlighted";
- }
- }
- } else {
- if (_inputHasContent) {
- cls += ' label-is-hidden';
- }
- }
- return cls;
- },
-
- _computeUnderlineClass: function(focused, invalid) {
- var cls = 'underline';
- if (invalid) {
- cls += ' is-invalid';
- } else if (focused) {
- cls += ' is-highlighted'
- }
- return cls;
- },
-
- _computeAddOnContentClass: function(focused, invalid) {
- var cls = 'add-on-content';
- if (invalid) {
- cls += ' is-invalid';
- } else if (focused) {
- cls += ' is-highlighted'
- }
- return cls;
- }
-
- });
-
-})();

Powered by Google App Engine
This is Rietveld 408576698