diff --git a/build/index.js b/build/index.js index 6e661f9..0291aaf 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(73))},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]",l="[object Proxy]";e.exports=function(e){if(!o(e))return!1;var t=r(e);return t==i||t==s||t==a||t==l}},function(e,t,n){var r=n(75),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(22);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(23),o=n(18),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,n){var r=n(86);"string"==typeof r&&(r=[[e.i,r,""]]);n(28)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.DataException=function(e){this.message=e,this.name="DataException"},t.EditorException=function(e){this.message=e,this.name="EditorException"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&(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)!==w.UNDEFINED){if(o(t.legend)===w.UNDEFINED)throw new u.EditorException('the "legend" property must be specified within fieldsetOpen');this.fieldsetOpen=e,this.fieldsetLegend=t.legend}o(t.fieldsetClose)!==w.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=!1;o(e.target.dataset.multiple)!==w.UNDEFINED&&!0===e.target.dataset.multiple&&0===t&&(document.querySelectorAll("input").value=""),(o(e.target.dataset.textarea)!==w.UNDEFINED&&e.target.dataset.textarea===w.STR_TRUE||o(e.target.children[0])!==w.UNDEFINED&&o(e.target.children[0].getAttribute("data-contents"))!==w.UNDEFINED&&e.target.children[0].getAttribute("data-contents")===w.STR_TRUE)&&(n=!0),this.setState({setMultipleText:1,isTextArea:n})}},{key:"onChange",value:function(e){var t=this.state.setMultipleText,n=e.target.dataset.multiple&&0===t?"":e.target.value;this.setState({dataIndices:Object.assign({},this.state.dataIndices,v({},e.target.name,n)),setMultipleText:1})}},{key:"fileUpload",value:function(){if(o(this.filesInput.files)!==w.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]);f.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,v({},e.props.name,t))})}},{key:"getFieldByType",value:function(e,t){var n=this,a=this.state,i=a.dataIndices,l=a.setMultipleText,u=this.props,c=u.action,d=u.fieldsEdit,f=Object.keys(d).length>1,m=t.type,v=t.name,x=t.label,T=t.defaultValue,R="",D={};o(t.attrs)!==w.UNDEFINED&&(D=t.attrs),!0===f&&0===l?R=this.lang.gte_editor_multiple_rows:c===O.ACTION_EDIT?R=o(i[v])!==w.UNDEFINED?i[v]:!0===f?"":d[0][v]:c===O.ACTION_CREATE&&(o(i[v])!==w.UNDEFINED?R=i[v]:(void 0===T?"undefined":o(T))!==w.UNDEFINED&&(R=T)),null===R&&(R="");var C={};switch(m){case O.TYPE_TEXT:case O.TYPE_HIDDEN:case O.TYPE_EMAIL:case O.TYPE_PASSWORD:C=s.default.createElement(p.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:D,id:v,type:m,name:v,value:R,isMultiple:f});break;case O.TYPE_COLOR:case O.TYPE_DATE:case O.TYPE_DATETIME:case O.TYPE_NUMBER:case O.TYPE_RANGE:case O.TYPE_SEARCH:case O.TYPE_TIME:case O.TYPE_TEL:case O.TYPE_URL:case O.TYPE_MONTH:case O.TYPE_WEEK:C=s.default.createElement(_.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:D,id:v,type:m,name:v,value:R});break;case O.TYPE_FILE:C=s.default.createElement("input",r({ref:function(e){n.filesInput=e}},D,{id:v,type:m,name:v,value:void 0}));break;case O.TYPE_TEXTAREA:C=o(t.plugins)!==w.UNDEFINED&&-1!==t.plugins.indexOf(O.PLUGINS_RTE)?s.default.createElement(y.default,{key:0,onFocus:this.onFocus.bind(this),onChangeHtml:this.onChangeHtml.bind(this),id:v,type:m,name:v,label:x,value:R,attributes:D,isMultiple:f,"data-textarea":!0}):s.default.createElement(h.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),id:v,type:m,name:v,label:x,value:R,attributes:D,isMultiple:f,"data-textarea":!0});break;case O.TYPE_SELECT:C=s.default.createElement(b.default,{key:0,onChange:this.onChange.bind(this),id:v,type:m,name:v,label:x,value:R,attributes:D,objectValues:t.values});break;case O.TYPE_CHECKBOX:case O.TYPE_RADIO:C=s.default.createElement(g.default,{key:0,onChange:this.onChange.bind(this),id:v,type:m,name:v,label:x,value:R,attributes:D,objectValues:t.values})}return[s.default.createElement(E.default,{key:0,id:v,label:x,type:m},C)]}},{key:"triggerBefore",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerBefore)!==w.UNDEFINED&&t.triggerBefore()})}},{key:"triggerAfter",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerAfter)!==w.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,l=this.state.dataIndices,c=this.getAjaxSettings(r),d=c.url,f=l,p={};if(p[w.HEADER_CONTENT_TYPE]=w.CONTENT_APP_JSON,r===O.ACTION_CREATE){this.triggerBefore(O.EDITOR_CREATE),this.fileUpload(),o(l.id)!==w.UNDEFINED&&delete l.id,o(l[w.GT_ROW_ID])!==w.UNDEFINED&&delete l[w.GT_ROW_ID];var _={};s.fields.forEach(function(e){o(e.defaultValue)!==w.UNDEFINED&&o(l[e.name])===w.UNDEFINED?_[e.name]=e.defaultValue:o(l[e.name])!==w.UNDEFINED&&(_[e.name]=l[e.name])}),p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(_),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[w.GT_ROW].id)===w.UNDEFINED)throw new u.DataException("The `id` field is required to return in response from server/back-end.");for(var r in n[w.GT_ROW])n[w.GT_ROW].hasOwnProperty(r)&&(f[r]=n[w.GT_ROW][r]);f[w.GT_ROW_ID]=n[w.GT_ROW].id,a(e,f),t.triggerAfter(O.EDITOR_CREATE)}).catch(function(e){console.error(e.message)})}else if(r===O.ACTION_EDIT){this.triggerBefore(O.EDITOR_EDIT),this.fileUpload();var h=[];for(var b in i)i.hasOwnProperty(b)&&(h[b]=T({},i[b],l));p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(h),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[w.GT_ROWS])===w.UNDEFINED||o(n[w.GT_ROWS][0])===w.UNDEFINED||o(n[w.GT_ROWS][0].id)===w.UNDEFINED)throw new u.DataException("The `id` field is required to return in response from server/back-end.");a(e,n),t.triggerAfter(O.EDITOR_EDIT)}).catch(function(e){console.error(e.message)})}else r===O.ACTION_DELETE&&(this.triggerBefore(O.EDITOR_REMOVE),p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(l),headers:p}).then(function(e){return e.json()}).then(function(){a(e,f),t.triggerAfter(O.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)===w.STRING){var n=O.HTTP_METHOD_POST;return e===O.ACTION_EDIT?n=O.HTTP_METHOD_PUT:e===O.ACTION_DELETE&&(n=O.HTTP_METHOD_DELETE),{url:t.ajax,method:n}}if(o(t.ajax)===w.OBJECT&&o(t.ajax[e])!==w.UNDEFINED&&o(t.ajax[e].url)!==w.UNDEFINED)return{url:t.ajax[e].url,method:t.ajax[e].type,headers:t.ajax[e].headers};throw new u.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===w.ENTER_KEY&&!1===this.state.isTextArea&&document.getElementById("gte_sent_btn").click()}},{key:"render",value:function(){var e=this.props,t=e.hidePopup,n=e.popupTitle,r=e.action,o=e.popupButton,a=e.active;this.setFields(this.props);var i=(0,d.default)({gte_editor_popup:!0,fade_in:a,fade_out:!a}),l=(0,d.default)({gte_popup_background:!0,fade_in:a,fade_out:!a}),u=(0,d.default)({gte_form_fields:!0,gte_form_fields_delete:r===O.ACTION_DELETE});return s.default.createElement("div",null,s.default.createElement("div",{onClick:t,className:i},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:t}),s.default.createElement("div",{className:u},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("button",{id:"gte_sent_btn",className:"btn","data-action":r,onClick:this.btnClicked.bind(this)},o)))))))),s.default.createElement("div",{onClick:t,className:l}))}}]),t}();R.propTYpes={active:l.default.bool.isRequired,editor:l.default.object.isRequired,action:l.default.string.isRequired,popupTitle:l.default.string.isRequired,popupButton:l.default.string.isRequired,editorUpdate:l.default.func.isRequired,selectedIds:l.default.array.isRequired},R.defaultProps={pluginProps:{}},t.default=R},function(e,t){var n={},r=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},o=r(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),a=r(function(){return document.head||document.getElementsByTagName("head")[0]}),i=null,s=0,l=[];function u(e,t){for(var r=0;r=0&&l.splice(t,1)}function p(e){var t=document.createElement("style");return t.type="text/css",d(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",d(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(){f(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(){f(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 u(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});E[m]=a.default.createElement("span",{key:m},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 x=[],T=b-1;T<_;++T){var R=T*o,D=T-1,C=T+1;h===C&&(g=D*o,D<0&&(g=(_-1)*o),y=C*o,C===_&&(y=0)),w=(0,s.default)({gt_page:!0,selected:T+1===r}),x[T]=a.default.createElement("div",{key:T,onClick:this.props.updatePagination,"data-from":R,className:w},T+1)}E[m]=a.default.createElement("span",{key:m},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),x);break}}else(h=c.MORE_PAGES&&1===b)&&(E[m]=a.default.createElement("div",{key:m,onClick:this.props.updatePagination,"data-from":m*o,className:w},v))}if(_>0&&0===E.length)for(var I=0;I<_;++I){var A=I+1,k=(0,s.default)({gt_page:!0,selected:A===r});E[I]=a.default.createElement("div",{key:I,onClick:this.props.updatePagination,"data-from":I*o,className:k},A)}var S=1===r?o*(_-1):o*(r-2),N=r===_?0:o*r,j=0===n?0:p+1,P=r*o,M=i.showing+" "+j+" "+i.to+" "+(P>n?n:P)+" "+i.of+" "+n+" "+i.entries+".";return 0===n&&(M=i.no_entries),a.default.createElement("div",{className:l.default.gt_pagination},a.default.createElement("div",{className:l.default.gt_pgn_ttl},M),a.default.createElement("div",{className:l.default.gt_pgn_pages},a.default.createElement("div",{className:l.default.gt_pagn},a.default.createElement("div",{"data-from":S,onClick:this.props.updatePagination,className:u},i.prev),E,a.default.createElement("div",{"data-from":N,onClick:this.props.updatePagination,className:f},i.next))),a.default.createElement("div",{className:l.default.clear}))}}]),t}();f.propTypes={page:i.default.number,perPage:i.default.number,countRows:i.default.number,fromRow:i.default.number},t.default=f},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;n0&&-1!==a.buttonsPosition.indexOf(s)&&a.buttons.map(function(e,o){switch(e[h.EXTENDED]){case h.EDITOR_CSV:u!==_.UNDEFINED&&r(c.download)!==_.UNDEFINED&&!0===c.download.csv&&(p[o]=i.default.createElement(d.default,{active:!1,jsonData:u,key:o},f.editor_csv));break;case h.EDITOR_RELOAD:p[o]=i.default.createElement(l.default,{active:!1,action:h.ACTION_RELOAD,showPopup:n,isReload:!0,key:o},f.editor_reload);break;case h.EDITOR_CREATE:p[o]=i.default.createElement(l.default,{active:!1,action:h.ACTION_CREATE,showPopup:n,key:o},f.editor_create);break;case h.EDITOR_EDIT:p[o]=i.default.createElement(l.default,{active:!(t.length>=1),selectedRows:t,action:h.ACTION_EDIT,showPopup:n,key:o},f.editor_edit);break;case h.EDITOR_REMOVE:p[o]=i.default.createElement(l.default,{active:0===t.length,selectedRows:t,action:h.ACTION_DELETE,showPopup:n,key:o},f.editor_remove)}}),p}},{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:f.default.clear}))}}]),t}();g.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=g},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(42)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(14),o=n(43),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(19),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{return i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}).call(this,n(13)(e))},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(11),o=n(16),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(47),o=n(46),a=n(45),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(49),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,l=(s?s.isBuffer:void 0)||o;e.exports=l}).call(this,n(13)(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(52),o=n(7),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},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(59),o=n(22),a=n(17),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(60),o=n(58)(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(62),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),l=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&&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)+"%"},u=(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?u:" "))))}}]),t}();d.defaultProps={height:10,percent:0,showPercent:!0},d.propTypes={percent:s.default.any,height:s.default.number},t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;tp.PERIOD_SEARCH){for(var _ in this.tOut)clearTimeout(this.tOut[_]);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)},p.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:i,selectedIds:[],selectedRows:[]}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"createTable",value:function(e,t,n){var o=this,a=this.state,u=a.dataSearch,c=a.perPage,d=a.fromRow,f=a.minRow,h=a.maxRow,b=a.scrolledDown,g=a.editedCell,y=this.settings.struct.editableCells,E=this.settings.struct.aggregateFooter,m=[];null!==u&&(e=u);var v=e;if(e.length>c){var w=parseInt(d),O=w+parseInt(c);v=!0===b?e.slice(0,O):e.slice(w,O)}v.forEach(function(e,t){var a,u=[];a=o.getRowId(e),!0===y&&u.push(i.default.createElement(l.default,{editRow:o.editRow.bind(o),dataIndex:_.EDITABLE_CELLS_INDEX,selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,count:t,gteRowId:a,key:-1,editableCells:y})),o.props.children.forEach(function(s,c){var d=s.props.data;if((void 0===d?"undefined":r(d))!==p.UNDEFINED&&!0===o.visibleCols[d]){var _=null;_=r(o.customColumns[d])!==p.UNDEFINED&&r(o.customColumns[d])===p.FUNCTION?o.customColumns[d](e[d],e,d):e[d],u.push(i.default.createElement(l.default,{dataIndex:d,selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,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[d]},_))}}),m.push(i.default.createElement(s.default,{clickedRow:o.clickedRow.bind(o),selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,key:t,count:t,gteRowId:a,editableCells:y},u))}),!0===E&&this.setFooter(v,m);var x={dataRows:m,countRows:e.length};(void 0===t?"undefined":r(t))!==p.UNDEFINED&&(x.sortButtons=t),this.setState(x)}},{key:"setFooter",value:function(e,t){var n=this,o=this.settings.columns,a=this.state,s=a.footerCounted,c=a.footerSum,d=a.footerAvg,f=a.footerMinLength,_=a.footerMaxLength,h=a.footerFrequency,b=0,g=0,y=0,E=0,m=[],v="";!0===s?(b=c,g=d,y=f,E=_,m=h):this.jsonData.forEach(function(e){n.props.children.forEach(function(t){var n=t.props.data;o.forEach(function(t){if(t[p.DATA]===n&&t[p.FOOTER]!==p.UNDEFINED){var o=e[n];switch(t[p.FOOTER]){case p.FOOTER_SUM:b+=parseFloat(o);break;case p.FOOTER_AVG:g+=parseFloat(o);break;case p.FOOTER_MIN_LENGTH:var a=o.length;(y>a||0===y)&&(y=a);break;case p.FOOTER_MAX_LENGTH:var i=o.length;(E0?b:0));break;case p.FOOTER_AVG:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},g>0?g/e.length:0));break;case p.FOOTER_MIN_LENGTH:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},y));break;case p.FOOTER_MAX_LENGTH:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},E));break;case p.FOOTER_FREQUENCY:var o=0;for(var s in m)0===o&&(v=s),m[s]>m[v]&&(v=s),++o;w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},v));break;default:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1}," "))}})}),!1===s&&this.setState({footerCounted:!0,footerSum:b,footerAvg:g,footerMinLength:y,footerMaxLength:E,footerFrequency:v}),t.push(i.default.createElement(u.default,{key:-1},w))}},{key:"getRowId",value:function(e){var t=0;if(r(e[p.GT_ROW_ID])!==p.UNDEFINED)t=e[p.GT_ROW_ID];else{if(r(e.id)===p.UNDEFINED)throw new 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,l=n.shiftDown,u=e.target.dataset,c=u.rowid,d=u.realid,f=o,_=a,h=0,b=0,g=parseInt(c),y=parseInt(d),E=f.indexOf(g);if(f.length>0&&-1!==E&&!0===s){var m=_.indexOf(y);f.splice(E,1),_.splice(m,1)}else if(!0===s)f.push(parseInt(c)),_.push(parseInt(d));else if(!0===l){for(var v in f.push(parseInt(c)),_.push(parseInt(d)),h=f[0],b=f[0],f)f[v]b&&(b=f[v]);f=[];for(var w=h;w<=b;++w)f.push(w)}else f=[parseInt(c)],_=[parseInt(d)];this.createTable(this.jsonData,i,f),this.setState({selectedRows:f,selectedIds:_},function(){if(!0===l){var e=document.querySelectorAll("tr.active"),n=[];for(var o in e)r(e[o].dataset)!==p.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,o=e.target.dataset.action,a=0,i=this.state,s=i.selectedRows,l=i.sortedButtons;if(o===_.ACTION_DELETE)!function(){var e=n.state.dataSearch,o=function(o){for(var i in n.jsonData)r(n.jsonData[i][p.GT_ROW_ID])!==p.UNDEFINED?a=n.jsonData[i][p.GT_ROW_ID]:r(n.jsonData[i].id)!==p.UNDEFINED&&(a=n.jsonData[i].id),t[o]===a&&(s.splice(s.indexOf(i),1),delete n.jsonData[i],null!==e&&e.forEach(function(n,r){parseInt(n[p.GT_ROW_ID])===parseInt(t[o])&&delete e[r]}))};for(var i in t)o(i)}();else if(o===_.ACTION_CREATE)this.jsonData.unshift(t);else if(o===_.ACTION_EDIT)for(var u in 0===s.length&&(s[0]=e.target.dataset.rowid),t[p.GT_ROWS])for(var c in this.jsonData)if(this.jsonData[c][p.GT_ROW_ID]===t[p.GT_ROWS][u][p.GT_ROW_ID])for(var d in t[p.GT_ROWS][u])this.jsonData[c][d]=t[p.GT_ROWS][u][d];this.setState({selectedRows:s},function(){n.createTable(n.jsonData,l)}),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){var t=this.state,n=t.selectedRows,o=t.dataSearch,a=t.selectedIds;this.lang=h[this.settings.lang];var i=e.target.dataset.action,s=this.lang.gte_editor_popupheader_create,l=this.lang.gte_editor_sendbtn_create,u={};switch(i){case _.ACTION_RELOAD:var c=this.settings,d=c.ajax,f=c.columns,b=c.tableOpts;b.buttons.map(function(e){e.extended===_.EDITOR_RELOAD&&r(e.triggerBefore)!==p.UNDEFINED&&r(e.triggerBefore)===p.FUNCTION&&e.triggerBefore()});var g=f.length;this.resolveData(d,g),b.buttons.map(function(e){e.extended===_.EDITOR_RELOAD&&r(e.triggerAfter)!==p.UNDEFINED&&r(e.triggerAfter)===p.FUNCTION&&e.triggerAfter()});break;case _.ACTION_EDIT:if(s=this.lang.gte_editor_popupheader_edit,l=this.lang.gte_editor_sendbtn_update,null!==o)for(var y in n)n.hasOwnProperty(y)&&(u[y]=o[n[y]]);else for(var E in a)if(a.hasOwnProperty(E))for(var m in this.jsonData)this.jsonData.hasOwnProperty(m)&&this.jsonData[m][p.GT_ROW_ID]===a[E]&&(u[E]=this.jsonData[m]);break;case _.ACTION_DELETE:s=this.lang.gte_editor_popupheader_delete,l=this.lang.gte_editor_sendbtn_delete}e.preventDefault(),i!==_.ACTION_RELOAD&&this.setState({action:i,active:!0,popup_title:s,popup_button:l,opacity:1,fieldsEdit:u,shiftDown:!1,ctrlDown:!1})}},{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))===p.UNDEFINED){var a=[];this.props.children.forEach(function(e,t){var n=e.props.data;(void 0===n?"undefined":r(n))!==p.UNDEFINED&&o.forEach(function(e,t){e[p.DATA]!==n||r(e[p.SORTABLE])!==p.UNDEFINED&&!0!==e[p.SORTABLE]||(a[n]=0)})}),this.setState({sortButtons:a})}else{this.nowMillis=(new Date).getTime(),this.nowMillis-this.lastTimeKeyup>p.SORT_PERIOD&&this.props.children.forEach(function(t,r){var o=n,a=o.state,i=a.sortButtons,s=a.dataSearch,l=t.props.data,u=o.jsonData,c=[];null!==s&&(u=s),e===l&&(1===i[l]?(c=o.getButtonsState(e,-1),u=n.sortDesc(l,u)):(c=o.getButtonsState(e,1),u=n.sortAsc(l,u)),o.createTable(u,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===p.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,f({},r,o))}),""!==o||t!==p.BACKSPACE_KEY&&t!==p.DELETE_KEY){var s=[],l="",u=0,c=this.jsonData;for(var d in c)for(var _ in c[d])if(_!==p.GT_ROW_ID&&!0===this.searchableCols[_]&&_===a)if(l=c[d][_]+"",!1===this.discreteSearchableCase[_]){if(-1!==l.toLowerCase().indexOf(o.toLowerCase())){s[u]=c[d],++u;break}}else if(-1!==l.indexOf(o)){s[u]=c[d],++u;break}if(i>p.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)},p.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)===p.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,l){var u=a.props.data;if((void 0===u?"undefined":r(u))!==p.UNDEFINED&&!0===e.visibleCols[u]){var c=i.default.Children.only(a),d={key:l+s,sortId:l+"",sortDirection:r(t[u])===p.UNDEFINED?t[u]:0};d.columns=n,d.key=l+s,!0===e.searchableCols[u]&&(d.doDiscreteSearch=e.doDiscreteSearch.bind(e),d.discreteFocus=e.discreteFocus.bind(e),d.discreteBlur=e.discreteBlur.bind(e),d.columnsSearch=e.state.columnsSearch),!0===e.sortableCols[u]&&(d.gteSort=p.SORTABLE,r(t[u])!==p.UNDEFINED&&(d.updateSort=e.setTableSort.bind(e,u),d.sortDirection=t[u])),o[l+s]=i.default.cloneElement(c,d)}}),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))!==p.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)!==p.UNDEFINED&&r(t[n].dataset.realid)!==p.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,l=t.aDown;if(!0===r&&!0===a&&n.length>0){var u=Math.min.apply(Math,d(n)),c=n;u>0&&(c.push(u-1),this.setState({selectedRows:c},function(){e.createTable(e.jsonData,e.state.sortedButtons)}),this.setSelectedIds())}else if(!0===i&&!0===r&&n.length>0){var f=Math.max.apply(Math,d(n)),p=n;f=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=b},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&&l<=g.MAX_AUTOLOAD_PERIOD&&setInterval(function(){e.resolveData(i,s,o)},1e3*l)}},{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 f.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 f.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,u=t.data,c=this.state,d=c.selectedRows,f=c.search,p=c.perPage,_=[];return!0===s.download.csv&&(_=this.jsonData),a.default.createElement(l.default,{updatePerPage:this.updatePerPage.bind(this),showPopup:this.showPopup.bind(this),doSearch:this.doSearch.bind(this),tableOpts:n,perPageRows:r,perPage:p,defaultPerPage:o,lang:i,selectedRows:d,search:f,struct:s,display:e,jsonData:_,isData:null!==u})}},{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,l=n.selectedIds,c=n.opacity,d=n.popup_button,f=n.popup_title,p=n.fieldsEdit,_=this.settings,h=_.tableOpts,b=_.lang,y=_.struct;return a.default.createElement(u.default,{active:o,action:i,editor:t,columns:t.fields,editorUpdate:this.editorUpdate.bind(this),selectedRows:s,selectedIds:l,fieldsEdit:p,opacity:c,popupButton:d,popupTitle:f,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,l=o.perPage,u=o.fromRow;return a.default.createElement(c.default,{updatePagination:this.handlePagination.bind(this),countRows:i,page:s,perPage:l,fromRow:u,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 l in a)r(s[l])!==g.UNDEFINED&&r(s[l].style)!==g.UNDEFINED&&(s[l].style.width=a[l].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:d.default.gt_container,style:{width:r.width}},a.default.createElement("div",{className:d.default.gt_head_tools},this.getTools(g.DISPLAY_TOP)),a.default.createElement("div",{className:d.default.gt_pagination},this.getPagination(g.DISPLAY_TOP)),a.default.createElement("table",{id:"gigatable",className:d.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:d.default.gt_pagination},this.getPagination(g.DISPLAY_BOTTOM)),a.default.createElement("div",{className:d.default.gt_foot_tools},this.getTools(g.DISPLAY_BOTTOM)),null===o?this.getEditor():"")}}]),t}();E.propTypes={editor:i.default.object,settings:i.default.object.isRequired},t.default=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Header=t.Reactables=void 0;var r=a(n(101)),o=a(n(30));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(73))},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]",l="[object Proxy]";e.exports=function(e){if(!o(e))return!1;var t=r(e);return t==i||t==s||t==a||t==l}},function(e,t,n){var r=n(75),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(22);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(23),o=n(18),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,n){var r=n(86);"string"==typeof r&&(r=[[e.i,r,""]]);n(28)(r,{});r.locals&&(e.exports=r.locals)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.DataException=function(e){this.message=e,this.name="DataException"},t.EditorException=function(e){this.message=e,this.name="EditorException"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&(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)!==w.UNDEFINED){if(o(t.legend)===w.UNDEFINED)throw new u.EditorException('the "legend" property must be specified within fieldsetOpen');this.fieldsetOpen=e,this.fieldsetLegend=t.legend}o(t.fieldsetClose)!==w.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=!1;o(e.target.dataset.multiple)!==w.UNDEFINED&&!0===e.target.dataset.multiple&&0===t&&(document.querySelectorAll("input").value=""),(o(e.target.dataset.textarea)!==w.UNDEFINED&&e.target.dataset.textarea===w.STR_TRUE||o(e.target.children[0])!==w.UNDEFINED&&o(e.target.children[0].getAttribute("data-contents"))!==w.UNDEFINED&&e.target.children[0].getAttribute("data-contents")===w.STR_TRUE)&&(n=!0),this.setState({setMultipleText:1,isTextArea:n})}},{key:"onChange",value:function(e){var t=this.state.setMultipleText,n=e.target.dataset.multiple&&0===t?"":e.target.value;this.setState({dataIndices:Object.assign({},this.state.dataIndices,v({},e.target.name,n)),setMultipleText:1})}},{key:"fileUpload",value:function(){if(o(this.filesInput.files)!==w.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]);f.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,v({},e.props.name,t))})}},{key:"getFieldByType",value:function(e,t){var n=this,a=this.state,i=a.dataIndices,l=a.setMultipleText,u=this.props,c=u.action,d=u.fieldsEdit,f=Object.keys(d).length>1,E=t.type,v=t.name,x=t.label,T=t.defaultValue,R="",D={};o(t.attrs)!==w.UNDEFINED&&(D=t.attrs),!0===f&&0===l?R=this.lang.gte_editor_multiple_rows:c===O.ACTION_EDIT?R=o(i[v])!==w.UNDEFINED?i[v]:!0===f?"":d[0][v]:c===O.ACTION_CREATE&&(o(i[v])!==w.UNDEFINED?R=i[v]:(void 0===T?"undefined":o(T))!==w.UNDEFINED&&(R=T)),null===R&&(R="");var C={};switch(E){case O.TYPE_TEXT:case O.TYPE_HIDDEN:case O.TYPE_EMAIL:case O.TYPE_PASSWORD:C=s.default.createElement(p.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:D,id:v,type:E,name:v,value:R,isMultiple:f});break;case O.TYPE_COLOR:case O.TYPE_DATE:case O.TYPE_DATETIME:case O.TYPE_NUMBER:case O.TYPE_RANGE:case O.TYPE_SEARCH:case O.TYPE_TIME:case O.TYPE_TEL:case O.TYPE_URL:case O.TYPE_MONTH:case O.TYPE_WEEK:C=s.default.createElement(_.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),attributes:D,id:v,type:E,name:v,value:R});break;case O.TYPE_FILE:C=s.default.createElement("input",r({ref:function(e){n.filesInput=e}},D,{id:v,type:E,name:v,value:void 0}));break;case O.TYPE_TEXTAREA:C=o(t.plugins)!==w.UNDEFINED&&-1!==t.plugins.indexOf(O.PLUGINS_RTE)?s.default.createElement(y.default,{key:0,onFocus:this.onFocus.bind(this),onChangeHtml:this.onChangeHtml.bind(this),id:v,type:E,name:v,label:x,value:R,attributes:D,isMultiple:f,"data-textarea":!0}):s.default.createElement(h.default,{key:0,onFocus:this.onFocus.bind(this),onChange:this.onChange.bind(this),id:v,type:E,name:v,label:x,value:R,attributes:D,isMultiple:f,"data-textarea":!0});break;case O.TYPE_SELECT:C=s.default.createElement(b.default,{key:0,onChange:this.onChange.bind(this),id:v,type:E,name:v,label:x,value:R,attributes:D,objectValues:t.values});break;case O.TYPE_CHECKBOX:case O.TYPE_RADIO:C=s.default.createElement(g.default,{key:0,onChange:this.onChange.bind(this),id:v,type:E,name:v,label:x,value:R,attributes:D,objectValues:t.values})}return[s.default.createElement(m.default,{key:0,id:v,label:x,type:E},C)]}},{key:"triggerBefore",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerBefore)!==w.UNDEFINED&&t.triggerBefore()})}},{key:"triggerAfter",value:function(e){this.props.tableOpts.buttons.map(function(t){t.extended===e&&o(t.triggerAfter)!==w.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,l=this.state.dataIndices,c=this.getAjaxSettings(r),d=c.url,f=l,p={};if(p[w.HEADER_CONTENT_TYPE]=w.CONTENT_APP_JSON,r===O.ACTION_CREATE){this.triggerBefore(O.EDITOR_CREATE),this.fileUpload(),o(l.id)!==w.UNDEFINED&&delete l.id,o(l[w.GT_ROW_ID])!==w.UNDEFINED&&delete l[w.GT_ROW_ID];var _={};s.fields.forEach(function(e){o(e.defaultValue)!==w.UNDEFINED&&o(l[e.name])===w.UNDEFINED?_[e.name]=e.defaultValue:o(l[e.name])!==w.UNDEFINED&&(_[e.name]=l[e.name])}),p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(_),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[w.GT_ROW].id)===w.UNDEFINED)throw new u.DataException("The `id` field is required to return in response from server/back-end.");for(var r in n[w.GT_ROW])n[w.GT_ROW].hasOwnProperty(r)&&(f[r]=n[w.GT_ROW][r]);f[w.GT_ROW_ID]=n[w.GT_ROW].id,a(e,f),t.triggerAfter(O.EDITOR_CREATE)}).catch(function(e){console.error(e.message)})}else if(r===O.ACTION_EDIT){this.triggerBefore(O.EDITOR_EDIT),this.fileUpload();var h=[];for(var b in i)i.hasOwnProperty(b)&&(h[b]=T({},i[b],l));p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(h),headers:p}).then(function(e){return e.json()}).then(function(n){if(o(n[w.GT_ROWS])===w.UNDEFINED||o(n[w.GT_ROWS][0])===w.UNDEFINED||o(n[w.GT_ROWS][0].id)===w.UNDEFINED)throw new u.DataException("The `id` field is required to return in response from server/back-end.");a(e,n),t.triggerAfter(O.EDITOR_EDIT)}).catch(function(e){console.error(e.message)})}else r===O.ACTION_DELETE&&(this.triggerBefore(O.EDITOR_REMOVE),p=this.setHeaders(c,p),fetch(d,{method:c.method,body:JSON.stringify(l),headers:p}).then(function(e){return e.json()}).then(function(){a(e,f),t.triggerAfter(O.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)===w.STRING){var n=O.HTTP_METHOD_POST;return e===O.ACTION_EDIT?n=O.HTTP_METHOD_PUT:e===O.ACTION_DELETE&&(n=O.HTTP_METHOD_DELETE),{url:t.ajax,method:n}}if(o(t.ajax)===w.OBJECT&&o(t.ajax[e])!==w.UNDEFINED&&o(t.ajax[e].url)!==w.UNDEFINED)return{url:t.ajax[e].url,method:t.ajax[e].type,headers:t.ajax[e].headers};throw new u.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===w.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;!1===a?this.resetFields():this.setFields(this.props);var i=(0,d.default)({gte_editor_popup:!0,fade_in:a,fade_out:!a}),l=(0,d.default)({gte_popup_background:!0,fade_in:a,fade_out:!a}),u=(0,d.default)({gte_form_fields:!0,gte_form_fields_delete:r===O.ACTION_DELETE});return s.default.createElement("div",null,s.default.createElement("div",{onClick:t,className:i},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:u},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("button",{id:"gte_sent_btn",className:"btn","data-action":r,onClick:this.btnClicked.bind(this)},o)))))))),s.default.createElement("div",{onClick:function(){t()},className:l}))}}]),t}();R.propTYpes={active:l.default.bool.isRequired,editor:l.default.object.isRequired,action:l.default.string.isRequired,popupTitle:l.default.string.isRequired,popupButton:l.default.string.isRequired,editorUpdate:l.default.func.isRequired,selectedIds:l.default.array.isRequired},R.defaultProps={pluginProps:{}},t.default=R},function(e,t){var n={},r=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}},o=r(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),a=r(function(){return document.head||document.getElementsByTagName("head")[0]}),i=null,s=0,l=[];function u(e,t){for(var r=0;r=0&&l.splice(t,1)}function p(e){var t=document.createElement("style");return t.type="text/css",d(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",d(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(){f(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(){f(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 u(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[E]=a.default.createElement("span",{key:E},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 x=[],T=b-1;T<_;++T){var R=T*o,D=T-1,C=T+1;h===C&&(g=D*o,D<0&&(g=(_-1)*o),y=C*o,C===_&&(y=0)),w=(0,s.default)({gt_page:!0,selected:T+1===r}),x[T]=a.default.createElement("div",{key:T,onClick:this.props.updatePagination,"data-from":R,className:w},T+1)}m[E]=a.default.createElement("span",{key:E},a.default.createElement("div",{"data-from":"0",onClick:this.props.updatePagination,className:"gt_page"},"1"),a.default.createElement("div",{className:"gt_page_dots"},"..."),x);break}}else(h=c.MORE_PAGES&&1===b)&&(m[E]=a.default.createElement("div",{key:E,onClick:this.props.updatePagination,"data-from":E*o,className:w},v))}if(_>0&&0===m.length)for(var I=0;I<_;++I){var A=I+1,k=(0,s.default)({gt_page:!0,selected:A===r});m[I]=a.default.createElement("div",{key:I,onClick:this.props.updatePagination,"data-from":I*o,className:k},A)}var S=1===r?o*(_-1):o*(r-2),N=r===_?0:o*r,j=0===n?0:p+1,P=r*o,M=i.showing+" "+j+" "+i.to+" "+(P>n?n:P)+" "+i.of+" "+n+" "+i.entries+".";return 0===n&&(M=i.no_entries),a.default.createElement("div",{className:l.default.gt_pagination},a.default.createElement("div",{className:l.default.gt_pgn_ttl},M),a.default.createElement("div",{className:l.default.gt_pgn_pages},a.default.createElement("div",{className:l.default.gt_pagn},a.default.createElement("div",{"data-from":S,onClick:this.props.updatePagination,className:u},i.prev),m,a.default.createElement("div",{"data-from":N,onClick:this.props.updatePagination,className:f},i.next))),a.default.createElement("div",{className:l.default.clear}))}}]),t}();f.propTypes={page:i.default.number,perPage:i.default.number,countRows:i.default.number,fromRow:i.default.number},t.default=f},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;n0&&-1!==a.buttonsPosition.indexOf(s)&&a.buttons.map(function(e,o){switch(e[h.EXTENDED]){case h.EDITOR_CSV:u!==_.UNDEFINED&&r(c.download)!==_.UNDEFINED&&!0===c.download.csv&&(p[o]=i.default.createElement(d.default,{active:!1,jsonData:u,key:o},f.editor_csv));break;case h.EDITOR_RELOAD:p[o]=i.default.createElement(l.default,{active:!1,action:h.ACTION_RELOAD,showPopup:n,isReload:!0,key:o},f.editor_reload);break;case h.EDITOR_CREATE:p[o]=i.default.createElement(l.default,{active:!1,action:h.ACTION_CREATE,showPopup:n,key:o},f.editor_create);break;case h.EDITOR_EDIT:p[o]=i.default.createElement(l.default,{active:!(t.length>=1),selectedRows:t,action:h.ACTION_EDIT,showPopup:n,key:o},f.editor_edit);break;case h.EDITOR_REMOVE:p[o]=i.default.createElement(l.default,{active:0===t.length,selectedRows:t,action:h.ACTION_DELETE,showPopup:n,key:o},f.editor_remove)}}),p}},{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:f.default.clear}))}}]),t}();g.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=g},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){var r=n(42)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(14),o=n(43),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(19),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{return i&&i.binding&&i.binding("util")}catch(e){}}();e.exports=s}).call(this,n(13)(e))},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(11),o=n(16),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(47),o=n(46),a=n(45),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(49),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,l=(s?s.isBuffer:void 0)||o;e.exports=l}).call(this,n(13)(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(52),o=n(7),a=Object.prototype,i=a.hasOwnProperty,s=a.propertyIsEnumerable,l=r(function(){return arguments}())?r:function(e){return o(e)&&i.call(e,"callee")&&!s.call(e,"callee")};e.exports=l},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(59),o=n(22),a=n(17),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(60),o=n(58)(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(62),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),l=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&&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)+"%"},u=(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?u:" "))))}}]),t}();d.defaultProps={height:10,percent:0,showPercent:!0},d.propTypes={percent:s.default.any,height:s.default.number},t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;tp.PERIOD_SEARCH){for(var _ in this.tOut)clearTimeout(this.tOut[_]);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)},p.TIMEOUT_SEARCH),this.c++;this.setState({dataSearch:i,selectedIds:[],selectedRows:[]}),this.lastTimeKeyup=this.nowMillis}else this.createTable(this.jsonData,this.state.sortedButtons)}}},{key:"createTable",value:function(e,t,n){var o=this,a=this.state,u=a.dataSearch,c=a.perPage,d=a.fromRow,f=a.minRow,h=a.maxRow,b=a.scrolledDown,g=a.editedCell,y=this.settings.struct.editableCells,m=this.settings.struct.aggregateFooter,E=[];null!==u&&(e=u);var v=e;if(e.length>c){var w=parseInt(d),O=w+parseInt(c);v=!0===b?e.slice(0,O):e.slice(w,O)}v.forEach(function(e,t){var a,u=[];a=o.getRowId(e),!0===y&&u.push(i.default.createElement(l.default,{editRow:o.editRow.bind(o),dataIndex:_.EDITABLE_CELLS_INDEX,selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,count:t,gteRowId:a,key:-1,editableCells:y})),o.props.children.forEach(function(s,c){var d=s.props.data;if((void 0===d?"undefined":r(d))!==p.UNDEFINED&&!0===o.visibleCols[d]){var _=null;_=r(o.customColumns[d])!==p.UNDEFINED&&r(o.customColumns[d])===p.FUNCTION?o.customColumns[d](e[d],e,d):e[d],u.push(i.default.createElement(l.default,{dataIndex:d,selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,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[d]},_))}}),E.push(i.default.createElement(s.default,{clickedRow:o.clickedRow.bind(o),selectedRows:(void 0===n?"undefined":r(n))!==p.UNDEFINED?n:o.state.selectedRows,minRow:f,maxRow:h,key:t,count:t,gteRowId:a,editableCells:y},u))}),!0===m&&this.setFooter(v,E);var x={dataRows:E,countRows:e.length};(void 0===t?"undefined":r(t))!==p.UNDEFINED&&(x.sortButtons=t),this.setState(x)}},{key:"setFooter",value:function(e,t){var n=this,o=this.settings.columns,a=this.state,s=a.footerCounted,c=a.footerSum,d=a.footerAvg,f=a.footerMinLength,_=a.footerMaxLength,h=a.footerFrequency,b=0,g=0,y=0,m=0,E=[],v="";!0===s?(b=c,g=d,y=f,m=_,E=h):this.jsonData.forEach(function(e){n.props.children.forEach(function(t){var n=t.props.data;o.forEach(function(t){if(t[p.DATA]===n&&t[p.FOOTER]!==p.UNDEFINED){var o=e[n];switch(t[p.FOOTER]){case p.FOOTER_SUM:b+=parseFloat(o);break;case p.FOOTER_AVG:g+=parseFloat(o);break;case p.FOOTER_MIN_LENGTH:var a=o.length;(y>a||0===y)&&(y=a);break;case p.FOOTER_MAX_LENGTH:var i=o.length;(m0?b:0));break;case p.FOOTER_AVG:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},g>0?g/e.length:0));break;case p.FOOTER_MIN_LENGTH:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},y));break;case p.FOOTER_MAX_LENGTH:w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},m));break;case p.FOOTER_FREQUENCY:var o=0;for(var s in E)0===o&&(v=s),E[s]>E[v]&&(v=s),++o;w.push(i.default.createElement(l.default,{footer:!0,key:r,selectedRows:[],count:-1,gteRowId:-1},v));break;default:w.push(i.default.createElement(l.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:v}),t.push(i.default.createElement(u.default,{key:-1},w))}},{key:"getRowId",value:function(e){var t=0;if(r(e[p.GT_ROW_ID])!==p.UNDEFINED)t=e[p.GT_ROW_ID];else{if(r(e.id)===p.UNDEFINED)throw new 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,l=n.shiftDown,u=e.target.dataset,c=u.rowid,d=u.realid,f=o,_=a,h=0,b=0,g=parseInt(c),y=parseInt(d),m=f.indexOf(g);if(f.length>0&&-1!==m&&!0===s){var E=_.indexOf(y);f.splice(m,1),_.splice(E,1)}else if(!0===s)f.push(parseInt(c)),_.push(parseInt(d));else if(!0===l){for(var v in f.push(parseInt(c)),_.push(parseInt(d)),h=f[0],b=f[0],f)f[v]b&&(b=f[v]);f=[];for(var w=h;w<=b;++w)f.push(w)}else f=[parseInt(c)],_=[parseInt(d)];this.createTable(this.jsonData,i,f),this.setState({selectedRows:f,selectedIds:_},function(){if(!0===l){var e=document.querySelectorAll("tr.active"),n=[];for(var o in e)r(e[o].dataset)!==p.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,o=e.target.dataset.action,a=0,i=this.state,s=i.selectedRows,l=i.sortedButtons;if(o===_.ACTION_DELETE)!function(){var e=n.state.dataSearch,o=function(o){for(var i in n.jsonData)r(n.jsonData[i][p.GT_ROW_ID])!==p.UNDEFINED?a=n.jsonData[i][p.GT_ROW_ID]:r(n.jsonData[i].id)!==p.UNDEFINED&&(a=n.jsonData[i].id),t[o]===a&&(s.splice(s.indexOf(i),1),delete n.jsonData[i],null!==e&&e.forEach(function(n,r){parseInt(n[p.GT_ROW_ID])===parseInt(t[o])&&delete e[r]}))};for(var i in t)o(i)}();else if(o===_.ACTION_CREATE)this.jsonData.unshift(t);else if(o===_.ACTION_EDIT)for(var u in 0===s.length&&(s[0]=e.target.dataset.rowid),t[p.GT_ROWS])for(var c in this.jsonData)if(this.jsonData[c][p.GT_ROW_ID]===t[p.GT_ROWS][u][p.GT_ROW_ID])for(var d in t[p.GT_ROWS][u])this.jsonData[c][d]=t[p.GT_ROWS][u][d];this.setState({selectedRows:s},function(){n.createTable(n.jsonData,l)}),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){var t=this.state,n=t.selectedRows,o=t.dataSearch,a=t.selectedIds;this.lang=h[this.settings.lang];var i=e.target.dataset.action,s=this.lang.gte_editor_popupheader_create,l=this.lang.gte_editor_sendbtn_create,u={};switch(i){case _.ACTION_RELOAD:var c=this.settings,d=c.ajax,f=c.columns,b=c.tableOpts;b.buttons.map(function(e){e.extended===_.EDITOR_RELOAD&&r(e.triggerBefore)!==p.UNDEFINED&&r(e.triggerBefore)===p.FUNCTION&&e.triggerBefore()});var g=f.length;this.resolveData(d,g),b.buttons.map(function(e){e.extended===_.EDITOR_RELOAD&&r(e.triggerAfter)!==p.UNDEFINED&&r(e.triggerAfter)===p.FUNCTION&&e.triggerAfter()});break;case _.ACTION_EDIT:if(s=this.lang.gte_editor_popupheader_edit,l=this.lang.gte_editor_sendbtn_update,null!==o)for(var y in n)n.hasOwnProperty(y)&&(u[y]=o[n[y]]);else for(var m in a)if(a.hasOwnProperty(m))for(var E in this.jsonData)this.jsonData.hasOwnProperty(E)&&this.jsonData[E][p.GT_ROW_ID]===a[m]&&(u[m]=this.jsonData[E]);break;case _.ACTION_DELETE:s=this.lang.gte_editor_popupheader_delete,l=this.lang.gte_editor_sendbtn_delete}e.preventDefault(),i!==_.ACTION_RELOAD&&this.setState({action:i,active:!0,popup_title:s,popup_button:l,opacity:1,fieldsEdit:u,shiftDown:!1,ctrlDown:!1})}},{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))===p.UNDEFINED){var a=[];this.props.children.forEach(function(e,t){var n=e.props.data;(void 0===n?"undefined":r(n))!==p.UNDEFINED&&o.forEach(function(e,t){e[p.DATA]!==n||r(e[p.SORTABLE])!==p.UNDEFINED&&!0!==e[p.SORTABLE]||(a[n]=0)})}),this.setState({sortButtons:a})}else{this.nowMillis=(new Date).getTime(),this.nowMillis-this.lastTimeKeyup>p.SORT_PERIOD&&this.props.children.forEach(function(t,r){var o=n,a=o.state,i=a.sortButtons,s=a.dataSearch,l=t.props.data,u=o.jsonData,c=[];null!==s&&(u=s),e===l&&(1===i[l]?(c=o.getButtonsState(e,-1),u=n.sortDesc(l,u)):(c=o.getButtonsState(e,1),u=n.sortAsc(l,u)),o.createTable(u,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===p.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,f({},r,o))}),""!==o||t!==p.BACKSPACE_KEY&&t!==p.DELETE_KEY){var s=[],l="",u=0,c=this.jsonData;for(var d in c)for(var _ in c[d])if(_!==p.GT_ROW_ID&&!0===this.searchableCols[_]&&_===a)if(l=c[d][_]+"",!1===this.discreteSearchableCase[_]){if(-1!==l.toLowerCase().indexOf(o.toLowerCase())){s[u]=c[d],++u;break}}else if(-1!==l.indexOf(o)){s[u]=c[d],++u;break}if(i>p.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)},p.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)===p.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,l){var u=a.props.data;if((void 0===u?"undefined":r(u))!==p.UNDEFINED&&!0===e.visibleCols[u]){var c=i.default.Children.only(a),d={key:l+s,sortId:l+"",sortDirection:r(t[u])===p.UNDEFINED?t[u]:0};d.columns=n,d.key=l+s,!0===e.searchableCols[u]&&(d.doDiscreteSearch=e.doDiscreteSearch.bind(e),d.discreteFocus=e.discreteFocus.bind(e),d.discreteBlur=e.discreteBlur.bind(e),d.columnsSearch=e.state.columnsSearch),!0===e.sortableCols[u]&&(d.gteSort=p.SORTABLE,r(t[u])!==p.UNDEFINED&&(d.updateSort=e.setTableSort.bind(e,u),d.sortDirection=t[u])),o[l+s]=i.default.cloneElement(c,d)}}),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))!==p.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)!==p.UNDEFINED&&r(t[n].dataset.realid)!==p.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,l=t.aDown;if(!0===r&&!0===a&&n.length>0){var u=Math.min.apply(Math,d(n)),c=n;u>0&&(c.push(u-1),this.setState({selectedRows:c},function(){e.createTable(e.jsonData,e.state.sortedButtons)}),this.setSelectedIds())}else if(!0===i&&!0===r&&n.length>0){var f=Math.max.apply(Math,d(n)),p=n;f=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=b},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&&l<=g.MAX_AUTOLOAD_PERIOD&&setInterval(function(){e.resolveData(i,s,o)},1e3*l)}},{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 f.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 f.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,u=t.data,c=this.state,d=c.selectedRows,f=c.search,p=c.perPage,_=[];return!0===s.download.csv&&(_=this.jsonData),a.default.createElement(l.default,{updatePerPage:this.updatePerPage.bind(this),showPopup:this.showPopup.bind(this),doSearch:this.doSearch.bind(this),tableOpts:n,perPageRows:r,perPage:p,defaultPerPage:o,lang:i,selectedRows:d,search:f,struct:s,display:e,jsonData:_,isData:null!==u})}},{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,l=n.selectedIds,c=n.opacity,d=n.popup_button,f=n.popup_title,p=n.fieldsEdit,_=this.settings,h=_.tableOpts,b=_.lang,y=_.struct;return a.default.createElement(u.default,{active:o,action:i,editor:t,columns:t.fields,editorUpdate:this.editorUpdate.bind(this),selectedRows:s,selectedIds:l,fieldsEdit:p,opacity:c,popupButton:d,popupTitle:f,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,l=o.perPage,u=o.fromRow;return a.default.createElement(c.default,{updatePagination:this.handlePagination.bind(this),countRows:i,page:s,perPage:l,fromRow:u,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 l in a)r(s[l])!==g.UNDEFINED&&r(s[l].style)!==g.UNDEFINED&&(s[l].style.width=a[l].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:d.default.gt_container,style:{width:r.width}},a.default.createElement("div",{className:d.default.gt_head_tools},this.getTools(g.DISPLAY_TOP)),a.default.createElement("div",{className:d.default.gt_pagination},this.getPagination(g.DISPLAY_TOP)),a.default.createElement("table",{id:"gigatable",className:d.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:d.default.gt_pagination},this.getPagination(g.DISPLAY_BOTTOM)),a.default.createElement("div",{className:d.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(101)),o=a(n(30));function a(e){return e&&e.__esModule?e:{default:e}}t.Reactables=r.default,t.Header=o.default}])}); \ No newline at end of file diff --git a/package.json b/package.json index 11d6f37..06aa531 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gigatables-react", - "version": "2.7.8", + "version": "2.7.9", "description": "GigaTables is a ReactJS plug-in to help web-developers process table-data in applications and CMS, CRM, ERP or similar systems. It supports ajax data processing/editing (CRUD), pagination, cross-sorting, global search, shft/ctrl rows selection, 7 popular languages and more.", "main": "./build/index.js", "dependencies": {