-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmall.grid.core.min.js
More file actions
1 lines (1 loc) · 55.6 KB
/
small.grid.core.min.js
File metadata and controls
1 lines (1 loc) · 55.6 KB
1
(function(d,b){d.extend(true,b,{Callback:{Handler:c,Create:a}});function c(){this.handlers=[];this.isLocked=false;this.lockedData=[]}c.prototype.subscribe=function(e){if(d.isFunction(e)){this.handlers.push(e)}return this};c.prototype.unsubscribe=function(f){for(var e=this.handlers.length-1;e>=0;e--){if(this.handlers[e]===f){this.handlers.splice(e,1)}}return this};c.prototype.unsubscribeAll=function(){this.handlers=[];return this};c.prototype.notify=function(){var f=arguments[0];if(this.isLocked===true){this.lockedData.push(f);return f}for(var g=0,e=this.handlers.length;g<e;g++){f=this.handlers[g].apply(null,arguments)}return f};c.prototype.lock=function(){this.isLocked=true;this.lockedData=[]};c.prototype.notifyLocked=function(){this.isLocked=false;return this.notify({data:this.lockedData})};function a(){return new c()}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(g,e){g.extend(true,e,{Cell:{Editor:{Create:d,Checkbox:f,Float:b,Integer:c,Text:h,Select:a}}});function f(j,k){var i=this,l=!j.value;this.destroy=function(){};this.getValue=function(){i.onChange.notify({value:l});return l};g.extend(this,{onInitialize:e.Callback.Create(),onChange:e.Callback.Create(),onDestroy:e.Callback.Create()});i.onInitialize.notify({value:j.value})}function b(l,m){var k=this,n=l.value,i=g('<input type="text" class="grid-float-editor" />').val(n).width(l.column.width);this.append=function(o){i.appendTo(o);return k};this.remove=function(){if(i&&i.length){i.detach()}return k};this.destroy=function(){i.remove();i=undefined;k.onDestroy.notify({})};this.getValue=function(){return j(i.val())};this.setValue=function(o){i.val(j(o));k.onChange.notify({value:o});return k};this.focus=function(){if(i.is(":focus")===false){i.val(k.getValue()).select()}return k};function j(o){return parseFloat(o,10)||0}g.extend(this,{onInitialize:e.Callback.Create(),onChange:e.Callback.Create(),onDestroy:e.Callback.Create()});k.onInitialize.notify({value:n})}function c(l,m){var k=this,n=l.value,i=g('<input type="text" class="grid-integer-editor" />').val(n).width(l.column.width);this.append=function(o){i.appendTo(o);return k};this.remove=function(){if(i&&i.length){i.detach()}return k};this.destroy=function(){i.remove();i=undefined;k.onDestroy.notify({})};this.getValue=function(){return j(i.val())};this.setValue=function(o){i.val(j(o));k.onChange.notify({value:o});return k};this.focus=function(){if(i.is(":focus")===false){i.val(k.getValue()).select()}return k};function j(o){return parseInt(o,10)||0}g.extend(this,{onInitialize:e.Callback.Create(),onChange:e.Callback.Create(),onDestroy:e.Callback.Create()});k.onInitialize.notify({value:n})}function h(k,l){var j=this,m=k.value,i=g('<input type="text" class="grid-text-editor"/>').val(m).width(k.column.width);this.append=function(n){i.appendTo(n);return j};this.remove=function(){if(i&&i.length){i.detach()}return j};this.destroy=function(){i.remove();i=undefined;j.onDestroy.notify({})};this.getValue=function(){return i.val()};this.setValue=function(n){i.val(n);j.onChange.notify({value:n});return j};this.focus=function(){if(i.is(":focus")===false){i.val(j.getValue()).select()}return j};g.extend(this,{onInitialize:e.Callback.Create(),onChange:e.Callback.Create(),onDestroy:e.Callback.Create()});j.onInitialize.notify({value:m})}function a(k,m){var j=this,l=k.value||{text:"",value:""},i=g('<select class="grid-select-editor"/>');this.append=function(n){i.appendTo(n);return j};this.remove=function(){if(i&&i.length){i.detach()}return j};this.destroy=function(){i.remove();i=undefined;j.onDestroy.notify({})};this.getValue=function(){return{text:i.find("option:selected").text(),value:i.val()}};this.setValue=function(n){i.val(n);j.onChange.notify({value:n});return j};this.focus=function(){i.focus();return j};this.setSource=function(n){if(n.constructor===Array){var o="";var q=false;for(var p=0;p<n.length;p++){q=l.value===n[p].value;o+='<option value="'+n[p].value+'"'+(q?" selected":"")+">"+n[p].text+"</option>"}i.append(o)}};g.extend(this,{onInitialize:e.Callback.Create(),onChange:e.Callback.Create(),onDestroy:e.Callback.Create()});j.onInitialize.notify({value:l})}function d(i,j,k){if(!i.length){throw new TypeError("Editor name is not defined")}if(k instanceof Object===false){throw new TypeError("Settings is not defined")}if(e.Utils.isFunction(i,e.Cell.Editor)===false){throw new TypeError("name is not defined")}return new e.Cell.Editor[i](j,k)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(e,a){e.extend(true,a,{Cell:{Formatter:{Checkbox:j,Date:b,Default:d,Float:h,Integer:f,Money:c,Select:i,None:d,Radio:g,Text:d}}});function d(m,l,n,k){return m!==null&&m!==undefined?m.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):""}function j(m,l,n,k){return m?"<i class='fa fa-check-square-o'></i>":"<i class='fa fa-square-o'></i>"}function g(m,l,n,k){return m?"<i class='fa fa-dot-circle-o'></i>":"<i class='fa fa-circle-o'></i>"}function h(m,l,n,k){return(parseFloat(m)||0).toFixed(k.formatter.floatFormatter.decimals).replace(/\d(?=(\d{3})+\.)/g,"$&,")}function f(m,l,n,k){return(parseInt(m,10)||0).toFixed(k.formatter.integerFormatter.decimals).replace(/\d(?=(\d{3})+\.)/g,"$&,")}function c(m,l,n,k){m=+m;if(!isNaN(m)){return new Intl.NumberFormat(k.formatter.moneyFormatter.locales,k.formatter.moneyFormatter.options).format(m)}return d(m,l,n,k)}function b(m,l,n,k){if(!(m instanceof Date)){m=Date.parse(m)}if(!isNaN(m)){return new Intl.DateTimeFormat(k.formatter.dateFormatter.locales,k.formatter.moneyFormatter.options).format(m)}return d(m,l,n,k)}function i(m,l,n,k){if(m instanceof Object){return m.text}return m}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(e,d){e.extend(true,d,{Cell:{HeaderFormatter:{Default:b,Checkbox:c,SelectionCheckbox:f,Star:a}}});function b(h,g){return h.name!==null&&h.name!==undefined?h.name.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""):""}function c(h,g){return h[h.field]?"<i class='fa fa-check-square-o' data-click-type='checkbox'></i>":"<i class='fa fa-square-o' data-click-type='checkbox'></i>"}function f(h,g){return h[h.field]?"<i class='fa fa-check-square-o' data-click-type='selection-checkbox'></i>":"<i class='fa fa-square-o' data-click-type='selection-checkbox'></i>"}function a(h,g){return h[h.field]?"<i class='fa fa-star' data-click-type='star'></i>":"<i class='fa fa-star-o' data-click-type='star'></i>"}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(f,d){f.extend(true,d,{Column:{Comparer:{Default:b,Date:e,Number:c,String:g}}});function b(h){return function(k,j){var i=(h.field in k.item)?k.item[h.field]:null,l=(h.field in j.item)?j.item[h.field]:null;if(i instanceof Date&&l instanceof Date){i=i.getTime();l=l.getTime()}else{if(!isNaN(parseFloat(i))&&isFinite(i)){i++;l++}else{if(i&&typeof i.toString==="function"&&l&&typeof l.toString==="function"){i=i.toString().toLowerCase();l=l.toString().toLowerCase()}}}return(i==l?0:(i>l?h.sortOrder:-h.sortOrder))}}function c(i){var h=i.sortOrder;return function(l,k){var j=(i.field in l.item)?l.item[i.field]:null,m=(i.field in k.item)?k.item[i.field]:null;return(j-m)*h}}function a(i){var h=i.sortOrder;return function(l,k){var j=(i.field in l.item&&typeof l.item[i.field]==="string")?l.item[i.field].toLowerCase():null,m=(i.field in k.item&&typeof k.item[i.field]==="string")?k.item[i.field].toLowerCase():null;return j.localeCompare(m)*h}}function g(i){var h=i.sortOrder;return function(l,k){var j=(i.field in l.item&&typeof l.item[i.field]==="string")?l.item[i.field].toLowerCase():null,m=(i.field in k.item&&typeof k.item[i.field]==="string")?k.item[i.field].toLowerCase():null;return(j==m?0:(j>m?1*h:-1*h))}}function e(i){var h=i.sortOrder;return function(l,k){var j=(i.field in l.item)?l.item[i.field]:null,m=(i.field in k.item)?k.item[i.field]:null;return(new Date(j)-new Date(m))*h}}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Column:{Create:d,Model:e,ColumnData:a}});function a(){}a.prototype.align="";a.prototype.cellCssClass="";a.prototype.editable=true;a.prototype.editor=undefined;a.prototype.editMode=false;a.prototype.field="";a.prototype.filterable=false;a.prototype.formatter="Default";a.prototype.headerFormatter="Default";a.prototype.headerCssClass="";a.prototype.hidden=false;a.prototype.id=undefined;a.prototype.item=null;a.prototype.maxWidth=9999;a.prototype.minWidth=25;a.prototype.name="";a.prototype.resizeable=true;a.prototype.sortable=true;a.prototype.sortComparer="Default";a.prototype.sortOrder=0;a.prototype.width=50;function e(G){var w=this;var K=[];this.items={addItem:function(O){A(F(O));return w},addItems:function(P){if(P.length){w.onChange.lock();for(var Q=0,O=P.length;Q<O;Q++){w.items.addItem(P[Q])}w.onChange.notifyLocked()}return w},deleteItems:function(){return s()},deleteItemById:function(O){return D(O)},getItems:function(){var P=[];for(var Q=0,O=K.length;Q<O;Q++){P.push(K[Q].item)}return P},setItems:function(P){if(P.length){w.onChange.lock();K=[];for(var Q=0,O=P.length;Q<O;Q++){w.items.addItem(P[Q])}w.onChange.notifyLocked()}return w},updateItemById:function(R,Q){for(var P=0,O=K.length;P<O;P++){if(K[P].id===R){K[P].item=Q;w.onChange.notify({id:R});break}}return w},updateItemByIndex:function(O,P){if(K[O]){K[O].item=P;w.onChange.notify({id:K[O].id})}return w}};function I(){K=[]}function n(O){if(K.length){return K.filter(O)}return[]}function o(P,O){if(K.length){return K.reduce(P,O)}}function H(O){if(K.length){K.sort(O)}return w}function t(){return K.length===0}function M(){return K.length}function A(O){if(O instanceof a){K.push(O);w.onChange.notify({id:O.id})}return w}function k(Q){if(Q.length){w.onChange.lock();for(var P=0,O=Q.length;P<O;P++){A(Q[P])}w.onChange.notifyLocked()}return w}function m(O){if(O instanceof a){D(O.id)}return w}function D(Q){for(var P=0,O=K.length;P<O;P++){if(K[P].id===Q){K.splice(P,1);w.onChange.notify({id:Q});break}}return w}function N(O){if(K[O]){var P=K[O].id;K.splice(O,1);w.onChange.notify({id:P})}return w}function s(){if(K.length){w.onChange.lock();K=[];w.onChange.notifyLocked()}return w}function i(Q){for(var P=0,O=K.length;P<O;P++){if(K[P].id===Q){return K[P]}}}function h(O){return K[O]}function B(O){return K[O].id}function J(Q){for(var P=0,O=K.length;P<O;P++){if(K[P].id===Q){return P}}return -1}function C(Q,O){var P=i(Q);if(P&&O&&O in P){return P[O]}}function l(O,P){var Q=h(O);if(Q&&P&&P in Q){return Q[P]}}function j(){return K}function x(P,O){g(J(P),O);return w}function g(O,P){if(P instanceof a){K.splice(O+1,0,P);w.onChange.notify({id:P.id})}return w}function y(P,O){v(J(P),O);return w}function v(O,P){if(P instanceof a){K.splice(O,0,P);w.onChange.notify({id:P.id})}return w}function L(S,Q,P){for(var R=0,O=K.length;R<O;R++){if(K[R].id===S){if(Q){K[R][Q]=P;w.onChange.notify({id:S})}break}}return w}function r(O,Q,P){if(Q&&K[O]){K[O][Q]=P;w.onChange.notify({id:K[O].id})}return w}function z(Q){if(Q.length){w.onChange.lock();K=[];for(var P=0,O=Q.length;P<O;P++){A(Q[P])}w.onChange.notifyLocked()}return w}function q(Q,P){w.onChange.lock();for(var R=0,O=K.length;R<O;R++){K[R][Q]=P;w.onChange.notify({id:K[R].id})}w.onChange.notifyLocked();return w}function u(O){if(O instanceof a){p(O.id,O)}return w}function p(R,Q){if(Q instanceof a){for(var P=0,O=K.length;P<O;P++){if(K[P].id===R){K[P]=Q;w.onChange.notify({id:R});break}}}return w}function f(O,P){if(P instanceof a){if(K[O]){K[O]=P;w.onChange.notify({id:P.id})}}return w}function E(Q){if(Q.length){w.onChange.lock();for(var P=0,O=Q.length;P<O;P++){u(Q[P])}w.onChange.notifyLocked()}return w}function F(P){if(P instanceof Object){var O=new a();if(b.Utils.isProperty(G.columns.idProperty,O)){O.id=O[G.columns.idProperty]}else{if(G.columns.newIdType==="number"){O.id=b.Utils.createId()}else{O.id=b.Utils.createGuid()}}O.name=P.name;O.field=P.field;O.item=P;if("align" in P){O.align=P.align}if("cellCssClass" in P){O.cellCssClass=P.cellCssClass}if("editable" in P){O.editable=P.editable}if("editor" in P){O.editor=P.editor}if("editMode" in P){O.editMode=P.editMode}if("filterable" in P){O.filterable=P.filterable}if("formatter" in P){O.formatter=P.formatter}if("headerFormatter" in P){O.headerFormatter=P.headerFormatter}if("headerCssClass" in P){O.headerCssClass=P.headerCssClass}if("hidden" in P){O.hidden=P.hidden}if("maxWidth" in P){O.maxWidth=P.maxWidth}if("minWidth" in P){O.minWidth=P.minWidth}if("resizeable" in P){O.resizeable=P.resizeable}if("sortable" in P){O.sortable=P.sortable}if("sortOrder" in P){O.sortOrder=P.sortOrder}if("sortComparer" in P){O.sortComparer=P.sortComparer}if("width" in P){O.width=P.width}return O}}c.extend(this,{destroy:I,onChange:b.Callback.Create(),filter:n,reduce:o,sort:H,total:M,addColumn:A,addColumns:k,createColumn:F,deleteColumn:m,deleteColumnById:D,deleteColumnByIndex:N,deleteColumns:s,getColumnById:i,getColumnByIndex:h,getColumnIdByIndex:B,getColumnIndexById:J,getColumnPropertyById:C,getColumnPropertyByIndex:l,getColumns:j,insertColumnAfterId:x,insertColumnAfterIndex:g,insertColumnBeforeId:y,insertColumnBeforeIndex:v,isEmpty:t,setColumnPropertyById:L,setColumnPropertyByIndex:r,setColumns:z,setColumnsProperty:q,updateColumn:u,updateColumnById:p,updateColumnByIndex:f,updateColumns:E})}function d(g,f){if(Array.isArray(g)===false){throw new TypeError("Data is not defined")}if(f instanceof Object===false){throw new TypeError("Settings is not defined")}return new e(f).items.addItems(g)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(e,d){e.extend(true,d,{Event:{Data:c,Handler:b,Create:a}});function c(j){for(var f in j){if(j.hasOwnProperty(f)){this[f]=j[f]}}var g=false;var i=false;var h=false;this.preventDefault=function(){if(j&&"event" in j&&typeof j.event.preventDefault==="function"){j.event.preventDefault()}h=true};this.isDefaultPrevented=function(){return h};this.stopPropagation=function(){if(j&&"event" in j&&typeof j.event.stopPropagation==="function"){j.event.stopPropagation()}g=true};this.isPropagationStopped=function(){return g};this.stopImmediatePropagation=function(){if(j&&"event" in j&&typeof j.event.stopImmediatePropagation==="function"){j.event.stopImmediatePropagation()}i=true};this.isImmediatePropagationStopped=function(){return i}}function b(){this.handlers=[]}b.prototype.subscribe=function(f){if(e.isFunction(f)){this.handlers.push(f)}return this};b.prototype.unsubscribe=function(g){for(var f=this.handlers.length-1;f>=0;f--){if(this.handlers[f]===g){this.handlers.splice(f,1)}}return this};b.prototype.unsubscribeAll=function(){this.handlers=[];return this};b.prototype.notify=function(h){if(typeof h!==c){h=new c(h)}for(var g=0,f=this.handlers.length;g<f&&h.isImmediatePropagationStopped()===false;g++){if(this.handlers[g].call(null,h)===false){this.stopImmediatePropagation();break}}};function a(){return new b()}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,a){c.extend(true,a,{Grid:{Create:d,Model:b}});function b(w,h,A){var s=this,u={},j="0.6.2 beta",t=a.Utils.createGuid();function x(){z(A.plugins);var C=["windowManager","view","viewModel"];for(var D=0;D<C.length;D++){h[C[D]].init()}s.onInitialize.notify({});return s}function B(){k();var C=["windowManager","view","viewModel","rowsModel","columnsModel"];for(var D=0;D<C.length;D++){h[C[D]].destroy();delete h[C[D]]}s.onDestroy.notify({})}function f(){return h.windowManager}function e(){return h.view}function p(){return h.viewModel}function n(){return h.rowsModel}function v(){return h.columnsModel}function y(){return A}function g(C){if(u[C]){return u[C]}}function m(){return u}function i(C){return u[C]!==undefined}function r(C,E){if(i(C)){l(C)}var D=a.Plugins.Create(C,h,A,E);if(!D){throw new Error("Plugin is not defined.")}u[C]=D}function z(C){var E=Object.keys(C);for(var D=0;D<E.length;D++){r(E[D],C[E[D]])}}function l(C){if(u[C]){u[C].destroy();delete u[C]}}function k(){var D=Object.keys(u);for(var C=0;C<D.length;C++){l(D[C])}}function o(){return j}function q(){return t}c.extend(this,{init:x,destroy:B,getId:q,getPlugin:g,getPlugins:m,getSettings:y,getVersion:o,getView:e,getViewModel:p,getRowsModel:n,getColumnsModel:v,getWindowManager:f,isRegisteredPlugin:i,registerPlugin:r,registerPlugins:z,unregisterPlugin:l,unregisterPlugins:k,onInitialize:a.Callback.Create(),onDestroy:a.Callback.Create()})}function d(n,o,i,p,f){var h=a.Settings.Create(p||{});var j=a.Row.Create(o||[],h);var g=a.Column.Create(i||[],h);var m=a.View.Model.Create(j,g,h,false);var l=a.View.Create(n,m,h,false);var k=a.View.Window.Create(l,h,false);var e=new b(n,{columnsModel:g,rowsModel:j,view:l,viewModel:m,windowManager:k},h);if(f!==false){e.init()}return e}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Handler:{Click:{Create:a,Handler:d}}});function d(m,h){m.on("click",i).on("mousedown",e).on("contextmenu",k).on("dblclick",f).on("keydown",g);function j(n){if(n&&n.target){var p=c(n.target).closest(h.cellIdentifier);if(p.length){var o=p.closest(h.rowIdentifier);if(o.length){return{cellIndex:p.index(),rowIndex:o.index(),event:n}}}}}function e(n){if(n.ctrlKey||n.shiftKey){document.getSelection().removeAllRanges();n.preventDefault()}}function i(n){var o=j(n);if(o&&h.handleClick){h.handleClick(o)}}function k(n){var o=j(n);if(o&&h.handleContextMenu){h.handleContextMenu(o)}}function f(n){var o=j(n);if(o&&h.handleDblClick){h.handleDblClick(o)}}function g(n){var o=j(n);if(o&&h.handleKeyDown){h.handleKeyDown(o)}}function l(){m.off("click",i).off("mousedown",e).off("contextmenu",k).off("dblclick",f).off("keydown",g);var o=Object.keys(h);for(var n=0;n<o.length;n++){delete h[o[n]]}}c.extend(this,{destroy:l})}function a(h,e){if(!h.length){throw new TypeError("Container is not defined or does not exist in the DOM.")}if(h.length!==1){throw new TypeError("There should be only 1 container.")}var g={rowIdentifier:"TR",cellIdentifier:"TD",handleClick:undefined,handleDblClick:undefined,handleContextMenu:undefined,handleKeyDown:undefined};var f=c.extend({},g,e);return new d(h,f)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Handler:{Resize:{Create:a,Handler:d}}});function d(n,g){var j,k,h,f=false;n.on("mousedown",g.handlerIdentifier,e);c(document).on("mousemove",i).on("mouseup",m);function e(o){j=c(this).closest(g.cellIdentifier);if(j.length){k=j.index();h=o.pageX;g.handleResizeStart({cellElement:j,cellIndex:k,event:o});f=true}}function i(o){if(f){var p=o.pageX-j.offset().left;if(p>0){g.handleResize({cellElement:j,cellIndex:k,xDelta:o.pageX-h,width:p,event:o})}}}function m(o){if(f){f=false;g.handleResizeStop({cellElement:j,cellIndex:k,event:o})}}function l(){n.off("mousedown",e);c(document).off("mousemove",i).off("mouseup",m);j=undefined;var p=Object.keys(g);for(var o=0;o<p.length;o++){delete g[p[o]]}}c.extend(this,{destroy:l})}function a(h,e){if(!h.length){throw new TypeError("Container is not defined or does not exist in the DOM.")}if(h.length!==1){throw new TypeError("There should be only 1 container.")}var g={cellIdentifier:"TD",handleResize:undefined,handleResizeStart:undefined,handleResizeStop:undefined,handlerIdentifier:undefined};var f=c.extend({},g,e);return new d(h,f)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{Handler:{Scroll:{Create:a,Handler:b}}});function b(n,f){if(f.resetTop){n[0].scrollTop=0}if(f.resetLeft){n[0].scrollLeft=0}var i,l,m=false,k=false,g={scrollTop:n[0].scrollTop,scrollLeft:n[0].scrollLeft};n.on("scroll",h);n.on("wheel",e);function e(o){clearTimeout(l);if(k===false){k=true;f.handleMouseWheelStart({event:o})}f.handleMouseWheel({event:o});l=setTimeout(function(){f.handleMouseWheelStop({event:o});k=false},f.latency)}function h(p){var o={scrollTop:n[0].scrollTop,scrollLeft:n[0].scrollLeft,topDelta:n[0].scrollTop-g.scrollTop,leftDelta:n[0].scrollLeft-g.scrollLeft,event:p};clearTimeout(i);if(m===false){m=true;f.handleScrollStart(o)}f.handleScroll(o);i=setTimeout(function(){f.handleScrollStop(o);m=false},f.latency);g={scrollTop:o.scrollTop,scrollLeft:o.scrollLeft}}function j(){clearTimeout(i);clearTimeout(l);n.off("scroll",h);n.off("wheel",e);var p=Object.keys(f);for(var o=0;o<p.length;o++){delete f[p[o]]}}d.extend(this,{destroy:j})}function a(h,e){if(!h.length){throw new TypeError("Container is not defined or does not exist in the DOM.")}if(h.length!==1){throw new TypeError("There should be only 1 container.")}var g={handleMouseWheel:undefined,handleMouseWheelStart:undefined,handleMouseWheelStop:undefined,handlescroll:undefined,handlescrollStart:undefined,handlescrollStop:undefined,latency:300,resetLeft:true,resetTop:true};var f=d.extend({},g,e);return new b(h,f)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{Handler:{Shared:{GetInstance:e,Handler:a}}});function a(l){var j=this,h;d(window).on("click",i).on("contextmenu",g).on("resize",m);function i(n){j.onClick.notify({event:n})}function g(n){j.onContextMenu.notify({event:n})}function m(n){if(h){clearTimeout(h)}h=setTimeout(function(){j.onResize.notify({event:n})},l.latency)}function f(){return l}function k(){clearTimeout(h);d(window).off("click",i).off("contextmenu",g).off("resize",m)}d.extend(this,{onClick:c.Event.Create(),onContextMenu:c.Event.Create(),onResize:c.Event.Create(),getSettings:f,destroy:k})}var b;function e(f){if(!b){var h={latency:400};var g=d.extend({},h,f);b=new a(g)}return b}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Plugins:{Create:a}});function a(d,e,f,h){if(!d.length){throw new Error("Plugin name is not defined.")}if(e.view instanceof b.View.View===false){throw new TypeError("View is not defined")}if(e.windowManager instanceof b.View.Window.Manager===false){throw new TypeError("WindowManager is not defined")}if(f instanceof Object===false){throw new TypeError("Settings is not defined")}if(b.Utils.isFunction(d,b.Plugins)!==true){throw new TypeError("name is not defined")}f.plugins[d]=jQuery.extend(true,f.plugins[d]||{},h||{});var g=new b.Plugins[d](e,f);return g.init()}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{Query:{Column:{Request:b,Create:a}}});function b(f){function g(j,m,o){var l=0,p=false,k=j-m-o,i=j+2*m+o,n=0;return function(r,q,s){if(r.hidden===true){return false}n++;p=k<=l&&l<=i;l+=o+r.width;if(p||(k<=l&&l<=i)){r.calcWidth=l;r.calcIndex=n;return true}return false}}function e(k,i,j){return f.filter(g(k,i,j))}function h(l){var m={width:0,count:0};var k=f.getColumns();for(var j=0;j<k.length;j++){if(k[j].hidden===true){continue}m.width+=k[j].width+l;m.count++}return m}d.extend(this,{getColumnsInRange:e,getColumnsTotal:h})}function a(e){if(e instanceof c.Column.Model===false){throw new TypeError("Column model is not defined.")}return new c.Query.Column.Request(e)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Query:{Filter:a}});function a(p){var t=this,n=[],e=b.Utils.createGuid();function f(){return e}function i(){return p}function m(){n=[];return t}function g(){return n}function s(u,v){if(u in t){return t[u](v||"")}throw new TypeError("Type "+u+" not found.")}function l(){n.push({action:"and"});return t}function k(){n.push({action:"or"});return t}function r(u){n.push({action:"eq",value:u});return t}function q(u){n.push({action:"neq",value:u});return t}function j(u){n.push({action:"startsWith",value:u});return t}function d(u){n.push({action:"endsWith",value:u});return t}function h(u){n.push({action:"contains",value:u});return t}function o(u){n.push({action:"doesNotContain",value:u});return t}c.extend(this,{getId:f,getField:i,clear:m,get:g,add:s,and:l,or:k,contains:h,doesnotcontain:o,endswith:d,eq:r,neq:q,startswith:j})}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{Query:{Row:{Request:b,Create:a}}});function b(i){function j(o,p,n){var l="";var m=p.replace(/'/g,"\\'");switch(n){case"and":l+=" && ";break;case"or":l+=" || ";break;case"eq":l+=" (item.item['"+o+"'] == '"+m+"') === true ";break;case"neq":l+=" (item.item['"+o+"'] == '"+m+"') === false ";break;case"startsWith":l+=" (('' + item.item['"+o+"']).indexOf('"+m+"') === 0) === true ";break;case"endsWith":l+=" (('' + item.item['"+o+"']).indexOf('"+m+"', item.item['"+o+"'].length - '"+m+"'.length) !== -1) === true ";break;case"contains":l+=" (('' + item.item['"+o+"']).indexOf('"+m+"') !== -1) === true ";break;case"doesNotContain":l+=" (('' + item.item['"+o+"']).indexOf('"+m+"') !== -1) === false ";break}return l}function h(q){var o="";for(var n=0;n<q.length;n++){var m=q[n].get(),r=q[n].getField(),l="";for(var p=0;p<m.length;p++){l+=j(r,m[p].value,m[p].action)}if(l.length){if(n!==0){o+=" && "}o+="("+l+")"}}if(o.length){return new Function("item","return "+o)}}function e(l,t,r,m){var s=0,q=false,n=l-t-r,p=l+2*t+r,o=0;return function(v,u,w){if(m&&(m(v)===false)||(v.hidden===true)){return false}o++;q=n<=s&&s<=p;s+=r+v.height;if(q||(n<=s&&s<=p)){v.calcHeight=s;v.calcIndex=o;return true}return false}}function k(n,m){if(n&&typeof n==="function"){var l=h(m);i.foreach(function(p,o,q){if(l&&(l(p)===false)||(p.hidden===true)){return false}return n(p,o,q)})}}function f(q,l,o,p,n){for(var m=0;m<p.length;m++){i.sort(c.Column.Comparer[p[m].getSortComparer()]({sortOrder:p[m].getSortOrder(),field:p[m].getField()}))}return i.filter(e(q,l,o,h(n)))}function g(l,p){var o={height:0,count:0};var q=i.getRows();var n=h(p);for(var m=0;m<q.length;m++){if((n&&(n(q[m])===false))||(q[m].hidden===true)){continue}o.height+=q[m].height+l;o.count++}return o}d.extend(this,{getRowsInRange:f,getRowsCallback:k,getRowsTotal:g})}function a(e){if(e instanceof c.Row.Model===false){throw new TypeError("Rows model is not defined.")}return new c.Query.Row.Request(e)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{Query:{Sorter:a}});function a(j,f,l){var k=this,d=b.Utils.createGuid();function e(){return d}function g(){return j}function i(){return f}function h(){return l}c.extend(this,{getId:e,getField:g,getSortOrder:i,getSortComparer:h})}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{Row:{Create:e,Model:a,RowData:b}});function b(){}b.prototype.cellCssClass="";b.prototype.disabled=false;b.prototype.editable=true;b.prototype.editMode=false;b.prototype.height=20;b.prototype.hidden=false;b.prototype.id=undefined;b.prototype.item=null;b.prototype.maxHeight=200;b.prototype.minHeight=20;b.prototype.rowCssClass="";function a(M){var n=this;var O=[];this.items={addItem:function(P){H(l(P));return n},addItems:function(Q){if(Q.length){n.onChange.lock();for(var R=0,P=Q.length;R<P;R++){n.items.addItem(Q[R])}n.onChange.notifyLocked()}return n},deleteItems:function(){return v()},deleteItemById:function(P){return j(P)},getItems:function(){var Q=[];for(var R=0,P=O.length;R<P;R++){Q.push(O[R].item)}return Q},setItemsProperty:function(R,Q){n.onChange.lock();for(var S=0,P=O.length;S<P;S++){O[S].item[R]=Q;n.onChange.notify({id:O[S].id})}n.onChange.notifyLocked();return n},setItemPropertyById:function(T,R,Q){for(var S=0,P=O.length;S<P;S++){if(O[S].id===T){if(R){O[S].item[R]=Q;n.onChange.notify({id:T})}break}}return n},setItemPropertyByIndex:function(P,R,Q){if(R&&O[P]){O[P].item[R]=Q;n.onChange.notify({id:O[P].id})}return n},setItems:function(Q){if(Q.length){n.onChange.lock();O=[];for(var R=0,P=Q.length;R<P;R++){n.items.addItem(Q[R])}n.onChange.notifyLocked()}return n},updateItemById:function(S,R){for(var Q=0,P=O.length;Q<P;Q++){if(O[Q].id===S){O[Q].item=R;n.onChange.notify({id:S});break}}return n},updateItemByIndex:function(P,Q){if(O[P]){O[P].item=Q;n.onChange.notify({id:O[P].id})}return n}};function K(){O=[]}function m(R){n.onChange.lock();for(var Q=0,P=O.length;Q<P;++Q){if(R(O[Q],Q,O)!==false){n.onChange.notify({id:O[Q].id})}}n.onChange.notifyLocked()}function D(P){if(O.length){return O.filter(P)}return[]}function q(Q,P){if(O.length){return O.reduce(Q,P)}}function N(P){if(O.length){O.sort(P)}return n}function s(){return O.length===0}function y(){return O.length}function o(R){if(R.length){n.onChange.lock();for(var Q=0,P=R.legth;Q<P;Q++){H(R[Q])}n.onChange.notifyLocked()}return n}function h(R){if(R.length){n.onChange.lock();for(var Q=0,P=R.length;Q<P;Q++){F(R[Q])}n.onChange.notifyLocked()}return n}function u(R){if(R.length){n.onChange.lock();O=[];for(var Q=0,P=R.length;Q<P;Q++){H(R[Q])}n.onChange.notifyLocked()}return n}function f(R,Q){n.onChange.lock();for(var S=0,P=O.length;S<P;S++){O[S][R]=Q;n.onChange.notify({id:O[S].id})}n.onChange.notifyLocked();return n}function v(){if(O.length){n.onChange.lock();O=[];n.onChange.notifyLocked()}return n}function H(P){if(P instanceof b){O.push(P);n.onChange.notify({id:P.id})}return n}function A(P){if(P instanceof b){j(P.id)}return n}function j(R){for(var Q=0,P=O.length;Q<P;Q++){if(O[Q].id===R){O.splice(Q,1);n.onChange.notify({id:R});break}}return n}function C(P){if(O[P]){var Q=O[P].id;O.splice(P,1);n.onChange.notify({id:Q})}return n}function B(R){for(var Q=0,P=O.length;Q<P;Q++){if(O[Q].id===R){return O[Q]}}}function L(P){return O[P]}function p(P){return O[P].id}function J(R){for(var Q=0,P=O.length;Q<P;Q++){if(O[Q].id===R){return Q}}return -1}function w(R,P){var Q=B(R);if(Q&&P&&P in Q){return Q[P]}}function i(P,Q){var R=L(P);if(R&&Q&&Q in R){return R[Q]}}function t(){return O}function g(Q,P){x(J(Q),P);return n}function x(P,Q){if(Q instanceof b){O.splice(P+1,0,Q);n.onChange.notify({id:Q.id})}return n}function r(Q,P){G(J(Q),P);return n}function G(P,Q){if(Q instanceof b){O.splice(P,0,Q);n.onChange.notify({id:Q.id})}return n}function I(T,R,Q){for(var S=0,P=O.length;S<P;S++){if(O[S].id===T){if(R){O[S][R]=Q;n.onChange.notify({id:T})}break}}return n}function E(P,R,Q){if(R&&O[P]){O[P][R]=Q;n.onChange.notify({id:O[P].id})}return n}function F(P){if(P instanceof b){z(P.id,P)}return n}function z(S,R){if(R instanceof b){for(var Q=0,P=O.length;Q<P;Q++){if(O[Q].id===S){O[Q]=R;n.onChange.notify({id:S});break}}}return n}function k(P,Q){if(Q instanceof b){if(O[P]){O[P]=Q;n.onChange.notify({id:Q.id})}}return n}function l(P){if(P instanceof Object){var Q=new b();if(c.Utils.isProperty(M.rows.idProperty,P)){Q.id=P[M.rows.idProperty]}else{if(M.rows.newIdType==="number"){Q.id=c.Utils.createId()}else{Q.id=c.Utils.createGuid()}}Q.item=P;if("cellCssClass" in P){Q.cellCssClass=P.cellCssClass}if("disabled" in P){Q.disabled=P.disabled}if("editable" in P){Q.editable=P.editable}if("editMode" in P){Q.editMode=P.editMode}if("height" in P){Q.height=P.height}if("hidden" in P){Q.hidden=P.hidden}if("maxHeight" in P){Q.maxHeight=P.maxHeight}if("minHeight" in P){Q.minHeight=P.minHeight}if("rowCssClass" in P){Q.rowCssClass=P.rowCssClass}return Q}}d.extend(this,{destroy:K,onChange:c.Callback.Create(),foreach:m,filter:D,reduce:q,sort:N,total:y,addRow:H,addRows:o,createRow:l,deleteRow:A,deleteRowById:j,deleteRowByIndex:C,deleteRows:v,getRowById:B,getRowByIndex:L,getRowIdByIndex:p,getRowIndexById:J,getRowPropertyById:w,getRowPropertyByIndex:i,getRows:t,insertRowAfterId:g,insertRowAfterIndex:x,insertRowBeforeId:r,insertRowBeforeIndex:G,isEmpty:s,setRowPropertyById:I,setRowPropertyByIndex:E,setRows:u,setRowsProperty:f,updateRow:F,updateRowById:z,updateRowByIndex:k,updateRows:h})}function e(g,f){if(Array.isArray(g)===false){throw new TypeError("Data is not defined")}if(f instanceof Object===false){throw new TypeError("Settings is not defined")}return new a(f).items.addItems(g)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(f,c){var d=function(){var m=[];for(var l=0;l<256;l++){m[l]=l<16?"0"+l.toString(16):l.toString(16)}return function(){var q=Math.random()*4294967295|0,s=Math.random()*4294967295|0,p=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(m[q&255]+m[q>>8&255]+m[q>>16&255]+m[q>>24&255]+"-"+m[s&255]+m[s>>8&255]+"-"+m[s>>16&15|64]+m[s>>24&255]+"-"+m[p&63|128]+m[p>>8&255]+"-"+m[p>>16&255]+m[p>>24&255]+m[o&255]+m[o>>8&255]+m[o>>16&255]+m[o>>24&255]).toLowerCase()}}();var g=function(){var l=0;return function(){return""+l++}}();function b(m,l){return l&&m&&m in l&&typeof l[m]==="function"}function j(l,m){return l&&l in m}function a(l){return(/^true$/i).test(l)}function k(){var n=1000000,m=1000000,l=f('<div style="display:none; " />').appendTo(document.body);do{l.css("height",m);if(l.height()===m){m+=n}else{break}}while(m<16000000);l.remove();return m-n}function i(){var l=f('<div style="position:absolute; top:-100px; left:-100px; width:100px; height:100px; overflow:scroll;"></div>').appendTo(document.body);var m={width:l.width()-l[0].clientWidth,height:l.height()-l[0].clientHeight};l.remove();return m}function e(l){var n=f("<table class='grid-content-table' style='position:absolute; top:-100px; left:-100px;'><tbody><tr><td class='"+l+"' style='width:5px; height:5px;'>-</td></tr></tbody></table>").appendTo(document.body);var o=n.find("TD");var m={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()};n.remove();n=o=undefined;return m}function h(l){return l<0?1:-1}f.extend(true,c,{Utils:{changeSortOrder:h,createGuid:d,createId:g,isFunction:b,isProperty:j,measureCellDiff:e,measureMaxSupportedCssHeight:k,measureScrollbar:i,parseBool:a}})})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{View:{Builder:{Create:a,Builder:d}}});function d(s){var o=this;function u(y){var x={headerCol:null,headerTbody:null,headerTable:null,headerWrap:null,contentCol:null,contentTbody:null,contentTable:null,contentWrap:null,header:null,content:null,footer:null,preload:null,viewport:null,container:y};x.viewport=c("<div class='grid-viewport'/>");x.header=c("<div class='grid-header'/>");x.content=c("<div class='grid-content'/>");x.footer=c("<div class='grid-footer'/>");x.preload=c("<div class='grid-preload-font'/>");x.headerCol=c("<colgroup></colgroup>");x.headerTable=c("<table class='grid-header-table'></table>");x.headerTbody=c("<tbody></tbody>");x.headerWrap=c("<div class='grid-header-wrap'/>");x.contentCol=c("<colgroup></colgroup>");x.contentTable=c("<table class='grid-content-table'></table>");x.contentTbody=c("<tbody></tbody>");x.contentWrap=c("<div class='grid-content-wrap'/>");x.headerCol.appendTo(x.headerTable);x.headerTbody.appendTo(x.headerTable);x.headerTable.appendTo(x.headerWrap);x.headerWrap.appendTo(x.header);x.contentCol.appendTo(x.contentTable);x.contentTbody.appendTo(x.contentTable);x.contentTable.appendTo(x.contentWrap);x.contentWrap.appendTo(x.content);x.header.appendTo(x.viewport);x.content.appendTo(x.viewport);x.footer.appendTo(x.viewport);x.preload.appendTo(x.viewport);if(s.header.disableTextSelection){x.header.addClass(s.cssClass.disableTextSelection)}if(s.rows.disableTextSelection){x.content.addClass(s.cssClass.disableTextSelection)}return x}function n(z,B){var y="<tr class='"+s.cssClass.headerRow+"'>";for(var x=0,A=z.length-1;x<=A;x++){y+=j(z[x],B,A===x)}if(B.virtualColumnWidth>=0&&s.showLastColumn===true){y+=k(z[x-1],B)}return y+"</tr>"}function g(y,z,A){var x=[s.cssClass.headerCell];if(y.headerCssClass){x.push(y.headerCssClass)}if(A&&z.hideColumnBorder){x.push(s.cssClass.cellColumnLast)}if(y.sortable||y.filterable){x.push(s.cssClass.cursorPointer)}return o.onHeaderColumnCss.notify(x,{column:y,opts:z,isLastColumn:A}).join(" ")}function j(x,y,z){return"<td style='height:"+s.header.height+"px' class='"+g(x,y,z)+"'>"+t(x)+"</td>"}function t(y){var x="<div class='"+s.cssClass.headerCellDiv+"'><span class='"+s.cssClass.headerColumnName+"'>"+(y.headerFormatter?b.Cell.HeaderFormatter[y.headerFormatter](y,s):(y.name||""))+"</span>";if(y.sortable&&y.sortOrder!==0){x+="<span class='"+(y.sortOrder===1?s.cssClass.headerSortUp:s.cssClass.headerSortDown)+"' data-click-type='sort'></span>"}if(y.filterable){x+="<span class='"+s.cssClass.headerFilter+"' data-click-type='menu'></span>"}x+="</div>";if(y.resizeable){x+="<span class='"+s.cssClass.headerResizeHandle+"' data-click-type='resize'></span>"}return x}function k(x,y){return"<td class='"+s.cssClass.headerCell+" "+s.cssClass.cellColumnLast+"' style='height:"+s.header.height+"px'></td>"}function p(z,B){var y="";for(var x=0,A=z.length;x<A;x++){y+=r(z[x])}if(B.virtualColumnWidth>=0&&s.showLastColumn===true){y+=m(z[x-1],B)}return y}function h(y){var x=s.cssClass.col;if(y.headerCssClass){x+=" "+y.headerCssClass}return x}function r(x){return"<col style='width:"+(x.width+s.cellOuterSize.width)+"px;' class='"+h(x)+"'/>"}function m(x,y){return"<col style='width:"+y.virtualColumnWidth+"px;' class='"+s.cssClass.col+" "+s.cssClass.collLast+"'/>"}function w(z,C,B){var y="";for(var x=0,A=C.length-1;x<=A;x++){y+=e(z,C[x],B,A===x)}return y}function i(x,A,z,B){var y=[s.cssClass.row,A.calcIndex&1===1?s.cssClass.rowEven:s.cssClass.rowOdd];if(A.rowCssClass){y.push(A.rowCssClass)}return o.onRowCss.notify(y,{columns:x,row:A,opts:z,isLastRow:B}).join(" ")}function e(z,C,B,D){var y="<tr class='"+i(z,C,B,D)+"'>";for(var x=0,A=z.length-1;x<=A;x++){y+=v(z[x],C,B,A===x,D)}if(B.virtualColumnWidth>=0&&s.showLastColumn===true){y+=f(z[x-1],B,D)}return y+"</tr>"}function q(y,B,z,A,C){var x=[s.cssClass.cell];if(y.cellCssClass){x.push(y.cellCssClass)}if(A&&z.hideColumnBorder){x.push(s.cssClass.cellColumnLast)}if(C&&z.hideRowBorder){x.push(s.cssClass.cellRowLast)}if(B.cellCssClass&&y.field in B.cellCssClass){x.push(B.cellCssClass[y.field])}return o.onCellCss.notify(x,{column:y,row:B,opts:z,isLastColumn:A,isLastRow:C}).join(" ")}function v(x,A,y,z,B){return"<td height='"+A.height+"' class='"+q(x,A,y,z,B)+"'>"+l(x,A)+"</td>"}function f(y,z,A){var x=s.cssClass.cell+" "+s.cssClass.cellColumnLast;if(A&&z.hideRowBorder){x+=" "+s.cssClass.cellRowLast}return"<td class='"+x+"'></td>"}function l(x,z){var y="";if(x.field in z.item&&(z.editMode===false||x.editMode===false)){if(x.formatter){y=b.Cell.Formatter[x.formatter](z.item[x.field],x,z,s)}else{y=z.item[x.field]}}return y}c.extend(this,{buildCellContentHtml:l,buildHeaderCellContentHtml:t,buildColsHtml:p,buildHeaderColumnsHtml:n,buildRowsHtml:w,buildViewPortElements:u,onHeaderColumnCss:b.Callback.Create(),onRowCss:b.Callback.Create(),onCellCss:b.Callback.Create()})}function a(e){if(e instanceof Object===false){throw new TypeError("Settings is not defined")}return new d(e)}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{View:{Create:d,View:a}});function a(o,ar,O,ao){var s=this,Q={width:0,height:0},at={rowsHeight:0,columnsWidth:0},al={},f=[],z=null,E=null,M=null,m={horisontal:false,vertical:false},v=[],h=false,A=0;al=O.buildViewPortElements(o);al.container.empty().addClass(ao.uid);al.viewport.appendTo(al.container);function aj(){var au=j();f.push(b.Handler.Resize.Create(al.header,{handleResize:n,handleResizeStart:e,handleResizeStop:G,handlerIdentifier:"."+ao.cssClass.headerResizeHandle}),b.Handler.Click.Create(al.header,{handleClick:T,handleDblClick:J,handleContextMenu:af}),b.Handler.Click.Create(al.content,{handleClick:C,handleDblClick:ab,handleContextMenu:ap,handleKeyDown:N}),b.Handler.Scroll.Create(al.content,{handleScrollStart:ah,handleScrollStop:an,handleScroll:ag,handleMouseWheelStart:U,handleMouseWheelStop:H,handleMouseWheel:ad}));var av=b.Handler.Shared.GetInstance();av.onClick.subscribe(am);av.onResize.subscribe(u);av.onContextMenu.subscribe(g);ar.onRowsChange.subscribe(y);ar.onColumnsChange.subscribe(k);ar.onInitialize.subscribe(R);l(au);return s}function ac(){j();clearTimeout(E);clearTimeout(M);ar.onRowsChange.unsubscribe(y);ar.onColumnsChange.unsubscribe(k);ar.onInitialize.unsubscribe(R);var ax=b.Handler.Shared.GetInstance();ax.onClick.unsubscribe(am);ax.onResize.unsubscribe(u);ax.onContextMenu.unsubscribe(g);if(al.container.length){for(var aw=0;aw<f.length;aw++){f[aw].destroy();f[aw]=undefined}al.container.removeClass(ao.uid);delete al.container}var av=Object.keys(al);for(var au=0;au<av.length;au++){al[av[au]].remove();delete al[av[au]]}o.empty()}function R(){var au=j();D();I();l(au);s.onInitialize.notify({})}function aq(){return Q}function ak(){return O}function ae(){return m.horisontal}function q(){return m.vertical}function i(au){if(al[au]){return al[au]}}function Y(av){var au=ar.getColumnById(av);if(au){return au.calcWidth-au.width-ao.cellOuterSize.width>=al.content[0].scrollLeft&&au.calcWidth<Q.width+al.content[0].scrollLeft}return false}function Z(au){if(al.headerTbody[0].rows[0]){return al.headerTbody[0].rows[0].cells[au]}}function t(av){var au=ar.getColumnIndexById(av);if(au!==-1){return Z(au)}}function aa(au){var av=ar.getRowById(au);if(av){return av.calcHeight-av.height-ao.cellOuterSize.height>=al.content[0].scrollTop&&av.calcHeight+av.height+ao.cellOuterSize.height<Q.height+al.content[0].scrollTop}return false}function S(au){return al.contentTbody[0].rows[au]}function P(au){var av=ar.getRowIndexById(au);if(av!==-1){return S(av)}}function W(au,av){return Y(au)&&aa(av)}function B(au,av){if(al.contentTbody[0].rows[av]&&al.contentTbody[0].rows[av].cells[au]){return al.contentTbody[0].rows[av].cells[au]}}function p(av,aw){var ax=ar.getRowIndexById(aw);var au=ar.getColumnIndexById(av);if(ax!==-1&&au!==-1){return B(au,ax)}}function V(){A++;K();return s}function K(){if(A>0){if(z!==null||w()===true){clearTimeout(E);E=setTimeout(V,187)}else{z++;clearTimeout(E);I();if(ao.renderDelay){M=setTimeout(function(){z=null},ao.renderDelay)}else{z=null}}}return s}function I(){var ay=j();A=0;var aw=1;if(at.rowsHeight>=ao.maxSupportedCssHeight){var az=Q.height+(m.horisontal?ao.scrollbarDimensions.height:0);aw=(at.rowsHeight-az)/(ao.maxSupportedCssHeight-az)}var au=ar.requestDataFromRange({top:al.content[0].scrollTop*aw,left:al.content[0].scrollLeft},Q,ao.cellOuterSize,{width:m.vertical?ao.scrollbarDimensions.width:0,height:m.horisontal?ao.scrollbarDimensions.height:0},aw===1);if(au.isCached===0){if(au.columns.length>0){al.headerTable.css({left:au.columns[0].calcWidth-au.columns[0].width-ao.cellOuterSize.width});if(au.rows.length>0){al.contentTable.css({top:au.rows[0].calcHeight-au.rows[0].height-ao.cellOuterSize.height-al.content[0].scrollTop*aw+al.content[0].scrollTop,left:au.columns[0].calcWidth-au.columns[0].width-ao.cellOuterSize.width})}var av=au.columns[au.columns.length-1];var ax={hideRowBorder:m.horisontal===false&&m.vertical===true,hideColumnBorder:m.vertical===false&&Q.width<=av.calcWidth,virtualColumnWidth:ao.showLastColumn===true&&Q.width>=av.calcWidth?Q.width-av.calcWidth:0};F(O.buildHeaderColumnsHtml(au.columns,ax),O.buildColsHtml(au.columns,ax),O.buildRowsHtml(au.columns,au.rows,ax))}else{F("","","")}}l(ay)}function F(aw,av,aA){s.onBeforeRowsRendered.notify({});var az=al.contentTbody[0].cloneNode(false);var au=al.headerTbody[0].cloneNode(false);var ay=al.headerCol[0].cloneNode(false);var ax=al.contentCol[0].cloneNode(false);ay.innerHTML=ax.innerHTML=av;az.innerHTML=aA;au.innerHTML=aw;if(al.contentCol[0].innerHTML!==ax.innerHTML){al.contentTable[0].replaceChild(ax,al.contentCol[0]);al.contentCol=c(ax)}if(al.contentTbody[0].innerHTML!==az.innerHTML){al.contentTable[0].replaceChild(az,al.contentTbody[0]);al.contentTbody=c(az)}if(al.headerCol[0].innerHTML!==ay.innerHTML){al.headerTable[0].replaceChild(ay,al.headerCol[0]);al.headerCol=c(ay)}if(al.headerTbody[0].innerHTML!==au.innerHTML){al.headerTable[0].replaceChild(au,al.headerTbody[0]);al.headerTbody=c(au)}s.onAfterRowsRendered.notify({})}function w(){return v.length>0}function j(av){var au=b.Utils.createGuid();v.push(au);if(av){av();return l(au)}return au}function l(av){for(var au=0;au<v.length;au++){if(v[au]===av){v.splice(au,1);return true}}return false}function X(au){var av=ar.getColumnByIndex(au.cellIndex);if(av){au.type=c(au.event.target).attr("data-click-type")||"";au.column=av;return au}}function ai(au){var av=ar.getColumnByIndex(au.cellIndex);var aw=ar.getRowByIndex(au.rowIndex);if(av&&av.field.length>0&&aw&&av.field in aw.item){au.row=aw;au.column=av;return au}}function r(au,av){s[av].notify(au)}function D(){Q.width=al.container.width();Q.height=Math.max(al.container.height()-ao.header.height-ao.cellOuterSize.height,0);if(Q.height){al.content.height(Q.height)}at.rowsHeight=ar.getRowsHeight(ao.cellOuterSize);at.columnsWidth=ar.getColumnsWidth(ao.cellOuterSize);x(true);s.onViewResized.notify({});return s}function L(av,ax,aw){var au={vertical:false,horisontal:false};if(av.columnsWidth>ax.width){au.vertical=av.rowsHeight+aw.height>ax.height;au.horisontal=true}else{if(av.rowsHeight>ax.height){au.horisontal=av.columnsWidth+aw.width>ax.width;au.vertical=true}}return au}function x(ax){var av=m;m=L(at,Q,ao.scrollbarDimensions);if(m.vertical!==av.vertical||m.horisontal!==av.horisontal||ax){al.content.css({overflow:m.vertical||m.horisontal?"auto":"hidden"});al.header.css({width:m.vertical?Q.width-ao.scrollbarDimensions.width:Q.width});s.onViewScrollChange.notify({})}var aw=Math.max(at.columnsWidth,m.vertical?Q.width-ao.scrollbarDimensions.width:Q.width);var au=at.columnsWidth?Math.min(at.rowsHeight,ao.maxSupportedCssHeight):0;al.headerWrap.css({width:aw});al.contentWrap.css({width:aw,height:au})}function y(){at.rowsHeight=ar.getRowsHeight(ao.cellOuterSize);x();V()}function k(){at.columnsWidth=ar.getColumnsWidth(ao.cellOuterSize);x();V()}function C(au){var av=ai(au);if(av){r(av,"onCellClick")}}function ab(au){var av=ai(au);if(av){r(av,"onCellDblClick")}}function ap(au){var av=ai(au);if(av){r(av,"onCellContextMenu")}}function N(au){var av=ai(au);if(av){r(av,"onCellKeyDown")}}function n(au){r(au,"onColumnResize")}function e(au){h=true;r(au,"onColumnResizeStart")}function G(au){h=false;r(au,"onColumnResizeStop")}function U(au){r(au,"onMouseWheelStart")}function H(au){r(au,"onMouseWheelStop")}function ad(au){r(au,"onMouseWheel")}function ah(au){if(h===false){r(au,"onScrollStart")}}function an(au){if(h===false){r(au,"onScrollStop")}}function ag(au){if(h===false){al.header[0].scrollLeft=al.content[0].scrollLeft;V();r(au,"onScroll")}}function u(au){j(function(){r(au,"onDocumentResize");D();I()})}function g(au){r(au,"onDocumentContextMenu")}function am(au){r(au,"onDocumentClick")}function T(au){var av=X(au);if(av){r(av,"onHeaderClick")}}function af(au){var av=X(au);if(av){r(av,"onHeaderContextMenu")}}function J(au){var av=X(au);if(av){r(av,"onHeaderDblClick")}}c.extend(this,{init:aj,destroy:ac,getBuilder:ak,getContentSize:aq,getCellNodeById:p,getCellNodeByIndex:B,getNode:i,getRowNodeById:P,getRowNodeByIndex:S,getColumnNodeById:t,getColumnNodeByIndex:Z,isCellVisible:W,isColumnVisible:Y,isHorisontalScrollVisible:ae,isRowVisible:aa,isSuspended:w,isVerticalScrollVisible:q,render:V,resize:D,resumeRender:l,suspendRender:j,onViewResized:b.Event.Create(),onViewScrollChange:b.Event.Create(),onScroll:b.Event.Create(),onScrollStart:b.Event.Create(),onScrollStop:b.Event.Create(),onMouseWheel:b.Event.Create(),onMouseWheelStart:b.Event.Create(),onMouseWheelStop:b.Event.Create(),onDocumentClick:b.Event.Create(),onDocumentResize:b.Event.Create(),onDocumentContextMenu:b.Event.Create(),onHeaderClick:b.Event.Create(),onHeaderContextMenu:b.Event.Create(),onHeaderDblClick:b.Event.Create(),onCellClick:b.Event.Create(),onCellContextMenu:b.Event.Create(),onCellDblClick:b.Event.Create(),onCellKeyDown:b.Event.Create(),onColumnResize:b.Event.Create(),onColumnResizeStart:b.Event.Create(),onColumnResizeStop:b.Event.Create(),onAfterRowsRendered:b.Event.Create(),onBeforeRowsRendered:b.Event.Create(),onInitialize:b.Callback.Create(),onDestroy:b.Callback.Create()})}function d(f,h,j,i){var k=c(f);if(!k.length){throw new TypeError("Container is not defined or does not exist in the DOM.")}if(k.length!==1){throw new TypeError("There should be only 1 container.")}if(h instanceof b.View.Model.Model===false){throw new TypeError("View model is not defined.")}if(j instanceof Object===false){throw new TypeError("Settings is not defined")}var g=b.View.Builder.Create(j);var e=new a(k,h,g,j);if(i!==false){e.init()}return e}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(c,b){c.extend(true,b,{View:{Model:{Model:a,Create:d}}});function a(H,h,x,L,S){var k=this,l={count:0,height:0},C={count:0,width:0};var U=[],m=[];var y={minTop:undefined,maxTop:undefined,minLeft:undefined,maxLeft:undefined};var D=[],i=[],T=[];function Q(){H.onChange.subscribe(r);h.onChange.subscribe(j);k.onInitialize.notify({});return k}function N(){H.onChange.unsubscribe(r);h.onChange.unsubscribe(j);D=[];i=[];T=[];U=undefined;m=undefined}function j(W){B();if(W.data){var Y=[];for(var X=0;X<W.data.length;X++){if(W.data[X].id){Y.push(W.data[X].id)}}k.onColumnsChange.notify({ids:Y})}else{if(W.id){k.onColumnsChange.notify({ids:[W.id]})}}}function r(W){T=i.slice();V();if(W.data){var Y=[];for(var X=0;X<W.data.length;X++){if(W.data[X].id){Y.push(W.data[X].id)}}k.onRowsChange.notify({ids:Y})}else{if(W.id){k.onRowsChange.notify({ids:[W.id]})}}}function u(){return U}function G(){return m}function R(W){return U[W]}function F(W){return m[W]}function M(X){for(var W=0;W<U.length;W++){if(U[W].id===X){return W}}return -1}function K(X){for(var W=0;W<m.length;W++){if(m[W].id===X){return W}}return -1}function E(X){for(var W=0;W<U.length;W++){if(U[W].id===X){return U[W]}}}function A(X){for(var W=0;W<m.length;W++){if(m[W].id===X){return m[W]}}}function q(){return l}function s(){return C}function O(){return D}function t(X){if(X instanceof b.Query.Filter){for(var W=0;W<D.length;W++){if(D[W].getId()===X.getId()){break}}D[W]=X;V();k.onRowsChange.notify()}}function w(X){for(var W=0;W<D.length;W++){if(D[W].getField()===X){D.splice(W,1);V();k.onRowsChange.notify();break}}}function p(X){for(var W=0;W<D.length;W++){if(D[W].getId()===X){D.splice(W,1);V();k.onRowsChange.notify();break}}}function f(){D=[];V();k.onRowsChange.notify()}function o(){return i}function P(W){if(W instanceof b.Query.Sorter){i=[W];T=i.slice();V();k.onRowsChange.notify()}}function e(X){for(var W=0;W<i.length;W++){if(i[W].getId()===X){i.splice(W,1);T=i.slice();V();k.onRowsChange.notify();break}}}function v(X){for(var W=0;W<i.length;W++){if(i[W].getField()===X){i.splice(W,1);T=i.slice();V();k.onRowsChange.notify();break}}}function z(){i=[];T=[];V();k.onRowsChange.notify()}function g(W){return x.getRowsCallback(W,D)}function J(W){l=x.getRowsTotal(W.height,D);return l.height}function I(W){C=L.getColumnsTotal(W.width);return C.width}function n(W,Z,X,ab,aa){var Y=(y.minTop<=W.top&&W.top<=y.maxTop+ab.height)&aa;var ac=(y.minLeft<=W.left&&W.left<=y.maxLeft+ab.width)&aa;if(Y===0){U=x.getRowsInRange(W.top,Z.height,X.height,T,D);T=[];V(U,Z,X);k.onCacheRowsChange.notify({})}if(ac===0){m=L.getColumnsInRange(W.left,Z.width,X.width);B(m,Z,X);k.onCacheColumnsChange.notify({})}return{isCached:Y&&ac,rows:U,columns:m}}function B(Y,X,W){if(Y&&Y.length){y.minLeft=Y[0].calcWidth-Y[0].width-W.width;y.maxLeft=Y[(Y.length-1)].calcWidth>X.width?Y[(Y.length-1)].calcWidth-X.width:X.width}else{y.minLeft=undefined;y.maxLeft=undefined}}function V(Y,X,W){if(Y&&Y.length){y.minTop=Y[0].calcHeight-Y[0].height-W.height;y.maxTop=Y[(Y.length-1)].calcHeight>X.height?Y[(Y.length-1)].calcHeight-X.height:X.height}else{y.minTop=undefined;y.maxTop=undefined}}c.extend(this,{init:Q,destroy:N,getRowsTotal:q,getColumnsTotal:s,requestRowsCallback:g,requestDataFromRange:n,clearFilterByField:w,clearFilterById:p,clearFilters:f,clearSorterByField:v,clearSorterById:e,clearSorters:z,getFilters:O,getSorters:o,setFilter:t,setSorter:P,getColumnById:A,getColumnByIndex:F,getColumnIndexById:K,getColumns:G,getColumnsWidth:I,getRowById:E,getRowByIndex:R,getRowIndexById:M,getRows:u,getRowsHeight:J,onInitialize:b.Callback.Create(),onDestroy:b.Callback.Create(),onColumnsChange:b.Callback.Create(),onRowsChange:b.Callback.Create(),onCacheColumnsChange:b.Callback.Create(),onCacheRowsChange:b.Callback.Create()})}function d(f,j,i,h){if(i instanceof Object===false){throw new TypeError("Settings is not defined")}if(f instanceof b.Row.Model===false){throw new TypeError("Rows model is not defined.")}if(j instanceof b.Column.Model===false){throw new TypeError("Column model is not defined.")}var k=new b.Query.Row.Create(f);var e=new b.Query.Column.Create(j);var g=new a(f,j,k,e,i);if(h!==false){g.init()}return g}})(jQuery,window.SmallGrid=window.SmallGrid||{});(function(d,c){d.extend(true,c,{View:{Window:{Create:a,Manager:b}}});function b(n,h){var t=this;var e=[];function s(x,w,u){if(g(x)===false){e.push({id:x,opts:u||{}});var v=d('<div class="grid-window grid-window-'+x+'"/>');if(w&&w.length){w.appendTo(v)}v.appendTo(n.getNode("container")).hide()}return t}function g(v){for(var u=0;u<e.length;u++){if(e[u].id===v){return true}}return false}function f(v){for(var u=0;u<e.length;u++){if(e[u].id===v){return{id:e[u].id,opts:e[u].opts,container:n.getNode("container").children(".grid-window-"+v)}}}return t}function k(w){for(var u=0;u<e.length;u++){if(e[u].id===w){e.splice(u,1);var v=n.getNode("container").children(".grid-window-"+w);if(v.length){v.remove()}break}}return t}function m(B,u,y){var w=y||0;var x=f(B);if(x!==null){x.container.show();var A=n.getNode("container");var v={width:x.container.width(),height:x.container.height()};var z=(v.width+u.x>A.width()&&v.width<u.x-A.offset().left)?u.x-v.width+w:u.x-w;x.container.offset({top:u.y-w,left:z})}return t}function r(A,u){var x=f(A);if(x!==null){x.container.show();var z=n.getNode("container");var v={width:x.container.width(),height:x.container.height()};var w={left:u.offset().left,top:u.offset().top,width:u.width(),height:u.height()};var y=(v.width+w.left>z.width()&&v.width<w.left-z.offset().left)?w.left+w.width-v.width:w.left;x.container.offset({top:w.top+w.height,left:y})}return t}function i(u){return n.getNode("container").children(".grid-window-"+u+":visible").length>0}function l(u){n.getNode("container").children(".grid-window-"+u).show();return t}function p(u){n.getNode("container").children(".grid-window-"+u).hide();return t}function j(){n.getNode("container").children(".grid-window").hide();return t}function q(){n.onDocumentClick.subscribe(j);n.onColumnResizeStart.subscribe(j);return t}function o(){n.onDocumentClick.unsubscribe(j);n.onColumnResizeStart.unsubscribe(j);e=[]}d.extend(this,{init:q,destroy:o,createWindow:s,showWindowNearPosition:m,showWindowNearTarget:r,getWindow:f,hideWindow:p,hideWindows:j,isWindow:g,isVisible:i,removeWindow:k,showWindow:l})}function a(f,h,g){if(f instanceof c.View.View===false){throw new TypeError("View is not defined")}if(h instanceof Object===false){throw new TypeError("Settings is not defined")}var e=new c.View.Window.Manager(f,h);if(g!==false){e.init()}return e}})(jQuery,window.SmallGrid=window.SmallGrid||{});if(typeof jQuery==="undefined"){throw new Error("Small grid requires jquery module to be loaded.")}if(typeof SmallGrid==="undefined"){throw new Error("Small grid required to be loaded.")}(function(c,b){var a={renderDelay:0,showLastColumn:true,uidPrefix:"smallgrid_",maxSupportedCssHeight:undefined,scrollbarDimensions:undefined,cellOuterSize:undefined,uid:undefined,cssClass:{disableTextSelection:"disable-text-selection",disabledColor:"disabled-color",cell:"grid-cell",cellEdit:"grid-cell-edit",cellColumnLast:"grid-cell-column-last",cellRowLast:"grid-cell-row-last",col:"grid-col",collLast:"grid-coll-last",cursorPointer:"grid-cursor-pointer",cursorResize:"grid-cursor-resize disable-text-selection",headerCell:"grid-header-cell",headerCellDiv:"grid-header-cell-div",headerColumnName:"grid-column-name",headerFilter:"grid-header-filter",headerFilterActive:"grid-header-filter-active",headerResizeHandle:"grid-resizable-handle",headerRow:"grid-header-row",headerSortable:"grid-sortable",headerSortDown:"grid-sort-icon grid-sort-icon-desc",headerSortUp:"grid-sort-icon grid-sort-icon-asc",row:"grid-row",rowEven:"grid-row-even",rowOdd:"grid-row-odd",rowSelected:"grid-row-selected",rowValignMiddle:"grid-row-valign-middle",rowValignTop:"grid-row-valign-top",rowValignBottom:"grid-row-valign-bottom",rowValignBaseline:"grid-row-valign-baseline",cellAlignCenter:"grid-cell-align-center",cellAlignRight:"grid-cell-align-right"},header:{height:20,disableTextSelection:true},columns:{idProperty:undefined,newIdType:""},rows:{disableTextSelection:false,idProperty:undefined,newIdType:"",valign:""},formatter:{floatFormatter:{decimals:2},integerFormatter:{decimals:0},moneyFormatter:{locales:"en-US",options:{currency:"EUR",style:"currency"}},dateFormatter:{locales:"en-GB",options:{}}},plugins:{AutoResize:{enabled:true},ColumnSort:{enabled:true},ColumnResize:{enabled:true},RowSelection:{enabled:true,multipleRowSelection:false},CellEdit:{enabled:true,editOnClick:false,autoFocus:true},ColumnCheckbox:{enabled:true},ColumnFilterMenu:{enabled:true},ColumnPickerMenu:{enabled:true},Footer:{enabled:false},CellAlign:{enabled:false}}};function d(f){var e=c.extend(true,{},a,f||{});if(e.maxSupportedCssHeight===undefined){a.maxSupportedCssHeight=e.maxSupportedCssHeight=b.Utils.measureMaxSupportedCssHeight()}if(e.scrollbarDimensions===undefined){a.scrollbarDimensions=e.scrollbarDimensions=b.Utils.measureScrollbar()}if(e.cellOuterSize===undefined){e.cellOuterSize=b.Utils.measureCellDiff(e.cssClass.cell)}if(e.uid===undefined){e.uid=b.Utils.createGuid()}return e}c.extend(true,b,{Settings:{Create:d,Default:a}})})(jQuery,window.SmallGrid=window.SmallGrid||{});