UNPKG

@lidorsystems/integralui-web

Version:

IntegralUI Web - Advanced UI Components for Angular

15 lines (12 loc) 121 kB
/* filename: integralui.base.grid.js version : 20.2.0 Copyright © 2016-2020 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. */ "use strict";var __extends=this&&this.__extends||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)if(t.hasOwnProperty(i))e[i]=t[i]})(t,i)};return function(t,i){e(t,i);function o(){this.constructor=t}t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0});var IntegralUIGridLines,core_1=require("@angular/core"),integralui_core_1=require("./integralui.core"),integralui_common_service_1=require("../services/integralui.common.service"),integralui_data_service_1=require("../services/integralui.data.service"),integralui_dragdrop_service_1=require("../services/integralui.dragdrop.service"),integralui_filter_service_1=require("../services/integralui.filter.service"),integralui_datepicker_1=require("./integralui.datepicker"),integralui_colorpicker_1=require("./integralui.colorpicker"),i0=require("@angular/core"),i1=require("../services/integralui.data.service"),i2=require("../services/integralui.dragdrop.service"),i3=require("../services/integralui.common.service"),i4=require("../services/integralui.filter.service");!function(e){e[e.None=0]="None";e[e.Horizontal=1]="Horizontal";e[e.Vertical=2]="Vertical";e[e.Both=3]="Both"}(IntegralUIGridLines=exports.IntegralUIGridLines||(exports.IntegralUIGridLines={}));var IntegralUIBaseGrid=function(e){__extends(t,e);function t(t,i,o,r,l,s,n,a){var c=e.call(this,l)||this;c.dataService=t;c.dragDropService=i;c.elemRef=o;c.elemRenderer=r;c.commonService=l;c.filterService=s;c.changeRef=n;c.cmpResolver=a;c.animateColumnSize={width:0,height:0};c.animateRowSize={width:0,height:0};c.prevClickedObj=null;c.headerData=[];c.rowData=[];c.rowHoverData=[];c.rowSelectData=[];c.cellData=[];c.footerData=[];c.completeColumnList=[];c.completeLeftColumnList=[];c.completeRightColumnList=[];c.currentColumnList=[];c.currentLeftColumnList=[];c.currentRightColumnList=[];c.currentRowList=[];c.dataColumns=[];c.dataRows=[];c.flatCompleteColumnList=[];c.flatCompleteLeftColumnList=[];c.flatCompleteRightColumnList=[];c.flatCurrentColumnList=[];c.flatCurrentLeftColumnList=[];c.flatCurrentRightColumnList=[];c.maxColumnLevels=0;c.options={};c.scrollColumnList=[];c.scrollLeftColumnList=[];c.scrollRightColumnList=[];c.scrollFooterList=[];c.scrollLeftFooterList=[];c.scrollRightFooterList=[];c.scrollRowList=[];c.scrollLeftRowList=[];c.scrollRightRowList=[];c.columnDataKey="columns";c.rowDataKey="rows";c.dropMarkElem=null;c.dragCmpRef=null;c.dragCmp=null;c.cloneElem=null;c.cloneElemStartPos={x:0,y:0};c.isCtrlDragEntered=!1;c.isFirstDragEnter=!1;c.isDragHandleVisible=!1;c.dragRowList=[];c.targetDropRow=null;c.targetDropPos=-1;c.prevTargetDropPos=-1;c.dragHandlePos={top:-9999999,left:0};c.dragHandleShiftPos={x:0,y:0};c.dragObjIndent=0;c.isDragActive=!1;c.dragStartPos={x:0,y:0};c.dragEndPos={x:0,y:0};c.clickedCell=null;c.dropList=null;c.dropListRef=null;c.calendar=null;c.calendarRef=null;c.colorPopup=null;c.colorPopupRef=null;c.colorPanelSize={width:240,height:270};c.currentEditorCell=null;c.isPopupDelayed=!1;c.isEditorFocused=!1;c.originalEditorText="";c.originalEditorValue=null;c.expandColIndex=0;c.hoverCell=null;c.hoverColumn=null;c.hoverRow=null;c.isGridHovered=!1;c.currentIndex=0;c.prevIndex=0;c.tabIndexCount=0;c.ctrlCursor="default";c.blockHoverRect={height:30,left:0,top:-9999999,width:880};c.blockSelectRect=[];c.blockSelectHeight=0;c.hoverRowObj={data:{}};c.columnStartPos={x:0,y:0};c.resizeColumn=null;c.resizeColumnIndex=-1;c.reorderColumn=null;c.columnReorderActive=!1;c.currentFocusCell=null;c.isKeyboardActive=!1;c.allowUpdate=!0;c.avgRowHeight=0;c.blockMarginTop=0;c.blockSize={width:0,height:0};c.leftBlockSize={width:0,height:0};c.rightBlockSize={width:0,height:0};c.columnPadding={top:0,right:0,bottom:0,left:0};c.currentGridLines=IntegralUIGridLines.Both;c.currentHeaderHeight=0;c.currentFooterHeight=0;c.isExpandBoxVisible=!0;c.isLayoutUpdating=!1;c.isHoverTemplatePresent=!1;c.isSelectedTemplatePresent=!1;c.numVisibleCells=0;c.viewIndexRange={left:0,middle:999,right:999};c.fixedLeftViewIndexRange=0;c.fixedRightViewIndexRange=0;c.visibleRange=1;c.isAutoSizeColumnsActive=!1;c.isHeaderVisible=!0;c.isFooterVisible=!0;c.isUpdateActive=!1;c.scrollSize={width:0,height:0};c.contentLeftPos=0;c.initialContentLeftPos=0;c.allColWidth=0;c.horScrollElemPos={bottom:0};c.cornerScrollElemPos={bottom:0};c.paginatorPos={top:0,left:0};c.currentPageNumber=1;c.onlyCurrentPage=!1;c.currentPageList=[];c.pageNumber=0;c.pageList=[];c.pageRowCount=0;c.paginatorHeight=0;c.originalScrollColumnList=[];c.reorderColumnObj=null;c.reorderColumnObjPos={top:0,left:0};c.reorderColumnStartPos={top:0,left:0};c.reorderColumnCurrentPos={top:0,left:0};c.reorderColIndex=-1;c.reorderNewColIndex=-1;c.startColumnReorder=!1;c.isColumnResizing=!1;c.currentScrollPos={x:0,y:0};c.isKeyPressed=!1;c.maxScrollPos={x:0,y:0};c.accelerator=.5;c.scrollTimerID=null;c.isScrollTimerActive=!1;c.scrollCount=0;c.isScrollActive=!1;c.prevScrollPos={x:0,y:0};c.scrollBarSize={width:0,height:0};c.scrollLargeChange={x:0,y:0};c.currentSelectedColumn=null;c.currentSelectedRow=null;c.currentSelectionMode=integralui_core_1.IntegralUISelectionMode.One;c.isRowClicked=!1;c.shiftFirstSelectedRow=null;c.removeIndex=-1;c.currentSelectedRows=[];c.isExpandBoxTouched=!1;c.touchStartPos={x:0,y:0};c.touchEndPos={x:0,y:0};c.footerHeight=0;c.headerHeight=0;c.mouseWheelSpeed=integralui_core_1.IntegralUISpeedMode.Normal;c.rowContentVisibility=integralui_core_1.IntegralUIContentVisibility.Both;c.rowHeight=0;c.showHoverRow=!1;c.afterSelect=new core_1.EventEmitter;c.beforeEdit=new core_1.EventEmitter;c.beforeSelect=new core_1.EventEmitter;c.beforeUpdate=new core_1.EventEmitter;c.cellClick=new core_1.EventEmitter;c.cellDblClick=new core_1.EventEmitter;c.cellHover=new core_1.EventEmitter;c.cellRightClick=new core_1.EventEmitter;c.cellValueChanging=new core_1.EventEmitter;c.cellValueChanged=new core_1.EventEmitter;c.change=new core_1.EventEmitter;c.columnAdding=new core_1.EventEmitter;c.columnAdded=new core_1.EventEmitter;c.columnClick=new core_1.EventEmitter;c.columnDblClick=new core_1.EventEmitter;c.columnHover=new core_1.EventEmitter;c.columnRightClick=new core_1.EventEmitter;c.columnOrderChanged=new core_1.EventEmitter;c.columnRemoving=new core_1.EventEmitter;c.columnRemoved=new core_1.EventEmitter;c.columnsCleared=new core_1.EventEmitter;c.columnSizeChanged=new core_1.EventEmitter;c.dragEnd=new core_1.EventEmitter;c.dragEnter=new core_1.EventEmitter;c.dragDrop=new core_1.EventEmitter;c.dragDropComplete=new core_1.EventEmitter;c.dragLeave=new core_1.EventEmitter;c.dragOver=new core_1.EventEmitter;c.dragStart=new core_1.EventEmitter;c.keyDown=new core_1.EventEmitter;c.keyPress=new core_1.EventEmitter;c.keyUp=new core_1.EventEmitter;c.pageChanged=new core_1.EventEmitter;c.rowAdding=new core_1.EventEmitter;c.rowAdded=new core_1.EventEmitter;c.rowClick=new core_1.EventEmitter;c.rowDblClick=new core_1.EventEmitter;c.rowHover=new core_1.EventEmitter;c.rowRemoving=new core_1.EventEmitter;c.rowRemoved=new core_1.EventEmitter;c.rowRightClick=new core_1.EventEmitter;c.rowsCleared=new core_1.EventEmitter;c.loadComplete=new core_1.EventEmitter;c.scrollPosChanged=new core_1.EventEmitter;c.selectionChanged=new core_1.EventEmitter;c.updateComplete=new core_1.EventEmitter;c.dragGhost=null;c.dragMode=integralui_core_1.IntegralUIDragDropDisplayMode.Popup;c.emptyRowObj={cells:[],draggable:!1,isEmpty:!0,status:1,style:{}};c.sortColumn=null;c.sortComparer=null;c.updateOptions();return c}Object.defineProperty(t.prototype,"allowColumnReorder",{set:function(e){},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"allowDrag",{set:function(e){this.options.allowDrag=e},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"allowDrop",{set:function(e){this.options.allowDrop=e},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"allowFilter",{set:function(e){this.options.allowFilter=e},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"allowFocus",{set:function(e){this.options.allowFocus=e;if(!e)this.currentFocusCell=null;this.refresh()},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"autoSizeColumns",{get:function(){return this.isAutoSizeColumnsActive},set:function(e){if(this.isAutoSizeColumnsActive!=e){this.isAutoSizeColumnsActive=e;this.updateLayout()}},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"columns",{get:function(){return this.dataColumns},set:function(e){this.dataColumns=e;this.updateData()},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"dataFields",{set:function(e){this.updateDataFields(e)},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"focusedCell",{get:function(){return this.currentFocusCell?this.currentFocusCell.data:null},set:function(e){if(this.currentFocusCell!=e)this.updateFocusCell(this.getObjFromCell(e))},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"gridLines",{get:function(){return this.currentGridLines},set:function(e){if(this.currentGridLines!=e){this.currentGridLines=e;this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"paging",{set:function(e){this.updatePaging(e);this.resetPageNumber();this.updateCurrentLayout()},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"rows",{get:function(){return this.dataRows},set:function(e){this.dataRows=e;this.updateData()},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"selectedColumn",{get:function(){return this.currentSelectedColumn},set:function(e){if(this.currentSelectedColumn!=e)this.processColumnSelection(null,e)},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"selectedRow",{get:function(){return this.currentSelectedRow},set:function(e){if(this.currentSelectedRow!=e){this.processRowSelection(null,e);this.updateSelectContentPos()}},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"selectionMode",{get:function(){return this.currentSelectionMode},set:function(e){if(this.currentSelectionMode!=e){this.currentSelectionMode=e;this.clearPrevSelection(this.currentSelectionMode!=integralui_core_1.IntegralUISelectionMode.None?this.currentSelectedRow:null);this.refresh();if(this.currentSelectionMode==integralui_core_1.IntegralUISelectionMode.None){this.currentSelectedRow=null;this.selectionChanged.emit(null)}}},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"showExpandBox",{get:function(){return this.isExpandBoxVisible},set:function(e){if(this.isExpandBoxVisible!=e){this.isExpandBoxVisible=e;this.updateLayout()}},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"showScroll",{get:function(){return this.options.showScroll},set:function(e){this.updateShowScroll(e)},enumerable:!0,configurable:!0});Object.defineProperty(t.prototype,"sorting",{set:function(e){this.options.sorting=e},enumerable:!0,configurable:!0});t.prototype.ngOnInit=function(){this.dataService.init([{data:this.columns,fields:this.options.columnFields,key:this.columnDataKey},{data:this.rows,fields:this.options.rowFields,key:this.rowDataKey}])};t.prototype.addColumn=function(e){this.callEventAddColumn("add",e)};t.prototype.clearColumns=function(){this.dataService.clear(null,this.columnDataKey);this.columnsCleared.emit(null);this.currentScrollPos.x=0};t.prototype.insertColumnAt=function(e,t){this.callEventAddColumn("at",e,t)};t.prototype.insertColumnBefore=function(e,t){this.callEventAddColumn("ref",e,-1,t)};t.prototype.insertColumnAfter=function(e,t){this.callEventAddColumn("ref",e,-1,t,!0)};t.prototype.removeColumn=function(e){return this.callEventRemoveColumn(e)};t.prototype.removeColumnAt=function(e){return this.callEventRemoveColumn(null,e)};t.prototype.callEventAddColumn=function(e,t,i,o,r){var l={cancel:!1,column:t};this.columnAdding.emit(l);if(1!=l.cancel){switch(e){case"at":this.dataService.insert(t,i,null,null,!1,this.columnDataKey);break;case"ref":this.dataService.insertByRef(t,o,r,this.columnDataKey);break;default:this.dataService.insert(t,-1,null,null,!1,this.columnDataKey)}this.columnAdded.emit({column:t})}};t.prototype.callEventRemoveColumn=function(e,t){var i={cancel:!1,column:e};this.columnRemoving.emit(i);if(1!=i.cancel){this.removeIndex=this.columns?this.columns.indexOf(e):-1;var o=this.dataService.removeAt(e,t,null,this.columnDataKey);if(o.result){this.columnRemoved.emit({column:o.obj});return!0}}return!1};t.prototype.addRow=function(e,t){this.callEventAddRow("add",e,-1,t)};t.prototype.clearRows=function(e){this.dataService.clear(e,this.rowDataKey);this.rowsCleared.emit({parent:e});this.clearSelection();this.currentScrollPos.y=0};t.prototype.insertRowAt=function(e,t,i){this.callEventAddRow("at",e,t,i)};t.prototype.insertRowBefore=function(e,t){this.callEventAddRow("ref",e,-1,null,t)};t.prototype.insertRowAfter=function(e,t){this.callEventAddRow("ref",e,-1,null,t,!0)};t.prototype.removeRow=function(e){return this.callEventRemoveRow(e)};t.prototype.removeRowAt=function(e,t){return this.callEventRemoveRow(null,e,t)};t.prototype.callEventAddRow=function(e,t,i,o,r,l){var s={cancel:!1,row:t};this.rowAdding.emit(s);if(1!=s.cancel){switch(e){case"at":this.dataService.insert(t,i,o,null,!1,this.rowDataKey);break;case"ref":this.dataService.insertByRef(t,r,l,this.rowDataKey);break;default:this.dataService.insert(t,-1,o,null,!1,this.rowDataKey)}this.rowAdded.emit({row:t})}};t.prototype.callEventRemoveRow=function(e,t,i){var o={cancel:!1,row:e};this.rowRemoving.emit(o);if(1!=o.cancel){this.removeIndex=this.rows?this.rows.indexOf(e):-1;var r=this.dataService.removeAt(e,t,i,this.rowDataKey);if(r.result){if(e&&e[this.options.rowFields.selected]){e[this.options.rowFields.selected]=!1;this.currentSelectedRows=this.currentSelectedRows.filter(function(t){return t!=e});if(this.currentSelectedRow&&this.commonService.isEqual(this.currentSelectedRow[this.options.rowFields.id],e[this.options.rowFields.id]))this.currentSelectedRow=null;this.selectionChanged.emit({row:this.currentSelectedRow})}this.rowRemoved.emit({row:r.obj});return!0}}return!1};t.prototype.cellClickEvent=function(e,t){if(this.isEnabled&&1==e.which)this.cellClick.emit({cell:t.data,event:e})};t.prototype.cellDblClickEvent=function(e,t){if(this.isEnabled&&1==e.which)this.cellDblClick.emit({cell:t.data,event:e})};t.prototype.cellRightClickEvent=function(e,t){if(this.isEnabled)this.cellRightClick.emit({cell:t.data,event:e})};t.prototype.columnClickEvent=function(e,t){var i=this;if(i.isEnabled&&1==e.which)if(i.allowAnimation)var o=setTimeout(function(){i.columnClick.emit({column:t.data,event:e});clearTimeout(o)},250);else i.columnClick.emit({column:t.data,event:e})};t.prototype.columnDblClickEvent=function(e,t){if(this.isEnabled&&1==e.which)this.columnDblClick.emit({column:t.data,event:e})};t.prototype.columnRightClickEvent=function(e,t){if(this.isEnabled)this.columnRightClick.emit({column:t.data,event:e})};t.prototype.rowClickEvent=function(e,t){if(this.isEnabled&&1==e.which)this.rowClick.emit({event:e,row:t.data})};t.prototype.rowDblClickEvent=function(e,t){if(this.isEnabled&&1==e.which){var i={cancel:!1,event:e,row:t.data};this.rowDblClick.emit(i);if(1!=i.cancel)this.toggle(t.data)}};t.prototype.rowRightClickEvent=function(e,t){if(this.isEnabled){var i={event:e,row:t.data};this.rowRightClick.emit(i)}};t.prototype.updateData=function(){};t.prototype.updateDataFields=function(e){if(e){this.updateColumnFields(e.column);this.updateRowFields(e.row);this.updateCellFields(e.cell)}else{this.updateColumnFields();this.updateRowFields();this.updateCellFields()}};t.prototype.updateOptions=function(e){if(e){this.options={allowAnimation:this.commonService.isFieldAvailable(e.allowAnimation,!0),allowCellFocus:this.commonService.isFieldAvailable(e.allowCellFocus,!0),allowColumnReorder:this.commonService.isFieldAvailable(e.allowColumnReorder,!1),allowDrag:this.commonService.isFieldAvailable(e.allowDrag,!1),allowDrop:this.commonService.isFieldAvailable(e.allowDrop,!0),allowFilter:this.commonService.isFieldAvailable(e.allowFilter,!1),allowFocus:this.commonService.isFieldAvailable(e.allowFocus,!1),animationSpeed:200,autoExpand:this.commonService.isFieldAvailable(e.autoExpand,!0),displayMode:this.commonService.isFieldAvailable(e.displayMode,"normal"),editorSettings:{activate:"click"},enabled:this.commonService.isFieldAvailable(e.enabled,!0),expandColIndex:this.commonService.isFieldAvailable(e.expandColIndex,void 0!=this.options.expandColIndex?this.options.expandColIndex:0),fillSpace:this.commonService.isFieldAvailable(e.fillSpace,!1),gridLines:this.commonService.isFieldAvailable(e.gridLines,"both"),hoverSelection:this.commonService.isFieldAvailable(e.hoverSelection,!1),indent:this.commonService.isFieldAvailable(e.indent,15),labelEdit:this.commonService.isFieldAvailable(e.labelEdit,!1),loadRows:[],mouseWheelSpeed:this.commonService.isFieldAvailable(e.mouseWheelSpeed,"normal"),pathSeparator:this.commonService.isFieldAvailable(e.pathSeparator,"\\"),rowHeight:this.commonService.isFieldAvailable(e.rowHeight,-1),rtl:this.commonService.isFieldAvailable(e.rtl,!1),selectedColumn:this.commonService.isFieldAvailable(e.selectedColumn,this.currentSelectedColumn?this.currentSelectedColumn:null),selectedIndex:-1,selectedRow:this.commonService.isFieldAvailable(e.selectedRow,this.currentSelectedRow?this.currentSelectedRow:null),selectedRows:[],selectionMode:this.commonService.isFieldAvailable(e.selectionMode,integralui_core_1.IntegralUISelectionMode.One),showFooter:this.commonService.isFieldAvailable(e.showFooter,!0),showHeader:this.commonService.isFieldAvailable(e.showHeader,!0),showIcons:this.commonService.isFieldAvailable(e.showIcons,!0),sorting:this.commonService.isFieldAvailable(e.sorting,integralui_core_1.IntegralUISortOrder.None)};this.updatePaging(e.paging);this.updateDataFields(e.dataFields);this.updateShowScroll(e.showScroll)}else{this.options={allowAnimation:!0,allowCellFocus:!0,allowColumnReorder:!1,allowDrag:!1,allowDrop:!0,allowFilter:!1,allowFocus:!1,animationSpeed:200,autoExpand:!0,displayMode:"normal",editorSettings:{activate:"click"},enabled:!0,expandColIndex:0,fillSpace:!1,gridLines:"both",hoverSelection:!1,indent:15,labelEdit:!1,loadRows:[],mouseWheelSpeed:"normal",pathSeparator:"\\",rowHeight:-1,rtl:!1,selectedColumn:null,selectedIndex:-1,selectedRow:null,selectedRows:[],selectionMode:integralui_core_1.IntegralUISelectionMode.One,showFooter:!0,showHeader:!0,showIcons:!0,sorting:integralui_core_1.IntegralUISortOrder.None};this.updatePaging();this.updateDataFields();this.updateShowScroll()}};t.prototype.updateColumnFields=function(e){if(e)this.options.columnFields={aggregation:e.aggregation?e.aggregation:"aggregation",allowDrag:e.allowDrag?e.allowDrag:"allowDrag",allowDrop:e.allowDrop?e.allowDrop:"allowDrop",allowFilter:e.allowFilter?e.allowFilter:"allowFilter",allowGrouping:e.allowGrouping?e.allowGrouping:"allowGrouping",allowResize:e.allowResize?e.allowResize:"allowResize",canSelect:e.canSelect?e.canSelect:"canSelect",cellTemplateUrl:e.cellTemplateUrl?e.cellTemplateUrl:"cellTemplateUrl",columns:e.columns?e.columns:"columns",comparer:e.comparer?e.comparer:"comparer",contentAlignment:e.contentAlignment?e.contentAlignment:"contentAlignment",contextMenu:e.contextMenu?e.contextMenu:"contextMenu",editorType:e.editorType?e.editorType:"editorType",editorSettings:e.editorSettings?e.editorSettings:"editorSettings",editorTemplate:e.editorTemplate?e.editorTemplate:"editorTemplate",expanded:e.expanded?e.expanded:"expanded",filterParams:e.filterParams?e.filterParams:"filterParams",filterTemplate:e.filterTemplate?e.filterTemplate:"filterTemplate",fixed:e.fixed?e.fixed:"fixed",fixedWidth:e.fixedWidth?e.fixedWidth:"fixedWidth",footerAlignment:e.footerAlignment?e.footerAlignment:"footerAlignment",footerContent:e.footerContent?e.footerContent:"footerContent",footerTemplate:e.footerTemplate?e.footerTemplate:"footerTemplate",footerTemplateModel:e.footerTemplateModel?e.footerTemplateModel:"footerTemplateModel",footerText:e.footerText?e.footerText:"footerText",footerTooltip:e.footerTooltip?e.footerTooltip:"footerTooltip",groupText:e.groupText?e.groupText:"groupText",headerAlignment:e.headerAlignment?e.headerAlignment:"headerAlignment",headerContent:e.headerContent?e.headerContent:"headerContent",headerTemplate:e.headerTemplate?e.headerTemplate:"headerTemplate",headerTemplateModel:e.headerTemplateModel?e.headerTemplateModel:"headerTemplateModel",headerText:e.headerText?e.headerText:"headerText",headerTooltip:e.headerTooltip?e.headerTooltip:"headerTooltip",icon:e.icon?e.icon:"icon",id:e.id?e.id:"id",minWidth:e.minWidth?e.minWidth:"minWidth",maxWidth:e.maxWidth?e.maxWidth:"maxWidth",name:e.name?e.name:"name",objects:e.columns?e.columns:"columns",pid:e.pid?e.pid:"pid",selected:e.selected?e.selected:"selected",style:e.style?e.style:"style",templateSettings:e.templateSettings?e.templateSettings:"templateSettings",visible:e.visible?e.visible:"visible",width:e.width?e.width:"width"};else this.options.columnFields={aggregation:"aggregation",allowDrag:"allowDrag",allowDrop:"allowDrop",allowFilter:"allowFilter",allowGrouping:"allowGrouping",allowResize:"allowResize",canSelect:"canSelect",cellTemplateUrl:"cellTemplateUrl",columns:"columns",comparer:"comparer",contentAlignment:"contentAlignment",contextMenu:"contextMenu",editorType:"editorType",editorSettings:"editorSettings",editorTemplate:"editorTemplate",expanded:"expanded",filterParams:"filterParams",filterTemplate:"filterTemplate",footerTemplateModel:"footerTemplateModel",fixed:"fixed",fixedWidth:"fixedWidth",footerAlignment:"footerAlignment",footerContent:"footerContent",footerTemplate:"footerTemplate",footerText:"footerText",footerTooltip:"footerTooltip",groupText:"groupText",headerAlignment:"headerAlignment",headerContent:"headerContent",headerTemplate:"headerTemplate",headerTemplateModel:"headerTemplateModel",headerText:"headerText",headerTooltip:"headerTooltip",icon:"icon",id:"id",minWidth:"minWidth",maxWidth:"maxWidth",name:"name",objects:"columns",pid:"pid",selected:"selected",style:"style",templateSettings:"templateSettings",visible:"visible",width:"width"};if(this.dataService)this.dataService.updateDataFields(this.options.columnFields,this.columnDataKey)};t.prototype.updateRowFields=function(e){if(e)this.options.rowFields={allowDrag:e.allowDrag?e.allowDrag:"allowDrag",allowDrop:e.allowDrop?e.allowDrop:"allowDrop",allowEdit:e.allowEdit?e.allowEdit:"allowEdit",allowFocus:e.allowFocus?e.allowFocus:"allowFocus",autoCheck:e.autoCheck?e.autoCheck:"autoCheck",canSelect:e.canSelect?e.canSelect:"canSelect",cells:e.cells?e.cells:"cells",checkBoxSettings:e.checkBoxSettings?e.checkBoxSettings:"checkBoxSettings",checked:e.checked?e.checked:"checked",checkState:e.checkState?e.checkState:"checkState",content:e.content?e.content:"content",contentVisibility:e.contentVisibility?e.contentVisibility:"contentVisibility",contextMenu:e.contextMenu?e.contextMenu:"contextMenu",gid:e.gid?e.gid:"gid",enabled:e.enabled?e.enabled:"enabled",expanded:e.expanded?e.expanded:"expanded",fixed:e.fixed?e.fixed:"fixed",hasChildren:e.hasChildren?e.hasChildren:"hasChildren",icon:e.icon?e.icon:"icon",id:e.id?e.id:"id",name:e.name?e.name:"name",objects:e.rows?e.rows:"rows",pid:e.pid?e.pid:"pid",rows:e.rows?e.rows:"rows",selected:e.selected?e.selected:"selected",statusIcon:e.statusIcon?e.statusIcon:"statusIcon",style:e.style?e.style:"style",subobjects:e.cells?e.cells:"cells",templateObj:e.templateObj?e.templateObj:"templateObj",text:e.text?e.text:"text",tooltip:e.tooltip?e.tooltip:"tooltip",value:e.value?e.value:"value",visible:e.visible?e.visible:"visible"};else this.options.rowFields={allowDrag:"allowDrag",allowDrop:"allowDrop",allowFocus:"allowFocus",canSelect:"canSelect",cells:"cells",content:"content",contentVisibility:"contentVisibility",contextMenu:"contextMenu",enabled:"enabled",expanded:"expanded",fixed:"fixed",gid:"gid",hasChildren:"hasChildren",icon:"icon",id:"id",name:"name",objects:"rows",pid:"pid",rows:"rows",selected:"selected",statusIcon:"statusIcon",style:"style",subobjects:"cells",text:"text",tooltip:"tooltip",value:"value",visible:"visible"};if(this.dataService)this.dataService.updateDataFields(this.options.rowFields,this.rowDataKey)};t.prototype.updateCellFields=function(e){if(e)this.options.cellFields={allowDrag:e.allowDrag?e.allowDrag:"allowDrag",allowEdit:e.allowEdit?e.allowEdit:"allowEdit",cid:e.cid?e.cid:"cid",content:e.content?e.content:"content",contextMenu:e.contextMenu?e.contextMenu:"contextMenu",editorSettings:e.editorSettings?e.editorSettings:"editorSettings",enabled:e.enabled?e.enabled:"enabled",expanded:e.expanded?e.expanded:"expanded",isGroup:e.isGroup?e.isGroup:"isGroup",labelEdit:e.labelEdit?e.labelEdit:"labelEdit",rid:e.rid?e.rid:"rid",selected:e.selected?e.selected:"selected",style:e.style?e.style:"style",tag:e.tag?e.tag:"tag",templateObj:e.templateObj?e.templateObj:"templateObj",text:e.text?e.text:"text",tooltip:e.tooltip?e.tooltip:"tooltip",value:e.value?e.value:"value",valueID:e.valueID?e.valueID:"valueID",valueType:e.valueType?e.valueType:"valueType"};else this.options.cellFields={allowDrag:"allowDrag",allowEdit:"allowEdit",cid:"cid",content:"content",contextMenu:"contextMenu",editorSettings:"editorSettings",enabled:"enabled",expanded:"expanded",isGroup:"isGroup",labelEdit:"labelEdit",rid:"rid",selected:"selected",style:"style",tag:"tag",templateObj:"templateObj",text:"text",tooltip:"tooltip",value:"value",valueID:"valueID",valueType:"valueType"}};t.prototype.updateShowScroll=function(e){if(e)this.options.showScroll={horizontal:this.commonService.isFieldAvailable(e.horizontal,!0),vertical:this.commonService.isFieldAvailable(e.vertical,!0)};else this.options.showScroll={horizontal:!0,vertical:!0}};t.prototype.processLoadData=function(e,t,i,o){var r=this;r.clearRows(t);r.updateRowFields(i);var l=[];if(e)if(o||void 0==o){var s=[];e.forEach(function(e,t){var i=e[r.options.rowFields.pid];if(s[i]){if(!s[i][r.options.rowFields.rows])s[i][r.options.rowFields.rows]=[];s[e[r.options.rowFields.id]]=e;s[i][r.options.rowFields.rows].push(e)}else{s[e[r.options.rowFields.id]]=e;l.push(e)}});s.length=0}else l=e;if(t){t[r.options.rowFields.rows]=l;for(var n=0;n<t[r.options.rowFields.rows].length;n++)t[r.options.rowFields.rows][n][r.options.rowFields.pid]=t[r.options.rowFields.id]}else if(r.rows){r.rows.length=0;for(n=0;n<l.length;n++)r.rows.push(l[n])}r.loadComplete.emit(null);this.updateLayout()};t.prototype.calcMaxColumnLevels=function(e,t){if(e&&0!=e.length)for(var i=0;i<e.length;i++)if(this.isColumnExpanded(e[i])&&this.isColumnWithChildrenVisible(e[i])){if(this.maxColumnLevels<t)this.maxColumnLevels=t;this.calcMaxColumnLevels(e[i][this.options.columnFields.columns],t+1)}};t.prototype.getColumnSpan=function(e){var t=0;if(!e[this.options.columnFields.columns]||0==e[this.options.columnFields.columns].length)return 1;for(var i=0;i<e[this.options.columnFields.columns].length;i++)t+=this.getColumnSpan(e[this.options.columnFields.columns][i]);return t};t.prototype.isColumnWithChildrenVisible=function(e){var t=!1;if(e)if(t=this.isColumnVisible(e)){var i=e[this.options.columnFields.columns];if(i&&i.length>0){for(var o=0,r=0;r<i.length;r++)if(this.isColumnWithChildrenVisible(i[r]))o++;t=o>0?!0:!1}}return t};t.prototype.createColumnLevel=function(e,t,i,o){if(e&&!(t>=this.maxColumnLevels))for(var r=0;r<e.length;){if((t>0?this.isColumnExpanded(e[r]):!0)&&this.isColumnWithChildrenVisible(e[r])){if(!e[r][this.options.columnFields.id])e[r][this.options.columnFields.id]=this.commonService.getUniqueId();if(o)e[r][this.options.columnFields.pid]=o;var l=e[r][this.options.columnFields.columns],s={colSpan:l?this.getColumnSpan(e[r]):0,data:e[r],isRoot:0==t?!0:!1,isVisible:!this.isColumnExpanded(e[r])||!l||0==l.length?!0:!1,rowSpan:!this.isColumnExpanded(e[r])||!l||0==l.length?this.maxColumnLevels-t:0};switch(i){case"left":this.completeLeftColumnList[t].push(s);break;case"right":this.completeRightColumnList[t].push(s);break;default:this.completeColumnList[t].push(s)}this.createColumnLevel(e[r][this.options.columnFields.columns],t+1,i,e[r][this.options.columnFields.id])}r++}};t.prototype.updateColumnCompleteList=function(){var e=this.currentColumnList.map(function(e){return e.data}),t=this.currentLeftColumnList.map(function(e){return e.data}),i=this.currentRightColumnList.map(function(e){return e.data});this.calcMaxColumnLevels(e,1);this.calcMaxColumnLevels(t,1);this.calcMaxColumnLevels(i,1);for(var o=1;o<=this.maxColumnLevels;o++){this.completeColumnList.push([]);this.completeLeftColumnList.push([]);this.completeRightColumnList.push([])}this.createColumnLevel(e,0);this.createColumnLevel(t,0,"left");this.createColumnLevel(i,0,"right");this.flatCompleteColumnList=this.createFlatColumnList(this.completeColumnList);this.flatCompleteLeftColumnList=this.createFlatColumnList(this.completeLeftColumnList);this.flatCompleteRightColumnList=this.createFlatColumnList(this.completeRightColumnList)};t.prototype.createScrollRowList=function(){this.createScrollNormalRowList();this.createScrollLeftRowList();this.createScrollRightRowList()};t.prototype.createScrollNormalRowList=function(){this.scrollRowList.length=0;for(var e=0;e<100;e++){var t=this.createEmptyRowObj();this.scrollRowList.push(t)}};t.prototype.createScrollLeftRowList=function(){this.scrollLeftRowList.length=0;for(var e=0;e<100;e++){var t=this.createEmptyRowObj();this.scrollLeftRowList.push(t)}};t.prototype.createScrollRightRowList=function(){this.scrollRightRowList.length=0;for(var e=0;e<100;e++){var t=this.createEmptyRowObj();this.scrollRightRowList.push(t)}};t.prototype.createEmptyRowObj=function(){for(var e={clickPos:{x:0,y:0},cells:[],data:{},draggable:!1,indent:0,inlineStyle:{},isEmpty:!0,isGroup:!1,style:{}},t=0;t<1;t++)e.cells.push(this.createEmptyCellObj());return e};t.prototype.createEmptyCellObj=function(){return{align:"",colIndex:-1,data:{},display:"none",editorClass:"",editorList:[],editorSettings:{},editorStyle:"",editorType:null,editorValue:null,expandBoxAllowed:!1,indent:0,inlineStyle:{},isEditorEnabled:!0,isEditorVisible:!0,isEmpty:!0,rowIndex:-1,style:{content:"iui-grid-row-cell-content"},tabIndex:-1,width:100,height:"auto"}};t.prototype.updateScrollRowListLimit=function(e){this.updateScrollNormalRowListLimit(e);this.updateScrollLeftRowListLimit(e);this.updateScrollRightRowListLimit(e)};t.prototype.updateScrollNormalRowListLimit=function(e){for(var t=0;t<this.scrollRowList.length;t++)for(var i=0;i<e;i++)this.scrollRowList[t].cells.push(this.createEmptyCellObj())};t.prototype.updateScrollLeftRowListLimit=function(e){for(var t=0;t<this.scrollLeftRowList.length;t++)for(var i=0;i<e;i++)this.scrollLeftRowList[t].cells.push(this.createEmptyCellObj())};t.prototype.updateScrollRightRowListLimit=function(e){for(var t=0;t<this.scrollRightRowList.length;t++)for(var i=0;i<e;i++)this.scrollRightRowList[t].cells.push(this.createEmptyCellObj())};t.prototype.getNumScrollColumns=function(e){switch(e){case"left":return this.scrollLeftRowList.length>0?this.scrollLeftRowList[0].cells.length:0;case"right":return this.scrollRightRowList.length>0?this.scrollRightRowList[0].cells.length:0}return this.scrollRowList.length>0?this.scrollRowList[0].cells.length:0};t.prototype.getNumVisibleColumns=function(e){switch(e){case"left":return this.flatCompleteLeftColumnList.filter(function(e){return e.isVisible}).length;case"right":return this.flatCompleteRightColumnList.filter(function(e){return e.isVisible}).length}return this.flatCompleteColumnList.filter(function(e){return e.isVisible}).length};t.prototype.resetRowObj=function(e){if(e){e.clickPos={x:0,y:0};e.data={};e.draggable=!1;e.indent=0;e.inlineStyle={};e.isEmpty=!0;e.isGroup=!1;e.style={}}};t.prototype.resetCellObj=function(e){if(e){e.align="";e.colIndex=-1;e.data={};e.display="none";e.editorClass="";e.editorList=[];e.editorSettings={};e.editorStyle="";e.editorType=null;e.editorValue=null;e.expandBoxAllowed=!1;e.indent=0;e.inlineStyle={};e.isEditorEnabled=!0;e.isEditorVisible=!0;e.isEmpty=!0;e.rowIndex=-1;e.style={content:"iui-grid-row-cell-content"};e.tabIndex=-1;e.width=0;e.height="auto"}};t.prototype.updateScrollColumnList=function(){};t.prototype.updateScrollRowList=function(e){};t.prototype.addDropMark=function(e){if(this.appRef){this.removeDropMark();var t=this.cmpResolver.resolveComponentFactory(integralui_core_1.IntegralUIDragWindow);if(t){this.dragCmpRef=this.appRef.createComponent(t);if(this.dragCmpRef.instance)this.dragCmp=this.dragCmpRef.instance}}};t.prototype.removeDropMark=function(){if(this.dragCmpRef)this.dragCmpRef.destroy();this.dragCmp=null};t.prototype.callDragDropEvent=function(e,t,i){var o=this,r={action:t.action,cancel:!1,dragRow:t.source,dropPos:t.dropPos,event:e,isDropAllowed:t.allow,mousePos:this.commonService.getMousePos(e),resume:function(){o.drop(e,o.dragDropService.getData());o.dragDropService.clearData()},sourceCtrl:t.sourceCtrl,targetCtrl:t.targetCtrl,targetRow:t.target};if(i)this.dragDrop.emit(r);else this.dragOver.emit(r);return r};t.prototype.checkEmptySpace=function(e){var t=this.getContentSize(),i=this.commonService.getPageRect(this.elemRef.nativeElement.firstElementChild),o=i.top+t.height,r=i.bottom,l=this.commonService.getMousePos(e),s=this.commonService.getShiftPos();l.x-=s.x;l.y-=s.y;return l.y>=o&&l.y<=r};t.prototype.ctrlDragEnter=function(e){if(this.isEnabled)this.processDragEnter(e)};t.prototype.ctrlDragDrop=function(e){if(this.isEnabled)this.processDragDrop(e);this.removeDropMark();e.stopPropagation()};t.prototype.ctrlDragLeave=function(e){if(this.isEnabled)this.processDragLeave(e)};t.prototype.ctrlDragOver=function(e){if(this.isEnabled)this.processDragOver(e);e.stopPropagation()};t.prototype.ctrlDragEnd=function(e){this.removeDropMark();var t=this.dragDropService.getData();if(t.targetCtrl&&t.targetCtrl.removeDropMark)t.targetCtrl.removeDropMark();this.rowDragEnd(e,null)};t.prototype.removeDragHandle=function(){this.isDragHandleVisible=!1;this.targetDropRow=null;this.targetDropPos=-1};t.prototype.dropMark=function(e,t){if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle){if(!t)this.removeDragHandle();this.updateScrollRowListDragOver(null)}else{if(!this.dragCmp&&!this.isScrollTimerActive)this.addDropMark({x:e.pageX,y:e.pageY});if(this.dragCmp){var i="none";if(this.options.allowDrop)i=t?"block":"none";this.dragCmp.display=i}}};t.prototype.updateDragComponent=function(e){if(this.dragCmp)this.dragCmp.updatePos(e)};t.prototype.isDragAllowed=function(e){return this.options.allowDrag?e&&(e[this.options.rowFields.allowDrag]||void 0===e[this.options.rowFields.allowDrag])?!0:!1:!1};t.prototype.isDropAllowed=function(e,t,i){var o=this.options.allowDrop;if(o&&e&&t)if(o=t[this.options.rowFields.allowDrop]||void 0===t[this.options.rowFields.allowDrop]?!0:!1)if(Array.isArray(e))for(var r=0;r<e.length;r++){if(this.commonService.isEqual(e[r][this.options.rowFields.id],t[this.options.rowFields.id])||0===i&&this.isParentOf(t,e[r])||this.isChildOf(t,e[r])){o=!1;break}if(!o)break}else if(this.commonService.isEqual(e[this.options.rowFields.id],t[this.options.rowFields.id])||0===i&&this.isParentOf(t,e)||this.isChildOf(t,e))o=!1;return o};t.prototype.processDragStart=function(e,t){if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle)this.processDragStartHandle(e,t);else this.processDragStartPopup(e,t)};t.prototype.processDragStartHandle=function(e,t){this.dragDropService.clearData();if(this.isDragAllowed(t)){if(t)if(!this.isDragAllowed(t))this.ctrlCursor="no-drop";else{var i={clone:this.cloneRow(t),handle:this.dragRowList,source:t,sourceCtrl:this,sourceData:this.rows};switch(this.selectionMode){case integralui_core_1.IntegralUISelectionMode.MultiSimple:case integralui_core_1.IntegralUISelectionMode.MultiExtended:i.clone=this.createCloneList(this.currentSelectedRows);i.source=this.currentSelectedRows}var o={action:e.shiftKey?"copy":"move",cancel:!1,dragRow:i.source,dropPos:-1,event:e,isDropAllowed:this.options.allowDrop,mousePos:this.commonService.getMousePos(e),sourceCtrl:i.sourceCtrl,targetCtrl:this,targetRow:null};this.dragStart.emit(o);if(1==o.cancel){e.preventDefault();return}else{this.isFirstDragEnter=!0;this.dragDropService.setData(i)}}}else e.preventDefault()};t.prototype.processDragStartPopup=function(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{var i={clone:this.cloneRow(t),source:t,sourceCtrl:this,sourceData:this.rows};switch(this.selectionMode){case integralui_core_1.IntegralUISelectionMode.MultiSimple:case integralui_core_1.IntegralUISelectionMode.MultiExtended:i.clone=this.createCloneList(this.currentSelectedRows);i.source=this.currentSelectedRows}var o={action:e.shiftKey?"copy":"move",cancel:!1,dragRow:i.source,dropPos:-1,event:e,isDropAllowed:this.options.allowDrop,mousePos:this.commonService.getMousePos(e),sourceCtrl:i.sourceCtrl,targetCtrl:this,targetRow:null};this.dragStart.emit(o);if(1==o.cancel){e.preventDefault();return}else{this.isDragActive=!0;this.isFirstDragEnter=!0;this.addDropMark({x:e.pageX,y:e.pageY});this.dropMark(e);if(e.dataTransfer){e.dataTransfer.effectAllowed="move";e.dataTransfer.setData("text",t[this.options.rowFields.id]?t[this.options.rowFields.id].toString():"")}else if(e.originalEvent&&e.originalEvent.dataTransfer){e.originalEvent.dataTransfer.effectAllowed="move";e.originalEvent.dataTransfer.setData("text",t[this.options.rowFields.id]?t[this.options.rowFields.id].toString():"")}this.dragDropService.setData(i)}}}else e.preventDefault()};t.prototype.processDragEnter=function(e){e.preventDefault();if(!this.isCtrlDragEntered){this.isCtrlDragEntered=!0;var t=this.dragDropService.getData();if(!this.isFirstDragEnter&&this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle){this.dragRowList=t.handle;if(this.dragRowList){for(var i=0;i<this.dragRowList.length;i++){var o=this.getObjIndexFromScrollList(this.dragRowList[i].data);if(o>=0)this.scrollRowList.splice(o,1)}this.isDragHandleVisible=!0;this.targetDropPos=2;this.targetDropRow=this.scrollRowList.length>0?this.scrollRowList[this.scrollRowList.length-1].data:null;this.scrollRowList.splice(this.scrollRowList.length,0,{cells:[],draggable:!1,isEmpty:!0,status:1,style:{}})}}this.isFirstDragEnter=!1;var r={action:e.shiftKey?"copy":"move",dragRow:t.source,dropPos:-1,event:e,isDropAllowed:this.options.allowDrop,mousePos:this.commonService.getMousePos(e),sourceCtrl:t.sourceCtrl,targetCtrl:this,targetRow:null};this.dragEnter.emit(r)}};t.prototype.processDragLeave=function(e){e.preventDefault();if(this.isCtrlDragEntered){var t=this.commonService.getPageRect(this.elemRef.nativeElement.firstElementChild),i=this.commonService.getMousePos(e),o=this.commonService.getShiftPos();i.x-=o.x;i.y-=o.y;if(i.x<=t.left||i.x>=t.right||i.y<=t.top||i.y>=t.bottom){this.isCtrlDragEntered=!1;if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle)this.updateScrollRowList();this.stopScrollTimer();var r=this.dragDropService.getData(),l={action:e.shiftKey?"copy":"move",dragRow:r.source,dropPos:-1,event:e,isDropAllowed:!1,mousePos:this.commonService.getMousePos(e),sourceCtrl:r.sourceCtrl,targetCtrl:null,targetRow:null};this.dragLeave.emit(l)}this.dropMark(e)}};t.prototype.processDragOver=function(e,t,i,o,r){if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle)this.processDragOverHandle(e,t,i,o,r);else this.processDragOverPopup(e,t,i,o,r)};t.prototype.processDragOverHandle=function(e,t,i,o,r){e.preventDefault();this.processDragEnter(e);this.hoverRow=null;this.changeCursor();var l=this.isDragActive;if(l){var s=this.dragDropService.getData(),n=this.commonService.getShiftPos();if(t&&!t.isEmpty){var a=this.commonService.getMousePos(e);a.x-=n.x;a.y-=n.y;var c="group"==t.data.type?"full":null,d=this.dragDropService.getDropPos(a,i,o,c);l=this.isDropAllowed(s.source,t.data,d);var u={action:e.shiftKey?"copy":"move",source:s.source,dropPos:d,allow:l,sourceCtrl:s.sourceCtrl,target:t.data,targetCtrl:this},h=this.callDragDropEvent(e,u);if(!l||1==h.cancel){this.ctrlCursor="no-drop";this.dropMark(e,!0);this.targetDropPos=-1;this.updateScrollRowListDragOver(t.data);this.updateDragHandlePos(e)}else{this.isDragHandleVisible=!0;this.dragRowList=s.handle;this.targetDropPos=d;this.updateScrollRowListDragOver(t.data);var p=this.getObjFromRow(t.data);this.dragObjIndent=p.indent;if(t.data[this.options.rowFields.rows]&&t.data[this.options.rowFields.rows].length>0)this.dragObjIndent+=this.options.indent;this.updateDragHandlePos(e);this.dragDropService.setData({action:e.shiftKey?"copy":"move",clone:s.clone,handle:s.handle,source:s.source,sourceCtrl:s.sourceCtrl,sourceData:s.sourceData,target:t.data,targetCtrl:this,dropPos:d})}}else if(!this.options.allowDrop){this.ctrlCursor="no-drop";this.dropMark(e)}else{this.dragRowList=s.handle;this.scrollRowList.length>0&&this.scrollRowList[this.scrollRowList.length-1].data;this.updateDragHandlePos(e)}}};t.prototype.processDragOverPopup=function(e,t,i,o,r){e.preventDefault();this.processDragEnter(e);var l=!0;if(e.dataTransfer)l="none"===e.dataTransfer.effectAllowed?!1:!0;else if(e.originalEvent&&e.originalEvent.dataTransfer)l="none"===e.originalEvent.dataTransfer.effectAllowed?!1:!0;if(l){var s=this.dragDropService.getData(),n=this.commonService.getShiftPos();if(t&&!t.isEmpty){(f=this.commonService.getMousePos(e)).x-=n.x;f.y-=n.y;var a="group"==t.data.type?"full":null,c=this.dragDropService.getDropPos(f,i,o,a);l=this.isDropAllowed(s.source,t.data,c);var d={action:e.shiftKey?"copy":"move",source:s.source,dropPos:c,allow:l,sourceCtrl:s.sourceCtrl,target:t.data,targetCtrl:this},u=this.callDragDropEvent(e,d);if(!l||1==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{var h=this.commonService.getMousePos(e),p=h.y+16,g=h.x+20,m="iui-dragwin-icon";switch(u.dropPos){case 0:m+=" iui-dragwin-move-in";break;case 1:m+=" iui-dragwin-move-up";break;case 2:m+=" iui-dragwin-move-down"}if("copy"==u.action)m+="-copy";this.updateDragComponent({class:m,top:p,left:g,text:t.data[this.options.rowFields.text]});this.dropMark(e,l);this.dragDropService.setData({action:u.action,clone:s.clone,dropPos:u.dropPos,source:s.source,sourceCtrl:s.sourceCtrl,sourceData:s.sourceData,target:t.data,targetCtrl:this})}}else if(!this.options.allowDrop){if(e.dataTransfer)e.dataTransfer.dropEffect="none";else if(e.originalEvent&&e.originalEvent.dataTransfer)e.originalEvent.dataTransfer.dropEffect="none";this.dropMark(e)}else{l=this.checkEmptySpace(e);d={action:e.shiftKey?"copy":"move",allow:l,dropPos:-1,source:s.source,sourceCtrl:s.sourceCtrl,target:null,targetCtrl:this},u=this.callDragDropEvent(e,d);if(!l||1==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{var f;p=(f=this.commonService.getMousePos(e)).y+16,g=f.x+20,m="iui-dragwin-icon iui-dragwin-move-end";if("copy"==u.action)m+="-copy";this.updateDragComponent({class:m,top:p,left:g,text:this.name?this.name:"Component"});this.dropMark(e,l&&!this.isScrollTimerActive);this.dragDropService.setData({action:u.action,clone:s.clone,source:s.source,sourceCtrl:s.sourceCtrl,sourceData:s.sourceData,target:null,targetCtrl:this,dropPos:-1})}}}};t.prototype.processDragDrop=function(e,t){e.preventDefault();var 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;var o=this.dragDropService.getData();if(i){if(t&&!t.isEmpty)i=this.isDropAllowed(o.source,t.data,o.dropPos);else i=this.checkEmptySpace(e);if(i&&o.source){var r={action:o.action,source:o.source,dropPos:o.dropPos,allow:i,sourceCtrl:o.sourceCtrl,target:o.target,targetCtrl:this},l=this.callDragDropEvent(e,r,!0);this.dragDropService.setData({action:l.action,clone:o.clone,dropPos:l.dropPos,source:o.source,sourceCtrl:o.sourceCtrl,sourceData:o.sourceData,target:o.target,targetCtrl:this});if(!l.cancel)this.drop(e,this.dragDropService.getData());else i=!1}if(o.sourceCtrl&&o.sourceCtrl.removeDropMark)o.sourceCtrl.removeDropMark()}if(i)this.dragDropService.clearData();else if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle)this.updateLayout();var s=this,n=setTimeout(function(){s.dropMark(e);if(i){var t=s.dragDropService.getData(),o={action:t.action,dragRow:t.source,dropPos:t.dropPos,event:e,isDropAllowed:!0,mousePos:s.commonService.getMousePos(e),sourceCtrl:t.sourceCtrl,targetCtrl:s,targetRow:t.target};s.dragDropComplete.emit(o)}s.isDragActive=!1;s.clearDragDropSettings();clearTimeout(n)},150)};t.prototype.clearDragDropSettings=function(){this.dragDropService.clearData();this.isDragActive=!1;this.isDragHandleVisible=!1;this.dragStartPos={x:0,y:0};this.dragEndPos={x:0,y:0};this.changeCursor()};t.prototype.drop=function(e,t){if(t&&t.sourceCtrl){var i="copy"==t.action&&t.clone?t.clone:t.source;if(Array.isArray(i)){for(var o=[],r=0;r<i.length;r++)o.push(i[r]);if(o.length>0){for(r=0;r<o.length;r++)this.processDataDrop(e,o[r],t);this.clearPrevSelection()}}else{this.processDataDrop(e,i,t);this.clearPrevSelection()}if(t.sourceCtrl!=t.targetCtrl&&t.sourceCtrl.updateLayout)t.sourceCtrl.updateLayout();this.updateLayout()}this.isCtrlDragEntered=!1};t.prototype.processDataDrop=function(e,t,i){var o="copy"==i.action;if("copy"!=i.action&&i.sourceCtrl&&i.sourceCtrl.removeRow)o=i.sourceCtrl.removeRow(t);if(o)switch(i.dropPos){case 0:if(this.dragMode==integralui_core_1.IntegralUIDragDropDisplayMode.Handle)this.insertRowAt(t,0,i.target);else this.insertRowAt(t,-1,i.target);break;case 1:this.insertRowBefore(t,i.target);break;case 2:this.insertRowAfter(t,i.target);break;default:this.addRow(t)}};t.prototype.callAfterSelectEvent=function(e){var t={obj:e};this.afterSelect.emit(t);this.selectionChanged.emit(null)};t.prototype.rowDragEnd=function(e,t){var i=this.dragDropService.getData(),o={action:e.shiftKey?"copy":"move",dragRow:i.source,dropPos:i.dropPos,event:e,mousePos:this.commonService.getMousePos(e),sourceCtrl:i.sourceCtrl,targetCtrl:this,targetRow:i.target};this.dragEnd.emit(o)};t.prototype.getEmptyObj=function(e){for(var t=null,i=0;i<this.scrollRowList.length;i++)if(this.scrollRowList[i].status==e){t=this.scrollRowList[i];break}return t};t.prototype.removeEmptyRow=function(e){var t=this.getEmptyObj(e);if(t){var i=this.scrollRowList.indexOf(t);if(i>=0)this.scrollRowList.splice(i,1)}};t.prototype.updateDragHandlePos=function(e){};t.prototype.updateScrollRowListDragOver=function(e){};t.prototype.addCalendar=function(){var e=this;if(e.appRef&&e.isEditorPresent(integralui_core_1.IntegralUIEditorType.Date)&&!e.calendarRef){e.removeCalendar();var t=e.cmpResolver.resolveComponentFactory(integralui_datepicker_1.IntegralUICalendarPopup);if(t){e.calendarRef=e.appRef.createComponent(t);if(e.calendarRef.instance)e.calendar=e.calendarRef.instance;e.hideCalendar();if(e.calendar){e.calendar.closed.subscribe(function(t){e.hideCalendar()});e.calendar.dateChanged.subscribe(function(t){e.hideCalendar();if(e.currentEditorCell&&1!=e.callCellValueChanging(e.currentEditorCell,t.date)){e.currentEditorCell.data[e.options.cellFields.value]=t.date;e.updateScrollRowList();e.callCellValueChanged(e.currentEditorCell)}e.isPopupDelayed=!0;setTimeout(function(){e.isPopupDelayed=!1},250)})}}}};t.prototype.addColorPopup=function(){var e=this;if(e.appRef&&e.isEditorPresent(integralui_core_1.IntegralUIEditorType.Color)&&!e.colorPopupRef){e.removeColorPopup();var t=e.cmpResolver.resolveComponentFactory(integralui_colorpicker_1.IntegralUIColorPickerPopup);if(t){e.colorPopupRef=e.appRef.createComponent(t);if(e.colorPopupRef.instance)e.colorPopup=e.colorPopupRef.instance;e.hideColorPopup();if(e.colorPopup)e.colorPopup.closed.subscribe(function(t){e.hideColorPopup();if(e.currentEditorCell&&1!=e.callCellValueChanging(e.currentEditorCell,t.value)){e.currentEditorCell.data[e.options.cellFields.value]=t.value;e.updateScrollRowList();e.callCellValueChanged(e.currentEditorCell)}e.isPopupDelayed=!0;setTimeout(function(){e.isPopupDelayed=!1},250)})}}};t.prototype.addDropList=function(){var e=this;if(e.appRef&&e.isEditorPresent(integralui_core_1.IntegralUIEditorType.DropList)&&!e.dropListRef){e.removeDropList();var t=e.cmpResolver.resolveComponentFactory(integralui_core_1.IntegralUIListPopup);if(t){e.dropListRef=e.appRef.createComponent(t);if(e.dropListRef.instance)e.dropList=e.dropListRef.instance;e.hideDropList();if(e.dropList){e.dropList.closed.subscribe(function(t){e.hideDropList()});e.dropList.selectionChanged.subscribe(function(t){e.hideDropList();if(t.item&&e.currentEditorCell&&1!=e.callCellValueChanging(e.currentEditorCell,t.item.value)){e.currentEditorCell.data[e.options