/** * KingTable 2.0.0 * https://github.com/RobertoPrevato/KingTable * * Copyright 2018, Roberto Prevato * https://robertoprevato.github.io * * Licensed under the MIT license: * http://www.opensource.org/licenses/MIT */ !function e(t,n,r){function i(s,o){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(e){var n=t[s][1][e];return i(n||e)},f,f.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s6)return!1;return a(t[0])}return!1}Object.defineProperty(n,"__esModule",{value:!0});var o=e("../../scripts/utils"),u=r(o),l=e("../../scripts/components/string"),f=r(l),c=e("../../scripts/components/regex"),d=r(c),p=e("../../scripts/components/reflection"),h=r(p),m=e("../../scripts/exceptions"),g={autoParseNumbers:!0,ci:!0};n.default={normalizeOrder:i,lookSortableAsNumber:s,options:g,parseSortBy:function(e){if(e){var t=e.split(/\s*,\s*/g);return u.default.map(t,function(e){var t=e.split(/\s/),n=t[0],r=t[1]||"asc";return[n,f.default.startsWith(r,"asc",!0)?1:-1]})}},humanSortBy:function(e,t){return e&&e.length?u.default.map(e,function(e){var n=e[0];return 1===e[1]?t?n+" asc":n:n+" desc"}).join(", "):""},getSortCriteria:function(e){var t,n=this,r=e.length;if(1==e.length){var i=e[0];if(u.default.isString(i)&&i.search(/,|\s/)>-1)return this.parseSortBy(i)}if(r>1){var a=u.default.toArray(e);t=u.default.map(a,function(e){return n.normalizeSortByValue(e,!0)})}else t=this.normalizeSortByValue(e[0]);return t},normalizeSortByValue:function(e,t){var n=this;if(u.default.isString(e))return t?[e,"asc"]:[[e,"asc"]];if(u.default.isArray(e))return u.default.isArray(e[0])?e:u.default.map(e,function(e){return n.normalizeSortByValue(e,!0)});if(u.default.isPlainObject(e)){var r,i=[];for(r in e)i.push([r,e[r]]);return i}(0,m.TypeException)("sort","string | [] | {}")},compareStrings:function(e,t,n){if(this.options.autoParseNumbers){var r=s(e),i=s(t);if(!1!==r||!1!==i){if(r===i)return 0;if(!1!==r&&!1===t)return n;if(!1===r&&!1!==t)return-n;if(ri)return n}}return f.default.compare(e,t,n,this.options)},sortBy:function(e){u.default.isArray(e)||(0,m.TypeException)("ar","array");var t=arguments.length,n=u.default.toArray(arguments).slice(1,t),r=this.getSortCriteria(n);r=i(r);var a=r.length,s=u.default.isString,o=this.compareStrings.bind(this),l=void 0,f=null;return e.sort(function(e,t){if(e===t)return 0;if(e!==l&&t===l)return-1;if(e===l&&t!==l)return 1;if(e!==f&&t===f)return-1;if(e===f&&t!==f)return 1;for(var n=0;np)return c}}return 0}),e},sortByProperty:function(e,t,n){u.default.isArray(e)||(0,m.TypeException)("arr","array"),u.default.isString(t)||(0,m.TypeException)("property","string"),u.default.isUnd(n)||(n="asc"),n=u.default.isNumber(n)?n:/^asc/i.test(n)?1:-1;var r={};return r[t]=n,this.sortBy(e,r)},searchByStringProperty:function(e){return u.default.require(e,["pattern","collection","property"]),this.searchByStringProperties(u.default.extend(e,{properties:[e.property]}))},search:function(e){if(!e||!e.length)return e;var t=arguments.length;if(t<2)return e;for(var n,r,i=u.default.toArray(arguments).slice(1,t),a=[],s=u.default.isString,o=0,t=e.length;ot[R])return-M;if(e[R]f)return M;if(i[L][I](l)o[L][I](f))return M;var c=e[y],d=t[y];if(c[N](i[H])&&d[N](o[H])){if(c[i[H]][D]()[F]()d[o[H]][D]()[F]())return M}if(i[A]>o[A])return-M;if(i[A]t.length;)n=n.substr(1,n.length);return n}},month:{rx:/M{1,4}/,fn:function(e,t,n,i){var a=(e.getMonth()+1).toString();switch(t.length){case 1:return a;case 2:return r(a,2);case 3:return a=e.getMonth(),i.monthShort[a];case 4:return a=e.getMonth(),i.month[a]}}},day:{rx:/D{1,4}/,fn:function(e,t,n,i){var a=e.getDate().toString();switch(t.length){case 1:return a;case 2:return r(a.toString(),2);case 3:return a=e.getDay(),i.weekShort[a];case 4:return a=e.getDay(),i.week[a]}}},hour:{rx:/h{1,2}/i,fn:function(e,t,n){var r=e.getHours(),i=/t{1,2}/i.test(n);for(i&&r>12&&(r%=12),r=r.toString();r.lengthn?r.substr(0,n):r}},hoursoffset:{rx:/z{1,3}/i,fn:function(e,t,n){var i=-e.getTimezoneOffset()/60,a=i>0?"+":"";switch(t.length){case 1:return a+i;case 2:return a+r(i,2);case 3:return a+r(i,2)+":00"}}},ampm:{rx:/t{1,2}/i,fn:function(e,t){var n,r=e.getHours(),i=/T{1,2}/.test(t);switch(t.length){case 1:n=r>12?"p":"a";break;case 2:n=r>12?"pm":"am"}return i?n.toUpperCase():n}},weekday:{rx:/w{1,2}/i,fn:function(e,t,n,r){var i=e.getDay(),a=t.length>1?"week":"weekShort",s=r[a];return s&&void 0!==s[i]?s[i]:i}}},u=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z?$|^\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}:\d{2}(?:\sUTC)?$/,l=/^(\d{4})\D(\d{1,2})\D(\d{1,2})(?:\s(\d{1,2})(?:\D(\d{1,2}))?(?:\D(\d{1,2}))?)?$/;n.default={looksLikeDate:function(e){return!!e&&(e instanceof Date||"string"==typeof e&&(!!l.exec(e)||!!u.exec(e)))},defaults:{format:{short:"DD.MM.YYYY",long:"DD.MM.YYYY HH:mm:ss"},week:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},parse:function(e){a.default.isString(e)||(0,s.TypeException)("s","string");var t=l.exec(e);if(t){var n=t[4];if(n){return new Date(parseInt(t[1]),parseInt(t[2])-1,parseInt(t[3]),parseInt(n),parseInt(t[5]||0),parseInt(t[6]||0))}return new Date(t[1],t[2]-1,t[3])}if(u.exec(e))return/Z$/.test(e)||-1!=e.indexOf("UTC")||(e+="Z"),new Date(e)},format:function(e,t,n){t||(t=this.defaults.format.short),n||(n=this.defaults);var r=t;for(var i in o){var a=o[i],s=t.match(a.rx);s&&(r=r.replace(a.rx,a.fn(e,s[0],t,n)))}return r},formatWithTime:function(e,t){return this.format(e,this.defaults.format.long,t)},isValid:function(e){return e instanceof Date&&isFinite(e)},sameDay:function(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()},isToday:function(e){return this.sameDay(e,new Date)},hasTime:function(e){var t=e.getHours(),n=e.getMinutes(),r=e.getSeconds();return!!(t||n||r)},toIso8601:function(e){return this.format(e,"YYYY-MM-DD")+"T"+this.format(e,"hh:mm:ss")+"."+this.format(e,"fff")+"Z"},toExcelDateValue:function(e){return(25569+(e.getTime()-60*e.getTimezoneOffset()*1e3)/864e5).toString().substr(0,5)}}},{"../../scripts/exceptions":20,"../../scripts/utils.js":34}],3:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;na));s++)e=this.replaceAt(e,i.i-n,i.v);return e},snakeCase:function(e){return e?this.removeMultipleSpaces(e.trim())[c](/[^a-zA-Z0-9]/g,"_")[c](/([a-z])[\s\-]?([A-Z])/g,function(e,t,n){return t+"_"+i(n)})[c](/([A-Z]+)/g,function(e,t){return i(t)})[c](/_{2,}/g,"_"):e},kebabCase:function(e){return e?this.removeMultipleSpaces(e.trim())[c](/[^a-zA-Z0-9]/g,"-")[c](/([a-z])[\s\-]?([A-Z])/g,function(e,t,n){return t+"-"+i(n)})[c](/([A-Z]+)/g,function(e,t){return i(t)})[c](/-{2,}/g,"-"):""},camelCase:function(e){return e?this.removeMultipleSpaces(e.trim())[c](/[^a-zA-Z0-9]+([a-zA-Z])?/g,function(e,t){return a(t)})[c](/([a-z])[\s\-]?([A-Z])/g,function(e,t,n){return t+a(n)})[c](/^([A-Z]+)/g,function(e,t){return i(t)}):e},format:function(e){var t=Array.prototype.slice.call(arguments,1);return e[c](/{(\d+)}/g,function(e,n){return void 0!==t[n]?t[n]:e})},getString:function(e){return"string"==typeof e?e:e.toString?e.toString():""},compare:function(e,t,n,r){n=u.default.isNumber(n)?n:/^asc/i.test(n)?1:-1;var i=u.default.extend({ci:!0},r);return e&&!t?n:!e&&t?-n:e||t?e==t?0:(u.default.isString(e)||(e=e.toString()),u.default.isString(t)||(t=t.toString()),i.ci&&(e=e.toLowerCase(),t=t.toLowerCase()),(0,f.default)(e)<(0,f.default)(t)?-n:n):0},ofLength:function(e,t){return new Array(t+1).join(e)},center:function(e,t,n){if(t<=0)throw new Error("length must be > 0");if(n||(n=" "),!e)return this.ofLength(n,t);if(1!=n.length)throw new Error(d);for(var r=Math.floor((t-e.length)/2),i=this.ofLength(n,r),a=!1,s=i+e+i;s.length 0");if(n||(n=" "),!e)return this.ofLength(n,t);if(1!=n.length)throw new Error(d);for(;e.length 0");if(n||(n=" "),!e)return this.ofLength(n,t);if(1!=n.length)throw new Error(d);for(;e.length-1&&e!=l?l:e}Object.defineProperty(n,"__esModule",{value:!0});var a=e("../../scripts/utils"),s=r(a),o=e("../../scripts/data/json"),u=r(o),l="application/json",f={type:"POST",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":l},json:{parseDates:!0}};n.default={defaults:f,requestBeforeSend:function(e,t,n){},setup:function(e){if(!s.default.isPlainObject(e))throw new Error("Invalid options for AJAX setup.");return s.default.extend(this.defaults,e),this},converters:{"application/json":function(e,t,n){return u.default.parse(e,n.json)}},createQs:function(e){if(!e)return"";var t,n,r=[];for(t in e)n=e[t],s.default.isNullOrEmptyString(n)||r.push([t,n]);return r.sort(function(e,t){return e>t?1:e-1))throw"application/x-www-form-urlencoded; charset=UTF-8"==g?"Not implemented":"invalid or not implemented content type: "+g;m=u.default.compose(m),r.requestBeforeSend(d,t,e),d.send(m)}else r.requestBeforeSend(d,t,e),d.send()})},get:function(e,t){return t=t||{},t.url=e,t.type="GET",this.shot(t)},post:function(e,t){return t=t||{},t.url=e,t.type="POST",this.shot(t)}}},{"../../scripts/data/json":13,"../../scripts/utils":34}],10:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("../../scripts/utils"),i=function(e){return e&&e.__esModule?e:{default:e}}(r),a={allStrings:1,keepType:2};n.default={default:{addBom:!0,separator:",",addSeparatorLine:!1,typeHandling:a.keepType},serialize:function(e,t){for(var n=i.default.extend({},this.default,t),r=[],s=n.separator,o=n.typeHandling,u=n.addBom?"\ufeff":"",l=0,f=e.length;l-1)&&(m='"'+m+'"'),c.push(m)}r.push(c.join(s))}return n.addSeparatorLine&&r.push("\t"+s),u+r.join("\n")}}},{"../../scripts/utils":34}],11:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default={supportsCsExport:function(){return navigator.msSaveBlob||function(){return void 0!==document.createElement("a").download}()},exportfile:function(e,t,n){var r=new Blob([t],{type:n});if(navigator.msSaveBlob)navigator.msSaveBlob(r,e);else{var i=document.createElement("a");if(void 0!==i.download){var a=URL.createObjectURL(r);i.setAttribute("href",a),i.setAttribute("download",e);var s={visibility:"hidden",position:"absolute",left:"-9999px"};for(var o in s)i.style[o]=s[o];document.body.appendChild(i),i.click(),document.body.removeChild(i)}}}}},{}],12:[function(e,t,n){"use strict";function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){return"number"==typeof e}function o(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}Object.defineProperty(n,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0?new Array(e*n+1).join(t||" "):"",f="<"+o;for(r in u)void 0!==u[r]&&(c.indexOf(r)>-1?f+=" "+r:f+=" "+r+'="'+u[r]+'"');if(a)return f+=" />",e>0&&(f=l+f+"\n"),f;f+=">";var d=i.children;e>0&&d.length&&(f+="\n");for(var p=0,h=d.length;p":f+="",e>0&&(f=l+f+"\n"),f}},{key:"tagName",get:function(){return this._tagName},set:function(e){if("string"!=typeof e)throw new Error("tagName must be a string");if(!e.trim())throw new Error("tagName must have a length");if(e.indexOf(" ")>-1)throw new Error("tagName cannot contain spaces");this._tagName=e}}]),e}(),f="area base basefont br col frame hr img input isindex link meta param".split(" "),c="checked selected disabled readonly multiple ismap isMap defer noresize noResize nowrap noWrap noshade noShade compact".split(" "),d=function(e){function t(e,n,i){a(this,t);var s=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));return s.empty=f.indexOf(e.toLowerCase())>-1,s}return i(t,e),u(t,[{key:"id",get:function(){return this.attributes.id},set:function(e){this.attributes.id=e}}]),t}(l),p=function(){function e(t){a(this,e),this.text=t}return u(e,[{key:"toString",value:function(e,t,n){var e=s(e)?e:0,n=s(n)?n:0,r=e>0?new Array(e*n+1).join(t||" "):"";return r+this.text+(r?"\n":"")}},{key:"text",get:function(){return this._text},set:function(e){e||(e=""),"string"!=typeof e&&(e=e.toString()),this._text=o(e)}}]),e}(),h=function(){function e(t){a(this,e),this.html=t}return u(e,[{key:"toString",value:function(e,t,n){var e=s(e)?e:0,n=s(n)?n:0,r=e>0?new Array(e*n+1).join(t||" "):"";return r+this.html+(r?"\n":"")}}]),e}(),m=function(){function e(t){a(this,e),this.text=t}return u(e,[{key:"toString",value:function(e,t,n){var e=s(e)?e:0,n=s(n)?n:0,r=e>0?new Array(e*n+1).join(t||" "):"";return r+"\x3c!--"+this.text+"--\x3e"+(r?"\n":"")}},{key:"text",get:function(){return this._text},set:function(e){e||(e=""),"string"!=typeof e&&(e=e.toString()),e=e.replace(//g,""),this._text=e}}]),e}(),g=function(){function e(t){a(this,e),this.children=t,this.hidden=!1}return u(e,[{key:"toString",value:function(e,t,n){var r="",i=this.children;if(!i||this.hidden)return r;for(var a=0,s=i.length;a0&&(new Date).getTime()>m?c.push(p):t(h)&&(f=r?p:h)}}return c.length&&this.remove(e,function(e){return c.indexOf(e)>-1}),f}},remove:function(e,t,n){var r=i(n);if(!t)return void r.removeItem(e);var a,s=r.getItem(e);if(s){try{s=u.default.parse(s)}catch(t){return void r.removeItem(e)}var o=s.length,l=[];for(a=0;a0?l+r:-1,c={ts:l,expiration:f,data:t},d=o.getItem(e);if(d){try{d=u.default.parse(d)}catch(r){return o.removeItem(e),this.set(e,t,n)}d.length>=n&&d.shift(),d.push(c)}else d=[{ts:l,expiration:f,data:t}];return o.setItem(e,u.default.compose(d))}}},{"../../scripts/data/json":13,"../../scripts/exceptions":20,"../../scripts/utils":34}],15:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={};n.default={items:function(){return r},length:function(){var e,t=0;for(e in r)t++;return t},getItem:function(e){return r[e]},setItem:function(e,t){r[e]=t},removeItem:function(e){delete r[e]},clear:function(){var e;for(e in r)delete r[e]}}},{}],16:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n/g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"escape",value:function(e){return e?this.escapeHtml(e):""}}]),e}();n.default=o},{"../../scripts/utils":34}],18:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=e("../../scripts/utils");!function(e){e&&e.__esModule}(r);n.default={normal:function(e){return''+e.replace(/\sxmlns="http:\/\/www\.w3\.org\/\d+\/xhtml"/,"")},pretty:function(e,t){e=this.normal(e),"number"!=typeof t&&(t=2);var n=/(>)(<)(\/*)/g,r=[];e=e.replace(n,"$1\r\n$2$3");for(var i=0,a=e.split("\r\n"),s=a.length,o=0;o]*>$/)?l=0:u.match(/^<\/\w/)?0!=i&&(i-=1):l=u.match(/^<\w[^>]*[^\/]>.*$/)?1:0;var f=new Array(i*t).join(" ");r.push(f+u+"\r\n"),i+=l}return r.join("")}}},{"../../scripts/utils":34}],19:[function(e,t,n){"use strict";function r(e,t,n){if(t.search(/\s/)>-1){t=t.split(/\s/g);for(var i=0,a=t[F];i-1){e.substr(0,t);return[e.substr(0,t),e.substr(t+1)]}return[e,""]}Object.defineProperty(n,"__esModule",{value:!0});var C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O=e("../scripts/utils.js"),V=function(e){return e&&e.__esModule?e:{default:e}}(O),j="object",M="string",F="length",D=V.default.any,H=V.default.each,I=".",N=[];n.default={splitNamespace:_,empty:function(e){for(;e.hasChildNodes();)this.off(e.lastChild),e.removeChild(e.lastChild)},remove:function(e){if(e){this.off(e);var t=e.parentElement||e.parentNode;t&&t.removeChild(e)}},closest:function(e,t,n){if(e&&t){if(!n&&t(e))return e;for(var r=e;r=r.parentElement;)if(t(r))return r}},closestWithTag:function(e,t,n){if(t)return t=t.toUpperCase(),this.closest(e,function(e){return e.tagName==t},n)},closestWithClass:function(e,t,n){if(t)return this.closest(e,function(e){return s(e,t)},n)},contains:function(e,t){if(!e||!t)return!1;if(!e.hasChildNodes())return!1;for(var n=e.childNodes,r=n.length,i=0;i="+t),r(n)&&(i=" <="+n)):i=" to be positive.",new Error(i)}Object.defineProperty(n,"__esModule",{value:!0});var l="???";n.ArgumentException=a,n.ArgumentNullException=i,n.TypeException=s,n.OutOfRangeException=u,n.OperationException=o},{}],21:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;nt.totalPageCount||e===t.page)}},{key:"onPageChange",value:function(){}},{key:"getPageCount",value:function(e,t){return i(e,t),e===1/0?1/0:e===-1/0?0:e<1?0:e>t?e%t==0?e/t:Math.ceil(e/t):1}},{key:"dispose",value:function(){delete this.onPageChange}},{key:"resultsPerPage",get:function(){return this._resultsPerPage},set:function(e){e||(e=0),i(e);var t=this,n=t.totalItemsCount;if(n){var r=t.getPageCount(n,e);t.totalPageCount=r,r<=t._page&&(t.page=r)}t._resultsPerPage=e,t.updateItemsNumber()}},{key:"page",get:function(){return this._page},set:function(e){i(e),e!=this.page&&(this._page=e,this.updateItemsNumber(),this.onPageChange())}}]),e}();n.default=l},{"../../scripts/utils":34}],23:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0}),n.TextSlider=void 0;var i=function(){function e(e,t){for(var n=0;n'+(0,d.escapeHtml)(u)+""}return f"+i+""}})}return r}},{key:"getFields",value:function(){var e=this.table,t=h.default.clone(e.columns),n=this.options,r=n.itemCount,i=this.getGeneratedFields(),a=r?{name:"ε_row",displayName:"#"}:null;a&&t.unshift(a);var s=n.fields;return s?(h.default.isFunction(s)&&(s=s.call(this,t)),t=i.concat(s.concat(t))):t=i.concat(t),t}},{key:"build",value:function(){var e=this,t=e.table,n=t.getData({format:!0,hide:!1});if(!n||!n.length)return e.display(e.emptyView());var r=e.getFields(),i=e.buildCaption(),a=e.buildView(r,n),s=e.buildRoot(i,a);e.display(s)}},{key:"buildRoot",value:function(e,t){var n=this.table,r={class:"king-table-region"};return n.id&&(r.id=n.id),new u.VHtmlElement("div",r,[e,t])}},{key:"buildView",value:function(e,t){this.table;return new u.VHtmlElement("table",{class:"king-table"},[this.buildHead(e),this.buildBody(e,t)])}},{key:"buildHead",value:function(e){var t=(this.table,new u.VHtmlElement("tr",{},h.default.map(h.default.values(e),function(e){if(!e.hidden&&!e.secret)return new u.VHtmlElement("th",{class:e.css},new u.VTextElement(e.displayName))})));return new u.VHtmlElement("thead",{class:"king-table-head"},t)}},{key:"buildBody",value:function(e,t){var n=this,r=this.table,i=r.builder,a=r.options.formattedSuffix,s=r.searchText?r.filters.getRuleByKey("search").value:null,o=r.options.autoHighlightSearchProperties,l=-1,f=h.default.map(t,function(t){l+=1,t.__ix__=l;for(var r,f,c=[],p=0,m=e.length;p0&&(c+=" "+n.of+" "+i),f(a)&&f(s)&&s>0&&(c+=" - "+n.results+" "+a+" - "+s,f(o)&&(c+=" "+n.of+" - "+o))),l&&e.options.showAnchorTimestamp&&(c+=" - "+n.anchorTime+" "+l),new u.VHtmlElement("span",{class:"pagination-info"},new u.VTextElement(c))}},{key:"emptyView",value:function(e){var t=this.getReg(),n=new u.VHtmlElement("div",{class:"king-table-empty"},new u.VHtmlElement("span",0,new u.VTextElement(t.noData)));return e?n:this.singleLine(this.table,n)}},{key:"errorView",value:function(e){return e||(e=this.getReg().errorFetchingData),this.singleLine(this.table,new u.VHtmlFragment('
\n \n '+e+'\n \n \n
'))}},{key:"loadingView",value:function(){var e=(this.table,this.getReg()),t=this.buildCaption();return t.children.push(new u.VHtmlElement("div",{class:"loading-info"},[new u.VHtmlElement("span",{class:"loading-text"},new u.VTextElement(e.loading)),new u.VHtmlElement("span",{class:"mini-loader"})])),this.buildRoot([t])}},{key:"display",value:function(e){var t=this.table;h.default.isString(e)||(e=e.toString());var n=t.element;if(n){for(n.classList.add("king-table"),t.emit("empty:element",n);n.hasChildNodes();)n.removeChild(n.lastChild);n.innerHTML=e}}},{key:"singleLine",value:function(e){var t=(this.table,this.buildCaption());return t.children.push(new u.VHtmlElement("br"),new u.VHtmlElement("div",{class:"loading-info"},h.default.isString(e)?new u.VTextElement(e):e)),this.buildRoot([t])}},{key:"loadingHandler",value:function(){var e=this,n=e.table;e.unsetLoadingHandler();var r=n.hasData()?t.options.loadInfoDelay:0;e.showLoadingTimeout=setTimeout(function(){if(!n.loading)return e.unsetLoadingHandler();e.display(e.loadingView())},r)}},{key:"unsetLoadingHandler",value:function(){return clearTimeout(this.showLoadingTimeout),this.showLoadingTimeout=null,this}},{key:"dispose", value:function(){var e=this.table,t=e.element;t&&g.default.empty(t),this.stopListening(this.table),this.table=null,delete this.options}}],[{key:"options",get:function(){return{handleLoadingInfo:!0,loadInfoDelay:500,paginationInfo:!0}}}]),t}(f.default);n.default=v},{"../../scripts/data/html":12,"../../scripts/dom":19,"../../scripts/raise":26,"../../scripts/tables/kingtable.html.base.builder":28,"../../scripts/utils":34}],30:[function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;nn[r]?1:t[r]0?x.default.debounce(e,t,this):e,this}},{key:"getViewResolver",value:function(){var e=this.options,t=e.view,n=e.views;x.default.isString(t)||(0,w.default)(21,"Missing view configuration for Rich HTML builder");var r=x.default.find(n,function(e){return e.name==t});r||(0,w.default)(22,"Missing view resolver for view: "+t);var i=r.resolver;return!0===i?this:(i||(0,w.default)(33,"Missing resolver in view configuration '"+t+"'"),x.default.isPlainObject(i)||(i=new i),x.default.quacks(i,["buildView"])||(0,w.default)(23,"Invalid resolver for view: "+t),i)}},{key:"buildCaption",value:function(){var e=this.table,t=e.options.caption;return t?new c.VHtmlElement("div",{class:"king-table-caption"},new c.VHtmlElement("span",{},new c.VTextElement(t))):null}},{key:"build",value:function(){var e=this;return e.table.element?e.ensureLayout().update():e}},{key:"ensureLayout",value:function(){var e=this;if(e.rootElement)return e;var t=e.table,n=e.options,r=t.element,i=e.buildView(null,null,new c.VHtmlFragment(" ")),a=e.buildCaption(),s=e.buildRoot(a,i);return t.emit("empty:element",r),S.default.empty(r),S.default.addClass(r,"king-table"),r.innerHTML=s.toString(),e.rootElement=S.default.findFirstByClass(r,"king-table-region"),e.bindEvents(),x.default.ifcall(n.onLayoutRender,e,[r]),n.filtersView&&x.default.ifcall(n.onFiltersRender,e,[S.default.findFirstByClass(r,"kt-filters")]),e}},{key:"update",value:function(){this.updatePagination().updateView()}},{key:"updatePagination",value:function(){var e=this.table,t=e.pagination,n=this.rootElement;n||(0,w.default)(26,"missing root element");var r=this.getReg(),t=(e.options,e.pagination),i=t.page,a=t.totalPageCount,s=t.resultsPerPage,o=t.firstObjectNumber,u=t.lastObjectNumber,l=t.totalItemsCount,f=e.getFormattedAnchorTime(),c=x.default.isNumber,d=S.default.findFirstByClass,p=S.default.addClass,h=S.default.removeClass;d(n,"pagination-bar-page-number").value=i,d(n,"pagination-bar-results-select").value=s;var m="pagination-button",g="pagination-button-disabled";x.default.each(["pagination-bar-first-page","pagination-bar-prev-page"],function(e){var t=d(n,e);i>1?(p(t,m),h(t,g)):(p(t,g),h(t,m))}),x.default.each(["pagination-bar-last-page","pagination-bar-next-page"],function(e){var t=d(n,e);i0&&(v+=r.results+" "+o+" - "+u,c(l)&&(v+=" "+r.of+" - "+l));var y="";f&&e.options.showAnchorTimestamp&&(y=r.anchorTime+" "+f);var b,k={"results-info":v,"anchor-timestamp-info":y,"total-page-count":r.of+" "+a};for(b in k){var E=d(n,b);E&&(E.innerHTML=k[b])}var P=e.searchText||"",T=d(n,"search-field");return T&&T.value!=P&&0==S.default.isFocused(T)&&(T.value=P),this}},{key:"updateView",value:function(){var e=this,t=e.options,n=e.table,r=n.pagination,i=e.rootElement;i||(0,w.default)(26,"missing root element"),x.default.each({"kt-search-active":n.searchText,"kt-search-sorting":n.options.searchSortingRules},function(e,t){S.default.modClass(i,t,e)});var r=n.getData({format:!0,hide:!1}),a=S.default.findFirstByClass(i,"king-table-view");if(!r||!r.length)return a.innerHTML=e.emptyView().toString(),e;var s=e.getFields();if(e._must_build_tools){document.getElementById(e.toolsRegionId).innerHTML=e.buildToolsInner(!0),delete e._must_build_tools}e.currentItems=r;var o=e.buildView(s,r);return a.innerHTML=o.children[0].toString(),x.default.ifcall(t.onViewUpdate,e,[a]),e}},{key:"display",value:function(e){var t=(this.table,this.options);x.default.isString(e)||(e=e.toString()),this.ensureLayout();var n=this.rootElement,r=S.default.findFirstByClass(n,"king-table-view");r.innerHTML=e,x.default.ifcall(t.onViewUpdate,this,[r])}},{key:"buildRoot",value:function(e,t){var n=this.table,r={class:"king-table-region"};return n.id&&(r.id=n.id),new c.VHtmlElement("div",r,[e,this.buildPaginationBar(),this.buildFiltersView(),t])}},{key:"buildPaginationBar",value:function(){var e=this.table,t=this.getReg(),n=this.options,r=e.pagination,i=(r.page,r.totalPageCount,r.resultsPerPage,r.firstObjectNumber),a=r.lastObjectNumber,s=r.totalItemsCount,o=n.filtersView,u=o&&n.filtersViewExpandable,l=u&&n.filtersViewOpen,f=e.getFormattedAnchorTime(),d=x.default.isNumber,p="";d(i)&&d(a)&&a>0&&(p+=t.results+" "+i+" - "+a,d(s)&&(p+=" "+t.of+" - "+s));var h;f&&e.options.showAnchorTimestamp&&(h=t.anchorTime+" "+f);var m=t.advancedFilters,g=n.allowSearch?new c.VHtmlElement("span",{class:"pagination-bar-filters"},new c.VHtmlElement("input",{type:"text",class:"search-field",value:e.searchText||""})):null,v="span",y=new c.VHtmlElement(v,{class:"separator"});return new c.VHtmlElement("div",{class:"pagination-bar"},[this.buildTools(),new c.VHtmlElement(v,{class:"pagination-bar-buttons"},[new c.VHtmlElement(v,{tabindex:"0",class:"pagination-button pagination-bar-first-page oi","data-glyph":"media-step-backward",title:t.firstPage}),new c.VHtmlElement(v,{tabindex:"0",class:"pagination-button pagination-bar-prev-page oi","data-glyph":"caret-left",title:t.prevPage}),y,new c.VHtmlElement(v,{class:"valigned"},new c.VTextElement(t.page)),new c.VHtmlElement("input",{type:"text",name:"page-number",class:"must-integer pagination-bar-page-number",value:r.page}),new c.VHtmlElement("span",{class:"valigned total-page-count",value:r.page},new c.VTextElement(t.of+" "+r.totalPageCount)),y,new c.VHtmlElement(v,{tabindex:"0",class:"pagination-button pagination-bar-refresh oi","data-glyph":"reload",title:t.refresh}),y,new c.VHtmlElement(v,{tabindex:"0",class:"pagination-button pagination-bar-next-page oi","data-glyph":"caret-right",title:t.nextPage}),new c.VHtmlElement(v,{tabindex:"0",class:"pagination-button pagination-bar-last-page oi","data-glyph":"media-step-forward",title:t.lastPage}),y,new c.VHtmlElement(v,{class:"valigned"},new c.VTextElement(t.resultsPerPage)),new c.VHtmlElement("select",{name:"pageresults",class:"pagination-bar-results-select valigned"},x.default.map(n.resultsPerPageSelect,function(e){var t=new c.VHtmlElement("option",{value:e},new c.VTextElement(e.toString()));return e===n.resultsPerPage&&(t.attributes.selected=!0),t})),y,p?new c.VHtmlElement(v,{class:"valigned results-info"},new c.VTextElement(p)):null,p?y:null,h?new c.VHtmlElement(v,{class:"valigned anchor-timestamp-info"},new c.VTextElement(h)):null,g?y:null,g,u?y:null,u?new c.VHtmlElement("button",{class:"btn valigned camo-btn kt-advanced-filters"+(l?" kt-open":"")},new c.VTextElement(m)):null])])}},{key:"buildHead",value:function(e){var t=this.table,n=t.builder,r=t.sortCriteria,i=n.getReg(),a=new c.VHtmlElement("tr",{},x.default.map(x.default.values(e),function(e){if(!e.hidden&&!e.secret){var t,n=!1,a=[e.css];if(e.sortable){a.push("sortable");var s=x.default.find(r,function(t){return t[0]===e.name});s&&(n=!0,t=s[1])}var o=e.displayName;return new c.VHtmlElement("th",{class:a.join(" "),"data-prop":e.name},new c.VHtmlElement("div",{},[new c.VHtmlElement("span",{},new c.VTextElement(o)),n?new c.VHtmlElement("span",{class:"oi kt-sort-glyph","data-glyph":1==t?"sort-ascending":"sort-descending","aria-hidden":!0,title:x.default.format(1==t?i.sortAscendingBy:i.sortDescendingBy,{name:o})}):null]))}}));return new c.VHtmlElement("thead",{class:"king-table-head"},a)}},{key:"buildView",value:function(e,t,n){var r,i=this.table;if(n)r=n;else if(t&&t.length){var r,a=this.getViewResolver();a===this?r=new c.VHtmlElement("table",{class:"king-table"},[this.buildHead(e),this.buildBody(e,t)]):(a.table=this.table,a.options=i.options,r=a.buildView(i,e,t),delete a.table,delete a.options)}else r=new c.VHtmlElement("div",{class:"king-table-view"},this.emptyView());return new c.VHtmlElement("div",{class:"king-table-view"},r)}},{key:"getTemplate",value:function(e,t){if(x.default.isFunction(e))return e.call(this);x.default.isString(e)||(0,w.default)(38,"Cannot obtain HTML from given parameter "+t+", must be a function or a string.");var n=document.getElementById(e);if(null!=n){if(/script/i.test(n.tagName))return n.innerText;(0,w.default)(38,"Cannot obtain HTML from parameter "+t+". Element is not