@syncfusion/ej2-treegrid
Version:
Essential JS 2 TreeGrid Component
1 lines • 368 kB
JavaScript
this.ej=this.ej||{},this.ej.treegrid=function(e,t,i,r,n,o){"use strict";function a(e){if(e.treeGrid&&e.treeGrid.isGantt)return!!e.taskFields.hasChildMapping&&(e.dataSource instanceof n.DataManager&&((t=e.dataSource.adaptor)instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor));if(e.dataSource instanceof n.DataManager){var t=e.dataSource.adaptor;return t instanceof n.ODataAdaptor||t instanceof n.WebApiAdaptor||t instanceof n.WebMethodAdaptor||t instanceof n.CacheAdaptor||t instanceof n.UrlAdaptor}return!1}function s(e){return!!(e.dataSource&&"result"in e.dataSource)}function d(e){for(var t=0;t<e.columns.length;t++)if(e.columns[parseInt(t.toString(),10)].showCheckbox)return!0;return!1}function l(e){return!((t.isNullOrUndefined(e.grid.searchSettings.key)||""===e.grid.searchSettings.key||"Child"!==e.searchSettings.hierarchyMode&&"None"!==e.searchSettings.hierarchyMode)&&(!e.allowFiltering||!e.grid.filterSettings.columns.length||"Child"!==e.filterSettings.hierarchyMode&&"None"!==e.filterSettings.hierarchyMode))}function p(e){for(var t=[],r=0,n=Object.keys(e).length;r<n;r++)i.getObject("hasChildRecords",e[parseInt(r.toString(),10)])&&t.push(e[parseInt(r.toString(),10)]);return t}function h(e,i,r){var n,o=t.isNullOrUndefined(i.parentItem)?null:m(e,i.parentItem.uniqueID);return null==o||(!e.initialRender||t.isNullOrUndefined(o[e.expandStateMapping])||o[e.expandStateMapping]?!1!==o.expanded&&(!o.parentItem||(n=m(e,o.parentItem.uniqueID),n&&e.initialRender&&!t.isNullOrUndefined(n[e.expandStateMapping])&&!n[e.expandStateMapping]?(n.expanded=!1,!1):(!n||!1!==n.expanded)&&(!n||h(e,n)))):(o.expanded=!1,!1))}function c(e){var i=[];if(t.isNullOrUndefined(e)||!e.hasChildRecords&&!t.isNullOrUndefined(e.childRecords)&&!e.childRecords.length)return[];if(!t.isNullOrUndefined(e.childRecords))for(var r=e.childRecords.filter(function(e){return!e.isSummaryRow}),n=0,o=Object.keys(r).length;n<o;n++)i.push(r[parseInt(n.toString(),10)]),(r[parseInt(n.toString(),10)].hasChildRecords||!t.isNullOrUndefined(r[parseInt(n.toString(),10)].childRecords)&&r[parseInt(n.toString(),10)].childRecords.length)&&(i=i.concat(c(r[parseInt(n.toString(),10)])));return i}function u(e){if(a(e)){var i=e.dataSource;return!t.isNullOrUndefined(i.ready)}return!0}function g(e){for(var t,i,r=[],n=0;e&&n<e.length;n++){i=Object.keys(e[parseInt(n.toString(),10)]),t={};for(var o=0;o<i.length;o++)t[i[parseInt(o.toString(),10)]]=e[parseInt(n.toString(),10)][i[parseInt(o.toString(),10)]];r.push(t)}return r}function f(e){return delete e.hasChildRecords,delete e.childRecords,delete e.index,delete e.parentItem,delete e.level,delete e.taskData,delete e.uniqueID,e}function m(e,t,i){if(i){return e.uniqueIDFilterCollection[""+t]}return e.uniqueIDCollection[""+t]}function y(e){var t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility}function S(e,i,r,o,a,s,d){var l,p,h,c=e.value,u=e.action,f=i.grid.getPrimaryKeyFieldNames()[0],y=i.dataSource instanceof n.DataManager?i.dataSource.dataSource.json:i.dataSource,S=i.grid.dataSource,R=[],x=c,C=!1;if("Batch"===i.editSettings.mode&&(h=i.grid.editModule.getBatchChanges()),"add"===u||"batchsave"===u&&"Batch"===i.editSettings.mode&&h.addedRecords.length){var b=v(e,y,i,r,o,a,d);c=b.value,C=b.isSkip}if(c instanceof Array?R=g(c):R.push(t.extend({},c)),!C&&("add"!==u||"Top"!==i.editSettings.newRowPosition&&"Bottom"!==i.editSettings.newRowPosition))for(var D=0;D<R.length;D++){"object"==typeof R[parseInt(D.toString(),10)][""+f]&&(R[parseInt(D.toString(),10)]=R[parseInt(D.toString(),10)][""+f]);var M=R[parseInt(D.toString(),10)].taskData?Object.keys(R[parseInt(D.toString(),10)].taskData):Object.keys(R[parseInt(D.toString(),10)]);l=0===y.length&&1===S.length?S.length:y.length;for(;l--&&l>=0&&"break"!==function(){if(0===y.length&&1===S.length&&S[parseInt(l.toString(),10)][""+f]===R[parseInt(D.toString(),10)][""+f]||y[parseInt(l.toString(),10)][""+f]===R[parseInt(D.toString(),10)][""+f]){if("delete"!==u){if("edit"===u){for(p=0;p<M.length;p++)if(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],M[parseInt(p.toString(),10)])&&("Cell"!==i.editSettings.mode||!t.isNullOrUndefined(h)&&0===h.changedRecords.length||M[parseInt(p.toString(),10)]===s)){var e=m(i,R[parseInt(D.toString(),10)].uniqueID);y[parseInt(l.toString(),10)][M[parseInt(p.toString(),10)]]=R[parseInt(D.toString(),10)][M[parseInt(p.toString(),10)]],e&&e.taskData&&(e.taskData[M[parseInt(p.toString(),10)]]=e[M[parseInt(p.toString(),10)]]=y[parseInt(l.toString(),10)][M[parseInt(p.toString(),10)]])}}else if("add"===u||"batchsave"===u){var n=void 0;"Child"===i.editSettings.newRowPosition?0===y.length&&1===S.length?y.push(x.taskData):r?(x.taskData[""+i.parentIdMapping]=y[parseInt(l.toString(),10)][""+i.idMapping],y.splice(l+1,0,x.taskData)):(Object.prototype.hasOwnProperty.call(y[parseInt(l.toString(),10)],i.childMapping)||(y[parseInt(l.toString(),10)][""+i.childMapping]=[]),y[parseInt(l.toString(),10)][""+i.childMapping].push(x.taskData),I(f,y[parseInt(l.toString(),10)],u,i,r,x)):"Below"===i.editSettings.newRowPosition?(y.splice(l+1,0,x.taskData),t.isNullOrUndefined(x.parentItem)||I(f,y[l+1],u,i,r,x)):o?"Above"===i.editSettings.newRowPosition&&(y.splice(l,0,x.taskData),t.isNullOrUndefined(x.parentItem)||I(f,y[parseInt(l.toString(),10)],u,i,r,x)):(n=0,y.splice(n,0,x.taskData))}return"break"}var a=y[parseInt(l.toString(),10)];if(y.splice(l,1),r){if(!t.isNullOrUndefined(a[""+i.parentIdMapping]))for(var d=i.flatData.filter(function(e){return e[""+i.idMapping]===a[""+i.parentIdMapping]})[0],c=d?d[""+i.childMapping]:[],g=c.length-1;g>=0;g--)if(c[parseInt(g.toString(),10)][""+i.idMapping]===a[""+i.idMapping]){i.enableImmutableMode||d.childRecords.length!==d.Children.length||d.childRecords.splice(g,1),c.splice(g,1),c.length||(d.hasChildRecords=!1,I(f,d,u,i,r));break}return"break"}}else t.isNullOrUndefined(y[parseInt(l.toString(),10)][""+i.childMapping])||w(y[parseInt(l.toString(),10)][""+i.childMapping],R[parseInt(D.toString(),10)],u,f,i,r,x,s)&&I(f,y[parseInt(l.toString(),10)],u,i,r)}(););}}function v(e,i,r,n,o,a,s){var d,l=!1,p=r.grid.getCurrentViewRecords();switch(d=t.extend({},e.value),d=f(d),r.editSettings.newRowPosition){case"Top":i.unshift(d),l=!0;break;case"Bottom":i.push(d),l=!0;break;case"Above":d=f(t.isNullOrUndefined(s)?0===p.length?d:d=t.extend({},p[o+1]):d=t.extend({},s));break;case"Below":case"Child":if(t.isNullOrUndefined(s)){var h=r.grid.getPrimaryKeyFieldNames()[0],c=p.length>0?p[parseInt(o.toString(),10)]:[];d=f(d=!t.isNullOrUndefined(c)&&c[""+h]===e.value[""+h]||-1!==a&&0!==i.length?t.extend({},c):t.extend({},e.value));r.editModule.internalProperties.taskData=d}else d=f(d=t.extend({},s));-1===a&&(i.unshift(d),l=!0)}return{value:d,isSkip:l}}function w(e,i,r,n,o,a,s,d){for(var l=!1,p=e.length;p--&&p>=0;)if(e[parseInt(p.toString(),10)][""+n]===i[""+n]||a&&e[parseInt(p.toString(),10)][o.parentIdMapping]===i[o.idMapping]){if("edit"===r){for(var h=Object.keys(i),c=m(o,i.uniqueID),u=0;u<h.length;u++)if(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],h[parseInt(u.toString(),10)])&&("Cell"!==o.editSettings.mode||h[parseInt(u.toString(),10)]===d)&&(c[h[parseInt(u.toString(),10)]]=c.taskData[h[parseInt(u.toString(),10)]]=e[parseInt(p.toString(),10)][h[parseInt(u.toString(),10)]]=i[h[parseInt(u.toString(),10)]],"Normal"===o.grid.editSettings.mode&&"Cell"===o.editSettings.mode&&!t.isNullOrUndefined(o.grid.editModule))){o.grid.editModule.editModule.editRowIndex=i.index,o.grid.editModule.editModule.updateCurrentViewData(i)}break}"add"===r||"batchsave"===r?"Child"===o.editSettings.newRowPosition?a?(s[""+o.parentIdMapping]=e[parseInt(p.toString(),10)][o.idMapping],e.splice(p+1,0,s),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(Object.prototype.hasOwnProperty.call(e[parseInt(p.toString(),10)],o.childMapping)||(e[parseInt(p.toString(),10)][o.childMapping]=[]),e[parseInt(p.toString(),10)][o.childMapping].push(s.taskData),I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Above"===o.editSettings.newRowPosition?(e.splice(p,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):"Below"===o.editSettings.newRowPosition&&(e.splice(p+1,0,s.taskData),t.isNullOrUndefined(s.parentItem)||I(n,e[parseInt(p.toString(),10)],r,o,a,s)):(e.splice(p,1),e.length||(l=!0))}else t.isNullOrUndefined(e[parseInt(p.toString(),10)][o.childMapping])||w(e[parseInt(p.toString(),10)][o.childMapping],i,r,n,o,a,s,d)&&I(n,e[parseInt(p.toString(),10)],r,o,a);return l}function I(e,i,r,o,a,s){if("Above"!==o.editSettings.newRowPosition&&"Below"!==o.editSettings.newRowPosition||"add"!==r&&"batchsave"!==r||t.isNullOrUndefined(s.parentItem)){var d,l=o.grid.getCurrentViewRecords();if(l.map(function(t,r){if(t[""+e]===i[""+e])return void(d=r)}),o.enableVirtualization&&t.isNullOrUndefined(d)){var p=t.getValue("uniqueIDCollection."+s.parentUniqueID,o);i=p}if(t.isNullOrUndefined(d)||(i=l[parseInt(d.toString(),10)]),o.enableVirtualization&&t.isNullOrUndefined(i)&&!t.isNullOrUndefined(s)&&(i=t.getValue("uniqueIDCollection."+s.parentUniqueID,o)),a||t.isNullOrUndefined(i.childRecords)||!i.childRecords.length?i.hasChildRecords=!1:i.hasChildRecords=!0,"add"===r||"batchsave"===r){i.expanded=!0,i.hasChildRecords=!0,o.sortSettings.columns.length&&t.isNullOrUndefined(s)&&(s=l.filter(function(e){return e.parentUniqueID===i.uniqueID?e:null}));var h=s?s instanceof Array?s[0]:s:l[d+1];"Below"!==o.editSettings.newRowPosition&&(Object.prototype.hasOwnProperty.call(i,"childRecords")?t.isNullOrUndefined(s)||i[""+e]===s[""+e]||i.childRecords.some(function(e){return e.uniqueID===s.uniqueID})||i.childRecords.push(s):i.childRecords=[],-1===i.childRecords.indexOf(h)&&i[""+e]!==s[""+e]&&i.childRecords.unshift(h),a&&(Object.prototype.hasOwnProperty.call(i,o.childMapping)||(i[o.childMapping]=[]),-1===i[""+o.childMapping].indexOf(h)&&i[""+e]!==s[""+e]&&i[o.childMapping].unshift(h)))}for(var c=o.grid.getPrimaryKeyFieldNames()[0],u=o.grid.dataSource instanceof n.DataManager?o.grid.dataSource.dataSource.json:o.grid.dataSource,g=0;g<u.length;g++)if(u[parseInt(g.toString(),10)][""+c]===i[""+c]){u[parseInt(g.toString(),10)]=i;break}o.grid.setRowData(e,i);var f=o.getRowByIndex(d);"Batch"===o.editSettings.mode&&(f="add"===r?o.getRows()[o.grid.getCurrentViewRecords().indexOf(i)]:o.getRows()[o.grid.getRowIndexByPrimaryKey(i[""+e])]);var y=void 0;if((o.frozenRows||o.getFrozenColumns())&&(y=o.getRowByIndex(d)),!o.enableVirtualization&&!t.isNullOrUndefined(f)||!t.isNullOrUndefined(y)){var S=o.treeColumnIndex;o.allowRowDragAndDrop&&o.enableImmutableMode&&(S+=1),o.renderModule.cellRender({data:i,cell:f.cells[parseInt(S.toString(),10)]?f.cells[parseInt(S.toString(),10)]:y.cells[S-o.getFrozenColumns()],column:o.grid.getColumns()[o.treeColumnIndex],requestType:r}),(o.enableImmutableMode&&"indenting"===o.action||"outdenting"===o.action)&&o.renderModule.RowModifier({data:i,row:f})}}else m(o,s.parentItem.uniqueID).childRecords.push(s)}var R=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),x=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},C=function(){function e(e){this.allowEditing=!0,this.edit={},this.disableHtmlEncode=!0,this.allowReordering=!0,this.showColumnMenu=!0,this.allowFiltering=!0,this.allowSorting=!0,this.allowResizing=!0,this.filter={},this.enableRowSpan=!0,this.enableColumnSpan=!0,t.merge(this,e)}return e.prototype.setProperties=function(e){for(var t=Object.keys(e),i=0;i<t.length;i++)if(this[t[parseInt(i.toString(),10)]]=e[t[parseInt(i.toString(),10)]],this.parent&&this.parent.isReact&&"template"===t[parseInt(i.toString(),10)]){this.parent.clipboardModule.treeGridParent.renderModule.refreshReactColumnTemplateByUid(this.uid)}},e}(),b=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return R(i,e),x([t.Property(null)],i.prototype,"columns",void 0),i}(C),D=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return R(t,e),t}(b),M=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),O=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},P=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return M(i,e),O([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),A=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),E=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return A(i,e),E([t.Property()],i.prototype,"field",void 0),E([t.Property()],i.prototype,"operator",void 0),E([t.Property()],i.prototype,"value",void 0),E([t.Property()],i.prototype,"matchCase",void 0),E([t.Property()],i.prototype,"ignoreAccent",void 0),E([t.Property()],i.prototype,"predicate",void 0),E([t.Property({})],i.prototype,"actualFilterValue",void 0),E([t.Property({})],i.prototype,"actualOperator",void 0),E([t.Property()],i.prototype,"type",void 0),E([t.Property()],i.prototype,"ejpredicate",void 0),E([t.Property()],i.prototype,"uid",void 0),E([t.Property()],i.prototype,"isForeignKey",void 0),i}(t.ChildProperty),U=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return A(i,e),E([t.Collection([],N)],i.prototype,"columns",void 0),E([t.Property("FilterBar")],i.prototype,"type",void 0),E([t.Property()],i.prototype,"mode",void 0),E([t.Property(!0)],i.prototype,"showFilterBarStatus",void 0),E([t.Property(1500)],i.prototype,"immediateModeDelay",void 0),E([t.Property()],i.prototype,"operators",void 0),E([t.Property(!1)],i.prototype,"ignoreAccent",void 0),E([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),k=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),q=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},B=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return k(i,e),q([t.Property("Both")],i.prototype,"wrapMode",void 0),i}(t.ChildProperty),T=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),V="https://ej2.syncfusion.com/documentation/treegrid",z="https://ej2.syncfusion.com/documentation",L=!1,F=function(e){function r(t){return i.Grid.Inject(i.Logger),e.call(this,t)||this}return T(r,e),r.prototype.getModuleName=function(){return"logger"},r.prototype.log=function(e,r){e instanceof Array||(e=[e]);for(var n=e,o=0;o<n.length;o++){var a=i.detailLists[n[parseInt(o.toString(),10)]],s=a.check(r,this.parent);if(s.success){var d=a.generateMessage(r,this.parent,s.options);d=d.replace("EJ2Grid","EJ2TreeGrid").replace("* Hierarchy Grid","").replace("* Grouping",""),L&&"primary_column_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace("Editing","Row DragAndDrop"),L=!1);var l=d.indexOf("https"),p=d.substring(l);"module_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,V+"/modules"):"primary_column_missing"===n[parseInt(o.toString(),10)]||"selection_key_missing"===n[parseInt(o.toString(),10)]?d=d.replace(p,z+"/api/treegrid/column/#isprimarykey"):"grid_remote_edit"===n[parseInt(o.toString(),10)]?d=d.replace(p,V+"/edit"):"virtual_height"===n[parseInt(o.toString(),10)]?d=d.replace(p,V+"/virtual"):"check_datasource_columns"===n[parseInt(o.toString(),10)]?d=d.replace(p,V+"/columns"):"locale_missing"===n[parseInt(o.toString(),10)]&&(d=d.replace(p,V+"/global-local/#localization")),"datasource_syntax_mismatch"===n[parseInt(o.toString(),10)]?t.isNullOrUndefined(this.treeGridObj)||t.isNullOrUndefined(this.treeGridObj.dataStateChange)||console[a.logType](d):console[a.logType](d)}}},r.prototype.treeLog=function(e,t,i){this.treeGridObj=i,e instanceof Array||(e=[e]);var r=e;i.allowRowDragAndDrop&&!i.columns.filter(function(e){return e.isPrimaryKey}).length&&(L=!0,this.log("primary_column_missing",t));for(var n=0;n<r.length;n++){var o=j[r[parseInt(n.toString(),10)]],a=o.check(t,i);if(a.success){var s=o.generateMessage(t,i,a.options);console[o.logType](s)}}},r}(i.Logger),j={mapping_fields_missing:{type:"mapping_fields_missing",logType:"error",check:function(e,i){var r={success:!1};return(t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.childMapping)&&t.isNullOrUndefined(i.parentIdMapping)||!t.isNullOrUndefined(i.idMapping)&&t.isNullOrUndefined(i.parentIdMapping)||t.isNullOrUndefined(i.idMapping)&&!t.isNullOrUndefined(i.parentIdMapping))&&(r={success:!0}),r},generateMessage:function(){return"[EJ2TreeGrid.Error]: MAPPING FIELDS MISSING \nOne of the following fields is missing. It is required for the hierarchical relationship of records in TreeGrid:\n* childMapping\n* idMapping\n* parentIdMapping\nRefer to the following documentation links for more details.\n"+z+"/api/treegrid#childmapping\n"+z+"/api/treegrid#idmapping\n"+z+"/api/treegrid#$parentidmapping"}}},_=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),H=function(e){function i(t,i){var r=e.call(this,t.grid,i)||this;return r.treeCopyContent="",r.copiedUniqueIdCollection=[],r.treeGridParent=t,r.serviceLocator=i,r}return _(i,e),i.prototype.setCopyData=function(i){var r=this.treeGridParent.getCurrentViewRecords();if(""===window.getSelection().toString()){this.clipBoardTextArea.value=this.copyContent="";var n=this.treeGridParent.grid.getRows();if("Cell"!==this.treeGridParent.selectionSettings.mode){for(var o=this.treeGridParent.getSelectedRowIndexes().sort(function(e,t){return e-t}),a=0;a<o.length;a++){a>0&&(this.treeCopyContent+="\n");var s=o[parseInt(a.toString(),10)];if(!n[s].classList.contains("e-summaryrow")){var d=[].slice.call(n[s].querySelectorAll(".e-rowcell")),l=this.treeGridParent.getSelectedRecords()[parseInt(a.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&("Parent"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.parentContentData(r,s,n,i,a),this.getCopyData(d,!1,"\t",i),this.treeCopyContent+=this.copyContent,this.copiedUniqueIdCollection.push(l),this.copyContent="","Child"!==this.treeGridParent.copyHierarchyMode&&"Both"!==this.treeGridParent.copyHierarchyMode||this.childContentData(r,o[parseInt(a.toString(),10)],n,i))}}if(i){var p=this.treeGridParent.getVisibleColumns().map(function(e){return e.headerText});this.getCopyData(p,!1,"\t",i),this.treeCopyContent=this.copyContent+"\n"+this.treeCopyContent}var h={data:this.treeCopyContent,cancel:!1};if(this.treeGridParent.trigger("beforeCopy",h),h.cancel)return;this.clipBoardTextArea.value=this.copyContent=h.data,t.Browser.userAgent.match(/ipad|ipod|iphone/i)?this.clipBoardTextArea.setSelectionRange(0,this.clipBoardTextArea.value.length):this.clipBoardTextArea.select(),this.isSelect=!0,this.copiedUniqueIdCollection=[],this.treeCopyContent=""}else e.prototype.setCopyData.call(this,i)}},i.prototype.parentContentData=function(e,i,r,n,o){if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem))for(var a=e[parseInt(i.toString(),10)].parentItem.level,s=0;s<a+1;s++)for(var d=0;d<e.length;d++)if(!t.isNullOrUndefined(e[parseInt(i.toString(),10)].parentItem)&&e[parseInt(d.toString(),10)].uniqueID===e[parseInt(i.toString(),10)].parentItem.uniqueID){i=d;var l=[].slice.call(r[parseInt(i.toString(),10)].querySelectorAll(".e-rowcell")),p=e[parseInt(d.toString(),10)].uniqueID;if(-1===this.copiedUniqueIdCollection.indexOf(p)){this.getCopyData(l,!1,"\t",n),this.treeCopyContent=o>0?this.treeCopyContent+this.copyContent+"\n":this.copyContent+"\n"+this.treeCopyContent,this.copiedUniqueIdCollection.push(p),this.copyContent="";break}}},i.prototype.copy=function(t){e.prototype.copy.call(this,t)},i.prototype.paste=function(t,i,r){e.prototype.paste.call(this,t,i,r)},i.prototype.getModuleName=function(){return"clipboard"},i.prototype.destroy=function(){e.prototype.destroy.call(this)},i.prototype.childContentData=function(e,i,r,n){if(e[parseInt(i.toString(),10)].hasChildRecords)for(var o=e[parseInt(i.toString(),10)].childRecords,a=0;a<o.length;a++)for(var s=0;s<e.length;s++)if(!t.isNullOrUndefined(o[parseInt(a.toString(),10)].uniqueID)&&e[parseInt(s.toString(),10)].uniqueID===o[parseInt(a.toString(),10)].uniqueID){if(!t.isNullOrUndefined(r[parseInt(s.toString(),10)])&&!r[parseInt(s.toString(),10)].classList.contains("e-summaryrow")){var d=[].slice.call(r[parseInt(s.toString(),10)].querySelectorAll(".e-rowcell")),l=e[parseInt(s.toString(),10)].uniqueID;-1===this.copiedUniqueIdCollection.indexOf(l)&&(this.getCopyData(d,!1,"\t",n),this.treeCopyContent+="\n"+this.copyContent,this.copyContent="",this.copiedUniqueIdCollection.push(l),this.childContentData(e,s,r,n))}break}},i}(i.Clipboard),G=function(){function e(e){this.headerCheckboxFrameEl=null,this.checkboxColIndexCache=-2,this.parentSelectionCounters={},this.selectedUidMap=new Map,this.totalSelectableCount=0,this.headerSelectionState="uncheck",this.checkedItemCount=0,this.visibleUidIndex={},this.parent=e,this.selectedItems=[],this.selectedIndexes=[],this.filteredList=[],this.searchingRecords=[],this.addEventListener()}return e.prototype.getModuleName=function(){return"selection"},e.prototype.buildVisibleUidMap=function(){this.visibleUidIndex={};var e=this.parent.grid.currentViewData;if(e)for(var t=0,i=e.length;t<i;t++){var r=e[parseInt(t.toString(),10)];r&&r.uniqueID&&(this.visibleUidIndex[r.uniqueID]=t)}},e.prototype.addEventListener=function(){this.parent.on("dataBoundArg",this.headerCheckbox,this),this.parent.on("columnCheckbox",this.columnCheckbox,this),this.parent.on("updateGridActions",this.updateGridActions,this),this.parent.grid.on("colgroup-refresh",this.headerCheckbox,this),this.parent.on("checkboxSelection",this.checkboxSelection,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("dataBoundArg",this.headerCheckbox),this.parent.off("columnCheckbox",this.columnCheckbox),this.parent.grid.off("colgroup-refresh",this.headerCheckbox),this.parent.off("checkboxSelection",this.checkboxSelection),this.parent.off("updateGridActions",this.updateGridActions))},e.prototype.destroy=function(){this.resetSelectionCaches(),this.removeEventListener()},e.prototype.checkboxSelection=function(e){var r,n,o=i.getObject("target",e),s=i.parentsUntil(o,"e-checkbox-wrapper");if(s&&s.querySelectorAll(".e-treecheckselect").length>0){n=s.querySelector('input[type="checkbox"]');var d=[];this.parent.frozenRows?d.push(parseInt(o.closest("tr").getAttribute("aria-rowindex"),10)-1):d.push(o.closest("tr").rowIndex),this.selectCheckboxes(d);var l=n.nextElementSibling.classList.contains("e-check");this.triggerChkChangeEvent(n,l,o.closest("tr"))}else if(s&&s.querySelectorAll(".e-treeselectall").length>0&&this.parent.autoCheckHierarchy){var p=s.querySelector(".e-frame"),h=!p.classList.contains("e-check")&&!p.classList.contains("e-stop");this.headerSelection(h),n=s.querySelector('input[type="checkbox"]'),this.triggerChkChangeEvent(n,h,o.closest("tr"))}!t.isNullOrUndefined(this.parent.parentQuery)&&this.parent.selectionSettings.persistSelection&&this.parent.columnModel.filter(function(e){return"checkbox"===e.type}).length>0&&a(this.parent)&&this.parent.parentQuery.length>0&&((r=this.parent.query.queries).push.apply(r,this.parent.parentQuery),this.parent.parentQuery=[])},e.prototype.triggerChkChangeEvent=function(e,t,i){var r=this.parent.getCurrentViewRecords()[i.rowIndex],n={checked:t,target:e,rowElement:i,rowData:e.classList.contains("e-treeselectall")?this.parent.getCheckedRecords():r};this.parent.trigger("checkboxChange",n)},e.prototype.getCheckboxcolumnIndex=function(){if(-2!==this.checkboxColIndexCache)return this.checkboxColIndexCache;for(var e,i=-1,r=this.parent.stackedHeader?this.parent.columnModel:this.parent.columns,n=0;n<r.length;n++)if(r[parseInt(n.toString(),10)].showCheckbox){e=r[parseInt(n.toString(),10)].uid;break}for(var o=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv"),a=0;a<o.length;a++)if(o[parseInt(a.toString(),10)].getAttribute("data-mappinguid")===e){i=a;break}return this.checkboxColIndexCache=t.isNullOrUndefined(i)?-1:i,this.checkboxColIndexCache},e.prototype.headerCheckbox=function(){if(this.buildVisibleUidMap(),this.totalSelectableCount=this.countSelectableRecords(this.resolveHeaderSelectionList(!0)),this.columnIndex=this.getCheckboxcolumnIndex(),this.columnIndex>-1){var e=this.parent.getHeaderContent().querySelectorAll(".e-headercelldiv")[this.columnIndex];if(e&&0===e.querySelectorAll(".e-treeselectall").length){var i=this.parent.createElement("input",{className:"e-treeselectall",attrs:{type:"checkbox"}}),n=r.createCheckBox(this.parent.createElement,!1,{checked:!1,label:" "});n.classList.add("e-hierarchycheckbox"),n.insertBefore(i.cloneNode(),n.firstChild),t.isNullOrUndefined(e)||e.insertBefore(n,e.firstChild),this.headerCheckboxFrameEl=n.querySelector(".e-frame"),this.parent.autoCheckHierarchy&&this.headerSelection()}else e&&e.querySelectorAll(".e-treeselectall").length>0&&(this.headerCheckboxFrameEl=e.querySelector(".e-frame"),this.parent.autoCheckHierarchy&&this.headerSelection())}},e.prototype.renderColumnCheckbox=function(e){var i=this.parent.createElement("input",{className:"e-treecheckselect",attrs:{type:"checkbox","aria-label":"checkbox"}}),n=e.data;e.cell.classList.add("e-treegridcheckbox"),e.cell.setAttribute("aria-label","checkbox");var o="check"===n.checkboxState,a=r.createCheckBox(this.parent.createElement,!1,{checked:o,label:" "});if(a.classList.add("e-hierarchycheckbox"),this.parent.allowTextWrap&&(a.querySelector(".e-frame").style.width="18px"),"indeterminate"===n.checkboxState){s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-stop")}else if("uncheck"===n.checkboxState){s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-uncheck")}else if("check"===n.checkboxState){var s=a.querySelectorAll(".e-frame")[0];t.removeClass([s],["e-check","e-stop","e-uncheck"]),a.querySelector(".e-frame").classList.add("e-check")}return a.insertBefore(i.cloneNode(),a.firstChild),a},e.prototype.columnCheckbox=function(e){var i=this.renderColumnCheckbox(e),r=e.cell.querySelector(".e-treecolumn-container");if(t.isNullOrUndefined(r)){var n=this.parent.createElement("span",{className:"e-treecheckbox"}),o=e.cell.innerHTML;e.cell.innerHTML="",n.innerHTML=o;var a=this.parent.createElement("div",{className:"e-treecheckbox-container"});a.appendChild(i),a.appendChild(n),e.cell.appendChild(a)}else e.cell.querySelector(".e-hierarchycheckbox")||r.insertBefore(i,r.querySelectorAll(".e-treecell")[0])},e.prototype.selectCheckboxes=function(e){for(var t=0;t<e.length;t++){var i=this.parent.getCurrentViewRecords()[e[parseInt(t.toString(),10)]],r=m(this.parent,i.uniqueID),n="check"===r.checkboxState?"uncheck":"check";r.checkboxState=n,this.traverSelection(r,n,!1)}},e.prototype.traverSelection=function(e,t,i){var r=e.checkboxState;i||this.buildVisibleUidMap();var n=Array.isArray(e.childRecords)?e.childRecords:[];if(n&&0!==n.length||!this.parent.autoCheckHierarchy||(n=this.getChildrenFromFlat(e)),this.parent.filterModule&&this.parent.filterModule.filteredResult.length>0&&n&&n.length&&(n=this.getFilteredChildRecords(n)),!this.parent.autoCheckHierarchy||!n||0===n.length)return this.updateSelectedItems(e,t),void(i||(e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem),this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(),""),this.refreshVisibleCheckboxes(),this.parent.autoCheckHierarchy&&this.updateHeaderCheckboxState()));for(var o=0,a=0,s=0,d=0;d<n.length;d++){var l=n[parseInt(d.toString(),10)];l&&!l.isSummaryRow&&(o++,this.updateSelectedItems(l,t,!0),l.hasChildRecords&&this.traverSelection(l,t,!0),"check"===l.checkboxState?a++:"indeterminate"===l.checkboxState&&s++)}e.uniqueID&&(this.parentSelectionCounters[e.uniqueID]={total:o,checked:a,indeterminate:s});var p=this.parentSelectionCounters[e.uniqueID],h=this.deriveParentState(e,p);if("check"===t&&p.total>0&&p.checked===p.total&&0===p.indeterminate&&(h="check"),this.updateSelectedItems(e,h),!i&&e.parentItem&&this.parent.autoCheckHierarchy&&this.updateParentSelection(e.parentItem,r,h),!i){var c=this.resolveHeaderSelectionList();this.updateSelectedCollectionsAfterBulk(c,""),this.refreshVisibleCheckboxes(),this.updateHeaderCheckboxState()}},e.prototype.getFilteredChildRecords=function(e){var t=this;return e.filter(function(e){return t.parent.filterModule.filteredResult.indexOf(e)>-1})},e.prototype.getChildrenFromFlat=function(e){var t=this.parent.flatData;if(!t||!e)return[];for(var i=e.uniqueID,r=[],n=0;n<t.length;n++){var o=t[parseInt(n.toString(),10)];if(o&&!o.isSummaryRow){var a=o.parentItem;a&&a.uniqueID===i&&r.push(o)}}return r},e.prototype.updateParentSelection=function(e,t,i){var r=m(this.parent,e.uniqueID);if(r){var n=this.buildSelectionSummary(r);t&&this.applySummaryDelta(n,t,-1),i&&this.applySummaryDelta(n,i,1),r.uniqueID&&(this.parentSelectionCounters[r.uniqueID]=n);var o=this.deriveParentState(r,n);if(r.checkboxState!==o){var a=r.checkboxState;r.checkboxState=o,this.updateSelectedItems(r,o),r.parentItem&&this.updateParentSelection(r.parentItem,a,o)}}},e.prototype.buildSelectionSummary=function(e,t){var i={total:0,checked:0,indeterminate:0},r=[];r=e&&Array.isArray(e.childRecords)&&e.childRecords.length?e.childRecords:this.getChildrenFromFlat(e),!t&&this.parent.filterModule&&this.parent.filterModule.filteredResult.length>0&&(r=this.getFilteredChildRecords(r));for(var n=0;n<r.length;n++){var o=r[parseInt(n.toString(),10)];o&&!o.isSummaryRow&&(i.total++,"check"===o.checkboxState?i.checked++:"indeterminate"===o.checkboxState&&i.indeterminate++)}return i},e.prototype.applySummaryDelta=function(e,t,i){"check"===t?e.checked=Math.max(0,e.checked+i):"indeterminate"===t&&(e.indeterminate=Math.max(0,e.indeterminate+i))},e.prototype.deriveParentState=function(e,t){var i=t.total,r=t.checked;return t.indeterminate>0||r>0&&r!==i?"indeterminate":r===i&&i>0?"check":"uncheck"},e.prototype.headerSelection=function(e){if(!t.isNullOrUndefined(this.parent.filterModule)&&this.parent.filterModule.filteredResult.length>0){var i=this.parent.filterModule.filteredResult;0===this.filteredList.length&&(this.filteredList=i),this.parent.grid.searchSettings.key.length?this.searchingRecords=i:this.filteredList===i||this.parent.grid.searchSettings.key.length||(this.filteredList=i,this.searchingRecords=[])}this.searchingRecords.length>0&&!t.isNullOrUndefined(e)?this.filteredList=this.searchingRecords:this.filteredList.length>0&&!this.parent.filterSettings.columns.length&&!this.parent.grid.searchSettings.key.length&&(this.filteredList=[]);var r=this.resolveHeaderSelectionList(!0);if(!t.isNullOrUndefined(e)){this.resetSelectionCaches();var n=e?"check":"uncheck";return this.headerSelectionState=n,this.processHeaderSelection(r,n),this.finalizeParentsAfterBulk(r),this.updateSelectedCollectionsAfterBulk(r,""),this.refreshVisibleCheckboxes(),void this.updateHeaderCheckboxState()}this.totalSelectableCount=this.countSelectableRecords(r),this.updateHeaderCheckboxState()},e.prototype.finalizeParentsAfterBulk=function(e){for(var t=e,i=0;i<t.length;i++){var r=t[parseInt(i.toString(),10)];if(r&&r.hasChildRecords){var n=this.buildSelectionSummary(r,!0);this.parentSelectionCounters[r.uniqueID]=n;var o=this.deriveParentState(r,n);"check"===this.headerSelectionState&&n.total>0&&n.checked===n.total&&0===n.indeterminate?o="check":"uncheck"===this.headerSelectionState&&(o="uncheck"),r.checkboxState!==o&&this.updateSelectedItems(r,o)}}},e.prototype.processHeaderSelection=function(e,t){for(var i=0;i<e.length;i++){var r=e[parseInt(i.toString(),10)];r&&(r.checkboxState!==t&&(r.checkboxState=t,this.updateSelectedItems(r,t,!0)))}},e.prototype.updateSelectedCollectionsAfterBulk=function(e,t){for(var i=!!(this.parent.filterModule&&this.parent.filterModule.filteredResult&&this.parent.filterModule.filteredResult.length),r=!!(this.parent.grid&&this.parent.grid.searchSettings&&this.parent.grid.searchSettings.key&&this.parent.grid.searchSettings.key.length),n=i||r||"refresh"===t||"searching"===t,o=n?e:this.selectedItems.slice(),a=[],s=new Map,d=[],l=0,p=o;l<p.length;l++)(y=p[l]).hasChildRecords&&n&&0===y.level&&this.updateParentSelection(y),y.uniqueID&&"check"===y.checkboxState&&(a.push(y),s.set(y.uniqueID,!0));if(!n){var h=this.parent.flatData;if(h)for(var c=0,u=h;c<u.length;c++){var g=u[c];g&&!g.isSummaryRow&&(g.uniqueID&&"check"===g.checkboxState&&!s.has(g.uniqueID)&&(a.push(g),s.set(g.uniqueID,!0)))}}this.selectedItems=a,this.selectedUidMap=s,this.buildVisibleUidMap();for(var f=0,m=this.selectedItems;f<m.length;f++){var y=m[f],S=this.visibleUidIndex[y.uniqueID];void 0!==S&&d.push(S)}this.selectedIndexes=d,this.checkedItemCount=this.selectedItems.length,this.totalSelectableCount=this.countSelectableRecords(e)},e.prototype.refreshVisibleCheckboxes=function(){this.buildVisibleUidMap();for(var e=this.parent.getCurrentViewRecords(),i=this.parent.uniqueIDCollection,r=0;e&&r<e.length;r++){var n=e[parseInt(r.toString(),10)];if(n){var o=n.uniqueID,a=i&&null!=o?i[String(o)]:n,s=a&&a.checkboxState?a.checkboxState:"uncheck",d=null,l=n.uid;if(l&&(d=this.parent.grid.getRowElementByUID(l)),!d){var p=this.parent.getRows();if(d=p&&p[parseInt(r.toString(),10)],(this.parent.frozenRows||this.parent.getFrozenColumns())&&!d){var h=this.parent.getDataRows();d=h&&h[parseInt(r.toString(),10)]}}if(d){var c=d.querySelector(".e-hierarchycheckbox .e-frame");if(c){t.removeClass([c],["e-check","e-stop","e-uncheck"]),c.classList.add("indeterminate"===s?"e-stop":"e-"+s);var u=d.querySelector(".e-treecheckselect");u&&u.setAttribute("aria-checked","check"===s?"true":"uncheck"===s?"false":"mixed")}}}}},e.prototype.resetSelectionCaches=function(){this.parentSelectionCounters={},this.selectedUidMap=new Map,this.selectedItems=[],this.selectedIndexes=[],this.totalSelectableCount=0,this.headerSelectionState="uncheck",this.checkedItemCount=0},e.prototype.countSelectableRecords=function(e){var t=0;if(!e)return t;for(var i=0;i<e.length;i++){var r=e[parseInt(i.toString(),10)];r&&!r.isSummaryRow&&t++}return t},e.prototype.resolveHeaderSelectionList=function(e){var t=[];if(a(this.parent))t=this.parent.getCurrentViewRecords();else{var i=!!(this.parent.filterModule&&this.parent.filterModule.filteredResult&&this.parent.filterModule.filteredResult.length),r=!!(this.parent.grid&&this.parent.grid.searchSettings&&this.parent.grid.searchSettings.key&&this.parent.grid.searchSettings.key.length);t=i?this.filteredList&&this.filteredList.length?this.filteredList:this.parent.filterModule.filteredResult:r&&this.searchingRecords&&this.searchingRecords.length?this.searchingRecords:this.parent.flatData}return t},e.prototype.updateHeaderCheckboxState=function(){var e=this.headerCheckboxFrameEl;if(e){var i=this.resolveHeaderSelectionList(!0);this.totalSelectableCount=this.countSelectableRecords(i);for(var r=0,n=0,o=i;n<o.length;n++){var a=o[n];a&&!a.isSummaryRow&&"check"===a.checkboxState&&r++}t.removeClass([e],["e-check","e-stop","e-uncheck"]),0===this.totalSelectableCount?e.classList.add("e-uncheck"):0===r?e.classList.add("e-uncheck"):r===this.totalSelectableCount?e.classList.add("e-check"):e.classList.add("e-stop")}},e.prototype.updateSelectedItems=function(e,i,r){this.buildVisibleUidMap();var n=e.uniqueID,o=this.parent.uniqueIDCollection,a=o&&null!=n&&o[String(n)]?o[String(n)]:e,s=!0===e.isSummaryRow,d=a.checkboxState,l=this.visibleUidIndex[String(n)];if(a.checkboxState=i,!r){if(!s&&d!==i)if("check"===i)this.checkedItemCount++,this.selectedUidMap.has(String(n))||(a.uniqueID&&this.selectedUidMap.set(String(a.uniqueID),!0),this.selectedItems.push(a),void 0!==l&&-1===this.selectedIndexes.indexOf(l)&&this.selectedIndexes.push(l));else if(("check"===d||"indeterminate"===d)&&(this.checkedItemCount>0&&this.checkedItemCount--,a&&a.uniqueID&&this.selectedUidMap.has(String(a.uniqueID)))){this.selectedUidMap.delete(String(a.uniqueID));var p=this.selectedItems.indexOf(a);if(-1!==p&&this.selectedItems.splice(p,1),void 0!==l){var h=this.selectedIndexes.indexOf(l);h>-1&&this.selectedIndexes.splice(h,1)}}var c=null,u=e.uid;if(u&&(c=this.parent.grid.getRowElementByUID(u)),!c){var g=void 0!==l?l:"number"==typeof this.visibleUidIndex[String(n)]?this.visibleUidIndex[String(n)]:-1;g>-1&&((c=this.parent.getRows()[parseInt(g.toString(),10)])||!this.parent.frozenRows&&!this.parent.getFrozenColumns()||(c=this.parent.getDataRows()[parseInt(g.toString(),10)]))}if(c){var f=c.querySelector(".e-hierarchycheckbox .e-frame");f&&(t.removeClass([f],["e-check","e-stop","e-uncheck"]),f.classList.add("indeterminate"===i?"e-stop":"e-"+i));var m=c.querySelector(".e-treecheckselect");m&&m.setAttribute("aria-checked","check"===i?"true":"uncheck"===i?"false":"mixed")}}},e.prototype.updateGridActions=function(e){var i=e.requestType;if(d(this.parent))if(this.parent.autoCheckHierarchy)if("sorting"===i||"paging"===i)this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(),""),this.refreshVisibleCheckboxes(),this.updateHeaderCheckboxState();else if("delete"===i||"add"===e.action){var r=[];"delete"===i?r=e.data:r.push(e.data);for(var n=0;n<r.length;n++)"delete"===i&&this.updateSelectedItems(r[parseInt(n.toString(),10)],"uncheck",!1),t.isNullOrUndefined(r[parseInt(n.toString(),10)].parentItem)||this.updateParentSelection(r[parseInt(n.toString(),10)].parentItem);this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(!0),""),this.refreshVisibleCheckboxes(),this.parent.autoCheckHierarchy&&this.updateHeaderCheckboxState()}else"add"===e.requestType&&this.parent.autoCheckHierarchy?e.data.checkboxState="uncheck":"filtering"!==i&&"searching"!==i&&"refresh"!==i||(this.updateSelectedCollectionsAfterBulk(this.resolveHeaderSelectionList(),i),this.refreshVisibleCheckboxes(),this.parent.autoCheckHierarchy&&this.updateHeaderCheckboxState());else"filtering"!==i&&"searching"!==i&&"refresh"!==i&&"sorting"!==i&&"paging"!==i&&"expanding"!==i&&"expand"!==i&&"collapsing"!==i&&"collapse"!==i||a(this.parent)||(this.selectedItems=[],this.selectedUidMap=new Map,this.selectedIndexes=[],this.refreshVisibleCheckboxes(),this.parent.autoCheckHierarchy&&this.updateHeaderCheckboxState())},e.prototype.getCheckedrecords=function(){return this.selectedItems},e.prototype.getCheckedRowIndexes=function(){this.buildVisibleUidMap();for(var e=[],t=0,i=this.selectedItems;t<i.length;t++){var r=i[t].uniqueID;void 0!==r&&void 0!==this.visibleUidIndex[r]&&e.push(this.visibleUidIndex[r])}return e},e}(),Q=function(){function e(e){this.parent=e,i.Grid.Inject(i.Print),this.addEventListener()}return e.prototype.getModuleName=function(){return"print"},e.prototype.addEventListener=function(){this.parent.grid.on("printGrid-Init",this.printTreeGrid,this)},e.prototype.removeEventListener=function(){this.parent.grid.off("printGrid-Init",this.printTreeGrid)},e.prototype.printTreeGrid=function(e){var r=i.getObject("printgrid",e),n=i.getObject("element",e);r.addEventListener("queryCellInfo",this.parent.grid.queryCellInfo),r.addEventListener("rowDataBound",this.parent.grid.rowDataBound),r.addEventListener("beforeDataBound",this.parent.grid.beforeDataBound),t.addClass([n],"e-treegrid")},e.prototype.print=function(){this.parent.grid.print()},e.prototype.destroy=function(){this.removeEventListener()},e}(),K=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),W=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},Y=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return K(i,e),W([t.Property()],i.prototype,"fields",void 0),W([t.Property(!1)],i.prototype,"ignoreCase",void 0),W([t.Property("contains")],i.prototype,"operator",void 0),W([t.Property()],i.prototype,"key",void 0),W([t.Property()],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),J=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),X=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a},$=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return J(i,e),X([t.Property("Row")],i.prototype,"mode",void 0),X([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),X([t.Property("Single")],i.prototype,"type",void 0),X([t.Property(!1)],i.prototype,"persistSelection",void 0),X([t.Property("Default")],i.prototype,"checkboxMode",void 0),X([t.Property(!1)],i.prototype,"checkboxOnly",void 0),X([t.Property(!0)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Z=function(){function e(e){this.parent=e,this.templateResult=null,this.parent.grid.on("template-result",this.columnTemplateResult,this),this.parent.grid.on("reactTemplateRender",this.reactTemplateRender,this)}return e.prototype.RowModifier=function(e){if(e.data){var r=e.data,n=r.parentItem;if(!t.isNullOrUndefined(r.parentItem)&&!l(this.parent)&&(!this.parent.allowPaging||"Root"===this.parent.pageSettings.pageSizeMode||a(this.parent)&&!u(this.parent))&&(this.parent.initialRender&&(!(t.isNullOrUndefined(n[this.parent.expandStateMapping])||n[this.parent.expandStateMapping])||this.parent.enableCollapseAll)||!h(this.parent,e.data,this.parent.grid.getCurrentViewRecords()))&&!t.isNullOrUndefined(e.row)){this.parent.toggleRowVisibility(e.row,"e-childrow-hidden");var o=this.parent.grid.getRowsObject();this.parent.grid.isFrozenGrid()||t.isNullOrUndefined(e.row.getAttribute("data-uid"))||(o.filter(function(t){return t.uid===e.row.getAttribute("data-uid")})[0].visible=!1)}if(a(this.parent)&&!u(this.parent)){var s=this.parent,d=this.parent.getCurrentViewRecords().filter(function(e){return t.getValue(s.idMapping,e)===t.getValue(s.parentIdMapping,r)});if(d.length>0&&!d[0].isSummaryRow&&!t.isNullOrUndefined(e.row)){var p=d[0].expanded?"e-childrow-visible":"e-childrow-hidden";this.parent.toggleRowVisibility(e.row,p)}}i.getObject("isSummaryRow",e.data)&&t.addClass([e.row],"e-summaryrow"),t.isNullOrUndefined(e.row)||(e.row.querySelector(".e-treegridexpand")?e.row.setAttribute("aria-expanded","true"):e.row.querySelector(".e-treegridcollapse")&&e.row.setAttribute("aria-expanded","false"),this.parent.enableCollapseAll&&this.parent.initialRender&&(t.isNullOrUndefined(r.parentItem)||this.parent.toggleRowVisibility(e.row,"e-childrow-hidden")));if(this.parent.rowDragAndDropModule&&this.parent.grid.rowDragAndDropModule&&(this.parent.grid.rowDragAndDropModule.dragStartData||this.parent.rowDragAndDropModule.draggedRecord)&&this.parent.getContentTable().scrollHeight<=this.parent.getContent().clientHeight){this.parent.getVisibleRecords()[this.parent.getVisibleRecords().length-1].uniqueID!==e.data.uniqueID||t.isNullOrUndefined(e.row)||e.row.cells[0].classList.contains("e-lastrowcell")||this.parent.lastRowBorder(e.row,!0)}if(this.parent.isReact){var c=this;c.parent.renderReactTemplates(function(){c.parent.trigger("rowDataBound",e)})}else this.parent.trigger("rowDataBound",e)}},e.prototype.cellRender=function(e){if(e.data){var r,n,o=this.parent.grid,s=e.data,d=t.isNullOrUndefined(s.filterLevel)?s.level:s.filterLevel,l=0,p=this.parent.getColumnByUid(e.column.uid),c=s.isSummaryRow,u=this.parent.getFrozenColumns();r=t.isNullOrUndefined(s.parentItem)?s.index:s.parentItem.index;if((this.parent.enableColumnVirtualization&&!this.parent.initialRender?this.parent.getVirtualColIndexByUid(e.column.uid):o.getColumnIndexByUid(e.column.uid))!==this.parent.treeColumnIndex||"add"!==e.requestType&&"rowDragAndDrop"!==e.requestType&&"delete"!==e.requestType&&!t.isNullOrUndefined(e.cell.querySelector(".e-treecell")))this.templateResult&&(this.templateResult=null);else{var g=t.createElement("div",{className:"e-treecolumn-container"}),f=t.createElement("span",{className:"e-icons e-none"});f.style.width="10px",f.style.display="inline-block";for(var m=0;m<d;m++)l+=10,g.appendChild(f.cloneNode());var y=t.isNullOrUndefined(s.hasFilteredChildRecords)?s.hasChildRecords:s.hasFilteredChildRecords;if(y&&!t.isNullOrUndefined(s.childRecords)&&(y=this.parent.isFromGantt&&this.parent.loadChildOnDemand?s.hasChildRecords:!(0===s.childRecords.length)),y){t.addClass([e.cell],"e-treerowcell"),e.cell.setAttribute("aria-expanded",s.expanded?"true":"false");var S=t.createElement("span",{className:"e-icons"}),v=void 0;if(this.parent.initialRender)v=s.expanded&&(t.isNullOrUndefined(s[this.parent.expandStateMapping])||s[this.parent.expandStateMapping])&&!this.parent.enableCollapseAll;else if(v=!(!s.expanded||!h(this.parent,s,this.parent.grid.getCurrentViewRecords())),"Cell"===this.parent.editSettings.mode&&!a(this.parent)){var w=this.parent.flatData.find(function(e){return e.uniqueID===s.uniqueID});t.isNullOrUndefined(w)||(v=s.expanded!==w.expanded?w.expanded:s.expanded)}t.addClass([S],v?"e-treegridexpand":"e-treegridcollapse"),l+=18,g.appendChild(S),f.style.width="4px",l+=7,g.appendChild(f.cloneNode())}else(d||!d&&!s.level)&&(l+=20,g.appendChild(f.cloneNode()),g.appendChild(f.cloneNode()));n=t.createElement("span",{className:"e-treecell"}),this.parent.allowTextWrap&&(n.style.width="Calc(100% - "+l+"px)"),t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level),this.updateTreeCell(e,n),g.appendChild(n),e.cell.appendChild(g)}if(o.getFrozenLeftColumnsCount()>0||o.getFrozenRightColumnsCount()>0){var I=o.getFrozenRightColumns(),R=o.getFrozenLeftColumns(),x=o.getMovableColumns();I.length>0&&I[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level):R.length>0&&R[0].field===e.column.field?t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level):x.length>0&&x[0].field===e.column.field&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level)}else u>this.parent.treeColumnIndex&&u>0&&o.getColumnIndexByUid(e.column.uid)===u?t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level):u<this.parent.treeColumnIndex&&u>0&&(o.getColumnIndexByUid(e.column.uid)===u||o.getColumnIndexByUid(e.column.uid)===u-1)?t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level):u===this.parent.treeColumnIndex&&u>0&&o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex-1&&t.addClass([e.cell],"e-gridrowindex"+r+"level"+s.level);if(!t.isNullOrUndefined(p)&&p.showCheckbox&&(this.parent.notify("columnCheckbox",e),this.parent.allowTextWrap)){var C=e.cell.querySelectorAll(".e-frame")[0];l+=parseInt(C.style.width,16),l+=10,(n=o.getColumnIndexByUid(e.column.uid)===this.parent.treeColumnIndex?e.cell.querySelector(".e-treecell"):e.cell.querySelector(".e-treecheckbox")).style.width="Calc(100% - "+l+"px)"}if(c){t