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
3e1f88f0b9
commit
2776720c6f
26 changed files with 291 additions and 213 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-input",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "An input element with data binding",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -33,11 +33,11 @@
|
|||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.3",
|
||||
"_release": "1.0.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.3",
|
||||
"commit": "edb505f41d67120cb505deedb92aa69e90078d2f"
|
||||
"tag": "v1.0.4",
|
||||
"commit": "eebeeb1642ab3e9b1abd5012c1df038250741184"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-input.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-input",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "An input element with data binding",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
|
|
@ -41,7 +41,7 @@ It may be desirable to only allow users to enter certain characters. You can use
|
|||
is separate from validation, and `allowed-pattern` does not affect how the input is validated.
|
||||
|
||||
<!-- only allow characters that match [0-9] -->
|
||||
<input is="iron-input" prevent-invaild-input allowed-pattern="[0-9]">
|
||||
<input is="iron-input" prevent-invalid-input allowed-pattern="[0-9]">
|
||||
|
||||
@hero hero.svg
|
||||
@demo demo/index.html
|
||||
|
@ -154,11 +154,16 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
// always matches the charCode.
|
||||
// None of this makes any sense.
|
||||
|
||||
var nonPrintable =
|
||||
// For these keys, ASCII code == browser keycode.
|
||||
var anyNonPrintable =
|
||||
(event.keyCode == 8) || // backspace
|
||||
(event.keyCode == 13) || // enter
|
||||
(event.keyCode == 27); // escape
|
||||
|
||||
// For these keys, make sure it's a browser keycode and not an ASCII code.
|
||||
var mozNonPrintable =
|
||||
(event.keyCode == 19) || // pause
|
||||
(event.keyCode == 20) || // caps lock
|
||||
(event.keyCode == 27) || // escape
|
||||
(event.keyCode == 45) || // insert
|
||||
(event.keyCode == 46) || // delete
|
||||
(event.keyCode == 144) || // num lock
|
||||
|
@ -166,7 +171,7 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
(event.keyCode > 32 && event.keyCode < 41) || // page up/down, end, home, arrows
|
||||
(event.keyCode > 111 && event.keyCode < 124); // fn keys
|
||||
|
||||
return !(event.charCode == 0 && nonPrintable);
|
||||
return !anyNonPrintable && !(event.charCode == 0 && mozNonPrintable);
|
||||
},
|
||||
|
||||
_onKeypress: function(event) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
@ -24,11 +24,11 @@
|
|||
},
|
||||
"private": true,
|
||||
"homepage": "https://github.com/Polymer/polymer",
|
||||
"_release": "1.0.6",
|
||||
"_release": "1.0.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "953fcba374812690c279abdacbfaf61e3e3aa347"
|
||||
"tag": "v1.0.7",
|
||||
"commit": "b39d0015ce5428232409eb3aca7ddefea899f894"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/polymer.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
|
|
@ -576,7 +576,8 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
ev.preventDefault();
|
||||
//This breaks scrolling in safari
|
||||
//ev.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.7.6",
|
||||
"version": "0.7.7",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -15,11 +15,11 @@
|
|||
],
|
||||
"license": "BSD",
|
||||
"ignore": [],
|
||||
"_release": "0.7.6",
|
||||
"_release": "0.7.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.7.6",
|
||||
"commit": "401764710ac11f9ed8a175195107752af2f72eb6"
|
||||
"tag": "v0.7.7",
|
||||
"commit": "274327b631eeb8b48d49702e1f1570d5ce7fb93d"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/webcomponentsjs.git",
|
||||
"_target": "^0.7.2",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
@ -761,17 +761,23 @@ window.CustomElements.addModule(function(scope) {
|
|||
var nativePrototype = HTMLElement.prototype;
|
||||
if (definition.is) {
|
||||
var inst = document.createElement(definition.tag);
|
||||
var expectedPrototype = Object.getPrototypeOf(inst);
|
||||
if (expectedPrototype === definition.prototype) {
|
||||
nativePrototype = expectedPrototype;
|
||||
}
|
||||
nativePrototype = Object.getPrototypeOf(inst);
|
||||
}
|
||||
var proto = definition.prototype, ancestor;
|
||||
while (proto && proto !== nativePrototype) {
|
||||
var foundPrototype = false;
|
||||
while (proto) {
|
||||
if (proto == nativePrototype) {
|
||||
foundPrototype = true;
|
||||
}
|
||||
ancestor = Object.getPrototypeOf(proto);
|
||||
if (ancestor) {
|
||||
proto.__proto__ = ancestor;
|
||||
}
|
||||
proto = ancestor;
|
||||
}
|
||||
if (!foundPrototype) {
|
||||
console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
||||
}
|
||||
definition.native = nativePrototype;
|
||||
}
|
||||
}
|
||||
|
@ -833,6 +839,9 @@ window.CustomElements.addModule(function(scope) {
|
|||
var isInstance;
|
||||
if (!Object.__proto__ && !useNative) {
|
||||
isInstance = function(obj, ctor) {
|
||||
if (obj instanceof ctor) {
|
||||
return true;
|
||||
}
|
||||
var p = obj;
|
||||
while (p) {
|
||||
if (p === ctor.prototype) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
if (typeof WeakMap === "undefined") {
|
||||
(function() {
|
||||
var defineProperty = Object.defineProperty;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "webcomponentsjs",
|
||||
"main": "webcomponents.js",
|
||||
"version": "0.7.6",
|
||||
"version": "0.7.7",
|
||||
"homepage": "http://webcomponents.org",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webcomponents.js",
|
||||
"version": "0.7.6",
|
||||
"version": "0.7.7",
|
||||
"description": "webcomponents.js",
|
||||
"main": "webcomponents.js",
|
||||
"directories": {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
window.WebComponents = window.WebComponents || {};
|
||||
|
||||
(function(scope) {
|
||||
|
@ -29,7 +29,7 @@ window.WebComponents = window.WebComponents || {};
|
|||
}
|
||||
}
|
||||
}
|
||||
if (flags.log && flags.log.split) {
|
||||
if (flags.log) {
|
||||
var parts = flags.log.split(",");
|
||||
flags.log = {};
|
||||
parts.forEach(function(f) {
|
||||
|
@ -2072,17 +2072,23 @@ window.CustomElements.addModule(function(scope) {
|
|||
var nativePrototype = HTMLElement.prototype;
|
||||
if (definition.is) {
|
||||
var inst = document.createElement(definition.tag);
|
||||
var expectedPrototype = Object.getPrototypeOf(inst);
|
||||
if (expectedPrototype === definition.prototype) {
|
||||
nativePrototype = expectedPrototype;
|
||||
}
|
||||
nativePrototype = Object.getPrototypeOf(inst);
|
||||
}
|
||||
var proto = definition.prototype, ancestor;
|
||||
while (proto && proto !== nativePrototype) {
|
||||
var foundPrototype = false;
|
||||
while (proto) {
|
||||
if (proto == nativePrototype) {
|
||||
foundPrototype = true;
|
||||
}
|
||||
ancestor = Object.getPrototypeOf(proto);
|
||||
if (ancestor) {
|
||||
proto.__proto__ = ancestor;
|
||||
}
|
||||
proto = ancestor;
|
||||
}
|
||||
if (!foundPrototype) {
|
||||
console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
||||
}
|
||||
definition.native = nativePrototype;
|
||||
}
|
||||
}
|
||||
|
@ -2144,6 +2150,9 @@ window.CustomElements.addModule(function(scope) {
|
|||
var isInstance;
|
||||
if (!Object.__proto__ && !useNative) {
|
||||
isInstance = function(obj, ctor) {
|
||||
if (obj instanceof ctor) {
|
||||
return true;
|
||||
}
|
||||
var p = obj;
|
||||
while (p) {
|
||||
if (p === ctor.prototype) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
|||
* Code distributed by Google as part of the polymer project is also
|
||||
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
*/
|
||||
// @version 0.7.6
|
||||
// @version 0.7.7
|
||||
window.WebComponents = window.WebComponents || {};
|
||||
|
||||
(function(scope) {
|
||||
|
@ -6841,17 +6841,23 @@ window.CustomElements.addModule(function(scope) {
|
|||
var nativePrototype = HTMLElement.prototype;
|
||||
if (definition.is) {
|
||||
var inst = document.createElement(definition.tag);
|
||||
var expectedPrototype = Object.getPrototypeOf(inst);
|
||||
if (expectedPrototype === definition.prototype) {
|
||||
nativePrototype = expectedPrototype;
|
||||
}
|
||||
nativePrototype = Object.getPrototypeOf(inst);
|
||||
}
|
||||
var proto = definition.prototype, ancestor;
|
||||
while (proto && proto !== nativePrototype) {
|
||||
var foundPrototype = false;
|
||||
while (proto) {
|
||||
if (proto == nativePrototype) {
|
||||
foundPrototype = true;
|
||||
}
|
||||
ancestor = Object.getPrototypeOf(proto);
|
||||
if (ancestor) {
|
||||
proto.__proto__ = ancestor;
|
||||
}
|
||||
proto = ancestor;
|
||||
}
|
||||
if (!foundPrototype) {
|
||||
console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is);
|
||||
}
|
||||
definition.native = nativePrototype;
|
||||
}
|
||||
}
|
||||
|
@ -6913,6 +6919,9 @@ window.CustomElements.addModule(function(scope) {
|
|||
var isInstance;
|
||||
if (!Object.__proto__ && !useNative) {
|
||||
isInstance = function(obj, ctor) {
|
||||
if (obj instanceof ctor) {
|
||||
return true;
|
||||
}
|
||||
var p = obj;
|
||||
while (p) {
|
||||
if (p === ctor.prototype) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -72,8 +72,8 @@
|
|||
}
|
||||
|
||||
.pageWithAbsoluteTabs .pageTabContent {
|
||||
padding-left: .3em !important;
|
||||
padding-right: .3em !important;
|
||||
padding-left: .25em !important;
|
||||
padding-right: .25em !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<form class="editItemMetadataForm editMetadataForm">
|
||||
<div class="metadataFormFields">
|
||||
|
||||
<div style="margin:2em 0 .5em;">
|
||||
<div style="margin:2em 0 .5em;text-align:center;">
|
||||
|
||||
<paper-button raised class="submit">
|
||||
<button class="btnSave clearButton" type="submit" data-role="none" style="display:inline-block;">
|
||||
|
@ -426,7 +426,7 @@
|
|||
</neon-animatable>
|
||||
<neon-animatable>
|
||||
<div class="editorTab imageEditorTab">
|
||||
<div style="margin:2em 0 .5em;">
|
||||
<div style="margin:2em 0 .5em;text-align:center;">
|
||||
|
||||
<paper-button raised class="subdued btnBrowseAllImages"><iron-icon icon="cloud"></iron-icon><span>${ButtonBrowseImages}</span></paper-button>
|
||||
<paper-button raised class="subdued btnOpenUploadMenu"><iron-icon icon="add"></iron-icon><span>${ButtonUpload}</span></paper-button>
|
||||
|
|
|
@ -738,7 +738,7 @@
|
|||
var html = '';
|
||||
|
||||
tasks = tasks.filter(function (t) {
|
||||
return t.State != 'Idle';
|
||||
return t.State != 'Idle' && !t.IsHidden;
|
||||
});
|
||||
|
||||
if (tasks.filter(function (t) {
|
||||
|
|
|
@ -1375,7 +1375,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function showMoreMenu(page) {
|
||||
function showMoreMenu(page, elem) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
|
@ -1401,6 +1401,7 @@
|
|||
|
||||
ActionSheetElement.show({
|
||||
items: menuItems,
|
||||
positionTo: elem,
|
||||
callback: function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
@ -1499,7 +1500,7 @@
|
|||
page.querySelector('.btnMore iron-icon').icon = AppInfo.moreIcon;
|
||||
|
||||
$('.btnMore', page).on('click', function () {
|
||||
showMoreMenu(page);
|
||||
showMoreMenu(page, this);
|
||||
});
|
||||
|
||||
}).on('pageshowready', "#editItemMetadataPage", function () {
|
||||
|
|
|
@ -75,7 +75,11 @@ document.registerElement(prototype.is, options);
|
|||
return ctor;
|
||||
};
|
||||
var desugar = function (prototype) {
|
||||
prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
|
||||
var base = Polymer.Base;
|
||||
if (prototype.extends) {
|
||||
base = Polymer.Base._getExtendedPrototype(prototype.extends);
|
||||
}
|
||||
prototype = Polymer.Base.chainObject(prototype, base);
|
||||
prototype.registerCallback();
|
||||
return prototype.constructor;
|
||||
};
|
||||
|
@ -108,6 +112,7 @@ return (document._currentScript || document.currentScript).ownerDocument;
|
|||
}
|
||||
});
|
||||
Polymer.Base = {
|
||||
__isPolymerInstance__: true,
|
||||
_addFeature: function (feature) {
|
||||
this.extend(this, feature);
|
||||
},
|
||||
|
@ -177,6 +182,16 @@ object.__proto__ = inherited;
|
|||
return object;
|
||||
};
|
||||
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
||||
if (window.CustomElements) {
|
||||
Polymer.instanceof = CustomElements.instanceof;
|
||||
} else {
|
||||
Polymer.instanceof = function (obj, ctor) {
|
||||
return obj instanceof ctor;
|
||||
};
|
||||
}
|
||||
Polymer.isInstance = function (obj) {
|
||||
return Boolean(obj && obj.__isPolymerInstance__);
|
||||
};
|
||||
Polymer.telemetry.instanceCount = 0;
|
||||
(function () {
|
||||
var modules = {};
|
||||
|
@ -305,11 +320,6 @@ this._marshalBehavior(this);
|
|||
}
|
||||
});
|
||||
Polymer.Base._addFeature({
|
||||
_prepExtends: function () {
|
||||
if (this.extends) {
|
||||
this.__proto__ = this._getExtendedPrototype(this.extends);
|
||||
}
|
||||
},
|
||||
_getExtendedPrototype: function (tag) {
|
||||
return this._getExtendedNativePrototype(tag);
|
||||
},
|
||||
|
@ -522,13 +532,12 @@ debouncer.stop();
|
|||
}
|
||||
}
|
||||
});
|
||||
Polymer.version = '1.0.6';
|
||||
Polymer.version = '1.0.7';
|
||||
Polymer.Base._addFeature({
|
||||
_registerFeatures: function () {
|
||||
this._prepIs();
|
||||
this._prepAttributes();
|
||||
this._prepBehaviors();
|
||||
this._prepExtends();
|
||||
this._prepConstructor();
|
||||
},
|
||||
_prepBehavior: function (b) {
|
||||
|
@ -1288,7 +1297,7 @@ d.appendChild(nc);
|
|||
return n;
|
||||
},
|
||||
importNode: function (externalNode, deep) {
|
||||
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
|
||||
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
||||
var n = nativeImportNode.call(doc, externalNode, false);
|
||||
if (deep) {
|
||||
var c$ = factory(externalNode).childNodes;
|
||||
|
@ -1476,15 +1485,15 @@ DomApi.prototype.cloneNode = function (deep) {
|
|||
return this.node.cloneNode(deep);
|
||||
};
|
||||
DomApi.prototype.importNode = function (externalNode, deep) {
|
||||
var doc = this.node instanceof HTMLDocument ? this.node : this.node.ownerDocument;
|
||||
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
||||
return doc.importNode(externalNode, deep);
|
||||
};
|
||||
DomApi.prototype.getDestinationInsertionPoints = function () {
|
||||
var n$ = this.node.getDestinationInsertionPoints();
|
||||
var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
|
||||
return n$ ? Array.prototype.slice.call(n$) : [];
|
||||
};
|
||||
DomApi.prototype.getDistributedNodes = function () {
|
||||
var n$ = this.node.getDistributedNodes();
|
||||
var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
|
||||
return n$ ? Array.prototype.slice.call(n$) : [];
|
||||
};
|
||||
DomApi.prototype._distributeParent = function () {
|
||||
|
@ -1942,7 +1951,6 @@ _registerFeatures: function () {
|
|||
this._prepIs();
|
||||
this._prepAttributes();
|
||||
this._prepBehaviors();
|
||||
this._prepExtends();
|
||||
this._prepConstructor();
|
||||
this._prepTemplate();
|
||||
this._prepShady();
|
||||
|
@ -2023,6 +2031,14 @@ for (var i = 0, node = root.firstChild; node; node = node.nextSibling, i++) {
|
|||
if (node.localName === 'template' && !node.hasAttribute('preserve-content')) {
|
||||
this._parseTemplate(node, i, list, annote);
|
||||
}
|
||||
if (node.nodeType === Node.TEXT_NODE) {
|
||||
var n = node.nextSibling;
|
||||
while (n && n.nodeType === Node.TEXT_NODE) {
|
||||
node.textContent += n.textContent;
|
||||
root.removeChild(n);
|
||||
n = n.nextSibling;
|
||||
}
|
||||
}
|
||||
var childAnnotation = this._parseNodeAnnotations(node, list, callback);
|
||||
if (childAnnotation) {
|
||||
childAnnotation.parent = annote;
|
||||
|
@ -2516,8 +2532,8 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
//This breaks scrolling in safari
|
||||
//ev.preventDefault();
|
||||
//This breaks scrolling in safari
|
||||
//ev.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -2990,7 +3006,8 @@ Polymer.dom(toElement).setAttribute(name, '');
|
|||
}
|
||||
},
|
||||
getContentChildNodes: function (slctr) {
|
||||
return Polymer.dom(Polymer.dom(this.root).querySelector(slctr || 'content')).getDistributedNodes();
|
||||
var content = Polymer.dom(this.root).querySelector(slctr || 'content');
|
||||
return content ? Polymer.dom(content).getDistributedNodes() : [];
|
||||
},
|
||||
getContentChildren: function (slctr) {
|
||||
return this.getContentChildNodes(slctr).filter(function (n) {
|
||||
|
@ -3994,9 +4011,11 @@ this.forEachStyleRule(rules, callback);
|
|||
return this.parser.stringify(rules, preserveProperties);
|
||||
},
|
||||
forRulesInStyles: function (styles, callback) {
|
||||
if (styles) {
|
||||
for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
|
||||
this.forEachStyleRule(this.rulesForStyle(s), callback);
|
||||
}
|
||||
}
|
||||
},
|
||||
rulesForStyle: function (style) {
|
||||
if (!style.__cssRules && style.textContent) {
|
||||
|
@ -4775,8 +4794,18 @@ if (!this._scopeSelector && this._needsStyleProperties()) {
|
|||
this._updateStyleProperties();
|
||||
}
|
||||
},
|
||||
_findStyleHost: function () {
|
||||
var e = this, root;
|
||||
while (root = Polymer.dom(e).getOwnerRoot()) {
|
||||
if (Polymer.isInstance(root.host)) {
|
||||
return root.host;
|
||||
}
|
||||
e = root.host;
|
||||
}
|
||||
return styleDefaults;
|
||||
},
|
||||
_updateStyleProperties: function () {
|
||||
var info, scope = this.domHost || styleDefaults;
|
||||
var info, scope = this._findStyleHost();
|
||||
if (!scope._styleCache) {
|
||||
scope._styleCache = new Polymer.StyleCache();
|
||||
}
|
||||
|
@ -4811,7 +4840,7 @@ styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._s
|
|||
}
|
||||
},
|
||||
_computeStyleProperties: function (scopeProps) {
|
||||
var scope = this.domHost || styleDefaults;
|
||||
var scope = this._findStyleHost();
|
||||
if (!scope._styleProperties) {
|
||||
scope._computeStyleProperties();
|
||||
}
|
||||
|
@ -4844,7 +4873,7 @@ return style;
|
|||
},
|
||||
serializeValueToAttribute: function (value, attribute, node) {
|
||||
node = node || this;
|
||||
if (attribute === 'class') {
|
||||
if (attribute === 'class' && !nativeShadow) {
|
||||
var host = node === this ? this.domHost || this.dataHost : this;
|
||||
if (host) {
|
||||
value = host._scopeElementClass(node, value);
|
||||
|
@ -4900,7 +4929,6 @@ Polymer.Base._addFeature({
|
|||
_registerFeatures: function () {
|
||||
this._prepIs();
|
||||
this._prepAttributes();
|
||||
this._prepExtends();
|
||||
this._prepConstructor();
|
||||
this._prepTemplate();
|
||||
this._prepStyles();
|
||||
|
@ -5370,19 +5398,18 @@ delay: Number
|
|||
},
|
||||
behaviors: [Polymer.Templatizer],
|
||||
observers: ['_itemsChanged(items.*)'],
|
||||
created: function () {
|
||||
this._instances = [];
|
||||
},
|
||||
detached: function () {
|
||||
if (this.rows) {
|
||||
for (var i = 0; i < this.rows.length; i++) {
|
||||
for (var i = 0; i < this._instances.length; i++) {
|
||||
this._detachRow(i);
|
||||
}
|
||||
}
|
||||
},
|
||||
attached: function () {
|
||||
if (this.rows) {
|
||||
var parentNode = Polymer.dom(this).parentNode;
|
||||
for (var i = 0; i < this.rows.length; i++) {
|
||||
Polymer.dom(parentNode).insertBefore(this.rows[i].root, this);
|
||||
}
|
||||
for (var i = 0; i < this._instances.length; i++) {
|
||||
Polymer.dom(parentNode).insertBefore(this._instances[i].root, this);
|
||||
}
|
||||
},
|
||||
ready: function () {
|
||||
|
@ -5399,7 +5426,7 @@ var sort = this.sort;
|
|||
this._sortFn = sort && (typeof sort == 'function' ? sort : function () {
|
||||
return dataHost[sort].apply(dataHost, arguments);
|
||||
});
|
||||
this._fullRefresh = true;
|
||||
this._needFullRefresh = true;
|
||||
if (this.items) {
|
||||
this._debounceTemplate(this._render);
|
||||
}
|
||||
|
@ -5410,7 +5437,7 @@ var filter = this.filter;
|
|||
this._filterFn = filter && (typeof filter == 'function' ? filter : function () {
|
||||
return dataHost[filter].apply(dataHost, arguments);
|
||||
});
|
||||
this._fullRefresh = true;
|
||||
this._needFullRefresh = true;
|
||||
if (this.items) {
|
||||
this._debounceTemplate(this._render);
|
||||
}
|
||||
|
@ -5428,7 +5455,7 @@ this.collection = null;
|
|||
this._error(this._logf('dom-repeat', 'expected array for `items`,' + ' found', this.items));
|
||||
}
|
||||
this._splices = [];
|
||||
this._fullRefresh = true;
|
||||
this._needFullRefresh = true;
|
||||
this._debounceTemplate(this._render);
|
||||
} else if (change.path == 'items.splices') {
|
||||
this._splices = this._splices.concat(change.value.keySplices);
|
||||
|
@ -5445,7 +5472,7 @@ path = path.substring(path.indexOf('.') + 1);
|
|||
var paths = this._observePaths;
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
if (path.indexOf(paths[i]) === 0) {
|
||||
this._fullRefresh = true;
|
||||
this._needFullRefresh = true;
|
||||
if (this.delay) {
|
||||
this.debounce('render', this._render, this.delay);
|
||||
} else {
|
||||
|
@ -5457,102 +5484,111 @@ return;
|
|||
}
|
||||
},
|
||||
render: function () {
|
||||
this._fullRefresh = true;
|
||||
this._needFullRefresh = true;
|
||||
this._debounceTemplate(this._render);
|
||||
this._flushTemplates();
|
||||
},
|
||||
_render: function () {
|
||||
var c = this.collection;
|
||||
if (!this._fullRefresh) {
|
||||
if (this._needFullRefresh) {
|
||||
this._applyFullRefresh();
|
||||
this._needFullRefresh = false;
|
||||
} else {
|
||||
if (this._sortFn) {
|
||||
this._applySplicesViewSort(this._splices);
|
||||
this._applySplicesUserSort(this._splices);
|
||||
} else {
|
||||
if (this._filterFn) {
|
||||
this._fullRefresh = true;
|
||||
this._applyFullRefresh();
|
||||
} else {
|
||||
this._applySplicesArraySort(this._splices);
|
||||
this._applySplicesArrayOrder(this._splices);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this._fullRefresh) {
|
||||
this._sortAndFilter();
|
||||
this._fullRefresh = false;
|
||||
}
|
||||
this._splices = [];
|
||||
var rowForKey = this._rowForKey = {};
|
||||
var keys = this._orderedKeys;
|
||||
this.rows = this.rows || [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var item = c.getItem(key);
|
||||
var row = this.rows[i];
|
||||
rowForKey[key] = i;
|
||||
if (!row) {
|
||||
this.rows.push(row = this._insertRow(i, null, item));
|
||||
var keyToIdx = this._keyToInstIdx = {};
|
||||
for (var i = 0; i < this._instances.length; i++) {
|
||||
var inst = this._instances[i];
|
||||
keyToIdx[inst.__key__] = i;
|
||||
inst.__setProperty(this.indexAs, i, true);
|
||||
}
|
||||
row.__setProperty(this.as, item, true);
|
||||
row.__setProperty('__key__', key, true);
|
||||
row.__setProperty(this.indexAs, i, true);
|
||||
}
|
||||
for (; i < this.rows.length; i++) {
|
||||
this._detachRow(i);
|
||||
}
|
||||
this.rows.splice(keys.length, this.rows.length - keys.length);
|
||||
this.fire('dom-change');
|
||||
},
|
||||
_sortAndFilter: function () {
|
||||
_applyFullRefresh: function () {
|
||||
var c = this.collection;
|
||||
if (!this._sortFn) {
|
||||
this._orderedKeys = [];
|
||||
var keys;
|
||||
if (this._sortFn) {
|
||||
keys = c ? c.getKeys() : [];
|
||||
} else {
|
||||
keys = [];
|
||||
var items = this.items;
|
||||
if (items) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
this._orderedKeys.push(c.getKey(items[i]));
|
||||
keys.push(c.getKey(items[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this._orderedKeys = c ? c.getKeys() : [];
|
||||
}
|
||||
if (this._filterFn) {
|
||||
this._orderedKeys = this._orderedKeys.filter(function (a) {
|
||||
keys = keys.filter(function (a) {
|
||||
return this._filterFn(c.getItem(a));
|
||||
}, this);
|
||||
}
|
||||
if (this._sortFn) {
|
||||
this._orderedKeys.sort(function (a, b) {
|
||||
keys.sort(function (a, b) {
|
||||
return this._sortFn(c.getItem(a), c.getItem(b));
|
||||
}.bind(this));
|
||||
}
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var inst = this._instances[i];
|
||||
if (inst) {
|
||||
inst.__setProperty('__key__', key, true);
|
||||
inst.__setProperty(this.as, c.getItem(key), true);
|
||||
} else {
|
||||
this._instances.push(this._insertRow(i, key));
|
||||
}
|
||||
}
|
||||
for (; i < this._instances.length; i++) {
|
||||
this._detachRow(i);
|
||||
}
|
||||
this._instances.splice(keys.length, this._instances.length - keys.length);
|
||||
},
|
||||
_keySort: function (a, b) {
|
||||
return this.collection.getKey(a) - this.collection.getKey(b);
|
||||
},
|
||||
_applySplicesViewSort: function (splices) {
|
||||
_applySplicesUserSort: function (splices) {
|
||||
var c = this.collection;
|
||||
var keys = this._orderedKeys;
|
||||
var rows = this.rows;
|
||||
var removedRows = [];
|
||||
var addedKeys = [];
|
||||
var instances = this._instances;
|
||||
var keyMap = {};
|
||||
var pool = [];
|
||||
var sortFn = this._sortFn || this._keySort.bind(this);
|
||||
splices.forEach(function (s) {
|
||||
for (var i = 0; i < s.removed.length; i++) {
|
||||
var idx = this._rowForKey[s.removed[i]];
|
||||
if (idx != null) {
|
||||
removedRows.push(idx);
|
||||
}
|
||||
var key = s.removed[i];
|
||||
keyMap[key] = keyMap[key] ? null : -1;
|
||||
}
|
||||
for (var i = 0; i < s.added.length; i++) {
|
||||
addedKeys.push(s.added[i]);
|
||||
var key = s.added[i];
|
||||
keyMap[key] = keyMap[key] ? null : 1;
|
||||
}
|
||||
}, this);
|
||||
if (removedRows.length) {
|
||||
removedRows.sort();
|
||||
for (var i = removedRows.length - 1; i >= 0; i--) {
|
||||
var idx = removedRows[i];
|
||||
var removedIdxs = [];
|
||||
var addedKeys = [];
|
||||
for (var key in keyMap) {
|
||||
if (keyMap[key] === -1) {
|
||||
removedIdxs.push(this._keyToInstIdx[key]);
|
||||
}
|
||||
if (keyMap[key] === 1) {
|
||||
addedKeys.push(key);
|
||||
}
|
||||
}
|
||||
if (removedIdxs.length) {
|
||||
removedIdxs.sort();
|
||||
for (var i = removedIdxs.length - 1; i >= 0; i--) {
|
||||
var idx = removedIdxs[i];
|
||||
if (idx !== undefined) {
|
||||
pool.push(this._detachRow(idx));
|
||||
rows.splice(idx, 1);
|
||||
keys.splice(idx, 1);
|
||||
instances.splice(idx, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addedKeys.length) {
|
||||
|
@ -5566,19 +5602,19 @@ return this._sortFn(c.getItem(a), c.getItem(b));
|
|||
}.bind(this));
|
||||
var start = 0;
|
||||
for (var i = 0; i < addedKeys.length; i++) {
|
||||
start = this._insertRowIntoViewSort(start, addedKeys[i], pool);
|
||||
start = this._insertRowUserSort(start, addedKeys[i], pool);
|
||||
}
|
||||
}
|
||||
},
|
||||
_insertRowIntoViewSort: function (start, key, pool) {
|
||||
_insertRowUserSort: function (start, key, pool) {
|
||||
var c = this.collection;
|
||||
var item = c.getItem(key);
|
||||
var end = this.rows.length - 1;
|
||||
var end = this._instances.length - 1;
|
||||
var idx = -1;
|
||||
var sortFn = this._sortFn || this._keySort.bind(this);
|
||||
while (start <= end) {
|
||||
var mid = start + end >> 1;
|
||||
var midKey = this._orderedKeys[mid];
|
||||
var midKey = this._instances[mid].__key__;
|
||||
var cmp = sortFn(c.getItem(midKey), item);
|
||||
if (cmp < 0) {
|
||||
start = mid + 1;
|
||||
|
@ -5592,106 +5628,110 @@ break;
|
|||
if (idx < 0) {
|
||||
idx = end + 1;
|
||||
}
|
||||
this._orderedKeys.splice(idx, 0, key);
|
||||
this.rows.splice(idx, 0, this._insertRow(idx, pool, c.getItem(key)));
|
||||
this._instances.splice(idx, 0, this._insertRow(idx, key, pool));
|
||||
return idx;
|
||||
},
|
||||
_applySplicesArraySort: function (splices) {
|
||||
var keys = this._orderedKeys;
|
||||
_applySplicesArrayOrder: function (splices) {
|
||||
var pool = [];
|
||||
splices.forEach(function (s) {
|
||||
for (var i = 0; i < s.removed.length; i++) {
|
||||
pool.push(this._detachRow(s.index + i));
|
||||
}
|
||||
this.rows.splice(s.index, s.removed.length);
|
||||
}, this);
|
||||
var c = this.collection;
|
||||
splices.forEach(function (s) {
|
||||
var args = [
|
||||
s.index,
|
||||
s.removed.length
|
||||
].concat(s.added);
|
||||
keys.splice.apply(keys, args);
|
||||
for (var i = 0; i < s.removed.length; i++) {
|
||||
var inst = this._detachRow(s.index + i);
|
||||
if (!inst.isPlaceholder) {
|
||||
pool.push(inst);
|
||||
}
|
||||
}
|
||||
this._instances.splice(s.index, s.removed.length);
|
||||
for (var i = 0; i < s.added.length; i++) {
|
||||
var item = c.getItem(s.added[i]);
|
||||
var row = this._insertRow(s.index + i, pool, item);
|
||||
this.rows.splice(s.index + i, 0, row);
|
||||
var inst = {
|
||||
isPlaceholder: true,
|
||||
key: s.added[i]
|
||||
};
|
||||
this._instances.splice(s.index + i, 0, inst);
|
||||
}
|
||||
}, this);
|
||||
for (var i = this._instances.length - 1; i >= 0; i--) {
|
||||
var inst = this._instances[i];
|
||||
if (inst.isPlaceholder) {
|
||||
this._instances[i] = this._insertRow(i, inst.key, pool, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
_detachRow: function (idx) {
|
||||
var row = this.rows[idx];
|
||||
var inst = this._instances[idx];
|
||||
if (!inst.isPlaceholder) {
|
||||
var parentNode = Polymer.dom(this).parentNode;
|
||||
for (var i = 0; i < row._children.length; i++) {
|
||||
var el = row._children[i];
|
||||
Polymer.dom(row.root).appendChild(el);
|
||||
for (var i = 0; i < inst._children.length; i++) {
|
||||
var el = inst._children[i];
|
||||
Polymer.dom(inst.root).appendChild(el);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
return inst;
|
||||
},
|
||||
_insertRow: function (idx, pool, item) {
|
||||
var row = pool && pool.pop() || this._generateRow(idx, item);
|
||||
var beforeRow = this.rows[idx];
|
||||
_insertRow: function (idx, key, pool, replace) {
|
||||
var inst;
|
||||
if (inst = pool && pool.pop()) {
|
||||
inst.__setProperty(this.as, this.collection.getItem(key), true);
|
||||
inst.__setProperty('__key__', key, true);
|
||||
} else {
|
||||
inst = this._generateRow(idx, key);
|
||||
}
|
||||
var beforeRow = this._instances[replace ? idx + 1 : idx];
|
||||
var beforeNode = beforeRow ? beforeRow._children[0] : this;
|
||||
var parentNode = Polymer.dom(this).parentNode;
|
||||
Polymer.dom(parentNode).insertBefore(row.root, beforeNode);
|
||||
return row;
|
||||
Polymer.dom(parentNode).insertBefore(inst.root, beforeNode);
|
||||
return inst;
|
||||
},
|
||||
_generateRow: function (idx, item) {
|
||||
var model = { __key__: this.collection.getKey(item) };
|
||||
model[this.as] = item;
|
||||
_generateRow: function (idx, key) {
|
||||
var model = { __key__: key };
|
||||
model[this.as] = this.collection.getItem(key);
|
||||
model[this.indexAs] = idx;
|
||||
var row = this.stamp(model);
|
||||
return row;
|
||||
var inst = this.stamp(model);
|
||||
return inst;
|
||||
},
|
||||
_showHideChildren: function (hidden) {
|
||||
if (this.rows) {
|
||||
for (var i = 0; i < this.rows.length; i++) {
|
||||
this.rows[i]._showHideChildren(hidden);
|
||||
}
|
||||
for (var i = 0; i < this._instances.length; i++) {
|
||||
this._instances[i]._showHideChildren(hidden);
|
||||
}
|
||||
},
|
||||
_forwardInstanceProp: function (row, prop, value) {
|
||||
_forwardInstanceProp: function (inst, prop, value) {
|
||||
if (prop == this.as) {
|
||||
var idx;
|
||||
if (this._sortFn || this._filterFn) {
|
||||
idx = this.items.indexOf(this.collection.getItem(row.__key__));
|
||||
idx = this.items.indexOf(this.collection.getItem(inst.__key__));
|
||||
} else {
|
||||
idx = row[this.indexAs];
|
||||
idx = inst[this.indexAs];
|
||||
}
|
||||
this.set('items.' + idx, value);
|
||||
}
|
||||
},
|
||||
_forwardInstancePath: function (row, path, value) {
|
||||
_forwardInstancePath: function (inst, path, value) {
|
||||
if (path.indexOf(this.as + '.') === 0) {
|
||||
this.notifyPath('items.' + row.__key__ + '.' + path.slice(this.as.length + 1), value);
|
||||
this.notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
|
||||
}
|
||||
},
|
||||
_forwardParentProp: function (prop, value) {
|
||||
if (this.rows) {
|
||||
this.rows.forEach(function (row) {
|
||||
row.__setProperty(prop, value, true);
|
||||
this._instances.forEach(function (inst) {
|
||||
inst.__setProperty(prop, value, true);
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
_forwardParentPath: function (path, value) {
|
||||
if (this.rows) {
|
||||
this.rows.forEach(function (row) {
|
||||
row.notifyPath(path, value, true);
|
||||
this._instances.forEach(function (inst) {
|
||||
inst.notifyPath(path, value, true);
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
_forwardItemPath: function (path, value) {
|
||||
if (this._rowForKey) {
|
||||
if (this._keyToInstIdx) {
|
||||
var dot = path.indexOf('.');
|
||||
var key = path.substring(0, dot < 0 ? path.length : dot);
|
||||
var idx = this._rowForKey[key];
|
||||
var row = this.rows[idx];
|
||||
if (row) {
|
||||
var idx = this._keyToInstIdx[key];
|
||||
var inst = this._instances[idx];
|
||||
if (inst) {
|
||||
if (dot >= 0) {
|
||||
path = this.as + '.' + path.substring(dot + 1);
|
||||
row.notifyPath(path, value, true);
|
||||
inst.notifyPath(path, value, true);
|
||||
} else {
|
||||
row.__setProperty(this.as, value, true);
|
||||
inst.__setProperty(this.as, value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5908,7 +5948,6 @@ created: function () {
|
|||
Polymer.ImportStatus.whenLoaded(this._readySelf.bind(this));
|
||||
},
|
||||
_registerFeatures: function () {
|
||||
this._prepExtends();
|
||||
this._prepConstructor();
|
||||
},
|
||||
_insertChildren: function () {
|
||||
|
@ -11533,7 +11572,7 @@ It may be desirable to only allow users to enter certain characters. You can use
|
|||
is separate from validation, and `allowed-pattern` does not affect how the input is validated.
|
||||
|
||||
<!-- only allow characters that match [0-9] -->
|
||||
<input is="iron-input" prevent-invaild-input allowed-pattern="[0-9]">
|
||||
<input is="iron-input" prevent-invalid-input allowed-pattern="[0-9]">
|
||||
|
||||
@hero hero.svg
|
||||
@demo demo/index.html
|
||||
|
@ -11646,11 +11685,16 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
// always matches the charCode.
|
||||
// None of this makes any sense.
|
||||
|
||||
var nonPrintable =
|
||||
// For these keys, ASCII code == browser keycode.
|
||||
var anyNonPrintable =
|
||||
(event.keyCode == 8) || // backspace
|
||||
(event.keyCode == 13) || // enter
|
||||
(event.keyCode == 27); // escape
|
||||
|
||||
// For these keys, make sure it's a browser keycode and not an ASCII code.
|
||||
var mozNonPrintable =
|
||||
(event.keyCode == 19) || // pause
|
||||
(event.keyCode == 20) || // caps lock
|
||||
(event.keyCode == 27) || // escape
|
||||
(event.keyCode == 45) || // insert
|
||||
(event.keyCode == 46) || // delete
|
||||
(event.keyCode == 144) || // num lock
|
||||
|
@ -11658,7 +11702,7 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
(event.keyCode > 32 && event.keyCode < 41) || // page up/down, end, home, arrows
|
||||
(event.keyCode > 111 && event.keyCode < 124); // fn keys
|
||||
|
||||
return !(event.charCode == 0 && nonPrintable);
|
||||
return !anyNonPrintable && !(event.charCode == 0 && mozNonPrintable);
|
||||
},
|
||||
|
||||
_onKeypress: function(event) {
|
||||
|
@ -11767,8 +11811,7 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
},
|
||||
|
||||
/**
|
||||
* Need to keep a reference to the form this element is registered
|
||||
* to, so that it can unregister if detached.
|
||||
* The form that the element is registered to.
|
||||
*/
|
||||
_parentForm: {
|
||||
type: Object
|
||||
|
@ -11776,7 +11819,8 @@ is separate from validation, and `allowed-pattern` does not affect how the input
|
|||
},
|
||||
|
||||
attached: function() {
|
||||
this._parentForm = Polymer.dom(this).parentNode;
|
||||
// Note: the iron-form that this element belongs to will set this
|
||||
// element's _parentForm property when handling this event.
|
||||
this.fire('iron-form-element-register');
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue