-
Notifications
You must be signed in to change notification settings - Fork 7
/
ractive-datatable.min.js
1 lines (1 loc) · 20.2 KB
/
ractive-datatable.min.js
1
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.RactiveDatatable=e():t.RactiveDatatable=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(64)},function(t,e,n){function r(t,e){for(var n=t.length;n--;)if(o(t[n][0],e))return n;return-1}var o=n(57);t.exports=r},function(t,e,n){function r(t,e){var n=t.__data__;return o(e)?n["string"==typeof e?"string":"hash"]:n.map}var o=n(40);t.exports=r},function(t,e,n){var r=n(5),o=r(Object,"create");t.exports=o},function(t,e,n){var r=n(32),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e,n){function r(t,e){var n=i(t,e);return o(n)?n:void 0}var o=n(27),i=n(34);t.exports=r},function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){var r=n(4),o=r.Symbol;t.exports=o},function(t,e,n){function r(t){return null==t?void 0===t?c:s:f&&f in Object(t)?i(t):a(t)}var o=n(7),i=n(33),a=n(52),s="[object Null]",c="[object Undefined]",f=o?o.toStringTag:void 0;t.exports=r},function(t,e){function n(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}t.exports=n},function(t,e,n){e=t.exports=n(11)(),e.push([t.id,".ractive-datatable{display:block;max-width:100%}.ractive-datatable .scroll{overflow:auto}.ractive-datatable table{border-collapse:collapse;border-spacing:0;width:100%}.ractive-datatable tbody{border:0 solid rgba(0,0,0,.25);border-bottom-width:1px;border-top-width:1px}.ractive-datatable thead.sortable th{cursor:pointer}.ractive-datatable th{padding:.5em 1em;font-size:1.2em;text-align:left;white-space:nowrap}.ractive-datatable th.sort:after{content:'';border:3px solid transparent;display:inline-block;margin-left:3px;vertical-align:middle}.ractive-datatable th.sort.desc:after{border-top-color:currentColor}.ractive-datatable th.sort.asc:after{border-bottom-color:currentColor;position:relative;top:-3px}.ractive-datatable td{text-align:left;padding:.5em 1em;white-space:nowrap}.ractive-datatable td.editing{padding:0}.ractive-datatable td.editing input{padding:.5em 1em;background:none;border:none;outline:none;width:100%;font-size:1em;border-bottom:1px dotted #333}.ractive-datatable .highlight{background:linear-gradient(rgba(107,206,255,.5),rgba(0,146,219,.5));color:rgba(0,0,0,.9);border-radius:3px;box-shadow:inset 0 1px hsla(0,0%,100%,.5);border:1px solid #0092db}.ractive-datatable tr{background:#fff}.ractive-datatable tr:nth-child(even){background:#fafafa}.ractive-datatable tr+tr{border-top:1px solid #ddd}.ractive-datatable tr:hover td{background:rgba(0,0,0,.05)}.ractive-datatable tr.selected{background:#5699ff;color:#fff}.ractive-datatable .footer{margin-top:5px}.ractive-datatable .pagination{float:right;user-select:none}.ractive-datatable .pagination .disabled{opacity:.15;cursor:default;user-select:none}.ractive-datatable .pagination a{display:inline-block;cursor:pointer}.ractive-datatable .pages a{width:2em;text-align:center}.ractive-datatable .pages a.active{font-weight:700;text-decoration:underline}",""])},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(t,e){t.exports={v:4,t:[{t:3,x:{r:["highlight","."],s:"_0(_1)"}}],e:{}}},function(t,e){t.exports={v:4,t:[{t:7,e:"div",m:[{n:"class",f:["ractive-datatable ",{t:2,r:"class"}],t:13},{n:"id",f:[{t:2,r:"id"}],t:13},{n:"style",f:[{t:2,r:"style"}],t:13}],f:[{t:4,f:[{t:7,e:"div",m:[{n:"class",f:"scroll",t:13}],f:[{t:7,e:"table",f:[{t:7,e:"thead",m:[{n:"class",f:[{t:2,x:{r:["sortable"],s:'_0?"sortable":""'}}],t:13}],f:[{t:4,f:[{t:7,e:"th",m:[{t:4,f:[{n:"class",f:["sort ",{t:2,r:"sortMode"}],t:13}],n:50,x:{r:["sortOn","."],s:"_0===_1"}},{n:"click",f:{x:{r:["@this","."],s:"[_0.setSort(_1)]"}},t:70}],f:[{t:2,x:{r:["columns","."],s:"_0&&_0[_1]&&_0[_1].header?_0[_1].header:_1"}}]}],r:"cols"}]}," ",{t:7,e:"tbody",f:[{t:4,f:[{t:7,e:"tr",m:[{t:4,f:[{n:"class",f:"selected",t:13}],n:50,x:{r:["selectionMode","_selection","index"],s:'_0=="row"&&_1.indexOf(_2)!==-1'}},{n:"click",f:{x:{r:["@this","event"],s:"[_0.selectRow(_1)]"}},t:70},{n:"index",f:[{t:2,r:"index"}],t:13}],f:[{t:4,f:[{t:4,f:[{t:7,e:"td",m:[{n:"class",f:"editing",t:13}],f:[{t:7,e:"input",m:[{n:"value",f:[{t:2,rx:{r:"rows",m:[{t:30,n:"r"},"item",{t:30,n:"."}]}}],t:13},{n:"blur-keyup",f:{x:{r:["@this","event"],s:"[_0.fieldedited(_1)]"}},t:70},{f:"false",t:73,v:"t"}]}]}],n:50,x:{r:["editable","can",".","rows","editing","r","c"],s:'_0&&_1("edit",_2,_3[_5].item)&&_4==_5+"-"+_6'}},{t:4,n:51,f:[{t:7,e:"td",m:[{n:"class",f:[{t:2,r:"."}],t:13},{n:"dblclick",f:{x:{r:["@this","r","c"],s:'[_0.set("editing",_1+"-"+_2)]'}},t:70},{t:4,f:[{n:"class",f:"selected",t:13}],n:50,x:{r:["selectionMode","c","index","selection"],s:'_0=="cell"&&_3[_2]&&_3[_2][_1]'}},{n:"click",f:{x:{r:["@this","event"],s:"[_0.selectCell(_1)]"}},t:70}],f:[{t:4,f:[{t:4,n:53,f:[{t:8,x:{r:["cellFor","c","cols"],s:"_0(_2[_1])"}}],x:{r:[".","r","rows"],s:"_2[_1].item[_0]||_2[_1].item"}}],n:50,x:{r:["r","rows"],s:"_1[_0]&&_1[_0].item"}}]}],l:1}],i:"c",r:"cols"}]}],i:"r",r:"rows"}]}]}]}," ",{t:7,e:"div",m:[{n:"class",f:"footer",t:13}],f:["Displaying ",{t:2,r:"current"}," of ",{t:2,r:"total"}," ",{t:4,f:[{t:7,e:"span",m:[{n:"class",f:"pagination",t:13}],f:[{t:4,f:[{t:7,e:"span",m:[{n:"class",f:"disabled",t:13}],f:["Previous"]}],n:50,r:"onFirstPage"},{t:4,n:51,f:[{t:7,e:"a",m:[{n:"click",f:{x:{r:["@this"],s:"[_0.previousPage()]"}},t:70}],f:["Previous"]}],l:1}," ",{t:7,e:"span",m:[{n:"class",f:"pages",t:13}],f:[{t:4,f:[{t:7,e:"a",m:[{n:"click",f:{x:{r:["@this","."],s:"[_0.gotoPage(_1)]"}},t:70},{n:"class",f:[{t:2,x:{r:["page","."],s:'_0==_1?"active":""'}}],t:13}],f:[{t:2,r:"."}]}],r:"pages"}]}," ",{t:4,f:[{t:7,e:"span",m:[{n:"class",f:"disabled",t:13}],f:["Next"]}],n:50,r:"onLastPage"},{t:4,n:51,f:[{t:7,e:"a",m:[{n:"click",f:{x:{r:["@this"],s:"[_0.nextPage()]"}},t:70}],f:["Next"]}],l:1}]}],n:50,r:"pages"}]}],n:50,r:"data"}]}],e:{}}},function(t,e,n){function r(t,e){for(var n=0;n<t.length;n++){var r=t[n],o=d[r.id];if(o){o.refs++;for(var i=0;i<o.parts.length;i++)o.parts[i](r.parts[i]);for(;i<r.parts.length;i++)o.parts.push(f(r.parts[i],e))}else{for(var a=[],i=0;i<r.parts.length;i++)a.push(f(r.parts[i],e));d[r.id]={id:r.id,refs:1,parts:a}}}}function o(t){for(var e=[],n={},r=0;r<t.length;r++){var o=t[r],i=o[0],a=o[1],s=o[2],c=o[3],f={css:a,media:s,sourceMap:c};n[i]?n[i].parts.push(f):e.push(n[i]={id:i,parts:[f]})}return e}function i(t,e){var n=g(),r=b[b.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),b.push(e);else{if("bottom"!==t.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(e)}}function a(t){t.parentNode.removeChild(t);var e=b.indexOf(t);e>=0&&b.splice(e,1)}function s(t){var e=document.createElement("style");return e.type="text/css",i(t,e),e}function c(t){var e=document.createElement("link");return e.rel="stylesheet",i(t,e),e}function f(t,e){var n,r,o;if(e.singleton){var i=x++;n=_||(_=s(e)),r=u.bind(null,n,i,!1),o=u.bind(null,n,i,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=c(e),r=p.bind(null,n),o=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(e),r=l.bind(null,n),o=function(){a(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}function u(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=m(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}function l(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function p(t,e){var n=e.css,r=e.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),i=t.href;t.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}var d={},h=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},v=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),_=null,x=0,b=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=v()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var n=o(t);return r(n,e),function(t){for(var i=[],a=0;a<n.length;a++){var s=n[a],c=d[s.id];c.refs--,i.push(c)}if(t){var f=o(t);r(f,e)}for(var a=0;a<i.length;a++){var c=i[a];if(0===c.refs){for(var u=0;u<c.parts.length;u++)c.parts[u]();delete d[c.id]}}}};var m=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e,n){var r=n(10);"string"==typeof r&&(r=[[t.id,r,""]]);n(14)(r,{});r.locals&&(t.exports=r.locals)},function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=n(35),i=n(36),a=n(37),s=n(38),c=n(39);r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=c,t.exports=r},function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=n(42),i=n(43),a=n(44),s=n(45),c=n(46);r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=c,t.exports=r},function(t,e,n){var r=n(5),o=n(4),i=r(o,"Map");t.exports=i},function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}var o=n(47),i=n(48),a=n(49),s=n(50),c=n(51);r.prototype.clear=o,r.prototype.delete=i,r.prototype.get=a,r.prototype.has=s,r.prototype.set=c,t.exports=r},function(t,e,n){var r=n(5),o=n(4),i=r(o,"Set");t.exports=i},function(t,e,n){function r(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new o;++e<n;)this.add(t[e])}var o=n(19),i=n(53),a=n(54);r.prototype.add=r.prototype.push=i,r.prototype.has=a,t.exports=r},function(t,e,n){function r(t,e){var n=null==t?0:t.length;return!!n&&o(t,e,0)>-1}var o=n(25);t.exports=r},function(t,e){function n(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1}t.exports=n},function(t,e){function n(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1}t.exports=n},function(t,e,n){function r(t,e,n){return e===e?a(t,e,n):o(t,i,n)}var o=n(24),i=n(26),a=n(55);t.exports=r},function(t,e){function n(t){return t!==t}t.exports=n},function(t,e,n){function r(t){if(!a(t)||i(t))return!1;var e=o(t)?h:f;return e.test(s(t))}var o=n(58),i=n(41),a=n(6),s=n(56),c=/[\\^$.*+?()[\]{}|]/g,f=/^\[object .+?Constructor\]$/,u=Function.prototype,l=Object.prototype,p=u.toString,d=l.hasOwnProperty,h=RegExp("^"+p.call(d).replace(c,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e,n){function r(t,e,n){var r=-1,l=i,p=t.length,d=!0,h=[],v=h;if(n)d=!1,l=a;else if(p>=u){var g=e?null:c(t);if(g)return f(g);d=!1,l=s,v=new o}else v=e?[]:h;t:for(;++r<p;){var _=t[r],x=e?e(_):_;if(_=n||0!==_?_:0,d&&x===x){for(var b=v.length;b--;)if(v[b]===x)continue t;e&&v.push(x),h.push(_)}else l(v,x,n)||(v!==h&&v.push(x),h.push(_))}return h}var o=n(21),i=n(22),a=n(23),s=n(29),c=n(31),f=n(9),u=200;t.exports=r},function(t,e){function n(t,e){return t.has(e)}t.exports=n},function(t,e,n){var r=n(4),o=r["__core-js_shared__"];t.exports=o},function(t,e,n){var r=n(20),o=n(62),i=n(9),a=1/0,s=r&&1/i(new r([,-0]))[1]==a?function(t){return new r(t)}:o;t.exports=s},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}())},function(t,e,n){function r(t){var e=a.call(t,c),n=t[c];try{t[c]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[c]=n:delete t[c]),o}var o=n(7),i=Object.prototype,a=i.hasOwnProperty,s=i.toString,c=o?o.toStringTag:void 0;t.exports=r},function(t,e){function n(t,e){return null==t?void 0:t[e]}t.exports=n},function(t,e,n){function r(){this.__data__=o?o(null):{},this.size=0}var o=n(3);t.exports=r},function(t,e){function n(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}t.exports=n},function(t,e,n){function r(t){var e=this.__data__;if(o){var n=e[t];return n===i?void 0:n}return s.call(e,t)?e[t]:void 0}var o=n(3),i="__lodash_hash_undefined__",a=Object.prototype,s=a.hasOwnProperty;t.exports=r},function(t,e,n){function r(t){var e=this.__data__;return o?void 0!==e[t]:a.call(e,t)}var o=n(3),i=Object.prototype,a=i.hasOwnProperty;t.exports=r},function(t,e,n){function r(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=o&&void 0===e?i:e,this}var o=n(3),i="__lodash_hash_undefined__";t.exports=r},function(t,e){function n(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}t.exports=n},function(t,e,n){function r(t){return!!i&&i in t}var o=n(30),i=function(){var t=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();t.exports=r},function(t,e){function n(){this.__data__=[],this.size=0}t.exports=n},function(t,e,n){function r(t){var e=this.__data__,n=o(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():a.call(e,n,1),--this.size,!0}var o=n(1),i=Array.prototype,a=i.splice;t.exports=r},function(t,e,n){function r(t){var e=this.__data__,n=o(e,t);return n<0?void 0:e[n][1]}var o=n(1);t.exports=r},function(t,e,n){function r(t){return o(this.__data__,t)>-1}var o=n(1);t.exports=r},function(t,e,n){function r(t,e){var n=this.__data__,r=o(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var o=n(1);t.exports=r},function(t,e,n){function r(){this.size=0,this.__data__={hash:new o,map:new(a||i),string:new o}}var o=n(16),i=n(17),a=n(18);t.exports=r},function(t,e,n){function r(t){var e=o(this,t).delete(t);return this.size-=e?1:0,e}var o=n(2);t.exports=r},function(t,e,n){function r(t){return o(this,t).get(t)}var o=n(2);t.exports=r},function(t,e,n){function r(t){return o(this,t).has(t)}var o=n(2);t.exports=r},function(t,e,n){function r(t,e){var n=o(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var o=n(2);t.exports=r},function(t,e){function n(t){return o.call(t)}var r=Object.prototype,o=r.toString;t.exports=n},function(t,e){function n(t){return this.__data__.set(t,r),this}var r="__lodash_hash_undefined__";t.exports=n},function(t,e){function n(t){return this.__data__.has(t)}t.exports=n},function(t,e){function n(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1}t.exports=n},function(t,e){function n(t){if(null!=t){try{return o.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var r=Function.prototype,o=r.toString;t.exports=n},function(t,e){function n(t,e){return t===e||t!==t&&e!==e}t.exports=n},function(t,e,n){function r(t){if(!i(t))return!1;var e=o(t);return e==s||e==c||e==a||e==f}var o=n(8),i=n(6),a="[object AsyncFunction]",s="[object Function]",c="[object GeneratorFunction]",f="[object Proxy]";t.exports=r},function(t,e,n){function r(t){return"number"==typeof t||i(t)&&o(t)==a}var o=n(8),i=n(60),a="[object Number]";t.exports=r},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e){function n(t){return void 0===t}t.exports=n},function(t,e){function n(){}t.exports=n},function(t,e,n){function r(t){return t&&t.length?o(t):[]}var o=n(28);t.exports=r},function(t,e,n){function r(){window.getSelection?window.getSelection().empty?window.getSelection().empty():window.getSelection().removeAllRanges&&window.getSelection().removeAllRanges():document.selection&&document.selection.empty()}n(15);var o=n(65),i=(n(63),n(61)),a=n(6),s=n(59),c=Ractive.extend({template:n(13),data:function(){return{filter:"",perpage:30,page:1,editable:!0,sortable:!0,sortOn:"",_selection:[],selectionMode:"",dynamicColumns:!0,columns:void 0,can:function(t,e,n){var r=this.get("columns");if(n.hasOwnProperty(e)||"edit"!=t)return!r||(!!i(r[e])||(!(!r[e]||!i(r[e][t]))||r[e][t]))},highlight:function(t){var e=this,n=e.get("filter");return"object"==typeof t?"":n&&t?(t=String(t),t.indexOf(n)>-1?t.split(n).join('<span class="highlight">'+n+"</span>"):t):t},cellFor:function(t){return this.partials[t]?t:"__default__"}}},computed:{_data:function(){var t=this,e=t.get("data"),n=t.get("filter"),r=t.get("sortOn"),i=t.get("sortMode");if(n&&n.length>0){var a=new RegExp(n,"i");e=e.filter(function(t){for(var e in t)if(t.hasOwnProperty(e)&&a.test(t[e]))return!0})}return r&&(e=e.slice().sort(o(r,"desc"==i))),e.map(function(t,e){return{item:t,index:e}})},rows:function(){var t=this,e=t.get("page")-1,n=t.get("_data"),r=t.get("perpage"),o=t.get("total");t.get("data");return n.slice(e*r,Math.min(e*r+r,o))},cols:function(){var t=this,e=t.get("data"),n=t.get("columns"),r=t.get("dynamicColumns"),o=[];if(r?e.forEach(function(t){Object.keys(t).forEach(function(t){o.indexOf(t)===-1&&o.push(t)})}):o=Object.keys(n),a(n)){var c=[];o=o.filter(function(t){var e=n[t];if(i(e)||e===!0)return!0;if(e.display!==!1){if(!i(e.order)&&s(e.order))return void c.splice(e.order,0,t);if(e!==!1)return!0}});var f=c.length;if(c&&f>0)for(;f--;)o.unshift(c[f])}return o},total:function(){var t=this.get("_data");return t?this.get("_data").length:0},current:function(){var t=this.get("page"),e=this.get("perpage"),n=this.get("total"),r=(t-1)*e;return(1==t?1:r)+"-"+Math.min(r+e,n)},pages:function(){var t=this.get("total"),e=this.get("page"),n=this.get("perpage"),r=(this.get("onFirstPage"),this.get("lastPage"));if(n>t)return null;for(var o=[],i=Math.min(r,7),a=e>r-4?r-i:Math.max(e-4,0),s=a+i;a++<s;)o.push(a);return e>i&&(o[0]=1),a<r-4&&(o[o.length-1]=r),o},lastPage:function(){var t=this.get("total"),e=this.get("perpage");return Math.ceil(t/e)},onFirstPage:function(){return 1==this.get("page")},onLastPage:function(){var t=this.get("page"),e=this.get("lastPage");return t==e}},partials:{__default__:n(12)},oninit:function(){var t=this;t.observe("editing",function(e){if(e){var n=t.find("td input");n&&n.focus()}},{defer:!0}),t.observe("perpage filter data",function(){t.set("page",1)}),t.observe("perpage",function(e){"number"!=typeof e&&t.set("perpage",parseInt(e,10))}),t.observe("page",function(e){"number"!=typeof e&&t.set("perpage",parseInt(e,10))}),t.observe("_selection",function(e){var n=t.get("data");e&&t.set("selection",e.map(function(t){return n[t]}))})},fieldedited:function(t){var e=this,n=t.original;if("keyup"==n.type&&13!==n.keyCode)return!1;var r=t.get(),o=t.get("index")+(e.get("page")-1)*e.get("perpage"),i=e.get("_data."+o+".item");if(t.node.value!==i[r]){o=e.get("data").indexOf(i);var a="data."+o+"."+r,s=t.node.value;e.set(a,s),e.fire("edit",i,r,s,o)}e.set("editing",null)},selectRow:function(t){var e,n=this.get("selectionMode"),o=t.original;if("cell"!=n){var i=this.get("_selection"),a=this.get("_lastSelected");if(e=t.context?t.context.index:t.index.r,s(e)){if(o.shiftKey&&a)for(var c=Math.min(a,e),f=Math.max(a,e),u=f;u<=f&&u>=c;u--)i.push(u);else if(o.ctrlKey||o.metaKey||o.altKey||1===i.length&&i[0]===e){var l=i.indexOf(e);l>-1?i.splice(l,1):i.push(e)}else i=[e];a=e,this.set("_lastSelected",a),this.set("_selection",i),r()}}},selectCell:function(t){var e=this.get("selectionMode");if("row"!=e){var n=t.original;n.stopImmediatePropagation(),r()}},setSort:function(t){var e=this;if(t&&e.get("sortable")){var n=e.get("sortMode"),r=e.get("sortOn");r!=t&&n||("asc"==n?e.set("sortMode","desc"):e.set("sortMode","asc")),e.set("sortOn",t)}},previousPage:function(){this.set("page",Math.max(this.get("page")-1,1))},nextPage:function(){this.set("page",Math.min(this.get("page")+1,this.get("lastPage")))},gotoPage:function(t){this.set("page",t)}});t.exports=c},function(t,e){function n(t,e){var n=e?1:-1,r=e?-1:1;return function(e,o){return e=e[t],o=o[t],"string"==typeof e&&(e=e.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),e<o?n:e>o?r:0}}t.exports=n}])});