Socket
Socket
Sign inDemoInstall

@ag-grid-enterprise/clipboard

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-grid-enterprise/clipboard - npm Package Compare versions

Comparing version 28.2.0 to 28.2.1

tsconfig.cjs.es5.docs.json

2

dist/cjs/es5/clipboard/clipboardService.js

@@ -549,3 +549,3 @@ "use strict";

};
return this.csvCreator.getDataAsCsv(exportParams);
return this.csvCreator.getDataAsCsv(exportParams, true);
};

@@ -552,0 +552,0 @@ ClipboardService.prototype.dispatchFlashCells = function (cellsToFlash) {

@@ -512,3 +512,3 @@ "use strict";

};
return this.csvCreator.getDataAsCsv(exportParams);
return this.csvCreator.getDataAsCsv(exportParams, true);
}

@@ -515,0 +515,0 @@ dispatchFlashCells(cellsToFlash) {

/**
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.0
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.1
* @link https://www.ag-grid.com/

@@ -559,3 +559,3 @@ * @license Commercial

};
return this.csvCreator.getDataAsCsv(exportParams);
return this.csvCreator.getDataAsCsv(exportParams, true);
};

@@ -562,0 +562,0 @@ ClipboardService.prototype.dispatchFlashCells = function (cellsToFlash) {

/**
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.0
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.1
* @link https://www.ag-grid.com/

@@ -7,6 +7,6 @@ * @license Commercial

/**
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.0
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue * @version v28.2.1
* @link https://www.ag-grid.com/
* @license Commercial
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@ag-grid-community/core"),o=require("@ag-grid-enterprise/core"),r=require("@ag-grid-community/csv-export"),i=(e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)},function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),n=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},s=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.lastPasteOperationTime=0,t.navigatorApiFailed=!1,t}return i(o,e),o.prototype.init=function(){var e=this;this.logger=this.loggerFactory.create("ClipboardService"),this.rowModel.getType()===t.Constants.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady((function(t){e.gridCtrl=t.gridCtrl}))},o.prototype.pasteFromClipboard=function(){var e=this;this.logger.log("pasteFromClipboard"),!this.gridOptionsWrapper.isSuppressClipboardApi()&&!this.navigatorApiFailed&&navigator.clipboard&&navigator.clipboard.readText?navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((function(o){t._.doOnce((function(){console.warn(o),console.warn("AG Grid: Unable to use the Clipboard API (navigator.clipboard.readText()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API")}),"clipboardApiError"),e.navigatorApiFailed=!0,e.pasteFromClipboardLegacy()})):this.pasteFromClipboardLegacy()},o.prototype.pasteFromClipboardLegacy=function(){var e=this,t=!1,o=function(o){var r=(new Date).getTime();r-e.lastPasteOperationTime<50&&(t=!0,o.preventDefault()),e.lastPasteOperationTime=r};this.executeOnTempElement((function(e){e.addEventListener("paste",o),e.focus({preventScroll:!0})}),(function(r){var i=r.value;t?e.refocusLastFocusedCell():e.processClipboardData(i),r.removeEventListener("paste",o)}))},o.prototype.refocusLastFocusedCell=function(){var e=this.focusService.getFocusedCell();e&&this.focusService.setFocusedCell({rowIndex:e.rowIndex,column:e.column,rowPinned:e.rowPinned,forceBrowserFocus:!0})},o.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t._.stringToArray(e,this.gridOptionsWrapper.getClipboardDelimiter()),i=this.gridOptionsWrapper.getProcessDataFromClipboardFunc();if(i&&(r=i({data:r})),null!=r){this.gridOptionsWrapper.isSuppressLastEmptyLineOnPaste()&&this.removeLastLineIfBlank(r);this.doPasteOperation((function(e,t,i,n){o.rangeService&&o.rangeService.isMoreThanOneCell()&&!o.hasOnlyOneValueToPaste(r)?o.pasteIntoActiveRange(r,e,t,n):o.pasteStartingFromFocusedCell(r,e,t,i,n)}))}}},o.prototype.doPasteOperation=function(e){var o,r=this.gridOptionsWrapper.getApi(),i=this.gridOptionsWrapper.getColumnApi();if(this.eventService.dispatchEvent({type:t.Events.EVENT_PASTE_START,api:r,columnApi:i,source:"clipboard"}),this.clientSideRowModel){var n=this.gridOptionsWrapper.isAggregateOnlyChangedColumns();o=new t.ChangedPath(n,this.clientSideRowModel.getRootNode())}var s={},a=[];e(s,a,this.focusService.getFocusedCell(),o),o&&this.clientSideRowModel.doAggregate(o),this.rowRenderer.refreshCells(),this.dispatchFlashCells(s),this.fireRowChanged(a),this.refocusLastFocusedCell();var l={type:t.Events.EVENT_PASTE_END,source:"clipboard"};this.eventService.dispatchEvent(l)},o.prototype.pasteIntoActiveRange=function(e,o,r,i){var n=this,s=this.getRangeSize()%e.length!=0,a=0,l=0;this.iterateActiveRanges(!1,(function(p,c,d,u){if(u-a>=e.length){if(s)return;a+=l,l=0}var h=e[u-a];r.push(c);var g=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(e,r){if(e.isCellEditable(c)&&!e.isSuppressPaste(c)){r>=h.length&&(r%=h.length);var s=n.processCell(c,e,h[r],t.Constants.EXPORT_TYPE_DRAG_COPY,g);c.setDataValue(e,s,t.Constants.SOURCE_PASTE),i&&i.addParentNode(c.parent,[e]);var a=n.cellPositionUtils.createIdFromValues(p.rowIndex,e,p.rowPinned);o[a]=!0}})),l++}))},o.prototype.pasteStartingFromFocusedCell=function(e,o,r,i,n){if(i){var s={rowIndex:i.rowIndex,rowPinned:i.rowPinned},a=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,r,o,n):this.pasteMultipleValues(e,s,r,a,o,t.Constants.EXPORT_TYPE_CLIPBOARD,n)}},o.prototype.isPasteSingleValueIntoRange=function(e){return this.hasOnlyOneValueToPaste(e)&&null!=this.rangeService&&!this.rangeService.isEmpty()},o.prototype.pasteSingleValueIntoRange=function(e,o,r,i){var n=this,s=e[0][0];this.iterateActiveRanges(!1,(function(e,a,l){o.push(a),l.forEach((function(e){return n.updateCellValue(a,e,s,r,t.Constants.EXPORT_TYPE_CLIPBOARD,i)}))}))},o.prototype.hasOnlyOneValueToPaste=function(e){return 1===e.length&&1===e[0].length},o.prototype.copyRangeDown=function(){var e=this;if(this.rangeService&&!this.rangeService.isEmpty()){var o=[];this.doPasteOperation((function(r,i,n,s){var a=e.gridOptionsWrapper.getProcessCellForClipboardFunc(),l=e.gridOptionsWrapper.getProcessCellFromClipboardFunc();e.iterateActiveRanges(!0,(function(n,p,c){o.length?(i.push(p),c.forEach((function(i,a){if(i.isCellEditable(p)&&!i.isSuppressPaste(p)){var c=e.processCell(p,i,o[a],t.Constants.EXPORT_TYPE_DRAG_COPY,l);p.setDataValue(i,c,t.Constants.SOURCE_PASTE),s&&s.addParentNode(p.parent,[i]);var d=e.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=e.processCell(p,r,e.valueService.getValue(r,p),t.Constants.EXPORT_TYPE_DRAG_COPY,a);o.push(i)}))}))}))}},o.prototype.removeLastLineIfBlank=function(e){var o=t._.last(e);if(o&&1===o.length&&""===o[0]){if(1===e.length)return;t._.removeFromArray(e,o)}},o.prototype.fireRowChanged=function(e){var o=this;this.gridOptionsWrapper.isFullRowEdit()&&e.forEach((function(e){var r={type:t.Events.EVENT_ROW_VALUE_CHANGED,node:e,data:e.data,rowIndex:e.rowIndex,rowPinned:e.rowPinned};o.eventService.dispatchEvent(r)}))},o.prototype.pasteMultipleValues=function(e,t,o,r,i,n,s){var a=this,l=t,p=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!l)return null;var e=a.rowPositionUtils.getRowNode(l);if(l=a.cellNavigationService.getRowBelow({rowPinned:l.rowPinned,rowIndex:l.rowIndex}),null==e)return null;if(!(e.detail||e.footer||p&&e.group))return e}}();t&&(e.forEach((function(e,o){return a.updateCellValue(t,r[o],e,i,n,s)})),o.push(t))}))},o.prototype.updateCellValue=function(e,o,r,i,n,s){if(e&&o&&o.isCellEditable(e)&&!o.isSuppressPaste(e)){var a=this.processCell(e,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());e.setDataValue(o,a,t.Constants.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(e.rowIndex,o,e.rowPinned)]=!0,s&&s.addParentNode(e.parent,[o])}},o.prototype.copyToClipboard=function(e){void 0===e&&(e={});var t=e.includeHeaders,o=e.includeGroupHeaders;this.logger.log("copyToClipboard: includeHeaders = "+t),null==t&&(t=this.gridOptionsWrapper.isCopyHeadersToClipboard()),null==o&&(o=this.gridOptionsWrapper.isCopyGroupHeadersToClipboard());var r={includeHeaders:t,includeGroupHeaders:o},i=!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();!this.rangeService||this.rangeService.isEmpty()||this.shouldSkipSingleCellRange()?i&&!this.selectionService.isEmpty()?this.copySelectedRowsToClipboard(r):this.focusService.isAnyCellFocused()&&this.copyFocusedCellToClipboard(r):this.copySelectedRangeToClipboard(r)},o.prototype.shouldSkipSingleCellRange=function(){return this.gridOptionsWrapper.isSuppressCopySingleCellRanges()&&!this.rangeService.isMoreThanOneCell()},o.prototype.iterateActiveRanges=function(e,t,o){var r=this;if(this.rangeService&&!this.rangeService.isEmpty()){var i=this.rangeService.getCellRanges();e?this.iterateActiveRange(i[0],t,o,!0):i.forEach((function(e,n){return r.iterateActiveRange(e,t,o,n===i.length-1)}))}},o.prototype.iterateActiveRange=function(e,t,o,r){if(this.rangeService){var i=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e);o&&e.columns&&o(e.columns);for(var s=0,a=!1;!a&&null!=i;){var l=this.rowPositionUtils.getRowNode(i);a=this.rowPositionUtils.sameRow(i,n),t(i,l,e.columns,s++,a&&r),i=this.cellNavigationService.getRowBelow(i)}}},o.prototype.copySelectedRangeToClipboard=function(e){if(void 0===e&&(e={}),this.rangeService&&!this.rangeService.isEmpty()){var t=this.rangeService.areAllRangesAbleToMerge()?this.buildDataFromMergedRanges(e):this.buildDataFromRanges(e),o=t.data,r=t.cellsToFlash;this.copyDataToClipboard(o),this.dispatchFlashCells(r)}},o.prototype.buildDataFromMergedRanges=function(e){var t=this,o=new Set,r=this.rangeService.getCellRanges(),i=new Map,n=[],s={};r.forEach((function(e){e.columns.forEach((function(e){return o.add(e)}));var r=t.getRangeRowPositionsAndCellsToFlash(e),a=r.rowPositions,l=r.cellsToFlash;a.forEach((function(e){var t=e.rowIndex+"-"+(e.rowPinned||"null");i.get(t)||(i.set(t,!0),n.push(e))})),Object.assign(s,l)}));var a=this.columnModel.getAllDisplayedColumns(),l=Array.from(o);return l.sort((function(e,t){return a.indexOf(e)-a.indexOf(t)})),{data:this.buildExportParams({columns:l,rowPositions:n,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}),cellsToFlash:s}},o.prototype.buildDataFromRanges=function(e){var t=this,o=this.rangeService.getCellRanges(),r=[],i={};return o.forEach((function(o){var n=t.getRangeRowPositionsAndCellsToFlash(o),s=n.rowPositions,a=n.cellsToFlash;Object.assign(i,a),r.push(t.buildExportParams({columns:o.columns,rowPositions:s,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}))})),{data:r.join("\n"),cellsToFlash:i}},o.prototype.getRangeRowPositionsAndCellsToFlash=function(e){for(var t=this,o=[],r={},i=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),s=i;s&&(o.push(s),e.columns.forEach((function(e){var o=t.cellPositionUtils.createIdFromValues(s.rowIndex,e,s.rowPinned);r[o]=!0})),!this.rowPositionUtils.sameRow(s,n));)s=this.cellNavigationService.getRowBelow(s);return{rowPositions:o,cellsToFlash:r}},o.prototype.copyFocusedCellToClipboard=function(e){var t;void 0===e&&(e={});var o=this.focusService.getFocusedCell();if(null!=o){var r=this.cellPositionUtils.createId(o),i={rowPinned:o.rowPinned,rowIndex:o.rowIndex},n=o.column,s=this.buildExportParams({columns:[n],rowPositions:[i],includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders});this.copyDataToClipboard(s),this.dispatchFlashCells(((t={})[r]=!0,t))}},o.prototype.copySelectedRowsToClipboard=function(e){void 0===e&&(e={});var t=e.columnKeys,o=e.includeHeaders,r=e.includeGroupHeaders,i=this.buildExportParams({columns:t,includeHeaders:o,includeGroupHeaders:r});this.copyDataToClipboard(i)},o.prototype.buildExportParams=function(e){var t=e.columns,o=e.rowPositions,r=e.includeHeaders,i=void 0!==r&&r,n=e.includeGroupHeaders,s={columnKeys:t,rowPositions:o,skipColumnHeaders:!i,skipColumnGroupHeaders:!(void 0!==n&&n),suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDelimiter(),onlySelected:!o,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processRowGroupCallback:function(e){return e.node.key},processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),processGroupHeaderCallback:this.gridOptionsWrapper.getProcessGroupHeaderForClipboardFunc()};return this.csvCreator.getDataAsCsv(s)},o.prototype.dispatchFlashCells=function(e){var o=this;window.setTimeout((function(){var r={type:t.Events.EVENT_FLASH_CELLS,cells:e};o.eventService.dispatchEvent(r)}),0)},o.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,type:r}):o},o.prototype.copyDataToClipboard=function(e){var o=this,r=this.gridOptionsWrapper.getSendToClipboardFunc();r?r({data:e}):!this.gridOptionsWrapper.isSuppressClipboardApi()&&navigator.clipboard?navigator.clipboard.writeText(e).catch((function(r){t._.doOnce((function(){console.warn(r),console.warn("AG Grid: Unable to use the Clipboard API (navigator.clipboard.writeText()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API.")}),"clipboardApiError"),o.copyDataToClipboardLegacy(e)})):this.copyDataToClipboardLegacy(e)},o.prototype.copyDataToClipboardLegacy=function(e){var t=this;this.executeOnTempElement((function(o){var r=t.gridOptionsWrapper.getDocument(),i=r.activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),r.execCommand("copy")||console.warn("AG Grid: Browser did not allow document.execCommand('copy'). Ensure api.copySelectedRowsToClipboard() is invoked via a user event, i.e. button click, otherwise the browser will prevent it for security reasons."),null!=i&&null!=i.focus&&i.focus({preventScroll:!0})}))},o.prototype.executeOnTempElement=function(e,t){var o=this.gridOptionsWrapper.getDocument(),r=o.createElement("textarea");r.style.width="1px",r.style.height="1px",r.style.top=o.documentElement.scrollTop+"px",r.style.left=o.documentElement.scrollLeft+"px",r.style.position="absolute",r.style.opacity="0";var i=this.gridCtrl.getGui();i.appendChild(r);try{e(r)}catch(e){console.warn("AG Grid: Browser does not support document.execCommand('copy') for clipboard operations")}t?window.setTimeout((function(){t(r),i.removeChild(r)}),100):i.removeChild(r)},o.prototype.getRangeSize=function(){var e=this.rangeService.getCellRanges(),t=0,o=0;return e.length>0&&(t=this.rangeService.getRangeStartRow(e[0]).rowIndex,o=this.rangeService.getRangeEndRow(e[0]).rowIndex),t-o+1},n([t.Autowired("csvCreator")],o.prototype,"csvCreator",void 0),n([t.Autowired("loggerFactory")],o.prototype,"loggerFactory",void 0),n([t.Autowired("selectionService")],o.prototype,"selectionService",void 0),n([t.Optional("rangeService")],o.prototype,"rangeService",void 0),n([t.Autowired("rowModel")],o.prototype,"rowModel",void 0),n([t.Autowired("ctrlsService")],o.prototype,"ctrlsService",void 0),n([t.Autowired("valueService")],o.prototype,"valueService",void 0),n([t.Autowired("focusService")],o.prototype,"focusService",void 0),n([t.Autowired("rowRenderer")],o.prototype,"rowRenderer",void 0),n([t.Autowired("columnModel")],o.prototype,"columnModel",void 0),n([t.Autowired("cellNavigationService")],o.prototype,"cellNavigationService",void 0),n([t.Autowired("cellPositionUtils")],o.prototype,"cellPositionUtils",void 0),n([t.Autowired("rowPositionUtils")],o.prototype,"rowPositionUtils",void 0),n([t.PostConstruct],o.prototype,"init",null),o=n([t.Bean("clipboardService")],o)}(t.BeanStub),a={moduleName:t.ModuleNames.ClipboardModule,beans:[s],dependantModules:[o.EnterpriseCoreModule,r.CsvExportModule]};exports.ClipboardModule=a;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@ag-grid-community/core"),o=require("@ag-grid-enterprise/core"),r=require("@ag-grid-community/csv-export"),i=(e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)},function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),n=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},s=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.lastPasteOperationTime=0,t.navigatorApiFailed=!1,t}return i(o,e),o.prototype.init=function(){var e=this;this.logger=this.loggerFactory.create("ClipboardService"),this.rowModel.getType()===t.Constants.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady((function(t){e.gridCtrl=t.gridCtrl}))},o.prototype.pasteFromClipboard=function(){var e=this;this.logger.log("pasteFromClipboard"),!this.gridOptionsWrapper.isSuppressClipboardApi()&&!this.navigatorApiFailed&&navigator.clipboard&&navigator.clipboard.readText?navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((function(o){t._.doOnce((function(){console.warn(o),console.warn("AG Grid: Unable to use the Clipboard API (navigator.clipboard.readText()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API")}),"clipboardApiError"),e.navigatorApiFailed=!0,e.pasteFromClipboardLegacy()})):this.pasteFromClipboardLegacy()},o.prototype.pasteFromClipboardLegacy=function(){var e=this,t=!1,o=function(o){var r=(new Date).getTime();r-e.lastPasteOperationTime<50&&(t=!0,o.preventDefault()),e.lastPasteOperationTime=r};this.executeOnTempElement((function(e){e.addEventListener("paste",o),e.focus({preventScroll:!0})}),(function(r){var i=r.value;t?e.refocusLastFocusedCell():e.processClipboardData(i),r.removeEventListener("paste",o)}))},o.prototype.refocusLastFocusedCell=function(){var e=this.focusService.getFocusedCell();e&&this.focusService.setFocusedCell({rowIndex:e.rowIndex,column:e.column,rowPinned:e.rowPinned,forceBrowserFocus:!0})},o.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t._.stringToArray(e,this.gridOptionsWrapper.getClipboardDelimiter()),i=this.gridOptionsWrapper.getProcessDataFromClipboardFunc();if(i&&(r=i({data:r})),null!=r){this.gridOptionsWrapper.isSuppressLastEmptyLineOnPaste()&&this.removeLastLineIfBlank(r);this.doPasteOperation((function(e,t,i,n){o.rangeService&&o.rangeService.isMoreThanOneCell()&&!o.hasOnlyOneValueToPaste(r)?o.pasteIntoActiveRange(r,e,t,n):o.pasteStartingFromFocusedCell(r,e,t,i,n)}))}}},o.prototype.doPasteOperation=function(e){var o,r=this.gridOptionsWrapper.getApi(),i=this.gridOptionsWrapper.getColumnApi();if(this.eventService.dispatchEvent({type:t.Events.EVENT_PASTE_START,api:r,columnApi:i,source:"clipboard"}),this.clientSideRowModel){var n=this.gridOptionsWrapper.isAggregateOnlyChangedColumns();o=new t.ChangedPath(n,this.clientSideRowModel.getRootNode())}var s={},a=[];e(s,a,this.focusService.getFocusedCell(),o),o&&this.clientSideRowModel.doAggregate(o),this.rowRenderer.refreshCells(),this.dispatchFlashCells(s),this.fireRowChanged(a),this.refocusLastFocusedCell();var l={type:t.Events.EVENT_PASTE_END,source:"clipboard"};this.eventService.dispatchEvent(l)},o.prototype.pasteIntoActiveRange=function(e,o,r,i){var n=this,s=this.getRangeSize()%e.length!=0,a=0,l=0;this.iterateActiveRanges(!1,(function(p,c,d,u){if(u-a>=e.length){if(s)return;a+=l,l=0}var h=e[u-a];r.push(c);var g=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(e,r){if(e.isCellEditable(c)&&!e.isSuppressPaste(c)){r>=h.length&&(r%=h.length);var s=n.processCell(c,e,h[r],t.Constants.EXPORT_TYPE_DRAG_COPY,g);c.setDataValue(e,s,t.Constants.SOURCE_PASTE),i&&i.addParentNode(c.parent,[e]);var a=n.cellPositionUtils.createIdFromValues(p.rowIndex,e,p.rowPinned);o[a]=!0}})),l++}))},o.prototype.pasteStartingFromFocusedCell=function(e,o,r,i,n){if(i){var s={rowIndex:i.rowIndex,rowPinned:i.rowPinned},a=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,r,o,n):this.pasteMultipleValues(e,s,r,a,o,t.Constants.EXPORT_TYPE_CLIPBOARD,n)}},o.prototype.isPasteSingleValueIntoRange=function(e){return this.hasOnlyOneValueToPaste(e)&&null!=this.rangeService&&!this.rangeService.isEmpty()},o.prototype.pasteSingleValueIntoRange=function(e,o,r,i){var n=this,s=e[0][0];this.iterateActiveRanges(!1,(function(e,a,l){o.push(a),l.forEach((function(e){return n.updateCellValue(a,e,s,r,t.Constants.EXPORT_TYPE_CLIPBOARD,i)}))}))},o.prototype.hasOnlyOneValueToPaste=function(e){return 1===e.length&&1===e[0].length},o.prototype.copyRangeDown=function(){var e=this;if(this.rangeService&&!this.rangeService.isEmpty()){var o=[];this.doPasteOperation((function(r,i,n,s){var a=e.gridOptionsWrapper.getProcessCellForClipboardFunc(),l=e.gridOptionsWrapper.getProcessCellFromClipboardFunc();e.iterateActiveRanges(!0,(function(n,p,c){o.length?(i.push(p),c.forEach((function(i,a){if(i.isCellEditable(p)&&!i.isSuppressPaste(p)){var c=e.processCell(p,i,o[a],t.Constants.EXPORT_TYPE_DRAG_COPY,l);p.setDataValue(i,c,t.Constants.SOURCE_PASTE),s&&s.addParentNode(p.parent,[i]);var d=e.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=e.processCell(p,r,e.valueService.getValue(r,p),t.Constants.EXPORT_TYPE_DRAG_COPY,a);o.push(i)}))}))}))}},o.prototype.removeLastLineIfBlank=function(e){var o=t._.last(e);if(o&&1===o.length&&""===o[0]){if(1===e.length)return;t._.removeFromArray(e,o)}},o.prototype.fireRowChanged=function(e){var o=this;this.gridOptionsWrapper.isFullRowEdit()&&e.forEach((function(e){var r={type:t.Events.EVENT_ROW_VALUE_CHANGED,node:e,data:e.data,rowIndex:e.rowIndex,rowPinned:e.rowPinned};o.eventService.dispatchEvent(r)}))},o.prototype.pasteMultipleValues=function(e,t,o,r,i,n,s){var a=this,l=t,p=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!l)return null;var e=a.rowPositionUtils.getRowNode(l);if(l=a.cellNavigationService.getRowBelow({rowPinned:l.rowPinned,rowIndex:l.rowIndex}),null==e)return null;if(!(e.detail||e.footer||p&&e.group))return e}}();t&&(e.forEach((function(e,o){return a.updateCellValue(t,r[o],e,i,n,s)})),o.push(t))}))},o.prototype.updateCellValue=function(e,o,r,i,n,s){if(e&&o&&o.isCellEditable(e)&&!o.isSuppressPaste(e)){var a=this.processCell(e,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());e.setDataValue(o,a,t.Constants.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(e.rowIndex,o,e.rowPinned)]=!0,s&&s.addParentNode(e.parent,[o])}},o.prototype.copyToClipboard=function(e){void 0===e&&(e={});var t=e.includeHeaders,o=e.includeGroupHeaders;this.logger.log("copyToClipboard: includeHeaders = "+t),null==t&&(t=this.gridOptionsWrapper.isCopyHeadersToClipboard()),null==o&&(o=this.gridOptionsWrapper.isCopyGroupHeadersToClipboard());var r={includeHeaders:t,includeGroupHeaders:o},i=!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();!this.rangeService||this.rangeService.isEmpty()||this.shouldSkipSingleCellRange()?i&&!this.selectionService.isEmpty()?this.copySelectedRowsToClipboard(r):this.focusService.isAnyCellFocused()&&this.copyFocusedCellToClipboard(r):this.copySelectedRangeToClipboard(r)},o.prototype.shouldSkipSingleCellRange=function(){return this.gridOptionsWrapper.isSuppressCopySingleCellRanges()&&!this.rangeService.isMoreThanOneCell()},o.prototype.iterateActiveRanges=function(e,t,o){var r=this;if(this.rangeService&&!this.rangeService.isEmpty()){var i=this.rangeService.getCellRanges();e?this.iterateActiveRange(i[0],t,o,!0):i.forEach((function(e,n){return r.iterateActiveRange(e,t,o,n===i.length-1)}))}},o.prototype.iterateActiveRange=function(e,t,o,r){if(this.rangeService){var i=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e);o&&e.columns&&o(e.columns);for(var s=0,a=!1;!a&&null!=i;){var l=this.rowPositionUtils.getRowNode(i);a=this.rowPositionUtils.sameRow(i,n),t(i,l,e.columns,s++,a&&r),i=this.cellNavigationService.getRowBelow(i)}}},o.prototype.copySelectedRangeToClipboard=function(e){if(void 0===e&&(e={}),this.rangeService&&!this.rangeService.isEmpty()){var t=this.rangeService.areAllRangesAbleToMerge()?this.buildDataFromMergedRanges(e):this.buildDataFromRanges(e),o=t.data,r=t.cellsToFlash;this.copyDataToClipboard(o),this.dispatchFlashCells(r)}},o.prototype.buildDataFromMergedRanges=function(e){var t=this,o=new Set,r=this.rangeService.getCellRanges(),i=new Map,n=[],s={};r.forEach((function(e){e.columns.forEach((function(e){return o.add(e)}));var r=t.getRangeRowPositionsAndCellsToFlash(e),a=r.rowPositions,l=r.cellsToFlash;a.forEach((function(e){var t=e.rowIndex+"-"+(e.rowPinned||"null");i.get(t)||(i.set(t,!0),n.push(e))})),Object.assign(s,l)}));var a=this.columnModel.getAllDisplayedColumns(),l=Array.from(o);return l.sort((function(e,t){return a.indexOf(e)-a.indexOf(t)})),{data:this.buildExportParams({columns:l,rowPositions:n,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}),cellsToFlash:s}},o.prototype.buildDataFromRanges=function(e){var t=this,o=this.rangeService.getCellRanges(),r=[],i={};return o.forEach((function(o){var n=t.getRangeRowPositionsAndCellsToFlash(o),s=n.rowPositions,a=n.cellsToFlash;Object.assign(i,a),r.push(t.buildExportParams({columns:o.columns,rowPositions:s,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}))})),{data:r.join("\n"),cellsToFlash:i}},o.prototype.getRangeRowPositionsAndCellsToFlash=function(e){for(var t=this,o=[],r={},i=this.rangeService.getRangeStartRow(e),n=this.rangeService.getRangeEndRow(e),s=i;s&&(o.push(s),e.columns.forEach((function(e){var o=t.cellPositionUtils.createIdFromValues(s.rowIndex,e,s.rowPinned);r[o]=!0})),!this.rowPositionUtils.sameRow(s,n));)s=this.cellNavigationService.getRowBelow(s);return{rowPositions:o,cellsToFlash:r}},o.prototype.copyFocusedCellToClipboard=function(e){var t;void 0===e&&(e={});var o=this.focusService.getFocusedCell();if(null!=o){var r=this.cellPositionUtils.createId(o),i={rowPinned:o.rowPinned,rowIndex:o.rowIndex},n=o.column,s=this.buildExportParams({columns:[n],rowPositions:[i],includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders});this.copyDataToClipboard(s),this.dispatchFlashCells(((t={})[r]=!0,t))}},o.prototype.copySelectedRowsToClipboard=function(e){void 0===e&&(e={});var t=e.columnKeys,o=e.includeHeaders,r=e.includeGroupHeaders,i=this.buildExportParams({columns:t,includeHeaders:o,includeGroupHeaders:r});this.copyDataToClipboard(i)},o.prototype.buildExportParams=function(e){var t=e.columns,o=e.rowPositions,r=e.includeHeaders,i=void 0!==r&&r,n=e.includeGroupHeaders,s={columnKeys:t,rowPositions:o,skipColumnHeaders:!i,skipColumnGroupHeaders:!(void 0!==n&&n),suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDelimiter(),onlySelected:!o,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processRowGroupCallback:function(e){return e.node.key},processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),processGroupHeaderCallback:this.gridOptionsWrapper.getProcessGroupHeaderForClipboardFunc()};return this.csvCreator.getDataAsCsv(s,!0)},o.prototype.dispatchFlashCells=function(e){var o=this;window.setTimeout((function(){var r={type:t.Events.EVENT_FLASH_CELLS,cells:e};o.eventService.dispatchEvent(r)}),0)},o.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,type:r}):o},o.prototype.copyDataToClipboard=function(e){var o=this,r=this.gridOptionsWrapper.getSendToClipboardFunc();r?r({data:e}):!this.gridOptionsWrapper.isSuppressClipboardApi()&&navigator.clipboard?navigator.clipboard.writeText(e).catch((function(r){t._.doOnce((function(){console.warn(r),console.warn("AG Grid: Unable to use the Clipboard API (navigator.clipboard.writeText()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API.")}),"clipboardApiError"),o.copyDataToClipboardLegacy(e)})):this.copyDataToClipboardLegacy(e)},o.prototype.copyDataToClipboardLegacy=function(e){var t=this;this.executeOnTempElement((function(o){var r=t.gridOptionsWrapper.getDocument(),i=r.activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),r.execCommand("copy")||console.warn("AG Grid: Browser did not allow document.execCommand('copy'). Ensure api.copySelectedRowsToClipboard() is invoked via a user event, i.e. button click, otherwise the browser will prevent it for security reasons."),null!=i&&null!=i.focus&&i.focus({preventScroll:!0})}))},o.prototype.executeOnTempElement=function(e,t){var o=this.gridOptionsWrapper.getDocument(),r=o.createElement("textarea");r.style.width="1px",r.style.height="1px",r.style.top=o.documentElement.scrollTop+"px",r.style.left=o.documentElement.scrollLeft+"px",r.style.position="absolute",r.style.opacity="0";var i=this.gridCtrl.getGui();i.appendChild(r);try{e(r)}catch(e){console.warn("AG Grid: Browser does not support document.execCommand('copy') for clipboard operations")}t?window.setTimeout((function(){t(r),i.removeChild(r)}),100):i.removeChild(r)},o.prototype.getRangeSize=function(){var e=this.rangeService.getCellRanges(),t=0,o=0;return e.length>0&&(t=this.rangeService.getRangeStartRow(e[0]).rowIndex,o=this.rangeService.getRangeEndRow(e[0]).rowIndex),t-o+1},n([t.Autowired("csvCreator")],o.prototype,"csvCreator",void 0),n([t.Autowired("loggerFactory")],o.prototype,"loggerFactory",void 0),n([t.Autowired("selectionService")],o.prototype,"selectionService",void 0),n([t.Optional("rangeService")],o.prototype,"rangeService",void 0),n([t.Autowired("rowModel")],o.prototype,"rowModel",void 0),n([t.Autowired("ctrlsService")],o.prototype,"ctrlsService",void 0),n([t.Autowired("valueService")],o.prototype,"valueService",void 0),n([t.Autowired("focusService")],o.prototype,"focusService",void 0),n([t.Autowired("rowRenderer")],o.prototype,"rowRenderer",void 0),n([t.Autowired("columnModel")],o.prototype,"columnModel",void 0),n([t.Autowired("cellNavigationService")],o.prototype,"cellNavigationService",void 0),n([t.Autowired("cellPositionUtils")],o.prototype,"cellPositionUtils",void 0),n([t.Autowired("rowPositionUtils")],o.prototype,"rowPositionUtils",void 0),n([t.PostConstruct],o.prototype,"init",null),o=n([t.Bean("clipboardService")],o)}(t.BeanStub),a={moduleName:t.ModuleNames.ClipboardModule,beans:[s],dependantModules:[o.EnterpriseCoreModule,r.CsvExportModule]};exports.ClipboardModule=a;

@@ -547,3 +547,3 @@ var __extends = (this && this.__extends) || (function () {

};
return this.csvCreator.getDataAsCsv(exportParams);
return this.csvCreator.getDataAsCsv(exportParams, true);
};

@@ -550,0 +550,0 @@ ClipboardService.prototype.dispatchFlashCells = function (cellsToFlash) {

@@ -510,3 +510,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

};
return this.csvCreator.getDataAsCsv(exportParams);
return this.csvCreator.getDataAsCsv(exportParams, true);
}

@@ -513,0 +513,0 @@ dispatchFlashCells(cellsToFlash) {

{
"name": "@ag-grid-enterprise/clipboard",
"version": "28.2.0",
"version": "28.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

@@ -10,3 +10,3 @@ "main": "./dist/cjs/es5/main.js",

"clean": "rimraf dist .hash",
"build-cjs": "npx tsc -p tsconfig.cjs.es5.json && npx tsc -p tsconfig.cjs.es6.json",
"build-cjs": "rimraf dist/tsconfig.cjs.es5.docs.tsbuildinfo && npx tsc -p tsconfig.cjs.es5.json && npx tsc -p tsconfig.cjs.es6.json",
"build-esm": "npx tsc -p tsconfig.esm.es5.json && npx tsc -p tsconfig.esm.es6.json",

@@ -52,5 +52,5 @@ "build-cjs-prod": "npx tsc -p tsconfig.cjs.es5.json --sourceMap false && npx tsc -p tsconfig.cjs.es6.json --sourceMap false",

"dependencies": {
"@ag-grid-community/core": "~28.2.0",
"@ag-grid-community/csv-export": "~28.2.0",
"@ag-grid-enterprise/core": "~28.2.0"
"@ag-grid-community/core": "~28.2.1",
"@ag-grid-community/csv-export": "~28.2.1",
"@ag-grid-enterprise/core": "~28.2.1"
},

@@ -57,0 +57,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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