polymer-rails 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e60e9c03cbc73a2ba56357a90887b2d8da9ee08
|
4
|
+
data.tar.gz: 831baa1eb5c10b24d86eaa5a2b93198360f07216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 454c524339c884bf208ade8fbc372c1c00288779edfa124181c9ae7feb0b91ce7bf6b44b1fed7912ec6683331d3f16afa763c1f014b73c33e55a42ec093656b1
|
7
|
+
data.tar.gz: 0a6d85f444772d21f214f39db74b9c476aff97c3ab4536169fd32c411f12880ae491b6b3cfea73a57b599048a93f8d6639221bd0ad58c4756ddfb5dd3e5ea2cc
|
@@ -13,21 +13,6 @@ document.body.removeAttribute('unresolved');
|
|
13
13
|
if (window.WebComponents) {
|
14
14
|
addEventListener('WebComponentsReady', resolve);
|
15
15
|
} else {
|
16
|
-
if (document.readyState =<!--
|
17
|
-
@license
|
18
|
-
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
19
|
-
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
20
|
-
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
21
|
-
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
22
|
-
Code distributed by Google as part of the polymer project is also
|
23
|
-
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
24
|
-
--><script>(function () {
|
25
|
-
function resolve() {
|
26
|
-
document.body.removeAttribute('unresolved');
|
27
|
-
}
|
28
|
-
if (window.WebComponents) {
|
29
|
-
addEventListener('WebComponentsReady', resolve);
|
30
|
-
} else {
|
31
16
|
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
32
17
|
resolve();
|
33
18
|
} else {
|
@@ -74,7 +59,11 @@ document.registerElement(prototype.is, options);
|
|
74
59
|
return ctor;
|
75
60
|
};
|
76
61
|
var desugar = function (prototype) {
|
77
|
-
|
62
|
+
var base = Polymer.Base;
|
63
|
+
if (prototype.extends) {
|
64
|
+
base = Polymer.Base._getExtendedPrototype(prototype.extends);
|
65
|
+
}
|
66
|
+
prototype = Polymer.Base.chainObject(prototype, base);
|
78
67
|
prototype.registerCallback();
|
79
68
|
return prototype.constructor;
|
80
69
|
};
|
@@ -107,6 +96,7 @@ return (document._currentScript || document.currentScript).ownerDocument;
|
|
107
96
|
}
|
108
97
|
});
|
109
98
|
Polymer.Base = {
|
99
|
+
__isPolymerInstance__: true,
|
110
100
|
_addFeature: function (feature) {
|
111
101
|
this.extend(this, feature);
|
112
102
|
},
|
@@ -176,6 +166,16 @@ object.__proto__ = inherited;
|
|
176
166
|
return object;
|
177
167
|
};
|
178
168
|
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
169
|
+
if (window.CustomElements) {
|
170
|
+
Polymer.instanceof = CustomElements.instanceof;
|
171
|
+
} else {
|
172
|
+
Polymer.instanceof = function (obj, ctor) {
|
173
|
+
return obj instanceof ctor;
|
174
|
+
};
|
175
|
+
}
|
176
|
+
Polymer.isInstance = function (obj) {
|
177
|
+
return Boolean(obj && obj.__isPolymerInstance__);
|
178
|
+
};
|
179
179
|
Polymer.telemetry.instanceCount = 0;
|
180
180
|
(function () {
|
181
181
|
var modules = {};
|
@@ -304,525 +304,6 @@ this._marshalBehavior(this);
|
|
304
304
|
}
|
305
305
|
});
|
306
306
|
Polymer.Base._addFeature({
|
307
|
-
_prepExtends: function () {
|
308
|
-
if (this.extends) {
|
309
|
-
this.__proto__ = this._getExtendedPrototype(this.extends);
|
310
|
-
}
|
311
|
-
},
|
312
|
-
_getExtendedPrototype: function (tag) {
|
313
|
-
return this._getExtendedNativePrototype(tag);
|
314
|
-
},
|
315
|
-
_nativePrototypes: {},
|
316
|
-
_getExtendedNativePrototype: function (tag) {
|
317
|
-
var p = this._nativePrototypes[tag];
|
318
|
-
if (!p) {
|
319
|
-
var np = this.getNativePrototype(tag);
|
320
|
-
p = this.extend(Object.create(np), Polymer.Base);
|
321
|
-
this._nativePrototypes[tag] = p;
|
322
|
-
}
|
323
|
-
return p;
|
324
|
-
},
|
325
|
-
getNativePrototype: function (tag) {
|
326
|
-
return Object.getPrototypeOf(document.createElement(tag));
|
327
|
-
}
|
328
|
-
});
|
329
|
-
Polymer.Base._addFeature({
|
330
|
-
_prepConstructor: function () {
|
331
|
-
this._factoryArgs = this.extends ? [
|
332
|
-
this.extends,
|
333
|
-
this.is
|
334
|
-
] : [this.is];
|
335
|
-
var ctor = function () {
|
336
|
-
return this._factory(arguments);
|
337
|
-
};
|
338
|
-
if (this.hasOwnProperty('extends')) {
|
339
|
-
ctor.extends = this.extends;
|
340
|
-
}
|
341
|
-
Object.defineProperty(this, 'constructor', {
|
342
|
-
value: ctor,
|
343
|
-
writable: true,
|
344
|
-
configurable: true
|
345
|
-
});
|
346
|
-
ctor.prototype = this;
|
347
|
-
},
|
348
|
-
_factory: function (args) {
|
349
|
-
var elt = document.createElement.apply(document, this._factoryArgs);
|
350
|
-
if (this.factoryImpl) {
|
351
|
-
this.factoryImpl.apply(elt, args);
|
352
|
-
}
|
353
|
-
return elt;
|
354
|
-
}
|
355
|
-
});
|
356
|
-
Polymer.nob = Object.create(null);
|
357
|
-
Polymer.Base._addFeature({
|
358
|
-
properties: {},
|
359
|
-
getPropertyInfo: function (property) {
|
360
|
-
var info = this._getPropertyInfo(property, this.properties);
|
361
|
-
if (!info) {
|
362
|
-
this.behaviors.some(function (b) {
|
363
|
-
return info = this._getPropertyInfo(property, b.properties);
|
364
|
-
}, this);
|
365
|
-
}
|
366
|
-
return info || Polymer.nob;
|
367
|
-
},
|
368
|
-
_getPropertyInfo: function (property, properties) {
|
369
|
-
var p = properties && properties[property];
|
370
|
-
if (typeof p === 'function') {
|
371
|
-
p = properties[property] = { type: p };
|
372
|
-
}
|
373
|
-
if (p) {
|
374
|
-
p.defined = true;
|
375
|
-
}
|
376
|
-
return p;
|
377
|
-
}
|
378
|
-
});
|
379
|
-
Polymer.CaseMap = {
|
380
|
-
_caseMap: {},
|
381
|
-
dashToCamelCase: function (dash) {
|
382
|
-
var mapped = Polymer.CaseMap._caseMap[dash];
|
383
|
-
if (mapped) {
|
384
|
-
return mapped;
|
385
|
-
}
|
386
|
-
if (dash.indexOf('-') < 0) {
|
387
|
-
return Polymer.CaseMap._caseMap[dash] = dash;
|
388
|
-
}
|
389
|
-
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
|
390
|
-
return m[1].toUpperCase();
|
391
|
-
});
|
392
|
-
},
|
393
|
-
camelToDashCase: function (camel) {
|
394
|
-
var mapped = Polymer.CaseMap._caseMap[camel];
|
395
|
-
if (mapped) {
|
396
|
-
return mapped;
|
397
|
-
}
|
398
|
-
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
|
399
|
-
return g[0] + '-' + g[1].toLowerCase();
|
400
|
-
});
|
401
|
-
}
|
402
|
-
};
|
403
|
-
Polymer.Base._addFeature({
|
404
|
-
_prepAttributes: function () {
|
405
|
-
this._aggregatedAttributes = {};
|
406
|
-
},
|
407
|
-
_addHostAttributes: function (attributes) {
|
408
|
-
if (attributes) {
|
409
|
-
this.mixin(this._aggregatedAttributes, attributes);
|
410
|
-
}
|
411
|
-
},
|
412
|
-
_marshalHostAttributes: function () {
|
413
|
-
this._applyAttributes(this, this._aggregatedAttributes);
|
414
|
-
},
|
415
|
-
_applyAttributes: function (node, attr$) {
|
416
|
-
for (var n in attr$) {
|
417
|
-
if (!this.hasAttribute(n) && n !== 'class') {
|
418
|
-
this.serializeValueToAttribute(attr$[n], n, this);
|
419
|
-
}
|
420
|
-
}
|
421
|
-
},
|
422
|
-
_marshalAttributes: function () {
|
423
|
-
this._takeAttributesToModel(this);
|
424
|
-
},
|
425
|
-
_takeAttributesToModel: function (model) {
|
426
|
-
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
427
|
-
this._setAttributeToProperty(model, this.attributes[i].name);
|
428
|
-
}
|
429
|
-
},
|
430
|
-
_setAttributeToProperty: function (model, attrName) {
|
431
|
-
if (!this._serializing) {
|
432
|
-
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
433
|
-
var info = this.getPropertyInfo(propName);
|
434
|
-
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
435
|
-
var val = this.getAttribute(attrName);
|
436
|
-
model[propName] = this.deserialize(val, info.type);
|
437
|
-
}
|
438
|
-
}
|
439
|
-
},
|
440
|
-
_serializing: false,
|
441
|
-
reflectPropertyToAttribute: function (name) {
|
442
|
-
this._serializing = true;
|
443
|
-
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
444
|
-
this._serializing = false;
|
445
|
-
},
|
446
|
-
serializeValueToAttribute: function (value, attribute, node) {
|
447
|
-
var str = this.serialize(value);
|
448
|
-
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
449
|
-
},
|
450
|
-
deserialize: function (value, type) {
|
451
|
-
switch (type) {
|
452
|
-
case Number:
|
453
|
-
value = Number(value);
|
454
|
-
break;
|
455
|
-
case Boolean:
|
456
|
-
value = value !== null;
|
457
|
-
break;
|
458
|
-
case Object:
|
459
|
-
try {
|
460
|
-
value = JSON.parse(value);
|
461
|
-
} catch (x) {
|
462
|
-
}
|
463
|
-
break;
|
464
|
-
case Array:
|
465
|
-
try {
|
466
|
-
value = JSON.parse(value);
|
467
|
-
} catch (x) {
|
468
|
-
value = null;
|
469
|
-
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
|
470
|
-
}
|
471
|
-
break;
|
472
|
-
case Date:
|
473
|
-
value = new Date(value);
|
474
|
-
break;
|
475
|
-
case String:
|
476
|
-
default:
|
477
|
-
break;
|
478
|
-
}
|
479
|
-
return value;
|
480
|
-
},
|
481
|
-
serialize: function (value) {
|
482
|
-
switch (typeof value) {
|
483
|
-
case 'boolean':
|
484
|
-
return value ? '' : undefined;
|
485
|
-
case 'object':
|
486
|
-
if (value instanceof Date) {
|
487
|
-
return value;
|
488
|
-
} else if (value) {
|
489
|
-
try {
|
490
|
-
return JSON.stringify(value);
|
491
|
-
} catch (x) {
|
492
|
-
return '';
|
493
|
-
}
|
494
|
-
}
|
495
|
-
default:
|
496
|
-
return value != null ? value : undefined;
|
497
|
-
}
|
498
|
-
}
|
499
|
-
});
|
500
|
-
Polymer.Base._addFeature({
|
501
|
-
_setupDebouncers: function () {
|
502
|
-
this._debouncers = {};
|
503
|
-
},
|
504
|
-
debounce: function (jobName, callback, wait) {
|
505
|
-
this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
|
506
|
-
},
|
507
|
-
isDebouncerActive: function (jobName) {
|
508
|
-
var debouncer = this._debouncers[jobName];
|
509
|
-
return debouncer && debouncer.finish;
|
510
|
-
},
|
511
|
-
flushDebouncer: function (jobName) {
|
512
|
-
var debouncer = this._debouncers[jobName];
|
513
|
-
if (debouncer) {
|
514
|
-
debouncer.complete();
|
515
|
-
}
|
516
|
-
},
|
517
|
-
cancelDebouncer: function (jobName) {
|
518
|
-
var debouncer = this._debouncers[jobName];
|
519
|
-
if (debouncer) {
|
520
|
-
debouncer.stop();
|
521
|
-
}
|
522
|
-
}
|
523
|
-
});
|
524
|
-
Polymer.version = '1.0.6';
|
525
|
-
Polymer.Base._addFeature({
|
526
|
-
_registerFeatures: function () {
|
527
|
-
this._prepIs();
|
528
|
-
this._prepAttributes();
|
529
|
-
this._prepBehaviors();
|
530
|
-
this._prepExtends();
|
531
|
-
this._prepConstructor();
|
532
|
-
},
|
533
|
-
_prepBehavior: function (b) {
|
534
|
-
this._addHostAttributes(b.hostAttributes);
|
535
|
-
},
|
536
|
-
_marshalBehavior: function (b) {
|
537
|
-
},
|
538
|
-
_initFeatures: function () {
|
539
|
-
this._marshalHostAttributes();
|
540
|
-
this._setupDebouncers();
|
541
|
-
this._marshalBehaviors();
|
542
|
-
}
|
543
|
-
});</script>
|
544
|
-
|
545
|
-
== 'interactive' || document.readyState === 'complete') {
|
546
|
-
resolve();
|
547
|
-
} else {
|
548
|
-
addEventListener('DOMContentLoaded', resolve);
|
549
|
-
}
|
550
|
-
}
|
551
|
-
}());
|
552
|
-
Polymer = {
|
553
|
-
Settings: function () {
|
554
|
-
var user = window.Polymer || {};
|
555
|
-
location.search.slice(1).split('&').forEach(function (o) {
|
556
|
-
o = o.split('=');
|
557
|
-
o[0] && (user[o[0]] = o[1] || true);
|
558
|
-
});
|
559
|
-
var wantShadow = user.dom === 'shadow';
|
560
|
-
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
561
|
-
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
562
|
-
var useShadow = wantShadow && hasShadow;
|
563
|
-
var hasNativeImports = Boolean('import' in document.createElement('link'));
|
564
|
-
var useNativeImports = hasNativeImports;
|
565
|
-
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
|
566
|
-
return {
|
567
|
-
wantShadow: wantShadow,
|
568
|
-
hasShadow: hasShadow,
|
569
|
-
nativeShadow: nativeShadow,
|
570
|
-
useShadow: useShadow,
|
571
|
-
useNativeShadow: useShadow && nativeShadow,
|
572
|
-
useNativeImports: useNativeImports,
|
573
|
-
useNativeCustomElements: useNativeCustomElements
|
574
|
-
};
|
575
|
-
}()
|
576
|
-
};
|
577
|
-
(function () {
|
578
|
-
var userPolymer = window.Polymer;
|
579
|
-
window.Polymer = function (prototype) {
|
580
|
-
var ctor = desugar(prototype);
|
581
|
-
prototype = ctor.prototype;
|
582
|
-
var options = { prototype: prototype };
|
583
|
-
if (prototype.extends) {
|
584
|
-
options.extends = prototype.extends;
|
585
|
-
}
|
586
|
-
Polymer.telemetry._registrate(prototype);
|
587
|
-
document.registerElement(prototype.is, options);
|
588
|
-
return ctor;
|
589
|
-
};
|
590
|
-
var desugar = function (prototype) {
|
591
|
-
prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
|
592
|
-
prototype.registerCallback();
|
593
|
-
return prototype.constructor;
|
594
|
-
};
|
595
|
-
window.Polymer = Polymer;
|
596
|
-
if (userPolymer) {
|
597
|
-
for (var i in userPolymer) {
|
598
|
-
Polymer[i] = userPolymer[i];
|
599
|
-
}
|
600
|
-
}
|
601
|
-
Polymer.Class = desugar;
|
602
|
-
}());
|
603
|
-
Polymer.telemetry = {
|
604
|
-
registrations: [],
|
605
|
-
_regLog: function (prototype) {
|
606
|
-
console.log('[' + prototype.is + ']: registered');
|
607
|
-
},
|
608
|
-
_registrate: function (prototype) {
|
609
|
-
this.registrations.push(prototype);
|
610
|
-
Polymer.log && this._regLog(prototype);
|
611
|
-
},
|
612
|
-
dumpRegistrations: function () {
|
613
|
-
this.registrations.forEach(this._regLog);
|
614
|
-
}
|
615
|
-
};
|
616
|
-
Object.defineProperty(window, 'currentImport', {
|
617
|
-
enumerable: true,
|
618
|
-
configurable: true,
|
619
|
-
get: function () {
|
620
|
-
return (document._currentScript || document.currentScript).ownerDocument;
|
621
|
-
}
|
622
|
-
});
|
623
|
-
Polymer.Base = {
|
624
|
-
_addFeature: function (feature) {
|
625
|
-
this.extend(this, feature);
|
626
|
-
},
|
627
|
-
registerCallback: function () {
|
628
|
-
this._registerFeatures();
|
629
|
-
this._doBehavior('registered');
|
630
|
-
},
|
631
|
-
createdCallback: function () {
|
632
|
-
Polymer.telemetry.instanceCount++;
|
633
|
-
this.root = this;
|
634
|
-
this._doBehavior('created');
|
635
|
-
this._initFeatures();
|
636
|
-
},
|
637
|
-
attachedCallback: function () {
|
638
|
-
this.isAttached = true;
|
639
|
-
this._doBehavior('attached');
|
640
|
-
},
|
641
|
-
detachedCallback: function () {
|
642
|
-
this.isAttached = false;
|
643
|
-
this._doBehavior('detached');
|
644
|
-
},
|
645
|
-
attributeChangedCallback: function (name) {
|
646
|
-
this._setAttributeToProperty(this, name);
|
647
|
-
this._doBehavior('attributeChanged', arguments);
|
648
|
-
},
|
649
|
-
extend: function (prototype, api) {
|
650
|
-
if (prototype && api) {
|
651
|
-
Object.getOwnPropertyNames(api).forEach(function (n) {
|
652
|
-
this.copyOwnProperty(n, api, prototype);
|
653
|
-
}, this);
|
654
|
-
}
|
655
|
-
return prototype || api;
|
656
|
-
},
|
657
|
-
mixin: function (target, source) {
|
658
|
-
for (var i in source) {
|
659
|
-
target[i] = source[i];
|
660
|
-
}
|
661
|
-
return target;
|
662
|
-
},
|
663
|
-
copyOwnProperty: function (name, source, target) {
|
664
|
-
var pd = Object.getOwnPropertyDescriptor(source, name);
|
665
|
-
if (pd) {
|
666
|
-
Object.defineProperty(target, name, pd);
|
667
|
-
}
|
668
|
-
},
|
669
|
-
_log: console.log.apply.bind(console.log, console),
|
670
|
-
_warn: console.warn.apply.bind(console.warn, console),
|
671
|
-
_error: console.error.apply.bind(console.error, console),
|
672
|
-
_logf: function () {
|
673
|
-
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
|
674
|
-
}
|
675
|
-
};
|
676
|
-
Polymer.Base._logPrefix = function () {
|
677
|
-
var color = window.chrome || /firefox/i.test(navigator.userAgent);
|
678
|
-
return color ? [
|
679
|
-
'%c[%s::%s]:',
|
680
|
-
'font-weight: bold; background-color:#EEEE00;'
|
681
|
-
] : ['[%s::%s]:'];
|
682
|
-
}();
|
683
|
-
Polymer.Base.chainObject = function (object, inherited) {
|
684
|
-
if (object && inherited && object !== inherited) {
|
685
|
-
if (!Object.__proto__) {
|
686
|
-
object = Polymer.Base.extend(Object.create(inherited), object);
|
687
|
-
}
|
688
|
-
object.__proto__ = inherited;
|
689
|
-
}
|
690
|
-
return object;
|
691
|
-
};
|
692
|
-
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
693
|
-
Polymer.telemetry.instanceCount = 0;
|
694
|
-
(function () {
|
695
|
-
var modules = {};
|
696
|
-
var DomModule = function () {
|
697
|
-
return document.createElement('dom-module');
|
698
|
-
};
|
699
|
-
DomModule.prototype = Object.create(HTMLElement.prototype);
|
700
|
-
DomModule.prototype.constructor = DomModule;
|
701
|
-
DomModule.prototype.createdCallback = function () {
|
702
|
-
var id = this.id || this.getAttribute('name') || this.getAttribute('is');
|
703
|
-
if (id) {
|
704
|
-
this.id = id;
|
705
|
-
modules[id] = this;
|
706
|
-
}
|
707
|
-
};
|
708
|
-
DomModule.prototype.import = function (id, slctr) {
|
709
|
-
var m = modules[id];
|
710
|
-
if (!m) {
|
711
|
-
forceDocumentUpgrade();
|
712
|
-
m = modules[id];
|
713
|
-
}
|
714
|
-
if (m && slctr) {
|
715
|
-
m = m.querySelector(slctr);
|
716
|
-
}
|
717
|
-
return m;
|
718
|
-
};
|
719
|
-
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
720
|
-
if (cePolyfill) {
|
721
|
-
var ready = CustomElements.ready;
|
722
|
-
CustomElements.ready = true;
|
723
|
-
}
|
724
|
-
document.registerElement('dom-module', DomModule);
|
725
|
-
if (cePolyfill) {
|
726
|
-
CustomElements.ready = ready;
|
727
|
-
}
|
728
|
-
function forceDocumentUpgrade() {
|
729
|
-
if (cePolyfill) {
|
730
|
-
var script = document._currentScript || document.currentScript;
|
731
|
-
if (script) {
|
732
|
-
CustomElements.upgradeAll(script.ownerDocument);
|
733
|
-
}
|
734
|
-
}
|
735
|
-
}
|
736
|
-
}());
|
737
|
-
Polymer.Base._addFeature({
|
738
|
-
_prepIs: function () {
|
739
|
-
if (!this.is) {
|
740
|
-
var module = (document._currentScript || document.currentScript).parentNode;
|
741
|
-
if (module.localName === 'dom-module') {
|
742
|
-
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
|
743
|
-
this.is = id;
|
744
|
-
}
|
745
|
-
}
|
746
|
-
}
|
747
|
-
});
|
748
|
-
Polymer.Base._addFeature({
|
749
|
-
behaviors: [],
|
750
|
-
_prepBehaviors: function () {
|
751
|
-
if (this.behaviors.length) {
|
752
|
-
this.behaviors = this._flattenBehaviorsList(this.behaviors);
|
753
|
-
}
|
754
|
-
this._prepAllBehaviors(this.behaviors);
|
755
|
-
},
|
756
|
-
_flattenBehaviorsList: function (behaviors) {
|
757
|
-
var flat = [];
|
758
|
-
behaviors.forEach(function (b) {
|
759
|
-
if (b instanceof Array) {
|
760
|
-
flat = flat.concat(this._flattenBehaviorsList(b));
|
761
|
-
} else if (b) {
|
762
|
-
flat.push(b);
|
763
|
-
} else {
|
764
|
-
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
765
|
-
}
|
766
|
-
}, this);
|
767
|
-
return flat;
|
768
|
-
},
|
769
|
-
_prepAllBehaviors: function (behaviors) {
|
770
|
-
for (var i = behaviors.length - 1; i >= 0; i--) {
|
771
|
-
this._mixinBehavior(behaviors[i]);
|
772
|
-
}
|
773
|
-
for (var i = 0, l = behaviors.length; i < l; i++) {
|
774
|
-
this._prepBehavior(behaviors[i]);
|
775
|
-
}
|
776
|
-
this._prepBehavior(this);
|
777
|
-
},
|
778
|
-
_mixinBehavior: function (b) {
|
779
|
-
Object.getOwnPropertyNames(b).forEach(function (n) {
|
780
|
-
switch (n) {
|
781
|
-
case 'hostAttributes':
|
782
|
-
case 'registered':
|
783
|
-
case 'properties':
|
784
|
-
case 'observers':
|
785
|
-
case 'listeners':
|
786
|
-
case 'created':
|
787
|
-
case 'attached':
|
788
|
-
case 'detached':
|
789
|
-
case 'attributeChanged':
|
790
|
-
case 'configure':
|
791
|
-
case 'ready':
|
792
|
-
break;
|
793
|
-
default:
|
794
|
-
if (!this.hasOwnProperty(n)) {
|
795
|
-
this.copyOwnProperty(n, b, this);
|
796
|
-
}
|
797
|
-
break;
|
798
|
-
}
|
799
|
-
}, this);
|
800
|
-
},
|
801
|
-
_doBehavior: function (name, args) {
|
802
|
-
this.behaviors.forEach(function (b) {
|
803
|
-
this._invokeBehavior(b, name, args);
|
804
|
-
}, this);
|
805
|
-
this._invokeBehavior(this, name, args);
|
806
|
-
},
|
807
|
-
_invokeBehavior: function (b, name, args) {
|
808
|
-
var fn = b[name];
|
809
|
-
if (fn) {
|
810
|
-
fn.apply(this, args || Polymer.nar);
|
811
|
-
}
|
812
|
-
},
|
813
|
-
_marshalBehaviors: function () {
|
814
|
-
this.behaviors.forEach(function (b) {
|
815
|
-
this._marshalBehavior(b);
|
816
|
-
}, this);
|
817
|
-
this._marshalBehavior(this);
|
818
|
-
}
|
819
|
-
});
|
820
|
-
Polymer.Base._addFeature({
|
821
|
-
_prepExtends: function () {
|
822
|
-
if (this.extends) {
|
823
|
-
this.__proto__ = this._getExtendedPrototype(this.extends);
|
824
|
-
}
|
825
|
-
},
|
826
307
|
_getExtendedPrototype: function (tag) {
|
827
308
|
return this._getExtendedNativePrototype(tag);
|
828
309
|
},
|
@@ -1035,13 +516,12 @@ debouncer.stop();
|
|
1035
516
|
}
|
1036
517
|
}
|
1037
518
|
});
|
1038
|
-
Polymer.version = '1.0.
|
519
|
+
Polymer.version = '1.0.7';
|
1039
520
|
Polymer.Base._addFeature({
|
1040
521
|
_registerFeatures: function () {
|
1041
522
|
this._prepIs();
|
1042
523
|
this._prepAttributes();
|
1043
524
|
this._prepBehaviors();
|
1044
|
-
this._prepExtends();
|
1045
525
|
this._prepConstructor();
|
1046
526
|
},
|
1047
527
|
_prepBehavior: function (b) {
|
@@ -753,7 +753,7 @@ d.appendChild(nc);
|
|
753
753
|
return n;
|
754
754
|
},
|
755
755
|
importNode: function (externalNode, deep) {
|
756
|
-
var doc = this.node instanceof
|
756
|
+
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
757
757
|
var n = nativeImportNode.call(doc, externalNode, false);
|
758
758
|
if (deep) {
|
759
759
|
var c$ = factory(externalNode).childNodes;
|
@@ -941,15 +941,15 @@ DomApi.prototype.cloneNode = function (deep) {
|
|
941
941
|
return this.node.cloneNode(deep);
|
942
942
|
};
|
943
943
|
DomApi.prototype.importNode = function (externalNode, deep) {
|
944
|
-
var doc = this.node instanceof
|
944
|
+
var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
|
945
945
|
return doc.importNode(externalNode, deep);
|
946
946
|
};
|
947
947
|
DomApi.prototype.getDestinationInsertionPoints = function () {
|
948
|
-
var n$ = this.node.getDestinationInsertionPoints();
|
948
|
+
var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
|
949
949
|
return n$ ? Array.prototype.slice.call(n$) : [];
|
950
950
|
};
|
951
951
|
DomApi.prototype.getDistributedNodes = function () {
|
952
|
-
var n$ = this.node.getDistributedNodes();
|
952
|
+
var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
|
953
953
|
return n$ ? Array.prototype.slice.call(n$) : [];
|
954
954
|
};
|
955
955
|
DomApi.prototype._distributeParent = function () {
|
@@ -1407,7 +1407,6 @@ _registerFeatures: function () {
|
|
1407
1407
|
this._prepIs();
|
1408
1408
|
this._prepAttributes();
|
1409
1409
|
this._prepBehaviors();
|
1410
|
-
this._prepExtends();
|
1411
1410
|
this._prepConstructor();
|
1412
1411
|
this._prepTemplate();
|
1413
1412
|
this._prepShady();
|
@@ -75,6 +75,14 @@ for (var i = 0, node = root.firstChild; node; node = node.nextSibling, i++) {
|
|
75
75
|
if (node.localName === 'template' && !node.hasAttribute('preserve-content')) {
|
76
76
|
this._parseTemplate(node, i, list, annote);
|
77
77
|
}
|
78
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
79
|
+
var n = node.nextSibling;
|
80
|
+
while (n && n.nodeType === Node.TEXT_NODE) {
|
81
|
+
node.textContent += n.textContent;
|
82
|
+
root.removeChild(n);
|
83
|
+
n = n.nextSibling;
|
84
|
+
}
|
85
|
+
}
|
78
86
|
var childAnnotation = this._parseNodeAnnotations(node, list, callback);
|
79
87
|
if (childAnnotation) {
|
80
88
|
childAnnotation.parent = annote;
|
@@ -1041,7 +1049,8 @@ Polymer.dom(toElement).setAttribute(name, '');
|
|
1041
1049
|
}
|
1042
1050
|
},
|
1043
1051
|
getContentChildNodes: function (slctr) {
|
1044
|
-
|
1052
|
+
var content = Polymer.dom(this.root).querySelector(slctr || 'content');
|
1053
|
+
return content ? Polymer.dom(content).getDistributedNodes() : [];
|
1045
1054
|
},
|
1046
1055
|
getContentChildren: function (slctr) {
|
1047
1056
|
return this.getContentChildNodes(slctr).filter(function (n) {
|
@@ -2045,9 +2054,11 @@ this.forEachStyleRule(rules, callback);
|
|
2045
2054
|
return this.parser.stringify(rules, preserveProperties);
|
2046
2055
|
},
|
2047
2056
|
forRulesInStyles: function (styles, callback) {
|
2057
|
+
if (styles) {
|
2048
2058
|
for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
|
2049
2059
|
this.forEachStyleRule(this.rulesForStyle(s), callback);
|
2050
2060
|
}
|
2061
|
+
}
|
2051
2062
|
},
|
2052
2063
|
rulesForStyle: function (style) {
|
2053
2064
|
if (!style.__cssRules && style.textContent) {
|
@@ -2826,8 +2837,18 @@ if (!this._scopeSelector && this._needsStyleProperties()) {
|
|
2826
2837
|
this._updateStyleProperties();
|
2827
2838
|
}
|
2828
2839
|
},
|
2840
|
+
_findStyleHost: function () {
|
2841
|
+
var e = this, root;
|
2842
|
+
while (root = Polymer.dom(e).getOwnerRoot()) {
|
2843
|
+
if (Polymer.isInstance(root.host)) {
|
2844
|
+
return root.host;
|
2845
|
+
}
|
2846
|
+
e = root.host;
|
2847
|
+
}
|
2848
|
+
return styleDefaults;
|
2849
|
+
},
|
2829
2850
|
_updateStyleProperties: function () {
|
2830
|
-
var info, scope = this.
|
2851
|
+
var info, scope = this._findStyleHost();
|
2831
2852
|
if (!scope._styleCache) {
|
2832
2853
|
scope._styleCache = new Polymer.StyleCache();
|
2833
2854
|
}
|
@@ -2862,7 +2883,7 @@ styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._s
|
|
2862
2883
|
}
|
2863
2884
|
},
|
2864
2885
|
_computeStyleProperties: function (scopeProps) {
|
2865
|
-
var scope = this.
|
2886
|
+
var scope = this._findStyleHost();
|
2866
2887
|
if (!scope._styleProperties) {
|
2867
2888
|
scope._computeStyleProperties();
|
2868
2889
|
}
|
@@ -2895,7 +2916,7 @@ return style;
|
|
2895
2916
|
},
|
2896
2917
|
serializeValueToAttribute: function (value, attribute, node) {
|
2897
2918
|
node = node || this;
|
2898
|
-
if (attribute === 'class') {
|
2919
|
+
if (attribute === 'class' && !nativeShadow) {
|
2899
2920
|
var host = node === this ? this.domHost || this.dataHost : this;
|
2900
2921
|
if (host) {
|
2901
2922
|
value = host._scopeElementClass(node, value);
|
@@ -2951,7 +2972,6 @@ Polymer.Base._addFeature({
|
|
2951
2972
|
_registerFeatures: function () {
|
2952
2973
|
this._prepIs();
|
2953
2974
|
this._prepAttributes();
|
2954
|
-
this._prepExtends();
|
2955
2975
|
this._prepConstructor();
|
2956
2976
|
this._prepTemplate();
|
2957
2977
|
this._prepStyles();
|
@@ -3421,19 +3441,18 @@ delay: Number
|
|
3421
3441
|
},
|
3422
3442
|
behaviors: [Polymer.Templatizer],
|
3423
3443
|
observers: ['_itemsChanged(items.*)'],
|
3444
|
+
created: function () {
|
3445
|
+
this._instances = [];
|
3446
|
+
},
|
3424
3447
|
detached: function () {
|
3425
|
-
|
3426
|
-
for (var i = 0; i < this.rows.length; i++) {
|
3448
|
+
for (var i = 0; i < this._instances.length; i++) {
|
3427
3449
|
this._detachRow(i);
|
3428
3450
|
}
|
3429
|
-
}
|
3430
3451
|
},
|
3431
3452
|
attached: function () {
|
3432
|
-
if (this.rows) {
|
3433
3453
|
var parentNode = Polymer.dom(this).parentNode;
|
3434
|
-
for (var i = 0; i < this.
|
3435
|
-
Polymer.dom(parentNode).insertBefore(this.
|
3436
|
-
}
|
3454
|
+
for (var i = 0; i < this._instances.length; i++) {
|
3455
|
+
Polymer.dom(parentNode).insertBefore(this._instances[i].root, this);
|
3437
3456
|
}
|
3438
3457
|
},
|
3439
3458
|
ready: function () {
|
@@ -3450,7 +3469,7 @@ var sort = this.sort;
|
|
3450
3469
|
this._sortFn = sort && (typeof sort == 'function' ? sort : function () {
|
3451
3470
|
return dataHost[sort].apply(dataHost, arguments);
|
3452
3471
|
});
|
3453
|
-
this.
|
3472
|
+
this._needFullRefresh = true;
|
3454
3473
|
if (this.items) {
|
3455
3474
|
this._debounceTemplate(this._render);
|
3456
3475
|
}
|
@@ -3461,7 +3480,7 @@ var filter = this.filter;
|
|
3461
3480
|
this._filterFn = filter && (typeof filter == 'function' ? filter : function () {
|
3462
3481
|
return dataHost[filter].apply(dataHost, arguments);
|
3463
3482
|
});
|
3464
|
-
this.
|
3483
|
+
this._needFullRefresh = true;
|
3465
3484
|
if (this.items) {
|
3466
3485
|
this._debounceTemplate(this._render);
|
3467
3486
|
}
|
@@ -3479,7 +3498,7 @@ this.collection = null;
|
|
3479
3498
|
this._error(this._logf('dom-repeat', 'expected array for `items`,' + ' found', this.items));
|
3480
3499
|
}
|
3481
3500
|
this._splices = [];
|
3482
|
-
this.
|
3501
|
+
this._needFullRefresh = true;
|
3483
3502
|
this._debounceTemplate(this._render);
|
3484
3503
|
} else if (change.path == 'items.splices') {
|
3485
3504
|
this._splices = this._splices.concat(change.value.keySplices);
|
@@ -3496,7 +3515,7 @@ path = path.substring(path.indexOf('.') + 1);
|
|
3496
3515
|
var paths = this._observePaths;
|
3497
3516
|
for (var i = 0; i < paths.length; i++) {
|
3498
3517
|
if (path.indexOf(paths[i]) === 0) {
|
3499
|
-
this.
|
3518
|
+
this._needFullRefresh = true;
|
3500
3519
|
if (this.delay) {
|
3501
3520
|
this.debounce('render', this._render, this.delay);
|
3502
3521
|
} else {
|
@@ -3508,102 +3527,111 @@ return;
|
|
3508
3527
|
}
|
3509
3528
|
},
|
3510
3529
|
render: function () {
|
3511
|
-
this.
|
3530
|
+
this._needFullRefresh = true;
|
3512
3531
|
this._debounceTemplate(this._render);
|
3513
3532
|
this._flushTemplates();
|
3514
3533
|
},
|
3515
3534
|
_render: function () {
|
3516
3535
|
var c = this.collection;
|
3517
|
-
if (
|
3536
|
+
if (this._needFullRefresh) {
|
3537
|
+
this._applyFullRefresh();
|
3538
|
+
this._needFullRefresh = false;
|
3539
|
+
} else {
|
3518
3540
|
if (this._sortFn) {
|
3519
|
-
this.
|
3541
|
+
this._applySplicesUserSort(this._splices);
|
3520
3542
|
} else {
|
3521
3543
|
if (this._filterFn) {
|
3522
|
-
this.
|
3544
|
+
this._applyFullRefresh();
|
3523
3545
|
} else {
|
3524
|
-
this.
|
3525
|
-
}
|
3546
|
+
this._applySplicesArrayOrder(this._splices);
|
3526
3547
|
}
|
3527
3548
|
}
|
3528
|
-
if (this._fullRefresh) {
|
3529
|
-
this._sortAndFilter();
|
3530
|
-
this._fullRefresh = false;
|
3531
3549
|
}
|
3532
3550
|
this._splices = [];
|
3533
|
-
var
|
3534
|
-
var
|
3535
|
-
|
3536
|
-
|
3537
|
-
|
3538
|
-
var item = c.getItem(key);
|
3539
|
-
var row = this.rows[i];
|
3540
|
-
rowForKey[key] = i;
|
3541
|
-
if (!row) {
|
3542
|
-
this.rows.push(row = this._insertRow(i, null, item));
|
3551
|
+
var keyToIdx = this._keyToInstIdx = {};
|
3552
|
+
for (var i = 0; i < this._instances.length; i++) {
|
3553
|
+
var inst = this._instances[i];
|
3554
|
+
keyToIdx[inst.__key__] = i;
|
3555
|
+
inst.__setProperty(this.indexAs, i, true);
|
3543
3556
|
}
|
3544
|
-
row.__setProperty(this.as, item, true);
|
3545
|
-
row.__setProperty('__key__', key, true);
|
3546
|
-
row.__setProperty(this.indexAs, i, true);
|
3547
|
-
}
|
3548
|
-
for (; i < this.rows.length; i++) {
|
3549
|
-
this._detachRow(i);
|
3550
|
-
}
|
3551
|
-
this.rows.splice(keys.length, this.rows.length - keys.length);
|
3552
3557
|
this.fire('dom-change');
|
3553
3558
|
},
|
3554
|
-
|
3559
|
+
_applyFullRefresh: function () {
|
3555
3560
|
var c = this.collection;
|
3556
|
-
|
3557
|
-
this.
|
3561
|
+
var keys;
|
3562
|
+
if (this._sortFn) {
|
3563
|
+
keys = c ? c.getKeys() : [];
|
3564
|
+
} else {
|
3565
|
+
keys = [];
|
3558
3566
|
var items = this.items;
|
3559
3567
|
if (items) {
|
3560
3568
|
for (var i = 0; i < items.length; i++) {
|
3561
|
-
|
3569
|
+
keys.push(c.getKey(items[i]));
|
3562
3570
|
}
|
3563
3571
|
}
|
3564
|
-
} else {
|
3565
|
-
this._orderedKeys = c ? c.getKeys() : [];
|
3566
3572
|
}
|
3567
3573
|
if (this._filterFn) {
|
3568
|
-
|
3574
|
+
keys = keys.filter(function (a) {
|
3569
3575
|
return this._filterFn(c.getItem(a));
|
3570
3576
|
}, this);
|
3571
3577
|
}
|
3572
3578
|
if (this._sortFn) {
|
3573
|
-
|
3579
|
+
keys.sort(function (a, b) {
|
3574
3580
|
return this._sortFn(c.getItem(a), c.getItem(b));
|
3575
3581
|
}.bind(this));
|
3576
3582
|
}
|
3583
|
+
for (var i = 0; i < keys.length; i++) {
|
3584
|
+
var key = keys[i];
|
3585
|
+
var inst = this._instances[i];
|
3586
|
+
if (inst) {
|
3587
|
+
inst.__setProperty('__key__', key, true);
|
3588
|
+
inst.__setProperty(this.as, c.getItem(key), true);
|
3589
|
+
} else {
|
3590
|
+
this._instances.push(this._insertRow(i, key));
|
3591
|
+
}
|
3592
|
+
}
|
3593
|
+
for (; i < this._instances.length; i++) {
|
3594
|
+
this._detachRow(i);
|
3595
|
+
}
|
3596
|
+
this._instances.splice(keys.length, this._instances.length - keys.length);
|
3577
3597
|
},
|
3578
3598
|
_keySort: function (a, b) {
|
3579
3599
|
return this.collection.getKey(a) - this.collection.getKey(b);
|
3580
3600
|
},
|
3581
|
-
|
3601
|
+
_applySplicesUserSort: function (splices) {
|
3582
3602
|
var c = this.collection;
|
3583
|
-
var
|
3584
|
-
var
|
3585
|
-
var removedRows = [];
|
3586
|
-
var addedKeys = [];
|
3603
|
+
var instances = this._instances;
|
3604
|
+
var keyMap = {};
|
3587
3605
|
var pool = [];
|
3588
3606
|
var sortFn = this._sortFn || this._keySort.bind(this);
|
3589
3607
|
splices.forEach(function (s) {
|
3590
3608
|
for (var i = 0; i < s.removed.length; i++) {
|
3591
|
-
var
|
3592
|
-
|
3593
|
-
removedRows.push(idx);
|
3594
|
-
}
|
3609
|
+
var key = s.removed[i];
|
3610
|
+
keyMap[key] = keyMap[key] ? null : -1;
|
3595
3611
|
}
|
3596
3612
|
for (var i = 0; i < s.added.length; i++) {
|
3597
|
-
|
3613
|
+
var key = s.added[i];
|
3614
|
+
keyMap[key] = keyMap[key] ? null : 1;
|
3598
3615
|
}
|
3599
3616
|
}, this);
|
3600
|
-
|
3601
|
-
|
3602
|
-
for (var
|
3603
|
-
|
3617
|
+
var removedIdxs = [];
|
3618
|
+
var addedKeys = [];
|
3619
|
+
for (var key in keyMap) {
|
3620
|
+
if (keyMap[key] === -1) {
|
3621
|
+
removedIdxs.push(this._keyToInstIdx[key]);
|
3622
|
+
}
|
3623
|
+
if (keyMap[key] === 1) {
|
3624
|
+
addedKeys.push(key);
|
3625
|
+
}
|
3626
|
+
}
|
3627
|
+
if (removedIdxs.length) {
|
3628
|
+
removedIdxs.sort();
|
3629
|
+
for (var i = removedIdxs.length - 1; i >= 0; i--) {
|
3630
|
+
var idx = removedIdxs[i];
|
3631
|
+
if (idx !== undefined) {
|
3604
3632
|
pool.push(this._detachRow(idx));
|
3605
|
-
|
3606
|
-
|
3633
|
+
instances.splice(idx, 1);
|
3634
|
+
}
|
3607
3635
|
}
|
3608
3636
|
}
|
3609
3637
|
if (addedKeys.length) {
|
@@ -3617,19 +3645,19 @@ return this._sortFn(c.getItem(a), c.getItem(b));
|
|
3617
3645
|
}.bind(this));
|
3618
3646
|
var start = 0;
|
3619
3647
|
for (var i = 0; i < addedKeys.length; i++) {
|
3620
|
-
start = this.
|
3648
|
+
start = this._insertRowUserSort(start, addedKeys[i], pool);
|
3621
3649
|
}
|
3622
3650
|
}
|
3623
3651
|
},
|
3624
|
-
|
3652
|
+
_insertRowUserSort: function (start, key, pool) {
|
3625
3653
|
var c = this.collection;
|
3626
3654
|
var item = c.getItem(key);
|
3627
|
-
var end = this.
|
3655
|
+
var end = this._instances.length - 1;
|
3628
3656
|
var idx = -1;
|
3629
3657
|
var sortFn = this._sortFn || this._keySort.bind(this);
|
3630
3658
|
while (start <= end) {
|
3631
3659
|
var mid = start + end >> 1;
|
3632
|
-
var midKey = this.
|
3660
|
+
var midKey = this._instances[mid].__key__;
|
3633
3661
|
var cmp = sortFn(c.getItem(midKey), item);
|
3634
3662
|
if (cmp < 0) {
|
3635
3663
|
start = mid + 1;
|
@@ -3643,106 +3671,110 @@ break;
|
|
3643
3671
|
if (idx < 0) {
|
3644
3672
|
idx = end + 1;
|
3645
3673
|
}
|
3646
|
-
this.
|
3647
|
-
this.rows.splice(idx, 0, this._insertRow(idx, pool, c.getItem(key)));
|
3674
|
+
this._instances.splice(idx, 0, this._insertRow(idx, key, pool));
|
3648
3675
|
return idx;
|
3649
3676
|
},
|
3650
|
-
|
3651
|
-
var keys = this._orderedKeys;
|
3677
|
+
_applySplicesArrayOrder: function (splices) {
|
3652
3678
|
var pool = [];
|
3679
|
+
var c = this.collection;
|
3653
3680
|
splices.forEach(function (s) {
|
3654
3681
|
for (var i = 0; i < s.removed.length; i++) {
|
3655
|
-
|
3682
|
+
var inst = this._detachRow(s.index + i);
|
3683
|
+
if (!inst.isPlaceholder) {
|
3684
|
+
pool.push(inst);
|
3656
3685
|
}
|
3657
|
-
|
3658
|
-
|
3659
|
-
var c = this.collection;
|
3660
|
-
splices.forEach(function (s) {
|
3661
|
-
var args = [
|
3662
|
-
s.index,
|
3663
|
-
s.removed.length
|
3664
|
-
].concat(s.added);
|
3665
|
-
keys.splice.apply(keys, args);
|
3686
|
+
}
|
3687
|
+
this._instances.splice(s.index, s.removed.length);
|
3666
3688
|
for (var i = 0; i < s.added.length; i++) {
|
3667
|
-
var
|
3668
|
-
|
3669
|
-
|
3689
|
+
var inst = {
|
3690
|
+
isPlaceholder: true,
|
3691
|
+
key: s.added[i]
|
3692
|
+
};
|
3693
|
+
this._instances.splice(s.index + i, 0, inst);
|
3670
3694
|
}
|
3671
3695
|
}, this);
|
3696
|
+
for (var i = this._instances.length - 1; i >= 0; i--) {
|
3697
|
+
var inst = this._instances[i];
|
3698
|
+
if (inst.isPlaceholder) {
|
3699
|
+
this._instances[i] = this._insertRow(i, inst.key, pool, true);
|
3700
|
+
}
|
3701
|
+
}
|
3672
3702
|
},
|
3673
3703
|
_detachRow: function (idx) {
|
3674
|
-
var
|
3704
|
+
var inst = this._instances[idx];
|
3705
|
+
if (!inst.isPlaceholder) {
|
3675
3706
|
var parentNode = Polymer.dom(this).parentNode;
|
3676
|
-
for (var i = 0; i <
|
3677
|
-
var el =
|
3678
|
-
Polymer.dom(
|
3707
|
+
for (var i = 0; i < inst._children.length; i++) {
|
3708
|
+
var el = inst._children[i];
|
3709
|
+
Polymer.dom(inst.root).appendChild(el);
|
3710
|
+
}
|
3679
3711
|
}
|
3680
|
-
return
|
3712
|
+
return inst;
|
3681
3713
|
},
|
3682
|
-
_insertRow: function (idx, pool,
|
3683
|
-
var
|
3684
|
-
|
3714
|
+
_insertRow: function (idx, key, pool, replace) {
|
3715
|
+
var inst;
|
3716
|
+
if (inst = pool && pool.pop()) {
|
3717
|
+
inst.__setProperty(this.as, this.collection.getItem(key), true);
|
3718
|
+
inst.__setProperty('__key__', key, true);
|
3719
|
+
} else {
|
3720
|
+
inst = this._generateRow(idx, key);
|
3721
|
+
}
|
3722
|
+
var beforeRow = this._instances[replace ? idx + 1 : idx];
|
3685
3723
|
var beforeNode = beforeRow ? beforeRow._children[0] : this;
|
3686
3724
|
var parentNode = Polymer.dom(this).parentNode;
|
3687
|
-
Polymer.dom(parentNode).insertBefore(
|
3688
|
-
return
|
3725
|
+
Polymer.dom(parentNode).insertBefore(inst.root, beforeNode);
|
3726
|
+
return inst;
|
3689
3727
|
},
|
3690
|
-
_generateRow: function (idx,
|
3691
|
-
var model = { __key__:
|
3692
|
-
model[this.as] =
|
3728
|
+
_generateRow: function (idx, key) {
|
3729
|
+
var model = { __key__: key };
|
3730
|
+
model[this.as] = this.collection.getItem(key);
|
3693
3731
|
model[this.indexAs] = idx;
|
3694
|
-
var
|
3695
|
-
return
|
3732
|
+
var inst = this.stamp(model);
|
3733
|
+
return inst;
|
3696
3734
|
},
|
3697
3735
|
_showHideChildren: function (hidden) {
|
3698
|
-
|
3699
|
-
|
3700
|
-
this.rows[i]._showHideChildren(hidden);
|
3701
|
-
}
|
3736
|
+
for (var i = 0; i < this._instances.length; i++) {
|
3737
|
+
this._instances[i]._showHideChildren(hidden);
|
3702
3738
|
}
|
3703
3739
|
},
|
3704
|
-
_forwardInstanceProp: function (
|
3740
|
+
_forwardInstanceProp: function (inst, prop, value) {
|
3705
3741
|
if (prop == this.as) {
|
3706
3742
|
var idx;
|
3707
3743
|
if (this._sortFn || this._filterFn) {
|
3708
|
-
idx = this.items.indexOf(this.collection.getItem(
|
3744
|
+
idx = this.items.indexOf(this.collection.getItem(inst.__key__));
|
3709
3745
|
} else {
|
3710
|
-
idx =
|
3746
|
+
idx = inst[this.indexAs];
|
3711
3747
|
}
|
3712
3748
|
this.set('items.' + idx, value);
|
3713
3749
|
}
|
3714
3750
|
},
|
3715
|
-
_forwardInstancePath: function (
|
3751
|
+
_forwardInstancePath: function (inst, path, value) {
|
3716
3752
|
if (path.indexOf(this.as + '.') === 0) {
|
3717
|
-
this.notifyPath('items.' +
|
3753
|
+
this.notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
|
3718
3754
|
}
|
3719
3755
|
},
|
3720
3756
|
_forwardParentProp: function (prop, value) {
|
3721
|
-
|
3722
|
-
|
3723
|
-
row.__setProperty(prop, value, true);
|
3757
|
+
this._instances.forEach(function (inst) {
|
3758
|
+
inst.__setProperty(prop, value, true);
|
3724
3759
|
}, this);
|
3725
|
-
}
|
3726
3760
|
},
|
3727
3761
|
_forwardParentPath: function (path, value) {
|
3728
|
-
|
3729
|
-
|
3730
|
-
row.notifyPath(path, value, true);
|
3762
|
+
this._instances.forEach(function (inst) {
|
3763
|
+
inst.notifyPath(path, value, true);
|
3731
3764
|
}, this);
|
3732
|
-
}
|
3733
3765
|
},
|
3734
3766
|
_forwardItemPath: function (path, value) {
|
3735
|
-
if (this.
|
3767
|
+
if (this._keyToInstIdx) {
|
3736
3768
|
var dot = path.indexOf('.');
|
3737
3769
|
var key = path.substring(0, dot < 0 ? path.length : dot);
|
3738
|
-
var idx = this.
|
3739
|
-
var
|
3740
|
-
if (
|
3770
|
+
var idx = this._keyToInstIdx[key];
|
3771
|
+
var inst = this._instances[idx];
|
3772
|
+
if (inst) {
|
3741
3773
|
if (dot >= 0) {
|
3742
3774
|
path = this.as + '.' + path.substring(dot + 1);
|
3743
|
-
|
3775
|
+
inst.notifyPath(path, value, true);
|
3744
3776
|
} else {
|
3745
|
-
|
3777
|
+
inst.__setProperty(this.as, value, true);
|
3746
3778
|
}
|
3747
3779
|
}
|
3748
3780
|
}
|
@@ -3959,7 +3991,6 @@ created: function () {
|
|
3959
3991
|
Polymer.ImportStatus.whenLoaded(this._readySelf.bind(this));
|
3960
3992
|
},
|
3961
3993
|
_registerFeatures: function () {
|
3962
|
-
this._prepExtends();
|
3963
3994
|
this._prepConstructor();
|
3964
3995
|
},
|
3965
3996
|
_insertChildren: function () {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polymer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Chaplinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|