@sd-angular/core
Version:
Sd Angular Core Lib
1 lines • 233 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("@angular/material/form-field"),require("@angular/material/icon"),require("@angular/material/input"),require("@angular/material/paginator"),require("@angular/material/table"),require("@angular/material/progress-spinner"),require("@angular/material/menu"),require("@angular/material/button"),require("@sd-angular/core/service"),require("@angular/material/tooltip"),require("@angular/material/chips"),require("@angular/material/radio"),require("@angular/material/slide-toggle"),require("ngx-device-detector"),require("jquery"),require("@sd-angular/core/api"),require("@sd-angular/core/notify"),require("@sd-angular/core/loading"),require("@sd-angular/core/translate"),require("rxjs"),require("rxjs/operators"),require("@sd-angular/core/export"),require("@sd-angular/core/setting"),require("object-hash"),require("@angular/material/select"),require("@angular/material/checkbox"),require("@sd-angular/core/utility"),require("@sd-angular/core/upload-excel"),require("@sd-angular/core/form")):"function"==typeof define&&define.amd?define("@sd-angular/core/grid",["exports","@angular/core","@angular/common","@angular/forms","@angular/material/form-field","@angular/material/icon","@angular/material/input","@angular/material/paginator","@angular/material/table","@angular/material/progress-spinner","@angular/material/menu","@angular/material/button","@sd-angular/core/service","@angular/material/tooltip","@angular/material/chips","@angular/material/radio","@angular/material/slide-toggle","ngx-device-detector","jquery","@sd-angular/core/api","@sd-angular/core/notify","@sd-angular/core/loading","@sd-angular/core/translate","rxjs","rxjs/operators","@sd-angular/core/export","@sd-angular/core/setting","object-hash","@angular/material/select","@angular/material/checkbox","@sd-angular/core/utility","@sd-angular/core/upload-excel","@sd-angular/core/form"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["sd-angular"]=e["sd-angular"]||{},e["sd-angular"].core=e["sd-angular"].core||{},e["sd-angular"].core.grid={}),e.ng.core,e.ng.common,e.ng.forms,e.ng.material.formField,e.ng.material.icon,e.ng.material.input,e.ng.material.paginator,e.ng.material.table,e.ng.material.progressSpinner,e.ng.material.menu,e.ng.material.button,e["sd-angular"].core.service,e.ng.material.tooltip,e.ng.material.chips,e.ng.material.radio,e.ng.material.slideToggle,e["ngx-device-detector"],e.jquery,e["sd-angular"].core.api,e["sd-angular"].core.notify,e["sd-angular"].core.loading,e["sd-angular"].core.translate,e.rxjs,e.rxjs.operators,e["sd-angular"].core.export,e["sd-angular"].core.setting,e["object-hash"],e.ng.material.select,e.ng.material.checkbox,e["sd-angular"].core.utility,e["sd-angular"].core["upload-excel"],e["sd-angular"].core.form)}(this,(function(e,t,n,i,l,r,o,a,d,s,c,m,u,p,f,g,h,y,b,v,C,x,k,I,F,w,O,D,S,T,E,M,P){"use strict";function H(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var N=H(b),A=H(D);function z(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)t.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(n[i[l]]=e[i[l]])}return n}function R(e,t,n,i){return new(n||(n=Promise))((function(l,r){function o(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?l(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))}function V(e,t){var n,i,l,r,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(l=2&r[0]?i.return:r[0]?i.throw||((l=i.return)&&l.call(i),0):i.next)&&!(l=l.call(i,r[1])).done)return l;switch(i=0,l&&(r=[2&r[0],l.value]),r[0]){case 0:case 1:l=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,i=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(l=o.trys,(l=l.length>0&&l[l.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!l||r[1]>l[0]&&r[1]<l[3])){o.label=r[1];break}if(6===r[0]&&o.label<l[1]){o.label=l[1],l=r;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(r);break}l[2]&&o.ops.pop(),o.trys.pop();continue}r=t.call(e,o)}catch(e){r=[6,e],i=0}finally{n=l=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}}Object.create;function B(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,l,r=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(e){l={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(l)throw l.error}}return o}function q(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}Object.create;function G(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function U(e,t,n,i,l){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!l)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!l:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?l.call(e,n):l?l.value=n:t.set(e,n),n}var L={type:void 0,items:[],filter:{type:"inline",disabled:!1},sortable:!0,paginate:{pageSize:50,pageCount:5},commands:[],columns:[]},Q=function(){function e(){}return e.prototype.transform=function(e,t,n){var i,l,r=function(e){var i,l,r,o;if("children"===e.type)return!1;var a=!1;return e.editor&&(a="function"==typeof e.editor.disabled?e.editor.disabled(t):e.editor.disabled),!a&&(!(a="function"==typeof(null===(i=n.editor)||void 0===i?void 0:i.disabled)?n.editor.disabled(t):null===(l=n.editor)||void 0===l?void 0:l.disabled)&&(t.editingStatus||(null===(r=e.editor)||void 0===r?void 0:r.alwayDisplay)||"inline"===(null===(o=n.editor)||void 0===o?void 0:o.type)))};t.editorHandler=t.editorHandler||{};try{for(var o=B(n.columns),a=o.next();!a.done;a=o.next()){var d=a.value;t.editorHandler.disabled=!1,t.editorHandler[d.field]={},"object"==typeof n.editor?"function"==typeof n.editor.disabled?t.editorHandler.disabled=n.editor.disabled(t):t.editorHandler.disabled=n.editor.disabled:t.editorHandler.disabled=!1,t.editorHandler.disabled?t.editorHandler[d.field].visible=!1:t.editorHandler[d.field].visible=r(d)}}catch(e){i={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(i)throw i.error}}return!0},e}();Q.decorators=[{type:t.Pipe,args:[{name:"editorHandler"}]}];var W=new t.InjectionToken("grid.configuration"),$=function(e){this.templateRef=e};$.decorators=[{type:t.Directive,args:[{selector:"[sdCellDef]"}]}],$.ctorParameters=function(){return[{type:t.TemplateRef}]},$.propDecorators={sdCellDef:[{type:t.Input}]};var K=function(e){this.templateRef=e};K.decorators=[{type:t.Directive,args:[{selector:"[sdCellFooterDef]"}]}],K.ctorParameters=function(){return[{type:t.TemplateRef}]},K.propDecorators={sdCellFooterDef:[{type:t.Input}]};var Y=function(e){this.templateRef=e};Y.decorators=[{type:t.Directive,args:[{selector:"[sdCellEditorDef]"}]}],Y.ctorParameters=function(){return[{type:t.TemplateRef}]},Y.propDecorators={sdCellEditorDef:[{type:t.Input}]};var _,J=function(e){var t=this;this.datePipe=e,this.filter=function(e,n){var i=e.filter((function(e){var i,l;try{for(var r=B(n.columns),o=r.next();!o.done;o=r.next()){var a=o.value,d=(n.rawFilter[a.field]||"").toString().trim().toLowerCase(),s=(e[a.field]||"").toString().trim().toLowerCase();if(d){if(!s)return!1;if("string"===a.type){if(-1===s.indexOf(d))return!1}else if("values"===a.type||"radio"===a.type){if(s!==d)return!1}else if("number"===a.type){var c=+d.replace(">=","").replace("<=","").replace(">","").replace("<",""),m=+s;if(c||0===c){if(!m&&0!==m)return!1;if(d.indexOf(">=")>-1&&m<c)return!1;if(d.indexOf("<=")>-1&&m>c)return!1;if(d.indexOf("<")>-1&&m>=c)return!1;if(d.indexOf(">")>-1&&m<=c)return!1;if(m!==c)return!1}}else if("bool"===a.type){if("1"===d&&"1"!==s&&"true"!==s)return!1;if("0"===d&&"0"!==s&&"false"!==s)return!1}else if("date"===a.type||"datetime"===a.type){var u=t.datePipe.transform(d,"yyyy/MM/dd"),p=new Date(u),f=new Date(u);if(f.setDate(f.getDate()+1),new Date(s).getTime()<p.getTime()||new Date(s).getTime()>=f.getTime())return!1}}}}catch(e){i={error:e}}finally{try{o&&!o.done&&(l=r.return)&&l.call(r)}finally{if(i)throw i.error}}return!0}));if(n.orderBy&&n.orderDirection){var l=n.columns.find((function(e){return e.field===n.orderBy}));if(l){var r=l.type,o=l.field;i.sort((function(e,t){if("number"===r)return(e[o]||0)-(t[o]||0);if("date"===r||"datetime"===r||"time"===r)return new Date(e[o]||"").getTime()-new Date(e[o]||"").getTime();var n=(e[o]||"").toString(),i=(t[o]||"").toString();return n>i?1:n<i?-1:0})),"DESC"===n.orderDirection&&i.reverse()}}return{items:i,total:i.length}}};J.decorators=[{type:t.Injectable}],J.ctorParameters=function(){return[{type:n.DatePipe}]};var X,Z,ee,te,ne=function(){var e=this;this.mapRequest=function(t){var n,i={whereClause:"1>0",pageSize:t.pageSize,pageNumber:t.pageNumber,orderBy:t.orderBy,orderDirection:t.orderDirection,filter:{},externalFilter:{}};t.customFilter&&("string"==typeof t.customFilter?i.whereClause+=" AND "+t.customFilter:"function"==typeof t.customFilter&&(i.whereClause+=" AND "+t.customFilter()));var l=function(n){var l;if(t.rawFilter[n.field]||0===t.rawFilter[n.field])if(i.filter[n.field]=t.rawFilter[n.field],"string"===n.type){var r=(null!==(l=t.rawFilter[n.field])&&void 0!==l?l:"").toString();G(e,_).call(e,r)?i.whereClause+=" AND "+n.field+' = GUID("'+t.rawFilter[n.field]+'")':r.startsWith("!=")?i.whereClause+=" AND "+n.field+' != "'+r.substring(2,r.length)+'"':r.startsWith("=")?i.whereClause+=" AND "+n.field+' = "'+r.substring(1,r.length)+'"':r.startsWith("%")?i.whereClause+=" AND "+n.field+'.EndsWith("'+r.substring(1,r.length)+'")':r.endsWith("%")?i.whereClause+=" AND "+n.field+'.StartsWith("'+r.substring(0,r.length-1)+'")':i.whereClause+=" AND "+n.field+'.Contains("'+r+'")'}else if("number"===n.type){var o=+t.rawFilter[n.field].replace(">=","").replace("<=","").replace(">","").replace("<","").trim();t.rawFilter[n.field].indexOf(">=")>-1?i.whereClause+=" AND "+n.field+" >= "+o:t.rawFilter[n.field].indexOf("<=")>-1?i.whereClause+=" AND "+n.field+" <= "+o:t.rawFilter[n.field].indexOf(">")>-1?i.whereClause+=" AND "+n.field+" > "+o:t.rawFilter[n.field].indexOf("<")>-1?i.whereClause+=" AND "+n.field+" < "+o:i.whereClause+=" AND "+n.field+" = "+o}else if("bool"===n.type)"0"!==t.rawFilter[n.field]&&"1"!==t.rawFilter[n.field]||(i.whereClause+=" AND "+n.field+" = "+("1"===t.rawFilter[n.field]?"true":"false"));else if("values"===n.type)t.rawFilter[n.field]&&(G(e,_).call(e,t.rawFilter[n.field])?i.whereClause+=" AND "+n.field+' = GUID("'+t.rawFilter[n.field]+'")':"string"==typeof t.rawFilter[n.field]?i.whereClause+=" AND "+n.field+' = "'+t.rawFilter[n.field]+'"':i.whereClause+=" AND "+n.field+" = "+t.rawFilter[n.field]);else if("radio"===n.type)t.rawFilter[n.field]&&(i.whereClause+=" AND "+n.field+' = "'+t.rawFilter[n.field]+'"');else if("date"===n.type||"datetime"===n.type){var a=new Date(t.rawFilter[n.field]);a=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0),i.whereClause+=" AND "+n.field+" >= DateTime("+a.getFullYear()+","+(a.getMonth()+1)+","+a.getDate()+")",a.setDate(a.getDate()+1),i.whereClause+=" AND "+n.field+" < DateTime("+a.getFullYear()+","+(a.getMonth()+1)+","+a.getDate()+")"}};return t.columns.forEach((function(n){"children"!==n.type?l(n):function(n){var r,o,a,d,s,c=!1;try{for(var m=B(n.children),u=m.next();!u.done;u=m.next()){var p=u.value;(t.rawFilter[p.field]||0===t.rawFilter[p.field])&&(l(p),c=!0)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=m.return)&&o.call(m)}finally{if(r)throw r.error}}if(!c&&t.rawFilter[n.field]){i.filter[n.field]=t.rawFilter[n.field];var f="",g=(null!==(s=t.rawFilter[n.field])&&void 0!==s?s:"").toString().trim();try{for(var h=B(n.children),y=h.next();!y.done;y=h.next())if("string"===(p=y.value).type)G(e,_).call(e,g)?f+=" OR "+p.field+' = GUID("'+g+'")':g.startsWith("!=")?f+=" OR "+p.field+' != "'+g.substring(2,g.length)+'"':g.startsWith("=")?f+=" OR "+p.field+' = "'+g.substring(1,g.length)+'"':g.startsWith("%")?f+=" OR "+p.field+'.EndsWith("'+g.substring(1,g.length)+'")':g.endsWith("%")?f+=" OR "+p.field+'.StartsWith("'+g.substring(0,g.length-1)+'")':f+=" OR "+p.field+'.Contains("'+g+'")';else if("number"===p.type){var b=+g.replace(">=","").replace("<=","").replace(">","").replace("<","").trim();Number.isNaN(b)||(g.indexOf(">=")>-1?f+=" OR "+p.field+" >= "+b:g.indexOf("<=")>-1?f+=" OR "+p.field+" <= "+b:g.indexOf(">")>-1?f+=" OR "+p.field+" > "+b:g.indexOf("<")>-1?f+=" OR "+p.field+" < "+b:f+=" OR "+p.field+" = "+b)}else if("bool"===p.type)"0"!==g&&"1"!==g||(f+=" OR "+p.field+" = "+("1"===g?"true":"false"));else if("values"===p.type)G(e,_).call(e,g)&&(f+=" OR "+p.field+' = GUID("'+g+'")'),"string"==typeof t.rawFilter[p.field]?f+=" OR "+p.field+' = "'+g+'"':f+=" OR "+p.field+" = "+g;else if("radio"===p.type)g&&(f+=" OR "+p.field+' = "'+g+'"');else if(("date"===p.type||"datetime"===p.type)&&Date.isDate(g)){var v=new Date(g);v=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0),f+=" OR ("+p.field+" >= DateTime("+v.getFullYear()+","+(v.getMonth()+1)+","+v.getDate()+")",v.setDate(v.getDate()+1),f+=" AND "+p.field+" < DateTime("+v.getFullYear()+","+(v.getMonth()+1)+","+v.getDate()+"))"}}catch(e){a={error:e}}finally{try{y&&!y.done&&(d=h.return)&&d.call(h)}finally{if(a)throw a.error}}f.trim().startsWith("OR")&&(f=f.trim().substr(2).trim(),i.whereClause+=" AND("+f+")")}}(n)})),null===(n=t.externalFilters)||void 0===n||n.forEach((function(e){var n,l,r,o,a,d=e.field;if("daterangefull"!==e.type);else if(i.externalFilter[d]=null===(n=t.rawExternalFilter)||void 0===n?void 0:n[d],(null===(l=i.externalFilter[d])||void 0===l?void 0:l.from)&&(null===(r=i.externalFilter[d])||void 0===r?void 0:r.to)){var s=new Date(null===(o=i.externalFilter[d])||void 0===o?void 0:o.from),c=Date.addDays(null===(a=i.externalFilter[d])||void 0===a?void 0:a.to,1);i.whereClause+=" AND "+d+" >= DateTime("+s.getFullYear()+","+(s.getMonth()+1)+","+s.getDate()+")",i.whereClause+=" AND "+d+" < DateTime("+c.getFullYear()+","+(c.getMonth()+1)+","+c.getDate()+")"}})),i},this.mapResponse=function(e){return{items:e.items,total:e.total}},_.set(this,(function(e){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/i.test(e)}))};_=new WeakMap,ne.decorators=[{type:t.Injectable}];var ie=function(){function e(e,n,i,l,r,o,a,d,s,c,m,u){var p=this;this.configuration=e,this.ref=n,this.handlerLocal=l,this.handlerDotnet=r,this.translateService=o,this.datePipe=a,this.loadingService=d,this.apiService=s,this.exportService=c,this.notifyService=m,this.editorVisiblePipe=u,this.isMobileOrTablet=!1,this.displayKey="SDCUSTOM",this.localItems=[],this.items=[],this.filter={},this.externalFilter={},this.hiddenPaginate=!1,this.inlineExternal={},this.inlineColumn={},this.quickFilters=[],this.pages=[1],this.pageCount=5,this.totalPage=1,this.isLoading=!1,this.viewItems=[],this.fixedColumns=[],this.normalColumns=[],this.columns=[],this.isCheckedAll=!1,this.selectedItems=[],this.cellDefs=new t.QueryList,this.cellDef={},this.cellEditorDefs=new t.QueryList,this.cellEditorDef={},this.cellFooterDefs=new t.QueryList,this.cellFooterDef={},X.set(this,0),this.footerRows=[],Z.set(this,void 0),this.selectedItem=null,ee.set(this,new I.Subscription),this.rowHandler={click:function(e){p.selectedItem=e,p.gridOption.onClickRow&&p.gridOption.onClickRow(e)},dblClick:function(e){p.selectedItem=e,p.gridOption.onDblClickRow&&p.gridOption.onDblClickRow(e)}},this.setOption=function(e){e=p.initConfiguration(e),e=p.initTranslate(e),delete p.gridOption,p.gridOption=e,p.gridOption.commands=p.gridOption.commands.filter((function(e){var t=e.hidden;return void 0===t||("boolean"==typeof t?!t:"function"==typeof t?!t():void 0)})),p.sdGridConfig.setOption({key:e.key,pageSize:p.gridOption.paginate.pageSize,columns:p.gridOption.columns}),p.initExternalFilter(),p.resize(),p.detectChanges()},this.initConfiguration=function(e){var t,n,i,l,r,o,a,d=p.configuration;switch(!(null===(t=e.filter)||void 0===t?void 0:t.type)&&(null===(n=null==d?void 0:d.filter)||void 0===n?void 0:n.type)&&(e.filter?e.filter.type=d.filter.type:e.filter={type:d.filter.type}),!(null===(i=e.filter)||void 0===i?void 0:i.columnInline)&&(null===(l=null==d?void 0:d.filter)||void 0===l?void 0:l.columnInline)&&(e.filter?e.filter.columnInline=d.filter.columnInline:e.filter={columnInline:d.filter.columnInline}),!(null===(r=e.filter)||void 0===r?void 0:r.quickFilterVisibility)&&(null===(o=null==d?void 0:d.filter)||void 0===o?void 0:o.quickFilterVisibility)&&(e.filter?e.filter.quickFilterVisibility=d.filter.quickFilterVisibility:e.filter={quickFilterVisibility:d.filter.quickFilterVisibility}),e.translate=null!==(a=e.translate)&&void 0!==a?a:null==d?void 0:d.translate,e.type){case"local":p.handler=p.handlerLocal;break;case"dotnet":p.handler=p.handlerDotnet;break;case"custom":if(p.handler=e.handlerCustom||(null==d?void 0:d.handlerCustom),!p.handler)return void p.notifyService.notify.warning("Handler custom was not found")}return Object.assign(Object.assign({},L),e)},this.initTranslate=function(e){var t,n,i,l,r=p.translateService.translate;return null===(t=e.commands)||void 0===t||t.forEach((function(t){var n;e.translate&&("string"==typeof t.title&&(t.title=r(t.title)),"children"in t&&(null===(n=t.children)||void 0===n||n.forEach((function(e){"string"==typeof e.title&&(e.title=r(e.title))}))))})),null===(n=e.columns)||void 0===n||n.forEach((function(t){var n;!1!==t.translate&&((e.translate||t.translate)&&(t.title=r(t.title)),"children"===t.type&&(null===(n=null==t?void 0:t.children)||void 0===n||n.forEach((function(t){!1!==t.translate&&(e.translate||t.translate)&&(t.title=r(t.title))}))))})),null===(l=null===(i=e.filter)||void 0===i?void 0:i.externalFilters)||void 0===l||l.forEach((function(t){e.translate&&(t.title=r(t.title))})),e},this.reload=function(e){return R(p,void 0,void 0,(function(){var t,n,i,l,r,o,a,d,s,c,m,u,p,f,g,h,y,b,v,C;return V(this,(function(x){switch(x.label){case 0:if(this.isLoading)return[2];this.isLoading=!0,a=((null===(t=G(this,Z))||void 0===t?void 0:t.pageIndex)||0)+1,d=(null===(n=G(this,Z))||void 0===n?void 0:n.pageSize)||50,x.label=1;case 1:return x.trys.push([1,15,16,17]),"local"===this.gridOption.type?[3,6]:(h=this.handler,s=h.mapRequest(this.getFilterInfo(a,d)),"GET"!==this.gridOption.method?[3,3]:(c=Object.keys(s).filter((function(e){return null!==s[e]&&void 0!==s[e]})).map((function(e){return e+"="+s[e]})).join("&"),m=this.gridOption.url.includes("?")?this.gridOption.url+"&"+c:this.gridOption.url+"?"+c,[4,this.apiService.get(m)]));case 2:return v=x.sent(),u=h.mapResponse(v),f=u.items,g=u.total,this.items=f,this.total=g,[3,5];case 3:return[4,this.apiService.post(this.gridOption.url,s)];case 4:v=x.sent(),p=h.mapResponse(v),f=p.items,g=p.total,this.items=f,this.total=g,x.label=5;case 5:return[3,13];case 6:return h=this.handler,"function"!=typeof this.gridOption.items?[3,11]:Array.isArray(e)?(this.localItems=e,[3,10]):[3,7];case 7:return(y=this.gridOption.items())instanceof Promise?(b=this,[4,y]):[3,9];case 8:return b.localItems=x.sent(),[3,10];case 9:this.localItems=y,x.label=10;case 10:return[3,12];case 11:this.gridOption.items=e||this.gridOption.items,this.localItems=this.gridOption.items,x.label=12;case 12:v=h.filter(this.localItems,{customFilter:this.gridOption.filter.customFilter,rawFilter:this.filter,columns:this.gridOption.columns,rawExternalFilter:this.externalFilter,externalFilters:null===(i=this.gridOption.filter)||void 0===i?void 0:i.externalFilters,orderBy:this.orderBy,orderDirection:this.orderDirection,pageNumber:a,pageSize:d}),this.items=v.items,this.total=v.total,x.label=13;case 13:return this.items.forEach((function(e){return e.originItem=Object.assign({},e)})),this.isCheckedAll=!1,G(this,te).call(this),[4,null===(r=null===(l=this.gridOption)||void 0===l?void 0:l.onReloadCompleted)||void 0===r?void 0:r.call(l,this.items)];case 14:return x.sent(),this.generateViewItems(),this.generateEditorHandlers(),N.default(this.gridBody.nativeElement).scrollTop(0),a>1&&!(null===(o=this.viewItems)||void 0===o?void 0:o.length)&&G(this,Z).firstPage(),this.detectChanges(),[3,17];case 15:return C=x.sent(),this.notifyService.handle.error(C),[3,17];case 16:return this.isLoading=!1,[7];case 17:return[2]}}))}))},this.detectChanges=function(){p.ref.detectChanges(),p.ref.markForCheck()},this.selectPage=function(){"local"===p.gridOption.type?p.reload(p.localItems):p.reload()},this.updateFilter=function(e){p.filter=(null==e?void 0:e.filter)||p.filter,p.externalFilter=(null==e?void 0:e.externalFilter)||p.externalFilter,G(p,Z).pageIndex=0,"local"===p.gridOption.type?p.reload(p.localItems):p.reload()},te.set(this,(function(){p.selectedItems=p.items.filter((function(e){return e.isChecked})).map((function(e){e.temporary,e.originItem,e.editorHandler,e.editingStatus,e.isChecked,e.subInformation,e.blinker;return z(e,["temporary","originItem","editorHandler","editingStatus","isChecked","subInformation","blinker"])}))})),this.onCheck=function(e,t){var n,i;p.gridOption.checkable&&(t||(e.isChecked=!e.isChecked),p.isCheckedAll=p.items.length===p.items.filter((function(e){return e.isChecked})).length,null===(i=(n=p.gridOption).onCheck)||void 0===i||i.call(n,p.items.filter((function(e){return e.isChecked})),e),G(p,te).call(p))},this.sort=function(e){var t,n;if("children"!==e.type&&"image"!==e.type){var i=null===(t=p.gridOption.sortable)||void 0===t||t,l=null===(n=e.sortable)||void 0===n||n;i&&l&&(p.orderBy===e.field?p.orderDirection="ASC"===p.orderDirection?"DESC":"ASC":(p.orderBy=e.field,p.orderDirection="ASC"),"local"===p.gridOption.type?p.reload(p.localItems):p.reload())}},this.clearFilter=function(){p.filter={},p.externalFilter={},p.initFilter(),p.initExternalFilter(),p.sdGridPopupFilter&&(p.sdGridPopupFilter.filter=p.filter,p.sdGridPopupFilter.externalFilter=p.externalFilter)},this.onClearFilter=function(){p.clearFilter(),p.reload()},this.expandOrCollapse=function(e){return R(p,void 0,void 0,(function(){var t,n,i,l,r;return V(this,(function(o){switch(o.label){case 0:if(e.temporary,e.originItem,e.editorHandler,e.editingStatus,e.isChecked,e.subInformation,i=z(e,["temporary","originItem","editorHandler","editingStatus","isChecked","subInformation"]),!this.gridOption.subInformation)return[2];if(null===(t=e.subInformation)||void 0===t?void 0:t.isOpened)return e.subInformation.isOpened=!1,[2];if(!this.gridOption.subInformation.lazyLoading||(null===(n=e.subInformation)||void 0===n?void 0:n.isLoaded))return[3,5];e.subInformation.isLoading=!0,o.label=1;case 1:return o.trys.push([1,3,,4]),l=e.subInformation,[4,this.gridOption.subInformation.onLoad(i)];case 2:return l.subItems=o.sent(),Array.isArray(e.subInformation.subItems)||(this.notifyService.alert.warning("Data is not an array"),e.subInformation.subItems=[]),e.subInformation.isLoading=!1,e.subInformation.isLoaded=!0,e.subInformation.isOpened=!0,this.ref.detectChanges(),[3,4];case 3:return r=o.sent(),this.notifyService.handle.error(r),e.subInformation.isLoading=!1,this.ref.detectChanges(),[3,4];case 4:return[2];case 5:return!1!==this.gridOption.subInformation.lazyLoading||e.subInformation.isLoaded?(e.subInformation.isOpened=!0,this.ref.detectChanges(),[2]):(e.subInformation.subItems=e[this.gridOption.subInformation.field],Array.isArray(e.subInformation.subItems)||(this.notifyService.alert.warning("Data is not an array"),e.subInformation.subItems=[]),e.subInformation.isLoaded=!0,e.subInformation.isOpened=!0,[2])}}))}))},this.onCreate=function(){var e,t=p.gridOption,n=t.type,i=t.editor,l=t.columns;if(null==i?void 0:i.addable){var r={};l.forEach((function(e){"values"===e.type?r[e.field]="":"bool"===e.type?r[e.field]=!0:"number"===e.type&&(r[e.field]=null)})),null===(e=i.onAdd)||void 0===e||e.call(i,r),"popup"!==i.type&&("local"===n&&p.items.splice(0,0,r),p.viewItems.splice(0,0,r)),p.onUpdate(r,!1)}},this.onUpdate=function(e,t){var n=p.gridOption,i=n.editor,l=n.columns;e.editingStatus=t?"update":"create",e.temporary=Object.assign({},e),p.generateEditorHanlder(e),"popup"===i.type&&p.sdGridPopupEditor.open(e,l,t),p.ref.detectChanges()},this.onSave=function(e){return R(p,void 0,void 0,(function(){var t,n,i,l;return V(this,(function(r){switch(r.label){case 0:t=this.gridOption.editor,r.label=1;case 1:return r.trys.push([1,7,8,9]),e.editorHandler.saving=!0,t.validate?(i=t.validate(e))instanceof Promise?[4,i]:[3,3]:[3,4];case 2:if(n=r.sent())throw n;return[3,4];case 3:if(i)throw i;r.label=4;case 4:return t.onSave&&(i=t.onSave(e))instanceof Promise?[4,i]:[3,6];case 5:r.sent(),r.label=6;case 6:return"create"===e.editingStatus&&"popup"===t.type&&("local"===this.gridOption.type&&this.items.splice(0,0,e),this.viewItems.splice(0,0,e)),e.editingStatus=void 0,this.generateEditorHanlder(e),[3,9];case 7:return l=r.sent(),this.notifyService.notify.warning(l),[3,9];case 8:return e.editorHandler.saving=!1,this.ref.detectChanges(),[7];case 9:return[2]}}))}))},this.onCancel=function(e){var t=p.gridOption.editor;if("inline"!==t.type)"create"===e.editingStatus?"popup"!==t.type&&("local"===p.gridOption.type&&p.items.splice(0,1),p.viewItems.splice(0,1)):(Object.assign(e,e.temporary),e.editingStatus=void 0,p.generateEditorHanlder(e),p.ref.detectChanges());else{if("local"===p.gridOption.type){var n=p.items.indexOf(e);p.items.splice(n,1)}var i=p.viewItems.indexOf(e);p.viewItems.splice(i,1)}},this.initExternalFilter=function(){var e,t;(null===(t=null===(e=p.gridOption.filter)||void 0===e?void 0:e.externalFilters)||void 0===t?void 0:t.length)&&p.gridOption.filter.externalFilters.forEach((function(e){var t,n,i,l,r,o,a,d,s;"string"!==e.type?"number"!==e.type?"daterange"!==e.type?"numberrange"!==e.type?"daterangefull"!==e.type?"values"!==e.type||e.default&&(p.externalFilter[e.field]=null!==(s=e.default)&&void 0!==s?s:""):p.externalFilter[e.field]={from:null!==(a=e.defaultFrom)&&void 0!==a?a:void 0,to:null!==(d=e.defaultTo)&&void 0!==d?d:void 0}:p.externalFilter[e.field]={from:null!==(r=e.defaultFrom)&&void 0!==r?r:void 0,to:null!==(o=e.defaultTo)&&void 0!==o?o:void 0}:p.externalFilter[e.field]={from:null!==(i=e.defaultFrom)&&void 0!==i?i:void 0,to:null!==(l=e.defaultTo)&&void 0!==l?l:void 0}:e.default&&(p.externalFilter[e.field]=null!==(n=e.default)&&void 0!==n?n:void 0):e.default&&(p.externalFilter[e.field]=null!==(t=e.default)&&void 0!==t?t:"")}))},this.onSearch=function(e,t,n){t[n.field]=e},this.onFilterConfigurationLoaded=function(e){var t,n;if(p.quickFilters=e.quickFilters||[],p.selectedQuickFilter=e.selectedQuickFilter||"",p.selectedQuickFilter){var i=p.quickFilters.find((function(e){return e.code===p.selectedQuickFilter}));if(i){var l=JSON.stringify(i.filter),r=JSON.stringify(i.externalFilter);p.filter=JSON.parse(l),p.externalFilter=p.refreshExternalFilter(null===(n=null===(t=p.gridOption)||void 0===t?void 0:t.filter)||void 0===n?void 0:n.externalFilters,JSON.parse(r))}}p.inlineExternal=e.inlineExternal||{},p.inlineColumn=e.inlineColumn||{},p.resize()},this.onSelectQuickFilter=function(e){var t,n,i,l=p.quickFilters.find((function(t){return t.code===e}));if(null==l?void 0:l.code){var r=JSON.stringify(l.filter),o=JSON.stringify(l.externalFilter);p.selectedQuickFilter=null==l?void 0:l.code,p.filter=JSON.parse(r),p.externalFilter=p.refreshExternalFilter(null===(n=null===(t=p.gridOption)||void 0===t?void 0:t.filter)||void 0===n?void 0:n.externalFilters,JSON.parse(o)),p.updateFilter()}else p.selectedQuickFilter="",p.onClearFilter();null===(i=p.sdGridPopupFilter)||void 0===i||i.updateConfiguration(p.selectedQuickFilter)},this.getExportItems=function(e,t){return void 0===e&&(e=1),void 0===t&&(t=1e4),R(p,void 0,void 0,(function(){var n,i,l,r,o,a,d,s,c;return V(this,(function(m){switch(m.label){case 0:if(this.isLoading)return[2];this.isLoading=!0,m.label=1;case 1:return m.trys.push([1,13,14,15]),"local"===this.gridOption.type?[3,6]:(a=this.handler,i=a.mapRequest(this.getFilterInfo(e,t)),"GET"!==this.gridOption.method?[3,3]:(l=Object.keys(i).filter((function(e){return null!==i[e]&&void 0!==i[e]})).map((function(e){return e+"="+i[e]})).join("&"),r=this.gridOption.url.includes("?")?this.gridOption.url+"&"+l:this.gridOption.url+"?"+l,[4,this.apiService.get(r)]));case 2:return s=m.sent(),[2,a.mapResponse(s).items];case 3:return[4,this.apiService.post(this.gridOption.url,i)];case 4:return s=m.sent(),[2,a.mapResponse(s).items];case 5:return[3,12];case 6:return o=[],a=this.handler,"function"!=typeof this.gridOption.items?[3,10]:(d=this.gridOption.items())instanceof Promise?[4,d]:[3,8];case 7:return o=m.sent(),[3,9];case 8:o=d,m.label=9;case 9:return[3,11];case 10:o=this.gridOption.items,m.label=11;case 11:return[2,(s=a.filter(o,{customFilter:this.gridOption.filter.customFilter,rawFilter:this.filter,columns:this.gridOption.columns,rawExternalFilter:this.externalFilter,externalFilters:null===(n=this.gridOption.filter)||void 0===n?void 0:n.externalFilters,orderBy:this.orderBy,orderDirection:this.orderDirection,pageNumber:e,pageSize:t})).items];case 12:return[3,15];case 13:return c=m.sent(),this.notifyService.handle.error(c),[3,15];case 14:return this.isLoading=!1,this.ref.detectChanges(),[7];case 15:return[2]}}))}))},this.getFilterInfo=function(e,t){var n,i,l,r,o;try{for(var a=B(Object.keys(p.filter)),d=a.next();!d.done;d=a.next()){var s=d.value;"string"==typeof p.filter[s]&&(p.filter[s]=p.filter[s].trim())}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}try{for(var c=B(Object.keys(p.externalFilter)),m=c.next();!m.done;m=c.next()){s=m.value;"string"==typeof p.externalFilter[s]&&(p.externalFilter[s]=p.externalFilter[s].trim())}}catch(e){l={error:e}}finally{try{m&&!m.done&&(r=c.return)&&r.call(c)}finally{if(l)throw l.error}}return{customFilter:p.gridOption.filter.customFilter,rawFilter:p.filter,columns:p.gridOption.columns,rawExternalFilter:p.externalFilter,externalFilters:null===(o=p.gridOption.filter)||void 0===o?void 0:o.externalFilters,orderBy:p.orderBy,orderDirection:p.orderDirection,pageNumber:e,pageSize:t}},this.onExportByTemplate=function(e){return R(p,void 0,void 0,(function(){var t,n,i,l,r,o,a,d,s=this;return V(this,(function(c){switch(c.label){case 0:return this.loadingService.start(),r=[],(null===(t=this.gridOption.export)||void 0===t?void 0:t.items)?[4,null===(n=this.gridOption.export)||void 0===n?void 0:n.items(this.getFilterInfo(1,1e4)).finally(this.loadingService.stop)]:[3,2];case 1:return r=c.sent(),[3,4];case 2:return[4,this.getExportItems().finally(this.loadingService.stop)];case 3:r=c.sent(),c.label=4;case 4:return(null===(i=this.gridOption.export)||void 0===i?void 0:i.mapping)?(o=this.gridOption.export.mapping(r,e.excelConfig.name))instanceof Promise?[4,o]:[3,6]:[3,7];case 5:return r=c.sent(),[3,7];case 6:r=o,c.label=7;case 7:return a=q(this.gridOption.columns,(null===(l=this.gridOption.export)||void 0===l?void 0:l.columns)||[]),d=r.map((function(e){var t={},n=function(i){if("children"===i.type)i.children.forEach(n);else if(i.transform)t[i.field]=i.transform(e[i.field],e);else if(void 0===e[i.field]||null===e[i.field]||""===e[i.field])t[i.field]="";else if("string"===i.type||"number"===i.type||"color"===i.type)t[i.field]=e[i.field];else if("bool"===i.type)e[i.field]?t[i.field]=i.trueValue||"True":t[i.field]=i.falseValue||"False";else if("date"===i.type){var l=new Date(e[i.field]);t[i.field]=s.datePipe.transform(l,"dd/MM/yyyy")}else if("datetime"===i.type){l=new Date(e[i.field]);t[i.field]=s.datePipe.transform(l,"dd/MM/yyyy HH:mm:ss")}else if("time"===i.type){l=new Date(e[i.field]);t[i.field]=s.datePipe.transform(l,"HH:mm:ss")}else if("values"===i.type){var r=i.values.find((function(t){return t.value===e[i.field]}));t[i.field]=r?r.text:e[i.field]}else if("radio"===i.type){r=i.values.find((function(t){return t[i.valueField]===e[i.field]}));t[i.field]=r?r[i.displayField]:e[i.field]}};return a.forEach(n),t})),this.exportService.exportByTemplate({filePath:e.excelConfig.fullPath,columns:e.excelColumns,items:d}),[2]}}))}))},this.onEditorChange=function(){p.ref.detectChanges()},this.onSelectPageSize=function(){p.reload()},this.refreshExternalFilter=function(e,t){return t=t||{},(e=e||[]).forEach((function(e){var n,i,l,r,o,a,d,s,c,m,u,p,f,g,h,y,b,v,C,x,k,I,F;"string"!==e.type?"number"!==e.type?"daterange"!==e.type?"numberrange"!==e.type?"daterangefull"!==e.type?"values"!==e.type||(t[e.field]=null!==(F=t[e.field]||e.default)&&void 0!==F?F:""):t[e.field]={from:null!==(C=null!==(v=null===(b=t[e.field])||void 0===b?void 0:b.from)&&void 0!==v?v:e.defaultFrom)&&void 0!==C?C:void 0,to:null!==(I=null!==(k=null===(x=t[e.field])||void 0===x?void 0:x.to)&&void 0!==k?k:e.defaultTo)&&void 0!==I?I:void 0}:t[e.field]={from:null!==(f=null!==(p=null===(u=t[e.field])||void 0===u?void 0:u.from)&&void 0!==p?p:e.defaultFrom)&&void 0!==f?f:void 0,to:null!==(y=null!==(h=null===(g=t[e.field])||void 0===g?void 0:g.to)&&void 0!==h?h:e.defaultTo)&&void 0!==y?y:void 0}:t[e.field]={from:null!==(d=null!==(a=null===(o=t[e.field])||void 0===o?void 0:o.from)&&void 0!==a?a:e.defaultFrom)&&void 0!==d?d:void 0,to:null!==(m=null!==(c=null===(s=t[e.field])||void 0===s?void 0:s.to)&&void 0!==c?c:e.defaultTo)&&void 0!==m?m:void 0}:t[e.field]=null!==(r=null!==(l=t[e.field])&&void 0!==l?l:e.default)&&void 0!==r?r:void 0:t[e.field]=null!==(i=null!==(n=t[e.field])&&void 0!==n?n:e.default)&&void 0!==i?i:""})),t},this.onCreateQuickFilter=function(e){var t,n,i;null===(t=p.matSelect)||void 0===t||t.close(),p.onFilterPopup(),null===(n=p.sdGridPopupFilter)||void 0===n||n.close(),null===(i=p.sdGridPopupFilter)||void 0===i||i.onCreateQuickFilter(e)},this.onEditQuickFilter=function(e,t){var n,i,l;null===(n=p.matSelect)||void 0===n||n.close(),p.onFilterPopup(),null===(i=p.sdGridPopupFilter)||void 0===i||i.close(),null===(l=p.sdGridPopupFilter)||void 0===l||l.onEditQuickFilter(e,t)},this.onDeleteQuickFilter=function(e,t){var n,i,l;null===(n=p.matSelect)||void 0===n||n.close(),p.onFilterPopup(),null===(i=p.sdGridPopupFilter)||void 0===i||i.close(),null===(l=p.sdGridPopupFilter)||void 0===l||l.onDeleteQuickFilter(e,t)},this.isMobileOrTablet=!i.isDesktop()}return Object.defineProperty(e.prototype,"paginator",{set:function(e){e&&G(this,Z)!==e&&(U(this,Z,e),G(this,ee).add(e.page.subscribe(this.selectPage)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"option",{set:function(e){this.setOption(e)},enumerable:!1,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;G(this,ee).add(this.fixedHeaders.changes.pipe(F.startWith([])).subscribe((function(){setTimeout((function(){var t=e.fixedHeaders.toArray();if(t.length>0)for(var n=N.default(t[0].nativeElement).outerWidth(!0),i=1;i<t.length;i++)N.default(t[i].nativeElement).css({left:n}),n+=N.default(t[i].nativeElement).outerWidth(!0)}),100)}))),G(this,ee).add(I.merge(this.fixedBodies.changes,this.cellFooterDefs.changes).pipe(F.startWith({})).subscribe((function(){setTimeout((function(){var t=e.fixedBodies.toArray();if(t.length>0)for(var n=e.fixedBodies.length/(e.viewItems.length+G(e,X)),i=N.default(t[0].nativeElement).outerWidth(!0),l=1;l<t.length;l++)l%n==0&&(i=0),N.default(t[l].nativeElement).css({left:i}),i+=N.default(t[l].nativeElement).outerWidth(!0);var r=e.fixedHeaders.toArray();if(r.length>0)for(i=N.default(r[0].nativeElement).outerWidth(!0),l=1;l<r.length;l++)N.default(r[l].nativeElement).css({left:i}),i+=N.default(r[l].nativeElement).outerWidth(!0)}),100)}))),G(this,ee).add(this.cellDefs.changes.pipe(F.startWith([])).subscribe((function(){var t,n;e.cellDef={};try{for(var i=B(e.cellDefs),l=i.next();!l.done;l=i.next()){var r=l.value;r.sdCellDef&&(e.cellDef[r.sdCellDef]=r)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))),G(this,ee).add(this.cellEditorDefs.changes.pipe(F.startWith([])).subscribe((function(){var t,n;e.cellEditorDef={};try{for(var i=B(e.cellEditorDefs),l=i.next();!l.done;l=i.next()){var r=l.value;r.sdCellEditorDef&&(e.cellEditorDef[r.sdCellEditorDef]=r)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}))),G(this,ee).add(this.cellFooterDefs.changes.pipe(F.startWith([])).subscribe((function(){var t,n;e.cellFooterDef={},U(e,X,0);try{for(var i=B(e.cellFooterDefs),l=i.next();!l.done;l=i.next()){var r=l.value;r.sdCellFooterDef&&(e.cellFooterDef[r.sdCellFooterDef]||(e.cellFooterDef[r.sdCellFooterDef]=[]),e.cellFooterDef[r.sdCellFooterDef].push(r),e.cellFooterDef[r.sdCellFooterDef].length>G(e,X)&&U(e,X,e.cellFooterDef[r.sdCellFooterDef].length))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.footerRows=Array(G(e,X)).fill(0).map((function(e,t){return t}))})))},e.prototype.ngOnDestroy=function(){G(this,ee).unsubscribe()},e.prototype.reloadItem=function(e){var t=this;Object.keys(e).forEach((function(n){var i=t.items.find((function(e){return!!e.id&&e.id===n}));i&&(t.gridOption.columns.forEach((function(l){void 0!==i[l.field]&&void 0!==e[n][l.field]&&i[l.field]!==e[n][l.field]&&t.blink(i,l.field)})),Object.assign(i,e[n]),t.generateEditorHanlder(i),t.stopBlink())}))},e.prototype.blink=function(e,t){e.blinker=e.blinker||{},e.blinker[t]=!0},e.prototype.stopBlink=function(){var e=this;setTimeout((function(){e.viewItems.forEach((function(e){e.blinker={}}))}),1500)},e.prototype.generateViewItems=function(){var e,t,n=((null===(e=G(this,Z))||void 0===e?void 0:e.pageIndex)||0)+1,i=(null===(t=G(this,Z))||void 0===t?void 0:t.pageSize)||50;delete this.viewItems,"local"===this.gridOption.type?this.viewItems=this.items.filter((function(e,t){return t>=(n-1)*i&&t<n*i})):this.viewItems=this.items,this.viewItems.forEach((function(e){e.blinker=e.blinker||{},e.subInformation=e.subInformation||{}}))},Object.defineProperty(e.prototype,"editedItems",{get:function(){return this.items.filter((function(e){return!e.originItem||!!Object.keys(e.originItem).some((function(t){return e.originItem[t]!==e[t]}))})).map((function(e){e.temporary,e.originItem,e.editorHandler,e.editingStatus,e.isChecked,e.subInformation,e.blinker;return z(e,["temporary","originItem","editorHandler","editingStatus","isChecked","subInformation","blinker"])}))},enumerable:!1,configurable:!0}),e.prototype.getItems=function(){return this.items},e.prototype.checkAll=function(e){var t=this;this.isCheckedAll=e,this.items.forEach((function(e){return e.isChecked=t.isCheckedAll})),this.gridOption.onCheck&&this.gridOption.onCheck(this.items.filter((function(e){return e.isChecked}))),G(this,te).call(this)},e.prototype.resize=function(){var e=this;this.detectChanges(),this.gridOption.height?this.gridBody.nativeElement.style.height=this.gridOption.height:(this.gridBody.nativeElement.style.height=window.innerHeight-300+"px",setTimeout((function(){var t=e.gridBody.nativeElement.getBoundingClientRect().top,n=e.gridOption.hideFooter?0:e.isMobileOrTablet?45:55,i=window.innerHeight-t-n;e.gridBody.nativeElement.style.height=i+"px"}),0),setTimeout((function(){var t=e.gridBody.nativeElement.getBoundingClientRect().top,n=e.gridOption.hideFooter?0:e.isMobileOrTablet?45:55,i=window.innerHeight-t-n;e.gridBody.nativeElement.style.height=i+"px"}),200),setTimeout((function(){var t=e.gridBody.nativeElement.getBoundingClientRect().top,n=e.gridOption.hideFooter?0:e.isMobileOrTablet?45:55,i=window.innerHeight-t-n;e.gridBody.nativeElement.style.height=i+"px"}),500),setTimeout((function(){var t=e.gridBody.nativeElement.getBoundingClientRect().top,n=e.gridOption.hideFooter?0:e.isMobileOrTablet?45:55,i=window.innerHeight-t-n;e.gridBody.nativeElement.style.height=i+"px"}),1e3))},e.prototype.setHeight=function(e){this.gridOption.height=e,this.resize()},e.prototype.loadConfig=function(e){this.gridOption.paginate.pageSize=e.pageSize,this.gridOption.columns=e.columns,this.fixedColumns=e.fixedColumns,this.normalColumns=e.normalColumns,this.columns=q(this.fixedColumns,this.normalColumns),this.initFilter(),this.initDictionaryColumnValues(),this.reload()},e.prototype.initFilter=function(){var e=this;this.gridOption.columns.forEach((function(t){var n;e.filter[t.field]=null!==(n=e.filter[t.field])&&void 0!==n?n:""}))},e.prototype.initDictionaryColumnValues=function(){this.gridOption.columns.forEach((function(e){"values"===e.type&&(e.dictionary={},e.values&&e.values.forEach((function(t){e.dictionary[t.value.toString()]={text:t.text,icon:t.icon,color:t.color,backgroundColor:t.backgroundColor}}))),"children"===e.type&&e.children.forEach((function(e){"values"===e.type&&(e.dictionary={},e.values&&e.values.forEach((function(t){e.dictionary[t.value.toString()]={text:t.text,icon:t.icon,color:t.color,backgroundColor:t.backgroundColor}})))}))}))},e.prototype.generateEditorHandlers=function(){var e=this;this.viewItems.forEach((function(t){e.generateEditorHanlder(t)}))},e.prototype.generateEditorHanlder=function(e){this.editorVisiblePipe.transform(null,e,this.gridOption)},e.prototype.trackById=function(e,t){return t.id},Object.defineProperty(e.prototype,"isFiltering",{get:function(){return Object.values(this.filter).some((function(e){return!!e}))},enumerable:!1,configurable:!0}),e.prototype.onFilterPopup=function(){var e,t=JSON.stringify(this.filter),n=JSON.stringify(this.externalFilter),i=JSON.parse(t),l=JSON.parse(n);this.sdGridPopupFilter.open(this.fixedColumns,this.normalColumns,i,l,null===(e=this.gridOption.filter)||void 0===e?void 0:e.externalFilters)},Object.defineProperty(e.prototype,"invalidItems",{get:function(){return this.items.filter((function(e){var t;return null===(t=e.editorHandler)||void 0===t?void 0:t.errorMessage})).map((function(e){e.temporary,e.originItem,e.editorHandler,e.editingStatus,e.isChecked,e.subInformation,e.blinker;return{item:z(e,["temporary","originItem","editorHandler","editingStatus","isChecked","subInformation","blinker"]),message:e.editorHandler.errorMessage}}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gridItems",{get:function(){return this.items.map((function(e){e.temporary,e.originItem,e.editorHandler,e.editingStatus,e.isChecked,e.subInformation,e.blinker;return z(e,["temporary","originItem","editorHandler","editingStatus","isChecked","subInformation","blinker"])}))},enumerable:!1,configurable:!0}),e}();X=new WeakMap,Z=new WeakMap,ee=new WeakMap,te=new WeakMap,ie.decorators=[{type:t.Component,args:[{selector:"sd-grid",template:'<div class="clearfix"></div>\r\n<ng-container *ngIf="!isMobileOrTablet && !gridOption?.filter?.disabled">\r\n <div class="row mx-0 mt-5">\r\n <div\r\n *ngIf="gridOption?.key && gridOption?.filter?.multiple !== false && (!gridOption?.filter?.quickFilterVisibility || gridOption?.filter?.quickFilterVisibility === \'inline\')"\r\n class="col-lg-2 col-md-3 col-sm-6 px-4">\r\n <mat-form-field class="sd-md" appearance="outline" style="width: 100%;">\r\n <mat-label>{{\'Quick filters\' | sdTranslate}}</mat-label>\r\n <mat-select [(ngModel)]="selectedQuickFilter" (selectionChange)="onSelectQuickFilter($event?.value)" #matSelect>\r\n <mat-option value="">{{\'Please select\' | sdTranslate}}</mat-option>\r\n <mat-option *ngFor="let quickFilter of quickFilters" [value]="quickFilter.code">\r\n <div style="display:flex; justify-content: space-between">\r\n <span>{{quickFilter.code}}</span>\r\n <div>\r\n <mat-icon class="mr-1 c-fa-icon" (click)="onEditQuickFilter($event, quickFilter)" fontSet="fa"\r\n fontIcon="fa-pencil"></mat-icon>\r\n <mat-icon class="mr-0 c-fa-icon" (click)="onDeleteQuickFilter($event, quickFilter)" fontSet="fa"\r\n fontIcon="fa-trash-o"></mat-icon>\r\n </div>\r\n </div>\r\n </mat-option>\r\n <mat-option>\r\n <div (click)="onCreateQuickFilter($event)">\r\n <mat-icon class="mr-1" fontSet="material-icons-outlined">add</mat-icon>\r\n <span>{{\'Create quick filter\' | sdTranslate}}</span>\r\n </div>\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <sd-grid-desktop-inline-filter class="c-display-contents" [columns]="gridOption.columns" [filter]="filter"\r\n [externalFilter]="externalFilter" (sdChange)="updateFilter()" [inlineExternal]="inlineExternal"\r\n [inlineColumn]="inlineColumn" [filterOption]="gridOption.filter">\r\n </sd-grid-desktop-inline-filter>\r\n </div>\r\n</ng-container>\r\n<div *ngIf="!isMobileOrTablet; else elseMobileOrTablet" class="sd-box"\r\n [ngClass]="{\'box-shadow-none\': gridOption.hideFooter}">\r\n <ng-container *ngTemplateOutlet="gridViewContent"></ng-container>\r\n <div [ngClass]="{\'d-none\': gridOption.hideFooter}" class="sd-box-footer clearfix">\r\n <div style="display: flex; align-items: center; align-content: space-between;">\r\n <div style="flex: 1;">\r\n <sd-button *ngIf="sdGridPopupFilter" class="mr-6" [title]="\'Filter\' | sdTranslate" icon="filter_list" size="sm"\r\n (action)="onFilterPopup()"></sd-button>\r\n <sd-button *ngIf="!gridOption?.hideReload" class="mr-6" [title]="\'Reload\' | sdTranslate" icon="refresh"\r\n size="sm" (action)="reload()"></sd-button>\r\n <sd-button *ngIf="gridOption.onImportExcel" class="mr-6" [title]="\'Import\' | sdTranslate" icon="publish"\r\n size="sm" (action)="sdGridImportExcel.open()"></sd-button>\r\n <ng-container *ngIf="sdGridPopupExportExcel">\r\n <sd-button *ngIf="!gridOption.key" class="mr-6" [title]="\'Export\' | sdTranslate" icon="get_app" size="sm"\r\n (action)="sdGridPopupExportExcel.exportDefault()" [disabled]="!viewItems?.length">\r\n </sd-button>\r\n <sd-button *ngIf="gridOption.key" class="mr-6" [title]="\'Export\' | sdTranslate" icon="get_app" size="sm"\r\n [matMenuTriggerFor]="menu" [disabled]="!viewItems?.length">\r\n </sd-button>\r\n <mat-menu #menu="matMenu">\r\n <button mat-menu-item (click)="sdGridPopupExportExcel.exportDefault()" type="button">\r\n <mat-icon>get_app</mat-icon>\r\n <span> {{\'Export all columns\' | sdTranslate}}</span>\r\n </button>\r\n <button mat-menu-item (click)="sdGridPopupExportExcel.open()" type="button">\r\n <mat-icon>settings</mat-icon>\r\n <span> {{\'Configure\' | sdTranslate}}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf="gridOption.key" class="mr-6" [title]="\'Configure\' | sdTranslate" icon="settings" size="sm"\r\n (action)="sdGridConfig.open()"></sd-button>\r\n </div>\r\n <div style="flex: 1;">\r\n <mat-paginator [length]="total" [pageSize]="gridOption.paginate?.pageSize" hidePageSize>\r\n </mat-paginator>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n<ng-template #elseMobileOrTablet>\r\n <div class="sd-box c-mobile-box">\r\n <div *ngIf="!gridOption?.mobileOrTablet?.useGridView" class="sd-box-body c-mobile-body"\r\n [ngClass]="{\'c-loading\': isLoading}" #gridBody>\r\n <i [ngClass]="{\'d-none\': !isLoading}" class="fa fa-4x fa-spinner fa-pulse c-loading-icon"></i>\r\n <ng-container *ngFor="let item of viewItems">\r\n <div class="c-mobile-item" [ngClass]="{\'c-mobile-item-selected\':item.isChecked}">\r\n <sd-grid-mobile-item-view [gridOption]="gridOption" [item]="item" (check)="onCheck(item)">\r\n </sd-grid-mobile-item-view>\r\n <div class="p-2" *ngIf="gridOption?.subInformation && item?.subInformation?.isOpened">\r\n <sd-grid-sub-information [subItems]="item?.subInformation?.subItems" [option]="gridOption?.subInformation">\r\n </sd-grid-sub-information>\r\n </div>\r\n <div class="c-mobile-command">\r\n <div>\r\n <i *ngIf="gridOption?.subInformation && item.subInformation?.isLoading"\r\n class="fa fa-spinner fa-spin ml-1 c-mobile-action" (click)="expandOrCollapse(item)"></i>\r\n <i *ngIf="gridOption?.subInformation && !item.subInformation?.isLoading" class="fa ml-1 c-mobile-action"\r\n [ngClass]="{\'fa-plus\': !item.subInformation?.isOpened, \'fa-minus\': item.subInformation?.isOpened}"\r\n (click)="expandOrCollapse(item)"></i>\r\n </div>\r\n <ng-container *ngIf="gridOption.commands | mobileCommandFilter:item | async; $implicit as filteredCommands">\r\n <div *ngIf="filteredCommands.length">\r\n <button [matMenuTriggerFor]="menu" aria-hidden="true" mat-icon-button type="button">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n \x3c!-- <i [matMenuTriggerFor]="menu" class="fa fa-navicon fa-fw c-mobile-action"></i> --\x3e\r\n <mat-menu #menu="matMenu">\r\n