integralui-web-grid
Version:
IntegralUI Web - Grid is a native Web Component that displays tabular data sets
15 lines (12 loc) • 136 kB
JavaScript
/*
filename: integralui.base.grid.js
version : 21.4.0
Copyright © 2016-2021 Lidor Systems. All rights reserved.
This file is part of the "IntegralUI Web" Library.
The contents of this file are subject to the IntegralUI Web License, and may not be used except in compliance with the License.
A copy of the License should have been installed in the product's root installation directory or it can be found at
http://www.lidorsystems.com/products/web/studio/license-agreement.aspx.
This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws.
*/
import{T as TemplateResult,a as defaultTemplateProcessor,h as html}from"../external/lit-element.js";import{c as classMap}from"../external/class-map.js";import{s as styleMap}from"../external/style-map.js";import IntegralUIBase from"./integralui.base.js";import IntegralUIDataService from"../services/integralui.data.service.js";import IntegralUIDragDropService from"../services/integralui.dragdrop.service.js";import IntegralUIFilterService from"../services/integralui.filter.service.js";import{IntegralUIGridLines,IntegralUIContentVisibility,IntegralUISpeedMode,IntegralUISortOrder,IntegralUISelectionMode,IntegralUIVisibility,IntegralUICheckState,IntegralUIEditorType,IntegralUIDateFormat,IntegralUIFilterType,IntegralUIObjectState,IntegralUIMoveDirection}from"./integralui.enums.js";import IntegralUIDragWindow from"./integralui.dragwin.js";import"./integralui.dropdown.js";import"./integralui.list.js";class IntegralUIBaseGrid extends IntegralUIBase{_init(){super._init();this._dataService=new IntegralUIDataService();this._dragDropService=IntegralUIDragDropService.getInstance();this._filterService=new IntegralUIFilterService();this._headerData=[];this._rowData=[];this._rowHoverData=[];this._rowSelectData=[];this._cellData=[];this._footerData=[];this._completeColumnList={left:[],normal:[],right:[]};this._currentColumnList={left:[],normal:[],right:[]};this._currentRowList=[];this._dataColumns=[];this._dataRows=[];this._flatCompleteColumnList={left:[],normal:[],right:[]};this._flatCurrentColumnList={left:[],normal:[],right:[]};this._fullList=[];this._maxColumnLevels=0;this._scrollColumnList={left:[],normal:[],right:[]};this._scrollFilterList={left:[],normal:[],right:[]};this._scrollFooterList={left:[],normal:[],right:[]};this._scrollRowList={left:[],normal:[],right:[]};this._columnDataKey="columns";this._columnFields={};this._rowDataKey="rows";this._rowFields={};this._isCellValueChangeAllowed=!0;this._cloneElem=null;this._cloneElemStartPos={x:0,y:0};this._dragCmp=null;this._dragEndPos={x:0,y:0};this._dragStartPos={x:0,y:0};this._dropMarkElem=null;this._isCtrlDragEntered=!1;this._isDragActive=!1;this._isFirstDragEnter=!1;this._prevTargetDropPos=-1;this._targetDropRow=null;this._targetDropPos=-1;this._dragGhost=null;this._dragObj=null;this._dragObjIndex=-1;this._isCtrlDragAllowed=!1;this._isCtrlDropAllowed=!0;this._isColumnReorderAllowed=!0;this._originalScrollColumnList=[];this._reorderColumnObj=null;this._reorderColumnObjPos={top:0,left:0};this._reorderColumnStartPos={top:0,left:0};this._reorderColumnCurrentPos={top:0,left:0};this._reorderColIndex=-1;this._reorderNewColIndex=-1;this._startColumnReorder=!1;this._currentEditingCell=null;this._currentEditingRow=null;this._isEditorFocused=!1;this._filterColumn=null;this._filteringColumns=[];this._isFilterAllowed=!1;this._currentExpandColumnID=void 0;this._expandColIndex=0;this._hoverCell=null;this._hoverColumn=null;this._hoverRow=null;this._isGridHovered=!1;this._currentIndex=0;this._prevIndex=0;this._tabIndexCount=0;this._ctrlCursor="default";this._suppressCallback=!1;this._blockHoverRect={height:30,left:0,top:-9999999,width:880};this._blockSelectRect=[];this._blockSelectHeight=0;this._hoverRowObj={data:{}};this._columnStartPos={x:0,y:0};this._resizeColumn=null;this._resizeColumnIndex=-1;this._reorderColumn=null;this._columnReorderActive=!1;this._currentFocusCell=null;this._isKeyboardActive=!1;this._isKeyboardFocusAllowed=!1;this._isKeyPressed=!1;this._keepActive=!1;this._loadRows=[];this._avgRowHeight=0;this._blockMarginTop=0;this._blockSize={width:0,height:0};this._leftBlockSize={width:0,height:0};this._rightBlockSize={width:0,height:0};this._columnPadding={top:0,right:0,bottom:0,left:0};this._currentGridLines=IntegralUIGridLines.Both;this._currentHeaderHeight=0;this._currentFixedColWidth=0;this._currentFilterHeight=0;this._currentFooterHeight=0;this._currentIndent=15;this._currentRowHeight=0;this._hiddenLeftHeaderElem=null;this._hiddenLeftHeaderElemSize={width:0,height:0};this._isExpandBoxVisible=!0;this._isLayoutUpdating=!1;this._isHoverTemplatePresent=!1;this._isSelectedTemplatePresent=!1;this._numVisibleCells=0;this._providedHeaderHeight=0;this._providedFooterHeight=0;this._viewIndexRange={left:0,middle:999,right:999};this._fixedLeftViewIndexRange=0;this._fixedRightViewIndexRange=0;this._visibleRange=1;this._updateTimer=null;this._isAutoSizeColumnsActive=!1;this._isHeaderVisible=!0;this._isInlineEditorVisible=!1;this._isInlineFilterVisible=!1;this._isFooterVisible=!0;this._isUpdateActive=!1;this._scrollSize={width:0,height:0};this._contentLeftPos=0;this._initialContentLeftPos=0;this._allColWidth=0;this._horScrollElemPos={bottom:0};this._cornerScrollElemPos={bottom:0};this._paginatorPos={top:0,left:0};this._currentContentVisibility=IntegralUIContentVisibility.Both;this._headerElem={left:null,normal:null,right:null};this._columnElems={left:[],normal:[],right:[]};this._filterElem={left:null,normal:null,right:null};this._filterElems={left:[],normal:[],right:[]};this._footerElem={left:null,normal:null,right:null};this._footerElems={left:[],normal:[],right:[]};this._bodyElem={left:[],normal:[],right:[]};this._rowElems={left:[],normal:[],right:[]};this._cellElems={left:[],normal:[],right:[]};this._isLoading=!1;this._isLoadingEnd=!1;this._loadingEndTimeout=null;this._loadIconPos={top:0,left:0};this._currentPageNumber=1;this._onlyCurrentPage=!1;this._currentPageList=[];this._currentPaging={enabled:!1,panel:!0,pageSize:100};this._pageNumber=0;this._pageList=[];this._pageRowCount=0;this._paginatorHeight=0;this._isColumnResizing=!1;this._currentMouseWheelSpeed=IntegralUISpeedMode.Normal;this._currentScrollPos={x:0,y:0};this._maxScrollPos={x:0,y:0};this._accelerator=.5;this._scrollTimerID=null;this._isScrollTimerActive=!1;this._scrollCount=0;this._isScrollActive=!1;this._prevScrollPos={x:0,y:0};this._scrollBarSize={width:0,height:0};this._scrollLargeChange={x:0,y:0};this._scrollVisibility={horizontal:!0,vertical:!0};this._currentSorting=IntegralUISortOrder.None;this._sortComparer=null;this._sortColumn=null;this._currentSelectedColumn=null;this._currentSelectedRow=null;this._currentSelectionMode=IntegralUISelectionMode.One;this._isRowClicked=!1;this._shiftFirstSelectedRow=null;this._removeIndex=-1;this._currentSelectedRows=[];this._updateDataFields();this._initStyle();this._createScrollRowList();this._isExpandBoxTouched=!1;this._touchStartPos={x:0,y:0};this._touchEndPos={x:0,y:0}}connectedCallback(){}disconnectedCallback(){this._removeDropMark()}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i)}static get properties(){return{allowColumnReorder:{type:Boolean,attribute:"allow-column-reorder",reflect:!0},allowDrag:{type:Boolean,attribute:"allow-drag",reflect:!0},allowDrop:{type:Boolean,attribute:"allow-drop",reflect:!0},allowFilter:{type:Boolean,attribute:"allow-filter",reflect:!0},allowFocus:{type:Boolean,attribute:"allow-focus",reflect:!0},columns:{type:Array},contentVisibility:{attribute:"content-visibility",converter:{fromAttribute:e=>{switch((e=e.replace(/"|'/,"").replace(/"|'/,"")).toLowerCase()){case"none":return IntegralUIContentVisibility.None;case"hover":return IntegralUIContentVisibility.Hover;case"select":return IntegralUIContentVisibility.Select;default:return IntegralUIContentVisibility.Both}},toAttribute:e=>{switch(e){case IntegralUIContentVisibility.None:return"None";case IntegralUIContentVisibility.Hover:return"Hover";case IntegralUIContentVisibility.Select:return"Select";default:return"Both"}}},reflect:!0},dataFields:{type:Object,attribute:"data-fields"},expandColumnIndex:{type:Number,attribute:"expand-column-index",reflect:!0},gridLines:{attribute:"grid-lines",converter:{fromAttribute:e=>{switch((e=e.replace(/"|'/,"").replace(/"|'/,"")).toLowerCase()){case"none":return IntegralUIGridLines.None;case"horizontal":return IntegralUIGridLines.Horizontal;case"vertical":return IntegralUIGridLines.Vertical;default:return IntegralUIGridLines.Both}},toAttribute:e=>{switch(e){case IntegralUIGridLines.None:return"None";case IntegralUIGridLines.Horizontal:return"Horizontal";case IntegralUIGridLines.Vertical:return"Vertical";default:return"Both"}}},reflect:!0},paging:{type:Object},rowHeight:{type:Number,attribute:"row-height",reflect:!0},rows:{type:Array},selectionMode:{attribute:"selection-mode",converter:{fromAttribute:e=>{switch((e=e.replace(/"|'/,"").replace(/"|'/,"")).toLowerCase()){case"none":return IntegralUISelectionMode.None;case"multisimple":return IntegralUISelectionMode.MultiSimple;case"multiextended":return IntegralUISelectionMode.MultiExtended;default:return IntegralUISelectionMode.One}},toAttribute:e=>{switch(e){case IntegralUISelectionMode.None:return"None";case IntegralUISelectionMode.MultiSimple:return"MultiSimple";case IntegralUISelectionMode.MultiExtended:return"MultiExtended";default:return"One"}}},reflect:!0},inlineEditor:{type:Boolean,attribute:"inline-editor",reflect:!0},inlineFilter:{type:Boolean,attribute:"inline-filter",reflect:!0},showFooter:{type:Boolean,attribute:"show-footer",reflect:!0},showHeader:{type:Boolean,attribute:"show-header",reflect:!0},sorting:{converter:{fromAttribute:e=>{switch((e=e.replace(/"|'/,"").replace(/"|'/,"")).toLowerCase()){case"ascending":return IntegralUISortOrder.Ascending;case"descending":return IntegralUISortOrder.Descending;default:return IntegralUISortOrder.None}},toAttribute:e=>{switch(e){case IntegralUISortOrder.Ascending:return"Ascending";case IntegralUISortOrder.Descending:return"Descending";default:return"None"}}},reflect:!0}}}get allowColumnReorder(){return this._isColumnReorderAllowed}set allowColumnReorder(e){if(this._isColumnReorderAllowed!==e){const t=this._isColumnReorderAllowed;this._isColumnReorderAllowed=e;this.requestUpdate("allowColumnReorder",t)}}set allowDrag(e){if(this._isCtrlDragAllowed!==e){const t=this._isCtrlDragAllowed;this._isCtrlDragAllowed=e;this.requestUpdate("allowDrag",t);this.updateLayout()}}set allowDrop(e){if(this._isCtrlDropAllowed!==e){const t=this._isCtrlDropAllowed;this._isCtrlDropAllowed=e;this.requestUpdate("allowDrop",t);this.updateLayout()}}set allowFilter(e){if(this._isFilterAllowed!==e){const t=this._isFilterAllowed;this._isFilterAllowed=e;this.requestUpdate("allowFilter",t)}}set allowFocus(e){if(this._isKeyboardFocusAllowed!==e){const t=this._isKeyboardFocusAllowed;this._isKeyboardFocusAllowed=e;if(!e)this._currentFocusCell=null;this.refresh();this.requestUpdate("allowFocus",t)}}get columns(){return this._dataColumns}set columns(e){const t=this._dataColumns;this._dataColumns=e;this._updateData();this.requestUpdate("columns",t)}get contentVisibility(){return this._currentContentVisibility}set contentVisibility(e){const t=this._currentContentVisibility;this._currentContentVisibility=e;this.requestUpdate("contentVisibility",t)}set dataFields(e){this._updateDataFields(e)}get expandColumnIndex(){return this._expandColIndex}set expandColumnIndex(e){const t=this._expandColIndex;this._expandColIndex=e;this.updateLayout();this.requestUpdate("expandColumnIndex",t)}get footerHeight(){return this._providedFooterHeight}set footerHeight(e){const t=this._providedFooterHeight;this._providedFooterHeight=e;this.requestUpdate("footerHeight",t)}get gridLines(){return this._currentGridLines}set gridLines(e){const t=this._currentGridLines;this._currentGridLines=e;this.refresh();this.requestUpdate("gridLines",t)}get headerHeight(){return this._providedHeaderHeight}set headerHeight(e){const t=this._providedHeaderHeight;this._providedHeaderHeight=e;this.requestUpdate("headerHeight",t)}get inlineEditor(){return this._isInlineEditorVisible}set inlineEditor(e){const t=this._isInlineEditorVisible;this._isInlineEditorVisible=e;this.updateLayout();this.requestUpdate("inlineEditor",t)}get inlineFilter(){return this._isInlineFilterVisible}set inlineFilter(e){const t=this._isInlineFilterVisible;this._isInlineFilterVisible=e;this.updateLayout();this.requestUpdate("inlineFilter",t)}get paging(){return this._currentPaging}set paging(e){const t=this._currentPaging;this._updatePaging(e);this.requestUpdate("paging",t)}get rowHeight(){return this._currentRowHeight}set rowHeight(e){const t=this._currentRowHeight;this._currentRowHeight=e;this.requestUpdate("rowHeight",t)}get rows(){return this._dataRows}set rows(e){const t=this._dataRows;this._dataRows=e;this._updateData();this.requestUpdate("rows",t)}get selectedColumn(){return this._currentSelectedColumn}set selectedColumn(e){if(this._currentSelectedColumn!==e){const t=this._currentSelectedColumn;this._processColumnSelection(null,e);this.requestUpdate("selectedColumn",t)}}get selectedRow(){return this._currentSelectedRow}set selectedRow(e){if(this._currentSelectedRow!==e){const t=this._currentSelectedRow;this._processRowSelection(null,e);this.requestUpdate("selectedRow",t)}}get selectionMode(){return this._currentSelectionMode}set selectionMode(e){if(this._currentSelectionMode!==e){const t=this._currentSelectionMode;this._currentSelectionMode=e;this._clearPrevSelection(this._currentSelectionMode!==IntegralUISelectionMode.None?this._currentSelectedRow:null);this.refresh();if(this._currentSelectionMode===IntegralUISelectionMode.None){this._currentSelectedRow=null;this._invokeEvent("selectionChanged",{obj:this._currentSelectedRow})}this.requestUpdate("selectionMode",t)}}get showFooter(){return this._isFooterVisible}set showFooter(e){const t=this._isFooterVisible;this._isFooterVisible=e;this.updateLayout();this.requestUpdate("showFooter",t)}get showHeader(){return this._isHeaderVisible}set showHeader(e){const t=this._isHeaderVisible;this._isHeaderVisible=e;this.updateLayout();this.requestUpdate("showHeader",t)}get sorting(){return this._currentSorting}set sorting(e){const t=this._currentSorting;this._currentSorting=e;this.requestUpdate("sorting",t)}addColumn(e){this._callEventAddColumn("add",e)}clearColumns(){this._dataService.clear(null,this._columnDataKey);this._invokeEvent("columnsCleared");this._currentScrollPos.x=0}insertColumnAfter(e,t){this._callEventAddColumn("ref",e,-1,t,!0)}insertColumnAt(e,t){this._callEventAddColumn("at",e,t)}insertColumnBefore(e,t){this._callEventAddColumn("ref",e,-1,t)}removeColumn(e){return this._callEventRemoveColumn(e)}removeColumnAt(e){return this._callEventRemoveColumn(null,e)}_callEventAddColumn(e,t,i,l,s){let r={cancel:!1,column:t};this._invokeEvent("columnAdding",r);if(!0!==r.cancel){switch(e){case"at":this._dataService.insert(t,i,null,null,!1,this._columnDataKey);break;case"ref":this._dataService.insertByRef(t,l,s,this._columnDataKey);break;default:this._dataService.insert(t,-1,null,null,!1,this._columnDataKey)}this._invokeEvent("columnAdded",{column:t})}}_callEventRemoveColumn(e,t){let i={cancel:!1,column:e};this._invokeEvent("columnRemoving",i);if(!0!==i.cancel){this._removeIndex=this._dataColumns?this._dataColumns.indexOf(e):-1;let i=this._dataService.removeAt(e,t,null,this._columnDataKey);if(i.result){this._invokeEvent("columnRemoved",{column:i.obj});return!0}}return!1}addRow(e,t){this._callEventAddRow("add",e,-1,t)}clearRows(e){this._dataService.clear(e,this._rowDataKey);this._invokeEvent("rowsCleared",{parent:e});this.clearSelection();this._currentScrollPos.y=0}insertRowAfter(e,t){this._callEventAddRow("ref",e,-1,null,t,!0)}insertRowAt(e,t,i){this._callEventAddRow("at",e,t,i)}insertRowBefore(e,t){this._callEventAddRow("ref",e,-1,null,t)}removeRow(e){return this._callEventRemoveRow(e)}removeRowAt(e,t){return this._callEventRemoveRow(null,e,t)}_callEventAddRow(e,t,i,l,s,r){let o={cancel:!1,row:t};this._invokeEvent("rowAdding",o);if(!0!==o.cancel){switch(e){case"at":this._dataService.insert(t,i,l,null,!1,this._rowDataKey);break;case"ref":this._dataService.insertByRef(t,s,r,this._rowDataKey);break;default:this._dataService.insert(t,-1,l,null,!1,this._rowDataKey)}this._invokeEvent("rowAdded",{row:t})}}_callEventRemoveRow(e,t,i){let l={cancel:!1,row:e};this._invokeEvent("rowRemoving",l);if(!0!==l.cancel){this.removeIndex=this._dataRows?this._dataRows.indexOf(e):-1;let l=this._dataService.removeAt(e,t,i,this._rowDataKey);if(l.result){if(e&&e[this._rowFields.selected]){e[this._rowFields.selected]=!1;this._currentSelectedRows=this._currentSelectedRows.filter(function(t){return t!==e});if(this._currentSelectedRow&&this._commonService.isEqual(this._currentSelectedRow[this._rowFields.id],e[this._rowFields.id]))this._currentSelectedRow=null;this._invokeEvent("selectionChanged",{obj:this._currentSelectedRow})}this._invokeEvent("rowRemoved",{row:l.obj});return!0}}return!1}_cellClickEvent(e,t){if(this._isEnabled&&1===e.which)this._invokeEvent("cellClick",{cell:t.data,event:e})}_cellDblClickEvent(e,t){if(this._isEnabled&&1===e.which)this._invokeEvent("cellDblClick",{cell:t.data,event:e})}_cellRightClickEvent(e,t){if(this._isEnabled)this._invokeEvent("cellRightClick",{cell:t.data,event:e})}_columnClickEvent(e,t){if(this._isEnabled&&1===e.which&&!this._isColumnResizing)this._invokeEvent("columnClick",{column:t.data,event:e})}_columnDblClickEvent(e,t){if(this._isEnabled&&1===e.which)this._invokeEvent("columnDblClick",{column:t.data,event:e})}_columnRightClickEvent(e,t){if(this._isEnabled)this._invokeEvent("columnRightClick",{column:t.data,event:e})}_rowClickEvent(e,t){if(this._isEnabled&&1===e.which)this._invokeEvent("rowClick",{event:e,row:t.data})}_rowDblClickEvent(e,t){if(this._isEnabled&&1===e.which){let i={cancel:!1,event:e,row:t.data};this._invokeEvent("rowDblClick",i);if(!0!==i.cancel)this.toggle(t.data)}}_rowRightClickEvent(e,t){if(this._isEnabled)this._invokeEvent("rowRightClick",{event:e,row:t.data})}_addColumnToCurrentList(e){if(this.isColumnVisible(e)){e.type="column";if(!e[this._columnFields.id])e[this._columnFields.id]=this._commonService.getUniqueId();if(this.isColumnVisible(e)){let t=e[this._columnFields.filterParams],i=t?this._filterService.createTree(t.conditions,t.formula):null,l=this._getSideName(e[this._columnFields.fixed]);this._currentColumnList[l].push({data:e,filter:i})}}}_createColumnLevel(e,t,i,l){if(!e||t>=this._maxColumnLevels)return;let s=0;for(;s<e.length;){let r=e[s];if(!r[this._columnFields.id])r[this._columnFields.id]=this._commonService.getUniqueId();if(l)r[this._columnFields.pid]=l;let o=r[this._columnFields.columns],n={colSpan:o?this._getColumnSpan(r):0,data:r,isRoot:0===t?!0:!1,isVisible:!o||0===o.length?!0:!1,rowSpan:!o||0===o.length?this._maxColumnLevels-t:0};this._completeColumnList[i][t].push(n);if(this._isColumnWithChildrenVisible(r))this._createColumnLevel(r[this._columnFields.columns],t+1,i,r[this._columnFields.id]);s++}}_createColumnListInRange(e,t){if(e)e.forEach(e=>{let i={colIndex:this._getColumnIndexFromList(e),data:e,isVisible:!e[this._columnFields.columns]||0===e[this._columnFields.columns].length?!0:!1};t.push(i);this._createColumnListInRange(e[this._columnFields.columns],t)})}_getColumnData(){return this._dataService.getList(null,this._columnDataKey)}_getColumnListInRange(e){let t=[];if(this._completeColumnList[e].length>0){let i=this._completeColumnList[e][0],l="normal"!==e?0:this._viewIndexRange.left,s="normal"!==e?i.length-1:this._viewIndexRange.right,r=i.filter((e,t)=>t>=l&&t<=s).map(e=>e.data);this._createColumnListInRange(r,t)}return t}_getColumnSpan(e){let t=0;if(!e[this._columnFields.columns]||0===e[this._columnFields.columns].length)return 1;for(let i=0;i<e[this._columnFields.columns].length;i++)t+=this._getColumnSpan(e[this._columnFields.columns][i]);return t}_updateCurrentColumnList(e){this._currentColumnList={left:[],normal:[],right:[]};this._flatCurrentColumnList={left:[],normal:[],right:[]};this._maxColumnLevels=0;this._completeColumnList={left:[],normal:[],right:[]};this._flatCompleteColumnList={left:[],normal:[],right:[]};let t=this._getColumnData();if(t){if(this._isCtrlDragAllowed)this._addColumnToCurrentList({fixed:"left",fixedWidth:!0,isDragDropColumn:!0,width:16});if(this._isInlineEditorVisible)this._addColumnToCurrentList({fixed:"left",fixedWidth:!0,isEditorColumn:!0,width:16});t.forEach(e=>this._addColumnToCurrentList(e));for(let e=0;e<3;e++){let t="";switch(e){case 1:t="left";break;case 2:t="right";break;default:t="normal"}this._createFlatList(this._currentColumnList[t].map(e=>e.data),this._columnFields.columns,this._flatCurrentColumnList[t])}this._updateColumnCompleteList()}this._createColumnsWithFilter()}_updateColumnCompleteList(){for(let e=0;e<3;e++){let t="";switch(e){case 1:t="left";break;case 2:t="right";break;default:t="normal"}this._updateColumnCompleteListBySide(t)}}_updateColumnCompleteListBySide(e){let t=this._currentColumnList[e].map(e=>e.data);this._calcMaxColumnLevels(t,1);for(let t=1;t<=this._maxColumnLevels;t++)this._completeColumnList[e].push([]);this._createColumnLevel(t,0,e);this._flatCompleteColumnList[e]=this._createFlatColumnList(this._completeColumnList[e])}_updateScrollColumnList(){for(let e=0;e<3;e++){let t="";switch(e){case 1:t="left";break;case 2:t="right";break;default:t="normal"}this._refreshScrollColumnList(t)}}_isColumnParentInRange(e,t,i){let l=!1;if(t>=0&&t<this._completeColumnList[e].length){let s=[];if(t>0)l=(s=this._completeColumnList[e][t].filter(e=>e.data[this._columnFields.id]===i)).length>0?this._isColumnParentInRange(e,t-1,s[0].data[this._columnFields.pid]):!1;else l=(s=this._completeColumnList[e][t].filter((e,t)=>t>=this._viewIndexRange.left&&t<=this._viewIndexRange.right).filter(e=>e.data[this._columnFields.id]===i)).length>0?!0:!1}return l}_refreshScrollColumnList(e){this._scrollColumnList[e].length=0;this._completeColumnList[e].forEach((t,i)=>{let l={columns:[]};t.forEach((t,s)=>{let r=!0;if("normal"===e)if(0===i&&s>=this._viewIndexRange.left&&s<=this._viewIndexRange.right)r=!0;else r=this._isColumnParentInRange(e,i-1,t.data[this._columnFields.pid]);if(r){let e={clickPos:{x:0,y:0},colSpan:t.colSpan>0?t.colSpan:1,data:t.data,footerHeight:this._providedFooterHeight>0?this._providedFooterHeight+"px":"auto",headerHeight:this._providedHeaderHeight>0?this._providedHeaderHeight+"px":"auto",inlineStyle:this._getColumnInlineStyle(t.data[this._columnFields.style]),location:{top:0,left:0},position:"relative",rowSpan:t.rowSpan>0?t.rowSpan:1,style:{}};this._updateColumnStyle(e);l.columns.push(e)}});this._scrollColumnList[e].push(l)});this._scrollFooterList[e].length=0;let t=this._getColumnListInRange(e);t.forEach(t=>{if(t.isVisible){let i={clickPos:{x:0,y:0},data:t.data,footerHeight:this._providedFooterHeight>0?this._providedFooterHeight+"px":"auto",headerHeight:this._providedHeaderHeight>0?this._providedHeaderHeight+"px":"auto",inlineStyle:this._getColumnInlineStyle(t.data[this._columnFields.style]),location:{top:0,left:0},position:"relative",style:{}};i.displayValue=this._getFooterDisplayValue(i);this._updateColumnStyle(i);this._scrollFooterList[e].push(i)}});this._scrollFilterList[e].length=0;t.forEach(t=>{if(t.isVisible){let i={clickPos:{x:0,y:0},data:t.data,filterAdjustment:this._getFilterAdjustment(t.data,{top:4}),filterDropDownSize:{width:225},filterFormat:this._getColumnFormat(t.data),filterOperation:this._getFilterOperation(t.data),filterSettings:this._getFilterSettings(t.data),filterType:this._getFilterType(t.data),filterValue:this._getFilterValue(t.data),location:{top:0,left:0},position:"relative",style:{}};i.filterCalendarSize=i.filterSettings.calendarSize;i.isFilterAllowed=!1!==i.filterSettings.visible;this._updateColumnStyle(i);this._scrollFilterList[e].push(i)}})}_processLoadData(e,t,i,l){let s=this;s.clearRows(t);s._updateRowFields(i);let r=[];if(e)if(l||void 0===l){let t=[];e.forEach(function(e,i){if(!e[s._rowFields.id])e[s._rowFields.id]=s._commonService.getUniqueId();let l=e[s._rowFields.pid];if(t[l]){if(!t[l][s._rowFields.rows])t[l][s._rowFields.rows]=[];t[e[s._rowFields.id]]=e;t[l][s._rowFields.rows].push(e)}else{t[e[s._rowFields.id]]=e;r.push(e)}});t.length=0}else r=e;if(t){t[s._rowFields.rows]=r;for(let e=0;e<t[s._rowFields.rows].length;e++)t[s._rowFields.rows][e][s._rowFields.pid]=t[s._rowFields.id]}else if(s._dataRows){s._dataRows.length=0;for(let e=0;e<r.length;e++)s._dataRows.push(r[e])}s._invokeEvent("loadComplete");s.updateLayout()}_updateColumnFields(e){let t=e||{};this._columnFields={aggregation:t.aggregation?t.aggregation:"aggregation",allowDrag:t.allowDrag?t.allowDrag:"allowDrag",allowDrop:t.allowDrop?t.allowDrop:"allowDrop",allowFilter:t.allowFilter?t.allowFilter:"allowFilter",allowGrouping:t.allowGrouping?t.allowGrouping:"allowGrouping",allowResize:t.allowResize?t.allowResize:"allowResize",canSelect:t.canSelect?t.canSelect:"canSelect",cellTemplateUrl:t.cellTemplateUrl?t.cellTemplateUrl:"cellTemplateUrl",columns:t.columns?t.columns:"columns",comparer:t.comparer?t.comparer:"comparer",contentAlignment:t.contentAlignment?t.contentAlignment:"contentAlignment",contextMenu:t.contextMenu?t.contextMenu:"contextMenu",editorType:t.editorType?t.editorType:"editorType",editorSettings:t.editorSettings?t.editorSettings:"editorSettings",editorTemplate:t.editorTemplate?t.editorTemplate:"editorTemplate",expanded:t.expanded?t.expanded:"expanded",filterOperation:t.filterOperation?t.filterOperation:"filterOperation",filterParams:t.filterParams?t.filterParams:"filterParams",filterSettings:t.filterSettings?t.filterSettings:"filterSettings",filterTemplate:t.filterTemplate?t.filterTemplate:"filterTemplate",filterType:t.filterType?t.filterType:"filterType",filterValue:t.filterValue?t.filterValue:"filterValue",fixed:t.fixed?t.fixed:"fixed",fixedWidth:t.fixedWidth?t.fixedWidth:"fixedWidth",format:t.format?t.format:"format",footerAlignment:t.footerAlignment?t.footerAlignment:"footerAlignment",footerContent:t.footerContent?t.footerContent:"footerContent",footerTemplate:t.footerTemplate?t.footerTemplate:"footerTemplate",footerTemplateModel:t.footerTemplateModel?t.footerTemplateModel:"footerTemplateModel",footerText:t.footerText?t.footerText:"footerText",footerTooltip:t.footerTooltip?t.footerTooltip:"footerTooltip",footerValue:t.footerValue?t.footerValue:"footerValue",groupText:t.groupText?t.groupText:"groupText",headerAlignment:t.headerAlignment?t.headerAlignment:"headerAlignment",headerContent:t.headerContent?t.headerContent:"headerContent",headerTemplate:t.headerTemplate?t.headerTemplate:"headerTemplate",headerTemplateModel:t.headerTemplateModel?t.headerTemplateModel:"headerTemplateModel",headerText:t.headerText?t.headerText:"headerText",headerTooltip:t.headerTooltip?t.headerTooltip:"headerTooltip",headerValue:t.headerValue?t.headerValue:"headerValue",icon:t.icon?t.icon:"icon",id:t.id?t.id:"id",isEnd:t.isEnd?t.isEnd:"isEnd",key:t.key?t.key:"key",maxWidth:t.maxWidth?t.maxWidth:"maxWidth",minWidth:t.minWidth?t.minWidth:"minWidth",name:t.name?t.name:"name",objects:t.columns?t.columns:"columns",pid:t.pid?t.pid:"pid",selected:t.selected?t.selected:"selected",sorting:t.sorting?t.sorting:"sorting",style:t.style?t.style:"style",templateSettings:t.templateSettings?t.templateSettings:"templateSettings",visible:t.visible?t.visible:"visible",width:t.width?t.width:"width"};if(this._dataService)this._dataService.updateDataFields(this._columnFields,this._columnDataKey)}_updateCellFields(e){let t=e||{};this._cellFields={allowDrag:t.allowDrag?t.allowDrag:"allowDrag",allowEdit:t.allowEdit?t.allowEdit:"allowEdit",cid:t.cid?t.cid:"cid",colName:t.colName?t.colName:"colName",content:t.content?t.content:"content",contextMenu:t.contextMenu?t.contextMenu:"contextMenu",editorSettings:t.editorSettings?t.editorSettings:"editorSettings",enabled:t.enabled?t.enabled:"enabled",expanded:t.expanded?t.expanded:"expanded",isGroup:t.isGroup?t.isGroup:"isGroup",labelEdit:t.labelEdit?t.labelEdit:"labelEdit",rid:t.rid?t.rid:"rid",selected:t.selected?t.selected:"selected",style:t.style?t.style:"style",tag:t.tag?t.tag:"tag",templateObj:t.templateObj?t.templateObj:"templateObj",text:t.text?t.text:"text",tooltip:t.tooltip?t.tooltip:"tooltip",value:t.value?t.value:"value",valueID:t.valueID?t.valueID:"valueID",valueType:t.valueType?t.valueType:"valueType"}}_updateData(){this._dataService.init([{data:this._dataColumns,fields:this._columnFields,key:this._columnDataKey},{data:this._dataRows,fields:this._rowFields,key:this._rowDataKey}])}_updateDataFields(e){let t=e||{};this._updateColumnFields(t.column);this._updateRowFields(t.row);this._updateCellFields(t.cell);this._updateFilterFields(t.filter)}_updateFilterFields(e){this._filterFields=e}_updateRowFields(e){let t=e||{};this._rowFields={allowDrag:t.allowDrag?t.allowDrag:"allowDrag",allowDrop:t.allowDrop?t.allowDrop:"allowDrop",allowEdit:t.allowEdit?t.allowEdit:"allowEdit",allowFocus:t.allowFocus?t.allowFocus:"allowFocus",autoCheck:t.autoCheck?t.autoCheck:"autoCheck",canSelect:t.canSelect?t.canSelect:"canSelect",cells:t.cells?t.cells:"cells",checkBoxSettings:t.checkBoxSettings?t.checkBoxSettings:"checkBoxSettings",checked:t.checked?t.checked:"checked",checkState:t.checkState?t.checkState:"checkState",content:t.content?t.content:"content",contentVisibility:t.contentVisibility?t.contentVisibility:"contentVisibility",contextMenu:t.contextMenu?t.contextMenu:"contextMenu",gid:t.gid?t.gid:"gid",editorVisible:t.editorVisible?t.editorVisible:"editorVisible",enabled:t.enabled?t.enabled:"enabled",expanded:t.expanded?t.expanded:"expanded",fixed:t.fixed?t.fixed:"fixed",hasChildren:t.hasChildren?t.hasChildren:"hasChildren",icon:t.icon?t.icon:"icon",id:t.id?t.id:"id",name:t.name?t.name:"name",objects:t.rows?t.rows:"rows",pid:t.pid?t.pid:"pid",rows:t.rows?t.rows:"rows",selected:t.selected?t.selected:"selected",sorting:t.sorting?t.sorting:"sorting",statusIcon:t.statusIcon?t.statusIcon:"statusIcon",style:t.style?t.style:"style",subobjects:t.cells?t.cells:"cells",templateObj:t.templateObj?t.templateObj:"templateObj",text:t.text?t.text:"text",tooltip:t.tooltip?t.tooltip:"tooltip",value:t.value?t.value:"value",visible:t.visible?t.visible:"visible"};if(this._dataService)this._dataService.updateDataFields(this._rowFields,this._rowDataKey)}_addChildRows(e,t,i,l){let s=!0;if(!e[this._rowFields.rows])return s=this._addRowToCurrentList(e,t,i,l);if((s=this._addRowToCurrentList(e,t,i,l))){let i=0;if(l||this._isRowExpanded(e)){let r=e[this._rowFields.rows];if(r){this._applySorting(r);for(let o=0;o<r.length;o++)if(this._addChildRows(r[o],t+this._currentIndent,e[this._rowFields.id],l))i++}}if(!l&&!this._isThereChildRows&&(i>0||this._isThereRows(e)))this._isThereChildRows=!0}return s}_addRowToCurrentList(e,t,i,l){let s=this;if(!e.type)e.type="row";if(!e[s._rowFields.id])e[s._rowFields.id]=s._commonService.getUniqueId();if(i)e[s._rowFields.pid]=i;let r=!0,o=e[s._rowFields.cells];if(o&&o.length>0){r=s._isRowAllowed(e,l);for(let t=0;t<o.length;t++){o[t].type="cell";o[t][s._cellFields.rid]=e[s._rowFields.id]}}if(r)if(l)s._fullList.push(e);else if(s._currentPaging.enabled)if(s._onlyCurrentPage)s._currentPageList.push({data:e,indent:t});else{if(!e[s._rowFields.pid])s._pageRowCount++;if(s._pageRowCount>s._currentPaging.pageSize){s._pageRowCount=1;s._pageNumber++;s._pageList.push([])}s._pageList[s._pageNumber].push({data:e,indent:t})}else s._currentRowList.push({data:e,indent:t});return r}_createEmptyRowObj(){let e={allowEdit:!1,clickPos:{x:0,y:0},cells:[],data:{},draggable:!1,indent:0,inlineStyle:{},isDragAllowed:!0,isEditAllowed:!0,isEditorActive:!1,isEmpty:!0,isGroup:!1,original:{},style:{}};for(let t=0;t<1;t++)e.cells.push(this._createEmptyCellObj());return e}_createEmptyCellObj(){return{align:"",allowEdit:!1,colIndex:-1,data:{},display:"none",displayValue:null,editorClass:"",editorList:[],editorSettings:{},editorStyle:"",editorType:null,editorValue:null,editorValueObject:{},editorVisibility:IntegralUIVisibility.Hover,expandBoxAllowed:!1,format:{},indent:0,inlineStyle:{},isDataEmpty:!0,isDragDropColumn:!1,isEditorColumn:!1,isEditorEnabled:!0,isEmpty:!0,rowIndex:-1,side:"normal",style:{content:{"iui-grid-row-cell-content":!0}},tabIndex:-1,width:100,height:"auto"}}_createScrollObjFromRow(e,t,i,l,s){let r=null,o=i?i:this._getObjFromRow(t);if(o){let n=(r={allowEdit:!0===o.data[this._rowFields.allowEdit],clickPos:{x:0,y:0},cells:[],data:o.data,draggable:this._isEnabled&&"group"!==o.data.type?!0:!1,isDragAllowed:this._isDragAllowed(t),isEditAllowed:this._isEditAllowed(t),isEditorActive:i.data===this._currentEditingRow,indent:o.indent,inlineStyle:o.data[this._rowFields.style],original:o.original,style:{}}).data[this._rowFields.cells];for(let i=0;i<e.length;i++){let o=e[i].data;if("normal"===s?e[i].isVisible:!0){let a=i,h=o[this._columnFields.id];if(h)a=this._getCellIndexById(n,i,h);this._tabIndexCount++;let d=a>=0&&a<n.length?n[a]:{},c={align:this._getCellAlignment(o),colID:h,colIndex:e[i].colIndex,data:d,display:"block",displayValue:null,editorClass:"",editorList:this._getCellEditorList(o),editorSettings:this._getCellEditorSettings(o),editorStyle:"",editorType:this._getCellEditorType(o),editorValue:null,editorValueObject:{},editorVisibility:this._getCellEditorVisibility(t,o),expandBoxAllowed:this._isExpandBoxAllowed(o,i),format:this._getColumnFormat(o),indent:this._getRowIndent(r,o),inlineStyle:d&&d[this._cellFields.style]?d[this._cellFields.style]:"",isDataEmpty:this._commonService.isEmpty(d)||!1===d[this._cellFields.allowEdit],isDragDropColumn:!0===o.isDragDropColumn?!0:!1,isEditorColumn:!0===o.isEditorColumn?!0:!1,isEditorEnabled:this._isCellEditorEnabled(o,d),rowIndex:void 0!==l?l-this._currentIndex:0,side:s,style:{content:{"iui-grid-row-cell-content":!0}},width:this._getCellWidth(r,o),height:this._currentRowHeight>0?this._currentRowHeight+"px":"auto"};c.allowEdit=void 0!==d[this._cellFields.allowEdit]?d[this._cellFields.allowEdit]:r.allowEdit||!0===c.editorSettings.editOnFocus;c.displayValue=this._getCellDisplayValue(c);c.editorValue=this._getCellValue(c);c.editorValueObject=this._getCellValueObject(c);c.editorClass=this._getCellEditorClass(c);c.tabIndex=c.isDragDropColumn||c.isEditorColumn?-1:this._tabIndexCount;r.cells.push(c)}}this._updateRowStyle(r)}return r}_createScrollRowList(){for(let e=0;e<3;e++){let t="";switch(e){case 1:t="left";break;case 2:t="right";break;default:t="normal"}this._createScrollRowListBySide(t)}}_createScrollRowListBySide(e){this._scrollRowList[e].length=0;for(let t=0;t<100;t++){let t=this._createEmptyRowObj();this._scrollRowList[e].push(t)}}_getRowData(){return this._dataService.getList(null,this._rowDataKey)}_isThereRows(e){return!this._isRowExpanded(e)&&e[this._rowFields.rows]&&e[this._rowFields.rows].length>0&&this._isThereVisibleChildren(e)}_refreshScrollRowList(e,t){let i=this;this._isLayoutUpdating=!0;this._tabIndexCount=0;let l=0,s=this._getColumnListInRange(e);for(let i=this._currentIndex;i<this._currentRowList.length&&i<this._currentIndex+this._visibleRange;i++){let r=this._currentRowList[i],o=this._createScrollObjFromRow(s,r.data,r,i,e),n=this._scrollRowList[e][l];n.allowEdit=o.allowEdit;n.isEmpty=!1;n.data=o.data;n.isDragAllowed=o.isDragAllowed;n.isEditAllowed=o.isEditAllowed;n.isEditorActive=o.isEditorActive;n.inlineStyle=o.inlineStyle;n.original=o.original;n.style=o.style;if(!t){n.draggable=o.draggable;n.indent=o.indent}let a=0;for(let e=0;e<o.cells.length;e++,a++){let i=o.cells[e],l=n.cells[e];l.allowEdit=i.allowEdit;l.isEmpty=!1;l.data=i.data;l.display=this._getRowCellDisplay(i);l.inlineStyle=i.inlineStyle;l.isDataEmpty=i.isDataEmpty;l.isDragDropColumn=i.isDragDropColumn;l.isEditorColumn=i.isEditorColumn;l.side=i.side;l.style=i.style;if(!t){l.align=i.align;l.colID=i.colID;l.colIndex=i.colIndex;l.displayValue=i.displayValue;l.editorClass=i.editorClass;l.editorList=i.editorList;l.editorSettings=i.editorSettings;l.editorStyle=i.editorStyle;l.editorType=i.editorType;l.editorValue=i.editorValue;l.editorValueObject=i.editorValueObject;l.editorVisibility=i.editorVisibility;l.expandBoxAllowed=i.expandBoxAllowed;l.indent=i.indent;l.isEditorEnabled=i.isEditorEnabled;l.rowIndex=i.rowIndex;l.tabIndex=i.tabIndex;l.width=i.width;l.height=i.height}}for(let e=a;e<n.cells.length;e++)this._resetCellObj(n.cells[e]);l++}for(let t=l;t<this._scrollRowList[e].length&&t<this._visibleRange;t++){let i=this._scrollRowList[e][t];this._resetRowObj(i);i.cells.forEach(e=>this._resetCellObj(e))}let r=setTimeout(function(){i._isLayoutUpdating=!1;clearTimeout(r)},100)}_resetRowObj(e){if(e){e.clickPos={x:0,y:0};e.data={};e.draggable=!1;e.allowEdit=!1;e.indent=0;e.inlineStyle={};e.isEmpty=!0;e.isGroup=!1;e.original={};e.style={}}}_resetCellObj(e){if(e){e.align="";e.allowEdit=!1;e.colIndex=-1;e.data={};e.display="none";e.displayValue=null;e.editorClass="";e.editorList=[];e.editorSettings={};e.editorStyle="";e.editorType=null;e.editorValue=null;e.editorValueObject={};e.editorVisibility=IntegralUIVisibility.Hover;e.expandBoxAllowed=!1;e.format={};e.indent=0;e.inlineStyle={};e.isEditorEnabled=!0;e.isEmpty=!0;e.rowIndex=-1;e.side="normal";e.style={content:{"iui-grid-row-cell-content":!0}};e.tabIndex=-1;e.width=0;e.height="auto"}}_updateCurrentRowList(e){this._currentRowList.length=0;if(this._currentPaging.enabled){if(this._currentPageNumber>=1&&this._currentPageNumber<=this._pageList.length)for(let e=0;e<this._pageList[this._currentPageNumber-1].length;e++)this._currentRowList.push(this._pageList[this._currentPageNumber-1][e])}else{this._isThereChildRows=!1;let e=this._getRowData();if(e){this._applySorting(e);for(let t=0;t<e.length;t++)this._addChildRows(e[t],0,null,!1)}}}updateFullList(){this._fullList.length=0;let e=this._getRowData();if(e)for(let t=0;t<e.length;t++)this._addChildRows(e[t],0,null,!0);return this._fullList}_updatePageList(){this._pageNumber=0;this._pageList.length=0;this._pageRowCount=0;this._isThereChildRows=!1;let e=this._getRowData();if(e&&e.length>0){this._applySorting(e);this._pageList.push([]);for(let t=0;t<e.length;t++)this._addChildRows(e[t],0,null,!1);if(this._pageList.length>0&&0===this._pageList[this._pageList.length-1].length)this._pageList.splice(this._pageList.length-1,1)}}_updateScrollRowList(e){for(let t=0;t<3;t++){let i="";switch(t){case 1:i="left";break;case 2:i="right";break;default:i="normal"}this._refreshScrollRowList(i,e)}}_updateScrollRowListLimit(e,t){for(let i=0;i<this._scrollRowList[e].length;i++)for(let l=0;l<t;l++)this._scrollRowList[e][i].cells.push(this._createEmptyCellObj())}_addDropMark(e){this._removeDropMark();this._dragCmp=document.createElement("iui-dragwin",{is:IntegralUIDragWindow});if(this._dragCmp){this._dragCmp.customStyle=this.customStyle;this._dragCmp.resourcePath=this.resourcePath;this._dragCmp.theme=this._currentTheme;document.body.appendChild(this._dragCmp);this._dragCmp.refresh()}}_removeDropMark(){if(this._dragCmp)this._dragCmp.parentNode.removeChild(this._dragCmp);this._dragCmp=null}_callDragDropEvent(e,t,i){let l=this,s={action:t.action,cancel:!1,dragObj:t.source,dropPos:t.dropPos,event:e,isDropAllowed:t.allow,mousePos:l._commonService.getMousePos(e),resume:function(){l.drop(e,l._dragDropService.getData());l._dragDropService.clearData()},sourceCtrl:t.sourceCtrl,targetCtrl:t.targetCtrl,targetObj:t.target};if(i)this._invokeEvent("dragDrop",s);else this._invokeEvent("dragOver",s);return s}_checkEmptySpace(e){let t=this._commonService.getPageRect(this._elemRef),i=t.top,l=t.bottom,s=this._commonService.getMousePos(e),r=this._commonService.getShiftPos();s.x-=r.x;s.y-=r.y;return s.y>=i&&s.y<=l}_clearDragDropSettings(e){if(e)this._dragDropService.clearData();this._isDragActive=!1;this._dragStartPos={x:0,y:0};this._dragEndPos={x:0,y:0};this._removeDropMark();this._removeDragHost();this._changeCursor()}_ctrlDragEnter(e){if(this._isEnabled)this._processDragEnter(e)}_ctrlDragDrop(e){if(this._isEnabled)this._processDragDrop(e);this._removeDropMark();e.stopPropagation()}_ctrlDragLeave(e){if(this._isEnabled)this._processDragLeave(e)}_ctrlDragOver(e){if(this._isEnabled)this._processDragOver(e);e.stopPropagation()}_ctrlDragEnd(e){this._removeDropMark();let t=this._dragDropService.getData();if(t.targetCtrl&&t.targetCtrl.removeDropMark)t.targetCtrl.removeDropMark();this._rowDragEnd(e,null)}_removeDragHandle(){this._isDragHandleVisible=!1;this._targetDropRow=null;this._targetDropPos=-1}_dropMark(e,t){if(!this._dragCmp&&!this._isScrollTimerActive)this._addDropMark({x:e.pageX,y:e.pageY});if(this._dragCmp){let e="none";if(this._isCtrlDropAllowed)e=t?"block":"none";this._dragCmp.display=e;this._dragCmp.refresh()}}_updateDragComponent(e){if(this._dragCmp)this._dragCmp.updatePos(e)}_isDragAllowed(e){return this._isCtrlDragAllowed?e&&(e[this._rowFields.allowDrag]||void 0===e[this._rowFields.allowDrag])?!0:!1:!1}_isDropAllowed(e,t,i){let l=this._isCtrlDropAllowed;if(l&&e&&t)if((l=t[this._rowFields.allowDrop]||void 0===t[this._rowFields.allowDrop]?!0:!1))if(Array.isArray(e))for(let s=0;s<e.length&&(l=this._isDropAllowedForObject(e[s],t,i));s++);else l=this._isDropAllowedForObject(e,t,i);return l}_isDropAllowedForObject(e,t,i){let l=!0;if(this._commonService.isEqual(e[this._rowFields.id],t[this._rowFields.id]))l=!1;else if(0===i&&this._isParentOf(t,e))l=!1;else if(this._isChildOf(t,e))l=!1;return l}_processDragStart(e,t){this._dragDropService.clearData();if(this._isDragAllowed(t)){if(t)if(!this._isDragAllowed(t)){if(e.dataTransfer)e.dataTransfer.effectAllowed="none";else if(e.originalEvent&&e.originalEvent.dataTransfer)e.originalEvent.dataTransfer.effectAllowed="none"}else{let i={clone:this.cloneRow(t),source:t,sourceCtrl:this,sourceData:this.rows};switch(this._currentSelectionMode){case IntegralUISelectionMode.MultiSimple:case IntegralUISelectionMode.MultiExtended:i.clone=this._createCloneList(this._currentSelectedRows);i.source=this._currentSelectedRows;break;default:this._defaultFunc()}let l={action:e.shiftKey?"copy":"move",cancel:!1,dragObj:i.source,dropPos:-1,event:e,isDropAllowed:this._isCtrlDropAllowed,mousePos:this._commonService.getMousePos(e),sourceCtrl:i.sourceCtrl,targetCtrl:this,targetObj:null};this._invokeEvent("dragStart",l);if(!0===l.cancel){e.preventDefault();return}else{this._isDragActive=!0;this._isFirstDragEnter=!0;this._addDropMark({x:e.pageX,y:e.pageY});this._dropMark(e);if(this._dragGhost)e.dataTransfer.setDragImage(this._dragGhost,12,this._avgRowHeight/2);if(e.dataTransfer){e.dataTransfer.effectAllowed="move";e.dataTransfer.setData("text",t[this._rowFields.id]?t[this._rowFields.id].toString():"")}else if(e.originalEvent&&e.originalEvent.dataTransfer){e.originalEvent.dataTransfer.effectAllowed="move";e.originalEvent.dataTransfer.setData("text",t[this._rowFields.id]?t[this._rowFields.id].toString():"")}this._dragDropService.setData(i)}}}else e.preventDefault()}_processDragEnter(e){e.preventDefault();if(!this._isCtrlDragEntered){this._isCtrlDragEntered=!0;let t=this._dragDropService.getData();this._isFirstDragEnter=!1;let i={action:e.shiftKey?"copy":"move",dragObj:t.source,dropPos:-1,event:e,isDropAllowed:this._isCtrlDropAllowed,mousePos:this._commonService.getMousePos(e),sourceCtrl:t.sourceCtrl,targetCtrl:this,targetObj:null};this._invokeEvent("dragEnter",i)}}_processDragLeave(e){e.preventDefault();if(this._isCtrlDragEntered){let t=this._commonService.getPageRect(this._elemRef),i=this._commonService.getMousePos(e),l=this._commonService.getShiftPos();i.x-=l.x;i.y-=l.y;if(i.x<=t.left||i.x>=t.right||i.y<=t.top||i.y>=t.bottom){this._isCtrlDragEntered=!1;this._stopScrollTimer();let t=this._dragDropService.getData(),i={action:e.shiftKey?"copy":"move",dragObj:t.source,dropPos:-1,event:e,isDropAllowed:!1,mousePos:this._commonService.getMousePos(e),sourceCtrl:t.sourceCtrl,targetCtrl:null,targetObj:null};this._invokeEvent("dragLeave",i)}this._dropMark(e)}}_processDragOver(e,t,i,l,s){e.preventDefault();this._processDragEnter(e);let r=!0;if(e.dataTransfer)r="none"===e.dataTransfer.effectAllowed?!1:!0;else if(e.originalEvent&&e.originalEvent.dataTransfer)r="none"===e.originalEvent.dataTransfer.effectAllowed?!1:!0;if(r){let s=this._dragDropService.getData(),o=this._commonService.getShiftPos();if(t&&!t.isEmpty){let n=this._commonService.getMousePos(e);n.x-=o.x;n.y-=o.y;let a=t.data,h="group"===t.data.type?"full":null,d=this._dragDropService.getDropPos(n,i,l,h);r=this._isDropAllowed(s.source,a,d);let c={action:e.shiftKey?"copy":"move",source:s.source,dropPos:d,allow:r,sourceCtrl:s.sourceCtrl,target:a,targetCtrl:this},u=this._callDragDropEvent(e,c);if(!r||!0===u.cancel){if(e.dataTransfer)e.dataTransfer.dropEffect="none";else if(e.originalEvent&&e.originalEvent.dataTransfer)e.originalEvent.dataTransfer.dropEffect="none";this._dropMark(e)}else{let i=this._commonService.getMousePos(e),l=i.y+16,o=i.x+20,n={"iui-dragwin-icon":!0},h="";switch(u.dropPos){case 0:h="iui-dragwin-move-in";break;case 1:h="iui-dragwin-move-up";break;case 2:h="iui-dragwin-move-down";break;default:h=""}if("copy"===u.action)h+="-copy";n[h]=!0;this._updateDragComponent({class:n,top:l,left:o,text:t.data[this._rowFields.text]});this._dropMark(e,r);this._dragDropService.setData({action:u.action,clone:s.clone,dropPos:u.dropPos,source:s.source,sourceCtrl:s.sourceCtrl,sourceData:s.sourceData,target:a,targetCtrl:this})}}else if(!this._isCtrlDropAllowed){if(e.dataTransfer)e.dataTransfer.dropEffect="none";else if(e.originalEvent&&e.originalEvent.dataTransfer)e.originalEvent.dataTransfer.dropEffect="none";this._dropMark(e)}else{r=this._checkEmptySpace(e);let t={action:e.shiftKey?"copy":"move",allow:r,dropPos:-1,source:s.source,sourceCtrl:s.sourceCtrl,target:null,targetCtrl:this},i=this._callDragDropEvent(e,t);if(!r||!0===i.cancel){if(e.dataTransfer)e.dataTransfer.dropEffect="none";else if(e.originalEvent&&e.originalEvent.dataTransfer)e.originalEvent.dataTransfer.dropEffect="none";this._dropMark(e)}else{let t=this._commonService.getMousePos(e),l=t.y+16,o=t.x+20,n={"iui-dragwin-icon":!0,"iui-dragwin-move-end":!0};if("copy"===i.action)n["iui-dragwin-move-end-copy"]=!0;this._updateDragComponent({class:n,top:l,left:o,text:this.name?this.name:"Component"});this._dropMark(e,r&&!this._isScrollTimerActive);this._dragDropService.setData({action:i.action,clone:s.clone,source:s.source,sourceCtrl:s.sourceCtrl,sourceData:s.sourceData,target:null,targetCtrl:this,dropPos:-1})}}}}_processDragDrop(e,t){e.preventDefault();let i=!0;if(e.dataTransfer)i="none"===e.dataTransfer.effectAllowed?!1:!0;else if(e.originalEvent&&e.originalEvent.dataTransfer)i="none"===e.originalEvent.dataTransfer.effectAllowed?!1:!0;let l=this._dragDropService.getData();if(i){let s=t.data;if(t&&!t.isEmpty)i=this._isDropAllowed(l.source,s,l.dropPos);else i=this._checkEmptySpace(e);if(i&&l.source){let t={action:l.action,source:l.source,dropPos:l.dropPos,allow:i,sourceCtrl:l.sourceCtrl,target:l.target,targetCtrl:this},s=this._callDragDropEvent(e,t,!0);this._dragDropService.setData({action:s.action,clone:l.clone,dropPos:s.dropPos,source:l.source,sourceCtrl:l.sourceCtrl,sourceData:l.sourceData,target:l.target,targetCtrl:this});if(!s.cancel&&this._isProcessAllowed)this._drop(this._dragDropService.getData())}else this._dragDropService.clearData();if(l.sourceCtrl&&l.sourceCtrl._clearDragDropSettings)l.sourceCtrl._clearDragDropSettings()}else this._dragDropService.clearData();this._isDragActive=!1;this._clearDragDropSettings()}_drop(e){if(e&&e.sourceCtrl){let t="copy"===e.action&&e.clone?e.clone:e.source;if(Array.isArray(t)){let i=[];for(let e=0;e<t.length;e++)i.push(t[e]);if(i.length>0){for(let t=0;t<i.length;t++)this._processDataDrop(i[t],e);this._clearPrevSelection()}}else{this._processDataDrop(t,e);this._clearPrevSelection()}if(e.sourceCtrl!==e.targetCtrl&&e.sourceCtrl.updateLayout)e.sourceCtrl.updateLayout();this.updateLayout()}this._isCtrlDragEntered=!1;this._dragDropService.clearData()}_processDataDrop(e,t){let i="copy"===t.action;if("copy"!==t.action&&t.sourceCtrl&&t.sourceCtrl.removeRow)i=t.sourceCtrl.removeRow(e);if(i)switch(t.dropPos){case 0:this.insertRowAt(e,-1,t.target);break;case 1:this.insertRowBefore(e,t.target);break;case 2:this.insertRowAfter(e,t.target);break;default:this.addRow(e)}}_callAfterSelectEvent(e){let t={obj:e};this._invokeEvent("afterSelect",t);this._invokeEvent("selectionChanged",t)}_removeDragHost(){this._dragObjIndex=-1;this._dragObj=null;this._dragGhost=null}_rowDragEnd(e,t){let i=this._dragDropService.getData(),l={action:e.shiftKey?"copy":"move",dragObj:i.source,dropPos:i.dropPos,event:e,mousePos:this._commonService.getMousePos(e),sourceCtrl:i.sourceCtrl,targetCtrl:this,targetObj:i.target};this._removeDropMark();this._removeDragHost();this._invokeEvent("dragEnd",l)}_resetReorderColumnSettings(){this._reorderColumnObj=null;this._reorderColumn=null;this._columnReorderActive=!1;this._startColumnReorder=!1}_callCellValueChanging(e,t,i){let l={cancel:!1,row:e.data,cell:t.data,text:t.data[this._cellFields.text],value:void 0!==i?i:t.data[this._cellFields.value]};this._invokeEvent("valueChanging",l);return l.cancel}_callCellValueChanged(e,t){let i={row:e.data,cell:t.data,text:t.data[this._cellFields.text],value:t.data[this._cellFields.value]};this._invokeEvent("valueChanged",i)}_closeEditor(e){let t=this;if(t._isEditorFocused)setTimeout(function(){t._currentEditingCell=null;t._isEditorFocused=!1;if(!e&&t._currentFocusCell)t._updateFocusCell(t._currentFocusCell,!0);t.update()},1)}_convertCheckBoxValue(e){switch(e){case"checked":return IntegralUICheckState.Checked;case"indeterminate":return IntegralUICheckState.Indeterminate;case"unchecked":return IntegralUICheckState.Unchecked;default:return