-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpla-collection.html
More file actions
1 lines (1 loc) · 1.62 KB
/
simpla-collection.html
File metadata and controls
1 lines (1 loc) · 1.62 KB
1
<link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../simpla-element-behavior/simpla-element-behavior.html"> <dom-module id="simpla-collection"> <template> <style>:host{display:block}</style> <template is="dom-if" if="[[editable]]"> <simpla-collection-editor path="[[path]]" as="[[as]]" items="{{items}}" active="{{active}}"> </simpla-collection-editor> </template> <slot></slot> </template> <script>!function(){"use strict";var e="simpla-collection-editor.html",t=["path","sid","gid"],r={type:"Collection",dataProperties:["items"]};Polymer({is:"simpla-collection",properties:{items:{type:Array,notify:!0,value:function(){return[]}},as:{type:String,notify:!0,value:"item"},active:{type:Boolean,notify:!0,value:!1},editable:{type:Boolean,observer:"_importEditor",notify:!0,value:!1}},observers:["_render(items.*)"],behaviors:[SimplaBehaviors.Element(r)],_render:function(){var e=Polymer.dom(this),r=e.querySelector("template"),i="["+this.as+"]",o=void 0,n=void 0;o=function(e){return function(t){var r=function(r){var o=r.getAttribute(t);r.setAttribute(t,o.replace(i,e))};return function e(i){var o=i.querySelectorAll("["+t+"]"),n=i.querySelectorAll("template");return[].forEach.call(o,r),[].forEach.call([].map.call(n,function(e){return e.content}),e),i}}},n=function(e){return t.map(o(e.id)).reduce(function(e,t){return t(e)},document.importNode(r.content,!0))},e.children.filter(function(e){return e!==r}).forEach(function(t){return e.removeChild(t)}),this.items.map(n).forEach(function(t){return e.appendChild(t)}),Polymer.dom.flush()},_importEditor:function(t){t&&this.importHref(this.resolveUrl(e))}})}(); </script> </dom-module>