@ag-grid-enterprise/clipboard
Advanced tools
Comparing version 26.0.0 to 26.1.0
@@ -172,3 +172,3 @@ "use strict"; | ||
var newValue = _this.processCell(rowNode, column, currentRowData[idx], core_1.Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, newValue, core_1.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, newValue, core_1.Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -244,3 +244,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var firstRowValue = _this.processCell(rowNode, column, firstRowValues[index], core_1.Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, firstRowValue, core_1.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, firstRowValue, core_1.Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -331,3 +331,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var processedValue = this.processCell(rowNode, column, value, type, this.gridOptionsWrapper.getProcessCellFromClipboardFunc()); | ||
this.valueService.setValue(rowNode, column, processedValue, core_1.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, processedValue, core_1.Constants.SOURCE_PASTE); | ||
var cellId = this.cellPositionUtils.createIdFromValues(rowNode.rowIndex, column, rowNode.rowPinned); | ||
@@ -334,0 +334,0 @@ cellsToFlash[cellId] = true; |
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://www.ag-grid.com/ | ||
@@ -183,3 +183,3 @@ ' * @license Commercial | ||
var newValue = _this.processCell(rowNode, column, currentRowData[idx], core.Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, newValue, core.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, newValue, core.Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -255,3 +255,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var firstRowValue = _this.processCell(rowNode, column, firstRowValues[index], core.Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, firstRowValue, core.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, firstRowValue, core.Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -342,3 +342,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var processedValue = this.processCell(rowNode, column, value, type, this.gridOptionsWrapper.getProcessCellFromClipboardFunc()); | ||
this.valueService.setValue(rowNode, column, processedValue, core.Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, processedValue, core.Constants.SOURCE_PASTE); | ||
var cellId = this.cellPositionUtils.createIdFromValues(rowNode.rowIndex, column, rowNode.rowPinned); | ||
@@ -345,0 +345,0 @@ cellsToFlash[cellId] = true; |
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://www.ag-grid.com/ | ||
@@ -8,6 +8,6 @@ ' * @license Commercial | ||
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://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,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a},a=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return 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;this.executeOnTempElement((function(e){return e.focus({preventScroll:!0})}),(function(t){var o=t.value;e.processClipboardData(o)}))},o.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t._.stringToArray(e,this.gridOptionsWrapper.getClipboardDeliminator()),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 a={},s=[],p=this.focusService.getFocusedCell();e(a,s,p,o),o&&this.clientSideRowModel.doAggregate(o),this.rowRenderer.refreshCells(),this.dispatchFlashCells(a),this.fireRowChanged(s),p&&this.focusService.setFocusedCell(p.rowIndex,p.column,p.rowPinned,!0),this.eventService.dispatchEvent({type:t.Events.EVENT_PASTE_END,api:r,columnApi:i,source:"clipboard"})},o.prototype.pasteIntoActiveRange=function(e,o,r,i){var n=this,a=this.getRangeSize()%e.length!=0,s=0,p=0;this.iterateActiveRanges(!1,(function(l,c,d,u){if(u-s>=e.length){if(a)return;s+=p,p=0}var g=e[u-s];r.push(c);var h=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(e,r){if(e.isCellEditable(c)&&!e.isSuppressPaste(c)){r>=g.length&&(r%=g.length);var a=n.processCell(c,e,g[r],t.Constants.EXPORT_TYPE_DRAG_COPY,h);n.valueService.setValue(c,e,a,t.Constants.SOURCE_PASTE),i&&i.addParentNode(c.parent,[e]);var s=n.cellPositionUtils.createIdFromValues(l.rowIndex,e,l.rowPinned);o[s]=!0}})),p++}))},o.prototype.pasteStartingFromFocusedCell=function(e,o,r,i,n){if(i){var a={rowIndex:i.rowIndex,rowPinned:i.rowPinned},s=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,r,o,n):this.pasteMultipleValues(e,a,r,s,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,a=e[0][0];this.iterateActiveRanges(!1,(function(e,s,p){o.push(s),p.forEach((function(e){return n.updateCellValue(s,e,a,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,a){var s=e.gridOptionsWrapper.getProcessCellForClipboardFunc(),p=e.gridOptionsWrapper.getProcessCellFromClipboardFunc();e.iterateActiveRanges(!0,(function(n,l,c){o.length?(i.push(l),c.forEach((function(i,s){if(i.isCellEditable(l)&&!i.isSuppressPaste(l)){var c=e.processCell(l,i,o[s],t.Constants.EXPORT_TYPE_DRAG_COPY,p);e.valueService.setValue(l,i,c,t.Constants.SOURCE_PASTE),a&&a.addParentNode(l.parent,[i]);var d=e.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=e.processCell(l,r,e.valueService.getValue(r,l),t.Constants.EXPORT_TYPE_DRAG_COPY,s);o.push(i)}))}))}))}},o.prototype.removeLastLineIfBlank=function(e){var o=t._.last(e);o&&1===o.length&&""===o[0]&&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,context:o.gridOptionsWrapper.getContext(),api:o.gridOptionsWrapper.getApi(),columnApi:o.gridOptionsWrapper.getColumnApi()};o.eventService.dispatchEvent(r)}))},o.prototype.pasteMultipleValues=function(e,t,o,r,i,n,a){var s=this,p=t,l=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!p)return null;var e=s.rowPositionUtils.getRowNode(p);if(p=s.cellNavigationService.getRowBelow({rowPinned:p.rowPinned,rowIndex:p.rowIndex}),null==e)return null;if(!(e.detail||e.footer||l&&e.group))return e}}();t&&(e.forEach((function(e,o){return s.updateCellValue(t,r[o],e,i,n,a)})),o.push(t))}))},o.prototype.updateCellValue=function(e,o,r,i,n,a){if(e&&o&&o.isCellEditable(e)&&!o.isSuppressPaste(e)){var s=this.processCell(e,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());this.valueService.setValue(e,o,s,t.Constants.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(e.rowIndex,o,e.rowPinned)]=!0,a&&a.addParentNode(e.parent,[o])}},o.prototype.copyToClipboard=function(e){this.logger.log("copyToClipboard: includeHeaders = "+e),null==e&&(e=this.gridOptionsWrapper.isCopyHeadersToClipboard());var t=!this.selectionService.isEmpty()&&!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();this.rangeService&&this.rangeService.isMoreThanOneCell()?this.copySelectedRangeToClipboard(e):t?this.copySelectedRowsToClipboard(e):this.focusService.isAnyCellFocused()?this.copyFocusedCellToClipboard(e):this.copySelectedRangeToClipboard(e)},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 a=0,s=!1;!s&&null!=i;){var p=this.rowPositionUtils.getRowNode(i);s=this.rowPositionUtils.sameRow(i,n),t(i,p,e.columns,a++,s&&r),i=this.cellNavigationService.getRowBelow(i)}}},o.prototype.copySelectedRangeToClipboard=function(e){var o=this;if(void 0===e&&(e=!1),this.rangeService&&!this.rangeService.isEmpty()){var r=this.gridOptionsWrapper.getClipboardDeliminator(),i="",n={};this.iterateActiveRanges(!1,(function(e,a,s,p,l){var c=o.gridOptionsWrapper.getProcessCellForClipboardFunc();s.forEach((function(s,p){var l=o.valueService.getValue(s,a),d=o.processCell(a,s,l,t.Constants.EXPORT_TYPE_CLIPBOARD,c);0!=p&&(i+=r),t._.exists(d)&&(i+=d);var u=o.cellPositionUtils.createIdFromValues(e.rowIndex,s,e.rowPinned);n[u]=!0})),l||(i+="\r\n")}),(function(t){if(e){var n=o.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),a=t.map((function(e){var t=o.columnModel.getDisplayNameForColumn(e,"clipboard",!0);return o.processHeader(e,t,n)||""}));i+=a.join(r)+"\r\n"}})),this.copyDataToClipboard(i),this.dispatchFlashCells(n)}},o.prototype.copyFocusedCellToClipboard=function(e){var o;void 0===e&&(e=!1);var r=this.focusService.getFocusedCell();if(null!=r){var i,n=this.cellPositionUtils.createId(r),a={rowPinned:r.rowPinned,rowIndex:r.rowIndex},s=this.rowPositionUtils.getRowNode(a),p=r.column,l=this.valueService.getValue(p,s),c=this.processCell(s,p,l,t.Constants.EXPORT_TYPE_CLIPBOARD,this.gridOptionsWrapper.getProcessCellForClipboardFunc());if(c=t._.missing(c)?"":c.toString(),e){var d=this.columnModel.getDisplayNameForColumn(p,"clipboard",!0);i=this.processHeader(p,d,this.gridOptionsWrapper.getProcessHeaderForClipboardFunc())+"\r\n"+c}else i=c;this.copyDataToClipboard(i),this.dispatchFlashCells(((o={})[n]=!0,o))}},o.prototype.dispatchFlashCells=function(e){var o=this;window.setTimeout((function(){var r={type:t.Events.EVENT_FLASH_CELLS,cells:e,api:o.gridApi,columnApi:o.columnApi};o.eventService.dispatchEvent(r)}),0)},o.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),type:r}):o},o.prototype.processHeader=function(e,t,o){return o?o({column:e,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext()}):t},o.prototype.copySelectedRowsToClipboard=function(e,t){void 0===e&&(e=!1);var o={columnKeys:t,skipColumnHeaders:!e,suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDeliminator(),onlySelected:!0,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc()},r=this.csvCreator.getDataAsCsv(o);this.copyDataToClipboard(r)},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().activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),document.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!=r&&null!=r.focus&&r.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("columnApi")],o.prototype,"columnApi",void 0),n([t.Autowired("gridApi")],o.prototype,"gridApi",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),s={moduleName:t.ModuleNames.ClipboardModule,beans:[a],dependantModules:[o.EnterpriseCoreModule,r.CsvExportModule]};exports.ClipboardModule=s; | ||
"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,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a},a=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return 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;this.executeOnTempElement((function(e){return e.focus({preventScroll:!0})}),(function(t){var o=t.value;e.processClipboardData(o)}))},o.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t._.stringToArray(e,this.gridOptionsWrapper.getClipboardDeliminator()),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 a={},s=[],p=this.focusService.getFocusedCell();e(a,s,p,o),o&&this.clientSideRowModel.doAggregate(o),this.rowRenderer.refreshCells(),this.dispatchFlashCells(a),this.fireRowChanged(s),p&&this.focusService.setFocusedCell(p.rowIndex,p.column,p.rowPinned,!0),this.eventService.dispatchEvent({type:t.Events.EVENT_PASTE_END,api:r,columnApi:i,source:"clipboard"})},o.prototype.pasteIntoActiveRange=function(e,o,r,i){var n=this,a=this.getRangeSize()%e.length!=0,s=0,p=0;this.iterateActiveRanges(!1,(function(l,c,d,u){if(u-s>=e.length){if(a)return;s+=p,p=0}var g=e[u-s];r.push(c);var h=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(e,r){if(e.isCellEditable(c)&&!e.isSuppressPaste(c)){r>=g.length&&(r%=g.length);var a=n.processCell(c,e,g[r],t.Constants.EXPORT_TYPE_DRAG_COPY,h);c.setDataValue(e,a,t.Constants.SOURCE_PASTE),i&&i.addParentNode(c.parent,[e]);var s=n.cellPositionUtils.createIdFromValues(l.rowIndex,e,l.rowPinned);o[s]=!0}})),p++}))},o.prototype.pasteStartingFromFocusedCell=function(e,o,r,i,n){if(i){var a={rowIndex:i.rowIndex,rowPinned:i.rowPinned},s=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,r,o,n):this.pasteMultipleValues(e,a,r,s,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,a=e[0][0];this.iterateActiveRanges(!1,(function(e,s,p){o.push(s),p.forEach((function(e){return n.updateCellValue(s,e,a,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,a){var s=e.gridOptionsWrapper.getProcessCellForClipboardFunc(),p=e.gridOptionsWrapper.getProcessCellFromClipboardFunc();e.iterateActiveRanges(!0,(function(n,l,c){o.length?(i.push(l),c.forEach((function(i,s){if(i.isCellEditable(l)&&!i.isSuppressPaste(l)){var c=e.processCell(l,i,o[s],t.Constants.EXPORT_TYPE_DRAG_COPY,p);l.setDataValue(i,c,t.Constants.SOURCE_PASTE),a&&a.addParentNode(l.parent,[i]);var d=e.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=e.processCell(l,r,e.valueService.getValue(r,l),t.Constants.EXPORT_TYPE_DRAG_COPY,s);o.push(i)}))}))}))}},o.prototype.removeLastLineIfBlank=function(e){var o=t._.last(e);o&&1===o.length&&""===o[0]&&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,context:o.gridOptionsWrapper.getContext(),api:o.gridOptionsWrapper.getApi(),columnApi:o.gridOptionsWrapper.getColumnApi()};o.eventService.dispatchEvent(r)}))},o.prototype.pasteMultipleValues=function(e,t,o,r,i,n,a){var s=this,p=t,l=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!p)return null;var e=s.rowPositionUtils.getRowNode(p);if(p=s.cellNavigationService.getRowBelow({rowPinned:p.rowPinned,rowIndex:p.rowIndex}),null==e)return null;if(!(e.detail||e.footer||l&&e.group))return e}}();t&&(e.forEach((function(e,o){return s.updateCellValue(t,r[o],e,i,n,a)})),o.push(t))}))},o.prototype.updateCellValue=function(e,o,r,i,n,a){if(e&&o&&o.isCellEditable(e)&&!o.isSuppressPaste(e)){var s=this.processCell(e,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());e.setDataValue(o,s,t.Constants.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(e.rowIndex,o,e.rowPinned)]=!0,a&&a.addParentNode(e.parent,[o])}},o.prototype.copyToClipboard=function(e){this.logger.log("copyToClipboard: includeHeaders = "+e),null==e&&(e=this.gridOptionsWrapper.isCopyHeadersToClipboard());var t=!this.selectionService.isEmpty()&&!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();this.rangeService&&this.rangeService.isMoreThanOneCell()?this.copySelectedRangeToClipboard(e):t?this.copySelectedRowsToClipboard(e):this.focusService.isAnyCellFocused()?this.copyFocusedCellToClipboard(e):this.copySelectedRangeToClipboard(e)},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 a=0,s=!1;!s&&null!=i;){var p=this.rowPositionUtils.getRowNode(i);s=this.rowPositionUtils.sameRow(i,n),t(i,p,e.columns,a++,s&&r),i=this.cellNavigationService.getRowBelow(i)}}},o.prototype.copySelectedRangeToClipboard=function(e){var o=this;if(void 0===e&&(e=!1),this.rangeService&&!this.rangeService.isEmpty()){var r=this.gridOptionsWrapper.getClipboardDeliminator(),i="",n={};this.iterateActiveRanges(!1,(function(e,a,s,p,l){var c=o.gridOptionsWrapper.getProcessCellForClipboardFunc();s.forEach((function(s,p){var l=o.valueService.getValue(s,a),d=o.processCell(a,s,l,t.Constants.EXPORT_TYPE_CLIPBOARD,c);0!=p&&(i+=r),t._.exists(d)&&(i+=d);var u=o.cellPositionUtils.createIdFromValues(e.rowIndex,s,e.rowPinned);n[u]=!0})),l||(i+="\r\n")}),(function(t){if(e){var n=o.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),a=t.map((function(e){var t=o.columnModel.getDisplayNameForColumn(e,"clipboard",!0);return o.processHeader(e,t,n)||""}));i+=a.join(r)+"\r\n"}})),this.copyDataToClipboard(i),this.dispatchFlashCells(n)}},o.prototype.copyFocusedCellToClipboard=function(e){var o;void 0===e&&(e=!1);var r=this.focusService.getFocusedCell();if(null!=r){var i,n=this.cellPositionUtils.createId(r),a={rowPinned:r.rowPinned,rowIndex:r.rowIndex},s=this.rowPositionUtils.getRowNode(a),p=r.column,l=this.valueService.getValue(p,s),c=this.processCell(s,p,l,t.Constants.EXPORT_TYPE_CLIPBOARD,this.gridOptionsWrapper.getProcessCellForClipboardFunc());if(c=t._.missing(c)?"":c.toString(),e){var d=this.columnModel.getDisplayNameForColumn(p,"clipboard",!0);i=this.processHeader(p,d,this.gridOptionsWrapper.getProcessHeaderForClipboardFunc())+"\r\n"+c}else i=c;this.copyDataToClipboard(i),this.dispatchFlashCells(((o={})[n]=!0,o))}},o.prototype.dispatchFlashCells=function(e){var o=this;window.setTimeout((function(){var r={type:t.Events.EVENT_FLASH_CELLS,cells:e,api:o.gridApi,columnApi:o.columnApi};o.eventService.dispatchEvent(r)}),0)},o.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),type:r}):o},o.prototype.processHeader=function(e,t,o){return o?o({column:e,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext()}):t},o.prototype.copySelectedRowsToClipboard=function(e,t){void 0===e&&(e=!1);var o={columnKeys:t,skipColumnHeaders:!e,suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDeliminator(),onlySelected:!0,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc()},r=this.csvCreator.getDataAsCsv(o);this.copyDataToClipboard(r)},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().activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),document.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!=r&&null!=r.focus&&r.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("columnApi")],o.prototype,"columnApi",void 0),n([t.Autowired("gridApi")],o.prototype,"gridApi",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),s={moduleName:t.ModuleNames.ClipboardModule,beans:[a],dependantModules:[o.EnterpriseCoreModule,r.CsvExportModule]};exports.ClipboardModule=s; |
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://www.ag-grid.com/ | ||
@@ -179,3 +179,3 @@ ' * @license Commercial | ||
var newValue = _this.processCell(rowNode, column, currentRowData[idx], Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, newValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, newValue, Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -251,3 +251,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var firstRowValue = _this.processCell(rowNode, column, firstRowValues[index], Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, firstRowValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, firstRowValue, Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -338,3 +338,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var processedValue = this.processCell(rowNode, column, value, type, this.gridOptionsWrapper.getProcessCellFromClipboardFunc()); | ||
this.valueService.setValue(rowNode, column, processedValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, processedValue, Constants.SOURCE_PASTE); | ||
var cellId = this.cellPositionUtils.createIdFromValues(rowNode.rowIndex, column, rowNode.rowPinned); | ||
@@ -341,0 +341,0 @@ cellsToFlash[cellId] = true; |
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://www.ag-grid.com/ | ||
@@ -8,6 +8,6 @@ ' * @license Commercial | ||
/** | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0 | ||
* @ag-grid-enterprise/clipboard - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0 | ||
* @link http://www.ag-grid.com/ | ||
' * @license Commercial | ||
*/ | ||
import{Constants as e,_ as t,Events as o,ChangedPath as r,Autowired as i,Optional as n,PostConstruct as a,Bean as s,BeanStub as p,ModuleNames as l}from"@ag-grid-community/core";import{EnterpriseCoreModule as c}from"@ag-grid-enterprise/core";import{CsvExportModule as d}from"@ag-grid-community/csv-export";var u,g=(u=function(e,t){return(u=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])})(e,t)},function(e,t){function o(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),h=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a},v=function(p){function l(){var e=null!==p&&p.apply(this,arguments)||this;return e.navigatorApiFailed=!1,e}return g(l,p),l.prototype.init=function(){var t=this;this.logger=this.loggerFactory.create("ClipboardService"),this.rowModel.getType()===e.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady((function(e){t.gridCtrl=e.gridCtrl}))},l.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()},l.prototype.pasteFromClipboardLegacy=function(){var e=this;this.executeOnTempElement((function(e){return e.focus({preventScroll:!0})}),(function(t){var o=t.value;e.processClipboardData(o)}))},l.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t.stringToArray(e,this.gridOptionsWrapper.getClipboardDeliminator()),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)}))}}},l.prototype.doPasteOperation=function(e){var t,i=this.gridOptionsWrapper.getApi(),n=this.gridOptionsWrapper.getColumnApi();if(this.eventService.dispatchEvent({type:o.EVENT_PASTE_START,api:i,columnApi:n,source:"clipboard"}),this.clientSideRowModel){var a=this.gridOptionsWrapper.isAggregateOnlyChangedColumns();t=new r(a,this.clientSideRowModel.getRootNode())}var s={},p=[],l=this.focusService.getFocusedCell();e(s,p,l,t),t&&this.clientSideRowModel.doAggregate(t),this.rowRenderer.refreshCells(),this.dispatchFlashCells(s),this.fireRowChanged(p),l&&this.focusService.setFocusedCell(l.rowIndex,l.column,l.rowPinned,!0),this.eventService.dispatchEvent({type:o.EVENT_PASTE_END,api:i,columnApi:n,source:"clipboard"})},l.prototype.pasteIntoActiveRange=function(t,o,r,i){var n=this,a=this.getRangeSize()%t.length!=0,s=0,p=0;this.iterateActiveRanges(!1,(function(l,c,d,u){if(u-s>=t.length){if(a)return;s+=p,p=0}var g=t[u-s];r.push(c);var h=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(t,r){if(t.isCellEditable(c)&&!t.isSuppressPaste(c)){r>=g.length&&(r%=g.length);var a=n.processCell(c,t,g[r],e.EXPORT_TYPE_DRAG_COPY,h);n.valueService.setValue(c,t,a,e.SOURCE_PASTE),i&&i.addParentNode(c.parent,[t]);var s=n.cellPositionUtils.createIdFromValues(l.rowIndex,t,l.rowPinned);o[s]=!0}})),p++}))},l.prototype.pasteStartingFromFocusedCell=function(t,o,r,i,n){if(i){var a={rowIndex:i.rowIndex,rowPinned:i.rowPinned},s=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(t)?this.pasteSingleValueIntoRange(t,r,o,n):this.pasteMultipleValues(t,a,r,s,o,e.EXPORT_TYPE_CLIPBOARD,n)}},l.prototype.isPasteSingleValueIntoRange=function(e){return this.hasOnlyOneValueToPaste(e)&&null!=this.rangeService&&!this.rangeService.isEmpty()},l.prototype.pasteSingleValueIntoRange=function(t,o,r,i){var n=this,a=t[0][0];this.iterateActiveRanges(!1,(function(t,s,p){o.push(s),p.forEach((function(t){return n.updateCellValue(s,t,a,r,e.EXPORT_TYPE_CLIPBOARD,i)}))}))},l.prototype.hasOnlyOneValueToPaste=function(e){return 1===e.length&&1===e[0].length},l.prototype.copyRangeDown=function(){var t=this;if(this.rangeService&&!this.rangeService.isEmpty()){var o=[];this.doPasteOperation((function(r,i,n,a){var s=t.gridOptionsWrapper.getProcessCellForClipboardFunc(),p=t.gridOptionsWrapper.getProcessCellFromClipboardFunc();t.iterateActiveRanges(!0,(function(n,l,c){o.length?(i.push(l),c.forEach((function(i,s){if(i.isCellEditable(l)&&!i.isSuppressPaste(l)){var c=t.processCell(l,i,o[s],e.EXPORT_TYPE_DRAG_COPY,p);t.valueService.setValue(l,i,c,e.SOURCE_PASTE),a&&a.addParentNode(l.parent,[i]);var d=t.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=t.processCell(l,r,t.valueService.getValue(r,l),e.EXPORT_TYPE_DRAG_COPY,s);o.push(i)}))}))}))}},l.prototype.removeLastLineIfBlank=function(e){var o=t.last(e);o&&1===o.length&&""===o[0]&&t.removeFromArray(e,o)},l.prototype.fireRowChanged=function(e){var t=this;this.gridOptionsWrapper.isFullRowEdit()&&e.forEach((function(e){var r={type:o.EVENT_ROW_VALUE_CHANGED,node:e,data:e.data,rowIndex:e.rowIndex,rowPinned:e.rowPinned,context:t.gridOptionsWrapper.getContext(),api:t.gridOptionsWrapper.getApi(),columnApi:t.gridOptionsWrapper.getColumnApi()};t.eventService.dispatchEvent(r)}))},l.prototype.pasteMultipleValues=function(e,t,o,r,i,n,a){var s=this,p=t,l=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!p)return null;var e=s.rowPositionUtils.getRowNode(p);if(p=s.cellNavigationService.getRowBelow({rowPinned:p.rowPinned,rowIndex:p.rowIndex}),null==e)return null;if(!(e.detail||e.footer||l&&e.group))return e}}();t&&(e.forEach((function(e,o){return s.updateCellValue(t,r[o],e,i,n,a)})),o.push(t))}))},l.prototype.updateCellValue=function(t,o,r,i,n,a){if(t&&o&&o.isCellEditable(t)&&!o.isSuppressPaste(t)){var s=this.processCell(t,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());this.valueService.setValue(t,o,s,e.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(t.rowIndex,o,t.rowPinned)]=!0,a&&a.addParentNode(t.parent,[o])}},l.prototype.copyToClipboard=function(e){this.logger.log("copyToClipboard: includeHeaders = "+e),null==e&&(e=this.gridOptionsWrapper.isCopyHeadersToClipboard());var t=!this.selectionService.isEmpty()&&!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();this.rangeService&&this.rangeService.isMoreThanOneCell()?this.copySelectedRangeToClipboard(e):t?this.copySelectedRowsToClipboard(e):this.focusService.isAnyCellFocused()?this.copyFocusedCellToClipboard(e):this.copySelectedRangeToClipboard(e)},l.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)}))}},l.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 a=0,s=!1;!s&&null!=i;){var p=this.rowPositionUtils.getRowNode(i);s=this.rowPositionUtils.sameRow(i,n),t(i,p,e.columns,a++,s&&r),i=this.cellNavigationService.getRowBelow(i)}}},l.prototype.copySelectedRangeToClipboard=function(o){var r=this;if(void 0===o&&(o=!1),this.rangeService&&!this.rangeService.isEmpty()){var i=this.gridOptionsWrapper.getClipboardDeliminator(),n="",a={};this.iterateActiveRanges(!1,(function(o,s,p,l,c){var d=r.gridOptionsWrapper.getProcessCellForClipboardFunc();p.forEach((function(p,l){var c=r.valueService.getValue(p,s),u=r.processCell(s,p,c,e.EXPORT_TYPE_CLIPBOARD,d);0!=l&&(n+=i),t.exists(u)&&(n+=u);var g=r.cellPositionUtils.createIdFromValues(o.rowIndex,p,o.rowPinned);a[g]=!0})),c||(n+="\r\n")}),(function(e){if(o){var t=r.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),a=e.map((function(e){var o=r.columnModel.getDisplayNameForColumn(e,"clipboard",!0);return r.processHeader(e,o,t)||""}));n+=a.join(i)+"\r\n"}})),this.copyDataToClipboard(n),this.dispatchFlashCells(a)}},l.prototype.copyFocusedCellToClipboard=function(o){var r;void 0===o&&(o=!1);var i=this.focusService.getFocusedCell();if(null!=i){var n,a=this.cellPositionUtils.createId(i),s={rowPinned:i.rowPinned,rowIndex:i.rowIndex},p=this.rowPositionUtils.getRowNode(s),l=i.column,c=this.valueService.getValue(l,p),d=this.processCell(p,l,c,e.EXPORT_TYPE_CLIPBOARD,this.gridOptionsWrapper.getProcessCellForClipboardFunc());if(d=t.missing(d)?"":d.toString(),o){var u=this.columnModel.getDisplayNameForColumn(l,"clipboard",!0);n=this.processHeader(l,u,this.gridOptionsWrapper.getProcessHeaderForClipboardFunc())+"\r\n"+d}else n=d;this.copyDataToClipboard(n),this.dispatchFlashCells(((r={})[a]=!0,r))}},l.prototype.dispatchFlashCells=function(e){var t=this;window.setTimeout((function(){var r={type:o.EVENT_FLASH_CELLS,cells:e,api:t.gridApi,columnApi:t.columnApi};t.eventService.dispatchEvent(r)}),0)},l.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),type:r}):o},l.prototype.processHeader=function(e,t,o){return o?o({column:e,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext()}):t},l.prototype.copySelectedRowsToClipboard=function(e,t){void 0===e&&(e=!1);var o={columnKeys:t,skipColumnHeaders:!e,suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDeliminator(),onlySelected:!0,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc()},r=this.csvCreator.getDataAsCsv(o);this.copyDataToClipboard(r)},l.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)},l.prototype.copyDataToClipboardLegacy=function(e){var t=this;this.executeOnTempElement((function(o){var r=t.gridOptionsWrapper.getDocument().activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),document.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!=r&&null!=r.focus&&r.focus({preventScroll:!0})}))},l.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)},l.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},h([i("csvCreator")],l.prototype,"csvCreator",void 0),h([i("loggerFactory")],l.prototype,"loggerFactory",void 0),h([i("selectionService")],l.prototype,"selectionService",void 0),h([n("rangeService")],l.prototype,"rangeService",void 0),h([i("rowModel")],l.prototype,"rowModel",void 0),h([i("ctrlsService")],l.prototype,"ctrlsService",void 0),h([i("valueService")],l.prototype,"valueService",void 0),h([i("focusService")],l.prototype,"focusService",void 0),h([i("rowRenderer")],l.prototype,"rowRenderer",void 0),h([i("columnModel")],l.prototype,"columnModel",void 0),h([i("cellNavigationService")],l.prototype,"cellNavigationService",void 0),h([i("columnApi")],l.prototype,"columnApi",void 0),h([i("gridApi")],l.prototype,"gridApi",void 0),h([i("cellPositionUtils")],l.prototype,"cellPositionUtils",void 0),h([i("rowPositionUtils")],l.prototype,"rowPositionUtils",void 0),h([a],l.prototype,"init",null),l=h([s("clipboardService")],l)}(p),f={moduleName:l.ClipboardModule,beans:[v],dependantModules:[c,d]};export{f as ClipboardModule}; | ||
import{Constants as e,_ as t,Events as o,ChangedPath as r,Autowired as i,Optional as n,PostConstruct as a,Bean as s,BeanStub as p,ModuleNames as l}from"@ag-grid-community/core";import{EnterpriseCoreModule as c}from"@ag-grid-enterprise/core";import{CsvExportModule as d}from"@ag-grid-community/csv-export";var u,g=(u=function(e,t){return(u=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])})(e,t)},function(e,t){function o(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),h=function(e,t,o,r){var i,n=arguments.length,a=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(n<3?i(a):n>3?i(t,o,a):i(t,o))||a);return n>3&&a&&Object.defineProperty(t,o,a),a},v=function(p){function l(){var e=null!==p&&p.apply(this,arguments)||this;return e.navigatorApiFailed=!1,e}return g(l,p),l.prototype.init=function(){var t=this;this.logger=this.loggerFactory.create("ClipboardService"),this.rowModel.getType()===e.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady((function(e){t.gridCtrl=e.gridCtrl}))},l.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()},l.prototype.pasteFromClipboardLegacy=function(){var e=this;this.executeOnTempElement((function(e){return e.focus({preventScroll:!0})}),(function(t){var o=t.value;e.processClipboardData(o)}))},l.prototype.processClipboardData=function(e){var o=this;if(null!=e){var r=t.stringToArray(e,this.gridOptionsWrapper.getClipboardDeliminator()),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)}))}}},l.prototype.doPasteOperation=function(e){var t,i=this.gridOptionsWrapper.getApi(),n=this.gridOptionsWrapper.getColumnApi();if(this.eventService.dispatchEvent({type:o.EVENT_PASTE_START,api:i,columnApi:n,source:"clipboard"}),this.clientSideRowModel){var a=this.gridOptionsWrapper.isAggregateOnlyChangedColumns();t=new r(a,this.clientSideRowModel.getRootNode())}var s={},p=[],l=this.focusService.getFocusedCell();e(s,p,l,t),t&&this.clientSideRowModel.doAggregate(t),this.rowRenderer.refreshCells(),this.dispatchFlashCells(s),this.fireRowChanged(p),l&&this.focusService.setFocusedCell(l.rowIndex,l.column,l.rowPinned,!0),this.eventService.dispatchEvent({type:o.EVENT_PASTE_END,api:i,columnApi:n,source:"clipboard"})},l.prototype.pasteIntoActiveRange=function(t,o,r,i){var n=this,a=this.getRangeSize()%t.length!=0,s=0,p=0;this.iterateActiveRanges(!1,(function(l,c,d,u){if(u-s>=t.length){if(a)return;s+=p,p=0}var g=t[u-s];r.push(c);var h=n.gridOptionsWrapper.getProcessCellFromClipboardFunc();d.forEach((function(t,r){if(t.isCellEditable(c)&&!t.isSuppressPaste(c)){r>=g.length&&(r%=g.length);var a=n.processCell(c,t,g[r],e.EXPORT_TYPE_DRAG_COPY,h);c.setDataValue(t,a,e.SOURCE_PASTE),i&&i.addParentNode(c.parent,[t]);var s=n.cellPositionUtils.createIdFromValues(l.rowIndex,t,l.rowPinned);o[s]=!0}})),p++}))},l.prototype.pasteStartingFromFocusedCell=function(t,o,r,i,n){if(i){var a={rowIndex:i.rowIndex,rowPinned:i.rowPinned},s=this.columnModel.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(t)?this.pasteSingleValueIntoRange(t,r,o,n):this.pasteMultipleValues(t,a,r,s,o,e.EXPORT_TYPE_CLIPBOARD,n)}},l.prototype.isPasteSingleValueIntoRange=function(e){return this.hasOnlyOneValueToPaste(e)&&null!=this.rangeService&&!this.rangeService.isEmpty()},l.prototype.pasteSingleValueIntoRange=function(t,o,r,i){var n=this,a=t[0][0];this.iterateActiveRanges(!1,(function(t,s,p){o.push(s),p.forEach((function(t){return n.updateCellValue(s,t,a,r,e.EXPORT_TYPE_CLIPBOARD,i)}))}))},l.prototype.hasOnlyOneValueToPaste=function(e){return 1===e.length&&1===e[0].length},l.prototype.copyRangeDown=function(){var t=this;if(this.rangeService&&!this.rangeService.isEmpty()){var o=[];this.doPasteOperation((function(r,i,n,a){var s=t.gridOptionsWrapper.getProcessCellForClipboardFunc(),p=t.gridOptionsWrapper.getProcessCellFromClipboardFunc();t.iterateActiveRanges(!0,(function(n,l,c){o.length?(i.push(l),c.forEach((function(i,s){if(i.isCellEditable(l)&&!i.isSuppressPaste(l)){var c=t.processCell(l,i,o[s],e.EXPORT_TYPE_DRAG_COPY,p);l.setDataValue(i,c,e.SOURCE_PASTE),a&&a.addParentNode(l.parent,[i]);var d=t.cellPositionUtils.createIdFromValues(n.rowIndex,i,n.rowPinned);r[d]=!0}}))):c.forEach((function(r){var i=t.processCell(l,r,t.valueService.getValue(r,l),e.EXPORT_TYPE_DRAG_COPY,s);o.push(i)}))}))}))}},l.prototype.removeLastLineIfBlank=function(e){var o=t.last(e);o&&1===o.length&&""===o[0]&&t.removeFromArray(e,o)},l.prototype.fireRowChanged=function(e){var t=this;this.gridOptionsWrapper.isFullRowEdit()&&e.forEach((function(e){var r={type:o.EVENT_ROW_VALUE_CHANGED,node:e,data:e.data,rowIndex:e.rowIndex,rowPinned:e.rowPinned,context:t.gridOptionsWrapper.getContext(),api:t.gridOptionsWrapper.getApi(),columnApi:t.gridOptionsWrapper.getColumnApi()};t.eventService.dispatchEvent(r)}))},l.prototype.pasteMultipleValues=function(e,t,o,r,i,n,a){var s=this,p=t,l=null!=this.clientSideRowModel&&!this.gridOptionsWrapper.isTreeData();e.forEach((function(e){var t=function(){for(;;){if(!p)return null;var e=s.rowPositionUtils.getRowNode(p);if(p=s.cellNavigationService.getRowBelow({rowPinned:p.rowPinned,rowIndex:p.rowIndex}),null==e)return null;if(!(e.detail||e.footer||l&&e.group))return e}}();t&&(e.forEach((function(e,o){return s.updateCellValue(t,r[o],e,i,n,a)})),o.push(t))}))},l.prototype.updateCellValue=function(t,o,r,i,n,a){if(t&&o&&o.isCellEditable(t)&&!o.isSuppressPaste(t)){var s=this.processCell(t,o,r,n,this.gridOptionsWrapper.getProcessCellFromClipboardFunc());t.setDataValue(o,s,e.SOURCE_PASTE),i[this.cellPositionUtils.createIdFromValues(t.rowIndex,o,t.rowPinned)]=!0,a&&a.addParentNode(t.parent,[o])}},l.prototype.copyToClipboard=function(e){this.logger.log("copyToClipboard: includeHeaders = "+e),null==e&&(e=this.gridOptionsWrapper.isCopyHeadersToClipboard());var t=!this.selectionService.isEmpty()&&!this.gridOptionsWrapper.isSuppressCopyRowsToClipboard();this.rangeService&&this.rangeService.isMoreThanOneCell()?this.copySelectedRangeToClipboard(e):t?this.copySelectedRowsToClipboard(e):this.focusService.isAnyCellFocused()?this.copyFocusedCellToClipboard(e):this.copySelectedRangeToClipboard(e)},l.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)}))}},l.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 a=0,s=!1;!s&&null!=i;){var p=this.rowPositionUtils.getRowNode(i);s=this.rowPositionUtils.sameRow(i,n),t(i,p,e.columns,a++,s&&r),i=this.cellNavigationService.getRowBelow(i)}}},l.prototype.copySelectedRangeToClipboard=function(o){var r=this;if(void 0===o&&(o=!1),this.rangeService&&!this.rangeService.isEmpty()){var i=this.gridOptionsWrapper.getClipboardDeliminator(),n="",a={};this.iterateActiveRanges(!1,(function(o,s,p,l,c){var d=r.gridOptionsWrapper.getProcessCellForClipboardFunc();p.forEach((function(p,l){var c=r.valueService.getValue(p,s),u=r.processCell(s,p,c,e.EXPORT_TYPE_CLIPBOARD,d);0!=l&&(n+=i),t.exists(u)&&(n+=u);var g=r.cellPositionUtils.createIdFromValues(o.rowIndex,p,o.rowPinned);a[g]=!0})),c||(n+="\r\n")}),(function(e){if(o){var t=r.gridOptionsWrapper.getProcessHeaderForClipboardFunc(),a=e.map((function(e){var o=r.columnModel.getDisplayNameForColumn(e,"clipboard",!0);return r.processHeader(e,o,t)||""}));n+=a.join(i)+"\r\n"}})),this.copyDataToClipboard(n),this.dispatchFlashCells(a)}},l.prototype.copyFocusedCellToClipboard=function(o){var r;void 0===o&&(o=!1);var i=this.focusService.getFocusedCell();if(null!=i){var n,a=this.cellPositionUtils.createId(i),s={rowPinned:i.rowPinned,rowIndex:i.rowIndex},p=this.rowPositionUtils.getRowNode(s),l=i.column,c=this.valueService.getValue(l,p),d=this.processCell(p,l,c,e.EXPORT_TYPE_CLIPBOARD,this.gridOptionsWrapper.getProcessCellForClipboardFunc());if(d=t.missing(d)?"":d.toString(),o){var u=this.columnModel.getDisplayNameForColumn(l,"clipboard",!0);n=this.processHeader(l,u,this.gridOptionsWrapper.getProcessHeaderForClipboardFunc())+"\r\n"+d}else n=d;this.copyDataToClipboard(n),this.dispatchFlashCells(((r={})[a]=!0,r))}},l.prototype.dispatchFlashCells=function(e){var t=this;window.setTimeout((function(){var r={type:o.EVENT_FLASH_CELLS,cells:e,api:t.gridApi,columnApi:t.columnApi};t.eventService.dispatchEvent(r)}),0)},l.prototype.processCell=function(e,t,o,r,i){return i?i({column:t,node:e,value:o,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext(),type:r}):o},l.prototype.processHeader=function(e,t,o){return o?o({column:e,api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),context:this.gridOptionsWrapper.getContext()}):t},l.prototype.copySelectedRowsToClipboard=function(e,t){void 0===e&&(e=!1);var o={columnKeys:t,skipColumnHeaders:!e,suppressQuotes:!0,columnSeparator:this.gridOptionsWrapper.getClipboardDeliminator(),onlySelected:!0,processCellCallback:this.gridOptionsWrapper.getProcessCellForClipboardFunc(),processHeaderCallback:this.gridOptionsWrapper.getProcessHeaderForClipboardFunc()},r=this.csvCreator.getDataAsCsv(o);this.copyDataToClipboard(r)},l.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)},l.prototype.copyDataToClipboardLegacy=function(e){var t=this;this.executeOnTempElement((function(o){var r=t.gridOptionsWrapper.getDocument().activeElement;o.value=e||" ",o.select(),o.focus({preventScroll:!0}),document.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!=r&&null!=r.focus&&r.focus({preventScroll:!0})}))},l.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)},l.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},h([i("csvCreator")],l.prototype,"csvCreator",void 0),h([i("loggerFactory")],l.prototype,"loggerFactory",void 0),h([i("selectionService")],l.prototype,"selectionService",void 0),h([n("rangeService")],l.prototype,"rangeService",void 0),h([i("rowModel")],l.prototype,"rowModel",void 0),h([i("ctrlsService")],l.prototype,"ctrlsService",void 0),h([i("valueService")],l.prototype,"valueService",void 0),h([i("focusService")],l.prototype,"focusService",void 0),h([i("rowRenderer")],l.prototype,"rowRenderer",void 0),h([i("columnModel")],l.prototype,"columnModel",void 0),h([i("cellNavigationService")],l.prototype,"cellNavigationService",void 0),h([i("columnApi")],l.prototype,"columnApi",void 0),h([i("gridApi")],l.prototype,"gridApi",void 0),h([i("cellPositionUtils")],l.prototype,"cellPositionUtils",void 0),h([i("rowPositionUtils")],l.prototype,"rowPositionUtils",void 0),h([a],l.prototype,"init",null),l=h([s("clipboardService")],l)}(p),f={moduleName:l.ClipboardModule,beans:[v],dependantModules:[c,d]};export{f as ClipboardModule}; |
@@ -170,3 +170,3 @@ var __extends = (this && this.__extends) || (function () { | ||
var newValue = _this.processCell(rowNode, column, currentRowData[idx], Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, newValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, newValue, Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -242,3 +242,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var firstRowValue = _this.processCell(rowNode, column, firstRowValues[index], Constants.EXPORT_TYPE_DRAG_COPY, processCellFromClipboardFunc); | ||
_this.valueService.setValue(rowNode, column, firstRowValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, firstRowValue, Constants.SOURCE_PASTE); | ||
if (changedPath) { | ||
@@ -329,3 +329,3 @@ changedPath.addParentNode(rowNode.parent, [column]); | ||
var processedValue = this.processCell(rowNode, column, value, type, this.gridOptionsWrapper.getProcessCellFromClipboardFunc()); | ||
this.valueService.setValue(rowNode, column, processedValue, Constants.SOURCE_PASTE); | ||
rowNode.setDataValue(column, processedValue, Constants.SOURCE_PASTE); | ||
var cellId = this.cellPositionUtils.createIdFromValues(rowNode.rowIndex, column, rowNode.rowPinned); | ||
@@ -332,0 +332,0 @@ cellsToFlash[cellId] = true; |
{ | ||
"name": "@ag-grid-enterprise/clipboard", | ||
"version": "26.0.0", | ||
"version": "26.1.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components", | ||
@@ -46,5 +46,5 @@ "main": "./dist/cjs/main.js", | ||
"dependencies": { | ||
"@ag-grid-community/core": "~26.0.0", | ||
"@ag-grid-community/csv-export": "~26.0.0", | ||
"@ag-grid-enterprise/core": "~26.0.0" | ||
"@ag-grid-community/core": "~26.1.0", | ||
"@ag-grid-community/csv-export": "~26.1.0", | ||
"@ag-grid-enterprise/core": "~26.1.0" | ||
}, | ||
@@ -54,2 +54,3 @@ "devDependencies": { | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "12.20.20", | ||
"jest": "^25.4.0", | ||
@@ -56,0 +57,0 @@ "ts-jest": "^25.4.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
1
100
0
304681
6
+ Added@ag-grid-community/core@26.1.0(transitive)
+ Added@ag-grid-community/csv-export@26.1.0(transitive)
+ Added@ag-grid-enterprise/core@26.1.0(transitive)
- Removed@ag-grid-community/core@26.0.0(transitive)
- Removed@ag-grid-community/csv-export@26.0.0(transitive)
- Removed@ag-grid-enterprise/core@26.0.0(transitive)