diff --git a/build/index.js b/build/index.js index 4a8d9d5..82f1a32 100644 --- a/build/index.js +++ b/build/index.js @@ -9,4 +9,4 @@ Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ -!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t-1&&e%1==0&&e-1&&e%1==0&&e<=n}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(72))},function(e,t,n){var r=n(10).Symbol;e.exports=r},function(e,t,n){var r=n(11),o=n(9),a="[object AsyncFunction]",i="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";e.exports=function(e){if(!o(e))return!1;var t=r(e);return t==i||t==s||t==a||t==u}},function(e,t,n){var r=n(74),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(24);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(25),o=n(20),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var i=e[t];a.call(e,t)&&o(i,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t){e.exports=o},function(e,t,n){var r=n(101);"string"==typeof r&&(r=[[e.i,r,""]]);n(32)(r,{});r.locals&&(e.exports=r.locals)},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=0&&u.splice(t,1)}function p(e){var t=document.createElement("style");return t.type="text/css",f(e,t),t}function _(e,t){var n,r,o;if(t.singleton){var a=s++;n=i||(i=p(t)),r=g.bind(null,n,a,!1),o=g.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return t.rel="stylesheet",f(e,t),t}(t),r=function(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}.bind(null,n),o=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=p(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){d(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");void 0===(t=t||{}).singleton&&(t.singleton=o()),void 0===t.insertAt&&(t.insertAt="bottom");var r=c(e);return l(r,t),function(e){for(var o=[],a=0;a=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(r.createElement)(e,n)},_}(r.Component),n.displayName="OnClickOutside("+(e.displayName||e.name||"Component")+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:p,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;nc.MORE_PAGES){if(h=c.MORE_PAGES&&h<=_-c.MORE_PAGES){h-1,h+1,g=(h-2)*o,y=h*o;var O=(0,s.default)({gt_page:!0,selected:h===r});m[v]=a.default.createElement("span",{key:v},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),a.default.createElement("div",{"data-from":g,onClick:this.props.updatePagination,className:"gt_page"},h-1),a.default.createElement("div",{"data-from":(h-1)*o,onClick:this.props.updatePagination,className:O},h),a.default.createElement("div",{"data-from":y,onClick:this.props.updatePagination,className:"gt_page"},h+1),a.default.createElement("div",{className:"gt_page_dots"},"..."),a.default.createElement("div",{"data-from":(_-1)*o,onClick:this.props.updatePagination,className:"gt_page"},_));break}if(h>b){for(var T=[],x=b-1;x<_;++x){var R=x*o,j=x-1,P=x+1;h===P&&(g=j*o,j<0&&(g=(_-1)*o),y=P*o,P===_&&(y=0)),w=(0,s.default)({gt_page:!0,selected:x+1===r}),T[x]=a.default.createElement("div",{key:x,onClick:this.props.updatePagination,"data-from":R,className:w},x+1)}m[v]=a.default.createElement("span",{key:v},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),T);break}}else(h=c.MORE_PAGES&&1===b)&&(m[v]=a.default.createElement("div",{key:v,onClick:this.props.updatePagination,"data-from":v*o,className:w},E))}if(_>0&&0===m.length)for(var C=0;C<_;++C){var k=C+1,D=(0,s.default)({gt_page:!0,selected:k===r});m[C]=a.default.createElement("div",{key:C,onClick:this.props.updatePagination,"data-from":C*o,className:D},k)}var I=1===r?o*(_-1):o*(r-2),S=r===_?0:o*r,A=0===n?0:p+1,N=r*o,M=i.showing+" "+A+" "+i.to+" "+(N>n?n:N)+" "+i.of+" "+n+" "+i.entries+".";return 0===n&&(M=i.no_entries),a.default.createElement("div",{className:u.default.gt_pagination},a.default.createElement("div",{className:u.default.gt_pgn_ttl},M),a.default.createElement("div",{className:u.default.gt_pgn_pages},a.default.createElement("div",{className:u.default.gt_pagn},a.default.createElement("div",{"data-from":I,onClick:this.props.updatePagination,className:l},i.prev),m,a.default.createElement("div",{"data-from":S,onClick:this.props.updatePagination,className:d},i.next))),a.default.createElement("div",{className:u.default.clear}))}}]),t}();d.propTypes={page:i.default.number,perPage:i.default.number,countRows:i.default.number,fromRow:i.default.number},t.default=d},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(41)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(16),o=n(42),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){(function(e){var r=n(21),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,i=a&&a.exports===o&&r.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}).call(this,n(15)(e))},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(11),o=n(18),a=n(7),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&o(e.length)&&!!i[r(e)]}},function(e,t,n){var r=n(46),o=n(45),a=n(44),i=a&&a.isTypedArray,s=i?o(i):r;e.exports=s},function(e,t){e.exports=function(){return!1}},function(e,t,n){(function(e){var r=n(10),o=n(48),a="object"==typeof t&&t&&!t.nodeType&&t,i=a&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===a?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||o;e.exports=u}).call(this,n(15)(e))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(11),o=n(7),a="[object Arguments]";e.exports=function(e){return o(e)&&r(e)==a}},function(e,t,n){var r=n(51),o=n(7),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t,n){var r=n(58),o=n(24),a=n(19),i=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:a;e.exports=i},function(e,t,n){var r=n(59),o=n(57)(r);e.exports=o},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(61),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,s=o(a.length-t,0),u=Array(s);++i1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,s&&o(n[0],n[1],s)&&(i=a<3?void 0:i,a=1),t=Object(t);++r0&&(n=this.setFieldsetFields(n)),n}},{key:"setEditFields",value:function(e){var t=this,n=[];return e.forEach(function(e,r){t.setFieldsets(r,e),n[r]=t.getFieldByType(r,e)}),this.fieldsetClose>0&&(n=this.setFieldsetFields(n)),n}},{key:"setFieldsets",value:function(e,t){if(o(t.fieldsetOpen)!==T.UNDEFINED){if(o(t.legend)===T.UNDEFINED)throw new l.EditorException('the "legend" property must be specified within fieldsetOpen');this.fieldsetOpen=e,this.fieldsetLegend=t.legend}o(t.fieldsetClose)!==T.UNDEFINED&&(this.fieldsetClose=e)}},{key:"setFieldsetFields",value:function(e){var t=this,n=[];e.forEach(function(e,r){r>=t.fieldsetOpen&&r<=t.fieldsetClose&&(n[r]=e)});var r=[];return r.push(e.slice(0,this.fieldsetOpen)),r.push(s.default.createElement("div",{key:0,className:"gte_editor_fields"},s.default.createElement("fieldset",null,s.default.createElement("legend",null,this.fieldsetLegend),n))),r.push(e.slice(this.fieldsetClose+1)),r}},{key:"setDeleteFields",value:function(e){var t=[],n=0;this.state.dataIndices=this.props.selectedIds,this.props.selectedIds.forEach(function(e,r){t[r]=s.default.createElement("input",{key:r,type:"hidden","data-value":e,name:"ids[]",value:e}),n=r});var r=(0,c.t)(this.lang.gte_editor_delete_popup,{rows:e.length});return t.push(s.default.createElement("div",{key:++n,className:"gte_msg"},r)),t}},{key:"onFocus",value:function(e){var t=this.state.setMultipleText,n=this.props.tableOpts,r=!1;o(e.target.dataset.multiple)!==T.UNDEFINED&&!0===e.target.dataset.multiple&&0===t&&(document.querySelectorAll("input").value=""),(o(e.target.dataset.textarea)!==T.UNDEFINED&&e.target.dataset.textarea===T.STR_TRUE||o(e.target.children[0])!==T.UNDEFINED&&o(e.target.children[0].getAttribute("data-contents"))!==T.UNDEFINED&&e.target.children[0].getAttribute("data-contents")===T.STR_TRUE)&&(r=!0),n.theme===T.THEME_MATERIAL_UI&&"TEXTAREA"===e.target.nodeName&&(r=!0),this.setState({setMultipleText:1,isTextArea:r})}},{key:"onChange",value:function(e){var t=this.state.setMultipleText,n=e.target.dataset.multiple&&0===t?"":e.target.value;if(e.target.type===x.TYPE_CHECKBOX){var a={};o(this.state.dataIndices[e.target.name])!==T.UNDEFINED?a[e.target.name]=r({},this.state.dataIndices[e.target.name]):a[e.target.name]={},a[e.target.name][e.target.value]=e.target.checked,this.setState({dataIndices:a,setMultipleText:1})}else this.setState({dataIndices:Object.assign({},this.state.dataIndices,O({},e.target.name,n)),setMultipleText:1})}},{key:"fileUpload",value:function(){if(o(this.filesInput.files)!==T.UNDEFINED){var e=this.props.editor.ajaxFiles,t=new FormData,n=this.filesInput.files;for(var r in n)n.hasOwnProperty(r)&&n[r]instanceof File&&t.append(r,n[r]);d.default.post(e).send(t).end(function(e,t){e?(console.log("Error has occurred while uploading files: "),console.log(e)):t.ok})}}},{key:"onChangeHtml",value:function(e,t){this.setState({dataIndices:Object.assign({},this.state.dataIndices,O({},e.props.name,t))})}},{key:"getFieldByType",value:function(e,t){var n=this,a=this.state,i=a.dataIndices,u=a.setMultipleText,l=this.props,c=l.action,f=l.fieldsEdit,d=l.tableOpts,g=Object.keys(f).length>1,w=t.type,O=t.name,R=t.label,j=t.defaultValue,P="",C={};o(t.attrs)!==T.UNDEFINED&&(C=t.attrs),!0===g&&0===u?P=this.lang.gte_editor_multiple_rows:c===x.ACTION_EDIT?P=o(i[O])!==T.UNDEFINED?i[O]:!0===g?"":f[0][O]:c===x.ACTION_CREATE&&(o(i[O])!==T.UNDEFINED?P=i[O]:(void 0===j?"undefined":o(j))!==T.UNDEFINED&&(P=j)),null===P&&(P="");var k={};switch(w){case x.TYPE_TEXT:case x.TYPE_HIDDEN:case x.TYPE_EMAIL:case x.TYPE_PASSWORD:k=s.default.createElement(y.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:C,id:O,type:w,name:O,value:P,isMultiple:g,theme:d.theme});break;case x.TYPE_COLOR:case x.TYPE_DATE:case x.TYPE_DATETIME:case x.TYPE_NUMBER:case x.TYPE_RANGE:case x.TYPE_SEARCH:case x.TYPE_TIME:case x.TYPE_TEL:case x.TYPE_URL:case x.TYPE_MONTH:case x.TYPE_WEEK:k=s.default.createElement(p.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:C,id:O,type:w,name:O,value:P});break;case x.TYPE_FILE:k=s.default.createElement("input",r({ref:function(e){n.filesInput=e}},C,{id:O,type:w,name:O,value:void 0}));break;case x.TYPE_TEXTAREA:k=o(t.plugins)!==T.UNDEFINED&&-1!==t.plugins.indexOf(x.PLUGINS_RTE)?s.default.createElement(_.default,{key:0,onFocus:this.onFocus.bind(this),onChangeHtml:this.onChangeHtml.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,isMultiple:g,"data-textarea":!0}):s.default.createElement(E.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,isMultiple:g,"data-textarea":!0,theme:d.theme});break;case x.TYPE_SELECT:k=o(t.plugins)!==T.UNDEFINED&&-1!==t.plugins.indexOf(x.PLUGINS_REACT_SELECT)?s.default.createElement(b.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,pluginProps:t.pluginProps}):s.default.createElement(m.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,objectValues:t.values,theme:d.theme});break;case x.TYPE_CHECKBOX:case x.TYPE_RADIO:k=s.default.createElement(v.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,objectValues:t.values,theme:d.theme})}return[s.default.createElement(h.default,{key:0,id:O,label:R,type:w},k)]}},{key:"triggerBefore",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerBefore)!==T.UNDEFINED&&t.triggerBefore()})}},{key:"triggerAfter",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerAfter)!==T.UNDEFINED&&t.triggerAfter()})}},{key:"btnClicked",value:function(e){var t=this;e.persist();var n=this.props,r=n.action,a=n.editorUpdate,i=n.fieldsEdit,s=n.editor,u=this.state.dataIndices,c=this.getAjaxSettings(r),f=c.url,d=u,p={};if(p[T.HEADER_CONTENT_TYPE]=T.CONTENT_APP_JSON,r===x.ACTION_CREATE){this.triggerBefore(x.EDITOR_CREATE),this.fileUpload(),o(u.id)!==T.UNDEFINED&&delete u.id,o(u[T.GT_ROW_ID])!==T.UNDEFINED&&delete u[T.GT_ROW_ID];var _={};s.fields.forEach(function(e){o(e.defaultValue)!==T.UNDEFINED&&o(u[e.name])===T.UNDEFINED?_[e.name]=e.defaultValue:o(u[e.name])!==T.UNDEFINED&&(_[e.name]=u[e.name])}),p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(_),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[T.GT_ROW].id)===T.UNDEFINED)throw new l.DataException("The `id` field is required to return in response from server/back-end.");for(var r in n[T.GT_ROW])n[T.GT_ROW].hasOwnProperty(r)&&(d[r]=n[T.GT_ROW][r]);d[T.GT_ROW_ID]=n[T.GT_ROW].id,a(e,d),t.triggerAfter(x.EDITOR_CREATE)}).catch(function(e){console.error(e.message)})}else if(r===x.ACTION_EDIT){this.triggerBefore(x.EDITOR_EDIT),this.fileUpload();var h=[];for(var b in i)i.hasOwnProperty(b)&&(h[b]=j({},i[b],u));p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(h),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[T.GT_ROWS])===T.UNDEFINED||o(n[T.GT_ROWS][0])===T.UNDEFINED||o(n[T.GT_ROWS][0].id)===T.UNDEFINED)throw new l.DataException("The `id` field is required to return in response from server/back-end.");a(e,n),t.triggerAfter(x.EDITOR_EDIT)}).catch(function(e){console.error(e.message)})}else r===x.ACTION_DELETE&&(this.triggerBefore(x.EDITOR_REMOVE),p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(u),headers:p}).then(function(e){return e.json()}).then(function(){a(e,d),t.triggerAfter(x.EDITOR_REMOVE)}))}},{key:"setHeaders",value:function(e,t){for(var n in e.headers)e.headers.hasOwnProperty(n)&&(t[n]=e.headers[n]);return t}},{key:"getAjaxSettings",value:function(e){var t=this.props.editor;if(o(t.ajax)===T.STRING){var n=x.HTTP_METHOD_POST;return e===x.ACTION_EDIT?n=x.HTTP_METHOD_PUT:e===x.ACTION_DELETE&&(n=x.HTTP_METHOD_DELETE),{url:t.ajax,method:n}}if(o(t.ajax)===T.OBJECT&&o(t.ajax[e])!==T.UNDEFINED&&o(t.ajax[e].url)!==T.UNDEFINED)return{url:t.ajax[e].url,method:t.ajax[e].type,headers:t.ajax[e].headers};throw new l.EditorException('"ajax" property must be set either as string url or object with "'+e+'" and "url", "type" properties set-up respectively.')}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"btnClickedEnter",value:function(e){e.keyCode===T.ENTER_KEY&&!1===this.state.isTextArea&&document.getElementById("gte_sent_btn").click()}},{key:"resetFields",value:function(){var e=this;setTimeout(function(){e.setState({dataIndices:{}}),e.setDataIndices(e.props)},300)}},{key:"render",value:function(){var e=this.props,t=e.hidePopup,n=e.popupTitle,r=e.action,o=e.popupButton,a=e.active,i=e.tableOpts;!1===a?this.resetFields():this.setFields(this.props);var u=(0,f.default)({gte_editor_popup:!0,fade_in:a,fade_out:!a}),l=(0,f.default)({gte_popup_background:!0,fade_in:a,fade_out:!a}),c=(0,f.default)({gte_form_fields:!0,gte_form_fields_delete:r===x.ACTION_DELETE});return s.default.createElement("div",null,s.default.createElement("div",{onClick:t,className:u},s.default.createElement("div",{className:"gte_popup_container"},s.default.createElement("div",{className:"gte_popup_container_wrapper"},s.default.createElement("div",{onKeyUp:this.btnClickedEnter.bind(this),onClick:this.stopPropagation.bind(this),className:"gte_form_border_box"},s.default.createElement("div",{className:"close_btn",onClick:function(){t()}}),s.default.createElement("div",{className:c},s.default.createElement("div",{className:"gte_header"},s.default.createElement("div",{className:"gte_editor_title"},n)),s.default.createElement("div",{className:"gte_form_body"},s.default.createElement("div",{className:"gte_form_body_content"},s.default.createElement("form",{id:"gte_form",action:"",method:"post"},s.default.createElement("div",{className:"gte_form_content"},s.default.createElement("div",null,s.default.createElement("input",{type:"hidden",name:"action",value:r})),s.default.createElement("div",null,this.fields))))),s.default.createElement("div",{className:"gte_footer"},s.default.createElement("div",{className:"gte_form_err"}),s.default.createElement("div",{className:"gte_form_buttons"},s.default.createElement(g.default,{"data-action":r,action:r,btnClicked:this.btnClicked.bind(this),theme:i.theme},o)))))))),s.default.createElement("div",{onClick:function(){t()},className:l}))}}]),t}();P.propTYpes={active:u.default.bool.isRequired,editor:u.default.object.isRequired,action:u.default.string.isRequired,popupTitle:u.default.string.isRequired,popupButton:u.default.string.isRequired,editorUpdate:u.default.func.isRequired,selectedIds:u.default.array.isRequired},P.defaultProps={pluginProps:{}},t.default=P},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&-1!==a.buttonsPosition.indexOf(s)&&a.buttons.map(function(e,o){switch(e[b.EXTENDED]){case b.EDITOR_CSV:c!==h.UNDEFINED&&r(d.download)!==h.UNDEFINED&&!0===d.download.csv&&(_[o]=i.default.createElement(l.default,{active:!1,jsonData:c,key:o},p.editor_csv));break;case b.EDITOR_RELOAD:_[o]=i.default.createElement(u.default,{active:!1,action:b.ACTION_RELOAD,showPopup:n,isReload:!0,key:o,theme:a.theme},p.editor_reload);break;case b.EDITOR_CREATE:_[o]=i.default.createElement(f.default,{active:!1,action:b.ACTION_CREATE,showPopup:n,key:o,incr:o,theme:a.theme,selectedRows:t},p.editor_create);break;case b.EDITOR_EDIT:_[o]=i.default.createElement(f.default,{active:!(t.length>=1),action:b.ACTION_EDIT,showPopup:n,key:o,theme:a.theme,incr:o,selectedRows:t},p.editor_edit);break;case b.EDITOR_REMOVE:_[o]=i.default.createElement(f.default,{active:0===t.length,selectedRows:t,action:b.ACTION_DELETE,showPopup:n,key:o,incr:o,theme:a.theme},p.editor_remove)}}),_}},{key:"render",value:function(){var e=this.props.isData;return i.default.createElement("div",{className:"gt_head_tools"},e?"":this.getButtons(),this.getPagesSelection(),this.getSearch(),i.default.createElement("div",{className:c.default.clear}))}}]),t}();y.propTypes={updatePerPage:s.default.func.isRequired,perPageRows:s.default.array,doSearch:s.default.func,tableOpts:s.default.object,showPopup:s.default.func,defaultPerPage:s.default.number,perPage:s.default.number,search:s.default.string,selectedRows:s.default.array,lang:s.default.string},t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&t<20,progress_bar_color_orange:t>=20&&t<40,progress_bar_color_yellow:t>=40&&t<60,progress_bar_color_light_green:t>=60&&t<80,progress_bar_color_green:t>=80,progress_bar_none:null===t||t===c.UNDEFINED}),s={height:(void 0===n?"undefined":r(n))===c.UNDEFINED?10:n,width:(t>100?100:t)+"%"},l=(null===t?0:t>100?100:t)+"%";return i.default.createElement("div",{className:"progress_bar_container"},i.default.createElement("div",{"data-percent":t,style:s,className:a},i.default.createElement("div",{className:"progress_bar_percent"},i.default.createElement("div",{className:"progress_bar_percent_child"},!0===o?l:" "))))}}]),t}();f.defaultProps={height:10,percent:0,showPercent:!0},f.propTypes={percent:s.default.any,height:s.default.number},t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0}},{key:"render",value:function(){var e=this.props,t=e.count,n=e.selectedRows,r=e.children,o=e.gteRowId,i=e.minRow,u=e.maxRow,l=e.clickedRow,c=e.editableCells,f=(0,s.default)({even:t%2==0,odd:t%2!=0,active:-1!==n.indexOf(t)});return a.default.createElement("tr",{key:o,className:f,"data-selectedrows":n,onClick:!1===c?l:void 0,"data-minrow":i,"data-maxrow":u,"data-rowid":t,"data-realid":o},r)}}]),t}();l.propTypes={gteRowId:i.default.number.isRequired,count:i.default.number.isRequired,minRow:i.default.number,maxRow:i.default.number,selectedRows:i.default.array},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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=function(){function e(e,t){for(var n=0;n_.PERIOD_SEARCH){for(var d in this.tOut)clearTimeout(this.tOut[d]);this.tOut=[],this.c=0,this.createTable(i,this.state.sortedButtons,this.state.selectedRows)}else this.tOut[this.c]=setTimeout(function(){n.createTable(i,n.state.sortedButtons,n.state.selectedRows)},_.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:i,selectedIds:[],selectedRows:[]}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"searchBlur",value:function(){this.setState({searchFocus:!1})}},{key:"searchFocus",value:function(){this.setState({searchFocus:!0})}},{key:"createTable",value:function(e,t,n){var o=this,a=this.state,l=a.dataSearch,c=a.perPage,f=a.fromRow,d=a.minRow,p=a.maxRow,b=a.scrolledDown,g=a.editedCell,y=this.settings.struct.editableCells,m=this.settings.struct.aggregateFooter,v=[];null!==l&&(e=l);var E=e;if(e.length>c){var w=parseInt(f),O=w+parseInt(c);E=!0===b?e.slice(0,O):e.slice(w,O)}E.forEach(function(e,t){var a,l=[];a=o.getRowId(e),!0===y&&l.push(i.default.createElement(u.default,{editRow:o.editRow.bind(o),dataIndex:h.EDITABLE_CELLS_INDEX,selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,count:t,gteRowId:a,key:-1,editableCells:y})),o.props.children.forEach(function(s,c){var f=s.props.data;if((void 0===f?"undefined":r(f))!==_.UNDEFINED&&!0===o.visibleCols[f]){var h=null;h=r(o.customColumns[f])!==_.UNDEFINED&&r(o.customColumns[f])===_.FUNCTION?o.customColumns[f](e[f],e,f):e[f],l.push(i.default.createElement(u.default,{dataIndex:f,selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,count:t,gteRowId:a,key:c,editableCells:y,editedCell:g,editor:o.props.editor,editCell:o.editCell.bind(o),editorUpdate:o.editorUpdate.bind(o),cell:""+t+c,plugins:o.plugins[f]},h))}}),v.push(i.default.createElement(s.default,{clickedRow:o.clickedRow.bind(o),selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,key:t,count:t,gteRowId:a,editableCells:y},l))}),!0===m&&this.setFooter(E,v);var T={dataRows:v,countRows:e.length};(void 0===t?"undefined":r(t))!==_.UNDEFINED&&(T.sortButtons=t),this.setState(T)}},{key:"setFooter",value:function(e,t){var n=this,o=this.settings.columns,a=this.state,s=a.footerCounted,c=a.footerSum,f=a.footerAvg,d=a.footerMinLength,p=a.footerMaxLength,h=a.footerFrequency,b=0,g=0,y=0,m=0,v=[],E="";!0===s?(b=c,g=f,y=d,m=p,v=h):this.jsonData.forEach(function(e){n.props.children.forEach(function(t){var n=t.props.data;o.forEach(function(t){if(t[_.DATA]===n&&t[_.FOOTER]!==_.UNDEFINED){var o=e[n];switch(t[_.FOOTER]){case _.FOOTER_SUM:b+=parseFloat(o);break;case _.FOOTER_AVG:g+=parseFloat(o);break;case _.FOOTER_MIN_LENGTH:var a=o.length;(y>a||0===y)&&(y=a);break;case _.FOOTER_MAX_LENGTH:var i=o.length;(m0?b:0));break;case _.FOOTER_AVG:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},g>0?g/e.length:0));break;case _.FOOTER_MIN_LENGTH:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},y));break;case _.FOOTER_MAX_LENGTH:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},m));break;case _.FOOTER_FREQUENCY:var o=0;for(var s in v)0===o&&(E=s),v[s]>v[E]&&(E=s),++o;w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},E));break;default:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1}," "))}})}),!1===s&&this.setState({footerCounted:!0,footerSum:b,footerAvg:g,footerMinLength:y,footerMaxLength:m,footerFrequency:E}),t.push(i.default.createElement(l.default,{key:-1},w))}},{key:"getRowId",value:function(e){var t=0;if(r(e[_.GT_ROW_ID])!==_.UNDEFINED)t=e[_.GT_ROW_ID];else{if(r(e.id)===_.UNDEFINED)throw new c.DataException('You have neither "GT_RowId" nor "id" in json structure.');t=e.id}return t}},{key:"clickedRow",value:function(e){var t=this,n=this.state,o=n.selectedRows,a=n.selectedIds,i=n.sortedButtons,s=n.ctrlDown,u=n.shiftDown,l=e.target.dataset,c=l.rowid,f=l.realid,d=o,p=a,h=0,b=0,g=parseInt(c),y=parseInt(f),m=d.indexOf(g);if(d.length>0&&-1!==m&&!0===s){var v=p.indexOf(y);d.splice(m,1),p.splice(v,1)}else if(!0===s)d.push(parseInt(c)),p.push(parseInt(f));else if(!0===u){for(var E in d.push(parseInt(c)),p.push(parseInt(f)),h=d[0],b=d[0],d)d[E]b&&(b=d[E]);d=[];for(var w=h;w<=b;++w)d.push(w)}else d=[parseInt(c)],p=[parseInt(f)];this.createTable(this.jsonData,i,d),this.setState({selectedRows:d,selectedIds:p},function(){if(!0===u){var e=document.querySelectorAll("tr.active"),n=[];for(var o in e)r(e[o].dataset)!==_.UNDEFINED&&n.push(parseInt(e[o].dataset.realid));t.setState({selectedIds:n})}})}},{key:"editRow",value:function(e){this.clickedRow(e)}},{key:"editCell",value:function(e){var t=this;this.setState({editedCell:e.target.dataset.cell},function(){t.createTable(t.jsonData,t.state.sortedButtons)})}},{key:"getButtonsState",value:function(e,t){var n=this.state.sortButtons,r=[];for(var o in n)r[o]=n[o],o===e&&(r[o]=t);return r}},{key:"editorUpdate",value:function(e,t){var n=this,r=e.target.dataset.action,o=0,a=this.state,i=a.selectedRows,s=a.sortedButtons;if(r===h.ACTION_DELETE)!function(){var e=n.state.dataSearch,r=function(r){for(var a in n.jsonData)o=n.getRowId(n.jsonData[a]),t[r]===o&&(i.splice(i.indexOf(a),1),delete n.jsonData[a],null!==e&&e.forEach(function(o,a){parseInt(n.getRowId(o))===parseInt(t[r])&&delete e[a]}))};for(var a in t)r(a)}();else if(r===h.ACTION_CREATE)this.jsonData.unshift(t);else if(r===h.ACTION_EDIT)for(var u in 0===i.length&&(i[0]=e.target.dataset.rowid),t[_.GT_ROWS])for(var l in this.jsonData)if(this.getRowId(this.jsonData[l])===this.getRowId(t[_.GT_ROWS][u]))for(var c in t[_.GT_ROWS][u])this.jsonData[l][c]=t[_.GT_ROWS][u][c];this.setState({selectedRows:i},function(){n.createTable(n.jsonData,s)}),this.hidePopup()}},{key:"handlePagination",value:function(e){var t=this,n=e.target.dataset.from,r=this.state,o=r.perPage,a=r.sortedButtons;this.setState({fromRow:parseInt(n),page:parseInt(n/o+1),selectedRows:[],selectedIds:[]},function(){t.createTable(t.jsonData,a)})}},{key:"updatePerPage",value:function(e){var t=this;this.setState({perPage:parseInt(e.target.value)},function(){t.createTable(t.jsonData,t.state.sortedButtons)})}},{key:"showPopup",value:function(e,t){var n=this.state.dataSearch;this.lang=b[this.settings.lang];var o=this.lang.gte_editor_popupheader_create,a=this.lang.gte_editor_sendbtn_create,i={};switch(t){case h.ACTION_RELOAD:var s=this.settings,u=s.ajax,l=s.columns,c=s.tableOpts;c.buttons.map(function(e){e.extended===h.EDITOR_RELOAD&&r(e.triggerBefore)!==_.UNDEFINED&&r(e.triggerBefore)===_.FUNCTION&&e.triggerBefore()});var f=l.length;this.resolveData(u,f),c.buttons.map(function(e){e.extended===h.EDITOR_RELOAD&&r(e.triggerAfter)!==_.UNDEFINED&&r(e.triggerAfter)===_.FUNCTION&&e.triggerAfter()});break;case h.ACTION_EDIT:o=this.lang.gte_editor_popupheader_edit,a=this.lang.gte_editor_sendbtn_update,i=this.setPopUpFields(null!==n?n:this.jsonData);break;case h.ACTION_DELETE:o=this.lang.gte_editor_popupheader_delete,a=this.lang.gte_editor_sendbtn_delete}e.preventDefault(),t!==h.ACTION_RELOAD&&this.setState({action:t,active:!0,popup_title:o,popup_button:a,opacity:1,fieldsEdit:i,shiftDown:!1,ctrlDown:!1})}},{key:"setPopUpFields",value:function(e){var t={},n=this.state.selectedIds;for(var r in n)if(n.hasOwnProperty(r))for(var o in e)e.hasOwnProperty(o)&&this.getRowId(e[o])===n[r]&&(t[r]=e[o]);return t}},{key:"hidePopup",value:function(){this.setState({active:!1})}},{key:"setTableSort",value:function(e,t){var n=this;if(!0!==this.state.discreteFocus){var o=this.settings.columns;if((void 0===t?"undefined":r(t))===_.UNDEFINED){var a=[];this.props.children.forEach(function(e,t){var n=e.props.data;(void 0===n?"undefined":r(n))!==_.UNDEFINED&&o.forEach(function(e,t){e[_.DATA]!==n||r(e[_.SORTABLE])!==_.UNDEFINED&&!0!==e[_.SORTABLE]||(a[n]=0)})}),this.setState({sortButtons:a})}else{this.nowMillis=(new Date).getTime(),this.nowMillis-this.lastTimeKeyup>_.SORT_PERIOD&&this.props.children.forEach(function(t,r){var o=n,a=o.state,i=a.sortButtons,s=a.dataSearch,u=t.props.data,l=o.jsonData,c=[];null!==s&&(l=s),e===u&&(1===i[u]?(c=o.getButtonsState(e,-1),l=n.sortDesc(u,l)):(c=o.getButtonsState(e,1),l=n.sortAsc(u,l)),o.createTable(l,c))}),this.lastTimeKeyup=this.nowMillis}}}},{key:"sortAsc",value:function(e,t){var n=0,r=0;return t.sort(function(t,o){return t=null===t[e]?"":t[e]+"",o=null===o[e]?"":o[e]+"",0===n&&(isNaN(t-o)&&(r=1),n=1),r?t.localeCompare(o):t-o}),t}},{key:"sortDesc",value:function(e,t){var n=0,r=0;return t.sort(function(t,o){return t=null===t[e]?"":t[e]+"",o=null===o[e]?"":o[e]+"",0===n&&(isNaN(t-o)&&(r=1),n=1),r?o.localeCompare(t):o-t}),t}},{key:"doDiscreteSearch",value:function(e){var t=e.keyCode;if(-1===_.SYMBOLLESS_KEYS.indexOf(t)){var n=this,r=e.target.name,o=e.target.value,a=e.target.dataset.index;o.length;this.nowMillis=(new Date).getTime();var i=this.nowMillis-this.lastTimeKeyup;if(this.setState({columnsSearch:Object.assign({},this.state.columnsSearch,p({},r,o))}),""!==o||t!==_.BACKSPACE_KEY&&t!==_.DELETE_KEY){var s=[],u="",l=0,c=this.jsonData;for(var f in c)for(var d in c[f])if(d!==_.GT_ROW_ID&&!0===this.searchableCols[d]&&d===a)if(u=c[f][d]+"",!1===this.discreteSearchableCase[d]){if(-1!==u.toLowerCase().indexOf(o.toLowerCase())){s[l]=c[f],++l;break}}else if(-1!==u.indexOf(o)){s[l]=c[f],++l;break}if(i>_.PERIOD_SEARCH){for(var h in this.tOut)clearTimeout(this.tOut[h]);this.tOut=[],this.c=0,this.createTable(s,this.state.sortedButtons,this.state.selectedRows)}else this.tOut[this.c]=setTimeout(function(){n.createTable(s,n.state.sortedButtons,n.state.selectedRows)},_.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:s}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"setHeads",value:function(){var e=this,t=this.state.sortButtons,n=this.settings.columns,o=[],a=this.settings.struct.editableCells,s=0;return!0===a&&r(this.props.editor)===_.UNDEFINED&&console.error("You trying to use editable cells without editor settings provided. You have 2 options add an editor settings to get editable cells work correctly or set editableCells to false to work with view mode."),!0===a&&(o[s]=i.default.createElement("th",{key:s,style:{cursor:"default"}}),s=1),this.props.children.forEach(function(a,u){var l=a.props.data;if((void 0===l?"undefined":r(l))!==_.UNDEFINED&&!0===e.visibleCols[l]){var c=i.default.Children.only(a),f={key:u+s,sortId:u+"",sortDirection:r(t[l])===_.UNDEFINED?t[l]:0};f.columns=n,f.key=u+s,!0===e.searchableCols[l]&&(f.doDiscreteSearch=e.doDiscreteSearch.bind(e),f.discreteFocus=e.discreteFocus.bind(e),f.discreteBlur=e.discreteBlur.bind(e),f.columnsSearch=e.state.columnsSearch),!0===e.sortableCols[l]&&(f.gteSort=_.SORTABLE,r(t[l])!==_.UNDEFINED&&(f.updateSort=e.setTableSort.bind(e,l),f.sortDirection=t[l])),o[u+s]=i.default.cloneElement(c,f)}}),o}},{key:"discreteFocus",value:function(){this.setState({discreteFocus:!0})}},{key:"discreteBlur",value:function(){this.setState({discreteFocus:!1})}},{key:"setLoader",value:function(e){var t=i.default.createElement(s.default,{selectedRows:("undefined"==typeof selectedRows?"undefined":r(selectedRows))!==_.UNDEFINED?selectedRows:this.state.selectedRows,minRow:0,maxRow:1,key:1,count:1,gteRowId:1},i.default.createElement("td",{colSpan:e},i.default.createElement("div",{style:{textAlign:"center"}},"Loading...")));this.setState({dataRows:t})}},{key:"setSelectedIds",value:function(){var e=[],t=document.querySelectorAll(".active");for(var n in t)r(t[n].dataset)!==_.UNDEFINED&&r(t[n].dataset.realid)!==_.UNDEFINED&&e.push(parseInt(t[n].dataset.realid));this.setState({selectedIds:e})}},{key:"addSelectedRows",value:function(){var e=this,t=this.state,n=t.selectedRows,r=t.shiftDown,o=t.ctrlDown,a=t.arrowUp,i=t.arrowDown,s=t.perPage,u=t.aDown,l=t.searchFocus;if(!0===r&&!0===a&&n.length>0){var c=Math.min.apply(Math,d(n)),f=n;c>0&&(f.push(c-1),this.setState({selectedRows:f},function(){e.createTable(e.jsonData,e.state.sortedButtons)}),this.setSelectedIds())}else if(!0===i&&!0===r&&n.length>0){var p=Math.max.apply(Math,d(n)),_=n;p=t.countRows)){var o="innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight,a=document.body,i=document.documentElement,s=Math.max(a.scrollHeight,a.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight);o+window.pageYOffset>=s?this.setState({fromRow:n+r,scrolledDown:!0},function(){e.createTable(e.jsonData,e.state.sortedButtons)}):this.setState({scrolledDown:!1})}}}]),t}();t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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=function(){function e(e,t){for(var n=0;n=g.MIN_AUTOLOAD_PERIOD&&u<=g.MAX_AUTOLOAD_PERIOD&&setInterval(function(){e.resolveData(i,s,o)},1e3*u)}},{key:"resolveData",value:function(e,t,n){var o=this;null===t&&(r(e.then)===g.FUNCTION?e.then(function(e){o.setAjaxData(e,n)}):this.setAjaxData(e,n))}},{key:"setAjaxData",value:function(e,t){var n=this,o=this.settings.headers,a=new Headers;for(var i in a.append(g.HEADER_CONTENT_TYPE,g.CONTENT_APP_JSON),o)o.hasOwnProperty(i)&&a.append(i,o[i]);fetch(e,{headers:a}).then(function(e){return n.setLoader(t),e.json()}).then(function(e){var t=e.rows?e.rows:e.row;if((void 0===t?"undefined":r(t))===g.UNDEFINED)throw new d.DataException('JSON must contain "rows" field.');n.jsonData=t,n.createTable(t),n.setTableSort()})}},{key:"componentDidMount",value:function(){var e=this,t=this;!0===this.settings.struct.infiniteScroll&&window.addEventListener("scroll",function(t){e.handleScroll()}),!0===this.settings.struct.fixedHeader&&this.fixHeaders(),document.addEventListener("keydown",function(n){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!0})}if(!1===e.state.active){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!0});break;case g.SHIFT_KEY:t.setState({shiftDown:!0});break;case g.ESCAPE_KEY:t.hidePopup();break;case g.ARROW_UP:t.setState({arrowUp:!0});break;case g.ARROW_DOWN:t.setState({arrowDown:!0});break;case g.ARROW_LEFT:t.setState({arrowLeft:!0});break;case g.ARROW_RIGHT:t.setState({arrowRight:!0});break;case g.A_KEY:t.setState({aDown:!0})}t.addSelectedRows(),t.setPagination()}}),document.addEventListener("keyup",function(n){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!1});break;case g.ESCAPE_KEY:t.hidePopup()}if(!1===e.state.active)switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!1});break;case g.SHIFT_KEY:t.setState({shiftDown:!1});break;case g.ARROW_UP:t.setState({arrowUp:!1});break;case g.ARROW_DOWN:t.setState({arrowDown:!1});break;case g.ARROW_LEFT:t.setState({arrowLeft:!1});break;case g.ARROW_RIGHT:t.setState({arrowRight:!1});break;case g.A_KEY:t.setState({aDown:!1})}});var n=this.settings.data;if(null!==n&&(void 0===n?"undefined":r(n))===g.OBJECT){var o=n.rows?n.rows:n.row;if(this.setLoader(this.settings.columns.length),(void 0===o?"undefined":r(o))===g.UNDEFINED)throw new d.DataException('JSON must contain "rows" field.');this.jsonData=o,this.createTable(o),this.setTableSort()}}},{key:"getTools",value:function(e){var t=this.settings,n=t.tableOpts,r=t.perPageRows,o=t.defaultPerPage,i=t.lang,s=t.struct,l=t.data,c=this.state,f=c.selectedRows,d=c.search,p=c.perPage,_=[];return!0===s.download.csv&&(_=this.jsonData),a.default.createElement(u.default,{updatePerPage:this.updatePerPage.bind(this),showPopup:this.showPopup.bind(this),doSearch:this.doSearch.bind(this),searchFocus:this.searchFocus.bind(this),searchBlur:this.searchBlur.bind(this),tableOpts:n,perPageRows:r,perPage:p,defaultPerPage:o,lang:i,selectedRows:f,search:d,struct:s,display:e,jsonData:_,isData:null!==l})}},{key:"getEditor",value:function(e){var t=this.props.editor;if((void 0===t?"undefined":r(t))!==g.UNDEFINED){var n=this.state,o=n.active,i=n.action,s=n.selectedRows,u=n.selectedIds,c=n.opacity,f=n.popup_button,d=n.popup_title,p=n.fieldsEdit,_=this.settings,h=_.tableOpts,b=_.lang,y=_.struct;return a.default.createElement(l.default,{active:o,action:i,editor:t,columns:t.fields,editorUpdate:this.editorUpdate.bind(this),selectedRows:s,selectedIds:u,fieldsEdit:p,opacity:c,popupButton:f,popupTitle:d,hidePopup:this.hidePopup.bind(this),lang:b,struct:y,display:e,tableOpts:h})}}},{key:"getPagination",value:function(e){var t=this.settings,n=t.lang,r=t.struct;if(-1===r.pagination.indexOf(e)||!0===r.infiniteScroll)return"";var o=this.state,i=o.countRows,s=o.page,u=o.perPage,l=o.fromRow;return a.default.createElement(c.default,{updatePagination:this.handlePagination.bind(this),countRows:i,page:s,perPage:u,fromRow:l,lang:n})}},{key:"fixHeaders",value:function(){var e=document.getElementsByTagName("thead")[0],t=(document.getElementsByTagName("tbody")[0],!1),n=e.offsetTop;e.offsetWidth;window.onscroll=function(o){var a=document.getElementsByTagName("tbody")[0].children[0].children,i=window.pageYOffset;if(e.offsetTop-i<=0&&!1===t){e.style.position="fixed",e.style.top="0px",e.style.backgroundColor="#f9f9f9",t=!0;var s=document.getElementsByTagName("thead")[0].childNodes[0].childNodes;for(var u in a)r(s[u])!==g.UNDEFINED&&r(s[u].style)!==g.UNDEFINED&&(s[u].style.width=a[u].offsetWidth)}else!0===t&&i<=n&&(e.style.position="static",e.style.backgroundColor="#fff",t=!1)}}},{key:"rerenderTable",value:function(){var e=this;this.setState({editedCell:""},function(){e.createTable(e.jsonData,e.state.sortButtons,e.state.selectedRows)})}},{key:"render",value:function(){var e=this.setHeads(),t=this.state.dataRows,n=this.settings,r=n.struct,o=n.data;return a.default.createElement("div",{ref:"tableLoaded",className:f.default.gt_container,style:{width:r.width}},a.default.createElement("div",{className:f.default.gt_head_tools},this.getTools(g.DISPLAY_TOP)),a.default.createElement("div",{className:f.default.gt_pagination},this.getPagination(g.DISPLAY_TOP)),a.default.createElement("table",{id:"gigatable",className:f.default.gigatable},a.default.createElement(h.default,null,e),a.default.createElement(p.default,{rerenderTable:this.rerenderTable.bind(this),struct:r},t),a.default.createElement(_.default,null,e)),a.default.createElement("div",{className:f.default.gt_pagination},this.getPagination(g.DISPLAY_BOTTOM)),a.default.createElement("div",{className:f.default.gt_foot_tools},this.getTools(g.DISPLAY_BOTTOM)),null===o?this.getEditor():"")}}]),t}();m.propTypes={editor:i.default.object,settings:i.default.object.isRequired},t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Header=t.Reactables=void 0;var r=a(n(128)),o=a(n(34));function a(e){return e&&e.__esModule?e:{default:e}}t.Reactables=r.default,t.Header=o.default}])}); \ No newline at end of file +!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t-1&&e%1==0&&e-1&&e%1==0&&e<=n}},function(e,t){e.exports=function(e){return e}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n}).call(this,n(72))},function(e,t,n){var r=n(10).Symbol;e.exports=r},function(e,t,n){var r=n(11),o=n(9),a="[object AsyncFunction]",i="[object Function]",s="[object GeneratorFunction]",u="[object Proxy]";e.exports=function(e){if(!o(e))return!1;var t=r(e);return t==i||t==s||t==a||t==u}},function(e,t,n){var r=n(74),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(24);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(25),o=n(20),a=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var i=e[t];a.call(e,t)&&o(i,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t){e.exports=o},function(e,t,n){var r=n(101);"string"==typeof r&&(r=[[e.i,r,""]]);n(32)(r,{});r.locals&&(e.exports=r.locals)},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=0&&u.splice(t,1)}function p(e){var t=document.createElement("style");return t.type="text/css",f(e,t),t}function _(e,t){var n,r,o;if(t.singleton){var a=s++;n=i||(i=p(t)),r=g.bind(null,n,a,!1),o=g.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return t.rel="stylesheet",f(e,t),t}(t),r=function(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}.bind(null,n),o=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=p(t),r=function(e,t){var n=t.css,r=t.media;r&&e.setAttribute("media",r);if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){d(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");void 0===(t=t||{}).singleton&&(t.singleton=o()),void 0===t.insertAt&&(t.insertAt="bottom");var r=c(e);return l(r,t),function(e){for(var o=[],a=0;a=0||(o[n]=e[n]);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,["excludeScrollbar"]));return e.prototype.isReactComponent?n.ref=this.getRef:n.wrappedRef=this.getRef,n.disableOnClickOutside=this.disableOnClickOutside,n.enableOnClickOutside=this.enableOnClickOutside,Object(r.createElement)(e,n)},_}(r.Component),n.displayName="OnClickOutside("+(e.displayName||e.name||"Component")+")",n.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:t&&t.excludeScrollbar||!1,outsideClickIgnoreClass:p,preventDefault:!1,stopPropagation:!1},n.getClass=function(){return e.getClass?e.getClass():e},s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;nc.MORE_PAGES){if(h=c.MORE_PAGES&&h<=_-c.MORE_PAGES){h-1,h+1,g=(h-2)*o,y=h*o;var O=(0,s.default)({gt_page:!0,selected:h===r});m[v]=a.default.createElement("span",{key:v},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),a.default.createElement("div",{"data-from":g,onClick:this.props.updatePagination,className:"gt_page"},h-1),a.default.createElement("div",{"data-from":(h-1)*o,onClick:this.props.updatePagination,className:O},h),a.default.createElement("div",{"data-from":y,onClick:this.props.updatePagination,className:"gt_page"},h+1),a.default.createElement("div",{className:"gt_page_dots"},"..."),a.default.createElement("div",{"data-from":(_-1)*o,onClick:this.props.updatePagination,className:"gt_page"},_));break}if(h>b){for(var T=[],x=b-1;x<_;++x){var R=x*o,j=x-1,P=x+1;h===P&&(g=j*o,j<0&&(g=(_-1)*o),y=P*o,P===_&&(y=0)),w=(0,s.default)({gt_page:!0,selected:x+1===r}),T[x]=a.default.createElement("div",{key:x,onClick:this.props.updatePagination,"data-from":R,className:w},x+1)}m[v]=a.default.createElement("span",{key:v},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),T);break}}else(h=c.MORE_PAGES&&1===b)&&(m[v]=a.default.createElement("div",{key:v,onClick:this.props.updatePagination,"data-from":v*o,className:w},E))}if(_>0&&0===m.length)for(var C=0;C<_;++C){var k=C+1,D=(0,s.default)({gt_page:!0,selected:k===r});m[C]=a.default.createElement("div",{key:C,onClick:this.props.updatePagination,"data-from":C*o,className:D},k)}var S=1===r?o*(_-1):o*(r-2),I=r===_?0:o*r,A=0===n?0:p+1,N=r*o,M=i.showing+" "+A+" "+i.to+" "+(N>n?n:N)+" "+i.of+" "+n+" "+i.entries+".";return 0===n&&(M=i.no_entries),a.default.createElement("div",{className:u.default.gt_pagination},a.default.createElement("div",{className:u.default.gt_pgn_ttl},M),a.default.createElement("div",{className:u.default.gt_pgn_pages},a.default.createElement("div",{className:u.default.gt_pagn},a.default.createElement("div",{"data-from":S,onClick:this.props.updatePagination,className:l},i.prev),m,a.default.createElement("div",{"data-from":I,onClick:this.props.updatePagination,className:d},i.next))),a.default.createElement("div",{className:u.default.clear}))}}]),t}();d.propTypes={page:i.default.number,perPage:i.default.number,countRows:i.default.number,fromRow:i.default.number},t.default=d},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(41)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(16),o=n(42),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))a.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){(function(e){var r=n(21),o="object"==typeof t&&t&&!t.nodeType&&t,a=o&&"object"==typeof e&&e&&!e.nodeType&&e,i=a&&a.exports===o&&r.process,s=function(){try{var e=a&&a.require&&a.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}).call(this,n(15)(e))},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(11),o=n(18),a=n(7),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,e.exports=function(e){return a(e)&&o(e.length)&&!!i[r(e)]}},function(e,t,n){var r=n(46),o=n(45),a=n(44),i=a&&a.isTypedArray,s=i?o(i):r;e.exports=s},function(e,t){e.exports=function(){return!1}},function(e,t,n){(function(e){var r=n(10),o=n(48),a="object"==typeof t&&t&&!t.nodeType&&t,i=a&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===a?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||o;e.exports=u}).call(this,n(15)(e))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){var r=n(11),o=n(7),a="[object Arguments]";e.exports=function(e){return o(e)&&r(e)==a}},function(e,t,n){var r=n(51),o=n(7),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=u},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t,n){var r=n(58),o=n(24),a=n(19),i=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:a;e.exports=i},function(e,t,n){var r=n(59),o=n(57)(r);e.exports=o},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(61),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var a=arguments,i=-1,s=o(a.length-t,0),u=Array(s);++i1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,s&&o(n[0],n[1],s)&&(i=a<3?void 0:i,a=1),t=Object(t);++r0&&(n=this.setFieldsetFields(n)),n}},{key:"setEditFields",value:function(e){var t=this,n=[];return e.forEach(function(e,r){t.setFieldsets(r,e),n[r]=t.getFieldByType(r,e)}),this.fieldsetClose>0&&(n=this.setFieldsetFields(n)),n}},{key:"setFieldsets",value:function(e,t){if(o(t.fieldsetOpen)!==T.UNDEFINED){if(o(t.legend)===T.UNDEFINED)throw new l.EditorException('the "legend" property must be specified within fieldsetOpen');this.fieldsetOpen=e,this.fieldsetLegend=t.legend}o(t.fieldsetClose)!==T.UNDEFINED&&(this.fieldsetClose=e)}},{key:"setFieldsetFields",value:function(e){var t=this,n=[];e.forEach(function(e,r){r>=t.fieldsetOpen&&r<=t.fieldsetClose&&(n[r]=e)});var r=[];return r.push(e.slice(0,this.fieldsetOpen)),r.push(s.default.createElement("div",{key:0,className:"gte_editor_fields"},s.default.createElement("fieldset",null,s.default.createElement("legend",null,this.fieldsetLegend),n))),r.push(e.slice(this.fieldsetClose+1)),r}},{key:"setDeleteFields",value:function(e){var t=[],n=0;this.state.dataIndices=this.props.selectedIds,this.props.selectedIds.forEach(function(e,r){t[r]=s.default.createElement("input",{key:r,type:"hidden","data-value":e,name:"ids[]",value:e}),n=r});var r=(0,c.t)(this.lang.gte_editor_delete_popup,{rows:e.length});return t.push(s.default.createElement("div",{key:++n,className:"gte_msg"},r)),t}},{key:"onFocus",value:function(e){var t=this.state.setMultipleText,n=this.props.tableOpts,r=!1;o(e.target.dataset.multiple)!==T.UNDEFINED&&!0===e.target.dataset.multiple&&0===t&&(document.querySelectorAll("input").value=""),(o(e.target.dataset.textarea)!==T.UNDEFINED&&e.target.dataset.textarea===T.STR_TRUE||o(e.target.children[0])!==T.UNDEFINED&&o(e.target.children[0].getAttribute("data-contents"))!==T.UNDEFINED&&e.target.children[0].getAttribute("data-contents")===T.STR_TRUE)&&(r=!0),n.theme===T.THEME_MATERIAL_UI&&"TEXTAREA"===e.target.nodeName&&(r=!0),this.setState({setMultipleText:1,isTextArea:r})}},{key:"onChange",value:function(e){var t=this.state.setMultipleText,n=e.target.dataset.multiple&&0===t?"":e.target.value;if(e.target.type===x.TYPE_CHECKBOX){var a={};o(this.state.dataIndices[e.target.name])!==T.UNDEFINED?a[e.target.name]=r({},this.state.dataIndices[e.target.name]):a[e.target.name]={},a[e.target.name][e.target.value]=e.target.checked,this.setState({dataIndices:a,setMultipleText:1})}else this.setState({dataIndices:Object.assign({},this.state.dataIndices,O({},e.target.name,n)),setMultipleText:1})}},{key:"fileUpload",value:function(){if(o(this.filesInput.files)!==T.UNDEFINED){var e=this.props.editor.ajaxFiles,t=new FormData,n=this.filesInput.files;for(var r in n)n.hasOwnProperty(r)&&n[r]instanceof File&&t.append(r,n[r]);d.default.post(e).send(t).end(function(e,t){e?(console.log("Error has occurred while uploading files: "),console.log(e)):t.ok})}}},{key:"onChangeHtml",value:function(e,t){this.setState({dataIndices:Object.assign({},this.state.dataIndices,O({},e.props.name,t))})}},{key:"getFieldByType",value:function(e,t){var n=this,a=this.state,i=a.dataIndices,u=a.setMultipleText,l=this.props,c=l.action,f=l.fieldsEdit,d=l.tableOpts,g=Object.keys(f).length>1,w=t.type,O=t.name,R=t.label,j=t.defaultValue,P="",C={};o(t.attrs)!==T.UNDEFINED&&(C=t.attrs),!0===g&&0===u?P=this.lang.gte_editor_multiple_rows:c===x.ACTION_EDIT?P=o(i[O])!==T.UNDEFINED?i[O]:!0===g?"":f[0][O]:c===x.ACTION_CREATE&&(o(i[O])!==T.UNDEFINED?P=i[O]:(void 0===j?"undefined":o(j))!==T.UNDEFINED&&(P=j)),null===P&&(P="");var k={};switch(w){case x.TYPE_TEXT:case x.TYPE_HIDDEN:case x.TYPE_EMAIL:case x.TYPE_PASSWORD:k=s.default.createElement(y.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:C,id:O,type:w,name:O,value:P,isMultiple:g,theme:d.theme});break;case x.TYPE_COLOR:case x.TYPE_DATE:case x.TYPE_DATETIME:case x.TYPE_NUMBER:case x.TYPE_RANGE:case x.TYPE_SEARCH:case x.TYPE_TIME:case x.TYPE_TEL:case x.TYPE_URL:case x.TYPE_MONTH:case x.TYPE_WEEK:k=s.default.createElement(p.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:C,id:O,type:w,name:O,value:P});break;case x.TYPE_FILE:k=s.default.createElement("input",r({ref:function(e){n.filesInput=e}},C,{id:O,type:w,name:O,value:void 0}));break;case x.TYPE_TEXTAREA:k=o(t.plugins)!==T.UNDEFINED&&-1!==t.plugins.indexOf(x.PLUGINS_RTE)?s.default.createElement(_.default,{key:0,onFocus:this.onFocus.bind(this),onChangeHtml:this.onChangeHtml.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,isMultiple:g,"data-textarea":!0}):s.default.createElement(E.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,isMultiple:g,"data-textarea":!0,theme:d.theme});break;case x.TYPE_SELECT:k=o(t.plugins)!==T.UNDEFINED&&-1!==t.plugins.indexOf(x.PLUGINS_REACT_SELECT)?s.default.createElement(b.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,pluginProps:t.pluginProps}):s.default.createElement(m.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,objectValues:t.values,theme:d.theme});break;case x.TYPE_CHECKBOX:case x.TYPE_RADIO:k=s.default.createElement(v.default,{key:0,onChange:this.onChange.bind(this),id:O,type:w,name:O,label:R,value:P,attributes:C,objectValues:t.values,theme:d.theme})}return[s.default.createElement(h.default,{key:0,id:O,label:R,type:w},k)]}},{key:"triggerBefore",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerBefore)!==T.UNDEFINED&&t.triggerBefore()})}},{key:"triggerAfter",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerAfter)!==T.UNDEFINED&&t.triggerAfter()})}},{key:"btnClicked",value:function(e){var t=this;e.persist();var n=this.props,r=n.action,a=n.editorUpdate,i=n.fieldsEdit,s=n.editor,u=this.state.dataIndices,c=this.getAjaxSettings(r),f=c.url,d=u,p={};if(p[T.HEADER_CONTENT_TYPE]=T.CONTENT_APP_JSON,r===x.ACTION_CREATE){this.triggerBefore(x.EDITOR_CREATE),this.fileUpload(),o(u.id)!==T.UNDEFINED&&delete u.id,o(u[T.GT_ROW_ID])!==T.UNDEFINED&&delete u[T.GT_ROW_ID];var _={};s.fields.forEach(function(e){o(e.defaultValue)!==T.UNDEFINED&&o(u[e.name])===T.UNDEFINED?_[e.name]=e.defaultValue:o(u[e.name])!==T.UNDEFINED&&(_[e.name]=u[e.name])}),p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(_),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[T.GT_ROW].id)===T.UNDEFINED)throw new l.DataException("The `id` field is required to return in response from server/back-end.");for(var r in n[T.GT_ROW])n[T.GT_ROW].hasOwnProperty(r)&&(d[r]=n[T.GT_ROW][r]);d[T.GT_ROW_ID]=n[T.GT_ROW].id,a(e,d),t.triggerAfter(x.EDITOR_CREATE)}).catch(function(e){console.error(e.message)})}else if(r===x.ACTION_EDIT){this.triggerBefore(x.EDITOR_EDIT),this.fileUpload();var h=[];for(var b in i)i.hasOwnProperty(b)&&(h[b]=j({},i[b],u));p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(h),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[T.GT_ROWS])===T.UNDEFINED||o(n[T.GT_ROWS][0])===T.UNDEFINED||o(n[T.GT_ROWS][0].id)===T.UNDEFINED)throw new l.DataException("The `id` field is required to return in response from server/back-end.");a(e,n),t.triggerAfter(x.EDITOR_EDIT)}).catch(function(e){console.error(e.message)})}else r===x.ACTION_DELETE&&(this.triggerBefore(x.EDITOR_REMOVE),p=this.setHeaders(c,p),fetch(f,{method:c.method,body:JSON.stringify(u),headers:p}).then(function(e){return e.json()}).then(function(){a(e,d),t.triggerAfter(x.EDITOR_REMOVE)}))}},{key:"setHeaders",value:function(e,t){for(var n in e.headers)e.headers.hasOwnProperty(n)&&(t[n]=e.headers[n]);return t}},{key:"getAjaxSettings",value:function(e){var t=this.props.editor;if(o(t.ajax)===T.STRING){var n=x.HTTP_METHOD_POST;return e===x.ACTION_EDIT?n=x.HTTP_METHOD_PUT:e===x.ACTION_DELETE&&(n=x.HTTP_METHOD_DELETE),{url:t.ajax,method:n}}if(o(t.ajax)===T.OBJECT&&o(t.ajax[e])!==T.UNDEFINED&&o(t.ajax[e].url)!==T.UNDEFINED)return{url:t.ajax[e].url,method:t.ajax[e].type,headers:t.ajax[e].headers};throw new l.EditorException('"ajax" property must be set either as string url or object with "'+e+'" and "url", "type" properties set-up respectively.')}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"btnClickedEnter",value:function(e){e.keyCode===T.ENTER_KEY&&!1===this.state.isTextArea&&document.getElementById("gte_sent_btn").click()}},{key:"resetFields",value:function(){var e=this;setTimeout(function(){e.setState({dataIndices:{}}),e.setDataIndices(e.props)},300)}},{key:"render",value:function(){var e=this.props,t=e.hidePopup,n=e.popupTitle,r=e.action,o=e.popupButton,a=e.active,i=e.tableOpts;!1===a?this.resetFields():this.setFields(this.props);var u=(0,f.default)({gte_editor_popup:!0,fade_in:a,fade_out:!a}),l=(0,f.default)({gte_popup_background:!0,fade_in:a,fade_out:!a}),c=(0,f.default)({gte_form_fields:!0,gte_form_fields_delete:r===x.ACTION_DELETE});return s.default.createElement("div",null,s.default.createElement("div",{onClick:t,className:u},s.default.createElement("div",{className:"gte_popup_container"},s.default.createElement("div",{className:"gte_popup_container_wrapper"},s.default.createElement("div",{onKeyUp:this.btnClickedEnter.bind(this),onClick:this.stopPropagation.bind(this),className:"gte_form_border_box"},s.default.createElement("div",{className:"close_btn",onClick:function(){t()}}),s.default.createElement("div",{className:c},s.default.createElement("div",{className:"gte_header"},s.default.createElement("div",{className:"gte_editor_title"},n)),s.default.createElement("div",{className:"gte_form_body"},s.default.createElement("div",{className:"gte_form_body_content"},s.default.createElement("form",{id:"gte_form",action:"",method:"post"},s.default.createElement("div",{className:"gte_form_content"},s.default.createElement("div",null,s.default.createElement("input",{type:"hidden",name:"action",value:r})),s.default.createElement("div",null,this.fields))))),s.default.createElement("div",{className:"gte_footer"},s.default.createElement("div",{className:"gte_form_err"}),s.default.createElement("div",{className:"gte_form_buttons"},s.default.createElement(g.default,{"data-action":r,action:r,btnClicked:this.btnClicked.bind(this),theme:i.theme},o)))))))),s.default.createElement("div",{onClick:function(){t()},className:l}))}}]),t}();P.propTYpes={active:u.default.bool.isRequired,editor:u.default.object.isRequired,action:u.default.string.isRequired,popupTitle:u.default.string.isRequired,popupButton:u.default.string.isRequired,editorUpdate:u.default.func.isRequired,selectedIds:u.default.array.isRequired},P.defaultProps={pluginProps:{}},t.default=P},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&-1!==a.buttonsPosition.indexOf(s)&&a.buttons.map(function(e,o){switch(e[b.EXTENDED]){case b.EDITOR_CSV:c!==h.UNDEFINED&&r(d.download)!==h.UNDEFINED&&!0===d.download.csv&&(_[o]=i.default.createElement(l.default,{active:!1,jsonData:c,key:o},p.editor_csv));break;case b.EDITOR_RELOAD:_[o]=i.default.createElement(u.default,{active:!1,action:b.ACTION_RELOAD,showPopup:n,isReload:!0,key:o,theme:a.theme},p.editor_reload);break;case b.EDITOR_CREATE:_[o]=i.default.createElement(f.default,{active:!1,action:b.ACTION_CREATE,showPopup:n,key:o,incr:o,theme:a.theme,selectedRows:t},p.editor_create);break;case b.EDITOR_EDIT:_[o]=i.default.createElement(f.default,{active:!(t.length>=1),action:b.ACTION_EDIT,showPopup:n,key:o,theme:a.theme,incr:o,selectedRows:t},p.editor_edit);break;case b.EDITOR_REMOVE:_[o]=i.default.createElement(f.default,{active:0===t.length,selectedRows:t,action:b.ACTION_DELETE,showPopup:n,key:o,incr:o,theme:a.theme},p.editor_remove)}}),_}},{key:"render",value:function(){var e=this.props.isData;return i.default.createElement("div",{className:"gt_head_tools"},e?"":this.getButtons(),this.getPagesSelection(),this.getSearch(),i.default.createElement("div",{className:c.default.clear}))}}]),t}();y.propTypes={updatePerPage:s.default.func.isRequired,perPageRows:s.default.array,doSearch:s.default.func,tableOpts:s.default.object,showPopup:s.default.func,defaultPerPage:s.default.number,perPage:s.default.number,search:s.default.string,selectedRows:s.default.array,lang:s.default.string},t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&t<20,progress_bar_color_orange:t>=20&&t<40,progress_bar_color_yellow:t>=40&&t<60,progress_bar_color_light_green:t>=60&&t<80,progress_bar_color_green:t>=80,progress_bar_none:null===t||t===c.UNDEFINED}),s={height:(void 0===n?"undefined":r(n))===c.UNDEFINED?10:n,width:(t>100?100:t)+"%"},l=(null===t?0:t>100?100:t)+"%";return i.default.createElement("div",{className:"progress_bar_container"},i.default.createElement("div",{"data-percent":t,style:s,className:a},i.default.createElement("div",{className:"progress_bar_percent"},i.default.createElement("div",{className:"progress_bar_percent_child"},!0===o?l:" "))))}}]),t}();f.defaultProps={height:10,percent:0,showPercent:!0},f.propTypes={percent:s.default.any,height:s.default.number},t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0}},{key:"render",value:function(){var e=this.props,t=e.count,n=e.selectedRows,r=e.children,o=e.gteRowId,i=e.minRow,u=e.maxRow,l=e.clickedRow,c=e.editableCells,f=(0,s.default)({even:t%2==0,odd:t%2!=0,active:-1!==n.indexOf(t)});return a.default.createElement("tr",{key:o,className:f,"data-selectedrows":n,onClick:!1===c?l:void 0,"data-minrow":i,"data-maxrow":u,"data-rowid":t,"data-realid":o},r)}}]),t}();l.propTypes={gteRowId:i.default.number.isRequired,count:i.default.number.isRequired,minRow:i.default.number,maxRow:i.default.number,selectedRows:i.default.array},t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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=function(){function e(e,t){for(var n=0;n_.PERIOD_SEARCH){for(var d in this.tOut)clearTimeout(this.tOut[d]);this.tOut=[],this.c=0,this.createTable(i,this.state.sortedButtons,this.state.selectedRows),this.setState({page:1})}else this.tOut[this.c]=setTimeout(function(){n.createTable(i,n.state.sortedButtons,n.state.selectedRows),n.setState({page:1})},_.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:i,selectedIds:[],selectedRows:[]}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"searchBlur",value:function(){this.setState({searchFocus:!1})}},{key:"searchFocus",value:function(){this.setState({searchFocus:!0})}},{key:"createTable",value:function(e,t,n){var o=this,a=this.state,l=a.dataSearch,c=a.perPage,f=a.fromRow,d=a.minRow,p=a.maxRow,b=a.scrolledDown,g=a.editedCell,y=this.settings.struct.editableCells,m=this.settings.struct.aggregateFooter,v=[];null!==l&&(e=l);var E=e;if(e.length>c){var w=parseInt(f),O=w+parseInt(c);E=!0===b?e.slice(0,O):e.slice(w,O)}E.forEach(function(e,t){var a,l=[];a=o.getRowId(e),!0===y&&l.push(i.default.createElement(u.default,{editRow:o.editRow.bind(o),dataIndex:h.EDITABLE_CELLS_INDEX,selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,count:t,gteRowId:a,key:-1,editableCells:y})),o.props.children.forEach(function(s,c){var f=s.props.data;if((void 0===f?"undefined":r(f))!==_.UNDEFINED&&!0===o.visibleCols[f]){var h=null;h=r(o.customColumns[f])!==_.UNDEFINED&&r(o.customColumns[f])===_.FUNCTION?o.customColumns[f](e[f],e,f):e[f],l.push(i.default.createElement(u.default,{dataIndex:f,selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,count:t,gteRowId:a,key:c,editableCells:y,editedCell:g,editor:o.props.editor,editCell:o.editCell.bind(o),editorUpdate:o.editorUpdate.bind(o),cell:""+t+c,plugins:o.plugins[f]},h))}}),v.push(i.default.createElement(s.default,{clickedRow:o.clickedRow.bind(o),selectedRows:(void 0===n?"undefined":r(n))!==_.UNDEFINED?n:o.state.selectedRows,minRow:d,maxRow:p,key:t,count:t,gteRowId:a,editableCells:y},l))}),!0===m&&this.setFooter(E,v);var T={dataRows:v,countRows:e.length};(void 0===t?"undefined":r(t))!==_.UNDEFINED&&(T.sortButtons=t),this.setState(T)}},{key:"setFooter",value:function(e,t){var n=this,o=this.settings.columns,a=this.state,s=a.footerCounted,c=a.footerSum,f=a.footerAvg,d=a.footerMinLength,p=a.footerMaxLength,h=a.footerFrequency,b=0,g=0,y=0,m=0,v=[],E="";!0===s?(b=c,g=f,y=d,m=p,v=h):this.jsonData.forEach(function(e){n.props.children.forEach(function(t){var n=t.props.data;o.forEach(function(t){if(t[_.DATA]===n&&t[_.FOOTER]!==_.UNDEFINED){var o=e[n];switch(t[_.FOOTER]){case _.FOOTER_SUM:b+=parseFloat(o);break;case _.FOOTER_AVG:g+=parseFloat(o);break;case _.FOOTER_MIN_LENGTH:var a=o.length;(y>a||0===y)&&(y=a);break;case _.FOOTER_MAX_LENGTH:var i=o.length;(m0?b:0));break;case _.FOOTER_AVG:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},g>0?g/e.length:0));break;case _.FOOTER_MIN_LENGTH:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},y));break;case _.FOOTER_MAX_LENGTH:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},m));break;case _.FOOTER_FREQUENCY:var o=0;for(var s in v)0===o&&(E=s),v[s]>v[E]&&(E=s),++o;w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},E));break;default:w.push(i.default.createElement(u.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1}," "))}})}),!1===s&&this.setState({footerCounted:!0,footerSum:b,footerAvg:g,footerMinLength:y,footerMaxLength:m,footerFrequency:E}),t.push(i.default.createElement(l.default,{key:-1},w))}},{key:"getRowId",value:function(e){var t=0;if(r(e[_.GT_ROW_ID])!==_.UNDEFINED)t=e[_.GT_ROW_ID];else{if(r(e.id)===_.UNDEFINED)throw new c.DataException('You have neither "GT_RowId" nor "id" in json structure.');t=e.id}return t}},{key:"clickedRow",value:function(e){var t=this,n=this.state,o=n.selectedRows,a=n.selectedIds,i=n.sortedButtons,s=n.ctrlDown,u=n.shiftDown,l=e.target.dataset,c=l.rowid,f=l.realid,d=o,p=a,h=0,b=0,g=parseInt(c),y=parseInt(f),m=d.indexOf(g);if(d.length>0&&-1!==m&&!0===s){var v=p.indexOf(y);d.splice(m,1),p.splice(v,1)}else if(!0===s)d.push(parseInt(c)),p.push(parseInt(f));else if(!0===u){for(var E in d.push(parseInt(c)),p.push(parseInt(f)),h=d[0],b=d[0],d)d[E]b&&(b=d[E]);d=[];for(var w=h;w<=b;++w)d.push(w)}else d=[parseInt(c)],p=[parseInt(f)];this.createTable(this.jsonData,i,d),this.setState({selectedRows:d,selectedIds:p},function(){if(!0===u){var e=document.querySelectorAll("tr.active"),n=[];for(var o in e)r(e[o].dataset)!==_.UNDEFINED&&n.push(parseInt(e[o].dataset.realid));t.setState({selectedIds:n})}})}},{key:"editRow",value:function(e){this.clickedRow(e)}},{key:"editCell",value:function(e){var t=this;this.setState({editedCell:e.target.dataset.cell},function(){t.createTable(t.jsonData,t.state.sortedButtons)})}},{key:"getButtonsState",value:function(e,t){var n=this.state.sortButtons,r=[];for(var o in n)r[o]=n[o],o===e&&(r[o]=t);return r}},{key:"editorUpdate",value:function(e,t){var n=this,r=e.target.dataset.action,o=0,a=this.state,i=a.selectedRows,s=a.sortedButtons;if(r===h.ACTION_DELETE)!function(){var e=n.state.dataSearch,r=function(r){for(var a in n.jsonData)o=n.getRowId(n.jsonData[a]),t[r]===o&&(i.splice(i.indexOf(a),1),delete n.jsonData[a],null!==e&&e.forEach(function(o,a){parseInt(n.getRowId(o))===parseInt(t[r])&&delete e[a]}))};for(var a in t)r(a)}();else if(r===h.ACTION_CREATE)this.jsonData.unshift(t);else if(r===h.ACTION_EDIT)for(var u in 0===i.length&&(i[0]=e.target.dataset.rowid),t[_.GT_ROWS])for(var l in this.jsonData)if(this.getRowId(this.jsonData[l])===this.getRowId(t[_.GT_ROWS][u]))for(var c in t[_.GT_ROWS][u])this.jsonData[l][c]=t[_.GT_ROWS][u][c];this.setState({selectedRows:i},function(){n.createTable(n.jsonData,s)}),this.hidePopup()}},{key:"handlePagination",value:function(e){var t=this,n=e.target.dataset.from,r=this.state,o=r.perPage,a=r.sortedButtons;this.setState({fromRow:parseInt(n),page:parseInt(n/o+1),selectedRows:[],selectedIds:[]},function(){t.createTable(t.jsonData,a)})}},{key:"updatePerPage",value:function(e){var t=this;this.setState({perPage:parseInt(e.target.value)},function(){t.createTable(t.jsonData,t.state.sortedButtons)})}},{key:"showPopup",value:function(e,t){var n=this.state.dataSearch;this.lang=b[this.settings.lang];var o=this.lang.gte_editor_popupheader_create,a=this.lang.gte_editor_sendbtn_create,i={};switch(t){case h.ACTION_RELOAD:var s=this.settings,u=s.ajax,l=s.columns,c=s.tableOpts;c.buttons.map(function(e){e.extended===h.EDITOR_RELOAD&&r(e.triggerBefore)!==_.UNDEFINED&&r(e.triggerBefore)===_.FUNCTION&&e.triggerBefore()});var f=l.length;this.resolveData(u,f),c.buttons.map(function(e){e.extended===h.EDITOR_RELOAD&&r(e.triggerAfter)!==_.UNDEFINED&&r(e.triggerAfter)===_.FUNCTION&&e.triggerAfter()});break;case h.ACTION_EDIT:o=this.lang.gte_editor_popupheader_edit,a=this.lang.gte_editor_sendbtn_update,i=this.setPopUpFields(null!==n?n:this.jsonData);break;case h.ACTION_DELETE:o=this.lang.gte_editor_popupheader_delete,a=this.lang.gte_editor_sendbtn_delete}e.preventDefault(),t!==h.ACTION_RELOAD&&this.setState({action:t,active:!0,popup_title:o,popup_button:a,opacity:1,fieldsEdit:i,shiftDown:!1,ctrlDown:!1})}},{key:"setPopUpFields",value:function(e){var t={},n=this.state.selectedIds;for(var r in n)if(n.hasOwnProperty(r))for(var o in e)e.hasOwnProperty(o)&&this.getRowId(e[o])===n[r]&&(t[r]=e[o]);return t}},{key:"hidePopup",value:function(){this.setState({active:!1})}},{key:"setTableSort",value:function(e,t){var n=this;if(!0!==this.state.discreteFocus){var o=this.settings.columns;if((void 0===t?"undefined":r(t))===_.UNDEFINED){var a=[];this.props.children.forEach(function(e,t){var n=e.props.data;(void 0===n?"undefined":r(n))!==_.UNDEFINED&&o.forEach(function(e,t){e[_.DATA]!==n||r(e[_.SORTABLE])!==_.UNDEFINED&&!0!==e[_.SORTABLE]||(a[n]=0)})}),this.setState({sortButtons:a})}else{this.nowMillis=(new Date).getTime(),this.nowMillis-this.lastTimeKeyup>_.SORT_PERIOD&&this.props.children.forEach(function(t,r){var o=n,a=o.state,i=a.sortButtons,s=a.dataSearch,u=t.props.data,l=o.jsonData,c=[];null!==s&&(l=s),e===u&&(1===i[u]?(c=o.getButtonsState(e,-1),l=n.sortDesc(u,l)):(c=o.getButtonsState(e,1),l=n.sortAsc(u,l)),o.createTable(l,c))}),this.lastTimeKeyup=this.nowMillis}}}},{key:"sortAsc",value:function(e,t){var n=0,r=0;return t.sort(function(t,o){return t=null===t[e]?"":t[e]+"",o=null===o[e]?"":o[e]+"",0===n&&(isNaN(t-o)&&(r=1),n=1),r?t.localeCompare(o):t-o}),t}},{key:"sortDesc",value:function(e,t){var n=0,r=0;return t.sort(function(t,o){return t=null===t[e]?"":t[e]+"",o=null===o[e]?"":o[e]+"",0===n&&(isNaN(t-o)&&(r=1),n=1),r?o.localeCompare(t):o-t}),t}},{key:"doDiscreteSearch",value:function(e){var t=e.keyCode;if(-1===_.SYMBOLLESS_KEYS.indexOf(t)){var n=this,r=e.target.name,o=e.target.value,a=e.target.dataset.index;o.length;this.nowMillis=(new Date).getTime();var i=this.nowMillis-this.lastTimeKeyup;if(this.setState({columnsSearch:Object.assign({},this.state.columnsSearch,p({},r,o))}),""!==o||t!==_.BACKSPACE_KEY&&t!==_.DELETE_KEY){var s=[],u="",l=0,c=this.jsonData;for(var f in c)for(var d in c[f])if(d!==_.GT_ROW_ID&&!0===this.searchableCols[d]&&d===a)if(u=c[f][d]+"",!1===this.discreteSearchableCase[d]){if(-1!==u.toLowerCase().indexOf(o.toLowerCase())){s[l]=c[f],++l;break}}else if(-1!==u.indexOf(o)){s[l]=c[f],++l;break}if(i>_.PERIOD_SEARCH){for(var h in this.tOut)clearTimeout(this.tOut[h]);this.tOut=[],this.c=0,this.createTable(s,this.state.sortedButtons,this.state.selectedRows)}else this.tOut[this.c]=setTimeout(function(){n.createTable(s,n.state.sortedButtons,n.state.selectedRows)},_.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:s}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"setHeads",value:function(){var e=this,t=this.state.sortButtons,n=this.settings.columns,o=[],a=this.settings.struct.editableCells,s=0;return!0===a&&r(this.props.editor)===_.UNDEFINED&&console.error("You trying to use editable cells without editor settings provided. You have 2 options add an editor settings to get editable cells work correctly or set editableCells to false to work with view mode."),!0===a&&(o[s]=i.default.createElement("th",{key:s,style:{cursor:"default"}}),s=1),this.props.children.forEach(function(a,u){var l=a.props.data;if((void 0===l?"undefined":r(l))!==_.UNDEFINED&&!0===e.visibleCols[l]){var c=i.default.Children.only(a),f={key:u+s,sortId:u+"",sortDirection:r(t[l])===_.UNDEFINED?t[l]:0};f.columns=n,f.key=u+s,!0===e.searchableCols[l]&&(f.doDiscreteSearch=e.doDiscreteSearch.bind(e),f.discreteFocus=e.discreteFocus.bind(e),f.discreteBlur=e.discreteBlur.bind(e),f.columnsSearch=e.state.columnsSearch),!0===e.sortableCols[l]&&(f.gteSort=_.SORTABLE,r(t[l])!==_.UNDEFINED&&(f.updateSort=e.setTableSort.bind(e,l),f.sortDirection=t[l])),o[u+s]=i.default.cloneElement(c,f)}}),o}},{key:"discreteFocus",value:function(){this.setState({discreteFocus:!0})}},{key:"discreteBlur",value:function(){this.setState({discreteFocus:!1})}},{key:"setLoader",value:function(e){var t=i.default.createElement(s.default,{selectedRows:("undefined"==typeof selectedRows?"undefined":r(selectedRows))!==_.UNDEFINED?selectedRows:this.state.selectedRows,minRow:0,maxRow:1,key:1,count:1,gteRowId:1},i.default.createElement("td",{colSpan:e},i.default.createElement("div",{style:{textAlign:"center"}},"Loading...")));this.setState({dataRows:t})}},{key:"setSelectedIds",value:function(){var e=[],t=document.querySelectorAll(".active");for(var n in t)r(t[n].dataset)!==_.UNDEFINED&&r(t[n].dataset.realid)!==_.UNDEFINED&&e.push(parseInt(t[n].dataset.realid));this.setState({selectedIds:e})}},{key:"addSelectedRows",value:function(){var e=this,t=this.state,n=t.selectedRows,r=t.shiftDown,o=t.ctrlDown,a=t.arrowUp,i=t.arrowDown,s=t.perPage,u=t.aDown,l=t.searchFocus;if(!0===r&&!0===a&&n.length>0){var c=Math.min.apply(Math,d(n)),f=n;c>0&&(f.push(c-1),this.setState({selectedRows:f},function(){e.createTable(e.jsonData,e.state.sortedButtons)}),this.setSelectedIds())}else if(!0===i&&!0===r&&n.length>0){var p=Math.max.apply(Math,d(n)),_=n;p=t.countRows)){var o="innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight,a=document.body,i=document.documentElement,s=Math.max(a.scrollHeight,a.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight);o+window.pageYOffset>=s?this.setState({fromRow:n+r,scrolledDown:!0},function(){e.createTable(e.jsonData,e.state.sortedButtons)}):this.setState({scrolledDown:!1})}}}]),t}();t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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=function(){function e(e,t){for(var n=0;n=g.MIN_AUTOLOAD_PERIOD&&u<=g.MAX_AUTOLOAD_PERIOD&&setInterval(function(){e.resolveData(i,s,o)},1e3*u)}},{key:"resolveData",value:function(e,t,n){var o=this;null===t&&(r(e.then)===g.FUNCTION?e.then(function(e){o.setAjaxData(e,n)}):this.setAjaxData(e,n))}},{key:"setAjaxData",value:function(e,t){var n=this,o=this.settings.headers,a=new Headers;for(var i in a.append(g.HEADER_CONTENT_TYPE,g.CONTENT_APP_JSON),o)o.hasOwnProperty(i)&&a.append(i,o[i]);fetch(e,{headers:a}).then(function(e){return n.setLoader(t),e.json()}).then(function(e){var t=e.rows?e.rows:e.row;if((void 0===t?"undefined":r(t))===g.UNDEFINED)throw new d.DataException('JSON must contain "rows" field.');n.jsonData=t,n.createTable(t),n.setTableSort()})}},{key:"componentDidMount",value:function(){var e=this,t=this;!0===this.settings.struct.infiniteScroll&&window.addEventListener("scroll",function(t){e.handleScroll()}),!0===this.settings.struct.fixedHeader&&this.fixHeaders(),document.addEventListener("keydown",function(n){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!0})}if(!1===e.state.active){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!0});break;case g.SHIFT_KEY:t.setState({shiftDown:!0});break;case g.ESCAPE_KEY:t.hidePopup();break;case g.ARROW_UP:t.setState({arrowUp:!0});break;case g.ARROW_DOWN:t.setState({arrowDown:!0});break;case g.ARROW_LEFT:t.setState({arrowLeft:!0});break;case g.ARROW_RIGHT:t.setState({arrowRight:!0});break;case g.A_KEY:t.setState({aDown:!0})}t.addSelectedRows(),t.setPagination()}}),document.addEventListener("keyup",function(n){switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!1});break;case g.ESCAPE_KEY:t.hidePopup()}if(!1===e.state.active)switch(n.which){case g.CTRL_KEY:case g.CTRL_KEY_MAC_CHROME:case g.CTRL_KEY_MAC_FF:t.setState({ctrlDown:!1});break;case g.SHIFT_KEY:t.setState({shiftDown:!1});break;case g.ARROW_UP:t.setState({arrowUp:!1});break;case g.ARROW_DOWN:t.setState({arrowDown:!1});break;case g.ARROW_LEFT:t.setState({arrowLeft:!1});break;case g.ARROW_RIGHT:t.setState({arrowRight:!1});break;case g.A_KEY:t.setState({aDown:!1})}});var n=this.settings.data;if(null!==n&&(void 0===n?"undefined":r(n))===g.OBJECT){var o=n.rows?n.rows:n.row;if(this.setLoader(this.settings.columns.length),(void 0===o?"undefined":r(o))===g.UNDEFINED)throw new d.DataException('JSON must contain "rows" field.');this.jsonData=o,this.createTable(o),this.setTableSort()}}},{key:"getTools",value:function(e){var t=this.settings,n=t.tableOpts,r=t.perPageRows,o=t.defaultPerPage,i=t.lang,s=t.struct,l=t.data,c=this.state,f=c.selectedRows,d=c.search,p=c.perPage,_=[];return!0===s.download.csv&&(_=this.jsonData),a.default.createElement(u.default,{updatePerPage:this.updatePerPage.bind(this),showPopup:this.showPopup.bind(this),doSearch:this.doSearch.bind(this),searchFocus:this.searchFocus.bind(this),searchBlur:this.searchBlur.bind(this),tableOpts:n,perPageRows:r,perPage:p,defaultPerPage:o,lang:i,selectedRows:f,search:d,struct:s,display:e,jsonData:_,isData:null!==l})}},{key:"getEditor",value:function(e){var t=this.props.editor;if((void 0===t?"undefined":r(t))!==g.UNDEFINED){var n=this.state,o=n.active,i=n.action,s=n.selectedRows,u=n.selectedIds,c=n.opacity,f=n.popup_button,d=n.popup_title,p=n.fieldsEdit,_=this.settings,h=_.tableOpts,b=_.lang,y=_.struct;return a.default.createElement(l.default,{active:o,action:i,editor:t,columns:t.fields,editorUpdate:this.editorUpdate.bind(this),selectedRows:s,selectedIds:u,fieldsEdit:p,opacity:c,popupButton:f,popupTitle:d,hidePopup:this.hidePopup.bind(this),lang:b,struct:y,display:e,tableOpts:h})}}},{key:"getPagination",value:function(e){var t=this.settings,n=t.lang,r=t.struct;if(-1===r.pagination.indexOf(e)||!0===r.infiniteScroll)return"";var o=this.state,i=o.countRows,s=o.page,u=o.perPage,l=o.fromRow;return a.default.createElement(c.default,{updatePagination:this.handlePagination.bind(this),countRows:i,page:s,perPage:u,fromRow:l,lang:n})}},{key:"fixHeaders",value:function(){var e=document.getElementsByTagName("thead")[0],t=(document.getElementsByTagName("tbody")[0],!1),n=e.offsetTop;e.offsetWidth;window.onscroll=function(o){var a=document.getElementsByTagName("tbody")[0].children[0].children,i=window.pageYOffset;if(e.offsetTop-i<=0&&!1===t){e.style.position="fixed",e.style.top="0px",e.style.backgroundColor="#f9f9f9",t=!0;var s=document.getElementsByTagName("thead")[0].childNodes[0].childNodes;for(var u in a)r(s[u])!==g.UNDEFINED&&r(s[u].style)!==g.UNDEFINED&&(s[u].style.width=a[u].offsetWidth)}else!0===t&&i<=n&&(e.style.position="static",e.style.backgroundColor="#fff",t=!1)}}},{key:"rerenderTable",value:function(){var e=this;this.setState({editedCell:""},function(){e.createTable(e.jsonData,e.state.sortButtons,e.state.selectedRows)})}},{key:"render",value:function(){var e=this.setHeads(),t=this.state.dataRows,n=this.settings,r=n.struct,o=n.data;return a.default.createElement("div",{ref:"tableLoaded",className:f.default.gt_container,style:{width:r.width}},a.default.createElement("div",{className:f.default.gt_head_tools},this.getTools(g.DISPLAY_TOP)),a.default.createElement("div",{className:f.default.gt_pagination},this.getPagination(g.DISPLAY_TOP)),a.default.createElement("table",{id:"gigatable",className:f.default.gigatable},a.default.createElement(h.default,null,e),a.default.createElement(p.default,{rerenderTable:this.rerenderTable.bind(this),struct:r},t),a.default.createElement(_.default,null,e)),a.default.createElement("div",{className:f.default.gt_pagination},this.getPagination(g.DISPLAY_BOTTOM)),a.default.createElement("div",{className:f.default.gt_foot_tools},this.getTools(g.DISPLAY_BOTTOM)),null===o?this.getEditor():"")}}]),t}();m.propTypes={editor:i.default.object,settings:i.default.object.isRequired},t.default=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Header=t.Reactables=void 0;var r=a(n(128)),o=a(n(34));function a(e){return e&&e.__esModule?e:{default:e}}t.Reactables=r.default,t.Header=o.default}])}); \ No newline at end of file