@evs-chris/raui
Advanced tools
Comparing version 0.5.16 to 0.5.17
@@ -999,3 +999,3 @@ import Ractive from 'ractive'; | ||
var columns = this._init.sets.columns; | ||
this._init.sets['meta.expand'] = rowEl && rowEl.f && rowEl.f.length; | ||
this._init.sets['meta.expand'] = rowEl && rowEl.f && rowEl.f.length && rowEl.f; | ||
@@ -1002,0 +1002,0 @@ var sortKey = '[_0._setSort(_1,_2)]'; |
@@ -1,1 +0,1 @@ | ||
import Ractive from"ractive";import{grid,style as gridStyle}from"./grid";import click from"./event-click";import expand from"./transition-expand";import scrolled from"./scrolled";import{sized}from"./watch-size";import globalRegister from"./globalRegister";var sortRE=/^([-+])?([^\s]+)$/;function isString(v){return typeof v==="string"}function isNumber(v){return typeof v==="number"}function isObject(v){return typeof v==="object"}function isRegex(v){return typeof v==="object"&&Object.prototype.toString.call(v)==="RegExp"}export var Table=function(Ractive){function Table(opts){Ractive.call(this,opts)}if(Ractive)Table.__proto__=Ractive;Table.prototype=Object.create(Ractive&&Ractive.prototype);Table.prototype.constructor=Table;var prototypeAccessors={selections:{configurable:true}};Table.prototype._allSelected=function _allSelected(){var sel=this.get("selections");var visible=this.get("paginate")==="virtual"?this.get("rows"):this.get("visibleRows");for(var i=0;i<visible.length;i++){if(!~sel.indexOf(visible[i])){return false}}return visible.length&&true};Table.prototype.nodeSet=function nodeSet(node,prop,value){node[prop]=value};Table.prototype._expand=function _expand(idx){var this$1=this;var which=this.get("visibleRows")[idx];var current=this.get("expanded");var expanded=this.find(".rtable-row-expand");if(expanded){this.transition("expand",expanded,{outro:true}).then(function(){if(current===which){this$1.set("expanded",null)}else{this$1.set("expanded",which);this$1.transition("expand",this$1.find(".rtable-row-expand"),{intro:true})}})}else{if(which===current){this.set("expanded",null)}else{this.set("expanded",which);this.transition("expand",this.find(".rtable-row-expand"),{intro:true})}}};Table.prototype._setSort=function _setSort(idx,ev){var col=this.get("columns."+idx);if(!col||!(col.sort||col.filter)){return}var cs=col.sort||col.filter;var sort=cs;if(isString(sort)&&sort[0]==="~"){sort=this.get(sort)}var multi=ev.ctrlKey;var sorts=this.get("sort");if(!Array.isArray(sort)){sort=[sort]}if(!sorts){sorts=[]}else if(!Array.isArray(sorts)){sorts=[sorts]}if(!sorts.length){this.set("sort",sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s}))}else{var cur=sorts.map(function(s){return sortRE.exec(s).slice(1)});var overlap=sort.reduce(function(a,c){return a&&!!cur.find(function(s){return s[1]===c})},true);if(overlap&&sorts.length!==sort.length&&!multi){this.set("sort",sort.map(function(s){return"+"+sort}))}else if(!multi){if(overlap){this.set("sort",cur.map(function(s){return""+(s[0]==="+"?"-":"+")+s[1]}))}else{this.set("sort",sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s}))}}else{if(overlap){this.set("sort",cur.map(function(s){return~sort.indexOf(s[1])?""+(s[0]==="+"?"-":"+")+s[1]:s[0]+s[1]}))}else{this.set("sort",sorts.concat(sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s})))}}}};Table.prototype._select=function _select(src,ev){var sels=this.get("selections");if(!sels){sels=[];this.set("selections",sels)}var i=sels.indexOf(src);if(~i){this.splice("selections",i,1)}else{this.push("selections",src)}if(i>=sels.length||sels.length===1){this.set("selected",sels[sels.length-1])}this.fire("selection",{},{item:sels[sels.length-1],items:sels});setTimeout(function(){return ev.target.checked=!~i});return false};Table.prototype.select=function select(){var selected=this.get("selected");if(selected){this.fire("selected",{},selected,this.get("rows").indexOf(selected),this.get("visibleRows").indexOf(selected))}};prototypeAccessors.selections.get=function(){return this.get("selections")||[]};Table.prototype.selectionOffset=function selectionOffset(offset){var selected=this.get("selected");var visible=this.get("visibleRows");if(!selected||!~visible.indexOf(selected)){var next=offset>0?visible[0]:visible[visible.length-1];this.set({selected:next,selections:[next]})}else{var idx=visible.indexOf(selected);if(offset>0?idx+offset>=visible.length:idx+offset<0){var move=offset<1?-1:1;if(move<0&&this.get("page")+move>=0||move>0&&this.get("page")+move<this.get("pagination.total")){this.add("page",move)}visible=this.get("visibleRows");var next$1=offset>0?visible[0]:visible[visible.length-1];this.set({selected:next$1,selections:[next$1]})}else{this.set({selected:visible[idx+offset],selections:[visible[idx+offset]]})}}this.fire("selection",{},{item:this.get("selected"),items:this.get("selections")})};Table.prototype.selectionDown=function selectionDown(){this.selectionOffset(1)};Table.prototype.selectionUp=function selectionUp(){this.selectionOffset(-1)};Table.prototype._selectGroup=function _selectGroup(idx){var this$1=this;var grp=idx;if(this.get("page")){grp+=this.get("page")*this.get("pagination.per")}var rows=this.get("rows");var groups=this.get("groups");var sels=this.get("selections");var x=rows[grp++];var xs=["selections"];var ss=[];var i;if(!~(i=sels.indexOf(x))){xs.push(x)}else{ss.push(i)}while(grp<rows.length&&!(grp in groups)){x=rows[grp++];if(!~(i=sels.indexOf(x))){xs.push(x)}else{ss.push(i)}}if(xs.length===1){i=ss.length;while(i--){this$1.splice("selections",ss[i],1)}}else{this.push.apply(this,xs)}return false};Table.prototype._groupSelected=function _groupSelected(idx){var grp=idx;if(this.get("page")){grp+=this.get("page")*this.get("pagination.per")}var rows=this.get("rows");var groups=this.get("groups");var sels=this.get("selections");if(!~sels.indexOf(rows[grp++])){return false}while(grp<rows.length&&!(grp in groups)){if(!~sels.indexOf(rows[grp++])){return false}}return true};Object.defineProperties(Table.prototype,prototypeAccessors);return Table}(Ractive);function columnGetter(table,col){if(!table||!col){return}if(typeof col.get==="function"){return col.get}var getters=table._getters||(table._getters={});var v=col.filter;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}var k=Array.isArray(v)?v.join("."):isString(v)?v:false;if(!k){return}if(!getters[k]){if(isString(v)&&~v.indexOf("*")){var parts=Ractive.splitKeypath(v);getters[k]=function(obj){var res=applyPathReduce(obj,parts);return res.v||res.l}}else{if(isString(v)){v=Ractive.splitKeypath(v)}getters[k]=function(obj){return applyPath(obj,v)}}}return getters[k]}function fieldGetter(table,field){if(!table||!field){return}if(typeof field.get==="function"){return field.get}var getters=table._getters||(table._getters={});var v=field.path;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}var k=Array.isArray(v)?v.join("."):isString(v)?v:false;if(k){if(!getters[k]){if(isString(v)&&~v.indexOf("*")){var parts=Ractive.splitKeypath(v);getters[k]=function(obj){var res=applyPathReduce(obj,parts);return res.v||res.l}}else{if(isString(v)){v=Ractive.splitKeypath(v)}getters[k]=function(obj){return applyPath(obj,v)}}}return getters[k]}else{v=field.value;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}if(typeof v==="function"){return v}}}Ractive.extendWith(Table,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable",g:1},{n:"class-rtable-virtual",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="virtual"'}}]},{n:"class-rtable-auto",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="auto"'}}]},{n:"class-rtable-fixed",t:13,f:[{t:2,r:"~/fixed"}]},{n:"class-rtable-border",t:13,f:[{t:2,r:"~/border"}]},{n:"class-rtable-fixed-header",t:13,f:[{t:2,r:"~/fixedHeader"}]},{n:"class-rtable-scrolled",t:13,f:[{t:2,x:{r:["~/scroll"],s:'!~(_0||"").indexOf("top")'}}]},{n:"class-rtable-with-select",t:13,f:[{t:2,r:"~/allowSelect"}]},{n:"class-rtable-valign-top",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="top"'}}]},{n:"class-rtable-valign-center",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="center"'}}]},{n:"class-rtable-valign-bottom",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="bottom"'}}]},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{n:"grid",t:71,f:{r:["~/scrollOffset"],s:"[{offset:_0}]"}}],f:[{t:8,r:"grid-head"}]}],n:50,r:"~/fixedHeader"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-top",g:1},{t:4,f:[{n:["scroll"],t:70,f:"scroll"},{n:"sized",t:71,f:{r:[],s:'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]'}}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}},{t:4,f:[{n:"scrolled",t:71,f:{r:[],s:'["~/scroll"]'}}],n:50,r:"~/fixedHeader"}],f:[{t:7,e:"div",m:[{n:"grid",t:71},{t:4,f:[{n:"style-margin-top",f:[{t:2,r:"~/virtual.above"},"px"],t:13},{n:"style-margin-bottom",f:[{t:2,r:"~/virtual.below"},"px"],t:13}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}}],f:[{t:4,f:[{t:8,r:"grid-head"}],n:51,r:"~/fixedHeader"}," ",{t:4,f:[{t:8,r:"grid-row"}],n:52,z:[{n:"source",x:{r:"~/items"}},{n:"shuffle",x:{x:{r:[],s:"true"}}}],r:"~/visibleRows"}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-row row t1",g:1}],f:[{t:16,r:"empty"}]}],n:50,x:{r:["~/rows.length"],s:"!_0"}}]}]}," ",{t:4,f:[{t:8,r:"pagination"}],n:50,x:{r:["~/paginate"],s:'_0!=="virtual"'}}]}],e:{'_0==="virtual"':function(_0){return _0==="virtual"},'_0==="auto"':function(_0){return _0==="auto"},'!~(_0||"").indexOf("top")':function(_0){return!~(_0||"").indexOf("top")},'_0==="top"':function(_0){return _0==="top"},'_0==="center"':function(_0){return _0==="center"},'_0==="bottom"':function(_0){return _0==="bottom"},"[{offset:_0}]":function(_0){return[{offset:_0}]},'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]':function(){return[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]},'["~/scroll"]':function(){return["~/scroll"]},true:function(){return true},"!_0":function(_0){return!_0},'_0!=="virtual"':function(_0){return _0!=="virtual"},"(_0+_1)%2===1":function(_0,_1){return(_0+_1)%2===1},"[_0._setSort(_1,_2)]":function(_0,_1,_2){return[_0._setSort(_1,_2)]},"[_0._select(_1,_2),false]":function(_0,_1,_2){return[_0._select(_1,_2),false]},'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]':function(_0,_1,_2){return[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]},"[_0._expand(_1)]":function(_0,_1){return[_0._expand(_1)]},"[_0.stopPropagation()]":function(_0){return[_0.stopPropagation()]},"_0.indexOf(_1)":function(_0,_1){return _0.indexOf(_1)},"_0===_1":function(_0,_1){return _0===_1},"_0>0":function(_0){return _0>0},"!_0&&_1>0":function(_0,_1){return!_0&&_1>0},'_0==="boolean"':function(_0){return _0==="boolean"},"_0._allSelected()":function(_0){return _0._allSelected()},"_0*_1+1":function(_0,_1){return _0*_1+1},"_2+1===_0?_1:(_2+1)*_3":function(_0,_1,_2,_3){return _2+1===_0?_1:(_2+1)*_3},"_0&&_1":function(_0,_1){return _0&&_1},"_0===1":function(_0){return _0===1},"_0._allSelected()&&_1<_2":function(_0,_1,_2){return _0._allSelected()&&_1<_2},'[_0.set("page",_1-1)]':function(_0,_1){return[_0.set("page",_1-1)]},'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]':function(_0,_1,_2,_3,_4){return[/^\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1)||_2.nodeSet(_3,"value",_4+1)]},"_0==_1+1":function(_0,_1){return _0==_1+1},'[_0.set("page",_2[_1-1])]':function(_0,_1,_2){return[_0.set("page",_2[_1-1])]},'_0==="..."':function(_0){return _0==="..."},'[_0.set("page",_1+1)]':function(_0,_1){return[_0.set("page",_1+1)]},"_0<_1-1":function(_0,_1){return _0<_1-1}},p:{"csp-dummy":[{t:7,e:"div",m:[{n:"class-rtable-odd",t:13,f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{n:"class-top",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="top"'}}]},{n:"class-bottom",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="bottom"'}}]},{n:"class-center",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="center"'}}]},{n:["click"],t:70,f:{r:["@this",".index","@event"],s:"[_0._setSort(_1,_2)]"}},{n:["click"],t:70,f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}},{n:["click"],t:70,f:{r:["~/rows","~/visibleRows","."],s:'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]'}},{n:["click"],t:70,f:{r:["@this","@index"],s:"[_0._expand(_1)]"}},{n:["click"],t:70,f:{r:["@event"],s:"[_0.stopPropagation()]"}}]}," ",{t:4,f:["..."],n:50,x:{r:["~/selections","."],s:"_0.indexOf(_1)"}}," ",{t:4,f:["..."],n:50,x:{r:[".","~/expanded"],s:"_0===_1"}}," ",{t:4,f:["..."],n:50,x:{r:["~/virtual.offset"],s:"_0>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/columns.0.type"],s:'_0==="boolean"'}}," ",{t:4,f:["..."],n:50,x:{r:["@this"],s:"_0._allSelected()"}}],empty:[{t:7,e:"div",f:[{t:7,e:"div",f:["No data."]}]}],pagination:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-bottom",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-info",g:1}],f:[{t:4,f:[{t:2,x:{r:["~/page","~/pagination.per"],s:"_0*_1+1"}}," - ",{t:2,x:{r:["~/pagination.total","~/rows.length","~/page","~/pagination.per"],s:"_2+1===_0?_1:(_2+1)*_3"}}," of ",{t:2,r:"~/rows.length"},{t:4,f:[" (",{t:2,r:"~/items.length"}," total)"],n:50,r:"~/isFiltered"}],n:50,x:{r:["pagination","rows.length"],s:"_0&&_1"}}," ",{t:4,f:[""],n:50,x:{r:["_paginate"],s:"_0===1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-select-all-all",g:1}],f:[{t:4,f:[{t:2,r:"selections.length"}," of ",{t:2,r:"rows.length"}," selected",{t:4,f:[" - ",{t:7,e:"a",m:[{n:"href",f:"#",t:13,g:1},{n:["click"],t:70,f:"selectAllAll"}],f:["Select All"]}],n:50,x:{r:["@this","selections.length","rows.length"],s:"_0._allSelected()&&_1<_2"}}],n:50,x:{r:["selections.length"],s:"_0>0"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-pages",g:1}],f:[{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1-1)]'}}],f:["Previous"]}],n:50,x:{r:["~/page"],s:"_0>0"}}," ",{t:4,f:[{t:4,f:[{t:7,e:"input",m:[{n:["change"],t:70,f:{r:["~/pagination.total","@node.value","@this","@node","~/page"],s:'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]'}},{n:"value",f:[{t:2,r:"."}],t:13},{t:73,v:"t",f:"false"}]}],n:50,x:{r:[".","~/page"],s:"_0==_1+1"}},{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","@index","../"],s:'[_0.set("page",_2[_1-1])]'}}],f:["..."]}," "],n:50,x:{r:["."],s:'_0==="..."'},l:1},{t:4,f:[" ",{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","."],s:'[_0.set("page",_1-1)]'}}],f:[{t:2,r:"."}]}],n:51,l:1}],n:52,r:"~/pagination.array"}," ",{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1+1)]'}}],f:["Next"]}],n:50,x:{r:["~/page","~/pagination.total"],s:"_0<_1-1"}}]}]}]}},css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.table.primary"));var active=Object.assign({},primary,data("raui.primary.active"),data("raui.table.primary.active"));var table=Object.assign({selected:{}},data("raui.table"));return"\n .rtable {\n display: flex;\n flex-direction: column;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n box-sizing: border-box;\n flex-grow: 2;\n }\n \n .rtable-group > div > div,\n .rtable-header > div > div,\n .rtable-row > div > div {\n padding: 0.5em;\n overflow: inherit;\n text-overflow: inherit;\n line-height: 1em;\n }\n .rtable-row > .rtable-no-pad > div {\n padding: 0;\n }\n \n .rtable-auto .row > *,\n .rtable-fixed .row > *\n {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n \n .rtable-header > div > div, .rtable-column {\n overflow: hidden;\n }\n \n .rtable-number-column {\n text-align: right;\n }\n .rtable-date-column {\n text-align: right;\n }\n \n .rtable-sortable {\n cursor: pointer;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .grid .row.rtable-row, .grid .rtable-header > .row {\n width: auto;\n min-width: min-content;\n flex-grow: 1;\n }\n \n .rtable-row-wrap {\n color: "+(primary.fg||"#222")+";\n border-style: solid;\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-width: 0 0 1px 0;\n background-color: "+(table.even||primary.bga||"#f4f4f4")+";\n }\n .rtable-row-wrap.rtable-odd {\n background-color: "+(table.odd||primary.bg||"#fff")+";\n }\n .rtable-row-wrap:hover, .rtable-row-wrap.rtable-selected:hover {\n background-color: "+(table.over||active.bg||"rgba(128, 182, 229, 0.2)")+";\n position: relative;\n box-shadow: inset 1px 0 0 #dadce0,inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n z-index: 1;\n }\n \n .rtable-row-wrap.rtable-selected {\n background-color: "+(table.selected.bg||"rgba(0, 119, 238, 0.12)")+";\n color: "+(table.selected.fg||primary.fg||"#222")+";\n }\n .rtable-row-wrap.rtable-selected.rtable-odd {\n background-color: "+(table.selected.odd||"rgba(0, 119, 238, 0.1)")+";\n }\n \n .rtable-row-wrap {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n \n .rtable-border .rtable-row .rtable-column,\n .rtable-border .rtable-group .rtable-column {\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 0 0 1px 1px;\n margin: 0 0 -1px -1px;\n }\n \n .rtable-border .rtable-row-wrap {\n border-width: 0 1px 1px 1px;\n }\n \n .rtable-border .rtable-row-expand {\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 1px 0 0 1px;\n margin-left: -1px;\n width: 100%;\n }\n \n .rtable-group {\n border-bottom: 2px solid "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap, .rtable-header.rtable-row-wrap:hover {\n font-weight: bold;\n background-color: "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap {\n border-bottom: 2px solid "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-top {\n flex-grow: 5;\n flex-shrink: 1;\n overflow-y: auto;\n margin: 0.5em 0;\n position: relative;\n }\n .rtable-fixed-header .rtable-header {\n margin-top: 0.5em;\n position: relative;\n z-index: 1;\n }\n .rtable-fixed-header.rtable-scrolled .rtable-header {\n box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n }\n .rtable-fixed-header .rtable-top {\n margin-top: 0;\n }\n \n .rtable-bottom {\n display: flex;\n flex-wrap: wrap;\n flex-shrink: 0;\n padding: 0 0.5em 0.5em 0.5em;\n justify-content: space-between;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .rtable-bottom > * {\n padding: 0.5em;\n }\n \n .rtable-pages span {\n margin: 0.3em;\n cursor: pointer;\n }\n .rtable-pages span:first-of-type {\n margin-left: 0;\n }\n .rtable-pages input {\n text-align: center;\n width: 2.5em;\n font-size: 1em;\n background-color: transparent;\n border: none;\n padding: 0;\n font-weight: bold;\n text-decoration: underline;\n }\n \n /* checkboxes */\n .rtable-select {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n position: absolute;\n display: block;\n margin: 0;\n width: 2em;\n height: 2em;\n box-shadow: none;\n outline: none;\n opacity: 0;\n top: 0;\n left: 0;\n border-radius: 2em;\n transform: translate(-0.1em, 0) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n background-color: "+(primary.bc||"#ccc")+";\n cursor: pointer;\n }\n \n .rtable-select-header > div, .rtable-select-row > div, .rtable-header > div.rtable-select-header > div {\n padding: 0;\n overflow: visible;\n width: 1.5em;\n position: relative;\n line-height: 1.8em;\n cursor: pointer;\n }\n \n .rtable-select:checked {\n background-color: "+(primary.fga||"#07e")+';\n }\n \n .rtable-select-header:hover .rtable-select, .rtable-select-row:hover .rtable-select {\n opacity: 0.04;\n }\n \n .rtable-select:focus {\n opacity: 0.12;\n transform: translate(-0.1em, 0) scale(1);\n }\n \n .rtable-select-header:hover .rtable-select:focus, .rtable-select-row:hover .rtable.select:focus {\n opacity: 0.16;\n }\n \n .rtable-select:active {\n opacity: 0.4;\n transform: translate(-0.1em, 0) scale(0);\n transition: transform 0s, opacity 0s;\n }\n \n .rtable-select-row > div:before, .rtable-select-header > div:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n border: solid 2px; /* Safari */\n border-color: '+(primary.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n transition: border-color 0.2s, background-color 0.2s;\n }\n \n .rtable-select-row > div:after, .rtable-select-header > div:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.35em, 0.55em) rotate(-45deg);\n opacity: 0;\n }\n \n .rtable-selected .rtable-select-row > div:before, .rtable-all-selected > div:before {\n border-color: '+(primary.fga||"#07e")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rtable-selected .rtable-select-row > div:after, .rtable-all-selected > div:after {\n border-color: "+(primary.bg||"#fff")+";\n opacity: 1;\n }\n \n .rtable-row-wrap > .rtable-select-header,\n .rtable-row-wrap > .rtable-select-row {\n text-align: center;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: 2em;\n }\n \n .rtable-column button, .rtable-column .btn {\n padding: 0 0.5em;\n margin: 0.2em 0.5em;\n min-height: 0;\n }\n \n .rtable-column.rtable-editing {\n padding: 0;\n }\n .rtable-column.rtable-editing input {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n margin: 0;\n border: none;\n background-color: transparent;\n padding: 0.25em 0.5em;\n }\n \n .rtable-valign-top .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-top > div {\n display: flex;\n height: 100%;\n align-items: flex-start;\n box-sizing: border-box;\n }\n .rtable-valign-bottom .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-bottom > div {\n display: flex;\n height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n }\n .rtable-valign-center .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-center > div {\n display: flex;\n height: 100%;\n align-items: center;\n box-sizing: border-box;\n }\n "+(data("table.includeGrid")!==false?gridStyle(data):"")}.call(this,data)].join(" ")},cssId:"rtable",noCssTransform:true,attributes:["paginate","items","filter","sort","helpers","fixed","allowSelect","allowSelectAll","border","fixedHeader","valign"],components:{table:false,Table:false},syncComputedChildren:true,decorators:{grid:grid,sized:sized},events:{},use:[click({name:"clickd",count:1}),click({name:"dblclickd",count:2}),expand(),scrolled()],on:{construct:construct,config:function config(){this.set(this._init.sets);Object.assign(this.partials,this._init.partials)},render:function render(){if(this._autoObserver){this._autoObserver.fire()}},selectAll:function selectAll(){var sel,item;if(this._allSelected()){item=null;sel=[];this.set({selections:sel,selected:item})}else{sel=(this.get("paginate")==="virtual"?this.get("rows"):this.get("visibleRows")).slice();item=sel[0];this.set({selections:sel,selected:item})}this.fire("selection",{},{item:item,items:sel})},selectAllAll:function selectAllAll(){var item=null;var sel=this.get("rows").slice();this.set({selections:sel,selected:item});this.fire("selection",{},{item:item,items:sel});return false}},observe:{paginate:{handler:function handler(v){var this$1=this;if(v==="auto"||v==="virtual"||v instanceof Ractive){if(this._autoObserver){this._autoObserver.cancel()}if(this._scrollListener){this._scrollListener.cancel()}var root=v==="auto"||v==="virtual"?this.root:v;var sized=false;var fn=function(){if(!this$1.rendered){return}var top=this$1.find(".rtable-top");if(!top){return}if(!this$1.get("items.length")){if(!this$1._autoLenObserver){this$1._autoLenObserver=this$1.observeOnce("items",function(){this$1._autoLenObserver=0;setTimeout(fn)})}return}var size=top.clientHeight+","+top.clientWidth;if(fn.last===size&&sized){return}var header=this$1.find(".rtable-header");if(!header){return}var rows=Array.apply(null,this$1.findAll(".rtable-live")).map(function(r){return r.offsetHeight});if(rows.length<5){var auto=Math.floor(top.clientHeight/header.offsetHeight);if(auto<5){auto=5}this$1.set("_paginate",auto);rows=Array.apply(null,this$1.findAll(".rtable-live")).map(function(r){return r.offsetHeight})}if(rows.length>0){sized=true}else{rows=[25]}var avg=Math.ceil(rows.reduce(function(a,c){return a+c},0)/rows.length);this$1._avgSize=avg;var fit=Math.floor((top.clientHeight-header.offsetHeight)/avg);if(v==="virtual"){fit=fit+10;if(fit<30){fit=30}}this$1.set("_paginate",fit);fn.last=size};var tm;var fnd=function(){if(tm){clearTimeout(tm)}tm=setTimeout(function(){fn();tm=null;if(sized&&this$1._scrollListener){this$1._scrollListener.fn()}},50)};this._autoObserver=this.observe("~/tableHeight",fnd);this._autoObserver.fire=fnd;if(v==="virtual"){var lock=false;var node;var fn$1=function(){if(!this$1.rendered){node=null;return}if(!node){node=this$1.find(".rtable-top")}if(!sized){return fnd()}var top=node.scrollTop;var virtual=this$1.get("virtual")||{};var offset=virtual.offset;var visible=this$1.get("_paginate");var page=visible-10;var count=this$1.get("rows.length");if(visible>count){visible=count}var avg=this$1._avgSize;var pageSize=page*avg;var wnd=Math.floor(top/avg);var first=wnd-5;if(first<0){first=0}var hardFirst=first;if(first+visible>count){first=count-visible}if(offset===first){return lock=false}if(!isNumber(offset)||isNaN(offset)||top<virtual.top+pageSize||top>virtual.bottom-pageSize||offset>0&&top<avg*page){var amtAbove=hardFirst;var amtBelow=count-hardFirst-visible;if(amtAbove<0){amtBelow+=amtAbove*-1;amtAbove=0}else if(amtAbove>count-visible){amtAbove=count-visible}if(amtBelow<0){amtBelow=0}var above=amtAbove*avg;var below=amtBelow*avg;var vis,next;if(first<offset+visible&&first>offset-visible){if(first>offset){vis=this$1.findAll(".rtable-live")[first-offset]}else{vis=this$1.findAll(".rtable-live")[offset-first]}}if(vis&&first>0&&vis.offsetTop>node.scrollTop-pageSize-5&&vis.offsetTop<node.scrollTop+pageSize){next=vis.offsetTop}this$1.set({"virtual.above":above,"virtual.below":below,"virtual.offset":first});if(typeof next==="number"){if(next!==vis.offsetTop){this$1.set("virtual.above",above+(next-vis.offsetTop))}}this$1.set({"virtual.top":this$1.get("virtual.above"),"virtual.bottom":node.scrollHeight-below})}lock=false};var scroll=this._scrollListener=this.on("scroll",function(ref){var node=ref.node;if(!lock){lock=true;requestAnimationFrame(fn$1)}});this._scrollListener.fn=fn$1;scroll.observer=this.observe("rows.length",function(){this$1.set("virtual.offset",null);fn$1()},{init:false,strict:true});var cancel=scroll.cancel;scroll.cancel=function(){cancel();scroll.observer.cancel()}}fnd()}else{if(this._autoObserver){this._autoObserver.cancel()}if(this._scrollListener){this._scrollListener.cancel()}}if(isNumber(v)){this.set("_paginate",v)}},defer:true}},data:function data(){return{page:0,selections:[],allowSelect:true,allowSelectAll:true,showGroups:true,allowGroupSelect:true,expanded:null,minPerPage:10}},computed:{rows:{get:function get(){var this$1=this;var columns=this.viewmodel.value.columns;var fields=this.viewmodel.value.fields;var cols=columns.filter(function(c){return c.filter}).map(function(c){return columnGetter(this$1,c)}).filter(function(c){return c});var list=this.get("items")||[];var src=list;var filter=this.get("filter");var sort=this.get("sort");if(isObject(filter)&&!Array.isArray(filter)){filter=[filter]}if((filter instanceof RegExp||isString(filter))&&filter){var nocase=filter===""+filter.toLowerCase()||filter===""+filter.toUpperCase();try{var re=isString(filter)?new RegExp(filter,nocase?"i":""):filter;list=list.filter(function(l){var i=cols.length;while(i--){var v=l&&cols[i](l);if(v&&isString(v)&&re.test(v)){return true}}})}catch(e){}}else if(Array.isArray(filter)){var flts=buildFilter(this,filter,columns,fields);var recache={};try{list=list.filter(function(l){return flts.reduce(function(ok,flt){return ok&&applyFilter.call(this$1,flt,l,recache)},true)})}catch(e){}}if(isString(sort)||isObject(sort)&&!Array.isArray(sort)){sort=[sort]}if(Array.isArray(sort)){sort=sort.map(function(f){if(isString(f)){var id=f[0]==="-"||f[0]==="+"?f.substr(1):f;var col=columns.find(function(c){return c.id===id});var fl=fields.find(function(c){return c.id===id});var res={dir:f[0]==="-"?-1:1,get:col&&columnGetter(this$1,col)||fl&&fieldGetter(this$1,fl)||columnGetter(this$1,{filter:id})};if(col&&col.type==="number"||fl&&fl.type==="number"){var get=res.get;res.get=function(v){return numberify(get.call(this,v))}}return res}else if(f&&typeof f==="object"){var col$1=columns.find(function(c){return c.id===f.id});var fl$1=fields.find(function(c){return c.id===f.id});var res$1={dir:isNumber(f.dir)?f.dir:f.dir==="desc"?-1:1,get:typeof f.get==="function"&&f.get||col$1&&columnGetter(this$1,col$1)||fl$1&&fieldGetter(this$1,fl$1)||f.path&&fieldGetter(this$1,{filter:f.path,value:f.value})};if(f.type==="number"||col$1&&col$1.type==="number"||fl$1&&fl$1.type==="number"){var get$1=res$1.get;res$1.get=function(v){return numberify(get$1.call(this,v))}}return res$1}}).filter(function(s){return s&&s.get});list.sort(function(a,b){var aa,bb,p;for(var i=0;i<sort.length;i++){aa=sort[i].get.call(this$1,a);bb=sort[i].get.call(this$1,b);p=sort[i].dir*compare(aa,bb);if(p!==0){return p}}return p})}this.set("isFiltered",src.length!==list.length);return list}},visibleRows:{get:function get(){var this$1=this;var rows=this.get("rows");var paginate=this.get("paginate");var per=paginate;var intPer=this.get("_paginate");var offset=this.get("page")||0;var virtual=this.get("virtual");if(!per){return rows}if(typeof per!=="number"&&isNaN(+per)){if(per==="auto"||per==="virtual"||per instanceof Ractive){per=intPer||1}else{per=30}}if(per<this.get("minPerPage")){per=this.get("minPerPage")}if(paginate==="virtual"){offset=virtual&&virtual.offset||0;return rows.slice(offset,offset+per)}else{if(offset*per>rows.length){setTimeout(function(){return this$1.set("page",0)},0)}return rows.slice(per*offset,per*offset+per)}}},pagination:{get:function get(){var items=this.get("items")||empty;var rows=this.get("rows");var paginate=this.get("paginate");var per=paginate;var offset=this.get("page")||0;if(typeof per!=="number"&&isNaN(per)){per=this.get("_paginate")}if(per<this.get("minPerPage")){per=this.get("minPerPage")}if(!per){return}var total=Math.ceil(rows.length/per);var info={max:Math.ceil(items.length/per),total:total,per:per};if(paginate==="virtual"){info.height=this._avg*rows.length}if(info.total>14){var arr=info.array=[];if(offset>5){arr.push(1,2,3,"...")}else{arr.push(1,2,3,4,5,6,7,8)}if(offset>5&&offset+6<total){arr.push(offset-1,offset,offset+1,offset+2,offset+3,"...",total-2,total-1,total)}else if(offset+6<total){arr.push("...",total-2,total-1,total)}else{arr.push(total-7,total-6,total-5,total-4,total-3,total-2,total-1,total)}}else{info.array=Array.apply(null,{length:info.total}).map(function(v,i){return i+1})}return info}},groups:{get:function get(){var this$1=this;var rows=this.get("rows");var last,cur;var res={};for(var i=0;i<rows.length;i++){cur=rows[i][this$1._init.by];if(cur!=last){res[i]=1}last=cur}return res}}}});function applyPath(src,path){if(path.length&&!src&&typeof src!=="object"){return}var res=src;for(var i=0;i<path.length;i++){res=res[path[i]];if(typeof res!=="object"||!res){return i+1<path.length?undefined:res}}return res}function applyPathReduce(src,path){if(!path.length){return{v:src}}if(path.length&&typeof src!=="object"){return{n:1}}var key=path[0];if(key==="*"&&Array.isArray(src)){var next=path.slice(1);return{l:src.reduce(function(a,c){var v=applyPathReduce(c,next);if(isObject(v)){if(v.v){a.push(v.v)}else if(v.l){a.push.apply(a,v.l)}else if(!v.n){a.push(v)}}else{a.push(v)}return a},[])}}else{return applyPathReduce(src[key],path.slice(1))}}function compare(a,b){return a<b?-1:a>b?1:a==b?0:!a&&b?-1:a&&!b?1:0}function buildFilter(grid,filter,columns,fields){return filter.map(function(f){var flt={op:f.op||"=",value:f.value||""};if(f.id){var field=columns.find(function(c){return c.id===f.id||c.filter===f.id});if(field){flt.get=columnGetter(grid,field);if(flt.get){flt.type=field.type||"string"}else{field=0}}if(!field){field=fields.find(function(c){return c.id===f.id});if(field){flt.get=fieldGetter(grid,field);flt.type=field.type||"string"}}}else{flt.op="skip"}if(f.op==="and"||f.op==="or"||f.op==="&&"||f.op==="||"){flt.op=f.op;if(Array.isArray(f.value)){flt.value=buildFilter(grid,f.value,columns,fields)}}return flt}).filter(function(f){return f.op!=="skip"})}function applyFilter(flt,item,recache){var this$1=this;if(!item||!flt.get&&flt.op!=="and"&&flt.op!=="or"&&flt.op!=="&&"&&flt.op!=="||"){return false}var v=flt.get&&flt.get.call(this,item);var val=flt.value;if(flt.op==="="||flt.op==="=="||flt.op==="is"){if(flt.type==="number"||flt.type==="date"){return+v==+val}return v==val}else if(flt.op==="!="||flt.op==="<>"||flt.op==="not"){if(flt.type==="number"||flt.type==="date"){return+v!=+val}return v!=val}else if(flt.op===">"||flt.op==="gt"){return numberify(v)>numberify(val)}else if(flt.op===">="||flt.op==="gte"){return numberify(v)>=numberify(val)}else if(flt.op==="<"||flt.op==="lt"){return numberify(v)<numberify(val)}else if(flt.op==="<="||flt.op==="lte"){return numberify(v)<=numberify(val)}else if(flt.op==="like"||flt.op==="notlike"||flt.op==="~"||flt.op==="!~"){var res=flt.op==="like"||flt.op==="~"?true:false;if(isString(val)){if(!val){return true}var re=recache[val]||(recache[val]=new RegExp(".*"+val.replace(/%/g,".*")+".*","gi"));res=re.test(v)}else if(isRegex(val)){res=val.test(v)}return flt.op==="like"||flt.op==="~"?res:!res}else if(flt.op==="contains"||flt.op==="@"){if(Array.isArray(v)){return!!~v.indexOf(val)}}else if(flt.op==="containslike"||flt.op==="@~"||flt.op==="containsnotlike"||flt.op==="@!~"){if(Array.isArray(v)){var re$1=isRegex(val)?val:isString(val)?recache[val]||(recache[val]=new RegExp(".*"+val.replace(/%/g,".*")+".*","gi")):null;if(!re$1){return false}var match=v.findIndex(function(x){return re$1.test((x||"").toString())});return flt.op==="containslike"||flt.op==="@~"?match>=0:match<0}}else if(flt.op==="in"&&Array.isArray(val)){return!!~val.indexOf(v)}else if((flt.op==="or"||flt.op==="||")&&Array.isArray(val)){return val.reduce(function(a,c){return a||applyFilter.call(this$1,c,item,recache)},false)}else if((flt.op==="and"||flt.op==="&&")&&Array.isArray(val)){return val.reduce(function(a,c){return a&&applyFilter.call(this$1,c,item,recache)},true)}return true}var notNumbers=/^[^\d]*/;export function numberify(v){if(isNumber(v)){return v}if(!v){return+Infinity}v=(""+v).replace(notNumbers,"");if(!v){return+Infinity}return parseFloat(v)}var colAttrs=["label","type","filter","hidden","sort","no-pad","id","editable"];var cell=/^[a-z]{1,3}[0-9]+(?:-[0-9]+)?$/;var empty=[];function construct(){var cmp=this.component;if(!cmp){return}var rowEl,groupEl,wrapperEl,mappings;var tpl=cmp.template.f||[];var attrs=cmp.template.m?cmp.template.m.slice():[];var t=cmp.template;cmp.template={e:t.e,f:t.f,t:t.t,m:attrs};var id=0;function map(attr,partial,plain){if(attr&&attr.f&&attr.f.length===1&&attr.f[0].t===2){var n="_a"+id++;attrs.push({t:13,n:n,f:attr.f});if(plain){return n}return partial?{t:[{t:2,r:"~/"+n}]}:{t:2,r:"~/"+n}}return attr&&attr.f}function grabColumns(tpl){var columns=[];var fields=[];tpl.forEach(function(e){if(e.e==="column"||e.e==="col"){var col={};var attrs=e.m||empty;var attr;col.index=columns.length;columns.push(col);col.content=(e.f||[]).filter(function(e){return e.e!=="edit"});attr=attrs.find(function(a){return a.n==="id"});if(attr&&isString(attr.f)){col.id=attr.f}col.label=attrs.find(function(a){return a.n==="label"});if(col.label&&col.label.f){col.label=map(col.label)}if(!col.label){col.label=""}if(!col.id){col.id=col.label}if(!Array.isArray(col.label)){col.label=[col.label]}col.type=attrs.find(function(a){return a.n==="type"});if(col.type&&col.type.f){col.type=col.type.f}if(!col.type){col.type="string"}col.filter=attrs.find(function(a){return a.n==="filter"});if(col.filter&&col.filter.f){col.filter=map(col.filter);if(col.filter.r){col.filter=col.filter.r}}col.sort=attrs.find(function(a){return a.n==="sort"});if(col.sort&&col.sort.f){col.sort=map(col.sort);if(col.sort.r){col.sort=col.sort.r}}col.dir=attrs.find(function(a){return a.n==="dir"});if(col.dir&&col.dir.f){col.dir=map(col.dir);if(col.dir.r){col.dir=col.dir.r}}col.hidden=attrs.find(function(a){return a.n==="hidden"});if(col.hidden&&col.hidden.f===0){col.hidden=true}else if(col.hidden&&isObject(col.hidden.f)){col.hidden=map(col.hidden)}else{col.hidden=false}if(isString(col.hidden)){col.hidden=false}col.noPad=attrs.find(function(a){return a.n==="no-pad"});if(col.noPad&&col.noPad.f===0){col.noPad=0}else if(col.noPad&&isObject(col.noPad.f)){col.noPad=map(col.noPad)}else{delete col.noPad}col.editable=attrs.find(function(a){return a.n==="editable"});if(col.editable&&col.editable.f===0){col.editable=true}else if(col.editable&&isObject(col.editable.f)){col.editable=map(col.editable)}else{col.editable=false}col.valign=attrs.find(function(a){return a.n==="valign"});if(col.valign&&isObject(col.valign.f)){col.valign=map(col.valign)}else if(col.valign&&typeof col.valign.f==="string"){col.valign=col.valign.f}attr=attrs.find(function(a){return a.n==="get"});if(attr&&attr.f){var name=map(attr,false,true);field.get=function(val){var fn=this.get(name);return typeof fn==="function"?fn.call(this,val):undefined}}col.attrs=attrs.filter(function(a){return!~colAttrs.indexOf(a.n)});col.attrs.forEach(function(a,i){if(cell.test(a.n)){col.attrs[i]={t:13,n:"class-"+a.n}}})}else if(e.e==="field"){var field$1={};var attrs$1=e.m||empty;var a;a=attrs$1.find(function(a){return a.n==="path"});if(isString(a)){field$1.path=a}else if(a&&a.f){field$1.path=map(a)}a=attrs$1.find(function(a){return a.n==="value"});if(a&&a.f){field$1.value=map(a)}a=attrs$1.find(function(a){return a.n==="type"});if(isString(a)){field$1.type=a}else if(a&&a.f){field$1.type=map(a)}a=attrs$1.find(function(a){return a.n==="id"});if(isString(a.f)){field$1.id=a.f}a=attrs$1.find(function(a){return a.n==="dir"});if(isString(a)){field$1.dir=a}else if(a&&isString(a.f)){field$1.dir=a.f}a=attrs$1.find(function(a){return a.n==="label"});if(isString(a)){field$1.label=a}else if(a&&a.f){field$1.label=map(a)}a=attrs$1.find(function(a){return a.n==="get"});if(a&&a.f){var name$1=map(a,false,true);field$1.get=function(val){var fn=this.get(name$1);return typeof fn==="function"?fn.call(this,val):undefined}}if(!field$1.id){field$1.id=field$1.label}if(!field$1.path){field$1.path=field$1.id}fields.push(field$1)}});return{fields:fields,columns:columns}}rowEl=tpl.find(function(e){return e.e==="row"});groupEl=tpl.find(function(e){return e.e==="group"});wrapperEl=tpl.find(function(e){return e.e==="wrapper"});this._init={sets:grabColumns(tpl),partials:{}};var columns=this._init.sets.columns;this._init.sets["meta.expand"]=rowEl&&rowEl.f&&rowEl.f.length;var sortKey="[_0._setSort(_1,_2)]";var header=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-header"},{t:4,f:[{n:"style-opacity",f:"0",t:13}],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}},{t:4,n:50,r:"~/fixedHeader",f:[{t:13,n:"style-padding-right",f:[{t:2,r:"~/scrollOffset"},"px"]}]}],f:[{t:7,e:"div",f:columns.filter(function(c){return c.hidden!==true}).map(function(c){var div={t:7,e:"div",f:[{t:7,e:"div",f:c.label}],m:[{t:4,n:53,r:"~/columns."+c.index,f:[{t:70,n:["click"],f:{r:["@this",".index","@event"],s:sortKey}}]},{t:13,n:"title",f:c.label}].concat(c.attrs.filter(function(a){return a.n!=="title"}))};if(c.type){div.m.push({t:13,n:"class-rtable-"+c.type+"-column"})}if(c.filter||c.sort){div.m.push({t:13,n:"class-rtable-sortable"})}div.m.push({t:13,n:"class-rtable-column"});var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res}),m:[{t:13,n:"class-row"}]}]}];header[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-header"},{t:13,n:"class-rtable-column"},{t:13,n:"title",f:[{t:2,r:"selections.length"}," items selected"]},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]}],f:[{t:7,e:"div",f:[{t:4,n:50,r:"~/allowSelectAll",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:"selectAll"}]}]}],m:[{t:70,n:["clickd"],f:"selectAll"}]}]}]});var row=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-rtable-odd",f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-live"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]}],f:[{t:7,e:"div",f:columns.filter(function(c){return c.hidden!==true}).map(function(c,cidx){var content=[{t:7,e:"div",f:[{t:16,r:"~/columns."+cidx+".content",c:{r:"."}}]}];if(c.attrs.length){c.attrsP=c.attrs;c.attrs=[{t:16,r:"~/columns."+cidx+".attrsP",c:{r:"."}}]}else{c.attrs=[]}var attrs=c.attrs;if(c.editable&&c.filter){var noclicky={t:70,n:["click","mousedown","pointerdown","MSPointerDown","touchstart"],f:{r:["@event"],s:"[_0.stopPropagation()]"}};var editor=[{t:4,n:50,x:{r:["~/columns."+cidx+".type"],s:"_0==='boolean'"},f:[{t:7,e:"input",m:[{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,r:c.filter}]},noclicky]}]},{t:4,n:51,l:1,f:[{t:7,e:"input",m:[{t:13,n:"value",f:[{t:2,r:c.filter}]},noclicky]}]}];if(typeof c.editable==="object"){attrs.push({t:13,n:"class-rtable-editing",f:c.editable});content=[Object.assign({},c.editable,{t:4,n:50,f:editor}),{t:4,n:51,l:1,f:content}]}else{attrs.push({t:13,n:"class-rtable-editing"});content=editor}}if(c.valign){attrs.push({t:13,n:"class-rtable-valign-col-top",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='top'"}}]},{t:13,n:"class-rtable-valign-col-bottom",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='bottom'"}}]},{t:13,n:"class-rtable-valign-col-center",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='center'"}}]})}var div={t:7,e:"div",f:content,m:attrs};if(c.type){attrs.unshift({t:13,n:"class-rtable-"+c.type+"-column"})}attrs.push({t:13,n:"class-rtable-column"});if(!div.m.find(function(a){return a.n==="title"})){attrs.unshift({t:13,n:"title",f:c.content.find(function(e){return e.e})?c.label:c.content})}if(c.noPad===0){attrs.push({t:13,n:"class-rtable-no-pad"})}else if(c.noPad){attrs.push({t:13,n:"class-rtable-no-pad",f:c.noPad})}var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res}),m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-row"},{t:70,n:rowEl&&rowEl.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}]}]}];if(rowEl&&rowEl.m&&rowEl.m.length){this._init.sets.rowAttrs=rowEl.m.slice();row[0].f[0].m.push({t:16,r:"~/rowAttrs",c:{r:"."}})}if(wrapperEl&&wrapperEl.m&&wrapperEl.m.length){this._init.sets.wrapperAttrs=wrapperEl.m.slice();row[0].m.push({t:16,r:"~/wrapperAttrs",c:{r:"."}})}if(rowEl&&rowEl.f&&rowEl.f.length){row[0].f[0].f.push({t:4,n:50,x:{r:[".","~/expanded"],s:"_0===_1"},f:[{t:7,e:"div",f:[{t:7,e:"div",f:[{t:16,r:"~/meta.expand",c:{r:"."}}]}],m:[{t:13,n:"class-t1"},{t:13,n:"class-rtable-row-expand"}]}]});row[0].f[0].m.push({t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._expand(_1)]"}})}row[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}]}]}]}]});var by;if(groupEl&&groupEl.m&&(by=groupEl.m.find(function(a){return a.n==="by"}))&&(isString(by.f)||by.length===1&&by[0].t===2)){var group={t:4,n:50,f:[{t:7,e:"div",m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-group"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:70,n:rowEl&&rowEl.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}].concat(groupEl.m.filter(function(a){return a.n!=="by"&&a.n!=="select"}))}],x:{s:"_0&&_1[(_1&&(_2*_3+_4))||_4]",r:["~/showGroups","~/groups","~/page","~/pagination.per","@index"]}};row.unshift(group);this._init.by=by.f;var parts=grabColumns(groupEl.f).columns.filter(function(c){return c.hidden!==true}).map(function(c){var div={t:7,e:"div",f:[{t:7,e:"div",f:c.content}],m:c.attrs};if(c.type){div.m.unshift({t:13,n:"class-rtable-"+c.type+"-column"})}div.m.push({t:13,n:"class-rtable-column"});if(!div.m.find(function(a){return a.n==="title"})){div.m.unshift({t:13,n:"title",f:c.content})}var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res});parts.unshift({t:4,n:50,r:"~/allowGroupSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}}]}]}]}]});var attr;if(attr=groupEl.m.find(function(a){return a.n==="select"})){(mappings||(mappings=[])).push(Object.assign({},attr,{n:"allowGroupSelect"}))}if(attr=groupEl.m.find(function(a){return a.n==="show"})){(mappings||(mappings=[])).push(Object.assign({},attr,{n:"showGroups"}))}group.f[0].f=parts}this._init.partials["grid-row"]=row;this._init.partials["grid-head"]=header;if(mappings&&this.component){this.component.mappings=mappings}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var Ractive=ref.Ractive;var instance=ref.instance;if("includeGrid"in opts){Ractive.styleSet("table.inclideGrid",opts.includeGrid)}instance.components[opts.name||"data-table"]=Table}}globalRegister("RMTable","components",Table);export default plugin; | ||
import Ractive from"ractive";import{grid,style as gridStyle}from"./grid";import click from"./event-click";import expand from"./transition-expand";import scrolled from"./scrolled";import{sized}from"./watch-size";import globalRegister from"./globalRegister";var sortRE=/^([-+])?([^\s]+)$/;function isString(v){return typeof v==="string"}function isNumber(v){return typeof v==="number"}function isObject(v){return typeof v==="object"}function isRegex(v){return typeof v==="object"&&Object.prototype.toString.call(v)==="RegExp"}export var Table=function(Ractive){function Table(opts){Ractive.call(this,opts)}if(Ractive)Table.__proto__=Ractive;Table.prototype=Object.create(Ractive&&Ractive.prototype);Table.prototype.constructor=Table;var prototypeAccessors={selections:{configurable:true}};Table.prototype._allSelected=function _allSelected(){var sel=this.get("selections");var visible=this.get("paginate")==="virtual"?this.get("rows"):this.get("visibleRows");for(var i=0;i<visible.length;i++){if(!~sel.indexOf(visible[i])){return false}}return visible.length&&true};Table.prototype.nodeSet=function nodeSet(node,prop,value){node[prop]=value};Table.prototype._expand=function _expand(idx){var this$1=this;var which=this.get("visibleRows")[idx];var current=this.get("expanded");var expanded=this.find(".rtable-row-expand");if(expanded){this.transition("expand",expanded,{outro:true}).then(function(){if(current===which){this$1.set("expanded",null)}else{this$1.set("expanded",which);this$1.transition("expand",this$1.find(".rtable-row-expand"),{intro:true})}})}else{if(which===current){this.set("expanded",null)}else{this.set("expanded",which);this.transition("expand",this.find(".rtable-row-expand"),{intro:true})}}};Table.prototype._setSort=function _setSort(idx,ev){var col=this.get("columns."+idx);if(!col||!(col.sort||col.filter)){return}var cs=col.sort||col.filter;var sort=cs;if(isString(sort)&&sort[0]==="~"){sort=this.get(sort)}var multi=ev.ctrlKey;var sorts=this.get("sort");if(!Array.isArray(sort)){sort=[sort]}if(!sorts){sorts=[]}else if(!Array.isArray(sorts)){sorts=[sorts]}if(!sorts.length){this.set("sort",sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s}))}else{var cur=sorts.map(function(s){return sortRE.exec(s).slice(1)});var overlap=sort.reduce(function(a,c){return a&&!!cur.find(function(s){return s[1]===c})},true);if(overlap&&sorts.length!==sort.length&&!multi){this.set("sort",sort.map(function(s){return"+"+sort}))}else if(!multi){if(overlap){this.set("sort",cur.map(function(s){return""+(s[0]==="+"?"-":"+")+s[1]}))}else{this.set("sort",sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s}))}}else{if(overlap){this.set("sort",cur.map(function(s){return~sort.indexOf(s[1])?""+(s[0]==="+"?"-":"+")+s[1]:s[0]+s[1]}))}else{this.set("sort",sorts.concat(sort.map(function(s){return""+(s===cs?col.dir||"+":"+")+s})))}}}};Table.prototype._select=function _select(src,ev){var sels=this.get("selections");if(!sels){sels=[];this.set("selections",sels)}var i=sels.indexOf(src);if(~i){this.splice("selections",i,1)}else{this.push("selections",src)}if(i>=sels.length||sels.length===1){this.set("selected",sels[sels.length-1])}this.fire("selection",{},{item:sels[sels.length-1],items:sels});setTimeout(function(){return ev.target.checked=!~i});return false};Table.prototype.select=function select(){var selected=this.get("selected");if(selected){this.fire("selected",{},selected,this.get("rows").indexOf(selected),this.get("visibleRows").indexOf(selected))}};prototypeAccessors.selections.get=function(){return this.get("selections")||[]};Table.prototype.selectionOffset=function selectionOffset(offset){var selected=this.get("selected");var visible=this.get("visibleRows");if(!selected||!~visible.indexOf(selected)){var next=offset>0?visible[0]:visible[visible.length-1];this.set({selected:next,selections:[next]})}else{var idx=visible.indexOf(selected);if(offset>0?idx+offset>=visible.length:idx+offset<0){var move=offset<1?-1:1;if(move<0&&this.get("page")+move>=0||move>0&&this.get("page")+move<this.get("pagination.total")){this.add("page",move)}visible=this.get("visibleRows");var next$1=offset>0?visible[0]:visible[visible.length-1];this.set({selected:next$1,selections:[next$1]})}else{this.set({selected:visible[idx+offset],selections:[visible[idx+offset]]})}}this.fire("selection",{},{item:this.get("selected"),items:this.get("selections")})};Table.prototype.selectionDown=function selectionDown(){this.selectionOffset(1)};Table.prototype.selectionUp=function selectionUp(){this.selectionOffset(-1)};Table.prototype._selectGroup=function _selectGroup(idx){var this$1=this;var grp=idx;if(this.get("page")){grp+=this.get("page")*this.get("pagination.per")}var rows=this.get("rows");var groups=this.get("groups");var sels=this.get("selections");var x=rows[grp++];var xs=["selections"];var ss=[];var i;if(!~(i=sels.indexOf(x))){xs.push(x)}else{ss.push(i)}while(grp<rows.length&&!(grp in groups)){x=rows[grp++];if(!~(i=sels.indexOf(x))){xs.push(x)}else{ss.push(i)}}if(xs.length===1){i=ss.length;while(i--){this$1.splice("selections",ss[i],1)}}else{this.push.apply(this,xs)}return false};Table.prototype._groupSelected=function _groupSelected(idx){var grp=idx;if(this.get("page")){grp+=this.get("page")*this.get("pagination.per")}var rows=this.get("rows");var groups=this.get("groups");var sels=this.get("selections");if(!~sels.indexOf(rows[grp++])){return false}while(grp<rows.length&&!(grp in groups)){if(!~sels.indexOf(rows[grp++])){return false}}return true};Object.defineProperties(Table.prototype,prototypeAccessors);return Table}(Ractive);function columnGetter(table,col){if(!table||!col){return}if(typeof col.get==="function"){return col.get}var getters=table._getters||(table._getters={});var v=col.filter;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}var k=Array.isArray(v)?v.join("."):isString(v)?v:false;if(!k){return}if(!getters[k]){if(isString(v)&&~v.indexOf("*")){var parts=Ractive.splitKeypath(v);getters[k]=function(obj){var res=applyPathReduce(obj,parts);return res.v||res.l}}else{if(isString(v)){v=Ractive.splitKeypath(v)}getters[k]=function(obj){return applyPath(obj,v)}}}return getters[k]}function fieldGetter(table,field){if(!table||!field){return}if(typeof field.get==="function"){return field.get}var getters=table._getters||(table._getters={});var v=field.path;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}var k=Array.isArray(v)?v.join("."):isString(v)?v:false;if(k){if(!getters[k]){if(isString(v)&&~v.indexOf("*")){var parts=Ractive.splitKeypath(v);getters[k]=function(obj){var res=applyPathReduce(obj,parts);return res.v||res.l}}else{if(isString(v)){v=Ractive.splitKeypath(v)}getters[k]=function(obj){return applyPath(obj,v)}}}return getters[k]}else{v=field.value;if(isString(v)&&v.indexOf("~/")===0){v=table.get(v)}if(typeof v==="function"){return v}}}Ractive.extendWith(Table,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable",g:1},{n:"class-rtable-virtual",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="virtual"'}}]},{n:"class-rtable-auto",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="auto"'}}]},{n:"class-rtable-fixed",t:13,f:[{t:2,r:"~/fixed"}]},{n:"class-rtable-border",t:13,f:[{t:2,r:"~/border"}]},{n:"class-rtable-fixed-header",t:13,f:[{t:2,r:"~/fixedHeader"}]},{n:"class-rtable-scrolled",t:13,f:[{t:2,x:{r:["~/scroll"],s:'!~(_0||"").indexOf("top")'}}]},{n:"class-rtable-with-select",t:13,f:[{t:2,r:"~/allowSelect"}]},{n:"class-rtable-valign-top",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="top"'}}]},{n:"class-rtable-valign-center",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="center"'}}]},{n:"class-rtable-valign-bottom",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="bottom"'}}]},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{n:"grid",t:71,f:{r:["~/scrollOffset"],s:"[{offset:_0}]"}}],f:[{t:8,r:"grid-head"}]}],n:50,r:"~/fixedHeader"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-top",g:1},{t:4,f:[{n:["scroll"],t:70,f:"scroll"},{n:"sized",t:71,f:{r:[],s:'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]'}}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}},{t:4,f:[{n:"scrolled",t:71,f:{r:[],s:'["~/scroll"]'}}],n:50,r:"~/fixedHeader"}],f:[{t:7,e:"div",m:[{n:"grid",t:71},{t:4,f:[{n:"style-margin-top",f:[{t:2,r:"~/virtual.above"},"px"],t:13},{n:"style-margin-bottom",f:[{t:2,r:"~/virtual.below"},"px"],t:13}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}}],f:[{t:4,f:[{t:8,r:"grid-head"}],n:51,r:"~/fixedHeader"}," ",{t:4,f:[{t:8,r:"grid-row"}],n:52,z:[{n:"source",x:{r:"~/items"}},{n:"shuffle",x:{x:{r:[],s:"true"}}}],r:"~/visibleRows"}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-row row t1",g:1}],f:[{t:16,r:"empty"}]}],n:50,x:{r:["~/rows.length"],s:"!_0"}}]}]}," ",{t:4,f:[{t:8,r:"pagination"}],n:50,x:{r:["~/paginate"],s:'_0!=="virtual"'}}]}],e:{'_0==="virtual"':function(_0){return _0==="virtual"},'_0==="auto"':function(_0){return _0==="auto"},'!~(_0||"").indexOf("top")':function(_0){return!~(_0||"").indexOf("top")},'_0==="top"':function(_0){return _0==="top"},'_0==="center"':function(_0){return _0==="center"},'_0==="bottom"':function(_0){return _0==="bottom"},"[{offset:_0}]":function(_0){return[{offset:_0}]},'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]':function(){return[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]},'["~/scroll"]':function(){return["~/scroll"]},true:function(){return true},"!_0":function(_0){return!_0},'_0!=="virtual"':function(_0){return _0!=="virtual"},"(_0+_1)%2===1":function(_0,_1){return(_0+_1)%2===1},"[_0._setSort(_1,_2)]":function(_0,_1,_2){return[_0._setSort(_1,_2)]},"[_0._select(_1,_2),false]":function(_0,_1,_2){return[_0._select(_1,_2),false]},'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]':function(_0,_1,_2){return[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]},"[_0._expand(_1)]":function(_0,_1){return[_0._expand(_1)]},"[_0.stopPropagation()]":function(_0){return[_0.stopPropagation()]},"_0.indexOf(_1)":function(_0,_1){return _0.indexOf(_1)},"_0===_1":function(_0,_1){return _0===_1},"_0>0":function(_0){return _0>0},"!_0&&_1>0":function(_0,_1){return!_0&&_1>0},'_0==="boolean"':function(_0){return _0==="boolean"},"_0._allSelected()":function(_0){return _0._allSelected()},"_0*_1+1":function(_0,_1){return _0*_1+1},"_2+1===_0?_1:(_2+1)*_3":function(_0,_1,_2,_3){return _2+1===_0?_1:(_2+1)*_3},"_0&&_1":function(_0,_1){return _0&&_1},"_0===1":function(_0){return _0===1},"_0._allSelected()&&_1<_2":function(_0,_1,_2){return _0._allSelected()&&_1<_2},'[_0.set("page",_1-1)]':function(_0,_1){return[_0.set("page",_1-1)]},'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]':function(_0,_1,_2,_3,_4){return[/^\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1)||_2.nodeSet(_3,"value",_4+1)]},"_0==_1+1":function(_0,_1){return _0==_1+1},'[_0.set("page",_2[_1-1])]':function(_0,_1,_2){return[_0.set("page",_2[_1-1])]},'_0==="..."':function(_0){return _0==="..."},'[_0.set("page",_1+1)]':function(_0,_1){return[_0.set("page",_1+1)]},"_0<_1-1":function(_0,_1){return _0<_1-1}},p:{"csp-dummy":[{t:7,e:"div",m:[{n:"class-rtable-odd",t:13,f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{n:"class-top",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="top"'}}]},{n:"class-bottom",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="bottom"'}}]},{n:"class-center",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="center"'}}]},{n:["click"],t:70,f:{r:["@this",".index","@event"],s:"[_0._setSort(_1,_2)]"}},{n:["click"],t:70,f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}},{n:["click"],t:70,f:{r:["~/rows","~/visibleRows","."],s:'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]'}},{n:["click"],t:70,f:{r:["@this","@index"],s:"[_0._expand(_1)]"}},{n:["click"],t:70,f:{r:["@event"],s:"[_0.stopPropagation()]"}}]}," ",{t:4,f:["..."],n:50,x:{r:["~/selections","."],s:"_0.indexOf(_1)"}}," ",{t:4,f:["..."],n:50,x:{r:[".","~/expanded"],s:"_0===_1"}}," ",{t:4,f:["..."],n:50,x:{r:["~/virtual.offset"],s:"_0>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/columns.0.type"],s:'_0==="boolean"'}}," ",{t:4,f:["..."],n:50,x:{r:["@this"],s:"_0._allSelected()"}}],empty:[{t:7,e:"div",f:[{t:7,e:"div",f:["No data."]}]}],pagination:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-bottom",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-info",g:1}],f:[{t:4,f:[{t:2,x:{r:["~/page","~/pagination.per"],s:"_0*_1+1"}}," - ",{t:2,x:{r:["~/pagination.total","~/rows.length","~/page","~/pagination.per"],s:"_2+1===_0?_1:(_2+1)*_3"}}," of ",{t:2,r:"~/rows.length"},{t:4,f:[" (",{t:2,r:"~/items.length"}," total)"],n:50,r:"~/isFiltered"}],n:50,x:{r:["pagination","rows.length"],s:"_0&&_1"}}," ",{t:4,f:[""],n:50,x:{r:["_paginate"],s:"_0===1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-select-all-all",g:1}],f:[{t:4,f:[{t:2,r:"selections.length"}," of ",{t:2,r:"rows.length"}," selected",{t:4,f:[" - ",{t:7,e:"a",m:[{n:"href",f:"#",t:13,g:1},{n:["click"],t:70,f:"selectAllAll"}],f:["Select All"]}],n:50,x:{r:["@this","selections.length","rows.length"],s:"_0._allSelected()&&_1<_2"}}],n:50,x:{r:["selections.length"],s:"_0>0"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-pages",g:1}],f:[{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1-1)]'}}],f:["Previous"]}],n:50,x:{r:["~/page"],s:"_0>0"}}," ",{t:4,f:[{t:4,f:[{t:7,e:"input",m:[{n:["change"],t:70,f:{r:["~/pagination.total","@node.value","@this","@node","~/page"],s:'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]'}},{n:"value",f:[{t:2,r:"."}],t:13},{t:73,v:"t",f:"false"}]}],n:50,x:{r:[".","~/page"],s:"_0==_1+1"}},{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","@index","../"],s:'[_0.set("page",_2[_1-1])]'}}],f:["..."]}," "],n:50,x:{r:["."],s:'_0==="..."'},l:1},{t:4,f:[" ",{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","."],s:'[_0.set("page",_1-1)]'}}],f:[{t:2,r:"."}]}],n:51,l:1}],n:52,r:"~/pagination.array"}," ",{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1+1)]'}}],f:["Next"]}],n:50,x:{r:["~/page","~/pagination.total"],s:"_0<_1-1"}}]}]}]}},css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.table.primary"));var active=Object.assign({},primary,data("raui.primary.active"),data("raui.table.primary.active"));var table=Object.assign({selected:{}},data("raui.table"));return"\n .rtable {\n display: flex;\n flex-direction: column;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n box-sizing: border-box;\n flex-grow: 2;\n }\n \n .rtable-group > div > div,\n .rtable-header > div > div,\n .rtable-row > div > div {\n padding: 0.5em;\n overflow: inherit;\n text-overflow: inherit;\n line-height: 1em;\n }\n .rtable-row > .rtable-no-pad > div {\n padding: 0;\n }\n \n .rtable-auto .row > *,\n .rtable-fixed .row > *\n {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n \n .rtable-header > div > div, .rtable-column {\n overflow: hidden;\n }\n \n .rtable-number-column {\n text-align: right;\n }\n .rtable-date-column {\n text-align: right;\n }\n \n .rtable-sortable {\n cursor: pointer;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .grid .row.rtable-row, .grid .rtable-header > .row {\n width: auto;\n min-width: min-content;\n flex-grow: 1;\n }\n \n .rtable-row-wrap {\n color: "+(primary.fg||"#222")+";\n border-style: solid;\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-width: 0 0 1px 0;\n background-color: "+(table.even||primary.bga||"#f4f4f4")+";\n }\n .rtable-row-wrap.rtable-odd {\n background-color: "+(table.odd||primary.bg||"#fff")+";\n }\n .rtable-row-wrap:hover, .rtable-row-wrap.rtable-selected:hover {\n background-color: "+(table.over||active.bg||"rgba(128, 182, 229, 0.2)")+";\n position: relative;\n box-shadow: inset 1px 0 0 #dadce0,inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n z-index: 1;\n }\n \n .rtable-row-wrap.rtable-selected {\n background-color: "+(table.selected.bg||"rgba(0, 119, 238, 0.12)")+";\n color: "+(table.selected.fg||primary.fg||"#222")+";\n }\n .rtable-row-wrap.rtable-selected.rtable-odd {\n background-color: "+(table.selected.odd||"rgba(0, 119, 238, 0.1)")+";\n }\n \n .rtable-row-wrap {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n \n .rtable-border .rtable-row .rtable-column,\n .rtable-border .rtable-group .rtable-column {\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 0 0 1px 1px;\n margin: 0 0 -1px -1px;\n }\n \n .rtable-border .rtable-row-wrap {\n border-width: 0 1px 1px 1px;\n }\n \n .rtable-border .rtable-row-expand {\n border-color: "+(table.divider||primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 1px 0 0 1px;\n margin-left: -1px;\n width: 100%;\n }\n \n .rtable-group {\n border-bottom: 2px solid "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap, .rtable-header.rtable-row-wrap:hover {\n font-weight: bold;\n background-color: "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap {\n border-bottom: 2px solid "+(table.divider||primary.bc||"#ccc")+";\n }\n \n .rtable-top {\n flex-grow: 5;\n flex-shrink: 1;\n overflow-y: auto;\n margin: 0.5em 0;\n position: relative;\n }\n .rtable-fixed-header .rtable-header {\n margin-top: 0.5em;\n position: relative;\n z-index: 1;\n }\n .rtable-fixed-header.rtable-scrolled .rtable-header {\n box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n }\n .rtable-fixed-header .rtable-top {\n margin-top: 0;\n }\n \n .rtable-bottom {\n display: flex;\n flex-wrap: wrap;\n flex-shrink: 0;\n padding: 0 0.5em 0.5em 0.5em;\n justify-content: space-between;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .rtable-bottom > * {\n padding: 0.5em;\n }\n \n .rtable-pages span {\n margin: 0.3em;\n cursor: pointer;\n }\n .rtable-pages span:first-of-type {\n margin-left: 0;\n }\n .rtable-pages input {\n text-align: center;\n width: 2.5em;\n font-size: 1em;\n background-color: transparent;\n border: none;\n padding: 0;\n font-weight: bold;\n text-decoration: underline;\n }\n \n /* checkboxes */\n .rtable-select {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n position: absolute;\n display: block;\n margin: 0;\n width: 2em;\n height: 2em;\n box-shadow: none;\n outline: none;\n opacity: 0;\n top: 0;\n left: 0;\n border-radius: 2em;\n transform: translate(-0.1em, 0) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n background-color: "+(primary.bc||"#ccc")+";\n cursor: pointer;\n }\n \n .rtable-select-header > div, .rtable-select-row > div, .rtable-header > div.rtable-select-header > div {\n padding: 0;\n overflow: visible;\n width: 1.5em;\n position: relative;\n line-height: 1.8em;\n cursor: pointer;\n }\n \n .rtable-select:checked {\n background-color: "+(primary.fga||"#07e")+';\n }\n \n .rtable-select-header:hover .rtable-select, .rtable-select-row:hover .rtable-select {\n opacity: 0.04;\n }\n \n .rtable-select:focus {\n opacity: 0.12;\n transform: translate(-0.1em, 0) scale(1);\n }\n \n .rtable-select-header:hover .rtable-select:focus, .rtable-select-row:hover .rtable.select:focus {\n opacity: 0.16;\n }\n \n .rtable-select:active {\n opacity: 0.4;\n transform: translate(-0.1em, 0) scale(0);\n transition: transform 0s, opacity 0s;\n }\n \n .rtable-select-row > div:before, .rtable-select-header > div:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n border: solid 2px; /* Safari */\n border-color: '+(primary.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n transition: border-color 0.2s, background-color 0.2s;\n }\n \n .rtable-select-row > div:after, .rtable-select-header > div:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.35em, 0.55em) rotate(-45deg);\n opacity: 0;\n }\n \n .rtable-selected .rtable-select-row > div:before, .rtable-all-selected > div:before {\n border-color: '+(primary.fga||"#07e")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rtable-selected .rtable-select-row > div:after, .rtable-all-selected > div:after {\n border-color: "+(primary.bg||"#fff")+";\n opacity: 1;\n }\n \n .rtable-row-wrap > .rtable-select-header,\n .rtable-row-wrap > .rtable-select-row {\n text-align: center;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: 2em;\n }\n \n .rtable-column button, .rtable-column .btn {\n padding: 0 0.5em;\n margin: 0.2em 0.5em;\n min-height: 0;\n }\n \n .rtable-column.rtable-editing {\n padding: 0;\n }\n .rtable-column.rtable-editing input {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n margin: 0;\n border: none;\n background-color: transparent;\n padding: 0.25em 0.5em;\n }\n \n .rtable-valign-top .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-top > div {\n display: flex;\n height: 100%;\n align-items: flex-start;\n box-sizing: border-box;\n }\n .rtable-valign-bottom .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-bottom > div {\n display: flex;\n height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n }\n .rtable-valign-center .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-center > div {\n display: flex;\n height: 100%;\n align-items: center;\n box-sizing: border-box;\n }\n "+(data("table.includeGrid")!==false?gridStyle(data):"")}.call(this,data)].join(" ")},cssId:"rtable",noCssTransform:true,attributes:["paginate","items","filter","sort","helpers","fixed","allowSelect","allowSelectAll","border","fixedHeader","valign"],components:{table:false,Table:false},syncComputedChildren:true,decorators:{grid:grid,sized:sized},events:{},use:[click({name:"clickd",count:1}),click({name:"dblclickd",count:2}),expand(),scrolled()],on:{construct:construct,config:function config(){this.set(this._init.sets);Object.assign(this.partials,this._init.partials)},render:function render(){if(this._autoObserver){this._autoObserver.fire()}},selectAll:function selectAll(){var sel,item;if(this._allSelected()){item=null;sel=[];this.set({selections:sel,selected:item})}else{sel=(this.get("paginate")==="virtual"?this.get("rows"):this.get("visibleRows")).slice();item=sel[0];this.set({selections:sel,selected:item})}this.fire("selection",{},{item:item,items:sel})},selectAllAll:function selectAllAll(){var item=null;var sel=this.get("rows").slice();this.set({selections:sel,selected:item});this.fire("selection",{},{item:item,items:sel});return false}},observe:{paginate:{handler:function handler(v){var this$1=this;if(v==="auto"||v==="virtual"||v instanceof Ractive){if(this._autoObserver){this._autoObserver.cancel()}if(this._scrollListener){this._scrollListener.cancel()}var root=v==="auto"||v==="virtual"?this.root:v;var sized=false;var fn=function(){if(!this$1.rendered){return}var top=this$1.find(".rtable-top");if(!top){return}if(!this$1.get("items.length")){if(!this$1._autoLenObserver){this$1._autoLenObserver=this$1.observeOnce("items",function(){this$1._autoLenObserver=0;setTimeout(fn)})}return}var size=top.clientHeight+","+top.clientWidth;if(fn.last===size&&sized){return}var header=this$1.find(".rtable-header");if(!header){return}var rows=Array.apply(null,this$1.findAll(".rtable-live")).map(function(r){return r.offsetHeight});if(rows.length<5){var auto=Math.floor(top.clientHeight/header.offsetHeight);if(auto<5){auto=5}this$1.set("_paginate",auto);rows=Array.apply(null,this$1.findAll(".rtable-live")).map(function(r){return r.offsetHeight})}if(rows.length>0){sized=true}else{rows=[25]}var avg=Math.ceil(rows.reduce(function(a,c){return a+c},0)/rows.length);this$1._avgSize=avg;var fit=Math.floor((top.clientHeight-header.offsetHeight)/avg);if(v==="virtual"){fit=fit+10;if(fit<30){fit=30}}this$1.set("_paginate",fit);fn.last=size};var tm;var fnd=function(){if(tm){clearTimeout(tm)}tm=setTimeout(function(){fn();tm=null;if(sized&&this$1._scrollListener){this$1._scrollListener.fn()}},50)};this._autoObserver=this.observe("~/tableHeight",fnd);this._autoObserver.fire=fnd;if(v==="virtual"){var lock=false;var node;var fn$1=function(){if(!this$1.rendered){node=null;return}if(!node){node=this$1.find(".rtable-top")}if(!sized){return fnd()}var top=node.scrollTop;var virtual=this$1.get("virtual")||{};var offset=virtual.offset;var visible=this$1.get("_paginate");var page=visible-10;var count=this$1.get("rows.length");if(visible>count){visible=count}var avg=this$1._avgSize;var pageSize=page*avg;var wnd=Math.floor(top/avg);var first=wnd-5;if(first<0){first=0}var hardFirst=first;if(first+visible>count){first=count-visible}if(offset===first){return lock=false}if(!isNumber(offset)||isNaN(offset)||top<virtual.top+pageSize||top>virtual.bottom-pageSize||offset>0&&top<avg*page){var amtAbove=hardFirst;var amtBelow=count-hardFirst-visible;if(amtAbove<0){amtBelow+=amtAbove*-1;amtAbove=0}else if(amtAbove>count-visible){amtAbove=count-visible}if(amtBelow<0){amtBelow=0}var above=amtAbove*avg;var below=amtBelow*avg;var vis,next;if(first<offset+visible&&first>offset-visible){if(first>offset){vis=this$1.findAll(".rtable-live")[first-offset]}else{vis=this$1.findAll(".rtable-live")[offset-first]}}if(vis&&first>0&&vis.offsetTop>node.scrollTop-pageSize-5&&vis.offsetTop<node.scrollTop+pageSize){next=vis.offsetTop}this$1.set({"virtual.above":above,"virtual.below":below,"virtual.offset":first});if(typeof next==="number"){if(next!==vis.offsetTop){this$1.set("virtual.above",above+(next-vis.offsetTop))}}this$1.set({"virtual.top":this$1.get("virtual.above"),"virtual.bottom":node.scrollHeight-below})}lock=false};var scroll=this._scrollListener=this.on("scroll",function(ref){var node=ref.node;if(!lock){lock=true;requestAnimationFrame(fn$1)}});this._scrollListener.fn=fn$1;scroll.observer=this.observe("rows.length",function(){this$1.set("virtual.offset",null);fn$1()},{init:false,strict:true});var cancel=scroll.cancel;scroll.cancel=function(){cancel();scroll.observer.cancel()}}fnd()}else{if(this._autoObserver){this._autoObserver.cancel()}if(this._scrollListener){this._scrollListener.cancel()}}if(isNumber(v)){this.set("_paginate",v)}},defer:true}},data:function data(){return{page:0,selections:[],allowSelect:true,allowSelectAll:true,showGroups:true,allowGroupSelect:true,expanded:null,minPerPage:10}},computed:{rows:{get:function get(){var this$1=this;var columns=this.viewmodel.value.columns;var fields=this.viewmodel.value.fields;var cols=columns.filter(function(c){return c.filter}).map(function(c){return columnGetter(this$1,c)}).filter(function(c){return c});var list=this.get("items")||[];var src=list;var filter=this.get("filter");var sort=this.get("sort");if(isObject(filter)&&!Array.isArray(filter)){filter=[filter]}if((filter instanceof RegExp||isString(filter))&&filter){var nocase=filter===""+filter.toLowerCase()||filter===""+filter.toUpperCase();try{var re=isString(filter)?new RegExp(filter,nocase?"i":""):filter;list=list.filter(function(l){var i=cols.length;while(i--){var v=l&&cols[i](l);if(v&&isString(v)&&re.test(v)){return true}}})}catch(e){}}else if(Array.isArray(filter)){var flts=buildFilter(this,filter,columns,fields);var recache={};try{list=list.filter(function(l){return flts.reduce(function(ok,flt){return ok&&applyFilter.call(this$1,flt,l,recache)},true)})}catch(e){}}if(isString(sort)||isObject(sort)&&!Array.isArray(sort)){sort=[sort]}if(Array.isArray(sort)){sort=sort.map(function(f){if(isString(f)){var id=f[0]==="-"||f[0]==="+"?f.substr(1):f;var col=columns.find(function(c){return c.id===id});var fl=fields.find(function(c){return c.id===id});var res={dir:f[0]==="-"?-1:1,get:col&&columnGetter(this$1,col)||fl&&fieldGetter(this$1,fl)||columnGetter(this$1,{filter:id})};if(col&&col.type==="number"||fl&&fl.type==="number"){var get=res.get;res.get=function(v){return numberify(get.call(this,v))}}return res}else if(f&&typeof f==="object"){var col$1=columns.find(function(c){return c.id===f.id});var fl$1=fields.find(function(c){return c.id===f.id});var res$1={dir:isNumber(f.dir)?f.dir:f.dir==="desc"?-1:1,get:typeof f.get==="function"&&f.get||col$1&&columnGetter(this$1,col$1)||fl$1&&fieldGetter(this$1,fl$1)||f.path&&fieldGetter(this$1,{filter:f.path,value:f.value})};if(f.type==="number"||col$1&&col$1.type==="number"||fl$1&&fl$1.type==="number"){var get$1=res$1.get;res$1.get=function(v){return numberify(get$1.call(this,v))}}return res$1}}).filter(function(s){return s&&s.get});list.sort(function(a,b){var aa,bb,p;for(var i=0;i<sort.length;i++){aa=sort[i].get.call(this$1,a);bb=sort[i].get.call(this$1,b);p=sort[i].dir*compare(aa,bb);if(p!==0){return p}}return p})}this.set("isFiltered",src.length!==list.length);return list}},visibleRows:{get:function get(){var this$1=this;var rows=this.get("rows");var paginate=this.get("paginate");var per=paginate;var intPer=this.get("_paginate");var offset=this.get("page")||0;var virtual=this.get("virtual");if(!per){return rows}if(typeof per!=="number"&&isNaN(+per)){if(per==="auto"||per==="virtual"||per instanceof Ractive){per=intPer||1}else{per=30}}if(per<this.get("minPerPage")){per=this.get("minPerPage")}if(paginate==="virtual"){offset=virtual&&virtual.offset||0;return rows.slice(offset,offset+per)}else{if(offset*per>rows.length){setTimeout(function(){return this$1.set("page",0)},0)}return rows.slice(per*offset,per*offset+per)}}},pagination:{get:function get(){var items=this.get("items")||empty;var rows=this.get("rows");var paginate=this.get("paginate");var per=paginate;var offset=this.get("page")||0;if(typeof per!=="number"&&isNaN(per)){per=this.get("_paginate")}if(per<this.get("minPerPage")){per=this.get("minPerPage")}if(!per){return}var total=Math.ceil(rows.length/per);var info={max:Math.ceil(items.length/per),total:total,per:per};if(paginate==="virtual"){info.height=this._avg*rows.length}if(info.total>14){var arr=info.array=[];if(offset>5){arr.push(1,2,3,"...")}else{arr.push(1,2,3,4,5,6,7,8)}if(offset>5&&offset+6<total){arr.push(offset-1,offset,offset+1,offset+2,offset+3,"...",total-2,total-1,total)}else if(offset+6<total){arr.push("...",total-2,total-1,total)}else{arr.push(total-7,total-6,total-5,total-4,total-3,total-2,total-1,total)}}else{info.array=Array.apply(null,{length:info.total}).map(function(v,i){return i+1})}return info}},groups:{get:function get(){var this$1=this;var rows=this.get("rows");var last,cur;var res={};for(var i=0;i<rows.length;i++){cur=rows[i][this$1._init.by];if(cur!=last){res[i]=1}last=cur}return res}}}});function applyPath(src,path){if(path.length&&!src&&typeof src!=="object"){return}var res=src;for(var i=0;i<path.length;i++){res=res[path[i]];if(typeof res!=="object"||!res){return i+1<path.length?undefined:res}}return res}function applyPathReduce(src,path){if(!path.length){return{v:src}}if(path.length&&typeof src!=="object"){return{n:1}}var key=path[0];if(key==="*"&&Array.isArray(src)){var next=path.slice(1);return{l:src.reduce(function(a,c){var v=applyPathReduce(c,next);if(isObject(v)){if(v.v){a.push(v.v)}else if(v.l){a.push.apply(a,v.l)}else if(!v.n){a.push(v)}}else{a.push(v)}return a},[])}}else{return applyPathReduce(src[key],path.slice(1))}}function compare(a,b){return a<b?-1:a>b?1:a==b?0:!a&&b?-1:a&&!b?1:0}function buildFilter(grid,filter,columns,fields){return filter.map(function(f){var flt={op:f.op||"=",value:f.value||""};if(f.id){var field=columns.find(function(c){return c.id===f.id||c.filter===f.id});if(field){flt.get=columnGetter(grid,field);if(flt.get){flt.type=field.type||"string"}else{field=0}}if(!field){field=fields.find(function(c){return c.id===f.id});if(field){flt.get=fieldGetter(grid,field);flt.type=field.type||"string"}}}else{flt.op="skip"}if(f.op==="and"||f.op==="or"||f.op==="&&"||f.op==="||"){flt.op=f.op;if(Array.isArray(f.value)){flt.value=buildFilter(grid,f.value,columns,fields)}}return flt}).filter(function(f){return f.op!=="skip"})}function applyFilter(flt,item,recache){var this$1=this;if(!item||!flt.get&&flt.op!=="and"&&flt.op!=="or"&&flt.op!=="&&"&&flt.op!=="||"){return false}var v=flt.get&&flt.get.call(this,item);var val=flt.value;if(flt.op==="="||flt.op==="=="||flt.op==="is"){if(flt.type==="number"||flt.type==="date"){return+v==+val}return v==val}else if(flt.op==="!="||flt.op==="<>"||flt.op==="not"){if(flt.type==="number"||flt.type==="date"){return+v!=+val}return v!=val}else if(flt.op===">"||flt.op==="gt"){return numberify(v)>numberify(val)}else if(flt.op===">="||flt.op==="gte"){return numberify(v)>=numberify(val)}else if(flt.op==="<"||flt.op==="lt"){return numberify(v)<numberify(val)}else if(flt.op==="<="||flt.op==="lte"){return numberify(v)<=numberify(val)}else if(flt.op==="like"||flt.op==="notlike"||flt.op==="~"||flt.op==="!~"){var res=flt.op==="like"||flt.op==="~"?true:false;if(isString(val)){if(!val){return true}var re=recache[val]||(recache[val]=new RegExp(".*"+val.replace(/%/g,".*")+".*","gi"));res=re.test(v)}else if(isRegex(val)){res=val.test(v)}return flt.op==="like"||flt.op==="~"?res:!res}else if(flt.op==="contains"||flt.op==="@"){if(Array.isArray(v)){return!!~v.indexOf(val)}}else if(flt.op==="containslike"||flt.op==="@~"||flt.op==="containsnotlike"||flt.op==="@!~"){if(Array.isArray(v)){var re$1=isRegex(val)?val:isString(val)?recache[val]||(recache[val]=new RegExp(".*"+val.replace(/%/g,".*")+".*","gi")):null;if(!re$1){return false}var match=v.findIndex(function(x){return re$1.test((x||"").toString())});return flt.op==="containslike"||flt.op==="@~"?match>=0:match<0}}else if(flt.op==="in"&&Array.isArray(val)){return!!~val.indexOf(v)}else if((flt.op==="or"||flt.op==="||")&&Array.isArray(val)){return val.reduce(function(a,c){return a||applyFilter.call(this$1,c,item,recache)},false)}else if((flt.op==="and"||flt.op==="&&")&&Array.isArray(val)){return val.reduce(function(a,c){return a&&applyFilter.call(this$1,c,item,recache)},true)}return true}var notNumbers=/^[^\d]*/;export function numberify(v){if(isNumber(v)){return v}if(!v){return+Infinity}v=(""+v).replace(notNumbers,"");if(!v){return+Infinity}return parseFloat(v)}var colAttrs=["label","type","filter","hidden","sort","no-pad","id","editable"];var cell=/^[a-z]{1,3}[0-9]+(?:-[0-9]+)?$/;var empty=[];function construct(){var cmp=this.component;if(!cmp){return}var rowEl,groupEl,wrapperEl,mappings;var tpl=cmp.template.f||[];var attrs=cmp.template.m?cmp.template.m.slice():[];var t=cmp.template;cmp.template={e:t.e,f:t.f,t:t.t,m:attrs};var id=0;function map(attr,partial,plain){if(attr&&attr.f&&attr.f.length===1&&attr.f[0].t===2){var n="_a"+id++;attrs.push({t:13,n:n,f:attr.f});if(plain){return n}return partial?{t:[{t:2,r:"~/"+n}]}:{t:2,r:"~/"+n}}return attr&&attr.f}function grabColumns(tpl){var columns=[];var fields=[];tpl.forEach(function(e){if(e.e==="column"||e.e==="col"){var col={};var attrs=e.m||empty;var attr;col.index=columns.length;columns.push(col);col.content=(e.f||[]).filter(function(e){return e.e!=="edit"});attr=attrs.find(function(a){return a.n==="id"});if(attr&&isString(attr.f)){col.id=attr.f}col.label=attrs.find(function(a){return a.n==="label"});if(col.label&&col.label.f){col.label=map(col.label)}if(!col.label){col.label=""}if(!col.id){col.id=col.label}if(!Array.isArray(col.label)){col.label=[col.label]}col.type=attrs.find(function(a){return a.n==="type"});if(col.type&&col.type.f){col.type=col.type.f}if(!col.type){col.type="string"}col.filter=attrs.find(function(a){return a.n==="filter"});if(col.filter&&col.filter.f){col.filter=map(col.filter);if(col.filter.r){col.filter=col.filter.r}}col.sort=attrs.find(function(a){return a.n==="sort"});if(col.sort&&col.sort.f){col.sort=map(col.sort);if(col.sort.r){col.sort=col.sort.r}}col.dir=attrs.find(function(a){return a.n==="dir"});if(col.dir&&col.dir.f){col.dir=map(col.dir);if(col.dir.r){col.dir=col.dir.r}}col.hidden=attrs.find(function(a){return a.n==="hidden"});if(col.hidden&&col.hidden.f===0){col.hidden=true}else if(col.hidden&&isObject(col.hidden.f)){col.hidden=map(col.hidden)}else{col.hidden=false}if(isString(col.hidden)){col.hidden=false}col.noPad=attrs.find(function(a){return a.n==="no-pad"});if(col.noPad&&col.noPad.f===0){col.noPad=0}else if(col.noPad&&isObject(col.noPad.f)){col.noPad=map(col.noPad)}else{delete col.noPad}col.editable=attrs.find(function(a){return a.n==="editable"});if(col.editable&&col.editable.f===0){col.editable=true}else if(col.editable&&isObject(col.editable.f)){col.editable=map(col.editable)}else{col.editable=false}col.valign=attrs.find(function(a){return a.n==="valign"});if(col.valign&&isObject(col.valign.f)){col.valign=map(col.valign)}else if(col.valign&&typeof col.valign.f==="string"){col.valign=col.valign.f}attr=attrs.find(function(a){return a.n==="get"});if(attr&&attr.f){var name=map(attr,false,true);field.get=function(val){var fn=this.get(name);return typeof fn==="function"?fn.call(this,val):undefined}}col.attrs=attrs.filter(function(a){return!~colAttrs.indexOf(a.n)});col.attrs.forEach(function(a,i){if(cell.test(a.n)){col.attrs[i]={t:13,n:"class-"+a.n}}})}else if(e.e==="field"){var field$1={};var attrs$1=e.m||empty;var a;a=attrs$1.find(function(a){return a.n==="path"});if(isString(a)){field$1.path=a}else if(a&&a.f){field$1.path=map(a)}a=attrs$1.find(function(a){return a.n==="value"});if(a&&a.f){field$1.value=map(a)}a=attrs$1.find(function(a){return a.n==="type"});if(isString(a)){field$1.type=a}else if(a&&a.f){field$1.type=map(a)}a=attrs$1.find(function(a){return a.n==="id"});if(isString(a.f)){field$1.id=a.f}a=attrs$1.find(function(a){return a.n==="dir"});if(isString(a)){field$1.dir=a}else if(a&&isString(a.f)){field$1.dir=a.f}a=attrs$1.find(function(a){return a.n==="label"});if(isString(a)){field$1.label=a}else if(a&&a.f){field$1.label=map(a)}a=attrs$1.find(function(a){return a.n==="get"});if(a&&a.f){var name$1=map(a,false,true);field$1.get=function(val){var fn=this.get(name$1);return typeof fn==="function"?fn.call(this,val):undefined}}if(!field$1.id){field$1.id=field$1.label}if(!field$1.path){field$1.path=field$1.id}fields.push(field$1)}});return{fields:fields,columns:columns}}rowEl=tpl.find(function(e){return e.e==="row"});groupEl=tpl.find(function(e){return e.e==="group"});wrapperEl=tpl.find(function(e){return e.e==="wrapper"});this._init={sets:grabColumns(tpl),partials:{}};var columns=this._init.sets.columns;this._init.sets["meta.expand"]=rowEl&&rowEl.f&&rowEl.f.length&&rowEl.f;var sortKey="[_0._setSort(_1,_2)]";var header=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-header"},{t:4,f:[{n:"style-opacity",f:"0",t:13}],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}},{t:4,n:50,r:"~/fixedHeader",f:[{t:13,n:"style-padding-right",f:[{t:2,r:"~/scrollOffset"},"px"]}]}],f:[{t:7,e:"div",f:columns.filter(function(c){return c.hidden!==true}).map(function(c){var div={t:7,e:"div",f:[{t:7,e:"div",f:c.label}],m:[{t:4,n:53,r:"~/columns."+c.index,f:[{t:70,n:["click"],f:{r:["@this",".index","@event"],s:sortKey}}]},{t:13,n:"title",f:c.label}].concat(c.attrs.filter(function(a){return a.n!=="title"}))};if(c.type){div.m.push({t:13,n:"class-rtable-"+c.type+"-column"})}if(c.filter||c.sort){div.m.push({t:13,n:"class-rtable-sortable"})}div.m.push({t:13,n:"class-rtable-column"});var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res}),m:[{t:13,n:"class-row"}]}]}];header[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-header"},{t:13,n:"class-rtable-column"},{t:13,n:"title",f:[{t:2,r:"selections.length"}," items selected"]},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]}],f:[{t:7,e:"div",f:[{t:4,n:50,r:"~/allowSelectAll",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:"selectAll"}]}]}],m:[{t:70,n:["clickd"],f:"selectAll"}]}]}]});var row=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-rtable-odd",f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-live"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]}],f:[{t:7,e:"div",f:columns.filter(function(c){return c.hidden!==true}).map(function(c,cidx){var content=[{t:7,e:"div",f:[{t:16,r:"~/columns."+cidx+".content",c:{r:"."}}]}];if(c.attrs.length){c.attrsP=c.attrs;c.attrs=[{t:16,r:"~/columns."+cidx+".attrsP",c:{r:"."}}]}else{c.attrs=[]}var attrs=c.attrs;if(c.editable&&c.filter){var noclicky={t:70,n:["click","mousedown","pointerdown","MSPointerDown","touchstart"],f:{r:["@event"],s:"[_0.stopPropagation()]"}};var editor=[{t:4,n:50,x:{r:["~/columns."+cidx+".type"],s:"_0==='boolean'"},f:[{t:7,e:"input",m:[{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,r:c.filter}]},noclicky]}]},{t:4,n:51,l:1,f:[{t:7,e:"input",m:[{t:13,n:"value",f:[{t:2,r:c.filter}]},noclicky]}]}];if(typeof c.editable==="object"){attrs.push({t:13,n:"class-rtable-editing",f:c.editable});content=[Object.assign({},c.editable,{t:4,n:50,f:editor}),{t:4,n:51,l:1,f:content}]}else{attrs.push({t:13,n:"class-rtable-editing"});content=editor}}if(c.valign){attrs.push({t:13,n:"class-rtable-valign-col-top",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='top'"}}]},{t:13,n:"class-rtable-valign-col-bottom",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='bottom'"}}]},{t:13,n:"class-rtable-valign-col-center",f:[{t:2,x:{r:["~/columns."+cidx+".valign"],s:"_0==='center'"}}]})}var div={t:7,e:"div",f:content,m:attrs};if(c.type){attrs.unshift({t:13,n:"class-rtable-"+c.type+"-column"})}attrs.push({t:13,n:"class-rtable-column"});if(!div.m.find(function(a){return a.n==="title"})){attrs.unshift({t:13,n:"title",f:c.content.find(function(e){return e.e})?c.label:c.content})}if(c.noPad===0){attrs.push({t:13,n:"class-rtable-no-pad"})}else if(c.noPad){attrs.push({t:13,n:"class-rtable-no-pad",f:c.noPad})}var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res}),m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-row"},{t:70,n:rowEl&&rowEl.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}]}]}];if(rowEl&&rowEl.m&&rowEl.m.length){this._init.sets.rowAttrs=rowEl.m.slice();row[0].f[0].m.push({t:16,r:"~/rowAttrs",c:{r:"."}})}if(wrapperEl&&wrapperEl.m&&wrapperEl.m.length){this._init.sets.wrapperAttrs=wrapperEl.m.slice();row[0].m.push({t:16,r:"~/wrapperAttrs",c:{r:"."}})}if(rowEl&&rowEl.f&&rowEl.f.length){row[0].f[0].f.push({t:4,n:50,x:{r:[".","~/expanded"],s:"_0===_1"},f:[{t:7,e:"div",f:[{t:7,e:"div",f:[{t:16,r:"~/meta.expand",c:{r:"."}}]}],m:[{t:13,n:"class-t1"},{t:13,n:"class-rtable-row-expand"}]}]});row[0].f[0].m.push({t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._expand(_1)]"}})}row[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}]}]}]}]});var by;if(groupEl&&groupEl.m&&(by=groupEl.m.find(function(a){return a.n==="by"}))&&(isString(by.f)||by.length===1&&by[0].t===2)){var group={t:4,n:50,f:[{t:7,e:"div",m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-group"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:70,n:rowEl&&rowEl.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}].concat(groupEl.m.filter(function(a){return a.n!=="by"&&a.n!=="select"}))}],x:{s:"_0&&_1[(_1&&(_2*_3+_4))||_4]",r:["~/showGroups","~/groups","~/page","~/pagination.per","@index"]}};row.unshift(group);this._init.by=by.f;var parts=grabColumns(groupEl.f).columns.filter(function(c){return c.hidden!==true}).map(function(c){var div={t:7,e:"div",f:[{t:7,e:"div",f:c.content}],m:c.attrs};if(c.type){div.m.unshift({t:13,n:"class-rtable-"+c.type+"-column"})}div.m.push({t:13,n:"class-rtable-column"});if(!div.m.find(function(a){return a.n==="title"})){div.m.unshift({t:13,n:"title",f:c.content})}var res=div;if(c.hidden&&c.hidden.r){res={t:4,n:51,r:c.hidden.r,f:[div]}}return res});parts.unshift({t:4,n:50,r:"~/allowGroupSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}}]}]}]}]});var attr;if(attr=groupEl.m.find(function(a){return a.n==="select"})){(mappings||(mappings=[])).push(Object.assign({},attr,{n:"allowGroupSelect"}))}if(attr=groupEl.m.find(function(a){return a.n==="show"})){(mappings||(mappings=[])).push(Object.assign({},attr,{n:"showGroups"}))}group.f[0].f=parts}this._init.partials["grid-row"]=row;this._init.partials["grid-head"]=header;if(mappings&&this.component){this.component.mappings=mappings}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var Ractive=ref.Ractive;var instance=ref.instance;if("includeGrid"in opts){Ractive.styleSet("table.inclideGrid",opts.includeGrid)}instance.components[opts.name||"data-table"]=Table}}globalRegister("RMTable","components",Table);export default plugin; |
{ | ||
"name": "@evs-chris/raui", | ||
"version": "0.5.16", | ||
"version": "0.5.17", | ||
"description": "Components, decorators, and helpers for Ractive apps that are generally Material-ish", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/evs-chris/raui", |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],e):e(t.RMTable={},t.Ractive)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n,r="undefined"!=typeof window?window:null;function i(t,e,n){if(r&&r.Ractive&&"object"==typeof r.Ractive[e]){var i=document.currentScript;if(i||(i=(i=document.querySelectorAll("script"))[i.length-1]),i){var o=i.getAttribute("data-alias");o&&(o=(o=o.split("&")).reduce(function(t,e){var n=e.split("="),r=n[0],i=n[1];return t[r]=i,t},{})),Ractive[e][o&&o[t]||t]=n}}}function o(t,e){var n=e.context||this.getContext(t),r={position:t.style.position,overflowY:t.style.overflowY};""!==t.style.position&&"static"!==t.style.position||(t.style.position="relative");var i=document.createElement("object");i.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),i.type="text/html";var o=function(){e.offsetWidth&&n.set(e.offsetWidth,t.offsetWidth),e.offsetHeight&&n.set(e.offsetHeight,t.offsetHeight),e.clientWidth&&n.set(e.clientWidth,t.clientWidth),e.clientHeight&&n.set(e.clientHeight,t.clientHeight),e.diffWidth&&n.set(e.diffWidth,t.offsetWidth-t.clientWidth),e.diffHeight&&n.set(e.diffHeight,t.offsetHeight-t.clientHeight)};return i.onload=function(){i.contentDocument.defaultView.addEventListener("resize",o),o()},/Trident/.test(navigator.userAgent)?(t.appendChild(i),i.data="about:blank"):(i.data="about:blank",t.appendChild(i)),{refresh:o,teardown:function(){t.removeChild(i),t.style.position=r.position,t.style.overflowY=r.overflowY}}}var a={tiny:{units:[2,3,4,5,6,8],max:"0",value:0},xsmall:{units:[2,3,4,5,6,8,10,12],max:"20em",prefix:"xs",value:10},small:{units:[2,3,4,5,6,8,10,12],max:"36em",value:20},medium:{units:[2,3,4,5,6,8,10,12],max:"48em",value:30},large:{units:[2,3,4,5,6,8,10,12,20,24],max:"64em",value:40},xlarge:{units:[2,3,4,5,6,8,10,12,20,24,32],max:"100em",value:50},ginormous:{units:[2,3,4,5,6,8,10,12,20,24,32,64],max:"150em",value:60}},l={"grid grid-root":/\bgrid grid-root\b/g},s=/\s+/g;function c(t,e){var r,i,c=this.getContext(t),f=this,d=e||{};function u(e){if("number"==typeof d.offset&&(e-=d.offset),!d.type||"class"===d.type){var n,o=-1;for(var a in r)r[a]<=e&&(l[a].lastIndex=-1,r[a]>o&&(n=a,o=r[a])),t.className=t.className.replace(l[a],"").trim();if(!n)return;l[n].test(t.className)||(t.className+=" "+n),d.value&&c.set(d.value,i[n].value),d.name&&c.set(d.name,n),t.className=t.className.replace(s," ")}}function p(){var e=(n||(n=document.createElement("div"),document.body.appendChild(n)),n);for(var o in i=f.get("@style.break")||a,r={},i)e.style.width=i[o].max,r[o]=e.clientWidth,l[o]||(l[o]=new RegExp("\\b"+o+"\\b","g"));e.style.width=0,u(t.clientWidth)}var h=this.observe("@style.break",p,{init:!1}),g=c.observe("@local.width",u,{init:!1}),b=o.call(this,t,{clientWidth:"@local.width"});return t.className+=" grid grid-root",d.immediate?p():requestAnimationFrame(p),{update:function(e){d=e||{},requestAnimationFrame(function(){return u(t.clientWidth)})},teardown:function(){t.className=t.className.replace(l["grid grid-root"],"").trim(),g.cancel(),h.cancel(),b.teardown()}}}function f(t,e){var n=t("raui.grid.break")||e||a,r=(t("raui.grid.wrappers")||[".row-wrap > ",".row-wrap > .row-wrap > "]).slice();r.unshift("");var i,o=".row > * { position: relative; width: 100%; transition-duration: 0.2s; transition-timing-function: ease-in-out; transition-property: padding, margin; box-sizing: border-box; }\n.grid { display: block; }\n.grid .row { display: flex !important; flex-wrap: wrap; min-height: fit-content; width: 100%; align-content: flex-start; }\n.grid .row.row-pad > * { padding: "+(t("raui.grid.padding")||"0.5em")+"; }\n.grid .row > .pad { display: flex; flex-direction: column; padding: "+(t("raui.grid.padding")||"0.5em")+"; box-sizing: border-box; }",l=Object.keys(n).map(function(t){return(n[t].key=t)&&n[t]});l.sort(function(t,e){return t.value>e.value?1:t.value<e.value?-1:0});var s={};l.reverse().reduce(function(t,e){return t.push(e.key),s[e.key]=t.slice(),t},[]);var c="",f="";return l.reverse().forEach(function(e){var n=e.prefix||e.key[0];e.units.forEach(function(o){f+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+"1, ."+t+" > "+e+".row > ."+n+"1, ."+t+" ."+n+"-n1, ."+t+" .row-"+n+"-n1 > *"}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: 100%; flex-grow: 0; flex-shrink: 0; }\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+"0, ."+t+" > "+e+".row > ."+n+"0, ."+t+" ."+n+"-n0, ."+t+" .row-"+n+"-n0 > *"}).join(", ")}).join(", ")+" { display: none; flex-grow: 0; flex-shrink: 0; }",c+="\n"+s[e.key].map(function(t){return"."+t+" .row-"+n+"-n1 > *"}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: 100%; }\n"+s[e.key].map(function(t){return"."+t+" .row-"+n+"-n0 > *"}).join(", ")+" { display: none; }";for(var a=function(a){i=(i=""+a/o*100).substr(0,i.indexOf(".")+3),c+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+".row-"+n+a+"-"+o+" > *, ."+t+" .row-"+n+"-n"+a+"-"+o+" > *, ."+t+" .row > ."+n+"-n"+a+"-"+o}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: "+i+"%; }",f+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+a+"-"+o+", ."+t+" > "+e+".row > ."+n+a+"-"+o+", ."+t+" ."+n+"-n"+a+"-"+o+", ."+t+" .row-"+n+"-n"+a+"-"+o+" > *"}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: "+i+"%; flex-grow: 0; flex-shrink: 0; }"},l=1;l<o;l++)a(l)}),s[e.key].forEach(function(t){return f+=r.map(function(e){return"."+t+" > "+e+".row > ."+n+"-fill"}).join(", ")+", ."+t+" ."+n+"-nfill { width: auto; flex-grow: 2; flex-shink: 2; }\n"+r.map(function(e){return"."+t+" > "+e+".row > ."+n+"-auto"}).join(", ")+", ."+t+" ."+n+"-nauto { width: auto; flex-shrink: 2; }"})}),o+=c+f}c.style=f,i("grid","decorators",c);var d=250;function u(t){return void 0===t&&(t={}),function(e){var n=e.Ractive;e.instance.events[t.name||(t.count||"")+"clicks"]=function(e,r,i){var o,a=Object.assign({},t,i);return(o=e.__r_clicks__)?o.subscribe(a.count||1,!!a.hold,r):(o=new p(n.getContext(e),a.delay||d,a.bubble||!1),e.__r_clicks__=o,o.subscribe(a.count||1,!!a.hold,r)),{teardown:function(){o.unsubscribe(a.count||1,!!a.hold,r)}}}}}u({name:"click",count:1}),u({name:"dblclick",count:2}),u({name:"trpclick",count:3});var p=function(t,e,n){this.context=t,this.node=t.node,this.delay=e,this.fires={},this.refs=0,this.bubble=n,this.bind()};function h(t){return this.__r_clicks__.mousedown(t)}function g(t){return this.__r_clicks__.touchdown(t)}function b(){this.addEventListener("keydown",m,!1),this.addEventListener("blur",v,!1)}function v(){this.removeEventListener("keydown",m,!1),this.removeEventListener("blur",v,!1)}function m(t){if(32===t.which||10===t.which||13===t.which)return this.__r_clicks__.fire()}function _(t,e){var n=t.processParams(e,{duration:200,easing:"easeInOut"});return new Promise(function(e){requestAnimationFrame(function(){t.setStyle("overflow","hidden");var r="x"===n.axis?"width":"height";if(t.isIntro||n.intro){var i=t.getStyle(r);t.setStyle(r,0),t.setStyle("opacity",0),e(t.animateStyle(r,i,n).then(function(){return t.animateStyle("opacity",1,n)}).then(function(){t.setStyle(r,""),t.setStyle("overflow","")}))}else t.setStyle(r,t.getStyle(r)),t.setStyle("opacity",1),e(t.animateStyle("opacity",0,n).then(function(){return t.animateStyle(r,0,n)}))})})}function w(t,e){void 0===e&&(e={});var n="string"==typeof e?e:e.bind;if("string"!=typeof n)return{teardown:function(){}};var r=e.allow||2,i=this.getContext(t);function o(){var e="";t.scrollHeight>t.clientHeight&&(e+="vscroll"),t.scrollWidth>t.clientWidth&&(e+=(e?" ":"")+"hscroll"),t.scrollTop<=r?e+=" top":t.scrollTop>=t.scrollHeight-t.clientHeight-r?e+=" bottom":e+=" vmiddle",t.scrollLeft<=r?e+=" left":t.scrollLeft>=t.scrollWidth-t.clientWidth-r?e+=" right":e+=" hmiddle",i.set(n,e)}return t.addEventListener("scroll",o,{passive:!0}),requestAnimationFrame(o),{refresh:o,teardown:function(){t.removeEventListener("scroll",o)}}}p.prototype.subscribe=function(t,e,n){(this.fires[t+","+e]||(this.fires[t+","+e]=[])).push(n),this.refs++},p.prototype.unsubscribe=function(t,e,n){var r=this.fires[t+","+e]||[];r.splice(r.indexOf(n),1),this.refs--,this.refs||this.teardown()},p.prototype.bind=function(){window.PointerEvent||window.navigator.pointerEnabled?this.context.listen("pointerdown",h):window.navigator.msPointerEnabled?this.context.listen("MSPointerDown",h):(this.context.listen("mousedown",h),this.context.listen("touchstart",g)),"A"!==this.node.tagName&&"BUTTON"!==this.node.tagName&&"button"!==this.node.type&&"submit"!==this.node.type&&"checkbox"!==this.node.type&&"radio"!==this.node.type||this.context.listen("focus",b)},p.prototype.fire=function(t,e,n,r){var i=this;this.tm?(this.tmCount++,clearTimeout(this.tm)):this.tmCount=1;var o=function(){i.tm=null,(i.fires[i.tmCount+","+!!r]||[]).forEach(function(o){o({node:i.node,original:t,x:e,y:n,hold:!!r})})};return r?o():this.tm=setTimeout(o,this.delay),this.bubble},p.prototype.mousedown=function(t){var e=this;if(!this.preventMousedownEvents&&(void 0===t.which||1===t.which)){var n,r=t.clientX,i=t.clientY,o=t.pointerId,a=function(t){t.pointerId==o&&(e.fire(t,r,i),s())},l=function(t){t.pointerId==o&&(Math.abs(t.clientX-r)>=5||Math.abs(t.clientY-i)>=5)&&s()},s=function(){n&&clearTimeout(n),e.node.removeEventListener("MSPointerUp",a,!1),document.removeEventListener("MSPointerMove",l,!1),document.removeEventListener("MSPointerCancel",s,!1),e.node.removeEventListener("pointerup",a,!1),document.removeEventListener("pointermove",l,!1),document.removeEventListener("pointercancel",s,!1),e.node.removeEventListener("click",a,!1),document.removeEventListener("mousemove",l,!1)};return window.PointerEvent||window.navigator.pointerEnabled?(this.node.addEventListener("pointerup",a,!1),document.addEventListener("pointermove",l,!1),document.addEventListener("pointercancel",s,!1)):window.navigator.msPointerEnabled?(this.node.addEventListener("MSPointerUp",a,!1),document.addEventListener("MSPointerMove",l,!1),document.addEventListener("MSPointerCancel",s,!1)):(this.node.addEventListener("click",a,!1),document.addEventListener("mousemove",l,!1)),n=setTimeout(function(){s(),e.fire(t,r,i,!0)},400),this.bubble||t.stopPropagation(),this.bubble}},p.prototype.touchdown=function(t){var e,n=this,r=t.touches[0],i=r.clientX,o=r.clientY,a=r.identifier,l=function(t){t.changedTouches[0].identifier===a?(t.preventDefault(),n.preventMousedownEvents=!0,clearTimeout(n.preventMousedownTimeout),n.preventMousedownTimeout=setTimeout(function(){n.preventMousedownEvents=!1},400),n.fire(t,i,o),c()):c()},s=function(t){1===t.touches.length&&t.touches[0].identifier===a||c();var e=t.touches[0];(Math.abs(e.clientX-i)>=5||Math.abs(e.clientY-o)>=5)&&c()},c=function(){e&&clearTimeout(e),n.node.removeEventListener("touchend",l,!1),window.removeEventListener("touchmove",s,!1),window.removeEventListener("touchcancel",c,!1)};return this.node.addEventListener("touchend",l,!1),window.addEventListener("touchmove",s,!1),window.addEventListener("touchcancel",c,!1),e=setTimeout(function(){c(),n.fire(t,i,o,!0)},400),this.bubble||t.stopPropagation(),this.bubble},p.prototype.teardown=function(){var t=this.context;t.unlisten("pointerdown",h),t.unlisten("MSPointerDown",h),t.unlisten("mousedown",h),t.unlisten("touchstart",g),t.unlisten("focus",b),delete this.node.__r_clicks__},i("expand","transitions",_);var x=/^([-+])?([^\s]+)$/;function y(t){return"string"==typeof t}function k(t){return"number"==typeof t}function O(t){return"object"==typeof t}function A(t){return"object"==typeof t&&"RegExp"===Object.prototype.toString.call(t)}var S,E,P=function(t){function e(e){t.call(this,e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selections:{configurable:!0}};return e.prototype._allSelected=function(){for(var t=this.get("selections"),e="virtual"===this.get("paginate")?this.get("rows"):this.get("visibleRows"),n=0;n<e.length;n++)if(!~t.indexOf(e[n]))return!1;return e.length&&!0},e.prototype.nodeSet=function(t,e,n){t[e]=n},e.prototype._expand=function(t){var e=this,n=this.get("visibleRows")[t],r=this.get("expanded"),i=this.find(".rtable-row-expand");i?this.transition("expand",i,{outro:!0}).then(function(){r===n?e.set("expanded",null):(e.set("expanded",n),e.transition("expand",e.find(".rtable-row-expand"),{intro:!0}))}):n===r?this.set("expanded",null):(this.set("expanded",n),this.transition("expand",this.find(".rtable-row-expand"),{intro:!0}))},e.prototype._setSort=function(t,e){var n=this.get("columns."+t);if(n&&(n.sort||n.filter)){var r=n.sort||n.filter,i=r;y(i)&&"~"===i[0]&&(i=this.get(i));var o=e.ctrlKey,a=this.get("sort");if(Array.isArray(i)||(i=[i]),a?Array.isArray(a)||(a=[a]):a=[],a.length){var l=a.map(function(t){return x.exec(t).slice(1)}),s=i.reduce(function(t,e){return t&&!!l.find(function(t){return t[1]===e})},!0);s&&a.length!==i.length&&!o?this.set("sort",i.map(function(t){return"+"+i})):o?s?this.set("sort",l.map(function(t){return~i.indexOf(t[1])?("+"===t[0]?"-":"+")+t[1]:t[0]+t[1]})):this.set("sort",a.concat(i.map(function(t){return""+(t===r&&n.dir||"+")+t}))):s?this.set("sort",l.map(function(t){return("+"===t[0]?"-":"+")+t[1]})):this.set("sort",i.map(function(t){return""+(t===r&&n.dir||"+")+t}))}else this.set("sort",i.map(function(t){return""+(t===r&&n.dir||"+")+t}))}},e.prototype._select=function(t,e){var n=this.get("selections");n||(n=[],this.set("selections",n));var r=n.indexOf(t);return~r?this.splice("selections",r,1):this.push("selections",t),(r>=n.length||1===n.length)&&this.set("selected",n[n.length-1]),this.fire("selection",{},{item:n[n.length-1],items:n}),setTimeout(function(){return e.target.checked=!~r}),!1},e.prototype.select=function(){var t=this.get("selected");t&&this.fire("selected",{},t,this.get("rows").indexOf(t),this.get("visibleRows").indexOf(t))},n.selections.get=function(){return this.get("selections")||[]},e.prototype.selectionOffset=function(t){var e=this.get("selected"),n=this.get("visibleRows");if(e&&~n.indexOf(e)){var r=n.indexOf(e);if(t>0?r+t>=n.length:r+t<0){var i=t<1?-1:1;(i<0&&this.get("page")+i>=0||i>0&&this.get("page")+i<this.get("pagination.total"))&&this.add("page",i),n=this.get("visibleRows");var o=t>0?n[0]:n[n.length-1];this.set({selected:o,selections:[o]})}else this.set({selected:n[r+t],selections:[n[r+t]]})}else{var a=t>0?n[0]:n[n.length-1];this.set({selected:a,selections:[a]})}this.fire("selection",{},{item:this.get("selected"),items:this.get("selections")})},e.prototype.selectionDown=function(){this.selectionOffset(1)},e.prototype.selectionUp=function(){this.selectionOffset(-1)},e.prototype._selectGroup=function(t){var e=t;this.get("page")&&(e+=this.get("page")*this.get("pagination.per"));var n,r=this.get("rows"),i=this.get("groups"),o=this.get("selections"),a=r[e++],l=["selections"],s=[];for(~(n=o.indexOf(a))?s.push(n):l.push(a);e<r.length&&!(e in i);)a=r[e++],~(n=o.indexOf(a))?s.push(n):l.push(a);if(1===l.length)for(n=s.length;n--;)this.splice("selections",s[n],1);else this.push.apply(this,l);return!1},e.prototype._groupSelected=function(t){var e=t;this.get("page")&&(e+=this.get("page")*this.get("pagination.per"));var n=this.get("rows"),r=this.get("groups"),i=this.get("selections");if(!~i.indexOf(n[e++]))return!1;for(;e<n.length&&!(e in r);)if(!~i.indexOf(n[e++]))return!1;return!0},Object.defineProperties(e.prototype,n),e}(e);function L(t,n){if(t&&n){if("function"==typeof n.get)return n.get;var r=t._getters||(t._getters={}),i=n.filter;y(i)&&0===i.indexOf("~/")&&(i=t.get(i));var o=Array.isArray(i)?i.join("."):!!y(i)&&i;if(o){if(!r[o])if(y(i)&&~i.indexOf("*")){var a=e.splitKeypath(i);r[o]=function(t){var e=T(t,a);return e.v||e.l}}else y(i)&&(i=e.splitKeypath(i)),r[o]=function(t){return H(t,i)};return r[o]}}}function j(t,n){if(t&&n){if("function"==typeof n.get)return n.get;var r=t._getters||(t._getters={}),i=n.path;y(i)&&0===i.indexOf("~/")&&(i=t.get(i));var o=Array.isArray(i)?i.join("."):!!y(i)&&i;if(o){if(!r[o])if(y(i)&&~i.indexOf("*")){var a=e.splitKeypath(i);r[o]=function(t){var e=T(t,a);return e.v||e.l}}else y(i)&&(i=e.splitKeypath(i)),r[o]=function(t){return H(t,i)};return r[o]}return y(i=n.value)&&0===i.indexOf("~/")&&(i=t.get(i)),"function"==typeof i?i:void 0}}function H(t,e){if(!e.length||t||"object"==typeof t){for(var n=t,r=0;r<e.length;r++)if("object"!=typeof(n=n[e[r]])||!n)return r+1<e.length?void 0:n;return n}}function T(t,e){if(!e.length)return{v:t};if(e.length&&"object"!=typeof t)return{n:1};var n=e[0];if("*"===n&&Array.isArray(t)){var r=e.slice(1);return{l:t.reduce(function(t,e){var n=T(e,r);return O(n)?n.v?t.push(n.v):n.l?t.push.apply(t,n.l):n.n||t.push(n):t.push(n),t},[])}}return T(t[n],e.slice(1))}function M(t,e){return t<e?-1:t>e?1:t==e?0:!t&&e?-1:t&&!e?1:0}e.extendWith(P,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable",g:1},{n:"class-rtable-virtual",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="virtual"'}}]},{n:"class-rtable-auto",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="auto"'}}]},{n:"class-rtable-fixed",t:13,f:[{t:2,r:"~/fixed"}]},{n:"class-rtable-border",t:13,f:[{t:2,r:"~/border"}]},{n:"class-rtable-fixed-header",t:13,f:[{t:2,r:"~/fixedHeader"}]},{n:"class-rtable-scrolled",t:13,f:[{t:2,x:{r:["~/scroll"],s:'!~(_0||"").indexOf("top")'}}]},{n:"class-rtable-with-select",t:13,f:[{t:2,r:"~/allowSelect"}]},{n:"class-rtable-valign-top",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="top"'}}]},{n:"class-rtable-valign-center",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="center"'}}]},{n:"class-rtable-valign-bottom",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="bottom"'}}]},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{n:"grid",t:71,f:{r:["~/scrollOffset"],s:"[{offset:_0}]"}}],f:[{t:8,r:"grid-head"}]}],n:50,r:"~/fixedHeader"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-top",g:1},{t:4,f:[{n:["scroll"],t:70,f:"scroll"},{n:"sized",t:71,f:{r:[],s:'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]'}}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}},{t:4,f:[{n:"scrolled",t:71,f:{r:[],s:'["~/scroll"]'}}],n:50,r:"~/fixedHeader"}],f:[{t:7,e:"div",m:[{n:"grid",t:71},{t:4,f:[{n:"style-margin-top",f:[{t:2,r:"~/virtual.above"},"px"],t:13},{n:"style-margin-bottom",f:[{t:2,r:"~/virtual.below"},"px"],t:13}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}}],f:[{t:4,f:[{t:8,r:"grid-head"}],n:51,r:"~/fixedHeader"}," ",{t:4,f:[{t:8,r:"grid-row"}],n:52,z:[{n:"source",x:{r:"~/items"}},{n:"shuffle",x:{x:{r:[],s:"true"}}}],r:"~/visibleRows"}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-row row t1",g:1}],f:[{t:16,r:"empty"}]}],n:50,x:{r:["~/rows.length"],s:"!_0"}}]}]}," ",{t:4,f:[{t:8,r:"pagination"}],n:50,x:{r:["~/paginate"],s:'_0!=="virtual"'}}]}],e:{'_0==="virtual"':function(t){return"virtual"===t},'_0==="auto"':function(t){return"auto"===t},'!~(_0||"").indexOf("top")':function(t){return!~(t||"").indexOf("top")},'_0==="top"':function(t){return"top"===t},'_0==="center"':function(t){return"center"===t},'_0==="bottom"':function(t){return"bottom"===t},"[{offset:_0}]":function(t){return[{offset:t}]},'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]':function(){return[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]},'["~/scroll"]':function(){return["~/scroll"]},true:function(){return!0},"!_0":function(t){return!t},'_0!=="virtual"':function(t){return"virtual"!==t},"(_0+_1)%2===1":function(t,e){return(t+e)%2==1},"[_0._setSort(_1,_2)]":function(t,e,n){return[t._setSort(e,n)]},"[_0._select(_1,_2),false]":function(t,e,n){return[t._select(e,n),!1]},'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]':function(t,e,n){return[["select",n,t.indexOf(n),e.indexOf(n)]]},"[_0._expand(_1)]":function(t,e){return[t._expand(e)]},"[_0.stopPropagation()]":function(t){return[t.stopPropagation()]},"_0.indexOf(_1)":function(t,e){return t.indexOf(e)},"_0===_1":function(t,e){return t===e},"_0>0":function(t){return t>0},"!_0&&_1>0":function(t,e){return!t&&e>0},'_0==="boolean"':function(t){return"boolean"===t},"_0._allSelected()":function(t){return t._allSelected()},"_0*_1+1":function(t,e){return t*e+1},"_2+1===_0?_1:(_2+1)*_3":function(t,e,n,r){return n+1===t?e:(n+1)*r},"_0&&_1":function(t,e){return t&&e},"_0===1":function(t){return 1===t},"_0._allSelected()&&_1<_2":function(t,e,n){return t._allSelected()&&e<n},'[_0.set("page",_1-1)]':function(t,e){return[t.set("page",e-1)]},'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]':function(t,e,n,r,i){return[/^\d+$/.test(e)&&+e>0&&+e<=t&&n.set("page",+e-1)||n.nodeSet(r,"value",i+1)]},"_0==_1+1":function(t,e){return t==e+1},'[_0.set("page",_2[_1-1])]':function(t,e,n){return[t.set("page",n[e-1])]},'_0==="..."':function(t){return"..."===t},'[_0.set("page",_1+1)]':function(t,e){return[t.set("page",e+1)]},"_0<_1-1":function(t,e){return t<e-1}},p:{"csp-dummy":[{t:7,e:"div",m:[{n:"class-rtable-odd",t:13,f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{n:"class-top",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="top"'}}]},{n:"class-bottom",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="bottom"'}}]},{n:"class-center",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="center"'}}]},{n:["click"],t:70,f:{r:["@this",".index","@event"],s:"[_0._setSort(_1,_2)]"}},{n:["click"],t:70,f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}},{n:["click"],t:70,f:{r:["~/rows","~/visibleRows","."],s:'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]'}},{n:["click"],t:70,f:{r:["@this","@index"],s:"[_0._expand(_1)]"}},{n:["click"],t:70,f:{r:["@event"],s:"[_0.stopPropagation()]"}}]}," ",{t:4,f:["..."],n:50,x:{r:["~/selections","."],s:"_0.indexOf(_1)"}}," ",{t:4,f:["..."],n:50,x:{r:[".","~/expanded"],s:"_0===_1"}}," ",{t:4,f:["..."],n:50,x:{r:["~/virtual.offset"],s:"_0>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/columns.0.type"],s:'_0==="boolean"'}}," ",{t:4,f:["..."],n:50,x:{r:["@this"],s:"_0._allSelected()"}}],empty:[{t:7,e:"div",f:[{t:7,e:"div",f:["No data."]}]}],pagination:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-bottom",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-info",g:1}],f:[{t:4,f:[{t:2,x:{r:["~/page","~/pagination.per"],s:"_0*_1+1"}}," - ",{t:2,x:{r:["~/pagination.total","~/rows.length","~/page","~/pagination.per"],s:"_2+1===_0?_1:(_2+1)*_3"}}," of ",{t:2,r:"~/rows.length"},{t:4,f:[" (",{t:2,r:"~/items.length"}," total)"],n:50,r:"~/isFiltered"}],n:50,x:{r:["pagination","rows.length"],s:"_0&&_1"}}," ",{t:4,f:[""],n:50,x:{r:["_paginate"],s:"_0===1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-select-all-all",g:1}],f:[{t:4,f:[{t:2,r:"selections.length"}," of ",{t:2,r:"rows.length"}," selected",{t:4,f:[" - ",{t:7,e:"a",m:[{n:"href",f:"#",t:13,g:1},{n:["click"],t:70,f:"selectAllAll"}],f:["Select All"]}],n:50,x:{r:["@this","selections.length","rows.length"],s:"_0._allSelected()&&_1<_2"}}],n:50,x:{r:["selections.length"],s:"_0>0"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-pages",g:1}],f:[{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1-1)]'}}],f:["Previous"]}],n:50,x:{r:["~/page"],s:"_0>0"}}," ",{t:4,f:[{t:4,f:[{t:7,e:"input",m:[{n:["change"],t:70,f:{r:["~/pagination.total","@node.value","@this","@node","~/page"],s:'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]'}},{n:"value",f:[{t:2,r:"."}],t:13},{t:73,v:"t",f:"false"}]}],n:50,x:{r:[".","~/page"],s:"_0==_1+1"}},{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","@index","../"],s:'[_0.set("page",_2[_1-1])]'}}],f:["..."]}," "],n:50,x:{r:["."],s:'_0==="..."'},l:1},{t:4,f:[" ",{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","."],s:'[_0.set("page",_1-1)]'}}],f:[{t:2,r:"."}]}],n:51,l:1}],n:52,r:"~/pagination.array"}," ",{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1+1)]'}}],f:["Next"]}],n:50,x:{r:["~/page","~/pagination.total"],s:"_0<_1-1"}}]}]}]}},css:function(t){return[function(t){var e=Object.assign({},t("raui.primary"),t("raui.table.primary")),n=Object.assign({},e,t("raui.primary.active"),t("raui.table.primary.active")),r=Object.assign({selected:{}},t("raui.table"));return"\n .rtable {\n display: flex;\n flex-direction: column;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n box-sizing: border-box;\n flex-grow: 2;\n }\n \n .rtable-group > div > div,\n .rtable-header > div > div,\n .rtable-row > div > div {\n padding: 0.5em;\n overflow: inherit;\n text-overflow: inherit;\n line-height: 1em;\n }\n .rtable-row > .rtable-no-pad > div {\n padding: 0;\n }\n \n .rtable-auto .row > *,\n .rtable-fixed .row > *\n {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n \n .rtable-header > div > div, .rtable-column {\n overflow: hidden;\n }\n \n .rtable-number-column {\n text-align: right;\n }\n .rtable-date-column {\n text-align: right;\n }\n \n .rtable-sortable {\n cursor: pointer;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .grid .row.rtable-row, .grid .rtable-header > .row {\n width: auto;\n min-width: min-content;\n flex-grow: 1;\n }\n \n .rtable-row-wrap {\n color: "+(e.fg||"#222")+";\n border-style: solid;\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-width: 0 0 1px 0;\n background-color: "+(r.even||e.bga||"#f4f4f4")+";\n }\n .rtable-row-wrap.rtable-odd {\n background-color: "+(r.odd||e.bg||"#fff")+";\n }\n .rtable-row-wrap:hover, .rtable-row-wrap.rtable-selected:hover {\n background-color: "+(r.over||n.bg||"rgba(128, 182, 229, 0.2)")+";\n position: relative;\n box-shadow: inset 1px 0 0 #dadce0,inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n z-index: 1;\n }\n \n .rtable-row-wrap.rtable-selected {\n background-color: "+(r.selected.bg||"rgba(0, 119, 238, 0.12)")+";\n color: "+(r.selected.fg||e.fg||"#222")+";\n }\n .rtable-row-wrap.rtable-selected.rtable-odd {\n background-color: "+(r.selected.odd||"rgba(0, 119, 238, 0.1)")+";\n }\n \n .rtable-row-wrap {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n \n .rtable-border .rtable-row .rtable-column,\n .rtable-border .rtable-group .rtable-column {\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-style: solid;\n border-width: 0 0 1px 1px;\n margin: 0 0 -1px -1px;\n }\n \n .rtable-border .rtable-row-wrap {\n border-width: 0 1px 1px 1px;\n }\n \n .rtable-border .rtable-row-expand {\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-style: solid;\n border-width: 1px 0 0 1px;\n margin-left: -1px;\n width: 100%;\n }\n \n .rtable-group {\n border-bottom: 2px solid "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap, .rtable-header.rtable-row-wrap:hover {\n font-weight: bold;\n background-color: "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap {\n border-bottom: 2px solid "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-top {\n flex-grow: 5;\n flex-shrink: 1;\n overflow-y: auto;\n margin: 0.5em 0;\n position: relative;\n }\n .rtable-fixed-header .rtable-header {\n margin-top: 0.5em;\n position: relative;\n z-index: 1;\n }\n .rtable-fixed-header.rtable-scrolled .rtable-header {\n box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n }\n .rtable-fixed-header .rtable-top {\n margin-top: 0;\n }\n \n .rtable-bottom {\n display: flex;\n flex-wrap: wrap;\n flex-shrink: 0;\n padding: 0 0.5em 0.5em 0.5em;\n justify-content: space-between;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .rtable-bottom > * {\n padding: 0.5em;\n }\n \n .rtable-pages span {\n margin: 0.3em;\n cursor: pointer;\n }\n .rtable-pages span:first-of-type {\n margin-left: 0;\n }\n .rtable-pages input {\n text-align: center;\n width: 2.5em;\n font-size: 1em;\n background-color: transparent;\n border: none;\n padding: 0;\n font-weight: bold;\n text-decoration: underline;\n }\n \n /* checkboxes */\n .rtable-select {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n position: absolute;\n display: block;\n margin: 0;\n width: 2em;\n height: 2em;\n box-shadow: none;\n outline: none;\n opacity: 0;\n top: 0;\n left: 0;\n border-radius: 2em;\n transform: translate(-0.1em, 0) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n background-color: "+(e.bc||"#ccc")+";\n cursor: pointer;\n }\n \n .rtable-select-header > div, .rtable-select-row > div, .rtable-header > div.rtable-select-header > div {\n padding: 0;\n overflow: visible;\n width: 1.5em;\n position: relative;\n line-height: 1.8em;\n cursor: pointer;\n }\n \n .rtable-select:checked {\n background-color: "+(e.fga||"#07e")+';\n }\n \n .rtable-select-header:hover .rtable-select, .rtable-select-row:hover .rtable-select {\n opacity: 0.04;\n }\n \n .rtable-select:focus {\n opacity: 0.12;\n transform: translate(-0.1em, 0) scale(1);\n }\n \n .rtable-select-header:hover .rtable-select:focus, .rtable-select-row:hover .rtable.select:focus {\n opacity: 0.16;\n }\n \n .rtable-select:active {\n opacity: 0.4;\n transform: translate(-0.1em, 0) scale(0);\n transition: transform 0s, opacity 0s;\n }\n \n .rtable-select-row > div:before, .rtable-select-header > div:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n border: solid 2px; /* Safari */\n border-color: '+(e.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n transition: border-color 0.2s, background-color 0.2s;\n }\n \n .rtable-select-row > div:after, .rtable-select-header > div:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.35em, 0.55em) rotate(-45deg);\n opacity: 0;\n }\n \n .rtable-selected .rtable-select-row > div:before, .rtable-all-selected > div:before {\n border-color: '+(e.fga||"#07e")+";\n background-color: "+(e.fga||"#07e")+";\n }\n \n .rtable-selected .rtable-select-row > div:after, .rtable-all-selected > div:after {\n border-color: "+(e.bg||"#fff")+";\n opacity: 1;\n }\n \n .rtable-row-wrap > .rtable-select-header,\n .rtable-row-wrap > .rtable-select-row {\n text-align: center;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: 2em;\n }\n \n .rtable-column button, .rtable-column .btn {\n padding: 0 0.5em;\n margin: 0.2em 0.5em;\n min-height: 0;\n }\n \n .rtable-column.rtable-editing {\n padding: 0;\n }\n .rtable-column.rtable-editing input {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n margin: 0;\n border: none;\n background-color: transparent;\n padding: 0.25em 0.5em;\n }\n \n .rtable-valign-top .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-top > div {\n display: flex;\n height: 100%;\n align-items: flex-start;\n box-sizing: border-box;\n }\n .rtable-valign-bottom .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-bottom > div {\n display: flex;\n height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n }\n .rtable-valign-center .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-center > div {\n display: flex;\n height: 100%;\n align-items: center;\n box-sizing: border-box;\n }\n "+(!1!==t("table.includeGrid")?f(t):"")}.call(this,t)].join(" ")},cssId:"rtable",noCssTransform:!0,attributes:["paginate","items","filter","sort","helpers","fixed","allowSelect","allowSelectAll","border","fixedHeader","valign"],components:{table:!1,Table:!1},syncComputedChildren:!0,decorators:{grid:c,sized:o},events:{},use:[u({name:"clickd",count:1}),u({name:"dblclickd",count:2}),(void 0===E&&(E={}),function(t){t.instance.transitions[E.name||"expand"]=_}),(void 0===S&&(S={}),function(t){t.instance.decorators[S.name||"scrolled"]=w})],on:{construct:function(){var t,e,n,r,i=this.component;if(!i)return;var o=i.template.f||[],a=i.template.m?i.template.m.slice():[],l=i.template;i.template={e:l.e,f:l.f,t:l.t,m:a};var s=0;function c(t,e,n){if(t&&t.f&&1===t.f.length&&2===t.f[0].t){var r="_a"+s++;return a.push({t:13,n:r,f:t.f}),n?r:e?{t:[{t:2,r:"~/"+r}]}:{t:2,r:"~/"+r}}return t&&t.f}function f(t){var e=[],n=[];return t.forEach(function(t){if("column"===t.e||"col"===t.e){var r,i={},o=t.m||C;if(i.index=e.length,e.push(i),i.content=(t.f||[]).filter(function(t){return"edit"!==t.e}),(r=o.find(function(t){return"id"===t.n}))&&y(r.f)&&(i.id=r.f),i.label=o.find(function(t){return"label"===t.n}),i.label&&i.label.f&&(i.label=c(i.label)),i.label||(i.label=""),i.id||(i.id=i.label),Array.isArray(i.label)||(i.label=[i.label]),i.type=o.find(function(t){return"type"===t.n}),i.type&&i.type.f&&(i.type=i.type.f),i.type||(i.type="string"),i.filter=o.find(function(t){return"filter"===t.n}),i.filter&&i.filter.f&&(i.filter=c(i.filter),i.filter.r&&(i.filter=i.filter.r)),i.sort=o.find(function(t){return"sort"===t.n}),i.sort&&i.sort.f&&(i.sort=c(i.sort),i.sort.r&&(i.sort=i.sort.r)),i.dir=o.find(function(t){return"dir"===t.n}),i.dir&&i.dir.f&&(i.dir=c(i.dir),i.dir.r&&(i.dir=i.dir.r)),i.hidden=o.find(function(t){return"hidden"===t.n}),i.hidden&&0===i.hidden.f?i.hidden=!0:i.hidden&&O(i.hidden.f)?i.hidden=c(i.hidden):i.hidden=!1,y(i.hidden)&&(i.hidden=!1),i.noPad=o.find(function(t){return"no-pad"===t.n}),i.noPad&&0===i.noPad.f?i.noPad=0:i.noPad&&O(i.noPad.f)?i.noPad=c(i.noPad):delete i.noPad,i.editable=o.find(function(t){return"editable"===t.n}),i.editable&&0===i.editable.f?i.editable=!0:i.editable&&O(i.editable.f)?i.editable=c(i.editable):i.editable=!1,i.valign=o.find(function(t){return"valign"===t.n}),i.valign&&O(i.valign.f)?i.valign=c(i.valign):i.valign&&"string"==typeof i.valign.f&&(i.valign=i.valign.f),(r=o.find(function(t){return"get"===t.n}))&&r.f){var a=c(r,!1,!0);field.get=function(t){var e=this.get(a);return"function"==typeof e?e.call(this,t):void 0}}i.attrs=o.filter(function(t){return!~z.indexOf(t.n)}),i.attrs.forEach(function(t,e){N.test(t.n)&&(i.attrs[e]={t:13,n:"class-"+t.n})})}else if("field"===t.e){var l,s={},f=t.m||C;if(y(l=f.find(function(t){return"path"===t.n}))?s.path=l:l&&l.f&&(s.path=c(l)),(l=f.find(function(t){return"value"===t.n}))&&l.f&&(s.value=c(l)),y(l=f.find(function(t){return"type"===t.n}))?s.type=l:l&&l.f&&(s.type=c(l)),y((l=f.find(function(t){return"id"===t.n})).f)&&(s.id=l.f),y(l=f.find(function(t){return"dir"===t.n}))?s.dir=l:l&&y(l.f)&&(s.dir=l.f),y(l=f.find(function(t){return"label"===t.n}))?s.label=l:l&&l.f&&(s.label=c(l)),(l=f.find(function(t){return"get"===t.n}))&&l.f){var d=c(l,!1,!0);s.get=function(t){var e=this.get(d);return"function"==typeof e?e.call(this,t):void 0}}s.id||(s.id=s.label),s.path||(s.path=s.id),n.push(s)}}),{fields:n,columns:e}}t=o.find(function(t){return"row"===t.e}),e=o.find(function(t){return"group"===t.e}),n=o.find(function(t){return"wrapper"===t.e}),this._init={sets:f(o),partials:{}};var d=this._init.sets.columns;this._init.sets["meta.expand"]=t&&t.f&&t.f.length;var u="[_0._setSort(_1,_2)]",p=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-header"},{t:4,f:[{n:"style-opacity",f:"0",t:13}],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}},{t:4,n:50,r:"~/fixedHeader",f:[{t:13,n:"style-padding-right",f:[{t:2,r:"~/scrollOffset"},"px"]}]}],f:[{t:7,e:"div",f:d.filter(function(t){return!0!==t.hidden}).map(function(t){var e={t:7,e:"div",f:[{t:7,e:"div",f:t.label}],m:[{t:4,n:53,r:"~/columns."+t.index,f:[{t:70,n:["click"],f:{r:["@this",".index","@event"],s:u}}]},{t:13,n:"title",f:t.label}].concat(t.attrs.filter(function(t){return"title"!==t.n}))};t.type&&e.m.push({t:13,n:"class-rtable-"+t.type+"-column"}),(t.filter||t.sort)&&e.m.push({t:13,n:"class-rtable-sortable"}),e.m.push({t:13,n:"class-rtable-column"});var n=e;return t.hidden&&t.hidden.r&&(n={t:4,n:51,r:t.hidden.r,f:[e]}),n}),m:[{t:13,n:"class-row"}]}]}];p[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-header"},{t:13,n:"class-rtable-column"},{t:13,n:"title",f:[{t:2,r:"selections.length"}," items selected"]},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]}],f:[{t:7,e:"div",f:[{t:4,n:50,r:"~/allowSelectAll",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:"selectAll"}]}]}],m:[{t:70,n:["clickd"],f:"selectAll"}]}]}]});var h,g=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-rtable-odd",f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-live"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]}],f:[{t:7,e:"div",f:d.filter(function(t){return!0!==t.hidden}).map(function(t,e){var n=[{t:7,e:"div",f:[{t:16,r:"~/columns."+e+".content",c:{r:"."}}]}];t.attrs.length?(t.attrsP=t.attrs,t.attrs=[{t:16,r:"~/columns."+e+".attrsP",c:{r:"."}}]):t.attrs=[];var r=t.attrs;if(t.editable&&t.filter){var i={t:70,n:["click","mousedown","pointerdown","MSPointerDown","touchstart"],f:{r:["@event"],s:"[_0.stopPropagation()]"}},o=[{t:4,n:50,x:{r:["~/columns."+e+".type"],s:"_0==='boolean'"},f:[{t:7,e:"input",m:[{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,r:t.filter}]},i]}]},{t:4,n:51,l:1,f:[{t:7,e:"input",m:[{t:13,n:"value",f:[{t:2,r:t.filter}]},i]}]}];"object"==typeof t.editable?(r.push({t:13,n:"class-rtable-editing",f:t.editable}),n=[Object.assign({},t.editable,{t:4,n:50,f:o}),{t:4,n:51,l:1,f:n}]):(r.push({t:13,n:"class-rtable-editing"}),n=o)}t.valign&&r.push({t:13,n:"class-rtable-valign-col-top",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='top'"}}]},{t:13,n:"class-rtable-valign-col-bottom",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='bottom'"}}]},{t:13,n:"class-rtable-valign-col-center",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='center'"}}]});var a={t:7,e:"div",f:n,m:r};t.type&&r.unshift({t:13,n:"class-rtable-"+t.type+"-column"}),r.push({t:13,n:"class-rtable-column"}),a.m.find(function(t){return"title"===t.n})||r.unshift({t:13,n:"title",f:t.content.find(function(t){return t.e})?t.label:t.content}),0===t.noPad?r.push({t:13,n:"class-rtable-no-pad"}):t.noPad&&r.push({t:13,n:"class-rtable-no-pad",f:t.noPad});var l=a;return t.hidden&&t.hidden.r&&(l={t:4,n:51,r:t.hidden.r,f:[a]}),l}),m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-row"},{t:70,n:t&&t.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}]}]}];t&&t.m&&t.m.length&&(this._init.sets.rowAttrs=t.m.slice(),g[0].f[0].m.push({t:16,r:"~/rowAttrs",c:{r:"."}}));n&&n.m&&n.m.length&&(this._init.sets.wrapperAttrs=n.m.slice(),g[0].m.push({t:16,r:"~/wrapperAttrs",c:{r:"."}}));t&&t.f&&t.f.length&&(g[0].f[0].f.push({t:4,n:50,x:{r:[".","~/expanded"],s:"_0===_1"},f:[{t:7,e:"div",f:[{t:7,e:"div",f:[{t:16,r:"~/meta.expand",c:{r:"."}}]}],m:[{t:13,n:"class-t1"},{t:13,n:"class-rtable-row-expand"}]}]}),g[0].f[0].m.push({t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._expand(_1)]"}}));if(g[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}]}]}]}]}),e&&e.m&&(h=e.m.find(function(t){return"by"===t.n}))&&(y(h.f)||1===h.length&&2===h[0].t)){var b={t:4,n:50,f:[{t:7,e:"div",m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-group"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:70,n:t&&t.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}].concat(e.m.filter(function(t){return"by"!==t.n&&"select"!==t.n}))}],x:{s:"_0&&_1[(_1&&(_2*_3+_4))||_4]",r:["~/showGroups","~/groups","~/page","~/pagination.per","@index"]}};g.unshift(b),this._init.by=h.f;var v,m=f(e.f).columns.filter(function(t){return!0!==t.hidden}).map(function(t){var e={t:7,e:"div",f:[{t:7,e:"div",f:t.content}],m:t.attrs};t.type&&e.m.unshift({t:13,n:"class-rtable-"+t.type+"-column"}),e.m.push({t:13,n:"class-rtable-column"}),e.m.find(function(t){return"title"===t.n})||e.m.unshift({t:13,n:"title",f:t.content});var n=e;return t.hidden&&t.hidden.r&&(n={t:4,n:51,r:t.hidden.r,f:[e]}),n});m.unshift({t:4,n:50,r:"~/allowGroupSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}}]}]}]}]}),(v=e.m.find(function(t){return"select"===t.n}))&&(r||(r=[])).push(Object.assign({},v,{n:"allowGroupSelect"})),(v=e.m.find(function(t){return"show"===t.n}))&&(r||(r=[])).push(Object.assign({},v,{n:"showGroups"})),b.f[0].f=m}this._init.partials["grid-row"]=g,this._init.partials["grid-head"]=p,r&&this.component&&(this.component.mappings=r)},config:function(){this.set(this._init.sets),Object.assign(this.partials,this._init.partials)},render:function(){this._autoObserver&&this._autoObserver.fire()},selectAll:function(){var t,e;this._allSelected()?(e=null,t=[],this.set({selections:t,selected:e})):(e=(t=("virtual"===this.get("paginate")?this.get("rows"):this.get("visibleRows")).slice())[0],this.set({selections:t,selected:e})),this.fire("selection",{},{item:e,items:t})},selectAllAll:function(){var t=this.get("rows").slice();return this.set({selections:t,selected:null}),this.fire("selection",{},{item:null,items:t}),!1}},observe:{paginate:{handler:function(t){var n=this;if("auto"===t||"virtual"===t||t instanceof e){this._autoObserver&&this._autoObserver.cancel(),this._scrollListener&&this._scrollListener.cancel();("auto"===t||"virtual"===t)&&this.root;var r,i=!1,o=function(){if(n.rendered){var e=n.find(".rtable-top");if(e)if(n.get("items.length")){var r=e.clientHeight+","+e.clientWidth;if(o.last!==r||!i){var a=n.find(".rtable-header");if(a){var l=Array.apply(null,n.findAll(".rtable-live")).map(function(t){return t.offsetHeight});if(l.length<5){var s=Math.floor(e.clientHeight/a.offsetHeight);s<5&&(s=5),n.set("_paginate",s),l=Array.apply(null,n.findAll(".rtable-live")).map(function(t){return t.offsetHeight})}l.length>0?i=!0:l=[25];var c=Math.ceil(l.reduce(function(t,e){return t+e},0)/l.length);n._avgSize=c;var f=Math.floor((e.clientHeight-a.offsetHeight)/c);"virtual"===t&&(f+=10)<30&&(f=30),n.set("_paginate",f),o.last=r}}}else n._autoLenObserver||(n._autoLenObserver=n.observeOnce("items",function(){n._autoLenObserver=0,setTimeout(o)}))}},a=function(){r&&clearTimeout(r),r=setTimeout(function(){o(),r=null,i&&n._scrollListener&&n._scrollListener.fn()},50)};if(this._autoObserver=this.observe("~/tableHeight",a),this._autoObserver.fire=a,"virtual"===t){var l,s=!1,c=function(){if(n.rendered){if(l||(l=n.find(".rtable-top")),!i)return a();var t=l.scrollTop,e=n.get("virtual")||{},r=e.offset,o=n.get("_paginate"),c=o-10,f=n.get("rows.length");o>f&&(o=f);var d=n._avgSize,u=c*d,p=Math.floor(t/d)-5;p<0&&(p=0);var h=p;if(p+o>f&&(p=f-o),r===p)return s=!1;if(!k(r)||isNaN(r)||t<e.top+u||t>e.bottom-u||r>0&&t<d*c){var g=h,b=f-h-o;g<0?(b+=-1*g,g=0):g>f-o&&(g=f-o),b<0&&(b=0);var v,m,_=g*d,w=b*d;p<r+o&&p>r-o&&(v=p>r?n.findAll(".rtable-live")[p-r]:n.findAll(".rtable-live")[r-p]),v&&p>0&&v.offsetTop>l.scrollTop-u-5&&v.offsetTop<l.scrollTop+u&&(m=v.offsetTop),n.set({"virtual.above":_,"virtual.below":w,"virtual.offset":p}),"number"==typeof m&&m!==v.offsetTop&&n.set("virtual.above",_+(m-v.offsetTop)),n.set({"virtual.top":n.get("virtual.above"),"virtual.bottom":l.scrollHeight-w})}s=!1}else l=null},f=this._scrollListener=this.on("scroll",function(t){t.node;s||(s=!0,requestAnimationFrame(c))});this._scrollListener.fn=c,f.observer=this.observe("rows.length",function(){n.set("virtual.offset",null),c()},{init:!1,strict:!0});var d=f.cancel;f.cancel=function(){d(),f.observer.cancel()}}a()}else this._autoObserver&&this._autoObserver.cancel(),this._scrollListener&&this._scrollListener.cancel();k(t)&&this.set("_paginate",t)},defer:!0}},data:function(){return{page:0,selections:[],allowSelect:!0,allowSelectAll:!0,showGroups:!0,allowGroupSelect:!0,expanded:null,minPerPage:10}},computed:{rows:{get:function(){var t=this,e=this.viewmodel.value.columns,n=this.viewmodel.value.fields,r=e.filter(function(t){return t.filter}).map(function(e){return L(t,e)}).filter(function(t){return t}),i=this.get("items")||[],o=i,a=this.get("filter"),l=this.get("sort");if(O(a)&&!Array.isArray(a)&&(a=[a]),(a instanceof RegExp||y(a))&&a){var s=a===""+a.toLowerCase()||a===""+a.toUpperCase();try{var c=y(a)?new RegExp(a,s?"i":""):a;i=i.filter(function(t){for(var e=r.length;e--;){var n=t&&r[e](t);if(n&&y(n)&&c.test(n))return!0}})}catch(t){}}else if(Array.isArray(a)){var f=function t(e,n,r,i){return n.map(function(n){var o={op:n.op||"=",value:n.value||""};if(n.id){var a=r.find(function(t){return t.id===n.id||t.filter===n.id});a&&(o.get=L(e,a),o.get?o.type=a.type||"string":a=0),a||(a=i.find(function(t){return t.id===n.id}))&&(o.get=j(e,a),o.type=a.type||"string")}else o.op="skip";return"and"!==n.op&&"or"!==n.op&&"&&"!==n.op&&"||"!==n.op||(o.op=n.op,Array.isArray(n.value)&&(o.value=t(e,n.value,r,i))),o}).filter(function(t){return"skip"!==t.op})}(this,a,e,n),d={};try{i=i.filter(function(e){return f.reduce(function(n,r){return n&&function t(e,n,r){var i=this;if(!n||!e.get&&"and"!==e.op&&"or"!==e.op&&"&&"!==e.op&&"||"!==e.op)return!1;var o=e.get&&e.get.call(this,n);var a=e.value;if("="===e.op||"=="===e.op||"is"===e.op)return"number"===e.type||"date"===e.type?+o==+a:o==a;if("!="===e.op||"<>"===e.op||"not"===e.op)return"number"===e.type||"date"===e.type?+o!=+a:o!=a;if(">"===e.op||"gt"===e.op)return W(o)>W(a);if(">="===e.op||"gte"===e.op)return W(o)>=W(a);if("<"===e.op||"lt"===e.op)return W(o)<W(a);if("<="===e.op||"lte"===e.op)return W(o)<=W(a);if("like"===e.op||"notlike"===e.op||"~"===e.op||"!~"===e.op){var l="like"===e.op||"~"===e.op;if(y(a)){if(!a)return!0;var s=r[a]||(r[a]=new RegExp(".*"+a.replace(/%/g,".*")+".*","gi"));l=s.test(o)}else A(a)&&(l=a.test(o));return"like"===e.op||"~"===e.op?l:!l}if("contains"===e.op||"@"===e.op){if(Array.isArray(o))return!!~o.indexOf(a)}else if("containslike"===e.op||"@~"===e.op||"containsnotlike"===e.op||"@!~"===e.op){if(Array.isArray(o)){var c=A(a)?a:y(a)?r[a]||(r[a]=new RegExp(".*"+a.replace(/%/g,".*")+".*","gi")):null;if(!c)return!1;var f=o.findIndex(function(t){return c.test((t||"").toString())});return"containslike"===e.op||"@~"===e.op?f>=0:f<0}}else{if("in"===e.op&&Array.isArray(a))return!!~a.indexOf(o);if(("or"===e.op||"||"===e.op)&&Array.isArray(a))return a.reduce(function(e,o){return e||t.call(i,o,n,r)},!1);if(("and"===e.op||"&&"===e.op)&&Array.isArray(a))return a.reduce(function(e,o){return e&&t.call(i,o,n,r)},!0)}return!0}.call(t,r,e,d)},!0)})}catch(t){}}return(y(l)||O(l)&&!Array.isArray(l))&&(l=[l]),Array.isArray(l)&&(l=l.map(function(r){if(y(r)){var i="-"===r[0]||"+"===r[0]?r.substr(1):r,o=e.find(function(t){return t.id===i}),a=n.find(function(t){return t.id===i}),l={dir:"-"===r[0]?-1:1,get:o&&L(t,o)||a&&j(t,a)||L(t,{filter:i})};if(o&&"number"===o.type||a&&"number"===a.type){var s=l.get;l.get=function(t){return W(s.call(this,t))}}return l}if(r&&"object"==typeof r){var c=e.find(function(t){return t.id===r.id}),f=n.find(function(t){return t.id===r.id}),d={dir:k(r.dir)?r.dir:"desc"===r.dir?-1:1,get:"function"==typeof r.get&&r.get||c&&L(t,c)||f&&j(t,f)||r.path&&j(t,{filter:r.path,value:r.value})};if("number"===r.type||c&&"number"===c.type||f&&"number"===f.type){var u=d.get;d.get=function(t){return W(u.call(this,t))}}return d}}).filter(function(t){return t&&t.get}),i.sort(function(e,n){for(var r,i,o,a=0;a<l.length;a++)if(r=l[a].get.call(t,e),i=l[a].get.call(t,n),0!==(o=l[a].dir*M(r,i)))return o;return o})),this.set("isFiltered",o.length!==i.length),i}},visibleRows:{get:function(){var t=this,n=this.get("rows"),r=this.get("paginate"),i=r,o=this.get("_paginate"),a=this.get("page")||0,l=this.get("virtual");return i?("number"!=typeof i&&isNaN(+i)&&(i="auto"===i||"virtual"===i||i instanceof e?o||1:30),i<this.get("minPerPage")&&(i=this.get("minPerPage")),"virtual"===r?(a=l&&l.offset||0,n.slice(a,a+i)):(a*i>n.length&&setTimeout(function(){return t.set("page",0)},0),n.slice(i*a,i*a+i))):n}},pagination:{get:function(){var t=this.get("items")||C,e=this.get("rows"),n=this.get("paginate"),r=n,i=this.get("page")||0;if("number"!=typeof r&&isNaN(r)&&(r=this.get("_paginate")),r<this.get("minPerPage")&&(r=this.get("minPerPage")),r){var o=Math.ceil(e.length/r),a={max:Math.ceil(t.length/r),total:o,per:r};if("virtual"===n&&(a.height=this._avg*e.length),a.total>14){var l=a.array=[];i>5?l.push(1,2,3,"..."):l.push(1,2,3,4,5,6,7,8),i>5&&i+6<o?l.push(i-1,i,i+1,i+2,i+3,"...",o-2,o-1,o):i+6<o?l.push("...",o-2,o-1,o):l.push(o-7,o-6,o-5,o-4,o-3,o-2,o-1,o)}else a.array=Array.apply(null,{length:a.total}).map(function(t,e){return e+1});return a}}},groups:{get:function(){for(var t,e,n=this.get("rows"),r={},i=0;i<n.length;i++)(e=n[i][this._init.by])!=t&&(r[i]=1),t=e;return r}}}});var R=/^[^\d]*/;function W(t){return k(t)?t:t&&(t=(""+t).replace(R,""))?parseFloat(t):1/0}var z=["label","type","filter","hidden","sort","no-pad","id","editable"],N=/^[a-z]{1,3}[0-9]+(?:-[0-9]+)?$/,C=[];function G(t){return void 0===t&&(t={}),function(e){var n=e.Ractive,r=e.instance;"includeGrid"in t&&n.styleSet("table.inclideGrid",t.includeGrid),r.components[t.name||"data-table"]=P}}i("RMTable","components",P),t.Table=P,t.numberify=W,t.plugin=G,t.default=G,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],e):e(t.RMTable={},t.Ractive)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n,r="undefined"!=typeof window?window:null;function i(t,e,n){if(r&&r.Ractive&&"object"==typeof r.Ractive[e]){var i=document.currentScript;if(i||(i=(i=document.querySelectorAll("script"))[i.length-1]),i){var o=i.getAttribute("data-alias");o&&(o=(o=o.split("&")).reduce(function(t,e){var n=e.split("="),r=n[0],i=n[1];return t[r]=i,t},{})),Ractive[e][o&&o[t]||t]=n}}}function o(t,e){var n=e.context||this.getContext(t),r={position:t.style.position,overflowY:t.style.overflowY};""!==t.style.position&&"static"!==t.style.position||(t.style.position="relative");var i=document.createElement("object");i.setAttribute("style","display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;"),i.type="text/html";var o=function(){e.offsetWidth&&n.set(e.offsetWidth,t.offsetWidth),e.offsetHeight&&n.set(e.offsetHeight,t.offsetHeight),e.clientWidth&&n.set(e.clientWidth,t.clientWidth),e.clientHeight&&n.set(e.clientHeight,t.clientHeight),e.diffWidth&&n.set(e.diffWidth,t.offsetWidth-t.clientWidth),e.diffHeight&&n.set(e.diffHeight,t.offsetHeight-t.clientHeight)};return i.onload=function(){i.contentDocument.defaultView.addEventListener("resize",o),o()},/Trident/.test(navigator.userAgent)?(t.appendChild(i),i.data="about:blank"):(i.data="about:blank",t.appendChild(i)),{refresh:o,teardown:function(){t.removeChild(i),t.style.position=r.position,t.style.overflowY=r.overflowY}}}var a={tiny:{units:[2,3,4,5,6,8],max:"0",value:0},xsmall:{units:[2,3,4,5,6,8,10,12],max:"20em",prefix:"xs",value:10},small:{units:[2,3,4,5,6,8,10,12],max:"36em",value:20},medium:{units:[2,3,4,5,6,8,10,12],max:"48em",value:30},large:{units:[2,3,4,5,6,8,10,12,20,24],max:"64em",value:40},xlarge:{units:[2,3,4,5,6,8,10,12,20,24,32],max:"100em",value:50},ginormous:{units:[2,3,4,5,6,8,10,12,20,24,32,64],max:"150em",value:60}},l={"grid grid-root":/\bgrid grid-root\b/g},s=/\s+/g;function c(t,e){var r,i,c=this.getContext(t),f=this,d=e||{};function u(e){if("number"==typeof d.offset&&(e-=d.offset),!d.type||"class"===d.type){var n,o=-1;for(var a in r)r[a]<=e&&(l[a].lastIndex=-1,r[a]>o&&(n=a,o=r[a])),t.className=t.className.replace(l[a],"").trim();if(!n)return;l[n].test(t.className)||(t.className+=" "+n),d.value&&c.set(d.value,i[n].value),d.name&&c.set(d.name,n),t.className=t.className.replace(s," ")}}function p(){var e=(n||(n=document.createElement("div"),document.body.appendChild(n)),n);for(var o in i=f.get("@style.break")||a,r={},i)e.style.width=i[o].max,r[o]=e.clientWidth,l[o]||(l[o]=new RegExp("\\b"+o+"\\b","g"));e.style.width=0,u(t.clientWidth)}var h=this.observe("@style.break",p,{init:!1}),g=c.observe("@local.width",u,{init:!1}),b=o.call(this,t,{clientWidth:"@local.width"});return t.className+=" grid grid-root",d.immediate?p():requestAnimationFrame(p),{update:function(e){d=e||{},requestAnimationFrame(function(){return u(t.clientWidth)})},teardown:function(){t.className=t.className.replace(l["grid grid-root"],"").trim(),g.cancel(),h.cancel(),b.teardown()}}}function f(t,e){var n=t("raui.grid.break")||e||a,r=(t("raui.grid.wrappers")||[".row-wrap > ",".row-wrap > .row-wrap > "]).slice();r.unshift("");var i,o=".row > * { position: relative; width: 100%; transition-duration: 0.2s; transition-timing-function: ease-in-out; transition-property: padding, margin; box-sizing: border-box; }\n.grid { display: block; }\n.grid .row { display: flex !important; flex-wrap: wrap; min-height: fit-content; width: 100%; align-content: flex-start; }\n.grid .row.row-pad > * { padding: "+(t("raui.grid.padding")||"0.5em")+"; }\n.grid .row > .pad { display: flex; flex-direction: column; padding: "+(t("raui.grid.padding")||"0.5em")+"; box-sizing: border-box; }",l=Object.keys(n).map(function(t){return(n[t].key=t)&&n[t]});l.sort(function(t,e){return t.value>e.value?1:t.value<e.value?-1:0});var s={};l.reverse().reduce(function(t,e){return t.push(e.key),s[e.key]=t.slice(),t},[]);var c="",f="";return l.reverse().forEach(function(e){var n=e.prefix||e.key[0];e.units.forEach(function(o){f+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+"1, ."+t+" > "+e+".row > ."+n+"1, ."+t+" ."+n+"-n1, ."+t+" .row-"+n+"-n1 > *"}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: 100%; flex-grow: 0; flex-shrink: 0; }\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+"0, ."+t+" > "+e+".row > ."+n+"0, ."+t+" ."+n+"-n0, ."+t+" .row-"+n+"-n0 > *"}).join(", ")}).join(", ")+" { display: none; flex-grow: 0; flex-shrink: 0; }",c+="\n"+s[e.key].map(function(t){return"."+t+" .row-"+n+"-n1 > *"}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: 100%; }\n"+s[e.key].map(function(t){return"."+t+" .row-"+n+"-n0 > *"}).join(", ")+" { display: none; }";for(var a=function(a){i=(i=""+a/o*100).substr(0,i.indexOf(".")+3),c+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+".row-"+n+a+"-"+o+" > *, ."+t+" .row-"+n+"-n"+a+"-"+o+" > *, ."+t+" .row > ."+n+"-n"+a+"-"+o}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: "+i+"%; }",f+="\n"+s[e.key].map(function(t){return r.map(function(e){return"."+t+" > "+e+"."+n+a+"-"+o+", ."+t+" > "+e+".row > ."+n+a+"-"+o+", ."+t+" ."+n+"-n"+a+"-"+o+", ."+t+" .row-"+n+"-n"+a+"-"+o+" > *"}).join(", ")}).join(", ")+" { display: "+(t("raui.grid.display")||"inline-block")+"; width: "+i+"%; flex-grow: 0; flex-shrink: 0; }"},l=1;l<o;l++)a(l)}),s[e.key].forEach(function(t){return f+=r.map(function(e){return"."+t+" > "+e+".row > ."+n+"-fill"}).join(", ")+", ."+t+" ."+n+"-nfill { width: auto; flex-grow: 2; flex-shink: 2; }\n"+r.map(function(e){return"."+t+" > "+e+".row > ."+n+"-auto"}).join(", ")+", ."+t+" ."+n+"-nauto { width: auto; flex-shrink: 2; }"})}),o+=c+f}c.style=f,i("grid","decorators",c);var d=250;function u(t){return void 0===t&&(t={}),function(e){var n=e.Ractive;e.instance.events[t.name||(t.count||"")+"clicks"]=function(e,r,i){var o,a=Object.assign({},t,i);return(o=e.__r_clicks__)?o.subscribe(a.count||1,!!a.hold,r):(o=new p(n.getContext(e),a.delay||d,a.bubble||!1),e.__r_clicks__=o,o.subscribe(a.count||1,!!a.hold,r)),{teardown:function(){o.unsubscribe(a.count||1,!!a.hold,r)}}}}}u({name:"click",count:1}),u({name:"dblclick",count:2}),u({name:"trpclick",count:3});var p=function(t,e,n){this.context=t,this.node=t.node,this.delay=e,this.fires={},this.refs=0,this.bubble=n,this.bind()};function h(t){return this.__r_clicks__.mousedown(t)}function g(t){return this.__r_clicks__.touchdown(t)}function b(){this.addEventListener("keydown",m,!1),this.addEventListener("blur",v,!1)}function v(){this.removeEventListener("keydown",m,!1),this.removeEventListener("blur",v,!1)}function m(t){if(32===t.which||10===t.which||13===t.which)return this.__r_clicks__.fire()}function _(t,e){var n=t.processParams(e,{duration:200,easing:"easeInOut"});return new Promise(function(e){requestAnimationFrame(function(){t.setStyle("overflow","hidden");var r="x"===n.axis?"width":"height";if(t.isIntro||n.intro){var i=t.getStyle(r);t.setStyle(r,0),t.setStyle("opacity",0),e(t.animateStyle(r,i,n).then(function(){return t.animateStyle("opacity",1,n)}).then(function(){t.setStyle(r,""),t.setStyle("overflow","")}))}else t.setStyle(r,t.getStyle(r)),t.setStyle("opacity",1),e(t.animateStyle("opacity",0,n).then(function(){return t.animateStyle(r,0,n)}))})})}function w(t,e){void 0===e&&(e={});var n="string"==typeof e?e:e.bind;if("string"!=typeof n)return{teardown:function(){}};var r=e.allow||2,i=this.getContext(t);function o(){var e="";t.scrollHeight>t.clientHeight&&(e+="vscroll"),t.scrollWidth>t.clientWidth&&(e+=(e?" ":"")+"hscroll"),t.scrollTop<=r?e+=" top":t.scrollTop>=t.scrollHeight-t.clientHeight-r?e+=" bottom":e+=" vmiddle",t.scrollLeft<=r?e+=" left":t.scrollLeft>=t.scrollWidth-t.clientWidth-r?e+=" right":e+=" hmiddle",i.set(n,e)}return t.addEventListener("scroll",o,{passive:!0}),requestAnimationFrame(o),{refresh:o,teardown:function(){t.removeEventListener("scroll",o)}}}p.prototype.subscribe=function(t,e,n){(this.fires[t+","+e]||(this.fires[t+","+e]=[])).push(n),this.refs++},p.prototype.unsubscribe=function(t,e,n){var r=this.fires[t+","+e]||[];r.splice(r.indexOf(n),1),this.refs--,this.refs||this.teardown()},p.prototype.bind=function(){window.PointerEvent||window.navigator.pointerEnabled?this.context.listen("pointerdown",h):window.navigator.msPointerEnabled?this.context.listen("MSPointerDown",h):(this.context.listen("mousedown",h),this.context.listen("touchstart",g)),"A"!==this.node.tagName&&"BUTTON"!==this.node.tagName&&"button"!==this.node.type&&"submit"!==this.node.type&&"checkbox"!==this.node.type&&"radio"!==this.node.type||this.context.listen("focus",b)},p.prototype.fire=function(t,e,n,r){var i=this;this.tm?(this.tmCount++,clearTimeout(this.tm)):this.tmCount=1;var o=function(){i.tm=null,(i.fires[i.tmCount+","+!!r]||[]).forEach(function(o){o({node:i.node,original:t,x:e,y:n,hold:!!r})})};return r?o():this.tm=setTimeout(o,this.delay),this.bubble},p.prototype.mousedown=function(t){var e=this;if(!this.preventMousedownEvents&&(void 0===t.which||1===t.which)){var n,r=t.clientX,i=t.clientY,o=t.pointerId,a=function(t){t.pointerId==o&&(e.fire(t,r,i),s())},l=function(t){t.pointerId==o&&(Math.abs(t.clientX-r)>=5||Math.abs(t.clientY-i)>=5)&&s()},s=function(){n&&clearTimeout(n),e.node.removeEventListener("MSPointerUp",a,!1),document.removeEventListener("MSPointerMove",l,!1),document.removeEventListener("MSPointerCancel",s,!1),e.node.removeEventListener("pointerup",a,!1),document.removeEventListener("pointermove",l,!1),document.removeEventListener("pointercancel",s,!1),e.node.removeEventListener("click",a,!1),document.removeEventListener("mousemove",l,!1)};return window.PointerEvent||window.navigator.pointerEnabled?(this.node.addEventListener("pointerup",a,!1),document.addEventListener("pointermove",l,!1),document.addEventListener("pointercancel",s,!1)):window.navigator.msPointerEnabled?(this.node.addEventListener("MSPointerUp",a,!1),document.addEventListener("MSPointerMove",l,!1),document.addEventListener("MSPointerCancel",s,!1)):(this.node.addEventListener("click",a,!1),document.addEventListener("mousemove",l,!1)),n=setTimeout(function(){s(),e.fire(t,r,i,!0)},400),this.bubble||t.stopPropagation(),this.bubble}},p.prototype.touchdown=function(t){var e,n=this,r=t.touches[0],i=r.clientX,o=r.clientY,a=r.identifier,l=function(t){t.changedTouches[0].identifier===a?(t.preventDefault(),n.preventMousedownEvents=!0,clearTimeout(n.preventMousedownTimeout),n.preventMousedownTimeout=setTimeout(function(){n.preventMousedownEvents=!1},400),n.fire(t,i,o),c()):c()},s=function(t){1===t.touches.length&&t.touches[0].identifier===a||c();var e=t.touches[0];(Math.abs(e.clientX-i)>=5||Math.abs(e.clientY-o)>=5)&&c()},c=function(){e&&clearTimeout(e),n.node.removeEventListener("touchend",l,!1),window.removeEventListener("touchmove",s,!1),window.removeEventListener("touchcancel",c,!1)};return this.node.addEventListener("touchend",l,!1),window.addEventListener("touchmove",s,!1),window.addEventListener("touchcancel",c,!1),e=setTimeout(function(){c(),n.fire(t,i,o,!0)},400),this.bubble||t.stopPropagation(),this.bubble},p.prototype.teardown=function(){var t=this.context;t.unlisten("pointerdown",h),t.unlisten("MSPointerDown",h),t.unlisten("mousedown",h),t.unlisten("touchstart",g),t.unlisten("focus",b),delete this.node.__r_clicks__},i("expand","transitions",_);var x=/^([-+])?([^\s]+)$/;function y(t){return"string"==typeof t}function k(t){return"number"==typeof t}function O(t){return"object"==typeof t}function A(t){return"object"==typeof t&&"RegExp"===Object.prototype.toString.call(t)}var S,E,P=function(t){function e(e){t.call(this,e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={selections:{configurable:!0}};return e.prototype._allSelected=function(){for(var t=this.get("selections"),e="virtual"===this.get("paginate")?this.get("rows"):this.get("visibleRows"),n=0;n<e.length;n++)if(!~t.indexOf(e[n]))return!1;return e.length&&!0},e.prototype.nodeSet=function(t,e,n){t[e]=n},e.prototype._expand=function(t){var e=this,n=this.get("visibleRows")[t],r=this.get("expanded"),i=this.find(".rtable-row-expand");i?this.transition("expand",i,{outro:!0}).then(function(){r===n?e.set("expanded",null):(e.set("expanded",n),e.transition("expand",e.find(".rtable-row-expand"),{intro:!0}))}):n===r?this.set("expanded",null):(this.set("expanded",n),this.transition("expand",this.find(".rtable-row-expand"),{intro:!0}))},e.prototype._setSort=function(t,e){var n=this.get("columns."+t);if(n&&(n.sort||n.filter)){var r=n.sort||n.filter,i=r;y(i)&&"~"===i[0]&&(i=this.get(i));var o=e.ctrlKey,a=this.get("sort");if(Array.isArray(i)||(i=[i]),a?Array.isArray(a)||(a=[a]):a=[],a.length){var l=a.map(function(t){return x.exec(t).slice(1)}),s=i.reduce(function(t,e){return t&&!!l.find(function(t){return t[1]===e})},!0);s&&a.length!==i.length&&!o?this.set("sort",i.map(function(t){return"+"+i})):o?s?this.set("sort",l.map(function(t){return~i.indexOf(t[1])?("+"===t[0]?"-":"+")+t[1]:t[0]+t[1]})):this.set("sort",a.concat(i.map(function(t){return""+(t===r&&n.dir||"+")+t}))):s?this.set("sort",l.map(function(t){return("+"===t[0]?"-":"+")+t[1]})):this.set("sort",i.map(function(t){return""+(t===r&&n.dir||"+")+t}))}else this.set("sort",i.map(function(t){return""+(t===r&&n.dir||"+")+t}))}},e.prototype._select=function(t,e){var n=this.get("selections");n||(n=[],this.set("selections",n));var r=n.indexOf(t);return~r?this.splice("selections",r,1):this.push("selections",t),(r>=n.length||1===n.length)&&this.set("selected",n[n.length-1]),this.fire("selection",{},{item:n[n.length-1],items:n}),setTimeout(function(){return e.target.checked=!~r}),!1},e.prototype.select=function(){var t=this.get("selected");t&&this.fire("selected",{},t,this.get("rows").indexOf(t),this.get("visibleRows").indexOf(t))},n.selections.get=function(){return this.get("selections")||[]},e.prototype.selectionOffset=function(t){var e=this.get("selected"),n=this.get("visibleRows");if(e&&~n.indexOf(e)){var r=n.indexOf(e);if(t>0?r+t>=n.length:r+t<0){var i=t<1?-1:1;(i<0&&this.get("page")+i>=0||i>0&&this.get("page")+i<this.get("pagination.total"))&&this.add("page",i),n=this.get("visibleRows");var o=t>0?n[0]:n[n.length-1];this.set({selected:o,selections:[o]})}else this.set({selected:n[r+t],selections:[n[r+t]]})}else{var a=t>0?n[0]:n[n.length-1];this.set({selected:a,selections:[a]})}this.fire("selection",{},{item:this.get("selected"),items:this.get("selections")})},e.prototype.selectionDown=function(){this.selectionOffset(1)},e.prototype.selectionUp=function(){this.selectionOffset(-1)},e.prototype._selectGroup=function(t){var e=t;this.get("page")&&(e+=this.get("page")*this.get("pagination.per"));var n,r=this.get("rows"),i=this.get("groups"),o=this.get("selections"),a=r[e++],l=["selections"],s=[];for(~(n=o.indexOf(a))?s.push(n):l.push(a);e<r.length&&!(e in i);)a=r[e++],~(n=o.indexOf(a))?s.push(n):l.push(a);if(1===l.length)for(n=s.length;n--;)this.splice("selections",s[n],1);else this.push.apply(this,l);return!1},e.prototype._groupSelected=function(t){var e=t;this.get("page")&&(e+=this.get("page")*this.get("pagination.per"));var n=this.get("rows"),r=this.get("groups"),i=this.get("selections");if(!~i.indexOf(n[e++]))return!1;for(;e<n.length&&!(e in r);)if(!~i.indexOf(n[e++]))return!1;return!0},Object.defineProperties(e.prototype,n),e}(e);function L(t,n){if(t&&n){if("function"==typeof n.get)return n.get;var r=t._getters||(t._getters={}),i=n.filter;y(i)&&0===i.indexOf("~/")&&(i=t.get(i));var o=Array.isArray(i)?i.join("."):!!y(i)&&i;if(o){if(!r[o])if(y(i)&&~i.indexOf("*")){var a=e.splitKeypath(i);r[o]=function(t){var e=T(t,a);return e.v||e.l}}else y(i)&&(i=e.splitKeypath(i)),r[o]=function(t){return H(t,i)};return r[o]}}}function j(t,n){if(t&&n){if("function"==typeof n.get)return n.get;var r=t._getters||(t._getters={}),i=n.path;y(i)&&0===i.indexOf("~/")&&(i=t.get(i));var o=Array.isArray(i)?i.join("."):!!y(i)&&i;if(o){if(!r[o])if(y(i)&&~i.indexOf("*")){var a=e.splitKeypath(i);r[o]=function(t){var e=T(t,a);return e.v||e.l}}else y(i)&&(i=e.splitKeypath(i)),r[o]=function(t){return H(t,i)};return r[o]}return y(i=n.value)&&0===i.indexOf("~/")&&(i=t.get(i)),"function"==typeof i?i:void 0}}function H(t,e){if(!e.length||t||"object"==typeof t){for(var n=t,r=0;r<e.length;r++)if("object"!=typeof(n=n[e[r]])||!n)return r+1<e.length?void 0:n;return n}}function T(t,e){if(!e.length)return{v:t};if(e.length&&"object"!=typeof t)return{n:1};var n=e[0];if("*"===n&&Array.isArray(t)){var r=e.slice(1);return{l:t.reduce(function(t,e){var n=T(e,r);return O(n)?n.v?t.push(n.v):n.l?t.push.apply(t,n.l):n.n||t.push(n):t.push(n),t},[])}}return T(t[n],e.slice(1))}function M(t,e){return t<e?-1:t>e?1:t==e?0:!t&&e?-1:t&&!e?1:0}e.extendWith(P,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable",g:1},{n:"class-rtable-virtual",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="virtual"'}}]},{n:"class-rtable-auto",t:13,f:[{t:2,x:{r:["~/paginate"],s:'_0==="auto"'}}]},{n:"class-rtable-fixed",t:13,f:[{t:2,r:"~/fixed"}]},{n:"class-rtable-border",t:13,f:[{t:2,r:"~/border"}]},{n:"class-rtable-fixed-header",t:13,f:[{t:2,r:"~/fixedHeader"}]},{n:"class-rtable-scrolled",t:13,f:[{t:2,x:{r:["~/scroll"],s:'!~(_0||"").indexOf("top")'}}]},{n:"class-rtable-with-select",t:13,f:[{t:2,r:"~/allowSelect"}]},{n:"class-rtable-valign-top",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="top"'}}]},{n:"class-rtable-valign-center",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="center"'}}]},{n:"class-rtable-valign-bottom",t:13,f:[{t:2,x:{r:["~/valign"],s:'_0==="bottom"'}}]},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{n:"grid",t:71,f:{r:["~/scrollOffset"],s:"[{offset:_0}]"}}],f:[{t:8,r:"grid-head"}]}],n:50,r:"~/fixedHeader"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-top",g:1},{t:4,f:[{n:["scroll"],t:70,f:"scroll"},{n:"sized",t:71,f:{r:[],s:'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]'}}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}},{t:4,f:[{n:"scrolled",t:71,f:{r:[],s:'["~/scroll"]'}}],n:50,r:"~/fixedHeader"}],f:[{t:7,e:"div",m:[{n:"grid",t:71},{t:4,f:[{n:"style-margin-top",f:[{t:2,r:"~/virtual.above"},"px"],t:13},{n:"style-margin-bottom",f:[{t:2,r:"~/virtual.below"},"px"],t:13}],n:50,x:{r:["~/paginate"],s:'_0==="virtual"'}}],f:[{t:4,f:[{t:8,r:"grid-head"}],n:51,r:"~/fixedHeader"}," ",{t:4,f:[{t:8,r:"grid-row"}],n:52,z:[{n:"source",x:{r:"~/items"}},{n:"shuffle",x:{x:{r:[],s:"true"}}}],r:"~/visibleRows"}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-row row t1",g:1}],f:[{t:16,r:"empty"}]}],n:50,x:{r:["~/rows.length"],s:"!_0"}}]}]}," ",{t:4,f:[{t:8,r:"pagination"}],n:50,x:{r:["~/paginate"],s:'_0!=="virtual"'}}]}],e:{'_0==="virtual"':function(t){return"virtual"===t},'_0==="auto"':function(t){return"auto"===t},'!~(_0||"").indexOf("top")':function(t){return!~(t||"").indexOf("top")},'_0==="top"':function(t){return"top"===t},'_0==="center"':function(t){return"center"===t},'_0==="bottom"':function(t){return"bottom"===t},"[{offset:_0}]":function(t){return[{offset:t}]},'[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]':function(){return[{offsetHeight:"~/tableHeight",diffWidth:"~/scrollOffset"}]},'["~/scroll"]':function(){return["~/scroll"]},true:function(){return!0},"!_0":function(t){return!t},'_0!=="virtual"':function(t){return"virtual"!==t},"(_0+_1)%2===1":function(t,e){return(t+e)%2==1},"[_0._setSort(_1,_2)]":function(t,e,n){return[t._setSort(e,n)]},"[_0._select(_1,_2),false]":function(t,e,n){return[t._select(e,n),!1]},'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]':function(t,e,n){return[["select",n,t.indexOf(n),e.indexOf(n)]]},"[_0._expand(_1)]":function(t,e){return[t._expand(e)]},"[_0.stopPropagation()]":function(t){return[t.stopPropagation()]},"_0.indexOf(_1)":function(t,e){return t.indexOf(e)},"_0===_1":function(t,e){return t===e},"_0>0":function(t){return t>0},"!_0&&_1>0":function(t,e){return!t&&e>0},'_0==="boolean"':function(t){return"boolean"===t},"_0._allSelected()":function(t){return t._allSelected()},"_0*_1+1":function(t,e){return t*e+1},"_2+1===_0?_1:(_2+1)*_3":function(t,e,n,r){return n+1===t?e:(n+1)*r},"_0&&_1":function(t,e){return t&&e},"_0===1":function(t){return 1===t},"_0._allSelected()&&_1<_2":function(t,e,n){return t._allSelected()&&e<n},'[_0.set("page",_1-1)]':function(t,e){return[t.set("page",e-1)]},'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]':function(t,e,n,r,i){return[/^\d+$/.test(e)&&+e>0&&+e<=t&&n.set("page",+e-1)||n.nodeSet(r,"value",i+1)]},"_0==_1+1":function(t,e){return t==e+1},'[_0.set("page",_2[_1-1])]':function(t,e,n){return[t.set("page",n[e-1])]},'_0==="..."':function(t){return"..."===t},'[_0.set("page",_1+1)]':function(t,e){return[t.set("page",e+1)]},"_0<_1-1":function(t,e){return t<e-1}},p:{"csp-dummy":[{t:7,e:"div",m:[{n:"class-rtable-odd",t:13,f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{n:"class-top",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="top"'}}]},{n:"class-bottom",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="bottom"'}}]},{n:"class-center",t:13,f:[{t:2,x:{r:[".valign"],s:'_0==="center"'}}]},{n:["click"],t:70,f:{r:["@this",".index","@event"],s:"[_0._setSort(_1,_2)]"}},{n:["click"],t:70,f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}},{n:["click"],t:70,f:{r:["~/rows","~/visibleRows","."],s:'[["select",_2,_0.indexOf(_2),_1.indexOf(_2)]]'}},{n:["click"],t:70,f:{r:["@this","@index"],s:"[_0._expand(_1)]"}},{n:["click"],t:70,f:{r:["@event"],s:"[_0.stopPropagation()]"}}]}," ",{t:4,f:["..."],n:50,x:{r:["~/selections","."],s:"_0.indexOf(_1)"}}," ",{t:4,f:["..."],n:50,x:{r:[".","~/expanded"],s:"_0===_1"}}," ",{t:4,f:["..."],n:50,x:{r:["~/virtual.offset"],s:"_0>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}}," ",{t:4,f:["..."],n:50,x:{r:["~/columns.0.type"],s:'_0==="boolean"'}}," ",{t:4,f:["..."],n:50,x:{r:["@this"],s:"_0._allSelected()"}}],empty:[{t:7,e:"div",f:[{t:7,e:"div",f:["No data."]}]}],pagination:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-bottom",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-info",g:1}],f:[{t:4,f:[{t:2,x:{r:["~/page","~/pagination.per"],s:"_0*_1+1"}}," - ",{t:2,x:{r:["~/pagination.total","~/rows.length","~/page","~/pagination.per"],s:"_2+1===_0?_1:(_2+1)*_3"}}," of ",{t:2,r:"~/rows.length"},{t:4,f:[" (",{t:2,r:"~/items.length"}," total)"],n:50,r:"~/isFiltered"}],n:50,x:{r:["pagination","rows.length"],s:"_0&&_1"}}," ",{t:4,f:[""],n:50,x:{r:["_paginate"],s:"_0===1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-select-all-all",g:1}],f:[{t:4,f:[{t:2,r:"selections.length"}," of ",{t:2,r:"rows.length"}," selected",{t:4,f:[" - ",{t:7,e:"a",m:[{n:"href",f:"#",t:13,g:1},{n:["click"],t:70,f:"selectAllAll"}],f:["Select All"]}],n:50,x:{r:["@this","selections.length","rows.length"],s:"_0._allSelected()&&_1<_2"}}],n:50,x:{r:["selections.length"],s:"_0>0"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rtable-pages",g:1}],f:[{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1-1)]'}}],f:["Previous"]}],n:50,x:{r:["~/page"],s:"_0>0"}}," ",{t:4,f:[{t:4,f:[{t:7,e:"input",m:[{n:["change"],t:70,f:{r:["~/pagination.total","@node.value","@this","@node","~/page"],s:'[(/^\\d+$/.test(_1)&&+_1>0&&+_1<=_0&&_2.set("page",+_1-1))||_2.nodeSet(_3,"value",_4+1)]'}},{n:"value",f:[{t:2,r:"."}],t:13},{t:73,v:"t",f:"false"}]}],n:50,x:{r:[".","~/page"],s:"_0==_1+1"}},{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","@index","../"],s:'[_0.set("page",_2[_1-1])]'}}],f:["..."]}," "],n:50,x:{r:["."],s:'_0==="..."'},l:1},{t:4,f:[" ",{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","."],s:'[_0.set("page",_1-1)]'}}],f:[{t:2,r:"."}]}],n:51,l:1}],n:52,r:"~/pagination.array"}," ",{t:4,f:[{t:7,e:"span",m:[{n:["click"],t:70,f:{r:["@this","~/page"],s:'[_0.set("page",_1+1)]'}}],f:["Next"]}],n:50,x:{r:["~/page","~/pagination.total"],s:"_0<_1-1"}}]}]}]}},css:function(t){return[function(t){var e=Object.assign({},t("raui.primary"),t("raui.table.primary")),n=Object.assign({},e,t("raui.primary.active"),t("raui.table.primary.active")),r=Object.assign({selected:{}},t("raui.table"));return"\n .rtable {\n display: flex;\n flex-direction: column;\n overflow: auto;\n max-width: 100%;\n max-height: 100%;\n box-sizing: border-box;\n flex-grow: 2;\n }\n \n .rtable-group > div > div,\n .rtable-header > div > div,\n .rtable-row > div > div {\n padding: 0.5em;\n overflow: inherit;\n text-overflow: inherit;\n line-height: 1em;\n }\n .rtable-row > .rtable-no-pad > div {\n padding: 0;\n }\n \n .rtable-auto .row > *,\n .rtable-fixed .row > *\n {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n }\n \n .rtable-header > div > div, .rtable-column {\n overflow: hidden;\n }\n \n .rtable-number-column {\n text-align: right;\n }\n .rtable-date-column {\n text-align: right;\n }\n \n .rtable-sortable {\n cursor: pointer;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .grid .row.rtable-row, .grid .rtable-header > .row {\n width: auto;\n min-width: min-content;\n flex-grow: 1;\n }\n \n .rtable-row-wrap {\n color: "+(e.fg||"#222")+";\n border-style: solid;\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-width: 0 0 1px 0;\n background-color: "+(r.even||e.bga||"#f4f4f4")+";\n }\n .rtable-row-wrap.rtable-odd {\n background-color: "+(r.odd||e.bg||"#fff")+";\n }\n .rtable-row-wrap:hover, .rtable-row-wrap.rtable-selected:hover {\n background-color: "+(r.over||n.bg||"rgba(128, 182, 229, 0.2)")+";\n position: relative;\n box-shadow: inset 1px 0 0 #dadce0,inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n z-index: 1;\n }\n \n .rtable-row-wrap.rtable-selected {\n background-color: "+(r.selected.bg||"rgba(0, 119, 238, 0.12)")+";\n color: "+(r.selected.fg||e.fg||"#222")+";\n }\n .rtable-row-wrap.rtable-selected.rtable-odd {\n background-color: "+(r.selected.odd||"rgba(0, 119, 238, 0.1)")+";\n }\n \n .rtable-row-wrap {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n \n .rtable-border .rtable-row .rtable-column,\n .rtable-border .rtable-group .rtable-column {\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-style: solid;\n border-width: 0 0 1px 1px;\n margin: 0 0 -1px -1px;\n }\n \n .rtable-border .rtable-row-wrap {\n border-width: 0 1px 1px 1px;\n }\n \n .rtable-border .rtable-row-expand {\n border-color: "+(r.divider||e.bc||"#ccc")+";\n border-style: solid;\n border-width: 1px 0 0 1px;\n margin-left: -1px;\n width: 100%;\n }\n \n .rtable-group {\n border-bottom: 2px solid "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap, .rtable-header.rtable-row-wrap:hover {\n font-weight: bold;\n background-color: "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-header.rtable-row-wrap {\n border-bottom: 2px solid "+(r.divider||e.bc||"#ccc")+";\n }\n \n .rtable-top {\n flex-grow: 5;\n flex-shrink: 1;\n overflow-y: auto;\n margin: 0.5em 0;\n position: relative;\n }\n .rtable-fixed-header .rtable-header {\n margin-top: 0.5em;\n position: relative;\n z-index: 1;\n }\n .rtable-fixed-header.rtable-scrolled .rtable-header {\n box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n }\n .rtable-fixed-header .rtable-top {\n margin-top: 0;\n }\n \n .rtable-bottom {\n display: flex;\n flex-wrap: wrap;\n flex-shrink: 0;\n padding: 0 0.5em 0.5em 0.5em;\n justify-content: space-between;\n user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n }\n \n .rtable-bottom > * {\n padding: 0.5em;\n }\n \n .rtable-pages span {\n margin: 0.3em;\n cursor: pointer;\n }\n .rtable-pages span:first-of-type {\n margin-left: 0;\n }\n .rtable-pages input {\n text-align: center;\n width: 2.5em;\n font-size: 1em;\n background-color: transparent;\n border: none;\n padding: 0;\n font-weight: bold;\n text-decoration: underline;\n }\n \n /* checkboxes */\n .rtable-select {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n position: absolute;\n display: block;\n margin: 0;\n width: 2em;\n height: 2em;\n box-shadow: none;\n outline: none;\n opacity: 0;\n top: 0;\n left: 0;\n border-radius: 2em;\n transform: translate(-0.1em, 0) scale(1);\n transition: transform 0.2s, opacity 0.2s;\n background-color: "+(e.bc||"#ccc")+";\n cursor: pointer;\n }\n \n .rtable-select-header > div, .rtable-select-row > div, .rtable-header > div.rtable-select-header > div {\n padding: 0;\n overflow: visible;\n width: 1.5em;\n position: relative;\n line-height: 1.8em;\n cursor: pointer;\n }\n \n .rtable-select:checked {\n background-color: "+(e.fga||"#07e")+';\n }\n \n .rtable-select-header:hover .rtable-select, .rtable-select-row:hover .rtable-select {\n opacity: 0.04;\n }\n \n .rtable-select:focus {\n opacity: 0.12;\n transform: translate(-0.1em, 0) scale(1);\n }\n \n .rtable-select-header:hover .rtable-select:focus, .rtable-select-row:hover .rtable.select:focus {\n opacity: 0.16;\n }\n \n .rtable-select:active {\n opacity: 0.4;\n transform: translate(-0.1em, 0) scale(0);\n transition: transform 0s, opacity 0s;\n }\n \n .rtable-select-row > div:before, .rtable-select-header > div:before {\n content: "";\n display: inline-block;\n box-sizing: border-box;\n border: solid 2px; /* Safari */\n border-color: '+(e.fg||"#222")+';\n border-radius: 2px;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n transition: border-color 0.2s, background-color 0.2s;\n }\n \n .rtable-select-row > div:after, .rtable-select-header > div:after {\n content: "";\n display: block;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 10px;\n height: 5px;\n border: solid 2px transparent;\n border-right: none;\n border-top: none;\n transform: translate(0.35em, 0.55em) rotate(-45deg);\n opacity: 0;\n }\n \n .rtable-selected .rtable-select-row > div:before, .rtable-all-selected > div:before {\n border-color: '+(e.fga||"#07e")+";\n background-color: "+(e.fga||"#07e")+";\n }\n \n .rtable-selected .rtable-select-row > div:after, .rtable-all-selected > div:after {\n border-color: "+(e.bg||"#fff")+";\n opacity: 1;\n }\n \n .rtable-row-wrap > .rtable-select-header,\n .rtable-row-wrap > .rtable-select-row {\n text-align: center;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: space-around;\n width: 2em;\n }\n \n .rtable-column button, .rtable-column .btn {\n padding: 0 0.5em;\n margin: 0.2em 0.5em;\n min-height: 0;\n }\n \n .rtable-column.rtable-editing {\n padding: 0;\n }\n .rtable-column.rtable-editing input {\n width: 100%;\n box-sizing: border-box;\n height: 100%;\n margin: 0;\n border: none;\n background-color: transparent;\n padding: 0.25em 0.5em;\n }\n \n .rtable-valign-top .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-top > div {\n display: flex;\n height: 100%;\n align-items: flex-start;\n box-sizing: border-box;\n }\n .rtable-valign-bottom .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-bottom > div {\n display: flex;\n height: 100%;\n align-items: flex-end;\n box-sizing: border-box;\n }\n .rtable-valign-center .grid > .rtable-row-wrap > .rtable-row > .rtable-column > div,\n .rtable .grid > .rtable-row-wrap > .rtable-row > .rtable-column.rtable-valign-col-center > div {\n display: flex;\n height: 100%;\n align-items: center;\n box-sizing: border-box;\n }\n "+(!1!==t("table.includeGrid")?f(t):"")}.call(this,t)].join(" ")},cssId:"rtable",noCssTransform:!0,attributes:["paginate","items","filter","sort","helpers","fixed","allowSelect","allowSelectAll","border","fixedHeader","valign"],components:{table:!1,Table:!1},syncComputedChildren:!0,decorators:{grid:c,sized:o},events:{},use:[u({name:"clickd",count:1}),u({name:"dblclickd",count:2}),(void 0===E&&(E={}),function(t){t.instance.transitions[E.name||"expand"]=_}),(void 0===S&&(S={}),function(t){t.instance.decorators[S.name||"scrolled"]=w})],on:{construct:function(){var t,e,n,r,i=this.component;if(!i)return;var o=i.template.f||[],a=i.template.m?i.template.m.slice():[],l=i.template;i.template={e:l.e,f:l.f,t:l.t,m:a};var s=0;function c(t,e,n){if(t&&t.f&&1===t.f.length&&2===t.f[0].t){var r="_a"+s++;return a.push({t:13,n:r,f:t.f}),n?r:e?{t:[{t:2,r:"~/"+r}]}:{t:2,r:"~/"+r}}return t&&t.f}function f(t){var e=[],n=[];return t.forEach(function(t){if("column"===t.e||"col"===t.e){var r,i={},o=t.m||C;if(i.index=e.length,e.push(i),i.content=(t.f||[]).filter(function(t){return"edit"!==t.e}),(r=o.find(function(t){return"id"===t.n}))&&y(r.f)&&(i.id=r.f),i.label=o.find(function(t){return"label"===t.n}),i.label&&i.label.f&&(i.label=c(i.label)),i.label||(i.label=""),i.id||(i.id=i.label),Array.isArray(i.label)||(i.label=[i.label]),i.type=o.find(function(t){return"type"===t.n}),i.type&&i.type.f&&(i.type=i.type.f),i.type||(i.type="string"),i.filter=o.find(function(t){return"filter"===t.n}),i.filter&&i.filter.f&&(i.filter=c(i.filter),i.filter.r&&(i.filter=i.filter.r)),i.sort=o.find(function(t){return"sort"===t.n}),i.sort&&i.sort.f&&(i.sort=c(i.sort),i.sort.r&&(i.sort=i.sort.r)),i.dir=o.find(function(t){return"dir"===t.n}),i.dir&&i.dir.f&&(i.dir=c(i.dir),i.dir.r&&(i.dir=i.dir.r)),i.hidden=o.find(function(t){return"hidden"===t.n}),i.hidden&&0===i.hidden.f?i.hidden=!0:i.hidden&&O(i.hidden.f)?i.hidden=c(i.hidden):i.hidden=!1,y(i.hidden)&&(i.hidden=!1),i.noPad=o.find(function(t){return"no-pad"===t.n}),i.noPad&&0===i.noPad.f?i.noPad=0:i.noPad&&O(i.noPad.f)?i.noPad=c(i.noPad):delete i.noPad,i.editable=o.find(function(t){return"editable"===t.n}),i.editable&&0===i.editable.f?i.editable=!0:i.editable&&O(i.editable.f)?i.editable=c(i.editable):i.editable=!1,i.valign=o.find(function(t){return"valign"===t.n}),i.valign&&O(i.valign.f)?i.valign=c(i.valign):i.valign&&"string"==typeof i.valign.f&&(i.valign=i.valign.f),(r=o.find(function(t){return"get"===t.n}))&&r.f){var a=c(r,!1,!0);field.get=function(t){var e=this.get(a);return"function"==typeof e?e.call(this,t):void 0}}i.attrs=o.filter(function(t){return!~z.indexOf(t.n)}),i.attrs.forEach(function(t,e){N.test(t.n)&&(i.attrs[e]={t:13,n:"class-"+t.n})})}else if("field"===t.e){var l,s={},f=t.m||C;if(y(l=f.find(function(t){return"path"===t.n}))?s.path=l:l&&l.f&&(s.path=c(l)),(l=f.find(function(t){return"value"===t.n}))&&l.f&&(s.value=c(l)),y(l=f.find(function(t){return"type"===t.n}))?s.type=l:l&&l.f&&(s.type=c(l)),y((l=f.find(function(t){return"id"===t.n})).f)&&(s.id=l.f),y(l=f.find(function(t){return"dir"===t.n}))?s.dir=l:l&&y(l.f)&&(s.dir=l.f),y(l=f.find(function(t){return"label"===t.n}))?s.label=l:l&&l.f&&(s.label=c(l)),(l=f.find(function(t){return"get"===t.n}))&&l.f){var d=c(l,!1,!0);s.get=function(t){var e=this.get(d);return"function"==typeof e?e.call(this,t):void 0}}s.id||(s.id=s.label),s.path||(s.path=s.id),n.push(s)}}),{fields:n,columns:e}}t=o.find(function(t){return"row"===t.e}),e=o.find(function(t){return"group"===t.e}),n=o.find(function(t){return"wrapper"===t.e}),this._init={sets:f(o),partials:{}};var d=this._init.sets.columns;this._init.sets["meta.expand"]=t&&t.f&&t.f.length&&t.f;var u="[_0._setSort(_1,_2)]",p=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-header"},{t:4,f:[{n:"style-opacity",f:"0",t:13}],n:50,x:{r:["~/fixedHeader","~/virtual.offset"],s:"!_0&&_1>0"}},{t:4,n:50,r:"~/fixedHeader",f:[{t:13,n:"style-padding-right",f:[{t:2,r:"~/scrollOffset"},"px"]}]}],f:[{t:7,e:"div",f:d.filter(function(t){return!0!==t.hidden}).map(function(t){var e={t:7,e:"div",f:[{t:7,e:"div",f:t.label}],m:[{t:4,n:53,r:"~/columns."+t.index,f:[{t:70,n:["click"],f:{r:["@this",".index","@event"],s:u}}]},{t:13,n:"title",f:t.label}].concat(t.attrs.filter(function(t){return"title"!==t.n}))};t.type&&e.m.push({t:13,n:"class-rtable-"+t.type+"-column"}),(t.filter||t.sort)&&e.m.push({t:13,n:"class-rtable-sortable"}),e.m.push({t:13,n:"class-rtable-column"});var n=e;return t.hidden&&t.hidden.r&&(n={t:4,n:51,r:t.hidden.r,f:[e]}),n}),m:[{t:13,n:"class-row"}]}]}];p[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-header"},{t:13,n:"class-rtable-column"},{t:13,n:"title",f:[{t:2,r:"selections.length"}," items selected"]},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]}],f:[{t:7,e:"div",f:[{t:4,n:50,r:"~/allowSelectAll",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this"],s:"_0._allSelected()"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:"selectAll"}]}]}],m:[{t:70,n:["clickd"],f:"selectAll"}]}]}]});var h,g=[{t:7,e:"div",m:[{t:13,n:"class-rtable-row-wrap"},{t:13,n:"class-rtable-odd",f:[{t:2,x:{r:["@index","~/virtual.offset"],s:"(_0+_1)%2===1"}}]},{t:13,n:"class-row-wrap"},{t:13,n:"class-rtable-live"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]}],f:[{t:7,e:"div",f:d.filter(function(t){return!0!==t.hidden}).map(function(t,e){var n=[{t:7,e:"div",f:[{t:16,r:"~/columns."+e+".content",c:{r:"."}}]}];t.attrs.length?(t.attrsP=t.attrs,t.attrs=[{t:16,r:"~/columns."+e+".attrsP",c:{r:"."}}]):t.attrs=[];var r=t.attrs;if(t.editable&&t.filter){var i={t:70,n:["click","mousedown","pointerdown","MSPointerDown","touchstart"],f:{r:["@event"],s:"[_0.stopPropagation()]"}},o=[{t:4,n:50,x:{r:["~/columns."+e+".type"],s:"_0==='boolean'"},f:[{t:7,e:"input",m:[{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,r:t.filter}]},i]}]},{t:4,n:51,l:1,f:[{t:7,e:"input",m:[{t:13,n:"value",f:[{t:2,r:t.filter}]},i]}]}];"object"==typeof t.editable?(r.push({t:13,n:"class-rtable-editing",f:t.editable}),n=[Object.assign({},t.editable,{t:4,n:50,f:o}),{t:4,n:51,l:1,f:n}]):(r.push({t:13,n:"class-rtable-editing"}),n=o)}t.valign&&r.push({t:13,n:"class-rtable-valign-col-top",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='top'"}}]},{t:13,n:"class-rtable-valign-col-bottom",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='bottom'"}}]},{t:13,n:"class-rtable-valign-col-center",f:[{t:2,x:{r:["~/columns."+e+".valign"],s:"_0==='center'"}}]});var a={t:7,e:"div",f:n,m:r};t.type&&r.unshift({t:13,n:"class-rtable-"+t.type+"-column"}),r.push({t:13,n:"class-rtable-column"}),a.m.find(function(t){return"title"===t.n})||r.unshift({t:13,n:"title",f:t.content.find(function(t){return t.e})?t.label:t.content}),0===t.noPad?r.push({t:13,n:"class-rtable-no-pad"}):t.noPad&&r.push({t:13,n:"class-rtable-no-pad",f:t.noPad});var l=a;return t.hidden&&t.hidden.r&&(l={t:4,n:51,r:t.hidden.r,f:[a]}),l}),m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-row"},{t:70,n:t&&t.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}]}]}];t&&t.m&&t.m.length&&(this._init.sets.rowAttrs=t.m.slice(),g[0].f[0].m.push({t:16,r:"~/rowAttrs",c:{r:"."}}));n&&n.m&&n.m.length&&(this._init.sets.wrapperAttrs=n.m.slice(),g[0].m.push({t:16,r:"~/wrapperAttrs",c:{r:"."}}));t&&t.f&&t.f.length&&(g[0].f[0].f.push({t:4,n:50,x:{r:[".","~/expanded"],s:"_0===_1"},f:[{t:7,e:"div",f:[{t:7,e:"div",f:[{t:16,r:"~/meta.expand",c:{r:"."}}]}],m:[{t:13,n:"class-t1"},{t:13,n:"class-rtable-row-expand"}]}]}),g[0].f[0].m.push({t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._expand(_1)]"}}));if(g[0].f.unshift({t:4,n:50,r:"~/allowSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this",".","@event"],s:"[_0._select(_1,_2),false]"}}]}]}]}]}),e&&e.m&&(h=e.m.find(function(t){return"by"===t.n}))&&(y(h.f)||1===h.length&&2===h[0].t)){var b={t:4,n:50,f:[{t:7,e:"div",m:[{t:13,n:"class-row"},{t:13,n:"class-rtable-group"},{t:13,n:"class-rtable-selected",f:[{t:2,x:{r:["~/selections","."],s:"~_0.indexOf(_1)"}}]},{t:70,n:t&&t.f?["dblclickd"]:["click","dblclick"],f:{r:["~/rows","~/visibleRows","."],s:"[['selected',_2,_0.indexOf(_2),_1.indexOf(_2)]]"}}].concat(e.m.filter(function(t){return"by"!==t.n&&"select"!==t.n}))}],x:{s:"_0&&_1[(_1&&(_2*_3+_4))||_4]",r:["~/showGroups","~/groups","~/page","~/pagination.per","@index"]}};g.unshift(b),this._init.by=h.f;var v,m=f(e.f).columns.filter(function(t){return!0!==t.hidden}).map(function(t){var e={t:7,e:"div",f:[{t:7,e:"div",f:t.content}],m:t.attrs};t.type&&e.m.unshift({t:13,n:"class-rtable-"+t.type+"-column"}),e.m.push({t:13,n:"class-rtable-column"}),e.m.find(function(t){return"title"===t.n})||e.m.unshift({t:13,n:"title",f:t.content});var n=e;return t.hidden&&t.hidden.r&&(n={t:4,n:51,r:t.hidden.r,f:[e]}),n});m.unshift({t:4,n:50,r:"~/allowGroupSelect",f:[{t:7,e:"div",m:[{t:13,n:"class-rtable-select-row"},{t:13,n:"class-rtable-column"},{t:70,n:["clickd"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}},{t:13,n:"class-rtable-all-selected",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]}],f:[{t:7,e:"div",f:[{t:7,e:"input",m:[{t:73,v:"t",f:"false"},{t:13,n:"type",f:"checkbox"},{t:13,n:"checked",f:[{t:2,x:{r:["@this","@index"],s:"_0._groupSelected(_1)"}}]},{t:13,n:"class-rtable-select"},{t:70,n:["click"],f:{r:["@this","@index"],s:"[_0._selectGroup(_1),false]"}}]}]}]}]}),(v=e.m.find(function(t){return"select"===t.n}))&&(r||(r=[])).push(Object.assign({},v,{n:"allowGroupSelect"})),(v=e.m.find(function(t){return"show"===t.n}))&&(r||(r=[])).push(Object.assign({},v,{n:"showGroups"})),b.f[0].f=m}this._init.partials["grid-row"]=g,this._init.partials["grid-head"]=p,r&&this.component&&(this.component.mappings=r)},config:function(){this.set(this._init.sets),Object.assign(this.partials,this._init.partials)},render:function(){this._autoObserver&&this._autoObserver.fire()},selectAll:function(){var t,e;this._allSelected()?(e=null,t=[],this.set({selections:t,selected:e})):(e=(t=("virtual"===this.get("paginate")?this.get("rows"):this.get("visibleRows")).slice())[0],this.set({selections:t,selected:e})),this.fire("selection",{},{item:e,items:t})},selectAllAll:function(){var t=this.get("rows").slice();return this.set({selections:t,selected:null}),this.fire("selection",{},{item:null,items:t}),!1}},observe:{paginate:{handler:function(t){var n=this;if("auto"===t||"virtual"===t||t instanceof e){this._autoObserver&&this._autoObserver.cancel(),this._scrollListener&&this._scrollListener.cancel();("auto"===t||"virtual"===t)&&this.root;var r,i=!1,o=function(){if(n.rendered){var e=n.find(".rtable-top");if(e)if(n.get("items.length")){var r=e.clientHeight+","+e.clientWidth;if(o.last!==r||!i){var a=n.find(".rtable-header");if(a){var l=Array.apply(null,n.findAll(".rtable-live")).map(function(t){return t.offsetHeight});if(l.length<5){var s=Math.floor(e.clientHeight/a.offsetHeight);s<5&&(s=5),n.set("_paginate",s),l=Array.apply(null,n.findAll(".rtable-live")).map(function(t){return t.offsetHeight})}l.length>0?i=!0:l=[25];var c=Math.ceil(l.reduce(function(t,e){return t+e},0)/l.length);n._avgSize=c;var f=Math.floor((e.clientHeight-a.offsetHeight)/c);"virtual"===t&&(f+=10)<30&&(f=30),n.set("_paginate",f),o.last=r}}}else n._autoLenObserver||(n._autoLenObserver=n.observeOnce("items",function(){n._autoLenObserver=0,setTimeout(o)}))}},a=function(){r&&clearTimeout(r),r=setTimeout(function(){o(),r=null,i&&n._scrollListener&&n._scrollListener.fn()},50)};if(this._autoObserver=this.observe("~/tableHeight",a),this._autoObserver.fire=a,"virtual"===t){var l,s=!1,c=function(){if(n.rendered){if(l||(l=n.find(".rtable-top")),!i)return a();var t=l.scrollTop,e=n.get("virtual")||{},r=e.offset,o=n.get("_paginate"),c=o-10,f=n.get("rows.length");o>f&&(o=f);var d=n._avgSize,u=c*d,p=Math.floor(t/d)-5;p<0&&(p=0);var h=p;if(p+o>f&&(p=f-o),r===p)return s=!1;if(!k(r)||isNaN(r)||t<e.top+u||t>e.bottom-u||r>0&&t<d*c){var g=h,b=f-h-o;g<0?(b+=-1*g,g=0):g>f-o&&(g=f-o),b<0&&(b=0);var v,m,_=g*d,w=b*d;p<r+o&&p>r-o&&(v=p>r?n.findAll(".rtable-live")[p-r]:n.findAll(".rtable-live")[r-p]),v&&p>0&&v.offsetTop>l.scrollTop-u-5&&v.offsetTop<l.scrollTop+u&&(m=v.offsetTop),n.set({"virtual.above":_,"virtual.below":w,"virtual.offset":p}),"number"==typeof m&&m!==v.offsetTop&&n.set("virtual.above",_+(m-v.offsetTop)),n.set({"virtual.top":n.get("virtual.above"),"virtual.bottom":l.scrollHeight-w})}s=!1}else l=null},f=this._scrollListener=this.on("scroll",function(t){t.node;s||(s=!0,requestAnimationFrame(c))});this._scrollListener.fn=c,f.observer=this.observe("rows.length",function(){n.set("virtual.offset",null),c()},{init:!1,strict:!0});var d=f.cancel;f.cancel=function(){d(),f.observer.cancel()}}a()}else this._autoObserver&&this._autoObserver.cancel(),this._scrollListener&&this._scrollListener.cancel();k(t)&&this.set("_paginate",t)},defer:!0}},data:function(){return{page:0,selections:[],allowSelect:!0,allowSelectAll:!0,showGroups:!0,allowGroupSelect:!0,expanded:null,minPerPage:10}},computed:{rows:{get:function(){var t=this,e=this.viewmodel.value.columns,n=this.viewmodel.value.fields,r=e.filter(function(t){return t.filter}).map(function(e){return L(t,e)}).filter(function(t){return t}),i=this.get("items")||[],o=i,a=this.get("filter"),l=this.get("sort");if(O(a)&&!Array.isArray(a)&&(a=[a]),(a instanceof RegExp||y(a))&&a){var s=a===""+a.toLowerCase()||a===""+a.toUpperCase();try{var c=y(a)?new RegExp(a,s?"i":""):a;i=i.filter(function(t){for(var e=r.length;e--;){var n=t&&r[e](t);if(n&&y(n)&&c.test(n))return!0}})}catch(t){}}else if(Array.isArray(a)){var f=function t(e,n,r,i){return n.map(function(n){var o={op:n.op||"=",value:n.value||""};if(n.id){var a=r.find(function(t){return t.id===n.id||t.filter===n.id});a&&(o.get=L(e,a),o.get?o.type=a.type||"string":a=0),a||(a=i.find(function(t){return t.id===n.id}))&&(o.get=j(e,a),o.type=a.type||"string")}else o.op="skip";return"and"!==n.op&&"or"!==n.op&&"&&"!==n.op&&"||"!==n.op||(o.op=n.op,Array.isArray(n.value)&&(o.value=t(e,n.value,r,i))),o}).filter(function(t){return"skip"!==t.op})}(this,a,e,n),d={};try{i=i.filter(function(e){return f.reduce(function(n,r){return n&&function t(e,n,r){var i=this;if(!n||!e.get&&"and"!==e.op&&"or"!==e.op&&"&&"!==e.op&&"||"!==e.op)return!1;var o=e.get&&e.get.call(this,n);var a=e.value;if("="===e.op||"=="===e.op||"is"===e.op)return"number"===e.type||"date"===e.type?+o==+a:o==a;if("!="===e.op||"<>"===e.op||"not"===e.op)return"number"===e.type||"date"===e.type?+o!=+a:o!=a;if(">"===e.op||"gt"===e.op)return W(o)>W(a);if(">="===e.op||"gte"===e.op)return W(o)>=W(a);if("<"===e.op||"lt"===e.op)return W(o)<W(a);if("<="===e.op||"lte"===e.op)return W(o)<=W(a);if("like"===e.op||"notlike"===e.op||"~"===e.op||"!~"===e.op){var l="like"===e.op||"~"===e.op;if(y(a)){if(!a)return!0;var s=r[a]||(r[a]=new RegExp(".*"+a.replace(/%/g,".*")+".*","gi"));l=s.test(o)}else A(a)&&(l=a.test(o));return"like"===e.op||"~"===e.op?l:!l}if("contains"===e.op||"@"===e.op){if(Array.isArray(o))return!!~o.indexOf(a)}else if("containslike"===e.op||"@~"===e.op||"containsnotlike"===e.op||"@!~"===e.op){if(Array.isArray(o)){var c=A(a)?a:y(a)?r[a]||(r[a]=new RegExp(".*"+a.replace(/%/g,".*")+".*","gi")):null;if(!c)return!1;var f=o.findIndex(function(t){return c.test((t||"").toString())});return"containslike"===e.op||"@~"===e.op?f>=0:f<0}}else{if("in"===e.op&&Array.isArray(a))return!!~a.indexOf(o);if(("or"===e.op||"||"===e.op)&&Array.isArray(a))return a.reduce(function(e,o){return e||t.call(i,o,n,r)},!1);if(("and"===e.op||"&&"===e.op)&&Array.isArray(a))return a.reduce(function(e,o){return e&&t.call(i,o,n,r)},!0)}return!0}.call(t,r,e,d)},!0)})}catch(t){}}return(y(l)||O(l)&&!Array.isArray(l))&&(l=[l]),Array.isArray(l)&&(l=l.map(function(r){if(y(r)){var i="-"===r[0]||"+"===r[0]?r.substr(1):r,o=e.find(function(t){return t.id===i}),a=n.find(function(t){return t.id===i}),l={dir:"-"===r[0]?-1:1,get:o&&L(t,o)||a&&j(t,a)||L(t,{filter:i})};if(o&&"number"===o.type||a&&"number"===a.type){var s=l.get;l.get=function(t){return W(s.call(this,t))}}return l}if(r&&"object"==typeof r){var c=e.find(function(t){return t.id===r.id}),f=n.find(function(t){return t.id===r.id}),d={dir:k(r.dir)?r.dir:"desc"===r.dir?-1:1,get:"function"==typeof r.get&&r.get||c&&L(t,c)||f&&j(t,f)||r.path&&j(t,{filter:r.path,value:r.value})};if("number"===r.type||c&&"number"===c.type||f&&"number"===f.type){var u=d.get;d.get=function(t){return W(u.call(this,t))}}return d}}).filter(function(t){return t&&t.get}),i.sort(function(e,n){for(var r,i,o,a=0;a<l.length;a++)if(r=l[a].get.call(t,e),i=l[a].get.call(t,n),0!==(o=l[a].dir*M(r,i)))return o;return o})),this.set("isFiltered",o.length!==i.length),i}},visibleRows:{get:function(){var t=this,n=this.get("rows"),r=this.get("paginate"),i=r,o=this.get("_paginate"),a=this.get("page")||0,l=this.get("virtual");return i?("number"!=typeof i&&isNaN(+i)&&(i="auto"===i||"virtual"===i||i instanceof e?o||1:30),i<this.get("minPerPage")&&(i=this.get("minPerPage")),"virtual"===r?(a=l&&l.offset||0,n.slice(a,a+i)):(a*i>n.length&&setTimeout(function(){return t.set("page",0)},0),n.slice(i*a,i*a+i))):n}},pagination:{get:function(){var t=this.get("items")||C,e=this.get("rows"),n=this.get("paginate"),r=n,i=this.get("page")||0;if("number"!=typeof r&&isNaN(r)&&(r=this.get("_paginate")),r<this.get("minPerPage")&&(r=this.get("minPerPage")),r){var o=Math.ceil(e.length/r),a={max:Math.ceil(t.length/r),total:o,per:r};if("virtual"===n&&(a.height=this._avg*e.length),a.total>14){var l=a.array=[];i>5?l.push(1,2,3,"..."):l.push(1,2,3,4,5,6,7,8),i>5&&i+6<o?l.push(i-1,i,i+1,i+2,i+3,"...",o-2,o-1,o):i+6<o?l.push("...",o-2,o-1,o):l.push(o-7,o-6,o-5,o-4,o-3,o-2,o-1,o)}else a.array=Array.apply(null,{length:a.total}).map(function(t,e){return e+1});return a}}},groups:{get:function(){for(var t,e,n=this.get("rows"),r={},i=0;i<n.length;i++)(e=n[i][this._init.by])!=t&&(r[i]=1),t=e;return r}}}});var R=/^[^\d]*/;function W(t){return k(t)?t:t&&(t=(""+t).replace(R,""))?parseFloat(t):1/0}var z=["label","type","filter","hidden","sort","no-pad","id","editable"],N=/^[a-z]{1,3}[0-9]+(?:-[0-9]+)?$/,C=[];function G(t){return void 0===t&&(t={}),function(e){var n=e.Ractive,r=e.instance;"includeGrid"in t&&n.styleSet("table.inclideGrid",t.includeGrid),r.components[t.name||"data-table"]=P}}i("RMTable","components",P),t.Table=P,t.numberify=W,t.plugin=G,t.default=G,Object.defineProperty(t,"__esModule",{value:!0})}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2283759