Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ag-grid-community/csv-export

Package Overview
Dependencies
Maintainers
3
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-grid-community/csv-export - npm Package Compare versions

Comparing version 32.2.0 to 32.2.1

2

dist/package/main.cjs.js

@@ -717,3 +717,3 @@ var __defProp = Object.defineProperty;

// community-modules/csv-export/src/version.ts
var VERSION = "32.2.0";
var VERSION = "32.2.1";

@@ -720,0 +720,0 @@ // community-modules/csv-export/src/csvExportModule.ts

var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of __getOwnPropNames(t))!__hasOwnProp.call(e,s)&&s!==o&&__defProp(e,s,{get:()=>t[s],enumerable:!(r=__getOwnPropDesc(t,s))||r.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{BaseCreator:()=>BaseCreator,BaseGridSerializingSession:()=>BaseGridSerializingSession,CsvCreator:()=>CsvCreator,CsvExportModule:()=>CsvExportModule,Downloader:()=>Downloader,GridSerializer:()=>GridSerializer,RowType:()=>RowType,XmlFactory:()=>XmlFactory,ZipContainer:()=>ZipContainer,_CsvExportCoreModule:()=>CsvExportCoreModule}),module.exports=__toCommonJS(main_exports);var import_core=require("@ag-grid-community/core"),BaseCreator=class extends import_core.BeanStub{setBeans(e){this.beans=e}getFileName(e){const t=this.getDefaultFileExtension();return(e==null||!e.length)&&(e=this.getDefaultFileName()),e.indexOf(".")===-1?`${e}.${t}`:e}getData(e){const t=this.createSerializingSession(e);return this.beans.gridSerializer.serialize(t,e)}getDefaultFileName(){return`export.${this.getDefaultFileExtension()}`}},import_core2=require("@ag-grid-community/core"),BaseGridSerializingSession=class{constructor(e){this.groupColumns=[];const{columnModel:t,funcColsService:o,columnNameService:r,valueService:s,gos:n,processCellCallback:i,processHeaderCallback:l,processGroupHeaderCallback:c,processRowGroupCallback:a}=e;this.columnModel=t,this.funcColsService=o,this.columnNameService=r,this.valueService=s,this.gos=n,this.processCellCallback=i,this.processHeaderCallback=l,this.processGroupHeaderCallback=c,this.processRowGroupCallback=a}prepare(e){this.groupColumns=e.filter(t=>!!t.getColDef().showRowGroup)}extractHeaderValue(e){return this.getHeaderName(this.processHeaderCallback,e)??""}extractRowCellValue(e,t,o,r,s){const i=(!this.gos.get("groupHideOpenParents")||s.footer)&&this.shouldRenderGroupSummaryCell(s,e,t)?this.createValueForGroupNode(e,s):this.valueService.getValue(e,s);return this.processCell({accumulatedRowIndex:o,rowNode:s,column:e,value:i,processCellCallback:this.processCellCallback,type:r})}shouldRenderGroupSummaryCell(e,t,o){if(!(e&&e.group))return!1;if(this.groupColumns.indexOf(t)!==-1){if(e.groupData?.[t.getId()]!=null||(0,import_core2._isServerSideRowModel)(this.gos)&&e.group)return!0;if(e.footer&&e.level===-1){const i=t.getColDef();return i==null||i.showRowGroup===!0||i.showRowGroup===this.funcColsService.getRowGroupColumns()[0].getId()}}const n=(0,import_core2._isGroupUseEntireRow)(this.gos,this.columnModel.isPivotMode());return o===0&&n}getHeaderName(e,t){return e?e(this.gos.addGridCommonParams({column:t})):this.columnNameService.getDisplayNameForColumn(t,"csv",!0)}createValueForGroupNode(e,t){if(this.processRowGroupCallback)return this.processRowGroupCallback(this.gos.addGridCommonParams({column:e,node:t}));const o=this.gos.get("treeData"),r=this.gos.get("suppressGroupMaintainValueType"),s=c=>{if(o||r)return c.key;const a=c.groupData?.[e.getId()];return!a||!c.rowGroupColumn||c.rowGroupColumn.getColDef().useValueFormatterForExport===!1?a:this.valueService.formatValue(c.rowGroupColumn,c,a)??a},n=t.footer,i=[s(t)];if(!(0,import_core2._isGroupMultiAutoColumn)(this.gos))for(;t.parent;)t=t.parent,i.push(s(t));const l=i.reverse().join(" -> ");return n?`Total ${l}`:l}processCell(e){const{accumulatedRowIndex:t,rowNode:o,column:r,value:s,processCellCallback:n,type:i}=e;return n?{value:n(this.gos.addGridCommonParams({accumulatedRowIndex:t,column:r,node:o,value:s,type:i,parseValue:l=>this.valueService.parseValue(r,o,l,this.valueService.getValue(r,o)),formatValue:l=>this.valueService.formatValue(r,o,l)??l}))??""}:r.getColDef().useValueFormatterForExport!==!1?{value:s??"",valueFormatted:this.valueService.formatValue(r,o,s)}:{value:s??""}}},import_core5=require("@ag-grid-community/core"),import_core3=require("@ag-grid-community/core"),Downloader=class{static download(e,t){const o=document.defaultView||window;if(!o){(0,import_core3._warnOnce)("There is no `window` associated with the current `document`");return}const r=document.createElement("a"),s=o.URL.createObjectURL(t);r.setAttribute("href",s),r.setAttribute("download",e),r.style.display="none",document.body.appendChild(r),r.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,view:o})),document.body.removeChild(r),o.setTimeout(()=>{o.URL.revokeObjectURL(s)},0)}},import_core4=require("@ag-grid-community/core"),LINE_SEPARATOR=`\r
`,CsvSerializingSession=class extends BaseGridSerializingSession{constructor(e){super(e),this.isFirstLine=!0,this.result="";const{suppressQuotes:t,columnSeparator:o}=e;this.suppressQuotes=t,this.columnSeparator=o}addCustomContent(e){e&&(typeof e=="string"?(/^\s*\n/.test(e)||this.beginNewLine(),e=e.replace(/\r?\n/g,LINE_SEPARATOR),this.result+=e):e.forEach(t=>{this.beginNewLine(),t.forEach((o,r)=>{r!==0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(o.data.value||""),o.mergeAcross&&this.appendEmptyCells(o.mergeAcross)})}))}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn(e,t,o,r){o!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(t),this.appendEmptyCells(r)}appendEmptyCells(e){for(let t=1;t<=e;t++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn(e,t){t!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(this.extractHeaderValue(e))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn(e,t,o){t!=0&&(this.result+=this.columnSeparator);const r=this.extractRowCellValue(e,t,t,"csv",o);this.result+=this.putInQuotes(r.valueFormatted??r.value)}putInQuotes(e){if(this.suppressQuotes)return e;if(e==null)return'""';let t;return typeof e=="string"?t=e:typeof e.toString=="function"?t=e.toString():((0,import_core4._warnOnce)("unknown value type during csv conversion"),t=""),'"'+t.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){this.isFirstLine||(this.result+=LINE_SEPARATOR),this.isFirstLine=!1}},CsvCreator=class extends BaseCreator{constructor(){super(...arguments),this.beanName="csvCreator"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.gridSerializer=e.gridSerializer}postConstruct(){this.setBeans({gridSerializer:this.gridSerializer,gos:this.gos})}getMergedParams(e){const t=this.gos.get("defaultCsvExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){(0,import_core5._warnOnce)("Export cancelled. Export is not allowed as per your configuration.");return}const t=this.getMergedParams(e),o=this.getData(t),r=new Blob(["\uFEFF",o],{type:"text/plain"}),s=typeof t.fileName=="function"?t.fileName(this.gos.getGridCommonParams()):t.fileName;Downloader.download(this.getFileName(s),r)}exportDataAsCsv(e){this.export(e)}getDataAsCsv(e,t=!1){const o=t?Object.assign({},e):this.getMergedParams(e);return this.getData(o)}getDefaultFileExtension(){return"csv"}createSerializingSession(e){const{columnModel:t,columnNameService:o,funcColsService:r,valueService:s,gos:n}=this,{processCellCallback:i,processHeaderCallback:l,processGroupHeaderCallback:c,processRowGroupCallback:a,suppressQuotes:d,columnSeparator:p}=e;return new CsvSerializingSession({columnModel:t,columnNameService:o,funcColsService:r,valueService:s,gos:n,processCellCallback:i||void 0,processHeaderCallback:l||void 0,processGroupHeaderCallback:c||void 0,processRowGroupCallback:a||void 0,suppressQuotes:d||!1,columnSeparator:p||","})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}},import_core7=require("@ag-grid-community/core");function getDataAsCsv(e,t){return e.csvCreator?.getDataAsCsv(t)}function exportDataAsCsv(e,t){e.csvCreator?.exportDataAsCsv(t)}var import_core6=require("@ag-grid-community/core"),RowType=(e=>(e[e.HEADER_GROUPING=0]="HEADER_GROUPING",e[e.HEADER=1]="HEADER",e[e.BODY=2]="BODY",e))(RowType||{}),GridSerializer=class extends import_core6.BeanStub{constructor(){super(...arguments),this.beanName="gridSerializer"}wireBeans(e){this.visibleColsService=e.visibleColsService,this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.rowModel=e.rowModel,this.pinnedRowModel=e.pinnedRowModel,this.selectionService=e.selectionService,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController}serialize(e,t={}){const{allColumns:o,columnKeys:r,skipRowGroups:s}=t,n=this.getColumnsToExport(o,s,r);return(0,import_core6._compose)(this.prepareSession(n),this.prependContent(t),this.exportColumnGroups(t,n),this.exportHeaders(t,n),this.processPinnedTopRows(t,n),this.processRows(t,n),this.processPinnedBottomRows(t,n),this.appendContent(t))(e).parse()}processRow(e,t,o,r){const s=t.shouldRowBeSkipped||(()=>!1),n=this.gos.get("groupRemoveSingleChildren"),i=this.gos.get("groupRemoveLowestSingleChildren"),c=t.rowPositions!=null||!!t.onlySelected,a=this.gos.get("groupHideOpenParents")&&!c,d=this.columnModel.isPivotMode()?r.leafGroup:!r.group,p=!!r.footer,h=i&&r.leafGroup,u=r.allChildrenCount===1&&r.childrenAfterGroup?.length===1&&(n||h);if(!d&&!p&&(t.skipRowGroups||u||a)||t.onlySelected&&!r.isSelected()||t.skipPinnedTop&&r.rowPinned==="top"||t.skipPinnedBottom&&r.rowPinned==="bottom"||r.level===-1&&!d&&!p||s(this.gos.addGridCommonParams({node:r})))return;const w=e.onNewBodyRow(r);if(o.forEach((f,v)=>{w.onColumn(f,v,r)}),t.getCustomContentBelowRow){const f=t.getCustomContentBelowRow(this.gos.addGridCommonParams({node:r}));f&&e.addCustomContent(f)}}appendContent(e){return t=>{const o=e.appendContent;return o&&t.addCustomContent(o),t}}prependContent(e){return t=>{const o=e.prependContent;return o&&t.addCustomContent(o),t}}prepareSession(e){return t=>(t.prepare(e),t)}exportColumnGroups(e,t){return o=>{if(!e.skipColumnGroupHeaders){const r=new import_core6.GroupInstanceIdCreator,s=this.visibleColsService.createGroups({columns:t,idCreator:r,pinned:null,isStandaloneStructure:!0});this.recursivelyAddHeaderGroups(s,o,e.processGroupHeaderCallback)}return o}}exportHeaders(e,t){return o=>{if(!e.skipColumnHeaders){const r=o.onNewHeaderRow();t.forEach((s,n)=>{r.onColumn(s,n,void 0)})}return o}}processPinnedTopRows(e,t){return o=>{const r=this.processRow.bind(this,o,e,t);return e.rowPositions?e.rowPositions.filter(s=>s.rowPinned==="top").sort((s,n)=>s.rowIndex-n.rowIndex).map(s=>this.pinnedRowModel.getPinnedTopRow(s.rowIndex)).forEach(r):this.pinnedRowModel.forEachPinnedRow("top",r),o}}processRows(e,t){return o=>{const r=this.rowModel,s=(0,import_core6._isClientSideRowModel)(this.gos),n=(0,import_core6._isServerSideRowModel)(this.gos),i=!s&&e.onlySelected,l=this.processRow.bind(this,o,e,t),{exportedRows:c="filteredAndSorted"}=e;if(e.rowPositions)e.rowPositions.filter(a=>a.rowPinned==null).sort((a,d)=>a.rowIndex-d.rowIndex).map(a=>r.getRow(a.rowIndex)).forEach(l);else if(this.columnModel.isPivotMode())s?r.forEachPivotNode(l,!0):n?r.forEachNodeAfterFilterAndSort(l,!0):r.forEachNode(l);else if(e.onlySelectedAllPages||i){const a=this.selectionService.getSelectedNodes();this.replicateSortedOrder(a),a.forEach(l)}else c==="all"?r.forEachNode(l):s||n?r.forEachNodeAfterFilterAndSort(l,!0):r.forEachNode(l);return o}}replicateSortedOrder(e){const t=this.sortController.getSortOptions(),o=(r,s)=>r.rowIndex!=null&&s.rowIndex!=null?r.rowIndex-s.rowIndex:r.level===s.level?r.parent?.id===s.parent?.id?this.rowNodeSorter.compareRowNodes(t,{rowNode:r,currentPos:r.rowIndex??-1},{rowNode:s,currentPos:s.rowIndex??-1}):o(r.parent,s.parent):r.level>s.level?o(r.parent,s):o(r,s.parent);e.sort(o)}processPinnedBottomRows(e,t){return o=>{const r=this.processRow.bind(this,o,e,t);return e.rowPositions?e.rowPositions.filter(s=>s.rowPinned==="bottom").sort((s,n)=>s.rowIndex-n.rowIndex).map(s=>this.pinnedRowModel.getPinnedBottomRow(s.rowIndex)).forEach(r):this.pinnedRowModel.forEachPinnedRow("bottom",r),o}}getColumnsToExport(e=!1,t=!1,o){const r=this.columnModel.isPivotMode();if(o&&o.length)return this.columnModel.getColsForKeys(o);const s=this.gos.get("treeData");let n=[];return e&&!r?n=this.columnModel.getCols():n=this.visibleColsService.getAllCols(),t&&!s&&(n=n.filter(i=>(0,import_core6.isColumnGroupAutoCol)(i)||(0,import_core6.isColumnControlsCol)(i))),n}recursivelyAddHeaderGroups(e,t,o){const r=[];e.forEach(s=>{const n=s;n.getChildren&&n.getChildren().forEach(i=>r.push(i))}),e.length>0&&(0,import_core6.isColumnGroup)(e[0])&&this.doAddHeaderHeader(t,e,o),r&&r.length>0&&this.recursivelyAddHeaderGroups(r,t,o)}doAddHeaderHeader(e,t,o){const r=e.onNewHeaderGroupingRow();let s=0;t.forEach(n=>{const i=n;let l;o?l=o(this.gos.addGridCommonParams({columnGroup:i})):l=this.columnNameService.getDisplayNameForColumnGroup(i,"header");const c=i.getLeafColumns().reduce((a,d,p,h)=>{let u=(0,import_core6._last)(a);return d.getColumnGroupShow()==="open"?(!u||u[1]!=null)&&(u=[p],a.push(u)):u&&u[1]==null&&(u[1]=p-1),p===h.length-1&&u&&u[1]==null&&(u[1]=p),a},[]);r.onColumn(i,l||"",s++,i.getLeafColumns().length-1,c)})}},VERSION="32.2.0",CsvExportCoreModule=(0,import_core7._defineModule)({version:VERSION,moduleName:`${import_core7.ModuleNames.CsvExportModule}-core`,beans:[CsvCreator,GridSerializer]}),CsvExportApiModule=(0,import_core7._defineModule)({version:VERSION,moduleName:`${import_core7.ModuleNames.CsvExportModule}-api`,apiFunctions:{getDataAsCsv,exportDataAsCsv},dependantModules:[CsvExportCoreModule]}),CsvExportModule=(0,import_core7._defineModule)({version:VERSION,moduleName:import_core7.ModuleNames.CsvExportModule,dependantModules:[CsvExportCoreModule,CsvExportApiModule]}),LINE_SEPARATOR2=`\r
`,CsvSerializingSession=class extends BaseGridSerializingSession{constructor(e){super(e),this.isFirstLine=!0,this.result="";const{suppressQuotes:t,columnSeparator:o}=e;this.suppressQuotes=t,this.columnSeparator=o}addCustomContent(e){e&&(typeof e=="string"?(/^\s*\n/.test(e)||this.beginNewLine(),e=e.replace(/\r?\n/g,LINE_SEPARATOR),this.result+=e):e.forEach(t=>{this.beginNewLine(),t.forEach((o,r)=>{r!==0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(o.data.value||""),o.mergeAcross&&this.appendEmptyCells(o.mergeAcross)})}))}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn(e,t,o,r){o!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(t),this.appendEmptyCells(r)}appendEmptyCells(e){for(let t=1;t<=e;t++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn(e,t){t!=0&&(this.result+=this.columnSeparator),this.result+=this.putInQuotes(this.extractHeaderValue(e))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn(e,t,o){t!=0&&(this.result+=this.columnSeparator);const r=this.extractRowCellValue(e,t,t,"csv",o);this.result+=this.putInQuotes(r.valueFormatted??r.value)}putInQuotes(e){if(this.suppressQuotes)return e;if(e==null)return'""';let t;return typeof e=="string"?t=e:typeof e.toString=="function"?t=e.toString():((0,import_core4._warnOnce)("unknown value type during csv conversion"),t=""),'"'+t.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){this.isFirstLine||(this.result+=LINE_SEPARATOR),this.isFirstLine=!1}},CsvCreator=class extends BaseCreator{constructor(){super(...arguments),this.beanName="csvCreator"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.gridSerializer=e.gridSerializer}postConstruct(){this.setBeans({gridSerializer:this.gridSerializer,gos:this.gos})}getMergedParams(e){const t=this.gos.get("defaultCsvExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){(0,import_core5._warnOnce)("Export cancelled. Export is not allowed as per your configuration.");return}const t=this.getMergedParams(e),o=this.getData(t),r=new Blob(["\uFEFF",o],{type:"text/plain"}),s=typeof t.fileName=="function"?t.fileName(this.gos.getGridCommonParams()):t.fileName;Downloader.download(this.getFileName(s),r)}exportDataAsCsv(e){this.export(e)}getDataAsCsv(e,t=!1){const o=t?Object.assign({},e):this.getMergedParams(e);return this.getData(o)}getDefaultFileExtension(){return"csv"}createSerializingSession(e){const{columnModel:t,columnNameService:o,funcColsService:r,valueService:s,gos:n}=this,{processCellCallback:i,processHeaderCallback:l,processGroupHeaderCallback:c,processRowGroupCallback:a,suppressQuotes:d,columnSeparator:p}=e;return new CsvSerializingSession({columnModel:t,columnNameService:o,funcColsService:r,valueService:s,gos:n,processCellCallback:i||void 0,processHeaderCallback:l||void 0,processGroupHeaderCallback:c||void 0,processRowGroupCallback:a||void 0,suppressQuotes:d||!1,columnSeparator:p||","})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}},import_core7=require("@ag-grid-community/core");function getDataAsCsv(e,t){return e.csvCreator?.getDataAsCsv(t)}function exportDataAsCsv(e,t){e.csvCreator?.exportDataAsCsv(t)}var import_core6=require("@ag-grid-community/core"),RowType=(e=>(e[e.HEADER_GROUPING=0]="HEADER_GROUPING",e[e.HEADER=1]="HEADER",e[e.BODY=2]="BODY",e))(RowType||{}),GridSerializer=class extends import_core6.BeanStub{constructor(){super(...arguments),this.beanName="gridSerializer"}wireBeans(e){this.visibleColsService=e.visibleColsService,this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.rowModel=e.rowModel,this.pinnedRowModel=e.pinnedRowModel,this.selectionService=e.selectionService,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController}serialize(e,t={}){const{allColumns:o,columnKeys:r,skipRowGroups:s}=t,n=this.getColumnsToExport(o,s,r);return(0,import_core6._compose)(this.prepareSession(n),this.prependContent(t),this.exportColumnGroups(t,n),this.exportHeaders(t,n),this.processPinnedTopRows(t,n),this.processRows(t,n),this.processPinnedBottomRows(t,n),this.appendContent(t))(e).parse()}processRow(e,t,o,r){const s=t.shouldRowBeSkipped||(()=>!1),n=this.gos.get("groupRemoveSingleChildren"),i=this.gos.get("groupRemoveLowestSingleChildren"),c=t.rowPositions!=null||!!t.onlySelected,a=this.gos.get("groupHideOpenParents")&&!c,d=this.columnModel.isPivotMode()?r.leafGroup:!r.group,p=!!r.footer,h=i&&r.leafGroup,u=r.allChildrenCount===1&&r.childrenAfterGroup?.length===1&&(n||h);if(!d&&!p&&(t.skipRowGroups||u||a)||t.onlySelected&&!r.isSelected()||t.skipPinnedTop&&r.rowPinned==="top"||t.skipPinnedBottom&&r.rowPinned==="bottom"||r.level===-1&&!d&&!p||s(this.gos.addGridCommonParams({node:r})))return;const w=e.onNewBodyRow(r);if(o.forEach((f,v)=>{w.onColumn(f,v,r)}),t.getCustomContentBelowRow){const f=t.getCustomContentBelowRow(this.gos.addGridCommonParams({node:r}));f&&e.addCustomContent(f)}}appendContent(e){return t=>{const o=e.appendContent;return o&&t.addCustomContent(o),t}}prependContent(e){return t=>{const o=e.prependContent;return o&&t.addCustomContent(o),t}}prepareSession(e){return t=>(t.prepare(e),t)}exportColumnGroups(e,t){return o=>{if(!e.skipColumnGroupHeaders){const r=new import_core6.GroupInstanceIdCreator,s=this.visibleColsService.createGroups({columns:t,idCreator:r,pinned:null,isStandaloneStructure:!0});this.recursivelyAddHeaderGroups(s,o,e.processGroupHeaderCallback)}return o}}exportHeaders(e,t){return o=>{if(!e.skipColumnHeaders){const r=o.onNewHeaderRow();t.forEach((s,n)=>{r.onColumn(s,n,void 0)})}return o}}processPinnedTopRows(e,t){return o=>{const r=this.processRow.bind(this,o,e,t);return e.rowPositions?e.rowPositions.filter(s=>s.rowPinned==="top").sort((s,n)=>s.rowIndex-n.rowIndex).map(s=>this.pinnedRowModel.getPinnedTopRow(s.rowIndex)).forEach(r):this.pinnedRowModel.forEachPinnedRow("top",r),o}}processRows(e,t){return o=>{const r=this.rowModel,s=(0,import_core6._isClientSideRowModel)(this.gos),n=(0,import_core6._isServerSideRowModel)(this.gos),i=!s&&e.onlySelected,l=this.processRow.bind(this,o,e,t),{exportedRows:c="filteredAndSorted"}=e;if(e.rowPositions)e.rowPositions.filter(a=>a.rowPinned==null).sort((a,d)=>a.rowIndex-d.rowIndex).map(a=>r.getRow(a.rowIndex)).forEach(l);else if(this.columnModel.isPivotMode())s?r.forEachPivotNode(l,!0):n?r.forEachNodeAfterFilterAndSort(l,!0):r.forEachNode(l);else if(e.onlySelectedAllPages||i){const a=this.selectionService.getSelectedNodes();this.replicateSortedOrder(a),a.forEach(l)}else c==="all"?r.forEachNode(l):s||n?r.forEachNodeAfterFilterAndSort(l,!0):r.forEachNode(l);return o}}replicateSortedOrder(e){const t=this.sortController.getSortOptions(),o=(r,s)=>r.rowIndex!=null&&s.rowIndex!=null?r.rowIndex-s.rowIndex:r.level===s.level?r.parent?.id===s.parent?.id?this.rowNodeSorter.compareRowNodes(t,{rowNode:r,currentPos:r.rowIndex??-1},{rowNode:s,currentPos:s.rowIndex??-1}):o(r.parent,s.parent):r.level>s.level?o(r.parent,s):o(r,s.parent);e.sort(o)}processPinnedBottomRows(e,t){return o=>{const r=this.processRow.bind(this,o,e,t);return e.rowPositions?e.rowPositions.filter(s=>s.rowPinned==="bottom").sort((s,n)=>s.rowIndex-n.rowIndex).map(s=>this.pinnedRowModel.getPinnedBottomRow(s.rowIndex)).forEach(r):this.pinnedRowModel.forEachPinnedRow("bottom",r),o}}getColumnsToExport(e=!1,t=!1,o){const r=this.columnModel.isPivotMode();if(o&&o.length)return this.columnModel.getColsForKeys(o);const s=this.gos.get("treeData");let n=[];return e&&!r?n=this.columnModel.getCols():n=this.visibleColsService.getAllCols(),t&&!s&&(n=n.filter(i=>(0,import_core6.isColumnGroupAutoCol)(i)||(0,import_core6.isColumnControlsCol)(i))),n}recursivelyAddHeaderGroups(e,t,o){const r=[];e.forEach(s=>{const n=s;n.getChildren&&n.getChildren().forEach(i=>r.push(i))}),e.length>0&&(0,import_core6.isColumnGroup)(e[0])&&this.doAddHeaderHeader(t,e,o),r&&r.length>0&&this.recursivelyAddHeaderGroups(r,t,o)}doAddHeaderHeader(e,t,o){const r=e.onNewHeaderGroupingRow();let s=0;t.forEach(n=>{const i=n;let l;o?l=o(this.gos.addGridCommonParams({columnGroup:i})):l=this.columnNameService.getDisplayNameForColumnGroup(i,"header");const c=i.getLeafColumns().reduce((a,d,p,h)=>{let u=(0,import_core6._last)(a);return d.getColumnGroupShow()==="open"?(!u||u[1]!=null)&&(u=[p],a.push(u)):u&&u[1]==null&&(u[1]=p-1),p===h.length-1&&u&&u[1]==null&&(u[1]=p),a},[]);r.onColumn(i,l||"",s++,i.getLeafColumns().length-1,c)})}},VERSION="32.2.1",CsvExportCoreModule=(0,import_core7._defineModule)({version:VERSION,moduleName:`${import_core7.ModuleNames.CsvExportModule}-core`,beans:[CsvCreator,GridSerializer]}),CsvExportApiModule=(0,import_core7._defineModule)({version:VERSION,moduleName:`${import_core7.ModuleNames.CsvExportModule}-api`,apiFunctions:{getDataAsCsv,exportDataAsCsv},dependantModules:[CsvExportCoreModule]}),CsvExportModule=(0,import_core7._defineModule)({version:VERSION,moduleName:import_core7.ModuleNames.CsvExportModule,dependantModules:[CsvExportCoreModule,CsvExportApiModule]}),LINE_SEPARATOR2=`\r
`;function returnAttributeIfPopulated(e,t,o){if(!t&&t!==""&&t!==0)return"";let r=t;return typeof t=="boolean"&&o&&(r=o(t)),` ${e}="${r}"`}var XmlFactory=class{static createHeader(e={}){const t="<?",o="?>",r=["version"];e.version||(e.version="1.0"),e.encoding&&r.push("encoding"),e.standalone&&r.push("standalone");const s=r.map(n=>`${n}="${e[n]}"`).join(" ");return`${t}xml ${s} ${o}`}static createXml(e,t){let o="";e.properties&&(e.properties.prefixedAttributes&&e.properties.prefixedAttributes.forEach(s=>{Object.keys(s.map).forEach(n=>{o+=returnAttributeIfPopulated(s.prefix+n,s.map[n],t)})}),e.properties.rawMap&&Object.keys(e.properties.rawMap).forEach(s=>{o+=returnAttributeIfPopulated(s,e.properties.rawMap[s],t)}));let r="<"+e.name+o;return!e.children&&e.textNode==null?r+"/>"+LINE_SEPARATOR2:e.textNode!=null?r+">"+e.textNode+"</"+e.name+">"+LINE_SEPARATOR2:(r+=">"+LINE_SEPARATOR2,e.children&&e.children.forEach(s=>{r+=this.createXml(s,t)}),r+"</"+e.name+">"+LINE_SEPARATOR2)}},import_core8=require("@ag-grid-community/core"),compressBlob=async e=>{let t=0;const o=[],r=new WritableStream({write:i=>{o.push(i),t+=i.length}}),s=new ReadableStream({start:i=>{const l=new FileReader;l.onload=c=>{c.target?.result&&i.enqueue(c.target.result),i.close()},l.readAsArrayBuffer(e)}}),n=new window.CompressionStream("deflate-raw");return await s.pipeThrough(n).pipeTo(r),{size:t,content:new Blob(o)}},deflateLocalFile=async e=>{const t=new Blob([e]),{size:o,content:r}=await compressBlob(t),s=new Uint8Array(await r.arrayBuffer());return{size:o,content:s}},convertTime=e=>{let t=e.getHours();return t<<=6,t=t|e.getMinutes(),t<<=5,t=t|e.getSeconds()/2,t},convertDate=e=>{let t=e.getFullYear()-1980;return t<<=4,t=t|e.getMonth()+1,t<<=5,t=t|e.getDate(),t};function convertDecToHex(e,t){let o="";for(let r=0;r<t;r++)o+=String.fromCharCode(e&255),e>>>=8;return o}var getCrcFromCrc32TableAndByteArray=e=>{if(!e.length)return 0;let t=-1,o=0,r=0,s=0;for(let n=0;n<e.length;n++)o=e[n],r=(t^o)&255,s=crcTable[r],t=t>>>8^s;return t^-1},getCrcFromCrc32Table=e=>e.length?getCrcFromCrc32TableAndByteArray(typeof e=="string"?new TextEncoder().encode(e):e):0,crcTable=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),getHeaders=(e,t,o,r,s,n)=>{const{content:i,path:l,created:c}=e,a=convertTime(c),d=convertDate(c),p=getCrcFromCrc32Table(s),h=n!==void 0?n:r,u=(0,import_core8._utf8_encode)(l),m=u!==l;let C="";if(m){const g=convertDecToHex(1,1)+convertDecToHex(getCrcFromCrc32Table(u),4)+u;C="up"+convertDecToHex(g.length,2)+g}const w="\0"+(m?"\0\b":"\0\0")+convertDecToHex(t?8:0,2)+convertDecToHex(a,2)+convertDecToHex(d,2)+convertDecToHex(h?p:0,4)+convertDecToHex(n??r,4)+convertDecToHex(r,4)+convertDecToHex(u.length,2)+convertDecToHex(C.length,2),f="PK"+w+u+C,v="PK\0"+w+"\0\0\0\0\0\0"+(i?"\0\0\0\0":"\0\0\0")+convertDecToHex(o,4)+u+C;return{localFileHeader:Uint8Array.from(f,g=>g.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(v,g=>g.charCodeAt(0))}},getDecodedContent=e=>{let t;if(typeof e=="string"){const o=atob(e.split(";base64,")[1]);t=Uint8Array.from(o,r=>r.charCodeAt(0))}else t=e;return{size:t.length,content:t}},getDeflatedHeaderAndContent=async(e,t)=>{const{content:o}=e,{size:r,content:s}=o?getDecodedContent(o):{size:0,content:Uint8Array.from([])};let n,i,l=!1;if(e.type==="file"&&s&&r>0){const d=await deflateLocalFile(s);n=d.content,i=d.size,l=!0}return{...getHeaders(e,l,t,r,s,i),content:n||s,isCompressed:l}},getHeaderAndContent=(e,t)=>{const{content:o}=e,{content:r}=o?getDecodedContent(o):{content:Uint8Array.from([])};return{...getHeaders(e,!1,t,r.length,r,void 0),content:r,isCompressed:!1}},buildCentralDirectoryEnd=(e,t,o)=>{const r="PK\0\0\0\0"+convertDecToHex(e,2)+convertDecToHex(e,2)+convertDecToHex(t,4)+convertDecToHex(o,4)+"\0\0";return Uint8Array.from(r,s=>s.charCodeAt(0))},ZipContainer=class{static addFolders(e){e.forEach(this.addFolder.bind(this))}static addFolder(e){this.folders.push({path:e,created:new Date,isBase64:!1,type:"folder"})}static addFile(e,t,o=!1){this.files.push({path:e,created:new Date,content:o?t:new TextEncoder().encode(t),isBase64:o,type:"file"})}static async getZipFile(e="application/zip"){const t=await this.buildCompressedFileStream();return this.clearStream(),new Blob([t],{type:e})}static getUncompressedZipFile(e="application/zip"){const t=this.buildFileStream();return this.clearStream(),new Blob([t],{type:e})}static clearStream(){this.folders=[],this.files=[]}static packageFiles(e){let t=0,o=0;for(const a of e){const{localFileHeader:d,centralDirectoryHeader:p,content:h}=a;t+=d.length+h.length,o+=p.length}const r=new Uint8Array(t),s=new Uint8Array(o);let n=0,i=0;for(const a of e){const{localFileHeader:d,centralDirectoryHeader:p,content:h}=a;r.set(d,n),n+=d.length,r.set(h,n),n+=h.length,s.set(p,i),i+=p.length}const l=buildCentralDirectoryEnd(e.length,o,t),c=new Uint8Array(r.length+s.length+l.length);return c.set(r),c.set(s,r.length),c.set(l,r.length+s.length),c}static async buildCompressedFileStream(){const e=[...this.folders,...this.files],t=[];let o=0;for(const r of e){const s=await getDeflatedHeaderAndContent(r,o),{localFileHeader:n,content:i}=s;t.push(s),o+=n.length+i.length}return this.packageFiles(t)}static buildFileStream(){const e=[...this.folders,...this.files],t=[];let o=0;for(const r of e){const s=getHeaderAndContent(r,o),{localFileHeader:n,content:i}=s;t.push(s),o+=n.length+i.length}return this.packageFiles(t)}};ZipContainer.folders=[],ZipContainer.files=[];
{
"name": "@ag-grid-community/csv-export",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js",

{
"name": "@ag-grid-community/csv-export",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./src/main.js",

@@ -1,1 +0,1 @@

export declare const VERSION = "32.2.0";
export declare const VERSION = "32.2.1";
{
"name": "@ag-grid-community/csv-export",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc