/*
*
* Wijmo Library 5.20183.567
* http://wijmo.com/
*
* Copyright(c) GrapeCity, Inc. All rights reserved.
*
* Licensed under the GrapeCity Commercial License.
* sales@wijmo.com
* wijmo.com/products/wijmo-5/license/
*
*/
function tryGetModuleWijmoGridDetail(){let e,t;return(e=__glob.wijmo)&&(t=e.grid)&&t.detail}function tryGetModuleWijmoInput(){let e;return(e=__glob.wijmo)&&e.input}import*as wjcGrid from"wijmo/wijmo.grid";import*as wjcCore from"wijmo/wijmo";var __glob="undefined"!=typeof window?window:self;import{Component,NgModule}from"@angular/core";import{ElementRef,Injector,Directive,ViewContainerRef,TemplateRef,Optional,forwardRef,Renderer}from"@angular/core";import{Inject,ChangeDetectorRef,SkipSelf}from"@angular/core";import{CommonModule}from"@angular/common";import{NG_VALUE_ACCESSOR}from"@angular/forms";import{WjDirectiveBehavior,WjDirectiveBaseModule,WjValueAccessorFactory}from"wijmo/wijmo.angular2.directiveBase";export var wjFlexGridMeta={selector:"wj-flex-grid",template:`
`,inputs:["wjModelProperty","isDisabled","newRowAtTop","allowAddNew","allowDelete","allowDragging","allowMerging","allowResizing","allowSorting","quickAutoSize","autoScroll","autoSearch","autoSizeMode","autoGenerateColumns","childItemsPath","groupHeaderFormat","headersVisibility","showSelectedHeaders","showMarquee","itemFormatter","isReadOnly","imeEnabled","mergeManager","selectionMode","showGroups","showSort","showDropDown","showAlternatingRows","showErrors","validateEdits","treeIndent","itemsSource","autoClipboard","frozenRows","frozenColumns","cloneFrozenCells","deferResizing","sortRowIndex","stickyHeaders","preserveSelectedState","preserveOutlineState","keyActionTab","keyActionEnter","rowHeaderPath","virtualizationThreshold"],outputs:["initialized","gotFocusNg: gotFocus","lostFocusNg: lostFocus","beginningEditNg: beginningEdit","cellEditEndedNg: cellEditEnded","cellEditEndingNg: cellEditEnding","prepareCellForEditNg: prepareCellForEdit","formatItemNg: formatItem","resizingColumnNg: resizingColumn","resizedColumnNg: resizedColumn","autoSizingColumnNg: autoSizingColumn","autoSizedColumnNg: autoSizedColumn","draggingColumnNg: draggingColumn","draggingColumnOverNg: draggingColumnOver","draggedColumnNg: draggedColumn","sortingColumnNg: sortingColumn","sortedColumnNg: sortedColumn","resizingRowNg: resizingRow","resizedRowNg: resizedRow","autoSizingRowNg: autoSizingRow","autoSizedRowNg: autoSizedRow","draggingRowNg: draggingRow","draggingRowOverNg: draggingRowOver","draggedRowNg: draggedRow","deletingRowNg: deletingRow","deletedRowNg: deletedRow","loadingRowsNg: loadingRows","loadedRowsNg: loadedRows","rowEditStartingNg: rowEditStarting","rowEditStartedNg: rowEditStarted","rowEditEndingNg: rowEditEnding","rowEditEndedNg: rowEditEnded","rowAddedNg: rowAdded","groupCollapsedChangedNg: groupCollapsedChanged","groupCollapsedChangingNg: groupCollapsedChanging","itemsSourceChangingNg: itemsSourceChanging","itemsSourceChangedNg: itemsSourceChanged","selectionChangingNg: selectionChanging","selectionChangedNg: selectionChanged","scrollPositionChangedNg: scrollPositionChanged","updatingViewNg: updatingView","updatedViewNg: updatedView","updatingLayoutNg: updatingLayout","updatedLayoutNg: updatedLayout","pastingNg: pasting","pastedNg: pasted","pastingCellNg: pastingCell","pastedCellNg: pastedCell","copyingNg: copying","copiedNg: copied"],providers:[{provide:NG_VALUE_ACCESSOR,useFactory:WjValueAccessorFactory,multi:!0,deps:["WjComponent"]}]};export class WjFlexGrid extends wjcGrid.FlexGrid{constructor(e,t,l,i){super(WjDirectiveBehavior.getHostElement(e,t)),this.isInitialized=!1;this._wjBehaviour=WjDirectiveBehavior.attach(this,e,t,l);new DirectiveCellFactory(this,i),this.deferUpdate(()=>{if(this.rows.defaultSize<10){let e=this.hostElement,t=getComputedStyle(e),l=getComputedStyle(document.body),i=2*parseInt(t.fontSize&&wjcCore.contains(document.body,e)?t.fontSize:l.fontSize);this.rows.defaultSize=i,this.columns.defaultSize=4*i,this.columnHeaders.rows.defaultSize=i,this.rowHeaders.columns.defaultSize=Math.round(1.25*i)}}),this.created()}created(){}ngOnInit(){this._wjBehaviour.ngOnInit()}ngAfterViewInit(){this._wjBehaviour.ngAfterViewInit()}ngOnDestroy(){this._wjBehaviour.ngOnDestroy()}addEventListener(e,t,l,i=!1){let o=WjDirectiveBehavior,r=o.ngZone;r&&o.outsideZoneEvents[t]?r.runOutsideAngular(()=>{super.addEventListener(e,t,l,i)}):super.addEventListener(e,t,l,i)}startEditing(e=!0,t,l,i){this._edtFocus=null;let o=super.startEditing(e,t,l,i);return o&&(this._edtFocus=i||null==i),o}onCellEditEnding(e){return this._edtFocus=null,super.onCellEditEnding(e)}};WjFlexGrid.meta={outputs:wjFlexGridMeta.outputs},WjFlexGrid.decorators=[{type:Component,args:[{selector:wjFlexGridMeta.selector,template:wjFlexGridMeta.template,inputs:wjFlexGridMeta.inputs,outputs:wjFlexGridMeta.outputs,providers:[{provide:"WjComponent",useExisting:forwardRef(()=>WjFlexGrid)},...wjFlexGridMeta.providers]}]}],WjFlexGrid.ctorParameters=(()=>[{type:ElementRef,decorators:[{type:Inject,args:[ElementRef]}]},{type:Injector,decorators:[{type:Inject,args:[Injector]}]},{type:void 0,decorators:[{type:Inject,args:["WjComponent"]},{type:SkipSelf},{type:Optional}]},{type:ChangeDetectorRef,decorators:[{type:Inject,args:[ChangeDetectorRef]}]}]);export var wjFlexGridColumnMeta={selector:"wj-flex-grid-column",template:`
`,inputs:["asyncBindings","wjProperty","name","dataMap","dataType","binding","sortMemberPath","format","header","width","maxLength","minWidth","maxWidth","align","allowDragging","allowSorting","allowResizing","allowMerging","aggregate","isReadOnly","cssClass","isContentHtml","isSelected","visible","wordWrap","multiLine","mask","inputType","isRequired","showDropDown","dropDownCssClass","quickAutoSize"],outputs:["initialized","isSelectedChangePC: isSelectedChange"],providers:[]};export class WjFlexGridColumn extends wjcGrid.Column{constructor(e,t,l){super(),this.isInitialized=!1,this.wjProperty="columns";let i=(this._wjBehaviour=WjDirectiveBehavior.attach(this,e,t,l)).parentBehavior.directive;i.autoGenerateColumns&&(i.autoGenerateColumns=!1,i.columns.clear()),this.created()}created(){}ngOnInit(){this._wjBehaviour.ngOnInit()}ngAfterViewInit(){this._wjBehaviour.ngAfterViewInit()}ngOnDestroy(){this._wjBehaviour.ngOnDestroy()}};WjFlexGridColumn.meta={outputs:wjFlexGridColumnMeta.outputs,changeEvents:{"grid.selectionChanged":["isSelected"]}},WjFlexGridColumn.decorators=[{type:Component,args:[{selector:wjFlexGridColumnMeta.selector,template:wjFlexGridColumnMeta.template,inputs:wjFlexGridColumnMeta.inputs,outputs:wjFlexGridColumnMeta.outputs,providers:[{provide:"WjComponent",useExisting:forwardRef(()=>WjFlexGridColumn)},...wjFlexGridColumnMeta.providers]}]}],WjFlexGridColumn.ctorParameters=(()=>[{type:ElementRef,decorators:[{type:Inject,args:[ElementRef]}]},{type:Injector,decorators:[{type:Inject,args:[Injector]}]},{type:void 0,decorators:[{type:Inject,args:["WjComponent"]},{type:SkipSelf},{type:Optional}]}]);export class WjFlexGridCellTemplate{constructor(e,t,l,i,o,r,n){this.viewContainerRef=e,this.templateRef=t,this.elRef=l,this.domRenderer=o,this.cdRef=n,this.autoSizeRows=!0,this.forceFullEdit=!0,i instanceof WjFlexGrid?this.grid=i:i instanceof WjFlexGridColumn&&(this.column=i,this.grid=WjDirectiveBehavior.getBehavior(i).parentBehavior.directive)}static _getTemplContextProp(e){return"$__cellTempl"+CellTemplateType[e]}ngOnInit(){this.ownerControl=this.column&&this.column.grid===this.grid?this.column:this.grid,this._attachToControl()}ngOnDestroy(){this.cellTypeStr&&(this.viewContainerRef.clear(),this.ownerControl[WjFlexGridCellTemplate._getTemplContextProp(this.cellType)]=null,this.grid.invalidate())}_instantiateTemplate(e,t){return WjDirectiveBehavior.instantiateTemplate(e,this.viewContainerRef,this.templateRef,this.domRenderer,!1,t)}_attachToControl(){if(!this.cellTypeStr)return;let e=this.cellType=wjcCore.asEnum(this.cellTypeStr,CellTemplateType),t=this.ownerControl;t[WjFlexGridCellTemplate._getTemplContextProp(e)]=this,t instanceof wjcGrid.Column&&(e===CellTemplateType.Cell||e===CellTemplateType.ColumnHeader||e===CellTemplateType.ColumnFooter)&&t._setFlag(wjcGrid.RowColFlags.HasTemplate,!0),this.grid.invalidate()}};WjFlexGridCellTemplate.decorators=[{type:Directive,args:[{selector:"[wjFlexGridCellTemplate]",inputs:["wjFlexGridCellTemplate","cellTypeStr: cellType","cellOverflow","valuePaths","autoSizeRows","forceFullEdit"],exportAs:"wjFlexGridCellTemplate",providers:[{provide:"WjComponent",useExisting:forwardRef(()=>WjFlexGridCellTemplate)}]}]}],WjFlexGridCellTemplate.ctorParameters=(()=>[{type:ViewContainerRef,decorators:[{type:Inject,args:[ViewContainerRef]}]},{type:TemplateRef,decorators:[{type:Inject,args:[TemplateRef]},{type:Optional}]},{type:ElementRef,decorators:[{type:Inject,args:[ElementRef]}]},{type:void 0,decorators:[{type:Inject,args:["WjComponent"]},{type:SkipSelf},{type:Optional}]},{type:Renderer,decorators:[{type:Inject,args:[Renderer]}]},{type:Injector,decorators:[{type:Inject,args:[Injector]}]},{type:ChangeDetectorRef,decorators:[{type:Inject,args:[ChangeDetectorRef]}]}]);export var CellTemplateType;!function(e){e[e.Cell=0]="Cell",e[e.CellEdit=1]="CellEdit",e[e.ColumnHeader=2]="ColumnHeader",e[e.RowHeader=3]="RowHeader",e[e.RowHeaderEdit=4]="RowHeaderEdit",e[e.TopLeft=5]="TopLeft",e[e.GroupHeader=6]="GroupHeader",e[e.Group=7]="Group",e[e.NewCellTemplate=8]="NewCellTemplate",e[e.ColumnFooter=9]="ColumnFooter",e[e.BottomLeft=10]="BottomLeft"}(CellTemplateType||(CellTemplateType={}));class DirectiveCellFactory extends wjcGrid.CellFactory{constructor(e,t){if(super(),this._needsCdCheck=!1,this._lastApplyTimeStamp=0,this._noApplyLag=!1,this._startingEditing=!1,this._cellStampCounter=0,this._composing=!1,this.grid=e,this._gridCdRef=t,!DirectiveCellFactory._templateTypes){DirectiveCellFactory._templateTypes=[];for(var l in CellTemplateType)isNaN(l)&&DirectiveCellFactory._templateTypes.push(l)}var i=this;this._baseCf=e.cellFactory,e.cellFactory=this,this._evtInput=document.createEvent("HTMLEvents"),this._evtInput.initEvent("input",!0,!1),this._evtBlur=document.createEvent("HTMLEvents"),this._evtBlur.initEvent("blur",!1,!1),e.prepareCellForEdit.addHandler(function(e,t){i._noApplyLag=!0}),e.cellEditEnded.addHandler(function(t,l){(l.range.col<0||l.range.col32?String.fromCharCode(t.charCode):null;l&&wjcCore.closest(t.target,".wj-flexgrid")===e.hostElement&&(!e.activeEditor||i._startingEditing?(i._editChar=l,setTimeout(()=>{e.activeEditor||(i._editChar=null)},0)):i._editChar&&(i._editChar+=l))},!0),e.hostElement.addEventListener("compositionstart",function(e){i._composing=!0},!0),e.hostElement.addEventListener("compositionend",function(e){i._composing=!1},!0),e.updatedView.addHandler(()=>{this._needsCdCheck&&(this._needsCdCheck=!1,this._gridCdRef.markForCheck())},this)}updateCell(e,t,l,i,o){this._cellStampCounter=(this._cellStampCounter+1)%1e7;let r=i[DirectiveCellFactory._cellStampProp]=this._cellStampCounter;i.style.overflow&&(i.style.overflow="");let n=t,a=l;o&&!o.isSingleCell&&(t=o.row,l=o.col);let d,s=this,p=e.grid,c=p.editRange,u=e.rows[t],g=u.dataItem,m=!1,C=!1,w=!1,h=!1;switch(e.cellType){case wjcGrid.CellType.Cell:if(c&&c.row===t&&c.col===l)d=CellTemplateType.CellEdit,C=w=!0;else if(u instanceof wjcGrid.GroupRow){var f=!((h=g instanceof wjcCore.CollectionViewGroup)||u.hasChildren);l==e.columns.firstVisibleIndex?d=f?CellTemplateType.Cell:CellTemplateType.GroupHeader:(d=f?CellTemplateType.Cell:CellTemplateType.Group,C=!0)}else u instanceof wjcGrid._NewRowTemplate?d=CellTemplateType.NewCellTemplate:tryGetModuleWijmoGridDetail()&&tryGetModuleWijmoGridDetail().DetailRow&&u instanceof tryGetModuleWijmoGridDetail().DetailRow||(d=CellTemplateType.Cell);break;case wjcGrid.CellType.ColumnHeader:d=CellTemplateType.ColumnHeader;break;case wjcGrid.CellType.RowHeader:d=p.collectionView&&p.collectionView.currentEditItem===g?CellTemplateType.RowHeaderEdit:CellTemplateType.RowHeader,m=!0;break;case wjcGrid.CellType.TopLeft:d=CellTemplateType.TopLeft,m=!0;break;case wjcGrid.CellType.ColumnFooter:d=CellTemplateType.ColumnFooter,C=!0;break;case wjcGrid.CellType.BottomLeft:d=CellTemplateType.BottomLeft,m=!0}var v=!1;if(null!=d){var y=h&&d==CellTemplateType.GroupHeader?p.columns.getColumn(g.groupDescription.propertyName):l>=0&&l{if(r===i[DirectiveCellFactory._cellStampProp]){var l=i.scrollHeight,n=e.rows,a=o&&o.rowSpan||1;if(t{h?this._initImeEditInput(m,j):this._initEditInput(m,j,null)},0),w){s._cellEditorVars=c.localVars;var R=function(e,t){if(p.cellEditEnding.removeHandler(R),!t.stayInEditMode){let e=wjcCore.getActiveElement();e&&e.dispatchEvent(s._evtBlur),wjcCore.contains(i,wjcCore.getActiveElement())&&i.focus()}if(s._triggerEditorEvents(i),!t.cancel&&!t.stayInEditMode){let e=c.localVars,t=Object.getOwnPropertyNames(c.bindings);for(let l of t)c.bindings[l].setValue(e,c.localVars.values[l])}var l=i.querySelectorAll(".wj-dropdown");[].forEach.call(l,function(e){var t=wjcCore.Control.getControl(e);t&&tryGetModuleWijmoInput()&&t instanceof tryGetModuleWijmoInput().DropDown&&(t.isDroppedDown=!1)})};let e=function(t,l){p.cellEditEnded.removeHandler(e),s._cellEditorVars=null};p.cellEditEnding.addHandler(R),p.cellEditEnded.addHandler(e)}else this._baseCf.updateCell(e,n,a,i,o,!1)}}}}v||(this._doDisposeCell(i),this._baseCf.updateCell(e,n,a,i,o))}getEditorValue(e){if(this._cellEditorVars){let t=e.editRange;return t&&t.isValid&&this._triggerEditorEvents(e.cells.getCellElement(t.row,t.col)),this._cellEditorVars.value}return super.getEditorValue(e)}disposeCell(e){this._doDisposeCell(e)}_doDisposeCell(e){for(var t=DirectiveCellFactory._templateTypes,l=0;l-1&&t.viewContainerRef.remove(e)}o.viewRef=null,o.rootElement=null,o.column=null,o.templateContextProperty=null,e[i]=null}}}_setViewRefContext(e,t,l,i,o,r){this._needsCdCheck=!0,e.row=t,e.col=l,e.item=i;let n={},a=e.cell||{},d={},s={localVars:a,bindings:d};if(a.row=t,a.col=l,a.item=i,a.value=o,a.values=n,r){let e=Object.getOwnPropertyNames(r);for(let t of e){let e=new wjcCore.Binding(r[t]);d[t]=e,n[t]=e.getValue(a)}}return e.cell!==a&&(e.cell=a),s}_initEditInput(e,t,l){let i=!1!==this.grid._edtFocus;if(this.grid._edtFocus=null,this._setFullEdit(t),i){let t=this._findInitialInput(e);if(t){var o=()=>{t.removeEventListener("focus",o),setTimeout(()=>{let e=null!=l?l:this._editChar;e&&(t.value=e,this._editChar=null,DirectiveCellFactory._setSelectionRange(t,e.length,e.length),t.dispatchEvent(this._evtInput))},DirectiveCellFactory._FOCUS_INTERVAL)};t.addEventListener("focus",o),t.focus()}}}_initImeEditInput(e,t){let l=wjcCore.getActiveElement();if(l&&l instanceof HTMLInputElement&&wjcCore.hasClass(l,"wj-grid-ime")){let i=o=>{l.removeEventListener("compositionend",i),wjcCore.setCss(l,wjcGrid._ImeHandler._cssHidden),this._initEditInput(e,t,l.value)};l.addEventListener("compositionend",i);let o=this._findInitialInput(e);if(o){let e=o.getBoundingClientRect(),t=l.getBoundingClientRect(),i=window.getComputedStyle(l),r=parseFloat(i.left),n=parseFloat(i.top);wjcCore.setCss(l,{left:r+e.left-t.left+"px",top:n+e.top-t.top+"px",width:e.width+"px",height:e.height+"px"})}}}_findInitialInput(e){let t=e&&e.rootElement&&e.rootElement.querySelectorAll("input,textarea");if(t)for(var l=0;l[]);