@grapecity/wijmo.grid.pdf 5.20242.21 → 5.20251.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +13 -13
package/es5-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20251.34
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{asFunction,asType,CancelEventArgs,Color,isFunction,Rect,Size,isObject,assert,asInt,asString,changeType,isArray,isString,DataType,Point,_getModule,removeChild,toPlainText,clamp,EventArgs,_registerModule}from"@grapecity/wijmo";import*as pdf from"@grapecity/wijmo.pdf";import*as selfModule from"@grapecity/wijmo.grid.pdf";export function softGrid(){return _getModule("wijmo.grid")}export function softDetail(){return _getModule("wijmo.grid.detail")}export function softMultiRow(){return _getModule("wijmo.grid.multirow")}export function softSheet(){return _getModule("wijmo.grid.sheet")}export function softOlap(){return _getModule("wijmo.olap")}export function softTransposed(){return _getModule("wijmo.grid.transposed")}export function softTransposedMultiRow(){return _getModule("wijmo.grid.transposedmultirow")}export var ScaleMode;!function(e){e[e.ActualSize=0]="ActualSize";e[e.PageWidth=1]="PageWidth";e[e.SinglePage=2]="SinglePage"}(ScaleMode||(ScaleMode={}));export var ExportMode;!function(e){e[e.All=0]="All";e[e.Selection=1]="Selection"}(ExportMode||(ExportMode={}));export var _CellType;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(_CellType||(_CellType={}));export function _merge(e,t,r){void 0===r&&(r=!1);!e&&t&&(e={});if(t&&e)for(var o in t){var n=t[o],i=e[o];if(isObject(n)){if(void 0===i||!isObject(i)&&r){if(isFunction(n.clone)){e[o]=i=n.clone();continue}e[o]=i={}}isObject(i)&&_merge(e[o],n,r)}else(void 0===i||r&&void 0!==n)&&(e[o]=n)}return e}export function _combineColumns(e,t){return{aggregate:t.aggregate,binding:t.binding,name:t.name,dataType:t.dataType,wordWrap:t.wordWrap,multiLine:t.multiLine,getAlignment:function(e){if("getAlignment"in t)return t.getAlignment(e)},index:e.index,visibleIndex:e.visibleIndex,isVisible:e.isVisible,renderWidth:e.renderWidth}}export function _cloneStyle(e){if(!e)return null;for(var t={},toCamel=function(e){return e.replace(/\-([a-z])/g,(function(e,t,r){return r>0?t.toUpperCase():t}))},r=0,o=e.length;r<o;r++){var n=e[r];t[toCamel(n)]=e.getPropertyValue(n)}return t}var PdfFormatItemEventArgs=function(e){__extends(PdfFormatItemEventArgs,e);function PdfFormatItemEventArgs(t,r,o,n,i,l,s,a,d){var u=e.call(this)||this;u.cancelBorders=!1;u._p=t;u._rng=r;"undefined"!=typeof HTMLElement&&(u._cell=asType(o,HTMLElement,!0));u._canvas=n;u._clientRect=i;u._contentRect=l;u._style=s;u._getFormattedCell=a;u._getTextRect=d;return u}Object.defineProperty(PdfFormatItemEventArgs.prototype,"panel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"row",{get:function(){return this._rng.row},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"col",{get:function(){return this._rng.col},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"canvas",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"clientRect",{get:function(){return this._clientRect},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"contentRect",{get:function(){return this._contentRect},enumerable:!0,configurable:!0});PdfFormatItemEventArgs.prototype.drawBackground=function(e){var t=this.clientRect;e&&t.width>0&&t.height>0&&this.canvas.paths.rect(t.left,t.top,t.width,t.height).fill(e||this.style.backgroundColor)};PdfFormatItemEventArgs.prototype.getFormattedCell=function(){return asFunction(this._getFormattedCell)()};Object.defineProperty(PdfFormatItemEventArgs.prototype,"tagContent",{get:function(){return this._tagContent},set:function(e){this._tagContent=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"style",{get:function(){return this._style},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"textTop",{get:function(){!this._textRect&&isFunction(this._getTextRect)&&(this._textRect=this._getTextRect());return this._textRect?this._textRect.top:this._contentRect.top},enumerable:!0,configurable:!0});return PdfFormatItemEventArgs}(CancelEventArgs);export{PdfFormatItemEventArgs};var _FlexGridPdfCoreConverter=function(){function _FlexGridPdfCoreConverter(){}_FlexGridPdfCoreConverter.draw=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");null==(i=this._applyDefaultDrawSettings(i)).scaleMode&&(i.scaleMode=null==o?ScaleMode.ActualSize:null==n?ScaleMode.PageWidth:ScaleMode.SinglePage);this._drawInternal(e,t,r,o,n,i)};_FlexGridPdfCoreConverter._applyDefaultDrawSettings=function(e){return _merge(_merge({},e),_FlexGridPdfCoreConverter.DefaultDrawSettings)};_FlexGridPdfCoreConverter._drawInternal=function(e,t,r,o,n,i){var l=null!=r,s=new Size(t.width,t.height);r||(r=new Point(0,t.y));isArray(i.embeddedFonts)&&i.embeddedFonts.forEach((function(e){t.registerFont(e)}));var a=this._getRowsToRender(e,i),d=new FlexGridRenderer(e,i,a,this.BorderWidth,!0),u=new Rect(r.x||0,r.y||0,o||s.width,n||s.height),p=this._getScaleFactor(d,i.scaleMode,u);if(r.y>0&&this._canBreakRows(i.scaleMode)){var c=a.find(e.cells,(function(e){return d.isRenderableRow(e)}));if(c){var f=(u.height-u.top)*(1/p);if((d.showColumnHeader?pdf.pxToPt(e.columnHeaders.height):0)+pdf.pxToPt(c.renderHeight)-this.BorderWidth>f){t.addPage();u=new Rect(r.x||0,0,o||s.width,n||s.height)}}}var h=this._getPages(d,a,u,i,l,p),g=(i.progress?this._getCellsCount(e,i,h):0)/i._progressMax,_=0,w=0,C=i.progress?function(){if(++_-w>=50){w=_;i.progress(_/g)}}:null;i.progress&&i.progress(0);for(var m=0;m<h.length;m++){m>0&&t.addPage();var b=h[m],R=0===b.pageCol?u.left:0,y=0===b.pageRow?u.top:0;t.saveState();t.paths.rect(0,0,t._widthCtm,t._heightCtm).clip();t.scale(p,p,new Point(R,y));t.translate(R,y);var x=new FlexGridRenderer(e,i,b.range,this.BorderWidth,m===h.length-1);x.render(t,C);t.restoreState();t.x=R;t.y=y+x.renderSize.height*p}i.progress&&0<i._progressMax&&i.progress(i._progressMax)};_FlexGridPdfCoreConverter._getCellsCount=function(e,t,r){for(var o=0,n=0;n<r.length;n++){o+=new FlexGridRenderer(e,t,r[n].range,0,!1).getCellsCount()}return o};_FlexGridPdfCoreConverter._getRowsToRender=function(e,t){var r=[];t.exportMode==ExportMode.All?r.push(new _CellRange(0,0,e.rows.length-1,e.columns.length-1)):r=e.getSelection();var o=new RowRange(r);if(o.isValid&&!t.drawDetailRows){var n=[];o.forEach(e.cells,(function(t,r,o){if(!e.isDetailRow(t)){var i=n.length;i&&n[i-1].bottomRow+1===o?n[i-1].row2++:n.push(new _CellRange(o,r.col,o,r.col2))}}));o=new RowRange(n)}return o};_FlexGridPdfCoreConverter._getScaleFactor=function(e,t,r){var o=1;if(t==ScaleMode.ActualSize)return o;var n=e.renderSize;if(t==ScaleMode.SinglePage){(i=Math.min(r.width/n.width,r.height/n.height))<1&&(o=i)}else{var i;(i=r.width/n.width)<1&&(o=i)}return o};_FlexGridPdfCoreConverter._canBreakRows=function(e){return e==ScaleMode.ActualSize||e==ScaleMode.PageWidth};_FlexGridPdfCoreConverter._getPages=function(e,t,r,o,n,i){var l=this,s=[],a=[],d=pdf.pxToPt,u=e.flex,p=e.showColumnHeader,c=e.showColumnFooter,f=e.showRowHeader,h=p?d(u.columnHeaders.height):0,g=c?d(u.columnFooters.height):0,_=f?d(u.rowHeaders.width):0,w=this._canBreakRows(o.scaleMode),C=o.scaleMode==ScaleMode.ActualSize,m=(r.width-r.left)*(1/i),b=(r.height-r.top)*(1/i),R=r.width*(1/i),y=r.height*(1/i),x=h,v=_,P=n&&o.scaleMode==ScaleMode.ActualSize,S=b;if(w){var T=0,G=0;t.forEach(u.cells,(function(t,r,o,n){S=s.length?y:b;if(e.isRenderableRow(t)){var i=d(t.renderHeight)+1;T++;x+=i;(p||T>1)&&(x-=l.BorderWidth);if(x>S){if(P||h+i>S&&0===G){s.push(n);x=h}else{s.push(n-1);x=h+i}G=0;p&&(x-=l.BorderWidth)}else G++}}))}var F=Math.max(t.length()-1,0);s.length&&s[s.length-1]===F||s.push(F);c&&x+g>S&&s.push(-1);if(C)for(var A=0,M=t.leftCol;M<=t.rightCol;M++){var W=u.columns[M];if(e.isRenderableColumn(W)){var J=d(W.renderWidth),E=a.length?R:m;A++;v+=J;(f||A>1)&&(v-=this.BorderWidth);if(v>E){if(_+J>E||P){a.push(M);v=_}else{a.push(M-1);v=_+J}f&&(v-=this.BorderWidth)}}}a.length&&a[a.length-1]===t.rightCol||a.push(t.rightCol);var H=[],z=!1,O=1,L=n&&o.maxPages>0?1:o.maxPages;for(M=0;M<s.length&&!z;M++)for(var j=0;j<a.length&&!z;j++,O++)if(!(z=O>L)){var D=0===M?0:s[M-1]+1,k=0===j?t.leftCol:a[j-1]+1,B=-1===s[M]?new RowRange([new _CellRange(-1,k,-1,a[j])]):t.subrange(D,s[M]-D+1,k,a[j]);H.push(new PdfPageRowRange(B,j,M))}return H};_FlexGridPdfCoreConverter.BorderWidth=1;_FlexGridPdfCoreConverter.DefFont=new pdf.PdfFont;_FlexGridPdfCoreConverter.DefaultDrawSettings={customCellContent:!1,drawDetailRows:!1,exportMode:ExportMode.All,maxPages:Number.MAX_VALUE,repeatMergedValuesAcrossPages:!0,recalculateStarWidths:!0,styles:{cellStyle:{font:{family:_FlexGridPdfCoreConverter.DefFont.family,size:_FlexGridPdfCoreConverter.DefFont.size,style:_FlexGridPdfCoreConverter.DefFont.style,weight:_FlexGridPdfCoreConverter.DefFont.weight},padding:1.5,verticalAlign:"middle"},headerCellStyle:{font:{weight:"bold"}}},quickCellStyles:!0,_progressMax:1};return _FlexGridPdfCoreConverter}();export{_FlexGridPdfCoreConverter};var FlexGridRenderer=function(){function FlexGridRenderer(e,t,r,o,n){this._flex=e;this._borderWidth=o;this._lastPage=n;this._settings=t||{};this._topLeft=new PanelSectionRenderer(this,e.topLeftCells,this.showRowHeader&&this.showColumnHeader?new RowRange([new _CellRange(0,0,e.topLeftCells.rows.length-1,e.topLeftCells.columns.length-1)]):new RowRange([]),o);this._rowHeader=new PanelSectionRenderer(this,e.rowHeaders,this.showRowHeader?r.clone(0,e.rowHeaders.columns.length-1):new RowRange([]),o);this._columnHeader=new PanelSectionRenderer(this,e.columnHeaders,this.showColumnHeader?new RowRange([new _CellRange(0,r.leftCol,e.columnHeaders.rows.length-1,r.rightCol)]):new RowRange([]),o);this._cells=new PanelSectionRenderer(this,e.cells,r,o);this._bottomLeft=new PanelSectionRenderer(this,e.bottomLeftCells,this.showRowHeader&&this.showColumnFooter?new RowRange([new _CellRange(0,0,e.bottomLeftCells.rows.length-1,e.bottomLeftCells.columns.length-1)]):new RowRange([]),o);this._columnFooter=new PanelSectionRenderer(this,e.columnFooters,this.showColumnFooter?new RowRange([new _CellRange(0,r.leftCol,e.columnFooters.rows.length-1,r.rightCol)]):new RowRange([]),o)}Object.defineProperty(FlexGridRenderer.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.isRenderableRow=function(e){return this._flex.isRenderableRow(e)};FlexGridRenderer.prototype.isRenderableColumn=function(e){return this._flex.isRenderableColumn(e)};FlexGridRenderer.prototype.getCellsCount=function(){return this._topLeft.getCellsCount()+this._rowHeader.getCellsCount()+this._columnHeader.getCellsCount()+this._cells.getCellsCount()+this._bottomLeft.getCellsCount()+this._columnFooter.getCellsCount()};FlexGridRenderer.prototype.render=function(e,t){var r,o,n,i;if(e.tagged){r=o=n=i=new TrStructCache(e,e.tag(pdf.PdfTagType.Table));e.addTag(r.el);if(e.version>=pdf.PdfVersion.v1_5){r.el.add((o=new TrStructCache(e,e.tag(pdf.PdfTagType.THead))).el);r.el.add((n=new TrStructCache(e,e.tag(pdf.PdfTagType.TBody))).el);r.el.add((i=new TrStructCache(e,e.tag(pdf.PdfTagType.TFoot))).el)}}var l=Math.max(0,Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)-this._borderWidth),s=Math.max(0,Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)-this._borderWidth);this._topLeft.render(e,0,0,t,o);this._rowHeader.render(e,0,s,t,n);this._columnHeader.render(e,l,0,t,o);this._cells.render(e,l,s,t,n);s+=Math.max(0,this._cells.renderSize.height-this._borderWidth);this._bottomLeft.render(e,0,s,t,i);this._columnFooter.render(e,l,s,t,i)};Object.defineProperty(FlexGridRenderer.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"renderSize",{get:function(){var e=Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)+Math.max(this._rowHeader.renderSize.height,this._cells.renderSize.height)+Math.max(this._bottomLeft.renderSize.height,this._columnFooter.renderSize.height),t=Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)+Math.max(this._columnHeader.renderSize.width,this._cells.renderSize.width);this._columnHeader.renderableRowsCount>0&&(e-=this._borderWidth);this._columnFooter.renderableRowsCount>0&&(e-=this._borderWidth);this._rowHeader.renderableColumnsCount>0&&(t-=this._borderWidth);return new Size(t,e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnHeader",{get:function(){return this._flex.showColumnHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showRowHeader",{get:function(){return this._flex.showRowHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnFooter",{get:function(){return this._lastPage&&this._flex.showColumnFooter},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.alignMergedTextToTheTopRow=function(e){return this._flex.alignMergedTextToTheTopRow(e)};FlexGridRenderer.prototype.getColumn=function(e,t,r){return this._flex.getColumn(e,t,r)};FlexGridRenderer.prototype.isAlternatingRow=function(e){return this._flex.isAlternatingRow(e)};FlexGridRenderer.prototype.isGroupRow=function(e){return this._flex.isGroupRow(e)};FlexGridRenderer.prototype.isNewRow=function(e){return this._flex.isNewRow(e)};FlexGridRenderer.prototype.isExpandableGroupRow=function(e){return this._flex.isExpandableGroupRow(e)};FlexGridRenderer.prototype.isBooleanCell=function(e,t,r){return this._flex.isBooleanCell(e,t,r)};FlexGridRenderer.prototype.getCellStyle=function(e,t,r){return this._flex.getCellStyle(e,t,r)};return FlexGridRenderer}(),PanelSection=function(){function PanelSection(e,t,r){this._flex=e;this._panel=t;this._range=r.clone()}Object.defineProperty(PanelSection.prototype,"renderableRowsCount",{get:function(){var e=this;if(null==this._renderableRowsCnt){this._renderableRowsCnt=0;this._range.forEach(this._panel,(function(t){e._flex.isRenderableRow(t)&&e._renderableRowsCnt++}))}return this._renderableRowsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"renderableColumnsCount",{get:function(){if(null==this._renderableColumnsCnt){this._renderableColumnsCnt=0;if(this._range.isValid)for(var e=this._range.leftCol;e<=this._range.rightCol;e++)this._flex.isRenderableColumn(this._panel.columns[e])&&this._renderableColumnsCnt++}return this._renderableColumnsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"size",{get:function(){if(null==this._size){var e=this._range.getRenderSize(this._flex,this._panel);this._size=new Size(pdf.pxToPt(e.width),pdf.pxToPt(e.height))}return this._size},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"panel",{get:function(){return this._panel},enumerable:!0,configurable:!0});return PanelSection}(),PanelSectionRenderer=function(e){__extends(PanelSectionRenderer,e);function PanelSectionRenderer(t,r,o,n){var i=e.call(this,t.flex,r,o)||this;i._gr=t;i._borderWidth=n;return i}Object.defineProperty(PanelSectionRenderer.prototype,"gr",{get:function(){return this._gr},enumerable:!0,configurable:!0});Object.defineProperty(PanelSectionRenderer.prototype,"renderSize",{get:function(){if(null==this._renderSize){this._renderSize=this.size.clone();this.renderableColumnsCount>1&&(this._renderSize.width-=this._borderWidth*(this.renderableColumnsCount-1));this.renderableRowsCount>1&&(this._renderSize.height-=this._borderWidth*(this.renderableRowsCount-1))}return this._renderSize},enumerable:!0,configurable:!0});PanelSectionRenderer.prototype._getRangeWidth=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.columns[i];if(this._gr.isRenderableColumn(l)){o++;r+=l.renderWidth}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype._getRangeHeight=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.rows[i];if(this._gr.isRenderableRow(l)){o++;r+=l.renderHeight}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype.getCellsCount=function(){var e=this,t=0,r=this.range,o=this.panel,n=new GetMergedRangeProxy(this._gr.flex);if(!r.isValid)return t;r.forEach(o,(function(i,l,s){if(e._gr.isRenderableRow(i))for(var a=r.leftCol;a<=r.rightCol;a++)if(e._gr.isRenderableColumn(o.columns[a])){var d=!1,u=void 0,p=n.getMergedRange(o,s,a);if(p){var c=s===p.firstVisibleRow,f=a===p.leftCol,h=s===l.topRow,g=a===l.leftCol,_=p.rowSpan>1,w=p.columnSpan>1;if(_&&w&&(c&&f||h&&g)||_&&!w&&(c||h)||!_&&w&&(f||g)){d=!0;w&&(u=Math.min(r.rightCol,p.rightCol))}}else d=!0;d&&t++;u&&(a=u)}}));return t};PanelSectionRenderer.prototype.render=function(e,t,r,o,n){var i=this,l=this.range;if(l.isValid){for(var s={},a=this.panel,d=new GetMergedRangeProxy(this._gr.flex),u=new _CellRangeExt(a,0,0,0,0),p=new _CellRenderer(this,e,this._borderWidth),c=l.leftCol;c<=l.rightCol;c++)s[c]=r;l.forEach(a,(function(r,c,f){if(i._gr.isRenderableRow(r))for(var h=n?n.getTR(f,a.cellType):null,g=t,_=l.leftCol;_<=l.rightCol;_++){var w=i.gr.getColumn(a,f,_);if(i._gr.isRenderableColumn(w)){var C,m=void 0,b=void 0,R=!1,y=void 0,x=i._gr.flex.getCellContent(i.panel,r,w,_),v=d.getMergedRange(a,f,_);if(v){if(f>=v.topRow){u.copyFrom(v);var P=f===v.firstVisibleRow,S=_===v.leftCol,T=f===c.topRow,G=_===c.leftCol,F=v.rowSpan>1,A=v.columnSpan>1;if(F&&A&&(P&&S||T&&G)||F&&!A&&(P||T)||!F&&A&&(S||G)){R=!0;C=P&&S||i.gr.settings.repeatMergedValuesAcrossPages?x:"";m=F?i._getRangeHeight(f,Math.min(v.bottomRow,c.bottomRow)):i._getRangeHeight(f,f);if(A){b=i._getRangeWidth(Math.max(l.leftCol,v.leftCol),Math.min(l.rightCol,v.rightCol));y=Math.min(l.rightCol,v.rightCol);for(var M=_+1;M<=y;M++)s[M]+=m-i._borderWidth}}}else m=i._getRangeHeight(f,f);null==b&&(b=i._getRangeWidth(_,_))}else{u.setRange(f,_,f,_);R=!0;C=x;m=i._getRangeHeight(f,f);b=i._getRangeWidth(_,_)}if(R&&b>0&&m>0){var W=p.renderCell(C,r,w,u,new Rect(g,s[_],b,m));if(h){var J=e.tag(a.cellType===_CellType.ColumnHeader||a.cellType==_CellType.TopLeft?pdf.PdfTagType.TH:pdf.PdfTagType.TD);W&&J.add(W);h.add(J)}o&&o()}m&&(s[_]+=m-i._borderWidth);b&&(g+=b-i._borderWidth);y&&(_=y)}}}))}};return PanelSectionRenderer}(PanelSection),TrStructCache=function(){function TrStructCache(e,t){this.doc=e;this.tableSection=t;this._trh=[];this._trb=[];this._trf=[]}Object.defineProperty(TrStructCache.prototype,"el",{get:function(){return this.tableSection},enumerable:!0,configurable:!0});TrStructCache.prototype.getTR=function(e,t){var r=t===_CellType.TopLeft||t===_CellType.ColumnHeader?this._trh:t===_CellType.RowHeader||t===_CellType.Cell?this._trb:this._trf,o=r[e];o||this.tableSection.add(r[e]=o=this.doc.tag(pdf.PdfTagType.TR));return o};return TrStructCache}(),_CellRenderer=function(){function _CellRenderer(e,t,r){this.InvisiblePen=new pdf.PdfPen(Color.fromRgba(0,0,0,0),0);this._pr=e;this._area=t;this._borderWidth=r}_CellRenderer.prototype.renderCell=function(e,t,r,o,n){var i,l=this,s=this._pr.gr.flex,a=this._pr.panel,getGridCell=function(e){return s.getCell(a,o.topRow,o.leftCol,e)},d=null,u=this._pr.gr.getCellStyle(a,t,r),p=this._pr.gr.settings.customCellContent,c=isFunction(this._pr.gr.settings.formatItem);if(p){var f=s.getComputedStyle(a,d=getGridCell(c));u.color=f.color;u.backgroundColor=f.backgroundColor;var h=s.getComputedDefBorderColor();u.borderLeftColor="none"!=f.borderLeftStyle?f.borderLeftColor:h;u.borderRightColor="none"!=f.borderRightStyle?f.borderRightColor:h;u.borderTopColor="none"!=f.borderTopStyle?f.borderTopColor:h;u.borderBottomColor="none"!=f.borderBottomStyle?f.borderBottomColor:h;u.font=new pdf.PdfFont(f.fontFamily,pdf._asPt(f.fontSize,!0,void 0),f.fontStyle,f.fontWeight);u.textAlign=f.textAlign}if(u.font&&!(u.font instanceof pdf.PdfFont)){var g=u.font;u.font=new pdf.PdfFont(g.family,g.size,g.style,g.weight)}u.boxSizing="border-box";u.borderWidth=this._borderWidth;u.borderStyle="solid";p||this._pr.gr.isExpandableGroupRow(t)&&0===r.visibleIndex||(u.textAlign=r.getAlignment(t));if(a.cellType===_CellType.Cell&&s.rows.maxGroupLevel>=0&&o.leftCol===s.columns.firstVisibleIndex){var _=s.isGroupRow(t)?Math.max(t.level,0):s.rows.maxGroupLevel+1,w=pdf._asPt(u.paddingLeft||u.padding),C=pdf.pxToPt(_*s.treeIndent);u.paddingLeft=w+C}var m,b=this._measureCell(e,a,t,r,u,n),R=o.rowSpan>1&&o.visibleRowsCount>1&&this._pr.gr.alignMergedTextToTheTopRow(a)?new Rect(b.contentRect.left,b.contentRect.top,b.contentRect.width,b.contentRect.height/(o.visibleRowsCount||1)):b.contentRect,y=!0,x=!0;if(c){(i=new PdfFormatItemEventArgs(a,o,d,this._area,b.rect,b.contentRect,u,(function(){return d||getGridCell(!0)}),(function(){return b.textRect=l._calculateTextRect(e,a,t,r,R,u)}))).data=e;this._pr.gr.settings.formatItem(i);if(i.data!==e){e=asString(i.data);b.textRect=null}y=!i.cancel;x=!i.cancelBorders;m=i.tagContent}y&&!b.textRect&&(b.textRect=this._calculateTextRect(e,a,t,r,R,u));return this._renderCell(e,t,r,o,b,u,y,x,null==m)||m};_CellRenderer.prototype._renderCell=function(e,t,r,o,n,i,l,s,a){if(l||s){var d,u=this._area.document.tagged,p=this._area.document;u&&p.beginArtifact({type:pdf.PdfArtifactType.Layout});this._renderEmptyCell(n,i,l,s);u&&p.endArtifact();if(l){a=!0===u&&!0===a;var c=void 0;if(this._isBooleanCellAndValue(e,this._pr.panel,t,r)){if(a){d=p.tag(pdf.PdfTagType.Span,null,{actual:e.toString()});c=p.beginTagContent(pdf.PdfTagType.Span)}this._renderBooleanCell(e,n,i)}else{if(a){d=p.tag(pdf.PdfTagType.P);c=p.beginTagContent(pdf.PdfTagType.P)}this._renderTextCell(e,n,i)}if(a){p.endTagContent();d.add(c)}}return d}};_CellRenderer.prototype._isBooleanCellAndValue=function(e,t,r,o){return this._pr.gr.isBooleanCell(t,r,o)&&this._isBoolean(e)};_CellRenderer.prototype._isBoolean=function(e){var t=isString(e)&&e.toLowerCase();return"true"===t||"false"===t||!0===e||!1===e};_CellRenderer.prototype._measureCell=function(e,t,r,o,n,i){this._decompositeStyle(n);var l=i.left,s=i.top,a=i.height,d=i.width,u=this._parseBorder(n),p=u.left.width,c=u.top.width,f=u.bottom.width,h=u.right.width,g=this._parsePadding(n),_=0,w=0,C=0,m=0;if("content-box"===n.boxSizing||void 0===n.boxSizing){_=g.top+a+g.bottom;w=g.left+d+g.right;C=a;m=d}else{if("border-box"!==n.boxSizing)throw"Invalid value: "+n.boxSizing;if(pdf._IE&&n instanceof CSSStyleDeclaration){_=g.top+g.bottom+a;w=g.left+g.right+d}else{_=Math.max(a-c-f,0);w=Math.max(d-p-h,0)}C=Math.max(_-g.top-g.bottom,0);m=Math.max(w-g.left-g.right,0)}return{rect:i=new Rect(l,s,d,a),clientRect:new Rect(l+p,s+c,w,_),contentRect:new Rect(l+p+g.left,s+c+g.top,m,C),textRect:null}};_CellRenderer.prototype._decompositeStyle=function(e){if(e){var t;if(t=e.borderColor){e.borderLeftColor||(e.borderLeftColor=t);e.borderRightColor||(e.borderRightColor=t);e.borderTopColor||(e.borderTopColor=t);e.borderBottomColor||(e.borderBottomColor=t)}if(t=e.borderWidth){e.borderLeftWidth||(e.borderLeftWidth=t);e.borderRightWidth||(e.borderRightWidth=t);e.borderTopWidth||(e.borderTopWidth=t);e.borderBottomWidth||(e.borderBottomWidth=t)}if(t=e.borderStyle){e.borderLeftStyle||(e.borderLeftStyle=t);e.borderRightStyle||(e.borderRightStyle=t);e.borderTopStyle||(e.borderTopStyle=t);e.borderBottomStyle||(e.borderBottomStyle=t)}if(t=e.padding){e.paddingLeft||(e.paddingLeft=t);e.paddingRight||(e.paddingRight=t);e.paddingTop||(e.paddingTop=t);e.paddingBottom||(e.paddingBottom=t)}}};_CellRenderer.prototype._parseBorder=function(e){var t={left:{width:0},top:{width:0},bottom:{width:0},right:{width:0}};"none"!==e.borderLeftStyle&&(t.left={width:pdf._asPt(e.borderLeftWidth),style:e.borderLeftStyle,color:e.borderLeftColor});"none"!==e.borderTopStyle&&(t.top={width:pdf._asPt(e.borderTopWidth),style:e.borderTopStyle,color:e.borderTopColor});"none"!==e.borderBottomStyle&&(t.bottom={width:pdf._asPt(e.borderBottomWidth),style:e.borderBottomStyle,color:e.borderBottomColor});"none"!==e.borderRightStyle&&(t.right={width:pdf._asPt(e.borderRightWidth),style:e.borderRightStyle,color:e.borderRightColor});return t};_CellRenderer.prototype._parsePadding=function(e){return{left:pdf._asPt(e.paddingLeft),top:pdf._asPt(e.paddingTop),bottom:pdf._asPt(e.paddingBottom),right:pdf._asPt(e.paddingRight)}};_CellRenderer.prototype._renderEmptyCell=function(e,t,r,o){var n=e.rect.left,i=e.rect.top,l=e.clientRect.width,s=e.clientRect.height,a=e.clientRect.left-e.rect.left,d=e.clientRect.top-e.rect.top,u=e.rect.top+e.rect.height-(e.clientRect.top+e.clientRect.height),p=e.rect.left+e.rect.width-(e.clientRect.left+e.clientRect.width);r=r&&t.backgroundColor&&l>0&&s>0;if(o&&(a||p||u||d)){var c=t.borderLeftColor||t.borderColor,f=t.borderRightColor||t.borderColor,h=t.borderTopColor||t.borderColor,g=t.borderBottomColor||t.borderColor;if(a&&d&&u&&p&&a===p&&a===u&&a===d&&c===f&&c===g&&c===h){var _=a,w=_/2,C=this._area.paths.rect(n+w,i+w,l+_,s+_);if(r){C.fillAndStroke(t.backgroundColor,new pdf.PdfPen(c,_));return}C.stroke(new pdf.PdfPen(c,_))}else{a&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a,i+d+s],[n,i+d+s+u]]).fill(c);d&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a+l,i+d],[n+a+l+p,i]]).fill(h);p&&this._area.paths.polygon([[n+a+l+p,i],[n+a+l,i+d],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(f);u&&this._area.paths.polygon([[n,i+d+s+u],[n+a,i+d+s],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(g)}}r&&this._area.paths.rect(e.clientRect.left,e.clientRect.top,e.clientRect.width,e.clientRect.height).fillAndStroke(t.backgroundColor,this.InvisiblePen)};_CellRenderer.prototype._renderBooleanCell=function(e,t,r){if(!(!t.textRect||t.textRect.height<=0||t.textRect.width<=0)){var o=t.textRect.left,n=t.textRect.top,i=t.textRect.height;this._area.paths.rect(o,n,i,i).fillAndStroke(Color.fromRgba(255,255,255),new pdf.PdfPen(void 0,.5));if(!0===changeType(e,DataType.Boolean,"")){var l=i/20,s=i-.5-2*l,a=i/8;this._area.document.saveState();this._area.translate(o+.25+l,n+.25+l).paths.moveTo(a/2,.6*s).lineTo(s-.6*s,s-a).lineTo(s-a/2,a/2).stroke(new pdf.PdfPen(void 0,a));this._area.document.restoreState()}}};_CellRenderer.prototype._renderTextCell=function(e,t,r){!e||!t.textRect||t.textRect.height<=0||t.textRect.width<=0||this._area.drawText(e,t.textRect.left,t.textRect.top,{brush:r.color,font:r.font,height:t.textRect.height,width:t.textRect.width,align:"center"===r.textAlign?pdf.PdfTextHorizontalAlign.Center:"right"===r.textAlign?pdf.PdfTextHorizontalAlign.Right:"justify"===r.textAlign?pdf.PdfTextHorizontalAlign.Justify:pdf.PdfTextHorizontalAlign.Left})};_CellRenderer.prototype._calculateTextRect=function(e,t,r,o,n,i){if(null!=e&&!isString(e))return null;var l=n.clone();if(this._isBooleanCellAndValue(e,t,r,o)){var s=this._getTextLineHeight(i.font);switch(i.verticalAlign){case"middle":l.top=n.top+n.height/2-s/2;break;case"bottom":l.top=n.top+n.height-s}switch(i.textAlign){case"justify":case"center":l.left=n.left+n.width/2-s/2;break;case"right":l.left=n.left+n.width-s}l.height=l.width=s}else if(l.height>0&&l.width>0)switch(i.verticalAlign){case"bottom":if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height-d.size.height-a;l.height=d.size.height}break;case"middle":var d;if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var u;a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height/2-(d.size.height-a)/2;l.height=d.size.height}}return l};_CellRenderer.prototype._getTextLineHeight=function(e){return this._area.lineHeight(e)};return _CellRenderer}();export{_CellRenderer};var GetMergedRangeProxy=function(){function GetMergedRangeProxy(e){this._columns={};this._flex=e}GetMergedRangeProxy.prototype.getMergedRange=function(e,t,r){var o=this._columns[r];if(o&&t>=o.topRow&&t<=o.bottomRow)return o;var n=this._flex.getMergedRange(e,t,r),i=e.columns,l=e.rows;if(n&&!n.isSingleCell&&(!i[n.col].isVisible||!i[n.col2].isVisible||!l[n.row].isVisible||!l[n.row2].isVisible)){n=n.clone();for(;n.col<n.col2&&!i[n.col].isVisible;)n.col++;for(;n.col2>n.col&&!i[n.col2].isVisible;)n.col2--;for(;n.row<n.row2&&!l[n.row].isVisible;)n.row++;for(;n.row2>n.row&&!l[n.row2].isVisible;)n.row2--}n&&n.isSingleCell&&(n=null);return this._columns[r]=n?new _CellRangeExt(e,n):null};return GetMergedRangeProxy}(),_CellRange=function(){function _CellRange(e,t,r,o){if("number"==typeof e){this._row=e;this._col=t;this._row2=r;this._col2=o}else{this._row=e.row;this._col=e.col;this._row2=e.row2;this._col2=e.col2}(this._row<0||this._row2<0)&&(this._row=this._row2=-1);(this._col<0||this._col2<0)&&(this._col=this._col2=-1)}Object.defineProperty(_CellRange.prototype,"row",{get:function(){return this._row},set:function(e){this._row=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col",{get:function(){return this._col},set:function(e){this._col=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"row2",{get:function(){return this._row2},set:function(e){this._row2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col2",{get:function(){return this._col2},set:function(e){this._col2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"topRow",{get:function(){return Math.min(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"bottomRow",{get:function(){return Math.max(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"leftCol",{get:function(){return Math.min(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rightCol",{get:function(){return Math.max(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"columnSpan",{get:function(){return Math.abs(this._col2-this._col)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rowSpan",{get:function(){return Math.abs(this._row2-this._row)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isValid",{get:function(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isSingleCell",{get:function(){return this._row===this._row2&&this._col===this._col2},enumerable:!0,configurable:!0});_CellRange.prototype.copyFrom=function(e){this.setRange(e.row,e.col,e.row2,e.col2)};_CellRange.prototype.clone=function(){return new _CellRange(this._row,this._col,this._row2,this._col2)};_CellRange.prototype.getRenderSize=function(e,t){var r=new Size(0,0);if(this.isValid){for(var o=this.topRow;o<=this.bottomRow;o++){var n=t.rows[o];e.isRenderableRow(n)&&(r.height+=n.renderHeight)}for(var i=this.leftCol;i<=this.rightCol;i++){var l=t.columns[i];e.isRenderableColumn(l)&&(r.width+=l.renderWidth)}}return r};_CellRange.prototype.setRange=function(e,t,r,o){void 0===e&&(e=-1);void 0===t&&(t=-1);void 0===r&&(r=e);void 0===o&&(o=t);this._row=asInt(e);this._col=asInt(t);this._row2=asInt(r);this._col2=asInt(o)};return _CellRange}();export{_CellRange};var _CellRangeExt=function(e){__extends(_CellRangeExt,e);function _CellRangeExt(t,r,o,n,i){var l=e.call(this,r,o,n,i)||this;l.firstVisibleRow=-1;l.visibleRowsCount=0;if(t){var s=l.topRow,a=l.bottomRow,d=t.rows.length;if(d>0)for(var u=s;u<=a&&u<d;u++)if(t.rows[u].isVisible){l.firstVisibleRow<0&&(l.firstVisibleRow=u);l.visibleRowsCount++}}return l}_CellRangeExt.prototype.copyFrom=function(t){e.prototype.copyFrom.call(this,t);this.firstVisibleRow=t.firstVisibleRow;this.visibleRowsCount=t.visibleRowsCount};_CellRangeExt.prototype.clone=function(){return new _CellRangeExt(null,this.row,this.col,this.row2,this.col2)};return _CellRangeExt}(_CellRange);export{_CellRangeExt};var _fc,RowRange=function(){function RowRange(e){this._ranges=e||[]}RowRange.prototype.length=function(){for(var e=0,t=0;t<this._ranges.length;t++){var r=this._ranges[t];r.isValid&&(e+=r.bottomRow-r.topRow+1)}return e};Object.defineProperty(RowRange.prototype,"isValid",{get:function(){return this._ranges.length&&this._ranges[0].isValid},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"leftCol",{get:function(){return this._ranges.length?this._ranges[0].leftCol:-1},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"rightCol",{get:function(){return this._ranges.length?this._ranges[0].rightCol:-1},enumerable:!0,configurable:!0});RowRange.prototype.clone=function(e,t){for(var r=[],o=0;o<this._ranges.length;o++){var n=this._ranges[o].clone();arguments.length>0&&(n.col=e);arguments.length>1&&(n.col2=t);r.push(n)}return new RowRange(r)};RowRange.prototype.getRenderSize=function(e,t){for(var r=new Size(0,0),o=0;o<this._ranges.length;o++){var n=this._ranges[o].getRenderSize(e,t);r.width=Math.max(r.width,n.width);r.height+=n.height}return r};RowRange.prototype.find=function(e,t){var r=null;this.forEach(e,(function(e){if(!0===t(e)){r=e;return!1}}));return r};RowRange.prototype.forEach=function(e,t){for(var r=0,o=!1,n=0;n<this._ranges.length&&!o;n++){var i=this._ranges[n];if(i.isValid)for(var l=i.topRow;l<=i.bottomRow&&!o;l++)o=!1===t(e.rows[l],i,l,r++)}};RowRange.prototype.subrange=function(e,t,r,o){var n=[];if(e>=0&&t>0)for(var i=0,l=0,s=0;s<this._ranges.length&&t>0;s++,i=l+1){var a=this._ranges[s];if(!(e>(l=i+(a.bottomRow-a.topRow)))){var d=e>i?a.topRow+(e-i):a.topRow,u=Math.min(a.bottomRow,d+t-1),p=arguments.length>2?r:a.leftCol,c=arguments.length>2?o:a.rightCol;n.push(new _CellRange(d,p,u,c));t-=u-d+1}}return new RowRange(n)};return RowRange}(),PdfPageRowRange=function(){function PdfPageRowRange(e,t,r){this._col=t;this._row=r;this._range=e}Object.defineProperty(PdfPageRowRange.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageCol",{get:function(){return this._col},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageRow",{get:function(){return this._row},enumerable:!0,configurable:!0});return PdfPageRowRange}(),FAKE_CELL="wj-pdf-fake-cell";function getFakeCell(e){if(!_fc){(_fc=document.createElement("div")).setAttribute(FAKE_CELL,"true");softGrid()&&_fc.setAttribute(softGrid().FlexGrid._WJS_MEASURE,"true")}var t=_fc.style;t.cssText="";t.position="absolute";t.overflow="hidden";t.width="1px";t.height="1px";t.clipPath="inset(100%)";t.clip="rect(0 0 0 0)";var r=e.hostElement,o=r.children.length?r.children[0]:r;_fc.parentNode!==o&&o.appendChild(_fc);return _fc}export function _removeFakeCell(){if(_fc){removeChild(_fc);_fc=null}}var FlexGridPdfConverter=function(){function FlexGridPdfConverter(){}FlexGridPdfConverter.draw=function(e,t,r,o,n){this.drawToPosition(e,t,null,r,o,n)};FlexGridPdfConverter.drawToPosition=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");var l,s=softGrid()&&e instanceof softGrid().FlexGrid,a=e;try{i=_FlexGridPdfCoreConverter._applyDefaultDrawSettings(i);var d=e;if(s){if(i&&i.recalculateStarWidths){l=a.columns.getTotalSize();a.columns._updateStarSizes(pdf.ptToPx(t.width))}d=this._getFlexGridAdapter(a,i)}_FlexGridPdfCoreConverter.draw(d,t,r,o,n,i)}finally{_removeFakeCell();s&&i&&i.recalculateStarWidths&&a.columns._updateStarSizes(l)}};FlexGridPdfConverter.export=function(e,t,r){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The fileName argument cannot be empty.");var o=(r=this._applyDefaultExportSettings(r)).documentOptions.ended;r.documentOptions.ended=function(e,i){r.progress&&r.progress(1);o&&!1===o.apply(n,[e,i])||pdf.saveBlob(i.blob,t);e.dispose()};var n=new pdf.PdfDocument(r.documentOptions);this.drawToPosition(e,n,null,null,null,r);n.end()};FlexGridPdfConverter._getFlexGridAdapter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowAdapter||softSheet()&&e instanceof softSheet().FlexSheet&&FlexSheetAdapter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridAdapter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&_TransposedGridAdapter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultiRowAdapter||FlexGridAdapter)(e,t)};FlexGridPdfConverter._applyDefaultExportSettings=function(e){return _merge(_merge({},e),this._DefaultExportSettings)};FlexGridPdfConverter._DefaultExportSettings=_merge({scaleMode:ScaleMode.PageWidth,documentOptions:{compress:!1,pageSettings:{margins:{left:36,right:36,top:18,bottom:18}}},_progressMax:.9},_FlexGridPdfCoreConverter.DefaultDrawSettings);return FlexGridPdfConverter}();export{FlexGridPdfConverter};var PdfWebWorkerResponseStatus,FlexGridAdapter=function(){function FlexGridAdapter(e,t){this._defBorderColor=null;this._flex=e;this._settings=t;t.quickCellStyles&&(this._styleCache=new StyleCache(500))}Object.defineProperty(FlexGridAdapter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columns",{get:function(){return this._flex.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rows",{get:function(){return this._flex.rows},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"bottomLeftCells",{get:function(){return this._flex.bottomLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"cells",{get:function(){return this._flex.cells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnFooters",{get:function(){return this._flex.columnFooters},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnHeaders",{get:function(){return this._flex.columnHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rowHeaders",{get:function(){return this._flex.rowHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"topLeftCells",{get:function(){return this._flex.topLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"treeIndent",{get:function(){return this._flex.treeIndent},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.getSelection=function(){var e=[],t=this._flex.selection,r=softGrid();switch(this._flex.selectionMode){case r.SelectionMode.None:break;case r.SelectionMode.Cell:case r.SelectionMode.CellRange:e.push(new _CellRange(t.row,t.col,t.row2,t.col2));break;case r.SelectionMode.Row:e.push(new _CellRange(t.topRow,0,t.topRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.RowRange:e.push(new _CellRange(t.topRow,0,t.bottomRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.ListBox:for(var o=-1,n=0;n<this._flex.rows.length;n++){if(this._flex.rows[n].isSelected){o<0&&(o=n);n===this._flex.rows.length-1&&e.push(new _CellRange(o,0,n,this._flex.cells.columns.length-1))}else{o>=0&&e.push(new _CellRange(o,0,n-1,this._flex.cells.columns.length-1));o=-1}}}return e};FlexGridAdapter.prototype.getCell=function(e,t,r,o){var n=e.getCellElement(t,r);if(!n){n=getFakeCell(e);this._flex.cellFactory.updateCell(e,t,r,n,null,o)}return n};FlexGridAdapter.prototype.getComputedDefBorderColor=function(){if(null==this._defBorderColor){var e=window.getComputedStyle(this._flex.hostElement);this._defBorderColor="none"!=e.borderRightStyle?e.borderRightColor:"none"!=e.borderBottomStyle?e.borderBottomColor:"none"!=e.borderLeftStyle?e.borderLeftColor:"none"!=e.borderTopStyle?e.borderTopColor:"rgba(0,0,0,0.2)"}return this._defBorderColor};FlexGridAdapter.prototype.getComputedStyle=function(e,t){var r,o=null==t.getAttribute(FAKE_CELL),n=t.className,i=n.indexOf("wj-state-selected")>=0||n.indexOf("wj-state-multi-selected")>=0;i&&(t.className=n.replace("wj-state-selected","").replace("wj-state-multi-selected",""));if(this._styleCache){var l=e.hostElement,s=t.style.cssText.split(/;\s+/).filter((function(e){var t=e.substring(0,e.indexOf(":"));return/^(color|background-color|border-color|border-left-color|border-right-color|border-top-color|border-bottom-color|font|textAlign)/i.test(t)})).join(";"),a=t;do{s=a.className+s}while(a!==l&&(a=a.parentElement));if(!(r=this._styleCache.getValue(s))){r=window.getComputedStyle(t);r=this._styleCache.add(s,r)}}else r=_cloneStyle(window.getComputedStyle(t));o&&i&&(t.className=n);return r};FlexGridAdapter.prototype.getMergedRange=function(e,t,r){var o=this._flex.getMergedRange(e,t,r,!1);return o?new _CellRange(o.row,o.col,o.row2,o.col2):null};Object.defineProperty(FlexGridAdapter.prototype,"showColumnHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Column)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showRowHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Row)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showColumnFooter",{get:function(){return this._flex.columnFooters.rows.length>0},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r,!0)};FlexGridAdapter.prototype.getCellContent=function(e,t,r,o){var n,i=softGrid();if(this.settings.customCellContent){var l=this.getCell(e,t.index,o,!0);!(n=(n=l.innerText.trim()).replace(/\r/gm,"").replace(/\n+/gm,"\n"))&&this.isBooleanCell(e,t,r)&&(n=null==(n=this._extractCheckboxValue(l))?"":n+"")}else{var s=r.isContentHtml;n=this.getCellData(e,t.index,o);if(this.isGroupRow(t)&&e.cellType===i.CellType.Cell&&r.index===e.columns.firstVisibleIndex){s=!0;n||(n=t.getGroupHeader())}s&&(n=toPlainText(n).trim())}return n};FlexGridAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===softGrid().CellType.Cell&&(!this.isExpandableGroupRow(t)||r.visibleIndex>0)};FlexGridAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridAdapter.prototype.isAlternatingRow=function(e){var t=!1,r=this._flex.alternatingRowStep;if(r){t=e.visibleIndex%(r+1)==0;1==r&&(t=!t)}return t};FlexGridAdapter.prototype.isGroupRow=function(e){return e instanceof softGrid().GroupRow};FlexGridAdapter.prototype.isNewRow=function(e){return e instanceof softGrid()._NewRowTemplate};FlexGridAdapter.prototype.isDetailRow=function(e){return softDetail()&&e instanceof softDetail().DetailRow};FlexGridAdapter.prototype.isExpandableGroupRow=function(e){return e instanceof softGrid().GroupRow&&e.hasChildren};FlexGridAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle),i=this._flex,l=softGrid();switch(e.cellType){case l.CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case l.CellType.ColumnHeader:case l.CellType.RowHeader:case l.CellType.TopLeft:case l.CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case l.CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}!this.settings.customCellContent&&i._getShowErrors()&&i._getError(e,t.index,r.index)&&_merge(n,o.errorCellStyle,!0);return n};FlexGridAdapter.prototype._extractCheckboxValue=function(e){var t=e.querySelector("input[type=checkbox]");if(t&&"none"!==t.style.display&&"hidden"!==t.style.visibility)return t.checked};return FlexGridAdapter}(),FlexSheetAdapter=function(e){__extends(FlexSheetAdapter,e);function FlexSheetAdapter(){return null!==e&&e.apply(this,arguments)||this}FlexSheetAdapter.prototype.getCellData=function(t,r,o){return t.cellType===softGrid().CellType.Cell?t.rows[r]instanceof softSheet().HeaderRow?this.flex.columnHeaders.getCellData(r,o,!0):this.flex.getCellValue(r,o,!0):e.prototype.getCellData.call(this,t,r,o)};FlexSheetAdapter.prototype.getCellStyle=function(t,r,o){var n=e.prototype.getCellStyle.call(this,t,r,o),i=this.flex.selectedSheet.findTable(r.index,o.index);if(i){var l=i.getRange(),s=r.index-l.topRow,a=o.index-l.leftCol,d=i._getTableCellAppliedStyles(s,a);d&&(d.font=new pdf.PdfFont(d.fontFamily,pdf._asPt(d.fontSize,!0,void 0),d.fontStyle,d.fontWeight));_merge(n,d,!0)}return n};Object.defineProperty(FlexSheetAdapter.prototype,"showColumnHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showRowHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showColumnFooter",{get:function(){return!1},enumerable:!0,configurable:!0});return FlexSheetAdapter}(FlexGridAdapter),MultiRowAdapter=function(e){__extends(MultiRowAdapter,e);function MultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}MultiRowAdapter.prototype.getColumn=function(t,r,o){return _combineColumns(e.prototype.getColumn.call(this,t,r,o),this.flex.getBindingColumn(t,r,o))};MultiRowAdapter.prototype.isAlternatingRow=function(t){if(t instanceof softMultiRow()._MultiRow){var r=!1,o=this.flex.alternatingRowStep;if(o){r=t.dataIndex%(o+1)==0;1==o&&(r=!r)}return r}return e.prototype.isAlternatingRow.call(this,t)};return MultiRowAdapter}(FlexGridAdapter),PivotGridAdapter=function(e){__extends(PivotGridAdapter,e);function PivotGridAdapter(){return null!==e&&e.apply(this,arguments)||this}PivotGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){var t=softGrid();return!this.flex.centerHeadersVertically&&(e.cellType===t.CellType.ColumnHeader||e.cellType===t.CellType.RowHeader)};return PivotGridAdapter}(FlexGridAdapter),_TransposedGridAdapter=function(e){__extends(_TransposedGridAdapter,e);function _TransposedGridAdapter(){return null!==e&&e.apply(this,arguments)||this}_TransposedGridAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=t.grid._getBindingColumn(t,r,n);return i?_combineColumns(n,i):n};return _TransposedGridAdapter}(FlexGridAdapter),TransposedMultiRowAdapter=function(e){__extends(TransposedMultiRowAdapter,e);function TransposedMultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultiRowAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=this.flex.getBindingColumn(t,r,o);return i?_combineColumns(n,i):n};return TransposedMultiRowAdapter}(FlexGridAdapter),StyleCache=function(){function StyleCache(e){this._cache={};this._size=0;this._max=e}StyleCache.prototype.add=function(e,t){this._size>=this._max&&this.clear();var r=this._cache[e]=_cloneStyle(t);this._size++;return r};StyleCache.prototype.clear=function(){this._cache={};this._size=0};StyleCache.prototype.getValue=function(e){return this._cache[e]||null};StyleCache.prototype.hasKey=function(e){return!!this._cache[e]};return StyleCache}();!function(e){e[e.Done=1]="Done";e[e.Progress=2]="Progress"}(PdfWebWorkerResponseStatus||(PdfWebWorkerResponseStatus={}));var DefGridName="",PdfWebWorkerExportDoneEventArgs=function(e){__extends(PdfWebWorkerExportDoneEventArgs,e);function PdfWebWorkerExportDoneEventArgs(t){var r=e.call(this)||this;r._buf=t;return r}Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"blob",{get:function(){this._blob||(this._blob=new Blob([new Uint8Array(this._buf)],{type:"application/pdf"}));return this._blob},enumerable:!0,configurable:!0});Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"buffer",{get:function(){return this._buf},enumerable:!0,configurable:!0});return PdfWebWorkerExportDoneEventArgs}(EventArgs);export{PdfWebWorkerExportDoneEventArgs};var PdfWebWorkerClient=function(){function PdfWebWorkerClient(){}PdfWebWorkerClient.exportGrid=function(e,t,r,o,n,i){(o=FlexGridPdfConverter._applyDefaultExportSettings(o)).progress=o.progress||i;this.addGrid(e,t,DefGridName,o);this.export(e,o.documentOptions,(function(e){isFunction(n)&&!1===n(e)||pdf.saveBlob(e.blob,r)}),i)};PdfWebWorkerClient.export=function(e,t,r,o){e.addEventListener("message",(function handler(t){var n=t.data;switch(n.status){case PdfWebWorkerResponseStatus.Done:e.removeEventListener("message",handler);isFunction(r)&&r(new PdfWebWorkerExportDoneEventArgs(n.data));break;case PdfWebWorkerResponseStatus.Progress:o&&o(n.data);break;default:throw"Unknown status: "+n.status}}));var n=this._clientDataToArrayBuffer(e);e.postMessage({content:n,settings:t},[n]);this._clearClientData(e)};PdfWebWorkerClient.addGrid=function(e,t,r,o){var n=this._gridToJson(t,o);this._addClientData(e,JSON.stringify(n),r,o,!0)};PdfWebWorkerClient.addImage=function(e,t,r,o){var n=isString(t)&&t.indexOf("data:image/svg")>=0?t:pdf._PdfImageHelper.getDataUri(t);this._addClientData(e,n,r,o)};PdfWebWorkerClient.addString=function(e,t,r){this._addClientData(e,t,r,null)};PdfWebWorkerClient.serializeGrid=function(e,t){var r=this._gridToJson(e,t);return strToBuf(JSON.stringify(r))};PdfWebWorkerClient._addClientData=function(e,t,r,o,n){void 0===n&&(n=!1);asType(e,Worker);asString(r);asString(t,!0);var i=e;i.clientData=i.clientData||{};i.clientData[r]={content:t,settings:o?JSON.stringify(o):null};var l=i.clientData[r];if(n){l.isGrid=!0;l.progressMessaging=!!o&&isFunction(o.progress)}};PdfWebWorkerClient._clearClientData=function(e){delete e.clientData};PdfWebWorkerClient._clientDataToArrayBuffer=function(e){var t=e;return strToBuf(JSON.stringify(t.clientData||{}))};PdfWebWorkerClient._gridToJson=function(e,t){t=FlexGridPdfConverter._applyDefaultExportSettings(t);var r,o;try{r=new pdf.PdfDocument(t.documentOptions);if(t&&t.recalculateStarWidths){o=e.columns.getTotalSize();e.columns._updateStarSizes(pdf.ptToPx(r.width))}return this._getJsonConverter(e,t).convert()}finally{_removeFakeCell();t&&t.recalculateStarWidths&&e.columns._updateStarSizes(o);if(null!=r){r.dispose();r=null}}};PdfWebWorkerClient._getJsonConverter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowJsonConverter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridJsonConverter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&TransposedGridJsonConverter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultirowJsonConverter||FlexGridJsonConverter)(e,t,FlexGridPdfConverter._getFlexGridAdapter(e,t))};return PdfWebWorkerClient}();export{PdfWebWorkerClient};var RowState,ColState,PdfWebWorker=function(){function PdfWebWorker(){}PdfWebWorker.initExportGrid=function(){var e=this;this.initExport((function(t,r){var o=r[DefGridName];if(o.progressMessaging){o.settings._progressMax=FlexGridPdfConverter._DefaultExportSettings._progressMax;o.settings.progress=function(t){e.sendExportProgress(t)};t.ended.addHandler((function(){e.sendExportProgress(1)}))}FlexGridPdfConverter.draw(o.content,t,null,null,o.settings);t.end()}))};PdfWebWorker.initExport=function(e){self.addEventListener("message",(function handler(t){self.removeEventListener("message",handler);var r=t.data,o=JSON.parse(bufToStr(r.content)),n=r.settings||{};n.ended=function(e,t){blobToBuf(t.blob,(function(e){self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Done},[e])}))};var i=new pdf.PdfDocument(n);Object.keys(o).forEach((function(e){var t=o[e];t.settings&&(t.settings=JSON.parse(t.settings));if(t.isGrid){t.settings&&PdfWebWorker._disableUnsupportedFeatures(t.settings);t.content=PdfWebWorker._deserializeGridFromString(t.content,t.settings)}}));e(i,o)}))};PdfWebWorker.sendExportProgress=function(e){e=clamp(e,0,1);self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Progress})};PdfWebWorker.deserializeGrid=function(e,t){return this._deserializeGridFromString(bufToStr(e),t)};PdfWebWorker._deserializeGridFromString=function(e,t){return this._getJsonAdapter(JSON.parse(e),FlexGridPdfConverter._applyDefaultExportSettings(t))};PdfWebWorker._disableUnsupportedFeatures=function(e){e.customCellContent=!1};PdfWebWorker._getJsonAdapter=function(e,t){switch(e.typeName){case"MultiRow":return new MultiRowJsonAdapter(e,t);case"PivotGrid":return new PivotGridJsonAdapter(e,t);case"TransposedGrid":return new TransposedGridJsonAdapter(e,t);case"TransposedMultiRow":return new TransposedMultiRowJsonAdapter(e,t);default:return new FlexGridJsonAdapter(e,t)}};return PdfWebWorker}();export{PdfWebWorker};function bufToStr(e){for(var t=new Uint16Array(e),r="",o=0,n=t.length;o<n;o++)r+=String.fromCharCode(t[o]);return r}function strToBuf(e){for(var t=new ArrayBuffer(2*e.length),r=new Uint16Array(t),o=0,n=e.length;o<n;o++)r[o]=e.charCodeAt(o);return t}function blobToBuf(e,t){asFunction(t);var r=new FileReader;r.onload=function(e){t(e.target.result)};r.readAsArrayBuffer(e)}!function(e){e[e.None=0]="None";e[e.Alternate=1]="Alternate";e[e.Group=2]="Group";e[e.ExpandableGroup=4]="ExpandableGroup";e[e.New=8]="New";e[e.Visible=16]="Visible";e[e.Detail=32]="Detail"}(RowState||(RowState={}));!function(e){e[e.None=0]="None";e[e.Visible=1]="Visible"}(ColState||(ColState={}));var FlexGridJsonConverter=function(){function FlexGridJsonConverter(e,t,r){this._flex=e;this._settings=t;this._adapter=r}FlexGridJsonConverter.prototype.convert=function(){var e={};e.typeName=this._getTypeName(this._flex);e.selection=this._serializeSelection();e.showColumnFooter=this.adapter.showColumnFooter;e.showColumnHeader=this.adapter.showColumnHeader;e.showRowHeader=this.adapter.showRowHeader;e.treeIndent=this._flex.treeIndent;e.bottomLeftCells=this._serializePanel(this._flex.bottomLeftCells);e.cells=this._serializePanel(this._flex.cells);e.columnFooters=this._serializePanel(this._flex.columnFooters);e.columnHeaders=this._serializePanel(this._flex.columnHeaders);e.rowHeaders=this._serializePanel(this._flex.rowHeaders);e.topLeftCells=this._serializePanel(this._flex.topLeftCells);return e};Object.defineProperty(FlexGridJsonConverter.prototype,"adapter",{get:function(){return this._adapter},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonConverter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});FlexGridJsonConverter.prototype._getTypeName=function(e){return e.constructor.toString().match(/function\s*(\w+)/)[1]};FlexGridJsonConverter.prototype._getRowState=function(e){var t=RowState.None;this.adapter.isAlternatingRow(e)&&(t|=RowState.Alternate);e instanceof softGrid().GroupRow&&(t|=RowState.Group);this.adapter.isDetailRow(e)&&(t|=RowState.Detail);this.adapter.isExpandableGroupRow(e)&&(t|=RowState.ExpandableGroup);e instanceof softGrid()._NewRowTemplate&&(t|=RowState.New);e.isVisible&&(t|=RowState.Visible);return t};FlexGridJsonConverter.prototype._getColumnState=function(e){var t=ColState.None;e.isVisible&&(t|=ColState.Visible);return t};FlexGridJsonConverter.prototype._serializeSelection=function(){for(var e=this.adapter.getSelection(),t=[],r=0;r<e.length;r++){var o=e[r];t.push([o.row,o.col,o.row2,o.col2])}return t};FlexGridJsonConverter.prototype._serializeColumns=function(e){for(var t=[],r=0,o=(e||[]).length;r<o;r++){var n=e[r],i=null;if(n){i={aggregate:n.aggregate,renderWidth:n.renderWidth,visibleIndex:n.visibleIndex};var l=n.getAlignment();l&&(i.alignment=l);var s=this._getColumnState(n);s!==ColState.None&&(i.state=s);n.binding&&(i.binding=n.binding);null!=n.dataType&&(i.dataType=n.dataType);null!=n.name&&(i.name=n.name);n.wordWrap&&(i.wordWrap=!0);n.multiLine&&(i.multiLine=!0)}t.push(i)}return t};FlexGridJsonConverter.prototype._serializePanel=function(e){var t=this,r={cellType:e.cellType,height:e.height,width:e.width};r.mergedRanges=this._serializeMergedRanges(e);r.columns=this._serializeColumns(e.columns);r.columnsFirstVisibleIndex=e.columns.firstVisibleIndex;r.rows=[];r.rowsMaxGroupLevel=e.rows.maxGroupLevel;for(var o=!this._settings.customCellContent&&this._flex._getShowErrors(),_loop_1=function(i,l,s){var a=e.rows[i],d={renderHeight:a.renderHeight};r.rows.push(d);var u=function(e){if(e.align)return e.align;if(!e.dataMap)switch(e.dataType){case DataType.Boolean:return"center";case DataType.Number:return"right"}return null}(a);u&&(d.alignment=u);a instanceof softGrid().GroupRow&&(d.level=a.level);var p=n._getRowState(a);p!==RowState.None&&(d.state=p);a.binding&&(d.binding=a.binding);null!=a.dataType&&(d.dataType=a.dataType);a.wordWrap&&(d.wordWrap=!0);a.multiLine&&(d.multiLine=!0);d.cells=[];for(var c=softGrid(),_loop_2=function(r){var l=n._adapter.getCellContent(e,e.rows[i],e.columns[r],r);if(isFunction(n._settings.formatItem)){var s=new PdfFormatItemEventArgs(e,new c.CellRange(i,r),null,null,null,null,null,(function(){return t._adapter.getCell(e,i,r,!0)}),null);s.data=l;n._settings.formatItem(s);s.data!==l&&(l=s.data)}d.cells[r]=l;if(o&&n._flex._getError(e,i,r)){d.errors||(d.errors={});d.errors[r]=1}},f=0;f<s;f++)_loop_2(f)},n=this,i=0,l=e.rows.length,s=e.columns.length;i<l;i++)_loop_1(i,0,s);return r};FlexGridJsonConverter.prototype._serializeMergedRanges=function(e){for(var t=[],r=[],o=0;o<e.columns.length;o++)r[o]=0;for(var n=0;n<e.rows.length;n++)for(var i=0;i<e.columns.length;i++)if(!(n<r[i])){var l=e.grid.getMergedRange(e,n,i);if(null!=l&&!l.isSingleCell){t.push([l.row,l.col,l.row2,l.col2]);for(var s=l.col;s<=l.col2;s++)r[s]=l.row2+1;l.col===l.col2||(i=l.col2)}}return t};return FlexGridJsonConverter}(),MultiRowJsonConverter=function(e){__extends(MultiRowJsonConverter,e);function MultiRowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}MultiRowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.rowsPerItem=this.flex.rowsPerItem;return t};MultiRowJsonConverter.prototype._serializePanel=function(t){var r=e.prototype._serializePanel.call(this,t);r.cellGroups=this._serializeCellGroup(t);return r};MultiRowJsonConverter.prototype._serializeCellGroup=function(e){var t=[],r=[],o=softGrid(),n=this.flex.rowsPerItem;e.cellType!==o.CellType.TopLeft&&e.cellType!==o.CellType.ColumnHeader||(n=e.rows.length);for(var i=0;i<n;i++){r[i]=[];for(var l=0;l<e.columns.length;l++){var s=this.flex.getBindingColumn(e,i,l),a=t.indexOf(s);r[i][l]=a<0?t.push(s)-1:a}}return{bindingColumns:this._serializeColumns(t),mappings:r}};return MultiRowJsonConverter}(FlexGridJsonConverter),PivotGridJsonConverter=function(e){__extends(PivotGridJsonConverter,e);function PivotGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}PivotGridJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.centerHeadersVertically=this.flex.centerHeadersVertically;return t};return PivotGridJsonConverter}(FlexGridJsonConverter),TransposedGridJsonConverter=function(e){__extends(TransposedGridJsonConverter,e);function TransposedGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedGridJsonConverter.prototype.convert=function(){for(var t=e.prototype.convert.call(this),r=new Array(this.flex.cells.rows.length),o=this.flex.cells,n=softGrid(),i=0,l=o.rows.length;i<l;i++){var s=o.rows[i].dataItem,a=s&&s._rowInfo;a instanceof n.Column||(a=_combineColumns(a,a));r[i]=a}t.rowInfo=this._serializeColumns(r);return t};return TransposedGridJsonConverter}(FlexGridJsonConverter),TransposedMultirowJsonConverter=function(e){__extends(TransposedMultirowJsonConverter,e);function TransposedMultirowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultirowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.cellGroups=this._serializeCellGroup();t.columnsPerItem=this.flex.columnsPerItem;return t};TransposedMultirowJsonConverter.prototype._serializeCellGroup=function(){for(var e=[],t=[],r=this.flex.columnsPerItem,o=this.flex.cells,n=0;n<o.rows.length;n++){t[n]=[];for(var i=0;i<r;i++){var l=this.flex.getBindingColumn(o,n,i),s=e.indexOf(l);t[n][i]=s<0?e.push(l)-1:s}}return{bindingColumns:this._serializeColumns(e),mappings:t}};return TransposedMultirowJsonConverter}(FlexGridJsonConverter),RowJson=function(){function RowJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.alignment=e.alignment;this.level=e.level;this.renderHeight=e.renderHeight;this.cells=e.cells;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this.errors=e.errors;this._state=e.state}Object.defineProperty(RowJson.prototype,"isAlternatingRow",{get:function(){return(this._state&RowState.Alternate)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isGroupRow",{get:function(){return(this._state&RowState.Group)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isDetailRow",{get:function(){return(this._state&RowState.Detail)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isExpandableGroupRow",{get:function(){return(this._state&RowState.ExpandableGroup)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isNewRow",{get:function(){return(this._state&RowState.New)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isVisible",{get:function(){return(this._state&RowState.Visible)!==RowState.None},enumerable:!0,configurable:!0});return RowJson}(),ColumnJson=function(){function ColumnJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.aggregate=e.aggregate;this.name=e.name;this.renderWidth=e.renderWidth;this.visibleIndex=e.visibleIndex;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this._alignment=e.alignment;this._state=e.state}ColumnJson.prototype.getAlignment=function(e){return this._alignment?this._alignment:e&&e.alignment?e.alignment:""};Object.defineProperty(ColumnJson.prototype,"isVisible",{get:function(){return(this._state&ColState.Visible)!==ColState.None},enumerable:!0,configurable:!0});return ColumnJson}(),RowJsonCollection=function RowJsonCollection(e,t){void 0===t&&(t=-1);this.maxGroupLevel=t;this.length=e.length;for(var r=0;r<e.length;r++)this[r]=new RowJson(e[r],r)},ColumnJsonCollection=function ColumnJsonCollection(e,t){void 0===t&&(t=-1);this.firstVisibleIndex=t;this.length=e.length;for(var r=0;r<e.length;r++){var o=e[r];this[r]=o?new ColumnJson(e[r],r):null}},GridJsonPanel=function(){function GridJsonPanel(e){this.height=e.height;this.width=e.width;this.cellType=e.cellType;this.columns=new ColumnJsonCollection(e.columns,e.columnsFirstVisibleIndex);this.rows=new RowJsonCollection(e.rows,e.rowsMaxGroupLevel);this._mergedRanges=this._deserializeMergedRanges(e.mergedRanges)}GridJsonPanel.prototype.getCellData=function(e,t){return this.rows[e].cells[t]};GridJsonPanel.prototype.getMergedRange=function(e,t){var r=this._mergedRanges[e];if(r)for(var o=0,n=r.length;o<n;o++){var i=r[o];if(t>=i.col&&t<=i.col2)return i}return null};GridJsonPanel.prototype._deserializeMergedRanges=function(e){var t=[];e=e||[];for(var r=0,o=this.rows.length;r<o;r++)t[r]=[];for(r=0,o=e.length;r<o;r++)for(var n=e[r],i=new _CellRange(n[0],n[1],n[2],n[3]),l=i.row;l<=i.row2;l++)t[l].push(i);return t};return GridJsonPanel}(),FlexGridJsonAdapter=function(){function FlexGridJsonAdapter(e,t){this.settings=t;this.bottomLeftCells=this.deserializePanel(e.bottomLeftCells);this.cells=this.deserializePanel(e.cells);this.columnFooters=this.deserializePanel(e.columnFooters);this.columnHeaders=this.deserializePanel(e.columnHeaders);this.rowHeaders=this.deserializePanel(e.rowHeaders);this.topLeftCells=this.deserializePanel(e.topLeftCells);this.treeIndent=e.treeIndent;this.showColumnFooter=e.showColumnFooter;this.showColumnHeader=e.showColumnHeader;this.showRowHeader=e.showRowHeader;this._selection=[];for(var r=0;r<e.selection.length;r++){var o=e.selection[r];this._selection.push(new _CellRange(o[0],o[1],o[2],o[3]))}}Object.defineProperty(FlexGridJsonAdapter.prototype,"columns",{get:function(){return this.cells.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonAdapter.prototype,"rows",{get:function(){return this.cells.rows},enumerable:!0,configurable:!0});FlexGridJsonAdapter.prototype.getSelection=function(){return this._selection};FlexGridJsonAdapter.prototype.getCell=function(e,t,r,o){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedDefBorderColor=function(){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedStyle=function(e,t){throw"Not implemented"};FlexGridJsonAdapter.prototype.getMergedRange=function(e,t,r){return e.getMergedRange(t,r)};FlexGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridJsonAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r)};FlexGridJsonAdapter.prototype.getCellContent=function(e,t,r,o){return this.getCellData(e,t.index,o)};FlexGridJsonAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===_CellType.Cell&&!this.isExpandableGroupRow(t)};FlexGridJsonAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridJsonAdapter.prototype.isAlternatingRow=function(e){return e.isAlternatingRow};FlexGridJsonAdapter.prototype.isGroupRow=function(e){return e.isGroupRow};FlexGridJsonAdapter.prototype.isNewRow=function(e){return e.isNewRow};FlexGridJsonAdapter.prototype.isDetailRow=function(e){return e.isDetailRow};FlexGridJsonAdapter.prototype.isExpandableGroupRow=function(e){return e.isExpandableGroupRow};FlexGridJsonAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridJsonAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridJsonAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle);switch(e.cellType){case _CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case _CellType.ColumnHeader:case _CellType.RowHeader:case _CellType.TopLeft:case _CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case _CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}t.errors&&t.errors[r.index]&&_merge(n,o.errorCellStyle,!0);return n};FlexGridJsonAdapter.prototype.deserializePanel=function(e){return new GridJsonPanel(e)};return FlexGridJsonAdapter}(),PivotGridJsonAdapter=function(e){__extends(PivotGridJsonAdapter,e);function PivotGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._centerHeadersVertically=t.centerHeadersVertically;return o}PivotGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!this._centerHeadersVertically&&(e.cellType===_CellType.ColumnHeader||e.cellType===_CellType.RowHeader)};return PivotGridJsonAdapter}(FlexGridJsonAdapter),MultiRowJsonPanel=function(e){__extends(MultiRowJsonPanel,e);function MultiRowJsonPanel(t){var r=e.call(this,t)||this;t.cellGroups&&(r._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return r}MultiRowJsonPanel.prototype.getColumn=function(e,t,r){var o=this.columns[t];if(this._cellGroups){this.cellType!==_CellType.ColumnHeader&&this.cellType!==_CellType.BottomLeft&&(e%=r);return _combineColumns(o,this._cellGroups.bindingColumns[this._cellGroups.mappings[e][t]])}return o};return MultiRowJsonPanel}(GridJsonPanel),MultiRowJsonAdapter=function(e){__extends(MultiRowJsonAdapter,e);function MultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowsPerItem=t.rowsPerItem;return o}MultiRowJsonAdapter.prototype.deserializePanel=function(e){return new MultiRowJsonPanel(e)};MultiRowJsonAdapter.prototype.getColumn=function(e,t,r){return e.getColumn(t,r,this._rowsPerItem)};return MultiRowJsonAdapter}(FlexGridJsonAdapter),TransposedGridJsonAdapter=function(e){__extends(TransposedGridJsonAdapter,e);function TransposedGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowInfo=new ColumnJsonCollection(t.rowInfo);return o}TransposedGridJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!==_CellType.Cell)return n;var i=this._rowInfo[r];return i?_combineColumns(n,i):n};return TransposedGridJsonAdapter}(FlexGridJsonAdapter),TransposedMultiRowJsonAdapter=function(e){__extends(TransposedMultiRowJsonAdapter,e);function TransposedMultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._columnsPerItem=t.columnsPerItem;t.cellGroups&&(o._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return o}TransposedMultiRowJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(this._cellGroups&&t.cellType===_CellType.Cell){o%=this._columnsPerItem;return _combineColumns(n,this._cellGroups.bindingColumns[this._cellGroups.mappings[r][o]])}return n};return TransposedMultiRowJsonAdapter}(FlexGridJsonAdapter);_registerModule("wijmo.grid.pdf",selfModule);
|
|
14
|
+
var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{asFunction,asType,CancelEventArgs,Color,isFunction,Rect,Size,isObject,assert,asInt,asString,changeType,isArray,isString,DataType,Point,_getModule,removeChild,toPlainText,ControlStateClsNames,clamp,EventArgs,_registerModule}from"@grapecity/wijmo";import*as pdf from"@grapecity/wijmo.pdf";import*as selfModule from"@grapecity/wijmo.grid.pdf";export function softGrid(){return _getModule("wijmo.grid")}export function softDetail(){return _getModule("wijmo.grid.detail")}export function softMultiRow(){return _getModule("wijmo.grid.multirow")}export function softSheet(){return _getModule("wijmo.grid.sheet")}export function softOlap(){return _getModule("wijmo.olap")}export function softTransposed(){return _getModule("wijmo.grid.transposed")}export function softTransposedMultiRow(){return _getModule("wijmo.grid.transposedmultirow")}export var ScaleMode;!function(e){e[e.ActualSize=0]="ActualSize";e[e.PageWidth=1]="PageWidth";e[e.SinglePage=2]="SinglePage"}(ScaleMode||(ScaleMode={}));export var ExportMode;!function(e){e[e.All=0]="All";e[e.Selection=1]="Selection"}(ExportMode||(ExportMode={}));export var _CellType;!function(e){e[e.None=0]="None";e[e.Cell=1]="Cell";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.TopLeft=4]="TopLeft";e[e.ColumnFooter=5]="ColumnFooter";e[e.BottomLeft=6]="BottomLeft"}(_CellType||(_CellType={}));export function _merge(e,t,r){void 0===r&&(r=!1);!e&&t&&(e={});if(t&&e)for(var o in t){var n=t[o],i=e[o];if(isObject(n)){if(void 0===i||!isObject(i)&&r){if(isFunction(n.clone)){e[o]=i=n.clone();continue}e[o]=i={}}isObject(i)&&_merge(e[o],n,r)}else(void 0===i||r&&void 0!==n)&&(e[o]=n)}return e}export function _combineColumns(e,t){return{aggregate:t.aggregate,binding:t.binding,name:t.name,dataType:t.dataType,wordWrap:t.wordWrap,multiLine:t.multiLine,getAlignment:function(e){if("getAlignment"in t)return t.getAlignment(e)},index:e.index,visibleIndex:e.visibleIndex,isVisible:e.isVisible,renderWidth:e.renderWidth}}export function _cloneStyle(e){if(!e)return null;for(var t={},toCamel=function(e){return e.replace(/\-([a-z])/g,(function(e,t,r){return r>0?t.toUpperCase():t}))},r=0,o=e.length;r<o;r++){var n=e[r];t[toCamel(n)]=e.getPropertyValue(n)}return t}var PdfFormatItemEventArgs=function(e){__extends(PdfFormatItemEventArgs,e);function PdfFormatItemEventArgs(t,r,o,n,i,l,s,a,d){var u=e.call(this)||this;u.cancelBorders=!1;u._p=t;u._rng=r;"undefined"!=typeof HTMLElement&&(u._cell=asType(o,HTMLElement,!0));u._canvas=n;u._clientRect=i;u._contentRect=l;u._style=s;u._getFormattedCell=a;u._getTextRect=d;return u}Object.defineProperty(PdfFormatItemEventArgs.prototype,"panel",{get:function(){return this._p},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"row",{get:function(){return this._rng.row},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"col",{get:function(){return this._rng.col},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"canvas",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"clientRect",{get:function(){return this._clientRect},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"contentRect",{get:function(){return this._contentRect},enumerable:!0,configurable:!0});PdfFormatItemEventArgs.prototype.drawBackground=function(e){var t=this.clientRect;e&&t.width>0&&t.height>0&&this.canvas.paths.rect(t.left,t.top,t.width,t.height).fill(e||this.style.backgroundColor)};PdfFormatItemEventArgs.prototype.getFormattedCell=function(){return asFunction(this._getFormattedCell)()};Object.defineProperty(PdfFormatItemEventArgs.prototype,"tagContent",{get:function(){return this._tagContent},set:function(e){this._tagContent=e},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"style",{get:function(){return this._style},enumerable:!0,configurable:!0});Object.defineProperty(PdfFormatItemEventArgs.prototype,"textTop",{get:function(){!this._textRect&&isFunction(this._getTextRect)&&(this._textRect=this._getTextRect());return this._textRect?this._textRect.top:this._contentRect.top},enumerable:!0,configurable:!0});return PdfFormatItemEventArgs}(CancelEventArgs);export{PdfFormatItemEventArgs};var _FlexGridPdfCoreConverter=function(){function _FlexGridPdfCoreConverter(){}_FlexGridPdfCoreConverter.draw=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");null==(i=this._applyDefaultDrawSettings(i)).scaleMode&&(i.scaleMode=null==o?ScaleMode.ActualSize:null==n?ScaleMode.PageWidth:ScaleMode.SinglePage);this._drawInternal(e,t,r,o,n,i)};_FlexGridPdfCoreConverter._applyDefaultDrawSettings=function(e){return _merge(_merge({},e),_FlexGridPdfCoreConverter.DefaultDrawSettings)};_FlexGridPdfCoreConverter._drawInternal=function(e,t,r,o,n,i){var l=null!=r,s=new Size(t.width,t.height);r||(r=new Point(0,t.y));isArray(i.embeddedFonts)&&i.embeddedFonts.forEach((function(e){t.registerFont(e)}));var a=this._getRowsToRender(e,i),d=new FlexGridRenderer(e,i,a,this.BorderWidth,!0),u=new Rect(r.x||0,r.y||0,o||s.width,n||s.height),p=this._getScaleFactor(d,i.scaleMode,u);if(r.y>0&&this._canBreakRows(i.scaleMode)){var c=a.find(e.cells,(function(e){return d.isRenderableRow(e)}));if(c){var f=(u.height-u.top)*(1/p);if((d.showColumnHeader?pdf.pxToPt(e.columnHeaders.height):0)+pdf.pxToPt(c.renderHeight)-this.BorderWidth>f){t.addPage();u=new Rect(r.x||0,0,o||s.width,n||s.height)}}}var h=this._getPages(d,a,u,i,l,p),g=(i.progress?this._getCellsCount(e,i,h):0)/i._progressMax,_=0,w=0,C=i.progress?function(){if(++_-w>=50){w=_;i.progress(_/g)}}:null;i.progress&&i.progress(0);for(var m=0;m<h.length;m++){m>0&&t.addPage();var b=h[m],R=0===b.pageCol?u.left:0,y=0===b.pageRow?u.top:0;t.saveState();t.paths.rect(0,0,t._widthCtm,t._heightCtm).clip();t.scale(p,p,new Point(R,y));t.translate(R,y);var x=new FlexGridRenderer(e,i,b.range,this.BorderWidth,m===h.length-1);x.render(t,C);t.restoreState();t.x=R;t.y=y+x.renderSize.height*p}i.progress&&0<i._progressMax&&i.progress(i._progressMax)};_FlexGridPdfCoreConverter._getCellsCount=function(e,t,r){for(var o=0,n=0;n<r.length;n++){o+=new FlexGridRenderer(e,t,r[n].range,0,!1).getCellsCount()}return o};_FlexGridPdfCoreConverter._getRowsToRender=function(e,t){var r=[];t.exportMode==ExportMode.All?r.push(new _CellRange(0,0,e.rows.length-1,e.columns.length-1)):r=e.getSelection();var o=new RowRange(r);if(o.isValid&&!t.drawDetailRows){var n=[];o.forEach(e.cells,(function(t,r,o){if(!e.isDetailRow(t)){var i=n.length;i&&n[i-1].bottomRow+1===o?n[i-1].row2++:n.push(new _CellRange(o,r.col,o,r.col2))}}));o=new RowRange(n)}return o};_FlexGridPdfCoreConverter._getScaleFactor=function(e,t,r){var o=1;if(t==ScaleMode.ActualSize)return o;var n=e.renderSize;if(t==ScaleMode.SinglePage){(i=Math.min(r.width/n.width,r.height/n.height))<1&&(o=i)}else{var i;(i=r.width/n.width)<1&&(o=i)}return o};_FlexGridPdfCoreConverter._canBreakRows=function(e){return e==ScaleMode.ActualSize||e==ScaleMode.PageWidth};_FlexGridPdfCoreConverter._getPages=function(e,t,r,o,n,i){var l=this,s=[],a=[],d=pdf.pxToPt,u=e.flex,p=e.showColumnHeader,c=e.showColumnFooter,f=e.showRowHeader,h=p?d(u.columnHeaders.height):0,g=c?d(u.columnFooters.height):0,_=f?d(u.rowHeaders.width):0,w=this._canBreakRows(o.scaleMode),C=o.scaleMode==ScaleMode.ActualSize,m=(r.width-r.left)*(1/i),b=(r.height-r.top)*(1/i),R=r.width*(1/i),y=r.height*(1/i),x=h,v=_,P=n&&o.scaleMode==ScaleMode.ActualSize,S=b;if(w){var G=0,T=0;t.forEach(u.cells,(function(t,r,o,n){S=s.length?y:b;if(e.isRenderableRow(t)){var i=d(t.renderHeight)+1;G++;x+=i;(p||G>1)&&(x-=l.BorderWidth);if(x>S){if(P||h+i>S&&0===T){s.push(n);x=h}else{s.push(n-1);x=h+i}T=0;p&&(x-=l.BorderWidth)}else T++}}))}var F=Math.max(t.length()-1,0);s.length&&s[s.length-1]===F||s.push(F);c&&x+g>S&&s.push(-1);if(C)for(var A=0,M=t.leftCol;M<=t.rightCol;M++){var W=u.columns[M];if(e.isRenderableColumn(W)){var J=d(W.renderWidth),E=a.length?R:m;A++;v+=J;(f||A>1)&&(v-=this.BorderWidth);if(v>E){if(_+J>E||P){a.push(M);v=_}else{a.push(M-1);v=_+J}f&&(v-=this.BorderWidth)}}}a.length&&a[a.length-1]===t.rightCol||a.push(t.rightCol);var H=[],z=!1,O=1,L=n&&o.maxPages>0?1:o.maxPages;for(M=0;M<s.length&&!z;M++)for(var j=0;j<a.length&&!z;j++,O++)if(!(z=O>L)){var D=0===M?0:s[M-1]+1,k=0===j?t.leftCol:a[j-1]+1,B=-1===s[M]?new RowRange([new _CellRange(-1,k,-1,a[j])]):t.subrange(D,s[M]-D+1,k,a[j]);H.push(new PdfPageRowRange(B,j,M))}return H};_FlexGridPdfCoreConverter.BorderWidth=1;_FlexGridPdfCoreConverter.DefFont=new pdf.PdfFont;_FlexGridPdfCoreConverter.DefaultDrawSettings={customCellContent:!1,drawDetailRows:!1,exportMode:ExportMode.All,maxPages:Number.MAX_VALUE,repeatMergedValuesAcrossPages:!0,recalculateStarWidths:!0,styles:{cellStyle:{font:{family:_FlexGridPdfCoreConverter.DefFont.family,size:_FlexGridPdfCoreConverter.DefFont.size,style:_FlexGridPdfCoreConverter.DefFont.style,weight:_FlexGridPdfCoreConverter.DefFont.weight},padding:1.5,verticalAlign:"middle"},headerCellStyle:{font:{weight:"bold"}}},quickCellStyles:!0,_progressMax:1};return _FlexGridPdfCoreConverter}();export{_FlexGridPdfCoreConverter};var FlexGridRenderer=function(){function FlexGridRenderer(e,t,r,o,n){this._flex=e;this._borderWidth=o;this._lastPage=n;this._settings=t||{};this._topLeft=new PanelSectionRenderer(this,e.topLeftCells,this.showRowHeader&&this.showColumnHeader?new RowRange([new _CellRange(0,0,e.topLeftCells.rows.length-1,e.topLeftCells.columns.length-1)]):new RowRange([]),o);this._rowHeader=new PanelSectionRenderer(this,e.rowHeaders,this.showRowHeader?r.clone(0,e.rowHeaders.columns.length-1):new RowRange([]),o);this._columnHeader=new PanelSectionRenderer(this,e.columnHeaders,this.showColumnHeader?new RowRange([new _CellRange(0,r.leftCol,e.columnHeaders.rows.length-1,r.rightCol)]):new RowRange([]),o);this._cells=new PanelSectionRenderer(this,e.cells,r,o);this._bottomLeft=new PanelSectionRenderer(this,e.bottomLeftCells,this.showRowHeader&&this.showColumnFooter?new RowRange([new _CellRange(0,0,e.bottomLeftCells.rows.length-1,e.bottomLeftCells.columns.length-1)]):new RowRange([]),o);this._columnFooter=new PanelSectionRenderer(this,e.columnFooters,this.showColumnFooter?new RowRange([new _CellRange(0,r.leftCol,e.columnFooters.rows.length-1,r.rightCol)]):new RowRange([]),o)}Object.defineProperty(FlexGridRenderer.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.isRenderableRow=function(e){return this._flex.isRenderableRow(e)};FlexGridRenderer.prototype.isRenderableColumn=function(e){return this._flex.isRenderableColumn(e)};FlexGridRenderer.prototype.getCellsCount=function(){return this._topLeft.getCellsCount()+this._rowHeader.getCellsCount()+this._columnHeader.getCellsCount()+this._cells.getCellsCount()+this._bottomLeft.getCellsCount()+this._columnFooter.getCellsCount()};FlexGridRenderer.prototype.render=function(e,t){var r,o,n,i;if(e.tagged){r=o=n=i=new TrStructCache(e,e.tag(pdf.PdfTagType.Table));e.addTag(r.el);if(e.version>=pdf.PdfVersion.v1_5){r.el.add((o=new TrStructCache(e,e.tag(pdf.PdfTagType.THead))).el);r.el.add((n=new TrStructCache(e,e.tag(pdf.PdfTagType.TBody))).el);r.el.add((i=new TrStructCache(e,e.tag(pdf.PdfTagType.TFoot))).el)}}var l=Math.max(0,Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)-this._borderWidth),s=Math.max(0,Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)-this._borderWidth);this._topLeft.render(e,0,0,t,o);this._rowHeader.render(e,0,s,t,n);this._columnHeader.render(e,l,0,t,o);this._cells.render(e,l,s,t,n);s+=Math.max(0,this._cells.renderSize.height-this._borderWidth);this._bottomLeft.render(e,0,s,t,i);this._columnFooter.render(e,l,s,t,i)};Object.defineProperty(FlexGridRenderer.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"renderSize",{get:function(){var e=Math.max(this._topLeft.renderSize.height,this._columnHeader.renderSize.height)+Math.max(this._rowHeader.renderSize.height,this._cells.renderSize.height)+Math.max(this._bottomLeft.renderSize.height,this._columnFooter.renderSize.height),t=Math.max(this._topLeft.renderSize.width,this._rowHeader.renderSize.width)+Math.max(this._columnHeader.renderSize.width,this._cells.renderSize.width);this._columnHeader.renderableRowsCount>0&&(e-=this._borderWidth);this._columnFooter.renderableRowsCount>0&&(e-=this._borderWidth);this._rowHeader.renderableColumnsCount>0&&(t-=this._borderWidth);return new Size(t,e)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnHeader",{get:function(){return this._flex.showColumnHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showRowHeader",{get:function(){return this._flex.showRowHeader},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridRenderer.prototype,"showColumnFooter",{get:function(){return this._lastPage&&this._flex.showColumnFooter},enumerable:!0,configurable:!0});FlexGridRenderer.prototype.alignMergedTextToTheTopRow=function(e){return this._flex.alignMergedTextToTheTopRow(e)};FlexGridRenderer.prototype.getColumn=function(e,t,r){return this._flex.getColumn(e,t,r)};FlexGridRenderer.prototype.isAlternatingRow=function(e){return this._flex.isAlternatingRow(e)};FlexGridRenderer.prototype.isGroupRow=function(e){return this._flex.isGroupRow(e)};FlexGridRenderer.prototype.isNewRow=function(e){return this._flex.isNewRow(e)};FlexGridRenderer.prototype.isExpandableGroupRow=function(e){return this._flex.isExpandableGroupRow(e)};FlexGridRenderer.prototype.isBooleanCell=function(e,t,r){return this._flex.isBooleanCell(e,t,r)};FlexGridRenderer.prototype.getCellStyle=function(e,t,r){return this._flex.getCellStyle(e,t,r)};return FlexGridRenderer}(),PanelSection=function(){function PanelSection(e,t,r){this._flex=e;this._panel=t;this._range=r.clone()}Object.defineProperty(PanelSection.prototype,"renderableRowsCount",{get:function(){var e=this;if(null==this._renderableRowsCnt){this._renderableRowsCnt=0;this._range.forEach(this._panel,(function(t){e._flex.isRenderableRow(t)&&e._renderableRowsCnt++}))}return this._renderableRowsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"renderableColumnsCount",{get:function(){if(null==this._renderableColumnsCnt){this._renderableColumnsCnt=0;if(this._range.isValid)for(var e=this._range.leftCol;e<=this._range.rightCol;e++)this._flex.isRenderableColumn(this._panel.columns[e])&&this._renderableColumnsCnt++}return this._renderableColumnsCnt},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"size",{get:function(){if(null==this._size){var e=this._range.getRenderSize(this._flex,this._panel);this._size=new Size(pdf.pxToPt(e.width),pdf.pxToPt(e.height))}return this._size},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PanelSection.prototype,"panel",{get:function(){return this._panel},enumerable:!0,configurable:!0});return PanelSection}(),PanelSectionRenderer=function(e){__extends(PanelSectionRenderer,e);function PanelSectionRenderer(t,r,o,n){var i=e.call(this,t.flex,r,o)||this;i._gr=t;i._borderWidth=n;return i}Object.defineProperty(PanelSectionRenderer.prototype,"gr",{get:function(){return this._gr},enumerable:!0,configurable:!0});Object.defineProperty(PanelSectionRenderer.prototype,"renderSize",{get:function(){if(null==this._renderSize){this._renderSize=this.size.clone();this.renderableColumnsCount>1&&(this._renderSize.width-=this._borderWidth*(this.renderableColumnsCount-1));this.renderableRowsCount>1&&(this._renderSize.height-=this._borderWidth*(this.renderableRowsCount-1))}return this._renderSize},enumerable:!0,configurable:!0});PanelSectionRenderer.prototype._getRangeWidth=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.columns[i];if(this._gr.isRenderableColumn(l)){o++;r+=l.renderWidth}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype._getRangeHeight=function(e,t){for(var r=0,o=0,n=this.panel,i=e;i<=t;i++){var l=n.rows[i];if(this._gr.isRenderableRow(l)){o++;r+=l.renderHeight}}r=pdf.pxToPt(r);o>1&&(r-=this._borderWidth*(o-1));return r};PanelSectionRenderer.prototype.getCellsCount=function(){var e=this,t=0,r=this.range,o=this.panel,n=new GetMergedRangeProxy(this._gr.flex);if(!r.isValid)return t;r.forEach(o,(function(i,l,s){if(e._gr.isRenderableRow(i))for(var a=r.leftCol;a<=r.rightCol;a++)if(e._gr.isRenderableColumn(o.columns[a])){var d=!1,u=void 0,p=n.getMergedRange(o,s,a);if(p){var c=s===p.firstVisibleRow,f=a===p.leftCol,h=s===l.topRow,g=a===l.leftCol,_=p.rowSpan>1,w=p.columnSpan>1;if(_&&w&&(c&&f||h&&g)||_&&!w&&(c||h)||!_&&w&&(f||g)){d=!0;w&&(u=Math.min(r.rightCol,p.rightCol))}}else d=!0;d&&t++;u&&(a=u)}}));return t};PanelSectionRenderer.prototype.render=function(e,t,r,o,n){var i=this,l=this.range;if(l.isValid){for(var s={},a=this.panel,d=new GetMergedRangeProxy(this._gr.flex),u=new _CellRangeExt(a,0,0,0,0),p=new _CellRenderer(this,e,this._borderWidth),c=l.leftCol;c<=l.rightCol;c++)s[c]=r;l.forEach(a,(function(r,c,f){if(i._gr.isRenderableRow(r))for(var h=n?n.getTR(f,a.cellType):null,g=t,_=l.leftCol;_<=l.rightCol;_++){var w=i.gr.getColumn(a,f,_);if(i._gr.isRenderableColumn(w)){var C,m=void 0,b=void 0,R=!1,y=void 0,x=i._gr.flex.getCellContent(i.panel,r,w,_),v=d.getMergedRange(a,f,_);if(v){if(f>=v.topRow){u.copyFrom(v);var P=f===v.firstVisibleRow,S=_===v.leftCol,G=f===c.topRow,T=_===c.leftCol,F=v.rowSpan>1,A=v.columnSpan>1;if(F&&A&&(P&&S||G&&T)||F&&!A&&(P||G)||!F&&A&&(S||T)){R=!0;C=P&&S||i.gr.settings.repeatMergedValuesAcrossPages?x:"";m=F?i._getRangeHeight(f,Math.min(v.bottomRow,c.bottomRow)):i._getRangeHeight(f,f);if(A){b=i._getRangeWidth(Math.max(l.leftCol,v.leftCol),Math.min(l.rightCol,v.rightCol));y=Math.min(l.rightCol,v.rightCol);for(var M=_+1;M<=y;M++)s[M]+=m-i._borderWidth}}}else m=i._getRangeHeight(f,f);null==b&&(b=i._getRangeWidth(_,_))}else{u.setRange(f,_,f,_);R=!0;C=x;m=i._getRangeHeight(f,f);b=i._getRangeWidth(_,_)}if(R&&b>0&&m>0){var W=p.renderCell(C,r,w,u,new Rect(g,s[_],b,m));if(h){var J=e.tag(a.cellType===_CellType.ColumnHeader||a.cellType==_CellType.TopLeft?pdf.PdfTagType.TH:pdf.PdfTagType.TD);W&&J.add(W);h.add(J)}o&&o()}m&&(s[_]+=m-i._borderWidth);b&&(g+=b-i._borderWidth);y&&(_=y)}}}))}};return PanelSectionRenderer}(PanelSection),TrStructCache=function(){function TrStructCache(e,t){this.doc=e;this.tableSection=t;this._trh=[];this._trb=[];this._trf=[]}Object.defineProperty(TrStructCache.prototype,"el",{get:function(){return this.tableSection},enumerable:!0,configurable:!0});TrStructCache.prototype.getTR=function(e,t){var r=t===_CellType.TopLeft||t===_CellType.ColumnHeader?this._trh:t===_CellType.RowHeader||t===_CellType.Cell?this._trb:this._trf,o=r[e];o||this.tableSection.add(r[e]=o=this.doc.tag(pdf.PdfTagType.TR));return o};return TrStructCache}(),_CellRenderer=function(){function _CellRenderer(e,t,r){this.InvisiblePen=new pdf.PdfPen(Color.fromRgba(0,0,0,0),0);this._pr=e;this._area=t;this._borderWidth=r}_CellRenderer.prototype.renderCell=function(e,t,r,o,n){var i,l=this,s=this._pr.gr.flex,a=this._pr.panel,getGridCell=function(e){return s.getCell(a,o.topRow,o.leftCol,e)},d=null,u=this._pr.gr.getCellStyle(a,t,r),p=this._pr.gr.settings.customCellContent,c=isFunction(this._pr.gr.settings.formatItem);if(p){var f=s.getComputedStyle(a,d=getGridCell(c));u.color=f.color;u.backgroundColor=f.backgroundColor;var h=s.getComputedDefBorderColor();u.borderLeftColor="none"!=f.borderLeftStyle?f.borderLeftColor:h;u.borderRightColor="none"!=f.borderRightStyle?f.borderRightColor:h;u.borderTopColor="none"!=f.borderTopStyle?f.borderTopColor:h;u.borderBottomColor="none"!=f.borderBottomStyle?f.borderBottomColor:h;u.font=new pdf.PdfFont(f.fontFamily,pdf._asPt(f.fontSize,!0,void 0),f.fontStyle,f.fontWeight);u.textAlign=f.textAlign}if(u.font&&!(u.font instanceof pdf.PdfFont)){var g=u.font;u.font=new pdf.PdfFont(g.family,g.size,g.style,g.weight)}u.boxSizing="border-box";u.borderWidth=this._borderWidth;u.borderStyle="solid";p||this._pr.gr.isExpandableGroupRow(t)&&0===r.visibleIndex||(u.textAlign=r.getAlignment(t));if(a.cellType===_CellType.Cell&&s.rows.maxGroupLevel>=0&&o.leftCol===s.columns.firstVisibleIndex){var _=s.isGroupRow(t)?Math.max(t.level,0):s.rows.maxGroupLevel+1,w=pdf._asPt(u.paddingLeft||u.padding),C=pdf.pxToPt(_*s.treeIndent);u.paddingLeft=w+C}var m,b=this._measureCell(e,a,t,r,u,n),R=o.rowSpan>1&&o.visibleRowsCount>1&&this._pr.gr.alignMergedTextToTheTopRow(a)?new Rect(b.contentRect.left,b.contentRect.top,b.contentRect.width,b.contentRect.height/(o.visibleRowsCount||1)):b.contentRect,y=!0,x=!0;if(c){(i=new PdfFormatItemEventArgs(a,o,d,this._area,b.rect,b.contentRect,u,(function(){return d||getGridCell(!0)}),(function(){return b.textRect=l._calculateTextRect(e,a,t,r,R,u)}))).data=e;this._pr.gr.settings.formatItem(i);if(i.data!==e){e=asString(i.data);b.textRect=null}y=!i.cancel;x=!i.cancelBorders;m=i.tagContent}y&&!b.textRect&&(b.textRect=this._calculateTextRect(e,a,t,r,R,u));return this._renderCell(e,t,r,o,b,u,y,x,null==m)||m};_CellRenderer.prototype._renderCell=function(e,t,r,o,n,i,l,s,a){if(l||s){var d,u=this._area.document.tagged,p=this._area.document;u&&p.beginArtifact({type:pdf.PdfArtifactType.Layout});this._renderEmptyCell(n,i,l,s);u&&p.endArtifact();if(l){a=!0===u&&!0===a;var c=void 0;if(this._isBooleanCellAndValue(e,this._pr.panel,t,r)){if(a){d=p.tag(pdf.PdfTagType.Span,null,{actual:e.toString()});c=p.beginTagContent(pdf.PdfTagType.Span)}this._renderBooleanCell(e,n,i)}else{if(a){d=p.tag(pdf.PdfTagType.P);c=p.beginTagContent(pdf.PdfTagType.P)}this._renderTextCell(e,n,i)}if(a){p.endTagContent();d.add(c)}}return d}};_CellRenderer.prototype._isBooleanCellAndValue=function(e,t,r,o){return this._pr.gr.isBooleanCell(t,r,o)&&this._isBoolean(e)};_CellRenderer.prototype._isBoolean=function(e){var t=isString(e)&&e.toLowerCase();return"true"===t||"false"===t||!0===e||!1===e};_CellRenderer.prototype._measureCell=function(e,t,r,o,n,i){this._decompositeStyle(n);var l=i.left,s=i.top,a=i.height,d=i.width,u=this._parseBorder(n),p=u.left.width,c=u.top.width,f=u.bottom.width,h=u.right.width,g=this._parsePadding(n),_=0,w=0,C=0,m=0;if("content-box"===n.boxSizing||void 0===n.boxSizing){_=g.top+a+g.bottom;w=g.left+d+g.right;C=a;m=d}else{if("border-box"!==n.boxSizing)throw"Invalid value: "+n.boxSizing;if(pdf._IE&&n instanceof CSSStyleDeclaration){_=g.top+g.bottom+a;w=g.left+g.right+d}else{_=Math.max(a-c-f,0);w=Math.max(d-p-h,0)}C=Math.max(_-g.top-g.bottom,0);m=Math.max(w-g.left-g.right,0)}return{rect:i=new Rect(l,s,d,a),clientRect:new Rect(l+p,s+c,w,_),contentRect:new Rect(l+p+g.left,s+c+g.top,m,C),textRect:null}};_CellRenderer.prototype._decompositeStyle=function(e){if(e){var t;if(t=e.borderColor){e.borderLeftColor||(e.borderLeftColor=t);e.borderRightColor||(e.borderRightColor=t);e.borderTopColor||(e.borderTopColor=t);e.borderBottomColor||(e.borderBottomColor=t)}if(t=e.borderWidth){e.borderLeftWidth||(e.borderLeftWidth=t);e.borderRightWidth||(e.borderRightWidth=t);e.borderTopWidth||(e.borderTopWidth=t);e.borderBottomWidth||(e.borderBottomWidth=t)}if(t=e.borderStyle){e.borderLeftStyle||(e.borderLeftStyle=t);e.borderRightStyle||(e.borderRightStyle=t);e.borderTopStyle||(e.borderTopStyle=t);e.borderBottomStyle||(e.borderBottomStyle=t)}if(t=e.padding){e.paddingLeft||(e.paddingLeft=t);e.paddingRight||(e.paddingRight=t);e.paddingTop||(e.paddingTop=t);e.paddingBottom||(e.paddingBottom=t)}}};_CellRenderer.prototype._parseBorder=function(e){var t={left:{width:0},top:{width:0},bottom:{width:0},right:{width:0}};"none"!==e.borderLeftStyle&&(t.left={width:pdf._asPt(e.borderLeftWidth),style:e.borderLeftStyle,color:e.borderLeftColor});"none"!==e.borderTopStyle&&(t.top={width:pdf._asPt(e.borderTopWidth),style:e.borderTopStyle,color:e.borderTopColor});"none"!==e.borderBottomStyle&&(t.bottom={width:pdf._asPt(e.borderBottomWidth),style:e.borderBottomStyle,color:e.borderBottomColor});"none"!==e.borderRightStyle&&(t.right={width:pdf._asPt(e.borderRightWidth),style:e.borderRightStyle,color:e.borderRightColor});return t};_CellRenderer.prototype._parsePadding=function(e){return{left:pdf._asPt(e.paddingLeft),top:pdf._asPt(e.paddingTop),bottom:pdf._asPt(e.paddingBottom),right:pdf._asPt(e.paddingRight)}};_CellRenderer.prototype._renderEmptyCell=function(e,t,r,o){var n=e.rect.left,i=e.rect.top,l=e.clientRect.width,s=e.clientRect.height,a=e.clientRect.left-e.rect.left,d=e.clientRect.top-e.rect.top,u=e.rect.top+e.rect.height-(e.clientRect.top+e.clientRect.height),p=e.rect.left+e.rect.width-(e.clientRect.left+e.clientRect.width);r=r&&t.backgroundColor&&l>0&&s>0;if(o&&(a||p||u||d)){var c=t.borderLeftColor||t.borderColor,f=t.borderRightColor||t.borderColor,h=t.borderTopColor||t.borderColor,g=t.borderBottomColor||t.borderColor;if(a&&d&&u&&p&&a===p&&a===u&&a===d&&c===f&&c===g&&c===h){var _=a,w=_/2,C=this._area.paths.rect(n+w,i+w,l+_,s+_);if(r){C.fillAndStroke(t.backgroundColor,new pdf.PdfPen(c,_));return}C.stroke(new pdf.PdfPen(c,_))}else{a&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a,i+d+s],[n,i+d+s+u]]).fill(c);d&&this._area.paths.polygon([[n,i],[n+a,i+d],[n+a+l,i+d],[n+a+l+p,i]]).fill(h);p&&this._area.paths.polygon([[n+a+l+p,i],[n+a+l,i+d],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(f);u&&this._area.paths.polygon([[n,i+d+s+u],[n+a,i+d+s],[n+a+l,i+d+s],[n+a+l+p,i+d+s+u]]).fill(g)}}r&&this._area.paths.rect(e.clientRect.left,e.clientRect.top,e.clientRect.width,e.clientRect.height).fillAndStroke(t.backgroundColor,this.InvisiblePen)};_CellRenderer.prototype._renderBooleanCell=function(e,t,r){if(!(!t.textRect||t.textRect.height<=0||t.textRect.width<=0)){var o=t.textRect.left,n=t.textRect.top,i=t.textRect.height;this._area.paths.rect(o,n,i,i).fillAndStroke(Color.fromRgba(255,255,255),new pdf.PdfPen(void 0,.5));if(!0===changeType(e,DataType.Boolean,"")){var l=i/20,s=i-.5-2*l,a=i/8;this._area.document.saveState();this._area.translate(o+.25+l,n+.25+l).paths.moveTo(a/2,.6*s).lineTo(s-.6*s,s-a).lineTo(s-a/2,a/2).stroke(new pdf.PdfPen(void 0,a));this._area.document.restoreState()}}};_CellRenderer.prototype._renderTextCell=function(e,t,r){!e||!t.textRect||t.textRect.height<=0||t.textRect.width<=0||this._area.drawText(e,t.textRect.left,t.textRect.top,{brush:r.color,font:r.font,height:t.textRect.height,width:t.textRect.width,align:"center"===r.textAlign?pdf.PdfTextHorizontalAlign.Center:"right"===r.textAlign?pdf.PdfTextHorizontalAlign.Right:"justify"===r.textAlign?pdf.PdfTextHorizontalAlign.Justify:pdf.PdfTextHorizontalAlign.Left})};_CellRenderer.prototype._calculateTextRect=function(e,t,r,o,n,i){if(null!=e&&!isString(e))return null;var l=n.clone();if(this._isBooleanCellAndValue(e,t,r,o)){var s=this._getTextLineHeight(i.font);switch(i.verticalAlign){case"middle":l.top=n.top+n.height/2-s/2;break;case"bottom":l.top=n.top+n.height-s}switch(i.textAlign){case"justify":case"center":l.left=n.left+n.width/2-s/2;break;case"right":l.left=n.left+n.width-s}l.height=l.width=s}else if(l.height>0&&l.width>0)switch(i.verticalAlign){case"bottom":if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height-d.size.height-a;l.height=d.size.height}break;case"middle":var d;if((d=this._area.measureText(e,i.font,{height:l.height,width:l.width})).size.height<l.height){var u;a=(u=this._area.document._document).currentLineHeight(!0)-u.currentLineHeight(!1);l.top+=l.height/2-(d.size.height-a)/2;l.height=d.size.height}}return l};_CellRenderer.prototype._getTextLineHeight=function(e){return this._area.lineHeight(e)};return _CellRenderer}();export{_CellRenderer};var GetMergedRangeProxy=function(){function GetMergedRangeProxy(e){this._columns={};this._flex=e}GetMergedRangeProxy.prototype.getMergedRange=function(e,t,r){var o=this._columns[r];if(o&&t>=o.topRow&&t<=o.bottomRow)return o;var n=this._flex.getMergedRange(e,t,r),i=e.columns,l=e.rows;if(n&&!n.isSingleCell&&(!i[n.col].isVisible||!i[n.col2].isVisible||!l[n.row].isVisible||!l[n.row2].isVisible)){n=n.clone();for(;n.col<n.col2&&!i[n.col].isVisible;)n.col++;for(;n.col2>n.col&&!i[n.col2].isVisible;)n.col2--;for(;n.row<n.row2&&!l[n.row].isVisible;)n.row++;for(;n.row2>n.row&&!l[n.row2].isVisible;)n.row2--}n&&n.isSingleCell&&(n=null);return this._columns[r]=n?new _CellRangeExt(e,n):null};return GetMergedRangeProxy}(),_CellRange=function(){function _CellRange(e,t,r,o){if("number"==typeof e){this._row=e;this._col=t;this._row2=r;this._col2=o}else{this._row=e.row;this._col=e.col;this._row2=e.row2;this._col2=e.col2}(this._row<0||this._row2<0)&&(this._row=this._row2=-1);(this._col<0||this._col2<0)&&(this._col=this._col2=-1)}Object.defineProperty(_CellRange.prototype,"row",{get:function(){return this._row},set:function(e){this._row=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col",{get:function(){return this._col},set:function(e){this._col=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"row2",{get:function(){return this._row2},set:function(e){this._row2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"col2",{get:function(){return this._col2},set:function(e){this._col2=e},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"topRow",{get:function(){return Math.min(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"bottomRow",{get:function(){return Math.max(this._row,this._row2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"leftCol",{get:function(){return Math.min(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rightCol",{get:function(){return Math.max(this._col,this._col2)},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"columnSpan",{get:function(){return Math.abs(this._col2-this._col)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"rowSpan",{get:function(){return Math.abs(this._row2-this._row)+1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isValid",{get:function(){return this._row>-1&&this._col>-1&&this._row2>-1&&this._col2>-1},enumerable:!0,configurable:!0});Object.defineProperty(_CellRange.prototype,"isSingleCell",{get:function(){return this._row===this._row2&&this._col===this._col2},enumerable:!0,configurable:!0});_CellRange.prototype.copyFrom=function(e){this.setRange(e.row,e.col,e.row2,e.col2)};_CellRange.prototype.clone=function(){return new _CellRange(this._row,this._col,this._row2,this._col2)};_CellRange.prototype.getRenderSize=function(e,t){var r=new Size(0,0);if(this.isValid){for(var o=this.topRow;o<=this.bottomRow;o++){var n=t.rows[o];e.isRenderableRow(n)&&(r.height+=n.renderHeight)}for(var i=this.leftCol;i<=this.rightCol;i++){var l=t.columns[i];e.isRenderableColumn(l)&&(r.width+=l.renderWidth)}}return r};_CellRange.prototype.setRange=function(e,t,r,o){void 0===e&&(e=-1);void 0===t&&(t=-1);void 0===r&&(r=e);void 0===o&&(o=t);this._row=asInt(e);this._col=asInt(t);this._row2=asInt(r);this._col2=asInt(o)};return _CellRange}();export{_CellRange};var _CellRangeExt=function(e){__extends(_CellRangeExt,e);function _CellRangeExt(t,r,o,n,i){var l=e.call(this,r,o,n,i)||this;l.firstVisibleRow=-1;l.visibleRowsCount=0;if(t){var s=l.topRow,a=l.bottomRow,d=t.rows.length;if(d>0)for(var u=s;u<=a&&u<d;u++)if(t.rows[u].isVisible){l.firstVisibleRow<0&&(l.firstVisibleRow=u);l.visibleRowsCount++}}return l}_CellRangeExt.prototype.copyFrom=function(t){e.prototype.copyFrom.call(this,t);this.firstVisibleRow=t.firstVisibleRow;this.visibleRowsCount=t.visibleRowsCount};_CellRangeExt.prototype.clone=function(){return new _CellRangeExt(null,this.row,this.col,this.row2,this.col2)};return _CellRangeExt}(_CellRange);export{_CellRangeExt};var _fc,RowRange=function(){function RowRange(e){this._ranges=e||[]}RowRange.prototype.length=function(){for(var e=0,t=0;t<this._ranges.length;t++){var r=this._ranges[t];r.isValid&&(e+=r.bottomRow-r.topRow+1)}return e};Object.defineProperty(RowRange.prototype,"isValid",{get:function(){return this._ranges.length&&this._ranges[0].isValid},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"leftCol",{get:function(){return this._ranges.length?this._ranges[0].leftCol:-1},enumerable:!0,configurable:!0});Object.defineProperty(RowRange.prototype,"rightCol",{get:function(){return this._ranges.length?this._ranges[0].rightCol:-1},enumerable:!0,configurable:!0});RowRange.prototype.clone=function(e,t){for(var r=[],o=0;o<this._ranges.length;o++){var n=this._ranges[o].clone();arguments.length>0&&(n.col=e);arguments.length>1&&(n.col2=t);r.push(n)}return new RowRange(r)};RowRange.prototype.getRenderSize=function(e,t){for(var r=new Size(0,0),o=0;o<this._ranges.length;o++){var n=this._ranges[o].getRenderSize(e,t);r.width=Math.max(r.width,n.width);r.height+=n.height}return r};RowRange.prototype.find=function(e,t){var r=null;this.forEach(e,(function(e){if(!0===t(e)){r=e;return!1}}));return r};RowRange.prototype.forEach=function(e,t){for(var r=0,o=!1,n=0;n<this._ranges.length&&!o;n++){var i=this._ranges[n];if(i.isValid)for(var l=i.topRow;l<=i.bottomRow&&!o;l++)o=!1===t(e.rows[l],i,l,r++)}};RowRange.prototype.subrange=function(e,t,r,o){var n=[];if(e>=0&&t>0)for(var i=0,l=0,s=0;s<this._ranges.length&&t>0;s++,i=l+1){var a=this._ranges[s];if(!(e>(l=i+(a.bottomRow-a.topRow)))){var d=e>i?a.topRow+(e-i):a.topRow,u=Math.min(a.bottomRow,d+t-1),p=arguments.length>2?r:a.leftCol,c=arguments.length>2?o:a.rightCol;n.push(new _CellRange(d,p,u,c));t-=u-d+1}}return new RowRange(n)};return RowRange}(),PdfPageRowRange=function(){function PdfPageRowRange(e,t,r){this._col=t;this._row=r;this._range=e}Object.defineProperty(PdfPageRowRange.prototype,"range",{get:function(){return this._range},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageCol",{get:function(){return this._col},enumerable:!0,configurable:!0});Object.defineProperty(PdfPageRowRange.prototype,"pageRow",{get:function(){return this._row},enumerable:!0,configurable:!0});return PdfPageRowRange}(),FAKE_CELL="wj-pdf-fake-cell";function getFakeCell(e){if(!_fc){(_fc=document.createElement("div")).setAttribute(FAKE_CELL,"true");softGrid()&&_fc.setAttribute(softGrid().FlexGrid._WJS_MEASURE,"true")}var t=_fc.style;t.cssText="";t.position="absolute";t.overflow="hidden";t.width="1px";t.height="1px";t.clipPath="inset(100%)";t.clip="rect(0 0 0 0)";var r=e.hostElement,o=r.children.length?r.children[0]:r;_fc.parentNode!==o&&o.appendChild(_fc);return _fc}export function _removeFakeCell(){if(_fc){removeChild(_fc);_fc=null}}var FlexGridPdfConverter=function(){function FlexGridPdfConverter(){}FlexGridPdfConverter.draw=function(e,t,r,o,n){this.drawToPosition(e,t,null,r,o,n)};FlexGridPdfConverter.drawToPosition=function(e,t,r,o,n,i){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The doc argument cannot be null.");var l,s=softGrid()&&e instanceof softGrid().FlexGrid,a=e;try{i=_FlexGridPdfCoreConverter._applyDefaultDrawSettings(i);var d=e;if(s){if(i&&i.recalculateStarWidths){l=a.columns.getTotalSize();a.columns._updateStarSizes(pdf.ptToPx(t.width))}d=this._getFlexGridAdapter(a,i)}_FlexGridPdfCoreConverter.draw(d,t,r,o,n,i)}finally{_removeFakeCell();s&&i&&i.recalculateStarWidths&&a.columns._updateStarSizes(l)}};FlexGridPdfConverter.export=function(e,t,r){assert(!!e,"The flex argument cannot be null.");assert(!!t,"The fileName argument cannot be empty.");var o=(r=this._applyDefaultExportSettings(r)).documentOptions.ended;r.documentOptions.ended=function(e,i){r.progress&&r.progress(1);o&&!1===o.apply(n,[e,i])||pdf.saveBlob(i.blob,t);e.dispose()};var n=new pdf.PdfDocument(r.documentOptions);this.drawToPosition(e,n,null,null,null,r);n.end()};FlexGridPdfConverter._getFlexGridAdapter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowAdapter||softSheet()&&e instanceof softSheet().FlexSheet&&FlexSheetAdapter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridAdapter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&_TransposedGridAdapter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultiRowAdapter||FlexGridAdapter)(e,t)};FlexGridPdfConverter._applyDefaultExportSettings=function(e){return _merge(_merge({},e),this._DefaultExportSettings)};FlexGridPdfConverter._DefaultExportSettings=_merge({scaleMode:ScaleMode.PageWidth,documentOptions:{compress:!1,pageSettings:{margins:{left:36,right:36,top:18,bottom:18}}},_progressMax:.9},_FlexGridPdfCoreConverter.DefaultDrawSettings);return FlexGridPdfConverter}();export{FlexGridPdfConverter};var PdfWebWorkerResponseStatus,FlexGridAdapter=function(){function FlexGridAdapter(e,t){this._defBorderColor=null;this._flex=e;this._settings=t;t.quickCellStyles&&(this._styleCache=new StyleCache(500))}Object.defineProperty(FlexGridAdapter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"settings",{get:function(){return this._settings},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columns",{get:function(){return this._flex.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rows",{get:function(){return this._flex.rows},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"bottomLeftCells",{get:function(){return this._flex.bottomLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"cells",{get:function(){return this._flex.cells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnFooters",{get:function(){return this._flex.columnFooters},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"columnHeaders",{get:function(){return this._flex.columnHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"rowHeaders",{get:function(){return this._flex.rowHeaders},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"topLeftCells",{get:function(){return this._flex.topLeftCells},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"treeIndent",{get:function(){return this._flex.treeIndent},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.getSelection=function(){var e=[],t=this._flex.selection,r=softGrid();switch(this._flex.selectionMode){case r.SelectionMode.None:break;case r.SelectionMode.Cell:case r.SelectionMode.CellRange:e.push(new _CellRange(t.row,t.col,t.row2,t.col2));break;case r.SelectionMode.Row:e.push(new _CellRange(t.topRow,0,t.topRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.RowRange:e.push(new _CellRange(t.topRow,0,t.bottomRow,this._flex.cells.columns.length-1));break;case r.SelectionMode.ListBox:for(var o=-1,n=0;n<this._flex.rows.length;n++){if(this._flex.rows[n].isSelected){o<0&&(o=n);n===this._flex.rows.length-1&&e.push(new _CellRange(o,0,n,this._flex.cells.columns.length-1))}else{o>=0&&e.push(new _CellRange(o,0,n-1,this._flex.cells.columns.length-1));o=-1}}}return e};FlexGridAdapter.prototype.getCell=function(e,t,r,o){var n=e.getCellElement(t,r);if(!n){n=getFakeCell(e);this._flex.cellFactory.updateCell(e,t,r,n,null,o)}return n};FlexGridAdapter.prototype.getComputedDefBorderColor=function(){if(null==this._defBorderColor){var e=window.getComputedStyle(this._flex.hostElement);this._defBorderColor="none"!=e.borderRightStyle?e.borderRightColor:"none"!=e.borderBottomStyle?e.borderBottomColor:"none"!=e.borderLeftStyle?e.borderLeftColor:"none"!=e.borderTopStyle?e.borderTopColor:"rgba(0,0,0,0.2)"}return this._defBorderColor};FlexGridAdapter.prototype.getComputedStyle=function(e,t){var r,o=null==t.getAttribute(FAKE_CELL),n=t.className,i=n.indexOf(ControlStateClsNames.selected)>=0||n.indexOf(ControlStateClsNames.multiSelected)>=0;i&&(t.className=n.replace(ControlStateClsNames.selected,"").replace(ControlStateClsNames.multiSelected,""));if(this._styleCache){var l=e.hostElement,s=t.style.cssText.split(/;\s+/).filter((function(e){var t=e.substring(0,e.indexOf(":"));return/^(color|background-color|border-color|border-left-color|border-right-color|border-top-color|border-bottom-color|font|textAlign)/i.test(t)})).join(";"),a=t;do{s=a.className+s}while(a!==l&&(a=a.parentElement));if(!(r=this._styleCache.getValue(s))){r=window.getComputedStyle(t);r=this._styleCache.add(s,r)}}else r=_cloneStyle(window.getComputedStyle(t));o&&i&&(t.className=n);return r};FlexGridAdapter.prototype.getMergedRange=function(e,t,r){var o=this._flex.getMergedRange(e,t,r,!1);return o?new _CellRange(o.row,o.col,o.row2,o.col2):null};Object.defineProperty(FlexGridAdapter.prototype,"showColumnHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Column)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showRowHeader",{get:function(){return!!(this._flex.headersVisibility&softGrid().HeadersVisibility.Row)},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridAdapter.prototype,"showColumnFooter",{get:function(){return this._flex.columnFooters.rows.length>0},enumerable:!0,configurable:!0});FlexGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r,!0)};FlexGridAdapter.prototype.getCellContent=function(e,t,r,o){var n,i=softGrid();if(this.settings.customCellContent){var l=this.getCell(e,t.index,o,!0);!(n=(n=l.innerText.trim()).replace(/\r/gm,"").replace(/\n+/gm,"\n"))&&this.isBooleanCell(e,t,r)&&(n=null==(n=this._extractCheckboxValue(l))?"":n+"")}else{var s=r.isContentHtml;n=this.getCellData(e,t.index,o);if(this.isGroupRow(t)&&e.cellType===i.CellType.Cell&&r.index===e.columns.firstVisibleIndex){s=!0;n||(n=t.getGroupHeader())}s&&(n=toPlainText(n).trim())}return n};FlexGridAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===softGrid().CellType.Cell&&(!this.isExpandableGroupRow(t)||r.visibleIndex>0)};FlexGridAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridAdapter.prototype.isAlternatingRow=function(e){var t=!1,r=this._flex.alternatingRowStep;if(r){t=e.visibleIndex%(r+1)==0;1==r&&(t=!t)}return t};FlexGridAdapter.prototype.isGroupRow=function(e){return e instanceof softGrid().GroupRow};FlexGridAdapter.prototype.isNewRow=function(e){return e instanceof softGrid()._NewRowTemplate};FlexGridAdapter.prototype.isDetailRow=function(e){return softDetail()&&e instanceof softDetail().DetailRow};FlexGridAdapter.prototype.isExpandableGroupRow=function(e){return e instanceof softGrid().GroupRow&&e.hasChildren};FlexGridAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle),i=this._flex,l=softGrid();switch(e.cellType){case l.CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case l.CellType.ColumnHeader:case l.CellType.RowHeader:case l.CellType.TopLeft:case l.CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case l.CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}!this.settings.customCellContent&&i._getShowErrors()&&i._getError(e,t.index,r.index)&&_merge(n,o.errorCellStyle,!0);return n};FlexGridAdapter.prototype._extractCheckboxValue=function(e){var t=e.querySelector("input[type=checkbox]");if(t&&"none"!==t.style.display&&"hidden"!==t.style.visibility)return t.checked};return FlexGridAdapter}(),FlexSheetAdapter=function(e){__extends(FlexSheetAdapter,e);function FlexSheetAdapter(){return null!==e&&e.apply(this,arguments)||this}FlexSheetAdapter.prototype.getCellData=function(t,r,o){return t.cellType===softGrid().CellType.Cell?t.rows[r]instanceof softSheet().HeaderRow?this.flex.columnHeaders.getCellData(r,o,!0):this.flex.getCellValue(r,o,!0):e.prototype.getCellData.call(this,t,r,o)};FlexSheetAdapter.prototype.getCellStyle=function(t,r,o){var n=e.prototype.getCellStyle.call(this,t,r,o),i=this.flex.selectedSheet.findTable(r.index,o.index);if(i){var l=i.getRange(),s=r.index-l.topRow,a=o.index-l.leftCol,d=i._getTableCellAppliedStyles(s,a);d&&(d.font=new pdf.PdfFont(d.fontFamily,pdf._asPt(d.fontSize,!0,void 0),d.fontStyle,d.fontWeight));_merge(n,d,!0)}return n};Object.defineProperty(FlexSheetAdapter.prototype,"showColumnHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showRowHeader",{get:function(){return!1},enumerable:!0,configurable:!0});Object.defineProperty(FlexSheetAdapter.prototype,"showColumnFooter",{get:function(){return!1},enumerable:!0,configurable:!0});return FlexSheetAdapter}(FlexGridAdapter),MultiRowAdapter=function(e){__extends(MultiRowAdapter,e);function MultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}MultiRowAdapter.prototype.getColumn=function(t,r,o){return _combineColumns(e.prototype.getColumn.call(this,t,r,o),this.flex.getBindingColumn(t,r,o))};MultiRowAdapter.prototype.isAlternatingRow=function(t){if(t instanceof softMultiRow()._MultiRow){var r=!1,o=this.flex.alternatingRowStep;if(o){r=t.dataIndex%(o+1)==0;1==o&&(r=!r)}return r}return e.prototype.isAlternatingRow.call(this,t)};return MultiRowAdapter}(FlexGridAdapter),PivotGridAdapter=function(e){__extends(PivotGridAdapter,e);function PivotGridAdapter(){return null!==e&&e.apply(this,arguments)||this}PivotGridAdapter.prototype.alignMergedTextToTheTopRow=function(e){var t=softGrid();return!this.flex.centerHeadersVertically&&(e.cellType===t.CellType.ColumnHeader||e.cellType===t.CellType.RowHeader)};return PivotGridAdapter}(FlexGridAdapter),_TransposedGridAdapter=function(e){__extends(_TransposedGridAdapter,e);function _TransposedGridAdapter(){return null!==e&&e.apply(this,arguments)||this}_TransposedGridAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=t.grid._getBindingColumn(t,r,n);return i?_combineColumns(n,i):n};return _TransposedGridAdapter}(FlexGridAdapter),TransposedMultiRowAdapter=function(e){__extends(TransposedMultiRowAdapter,e);function TransposedMultiRowAdapter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultiRowAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!=softGrid().CellType.Cell)return n;var i=this.flex.getBindingColumn(t,r,o);return i?_combineColumns(n,i):n};return TransposedMultiRowAdapter}(FlexGridAdapter),StyleCache=function(){function StyleCache(e){this._cache={};this._size=0;this._max=e}StyleCache.prototype.add=function(e,t){this._size>=this._max&&this.clear();var r=this._cache[e]=_cloneStyle(t);this._size++;return r};StyleCache.prototype.clear=function(){this._cache={};this._size=0};StyleCache.prototype.getValue=function(e){return this._cache[e]||null};StyleCache.prototype.hasKey=function(e){return!!this._cache[e]};return StyleCache}();!function(e){e[e.Done=1]="Done";e[e.Progress=2]="Progress"}(PdfWebWorkerResponseStatus||(PdfWebWorkerResponseStatus={}));var DefGridName="",PdfWebWorkerExportDoneEventArgs=function(e){__extends(PdfWebWorkerExportDoneEventArgs,e);function PdfWebWorkerExportDoneEventArgs(t){var r=e.call(this)||this;r._buf=t;return r}Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"blob",{get:function(){this._blob||(this._blob=new Blob([new Uint8Array(this._buf)],{type:"application/pdf"}));return this._blob},enumerable:!0,configurable:!0});Object.defineProperty(PdfWebWorkerExportDoneEventArgs.prototype,"buffer",{get:function(){return this._buf},enumerable:!0,configurable:!0});return PdfWebWorkerExportDoneEventArgs}(EventArgs);export{PdfWebWorkerExportDoneEventArgs};var PdfWebWorkerClient=function(){function PdfWebWorkerClient(){}PdfWebWorkerClient.exportGrid=function(e,t,r,o,n,i){(o=FlexGridPdfConverter._applyDefaultExportSettings(o)).progress=o.progress||i;this.addGrid(e,t,DefGridName,o);this.export(e,o.documentOptions,(function(e){isFunction(n)&&!1===n(e)||pdf.saveBlob(e.blob,r)}),i)};PdfWebWorkerClient.export=function(e,t,r,o){e.addEventListener("message",(function handler(t){var n=t.data;switch(n.status){case PdfWebWorkerResponseStatus.Done:e.removeEventListener("message",handler);isFunction(r)&&r(new PdfWebWorkerExportDoneEventArgs(n.data));break;case PdfWebWorkerResponseStatus.Progress:o&&o(n.data);break;default:throw"Unknown status: "+n.status}}));var n=this._clientDataToArrayBuffer(e);e.postMessage({content:n,settings:t},[n]);this._clearClientData(e)};PdfWebWorkerClient.addGrid=function(e,t,r,o){var n=this._gridToJson(t,o);this._addClientData(e,JSON.stringify(n),r,o,!0)};PdfWebWorkerClient.addImage=function(e,t,r,o){var n=isString(t)&&t.indexOf("data:image/svg")>=0?t:pdf._PdfImageHelper.getDataUri(t);this._addClientData(e,n,r,o)};PdfWebWorkerClient.addString=function(e,t,r){this._addClientData(e,t,r,null)};PdfWebWorkerClient.serializeGrid=function(e,t){var r=this._gridToJson(e,t);return strToBuf(JSON.stringify(r))};PdfWebWorkerClient._addClientData=function(e,t,r,o,n){void 0===n&&(n=!1);asType(e,Worker);asString(r);asString(t,!0);var i=e;i.clientData=i.clientData||{};i.clientData[r]={content:t,settings:o?JSON.stringify(o):null};var l=i.clientData[r];if(n){l.isGrid=!0;l.progressMessaging=!!o&&isFunction(o.progress)}};PdfWebWorkerClient._clearClientData=function(e){delete e.clientData};PdfWebWorkerClient._clientDataToArrayBuffer=function(e){var t=e;return strToBuf(JSON.stringify(t.clientData||{}))};PdfWebWorkerClient._gridToJson=function(e,t){t=FlexGridPdfConverter._applyDefaultExportSettings(t);var r,o;try{r=new pdf.PdfDocument(t.documentOptions);if(t&&t.recalculateStarWidths){o=e.columns.getTotalSize();e.columns._updateStarSizes(pdf.ptToPx(r.width))}return this._getJsonConverter(e,t).convert()}finally{_removeFakeCell();t&&t.recalculateStarWidths&&e.columns._updateStarSizes(o);if(null!=r){r.dispose();r=null}}};PdfWebWorkerClient._getJsonConverter=function(e,t){return new(softMultiRow()&&e instanceof softMultiRow().MultiRow&&MultiRowJsonConverter||softOlap()&&e instanceof softOlap().PivotGrid&&PivotGridJsonConverter||softTransposed()&&e instanceof softTransposed().TransposedGrid&&TransposedGridJsonConverter||softTransposedMultiRow()&&e instanceof softTransposedMultiRow().TransposedMultiRow&&TransposedMultirowJsonConverter||FlexGridJsonConverter)(e,t,FlexGridPdfConverter._getFlexGridAdapter(e,t))};return PdfWebWorkerClient}();export{PdfWebWorkerClient};var RowState,ColState,PdfWebWorker=function(){function PdfWebWorker(){}PdfWebWorker.initExportGrid=function(){var e=this;this.initExport((function(t,r){var o=r[DefGridName];if(o.progressMessaging){o.settings._progressMax=FlexGridPdfConverter._DefaultExportSettings._progressMax;o.settings.progress=function(t){e.sendExportProgress(t)};t.ended.addHandler((function(){e.sendExportProgress(1)}))}FlexGridPdfConverter.draw(o.content,t,null,null,o.settings);t.end()}))};PdfWebWorker.initExport=function(e){self.addEventListener("message",(function handler(t){self.removeEventListener("message",handler);var r=t.data,o=JSON.parse(bufToStr(r.content)),n=r.settings||{};n.ended=function(e,t){blobToBuf(t.blob,(function(e){self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Done},[e])}))};var i=new pdf.PdfDocument(n);Object.keys(o).forEach((function(e){var t=o[e];t.settings&&(t.settings=JSON.parse(t.settings));if(t.isGrid){t.settings&&PdfWebWorker._disableUnsupportedFeatures(t.settings);t.content=PdfWebWorker._deserializeGridFromString(t.content,t.settings)}}));e(i,o)}))};PdfWebWorker.sendExportProgress=function(e){e=clamp(e,0,1);self.postMessage({data:e,status:PdfWebWorkerResponseStatus.Progress})};PdfWebWorker.deserializeGrid=function(e,t){return this._deserializeGridFromString(bufToStr(e),t)};PdfWebWorker._deserializeGridFromString=function(e,t){return this._getJsonAdapter(JSON.parse(e),FlexGridPdfConverter._applyDefaultExportSettings(t))};PdfWebWorker._disableUnsupportedFeatures=function(e){e.customCellContent=!1};PdfWebWorker._getJsonAdapter=function(e,t){switch(e.typeName){case"MultiRow":return new MultiRowJsonAdapter(e,t);case"PivotGrid":return new PivotGridJsonAdapter(e,t);case"TransposedGrid":return new TransposedGridJsonAdapter(e,t);case"TransposedMultiRow":return new TransposedMultiRowJsonAdapter(e,t);default:return new FlexGridJsonAdapter(e,t)}};return PdfWebWorker}();export{PdfWebWorker};function bufToStr(e){for(var t=new Uint16Array(e),r="",o=0,n=t.length;o<n;o++)r+=String.fromCharCode(t[o]);return r}function strToBuf(e){for(var t=new ArrayBuffer(2*e.length),r=new Uint16Array(t),o=0,n=e.length;o<n;o++)r[o]=e.charCodeAt(o);return t}function blobToBuf(e,t){asFunction(t);var r=new FileReader;r.onload=function(e){t(e.target.result)};r.readAsArrayBuffer(e)}!function(e){e[e.None=0]="None";e[e.Alternate=1]="Alternate";e[e.Group=2]="Group";e[e.ExpandableGroup=4]="ExpandableGroup";e[e.New=8]="New";e[e.Visible=16]="Visible";e[e.Detail=32]="Detail"}(RowState||(RowState={}));!function(e){e[e.None=0]="None";e[e.Visible=1]="Visible"}(ColState||(ColState={}));var FlexGridJsonConverter=function(){function FlexGridJsonConverter(e,t,r){this._flex=e;this._settings=t;this._adapter=r}FlexGridJsonConverter.prototype.convert=function(){var e={};e.typeName=this._getTypeName(this._flex);e.selection=this._serializeSelection();e.showColumnFooter=this.adapter.showColumnFooter;e.showColumnHeader=this.adapter.showColumnHeader;e.showRowHeader=this.adapter.showRowHeader;e.treeIndent=this._flex.treeIndent;e.bottomLeftCells=this._serializePanel(this._flex.bottomLeftCells);e.cells=this._serializePanel(this._flex.cells);e.columnFooters=this._serializePanel(this._flex.columnFooters);e.columnHeaders=this._serializePanel(this._flex.columnHeaders);e.rowHeaders=this._serializePanel(this._flex.rowHeaders);e.topLeftCells=this._serializePanel(this._flex.topLeftCells);return e};Object.defineProperty(FlexGridJsonConverter.prototype,"adapter",{get:function(){return this._adapter},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonConverter.prototype,"flex",{get:function(){return this._flex},enumerable:!0,configurable:!0});FlexGridJsonConverter.prototype._getConstructorName=function(e){var t=e.constructor.name;return t=t.replace(/\d+$/g,"")};FlexGridJsonConverter.prototype._getTypeName=function(e){for(var t=new Set(["MultiRow","PivotGrid","TransposedGrid","TransposedMultiRow","FlexGrid"]),r=e;r;){var o=this._getConstructorName(r);if(t.has(o))return o;r=r.constructor.prototype.__proto__}return e.constructor.name};FlexGridJsonConverter.prototype._getRowState=function(e){var t=RowState.None;this.adapter.isAlternatingRow(e)&&(t|=RowState.Alternate);e instanceof softGrid().GroupRow&&(t|=RowState.Group);this.adapter.isDetailRow(e)&&(t|=RowState.Detail);this.adapter.isExpandableGroupRow(e)&&(t|=RowState.ExpandableGroup);e instanceof softGrid()._NewRowTemplate&&(t|=RowState.New);e.isVisible&&(t|=RowState.Visible);return t};FlexGridJsonConverter.prototype._getColumnState=function(e){var t=ColState.None;e.isVisible&&(t|=ColState.Visible);return t};FlexGridJsonConverter.prototype._serializeSelection=function(){for(var e=this.adapter.getSelection(),t=[],r=0;r<e.length;r++){var o=e[r];t.push([o.row,o.col,o.row2,o.col2])}return t};FlexGridJsonConverter.prototype._serializeColumns=function(e){for(var t=[],r=0,o=(e||[]).length;r<o;r++){var n=e[r],i=null;if(n){i={aggregate:n.aggregate,renderWidth:n.renderWidth,visibleIndex:n.visibleIndex};var l=n.getAlignment();l&&(i.alignment=l);var s=this._getColumnState(n);s!==ColState.None&&(i.state=s);n.binding&&(i.binding=n.binding);null!=n.dataType&&(i.dataType=n.dataType);null!=n.name&&(i.name=n.name);n.wordWrap&&(i.wordWrap=!0);n.multiLine&&(i.multiLine=!0)}t.push(i)}return t};FlexGridJsonConverter.prototype._serializePanel=function(e){var t=this,r={cellType:e.cellType,height:e.height,width:e.width};r.mergedRanges=this._serializeMergedRanges(e);r.columns=this._serializeColumns(e.columns);r.columnsFirstVisibleIndex=e.columns.firstVisibleIndex;r.rows=[];r.rowsMaxGroupLevel=e.rows.maxGroupLevel;for(var o=!this._settings.customCellContent&&this._flex._getShowErrors(),_loop_1=function(i,l,s){var a=e.rows[i],d={renderHeight:a.renderHeight};r.rows.push(d);var u=function(e){if(e.align)return e.align;if(!e.dataMap)switch(e.dataType){case DataType.Boolean:return"center";case DataType.Number:return"right"}return null}(a);u&&(d.alignment=u);a instanceof softGrid().GroupRow&&(d.level=a.level);var p=n._getRowState(a);p!==RowState.None&&(d.state=p);a.binding&&(d.binding=a.binding);null!=a.dataType&&(d.dataType=a.dataType);a.wordWrap&&(d.wordWrap=!0);a.multiLine&&(d.multiLine=!0);d.cells=[];for(var c=softGrid(),_loop_2=function(r){var l=n._adapter.getCellContent(e,e.rows[i],e.columns[r],r);if(isFunction(n._settings.formatItem)){var s=new PdfFormatItemEventArgs(e,new c.CellRange(i,r),null,null,null,null,null,(function(){return t._adapter.getCell(e,i,r,!0)}),null);s.data=l;n._settings.formatItem(s);s.data!==l&&(l=s.data)}d.cells[r]=l;if(o&&n._flex._getError(e,i,r)){d.errors||(d.errors={});d.errors[r]=1}},f=0;f<s;f++)_loop_2(f)},n=this,i=0,l=e.rows.length,s=e.columns.length;i<l;i++)_loop_1(i,0,s);return r};FlexGridJsonConverter.prototype._serializeMergedRanges=function(e){for(var t=[],r=[],o=0;o<e.columns.length;o++)r[o]=0;for(var n=0;n<e.rows.length;n++)for(var i=0;i<e.columns.length;i++)if(!(n<r[i])){var l=e.grid.getMergedRange(e,n,i);if(null!=l&&!l.isSingleCell){t.push([l.row,l.col,l.row2,l.col2]);for(var s=l.col;s<=l.col2;s++)r[s]=l.row2+1;l.col===l.col2||(i=l.col2)}}return t};return FlexGridJsonConverter}(),MultiRowJsonConverter=function(e){__extends(MultiRowJsonConverter,e);function MultiRowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}MultiRowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.rowsPerItem=this.flex.rowsPerItem;return t};MultiRowJsonConverter.prototype._serializePanel=function(t){var r=e.prototype._serializePanel.call(this,t);r.cellGroups=this._serializeCellGroup(t);return r};MultiRowJsonConverter.prototype._serializeCellGroup=function(e){var t=[],r=[],o=softGrid(),n=this.flex.rowsPerItem;e.cellType!==o.CellType.TopLeft&&e.cellType!==o.CellType.ColumnHeader||(n=e.rows.length);for(var i=0;i<n;i++){r[i]=[];for(var l=0;l<e.columns.length;l++){var s=this.flex.getBindingColumn(e,i,l),a=t.indexOf(s);r[i][l]=a<0?t.push(s)-1:a}}return{bindingColumns:this._serializeColumns(t),mappings:r}};return MultiRowJsonConverter}(FlexGridJsonConverter),PivotGridJsonConverter=function(e){__extends(PivotGridJsonConverter,e);function PivotGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}PivotGridJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.centerHeadersVertically=this.flex.centerHeadersVertically;return t};return PivotGridJsonConverter}(FlexGridJsonConverter),TransposedGridJsonConverter=function(e){__extends(TransposedGridJsonConverter,e);function TransposedGridJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedGridJsonConverter.prototype.convert=function(){for(var t=e.prototype.convert.call(this),r=new Array(this.flex.cells.rows.length),o=this.flex.cells,n=softGrid(),i=0,l=o.rows.length;i<l;i++){var s=o.rows[i].dataItem,a=s&&s._rowInfo;a instanceof n.Column||(a=_combineColumns(a,a));r[i]=a}t.rowInfo=this._serializeColumns(r);return t};return TransposedGridJsonConverter}(FlexGridJsonConverter),TransposedMultirowJsonConverter=function(e){__extends(TransposedMultirowJsonConverter,e);function TransposedMultirowJsonConverter(){return null!==e&&e.apply(this,arguments)||this}TransposedMultirowJsonConverter.prototype.convert=function(){var t=e.prototype.convert.call(this);t.cellGroups=this._serializeCellGroup();t.columnsPerItem=this.flex.columnsPerItem;return t};TransposedMultirowJsonConverter.prototype._serializeCellGroup=function(){for(var e=[],t=[],r=this.flex.columnsPerItem,o=this.flex.cells,n=0;n<o.rows.length;n++){t[n]=[];for(var i=0;i<r;i++){var l=this.flex.getBindingColumn(o,n,i),s=e.indexOf(l);t[n][i]=s<0?e.push(l)-1:s}}return{bindingColumns:this._serializeColumns(e),mappings:t}};return TransposedMultirowJsonConverter}(FlexGridJsonConverter),RowJson=function(){function RowJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.alignment=e.alignment;this.level=e.level;this.renderHeight=e.renderHeight;this.cells=e.cells;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this.errors=e.errors;this._state=e.state}Object.defineProperty(RowJson.prototype,"isAlternatingRow",{get:function(){return(this._state&RowState.Alternate)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isGroupRow",{get:function(){return(this._state&RowState.Group)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isDetailRow",{get:function(){return(this._state&RowState.Detail)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isExpandableGroupRow",{get:function(){return(this._state&RowState.ExpandableGroup)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isNewRow",{get:function(){return(this._state&RowState.New)!==RowState.None},enumerable:!0,configurable:!0});Object.defineProperty(RowJson.prototype,"isVisible",{get:function(){return(this._state&RowState.Visible)!==RowState.None},enumerable:!0,configurable:!0});return RowJson}(),ColumnJson=function(){function ColumnJson(e,t){this.index=t;this.binding=e.binding;this.dataType=e.dataType;this.aggregate=e.aggregate;this.name=e.name;this.renderWidth=e.renderWidth;this.visibleIndex=e.visibleIndex;this.wordWrap=e.wordWrap||!1;this.multiLine=e.multiLine||!1;this._alignment=e.alignment;this._state=e.state}ColumnJson.prototype.getAlignment=function(e){return this._alignment?this._alignment:e&&e.alignment?e.alignment:""};Object.defineProperty(ColumnJson.prototype,"isVisible",{get:function(){return(this._state&ColState.Visible)!==ColState.None},enumerable:!0,configurable:!0});return ColumnJson}(),RowJsonCollection=function RowJsonCollection(e,t){void 0===t&&(t=-1);this.maxGroupLevel=t;this.length=e.length;for(var r=0;r<e.length;r++)this[r]=new RowJson(e[r],r)},ColumnJsonCollection=function ColumnJsonCollection(e,t){void 0===t&&(t=-1);this.firstVisibleIndex=t;this.length=e.length;for(var r=0;r<e.length;r++){var o=e[r];this[r]=o?new ColumnJson(e[r],r):null}},GridJsonPanel=function(){function GridJsonPanel(e){this.height=e.height;this.width=e.width;this.cellType=e.cellType;this.columns=new ColumnJsonCollection(e.columns,e.columnsFirstVisibleIndex);this.rows=new RowJsonCollection(e.rows,e.rowsMaxGroupLevel);this._mergedRanges=this._deserializeMergedRanges(e.mergedRanges)}GridJsonPanel.prototype.getCellData=function(e,t){return this.rows[e].cells[t]};GridJsonPanel.prototype.getMergedRange=function(e,t){var r=this._mergedRanges[e];if(r)for(var o=0,n=r.length;o<n;o++){var i=r[o];if(t>=i.col&&t<=i.col2)return i}return null};GridJsonPanel.prototype._deserializeMergedRanges=function(e){var t=[];e=e||[];for(var r=0,o=this.rows.length;r<o;r++)t[r]=[];for(r=0,o=e.length;r<o;r++)for(var n=e[r],i=new _CellRange(n[0],n[1],n[2],n[3]),l=i.row;l<=i.row2;l++)t[l].push(i);return t};return GridJsonPanel}(),FlexGridJsonAdapter=function(){function FlexGridJsonAdapter(e,t){this.settings=t;this.bottomLeftCells=this.deserializePanel(e.bottomLeftCells);this.cells=this.deserializePanel(e.cells);this.columnFooters=this.deserializePanel(e.columnFooters);this.columnHeaders=this.deserializePanel(e.columnHeaders);this.rowHeaders=this.deserializePanel(e.rowHeaders);this.topLeftCells=this.deserializePanel(e.topLeftCells);this.treeIndent=e.treeIndent;this.showColumnFooter=e.showColumnFooter;this.showColumnHeader=e.showColumnHeader;this.showRowHeader=e.showRowHeader;this._selection=[];for(var r=0;r<e.selection.length;r++){var o=e.selection[r];this._selection.push(new _CellRange(o[0],o[1],o[2],o[3]))}}Object.defineProperty(FlexGridJsonAdapter.prototype,"columns",{get:function(){return this.cells.columns},enumerable:!0,configurable:!0});Object.defineProperty(FlexGridJsonAdapter.prototype,"rows",{get:function(){return this.cells.rows},enumerable:!0,configurable:!0});FlexGridJsonAdapter.prototype.getSelection=function(){return this._selection};FlexGridJsonAdapter.prototype.getCell=function(e,t,r,o){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedDefBorderColor=function(){throw"Not implemented"};FlexGridJsonAdapter.prototype.getComputedStyle=function(e,t){throw"Not implemented"};FlexGridJsonAdapter.prototype.getMergedRange=function(e,t,r){return e.getMergedRange(t,r)};FlexGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!1};FlexGridJsonAdapter.prototype.getCellData=function(e,t,r){return e.getCellData(t,r)};FlexGridJsonAdapter.prototype.getCellContent=function(e,t,r,o){return this.getCellData(e,t.index,o)};FlexGridJsonAdapter.prototype.isBooleanCell=function(e,t,r){return r.dataType===DataType.Boolean&&e.cellType===_CellType.Cell&&!this.isExpandableGroupRow(t)};FlexGridJsonAdapter.prototype.getColumn=function(e,t,r){return e.columns[r]};FlexGridJsonAdapter.prototype.isAlternatingRow=function(e){return e.isAlternatingRow};FlexGridJsonAdapter.prototype.isGroupRow=function(e){return e.isGroupRow};FlexGridJsonAdapter.prototype.isNewRow=function(e){return e.isNewRow};FlexGridJsonAdapter.prototype.isDetailRow=function(e){return e.isDetailRow};FlexGridJsonAdapter.prototype.isExpandableGroupRow=function(e){return e.isExpandableGroupRow};FlexGridJsonAdapter.prototype.isRenderableRow=function(e){return e.isVisible&&e.renderHeight>0&&!this.isNewRow(e)};FlexGridJsonAdapter.prototype.isRenderableColumn=function(e){return e.isVisible&&e.renderWidth>0};FlexGridJsonAdapter.prototype.getCellStyle=function(e,t,r){var o=this.settings.styles,n=_merge({},o.cellStyle);switch(e.cellType){case _CellType.Cell:this.isExpandableGroupRow(t)?_merge(n,o.groupCellStyle,!0):this.isAlternatingRow(t)&&_merge(n,o.altCellStyle,!0);break;case _CellType.ColumnHeader:case _CellType.RowHeader:case _CellType.TopLeft:case _CellType.BottomLeft:_merge(n,o.headerCellStyle,!0);break;case _CellType.ColumnFooter:_merge(n,o.headerCellStyle,!0);_merge(n,o.footerCellStyle,!0)}t.errors&&t.errors[r.index]&&_merge(n,o.errorCellStyle,!0);return n};FlexGridJsonAdapter.prototype.deserializePanel=function(e){return new GridJsonPanel(e)};return FlexGridJsonAdapter}(),PivotGridJsonAdapter=function(e){__extends(PivotGridJsonAdapter,e);function PivotGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._centerHeadersVertically=t.centerHeadersVertically;return o}PivotGridJsonAdapter.prototype.alignMergedTextToTheTopRow=function(e){return!this._centerHeadersVertically&&(e.cellType===_CellType.ColumnHeader||e.cellType===_CellType.RowHeader)};return PivotGridJsonAdapter}(FlexGridJsonAdapter),MultiRowJsonPanel=function(e){__extends(MultiRowJsonPanel,e);function MultiRowJsonPanel(t){var r=e.call(this,t)||this;t.cellGroups&&(r._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return r}MultiRowJsonPanel.prototype.getColumn=function(e,t,r){var o=this.columns[t];if(this._cellGroups){this.cellType!==_CellType.ColumnHeader&&this.cellType!==_CellType.BottomLeft&&(e%=r);return _combineColumns(o,this._cellGroups.bindingColumns[this._cellGroups.mappings[e][t]])}return o};return MultiRowJsonPanel}(GridJsonPanel),MultiRowJsonAdapter=function(e){__extends(MultiRowJsonAdapter,e);function MultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowsPerItem=t.rowsPerItem;return o}MultiRowJsonAdapter.prototype.deserializePanel=function(e){return new MultiRowJsonPanel(e)};MultiRowJsonAdapter.prototype.getColumn=function(e,t,r){return e.getColumn(t,r,this._rowsPerItem)};return MultiRowJsonAdapter}(FlexGridJsonAdapter),TransposedGridJsonAdapter=function(e){__extends(TransposedGridJsonAdapter,e);function TransposedGridJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._rowInfo=new ColumnJsonCollection(t.rowInfo);return o}TransposedGridJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(t.cellType!==_CellType.Cell)return n;var i=this._rowInfo[r];return i?_combineColumns(n,i):n};return TransposedGridJsonAdapter}(FlexGridJsonAdapter),TransposedMultiRowJsonAdapter=function(e){__extends(TransposedMultiRowJsonAdapter,e);function TransposedMultiRowJsonAdapter(t,r){var o=e.call(this,t,r)||this;o._columnsPerItem=t.columnsPerItem;t.cellGroups&&(o._cellGroups={bindingColumns:new ColumnJsonCollection(t.cellGroups.bindingColumns),mappings:t.cellGroups.mappings});return o}TransposedMultiRowJsonAdapter.prototype.getColumn=function(t,r,o){var n=e.prototype.getColumn.call(this,t,r,o);if(this._cellGroups&&t.cellType===_CellType.Cell){o%=this._columnsPerItem;return _combineColumns(n,this._cellGroups.bindingColumns[this._cellGroups.mappings[r][o]])}return n};return TransposedMultiRowJsonAdapter}(FlexGridJsonAdapter);_registerModule("wijmo.grid.pdf",selfModule);
|