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

@ag-grid-enterprise/clipboard

Package Overview
Dependencies
Maintainers
0
Versions
74
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 31.3.2 to 32.0.0

dist/types/src/clipboard/clipboardApi.d.ts

30

CONTRIBUTING.md

@@ -5,6 +5,4 @@ # Contributing to AG Grid Enterprise

Retention of Intellectual Property Rights for AG Grid Enterprise component
==============
# Retention of Intellectual Property Rights for AG Grid Enterprise component
1.DEFINITIONS

@@ -27,9 +25,9 @@

- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Signing the CLA](#cla)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
- [Signing the CLA](#cla)

@@ -45,2 +43,3 @@ ## <a name="question"></a> Got a Question or Problem?

## <a name="issue"></a> Found a Bug?
If you find a bug in the source code, you can help us by

@@ -50,3 +49,4 @@ [submitting an issue](#submit-issue) to our [GitHub Repository][github].

## <a name="feature"></a> Missing a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
You can _request_ a new feature by [submitting an issue](#submit-issue) to our GitHub
Repository.

@@ -62,5 +62,5 @@

- version of AG Grid Enterprise used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
- version of AG Grid Enterprise used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails

@@ -78,3 +78,1 @@ A minimal reproduce scenario using http://plnkr.co/ allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. If plunker is not a suitable way to demonstrate the problem (for example for issues related to our npm packaging), please create a standalone git repository demonstrating the problem.

[stackoverflow]: http://stackoverflow.com/questions/tagged/ag-grid

@@ -18,11 +18,2 @@ var __defProp = Object.defineProperty;

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
return result;
};

@@ -38,5 +29,25 @@ // enterprise-modules/clipboard/src/main.ts

var import_core2 = require("@ag-grid-community/core");
var import_csv_export = require("@ag-grid-community/csv-export");
var import_core3 = require("@ag-grid-enterprise/core");
var import_csv_export = require("@ag-grid-community/csv-export");
// enterprise-modules/clipboard/src/clipboard/clipboardApi.ts
function copyToClipboard(beans, params) {
beans.clipboardService?.copyToClipboard(params);
}
function cutToClipboard(beans, params) {
beans.clipboardService?.cutToClipboard(params);
}
function copySelectedRowsToClipboard(beans, params) {
beans.clipboardService?.copySelectedRowsToClipboard(params);
}
function copySelectedRangeToClipboard(beans, params) {
beans.clipboardService?.copySelectedRangeToClipboard(params);
}
function copySelectedRangeDown(beans) {
beans.clipboardService?.copyRangeDown();
}
function pasteFromClipboard(beans) {
beans.clipboardService?.pasteFromClipboard();
}
// enterprise-modules/clipboard/src/clipboard/clipboardService.ts

@@ -48,10 +59,25 @@ var import_core = require("@ag-grid-community/core");

var apiError = (method) => `AG Grid: Unable to use the Clipboard API (navigator.clipboard.${method}()). 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.`;
var ClipboardService = class extends import_core.BeanStub {
var ClipboardService = class _ClipboardService extends import_core.BeanStub {
constructor() {
super(...arguments);
this.beanName = "clipboardService";
this.lastPasteOperationTime = 0;
this.navigatorApiFailed = false;
}
init() {
this.logger = this.loggerFactory.create("ClipboardService");
wireBeans(beans) {
this.csvCreator = beans.csvCreator;
this.selectionService = beans.selectionService;
this.rowModel = beans.rowModel;
this.ctrlsService = beans.ctrlsService;
this.valueService = beans.valueService;
this.focusService = beans.focusService;
this.rowRenderer = beans.rowRenderer;
this.visibleColsService = beans.visibleColsService;
this.funcColsService = beans.funcColsService;
this.cellNavigationService = beans.cellNavigationService;
this.cellPositionUtils = beans.cellPositionUtils;
this.rowPositionUtils = beans.rowPositionUtils;
this.rangeService = beans.rangeService;
}
postConstruct() {
if (this.rowModel.getType() === "clientSide") {

@@ -65,10 +91,7 @@ this.clientSideRowModel = this.rowModel;

pasteFromClipboard() {
this.logger.log("pasteFromClipboard");
const allowNavigator = !this.gos.get("suppressClipboardApi");
if (allowNavigator && !this.navigatorApiFailed && navigator.clipboard && navigator.clipboard.readText) {
navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((e) => {
import_core._.doOnce(() => {
console.warn(e);
console.warn(apiError("readText"));
}, "clipboardApiError");
(0, import_core._warnOnce)(`${e}
${apiError("readText")}`);
this.navigatorApiFailed = true;

@@ -120,3 +143,3 @@ this.pasteFromClipboardLegacy();

const delimiter = this.gos.get("clipboardDelimiter");
return import_core._.exists(delimiter) ? delimiter : " ";
return (0, import_core._exists)(delimiter) ? delimiter : " ";
}

@@ -127,3 +150,3 @@ processClipboardData(data) {

}
let parsedData = ClipboardService.stringToArray(data, this.getClipboardDelimiter());
let parsedData = _ClipboardService.stringToArray(data, this.getClipboardDelimiter());
const userFunc = this.gos.getCallback("processDataFromClipboard");

@@ -140,4 +163,3 @@ if (userFunc) {

const pasteOperation = (cellsToFlash, updatedRowNodes, focusedCell, changedPath) => {
var _a;
const rangeActive = (_a = this.rangeService) == null ? void 0 : _a.isMoreThanOneCell();
const rangeActive = this.rangeService?.isMoreThanOneCell();
const pasteIntoRange = rangeActive && !this.hasOnlyOneValueToPaste(parsedData);

@@ -208,3 +230,3 @@ if (pasteIntoRange) {

this.eventService.dispatchEvent({
type: import_core.Events.EVENT_PASTE_START,
type: "pasteStart",
source

@@ -233,3 +255,3 @@ });

const event = {
type: import_core.Events.EVENT_PASTE_END,
type: "pasteEnd",
source

@@ -287,3 +309,3 @@ };

columns.push(currentColumn);
currentColumn = this.columnModel.getDisplayedColAfter(currentColumn);
currentColumn = this.visibleColsService.getColAfter(currentColumn);
}

@@ -320,3 +342,5 @@ return columns;

updatedRowNodes.push(rowNode);
columns.forEach((column) => this.updateCellValue(rowNode, column, value, cellsToFlash, EXPORT_TYPE_CLIPBOARD, changedPath));
columns.forEach(
(column) => this.updateCellValue(rowNode, column, value, cellsToFlash, EXPORT_TYPE_CLIPBOARD, changedPath)
);
};

@@ -379,3 +403,3 @@ this.iterateActiveRanges(false, rowCallback);

removeLastLineIfBlank(parsedData) {
const lastLine = import_core._.last(parsedData);
const lastLine = (0, import_core._last)(parsedData);
const lastLineIsBlank = lastLine && lastLine.length === 1 && lastLine[0] === "";

@@ -386,3 +410,3 @@ if (lastLineIsBlank) {

}
import_core._.removeFromArray(parsedData, lastLine);
(0, import_core._removeFromArray)(parsedData, lastLine);
}

@@ -396,3 +420,3 @@ }

const event = {
type: import_core.Events.EVENT_ROW_VALUE_CHANGED,
type: "rowValueChanged",
node: rowNode,

@@ -415,3 +439,6 @@ data: rowNode.data,

const res = this.rowPositionUtils.getRowNode(rowPointer);
rowPointer = this.cellNavigationService.getRowBelow({ rowPinned: rowPointer.rowPinned, rowIndex: rowPointer.rowIndex });
rowPointer = this.cellNavigationService.getRowBelow({
rowPinned: rowPointer.rowPinned,
rowIndex: rowPointer.rowIndex
});
if (res == null) {

@@ -431,3 +458,5 @@ return null;

}
clipboardRowData.forEach((value, index) => this.updateCellValue(rowNode, columnsToPasteInto[index], value, cellsToFlash, type, changedPath));
clipboardRowData.forEach(
(value, index) => this.updateCellValue(rowNode, columnsToPasteInto[index], value, cellsToFlash, type, changedPath)
);
updatedRowNodes.push(rowNode);

@@ -443,3 +472,10 @@ });

}
const processedValue = this.processCell(rowNode, column, value, type, this.gos.getCallback("processCellFromClipboard"), true);
const processedValue = this.processCell(
rowNode,
column,
value,
type,
this.gos.getCallback("processCellFromClipboard"),
true
);
rowNode.setDataValue(column, processedValue, SOURCE_PASTE);

@@ -461,3 +497,3 @@ const { rowIndex, rowPinned } = rowNode;

const startEvent = {
type: import_core.Events.EVENT_CUT_START,
type: "cutStart",
source

@@ -468,3 +504,3 @@ };

const endEvent = {
type: import_core.Events.EVENT_CUT_END,
type: "cutEnd",
source

@@ -476,3 +512,2 @@ };

let { includeHeaders, includeGroupHeaders } = params;
this.logger.log(`copyToClipboard: includeHeaders = ${includeHeaders}`);
if (includeHeaders == null) {

@@ -502,3 +537,3 @@ includeHeaders = this.gos.get("copyHeadersToClipboard");

clearCellsAfterCopy(type) {
this.eventService.dispatchEvent({ type: import_core.Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START });
this.eventService.dispatchEvent({ type: "keyShortcutChangedCellStart" });
if (type === 0 /* CellRange */) {

@@ -518,7 +553,7 @@ this.rangeService.clearCellRangeCellValues({ cellEventSource: "clipboardService" });

}
this.eventService.dispatchEvent({ type: import_core.Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END });
this.eventService.dispatchEvent({ type: "keyShortcutChangedCellEnd" });
}
clearSelectedRows() {
const selected = this.selectionService.getSelectedNodes();
const columns = this.columnModel.getAllDisplayedColumns();
const columns = this.visibleColsService.getAllCols();
for (const row of selected) {

@@ -531,7 +566,6 @@ for (const col of columns) {

clearCellValue(rowNode, column) {
var _a;
if (!column.isCellEditable(rowNode)) {
return;
}
const emptyValue = (_a = this.valueService.parseValue(column, rowNode, "", rowNode.getValueFromValueService(column))) != null ? _a : null;
const emptyValue = this.valueService.parseValue(column, rowNode, "", rowNode.getValueFromValueService(column)) ?? null;
rowNode.setDataValue(column, emptyValue, "clipboardService");

@@ -550,3 +584,5 @@ }

} else {
cellRanges.forEach((range, idx) => this.iterateActiveRange(range, rowCallback, columnCallback, idx === cellRanges.length - 1));
cellRanges.forEach(
(range, idx) => this.iterateActiveRange(range, rowCallback, columnCallback, idx === cellRanges.length - 1)
);
}

@@ -599,3 +635,3 @@ }

});
const allColumns = this.columnModel.getAllDisplayedColumns();
const allColumns = this.visibleColsService.getAllCols();
const exportedColumns = Array.from(columnsSet);

@@ -622,8 +658,10 @@ exportedColumns.sort((a, b) => {

Object.assign(allCellsToFlash, cellsToFlash);
data.push(this.buildExportParams({
columns: range.columns,
rowPositions,
includeHeaders: params.includeHeaders,
includeGroupHeaders: params.includeGroupHeaders
}));
data.push(
this.buildExportParams({
columns: range.columns,
rowPositions,
includeHeaders: params.includeHeaders,
includeGroupHeaders: params.includeGroupHeaders
})
);
});

@@ -653,3 +691,3 @@ return { data: data.join("\n"), cellsToFlash: allCellsToFlash };

getCellsToFlashFromRowNodes(rowNodes) {
const allDisplayedColumns = this.columnModel.getAllDisplayedColumns();
const allDisplayedColumns = this.visibleColsService.getAllCols();
const cellsToFlash = {};

@@ -719,11 +757,10 @@ for (let i = 0; i < rowNodes.length; i++) {

const getValueFromNode = () => {
var _a, _b;
if (isTreeData || isSuppressGroupMaintainValueType || !column) {
return node.key;
}
const value2 = (_a = node.groupData) == null ? void 0 : _a[column.getId()];
const value2 = node.groupData?.[column.getId()];
if (!value2 || !node.rowGroupColumn || node.rowGroupColumn.getColDef().useValueFormatterForExport === false) {
return value2;
}
return (_b = this.valueService.formatValue(node.rowGroupColumn, node, value2)) != null ? _b : value2;
return this.valueService.formatValue(node.rowGroupColumn, node, value2) ?? value2;
};

@@ -742,3 +779,3 @@ let value = getValueFromNode();

if (!column2 && node.footer && node.level === -1) {
column2 = this.columnModel.getRowGroupColumns()[0];
column2 = this.funcColsService.getRowGroupColumns()[0];
}

@@ -750,6 +787,3 @@ return processCellForClipboard({

type: "clipboard",
formatValue: (valueToFormat) => {
var _a;
return (_a = this.valueService.formatValue(column2, node, valueToFormat)) != null ? _a : valueToFormat;
},
formatValue: (valueToFormat) => this.valueService.formatValue(column2, node, valueToFormat) ?? valueToFormat,
parseValue: (valueToParse) => this.valueService.parseValue(column2, node, valueToParse, this.valueService.getValue(column2, node))

@@ -760,6 +794,7 @@ });

}
// eslint-disable-next-line @typescript-eslint/ban-types
dispatchFlashCells(cellsToFlash) {
window.setTimeout(() => {
const event = {
type: import_core.Events.EVENT_FLASH_CELLS,
type: "flashCells",
cells: cellsToFlash

@@ -771,3 +806,2 @@ };

processCell(rowNode, column, value, type, func, canParse, canFormat) {
var _a;
if (func) {

@@ -779,7 +813,9 @@ const params = {

type,
formatValue: (valueToFormat) => {
var _a2;
return (_a2 = this.valueService.formatValue(column, rowNode != null ? rowNode : null, valueToFormat)) != null ? _a2 : valueToFormat;
},
parseValue: (valueToParse) => this.valueService.parseValue(column, rowNode != null ? rowNode : null, valueToParse, this.valueService.getValue(column, rowNode))
formatValue: (valueToFormat) => this.valueService.formatValue(column, rowNode ?? null, valueToFormat) ?? valueToFormat,
parseValue: (valueToParse) => this.valueService.parseValue(
column,
rowNode ?? null,
valueToParse,
this.valueService.getValue(column, rowNode)
)
};

@@ -789,6 +825,11 @@ return func(params);

if (canParse && column.getColDef().useValueParserForImport !== false) {
return this.valueService.parseValue(column, rowNode != null ? rowNode : null, value, this.valueService.getValue(column, rowNode));
return this.valueService.parseValue(
column,
rowNode ?? null,
value,
this.valueService.getValue(column, rowNode)
);
}
if (canFormat && column.getColDef().useValueFormatterForExport !== false) {
return (_a = this.valueService.formatValue(column, rowNode != null ? rowNode : null, value)) != null ? _a : value;
return this.valueService.formatValue(column, rowNode ?? null, value) ?? value;
}

@@ -806,6 +847,4 @@ return value;

navigator.clipboard.writeText(data).catch((e) => {
import_core._.doOnce(() => {
console.warn(e);
console.warn(apiError("writeText"));
}, "clipboardApiError");
(0, import_core._warnOnce)(`${e}
${apiError("writeText")}`);
this.copyDataToClipboardLegacy(data);

@@ -826,3 +865,5 @@ });

if (!result) {
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.");
(0, import_core._warnOnce)(
"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."
);
}

@@ -848,3 +889,3 @@ if (focusedElementBefore != null && focusedElementBefore.focus != null) {

} catch (err) {
console.warn("AG Grid: Browser does not support document.execCommand('copy') for clipboard operations");
(0, import_core._warnOnce)("Browser does not support document.execCommand('copy') for clipboard operations");
}

@@ -871,60 +912,30 @@ if (callbackAfter) {

};
__decorateClass([
(0, import_core.Autowired)("csvCreator")
], ClipboardService.prototype, "csvCreator", 2);
__decorateClass([
(0, import_core.Autowired)("loggerFactory")
], ClipboardService.prototype, "loggerFactory", 2);
__decorateClass([
(0, import_core.Autowired)("selectionService")
], ClipboardService.prototype, "selectionService", 2);
__decorateClass([
(0, import_core.Autowired)("rowModel")
], ClipboardService.prototype, "rowModel", 2);
__decorateClass([
(0, import_core.Autowired)("ctrlsService")
], ClipboardService.prototype, "ctrlsService", 2);
__decorateClass([
(0, import_core.Autowired)("valueService")
], ClipboardService.prototype, "valueService", 2);
__decorateClass([
(0, import_core.Autowired)("focusService")
], ClipboardService.prototype, "focusService", 2);
__decorateClass([
(0, import_core.Autowired)("rowRenderer")
], ClipboardService.prototype, "rowRenderer", 2);
__decorateClass([
(0, import_core.Autowired)("columnModel")
], ClipboardService.prototype, "columnModel", 2);
__decorateClass([
(0, import_core.Autowired)("cellNavigationService")
], ClipboardService.prototype, "cellNavigationService", 2);
__decorateClass([
(0, import_core.Autowired)("cellPositionUtils")
], ClipboardService.prototype, "cellPositionUtils", 2);
__decorateClass([
(0, import_core.Autowired)("rowPositionUtils")
], ClipboardService.prototype, "rowPositionUtils", 2);
__decorateClass([
(0, import_core.Optional)("rangeService")
], ClipboardService.prototype, "rangeService", 2);
__decorateClass([
import_core.PostConstruct
], ClipboardService.prototype, "init", 1);
ClipboardService = __decorateClass([
(0, import_core.Bean)("clipboardService")
], ClipboardService);
// enterprise-modules/clipboard/src/version.ts
var VERSION = "31.3.2";
var VERSION = "32.0.0";
// enterprise-modules/clipboard/src/clipboardModule.ts
var ClipboardCoreModule = {
version: VERSION,
moduleName: `${import_core2.ModuleNames.ClipboardModule}-core`,
beans: [ClipboardService],
dependantModules: [import_core3.EnterpriseCoreModule, import_csv_export.CsvExportModule]
};
var ClipboardApiModule = {
version: VERSION,
moduleName: `${import_core2.ModuleNames.ClipboardModule}-api`,
apiFunctions: {
copyToClipboard,
cutToClipboard,
copySelectedRowsToClipboard,
copySelectedRangeToClipboard,
copySelectedRangeDown,
pasteFromClipboard
},
dependantModules: [ClipboardCoreModule]
};
var ClipboardModule = {
version: VERSION,
moduleName: import_core2.ModuleNames.ClipboardModule,
beans: [ClipboardService],
dependantModules: [
import_core3.EnterpriseCoreModule,
import_csv_export.CsvExportModule
]
dependantModules: [ClipboardCoreModule, ClipboardApiModule]
};

@@ -1,4 +0,6 @@

var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var s in e)__defProp(t,s,{get:e[s],enumerable:!0})},__copyProps=(t,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of __getOwnPropNames(e))!__hasOwnProp.call(t,r)&&r!==s&&__defProp(t,r,{get:()=>e[r],enumerable:!(o=__getOwnPropDesc(e,r))||o.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,s,o)=>{for(var r=o>1?void 0:o?__getOwnPropDesc(e,s):e,l=t.length-1,i;l>=0;l--)(i=t[l])&&(r=(o?i(e,s,r):i(r))||r);return o&&r&&__defProp(e,s,r),r},main_exports={};__export(main_exports,{ClipboardModule:()=>ClipboardModule}),module.exports=__toCommonJS(main_exports);var import_core2=require("@ag-grid-community/core"),import_core3=require("@ag-grid-enterprise/core"),import_csv_export=require("@ag-grid-community/csv-export"),import_core=require("@ag-grid-community/core"),SOURCE_PASTE="paste",EXPORT_TYPE_DRAG_COPY="dragCopy",EXPORT_TYPE_CLIPBOARD="clipboard",apiError=t=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${t}()). 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.`,ClipboardService=class extends import_core.BeanStub{constructor(){super(...arguments),this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}init(){this.logger=this.loggerFactory.create("ClipboardService"),this.rowModel.getType()==="clientSide"&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady(t=>{this.gridCtrl=t.gridCtrl})}pasteFromClipboard(){this.logger.log("pasteFromClipboard"),!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&navigator.clipboard&&navigator.clipboard.readText?navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch(e=>{import_core._.doOnce(()=>{console.warn(e),console.warn(apiError("readText"))},"clipboardApiError"),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()}):this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let t=!1;const e=s=>{const o=new Date().getTime();o-this.lastPasteOperationTime<50&&(t=!0,s.preventDefault()),this.lastPasteOperationTime=o};this.executeOnTempElement(s=>{s.addEventListener("paste",e),s.focus({preventScroll:!0})},s=>{const o=s.value;t?this.refocusLastFocusedCell():this.processClipboardData(o),s.removeEventListener("paste",e)})}refocusLastFocusedCell(){const t=this.focusService.getFocusedCell();t&&this.focusService.setFocusedCell({rowIndex:t.rowIndex,column:t.column,rowPinned:t.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){const t=this.gos.get("clipboardDelimiter");return import_core._.exists(t)?t:" "}processClipboardData(t){if(t==null)return;let e=ClipboardService.stringToArray(t,this.getClipboardDelimiter());const s=this.gos.getCallback("processDataFromClipboard");if(s&&(e=s({data:e})),e==null)return;this.gos.get("suppressLastEmptyLineOnPaste")&&this.removeLastLineIfBlank(e);const o=(r,l,i,a)=>{var c;((c=this.rangeService)==null?void 0:c.isMoreThanOneCell())&&!this.hasOnlyOneValueToPaste(e)?this.pasteIntoActiveRange(this.rangeService,e,r,l,a):this.pasteStartingFromFocusedCell(e,r,l,i,a)};this.doPasteOperation(o)}static stringToArray(t,e=","){const s=[],o=l=>l==="\r"||l===`
`;let r=!1;if(t==="")return[[""]];for(let l=0,i=0,a=0;a<t.length;a++){const c=t[a-1],u=t[a],n=t[a+1],d=()=>{s[l]||(s[l]=[]),s[l][i]||(s[l][i]="")};if(d(),u==='"'&&(r?n==='"'?(s[l][i]+='"',a++):r=!1:(c===void 0||c===e||o(c))&&(r=!0)),!r&&u!=='"'){if(u===e){i++,d();continue}else if(o(u)){i=0,l++,d(),u==="\r"&&n===`
`&&a++;continue}}s[l][i]+=u}return s}doPasteOperation(t){const e="clipboard";this.eventService.dispatchEvent({type:import_core.Events.EVENT_PASTE_START,source:e});let s;if(this.clientSideRowModel){const c=this.gos.get("aggregateOnlyChangedColumns");s=new import_core.ChangedPath(c,this.clientSideRowModel.getRootNode())}const o={},r=[],l=this.focusService.getFocusedCell();t(o,r,l,s);const i=[...r];s&&(this.clientSideRowModel.doAggregate(s),s.forEachChangedNodeDepthFirst(c=>{i.push(c)})),this.rowRenderer.refreshCells({rowNodes:i}),this.dispatchFlashCells(o),this.fireRowChanged(r),this.refocusLastFocusedCell();const a={type:import_core.Events.EVENT_PASTE_END,source:e};this.eventService.dispatchEvent(a)}pasteIntoActiveRange(t,e,s,o,r){const l=this.getRangeSize(t)%e.length!=0;let i=0,a=0;const c=(u,n,d,p)=>{if(p-i>=e.length){if(l)return;i+=a,a=0}const g=e[p-i];o.push(n);const f=this.gos.getCallback("processCellFromClipboard");d.forEach((C,v)=>{if(!C.isCellEditable(n)||C.isSuppressPaste(n))return;v>=g.length&&(v=v%g.length);const w=this.processCell(n,C,g[v],EXPORT_TYPE_DRAG_COPY,f,!0);n.setDataValue(C,w,SOURCE_PASTE),r&&r.addParentNode(n.parent,[C]);const{rowIndex:m,rowPinned:b}=u,S=this.cellPositionUtils.createIdFromValues({rowIndex:m,column:C,rowPinned:b});s[S]=!0}),a++};this.iterateActiveRanges(!1,c)}getDisplayedColumnsStartingAt(t){let e=t;const s=[];for(;e!=null;)s.push(e),e=this.columnModel.getDisplayedColAfter(e);return s}pasteStartingFromFocusedCell(t,e,s,o,r){if(!o)return;const l={rowIndex:o.rowIndex,rowPinned:o.rowPinned},i=this.getDisplayedColumnsStartingAt(o.column);this.isPasteSingleValueIntoRange(t)?this.pasteSingleValueIntoRange(t,s,e,r):this.pasteMultipleValues(t,l,s,i,e,EXPORT_TYPE_CLIPBOARD,r)}isPasteSingleValueIntoRange(t){return this.hasOnlyOneValueToPaste(t)&&this.rangeService!=null&&!this.rangeService.isEmpty()}pasteSingleValueIntoRange(t,e,s,o){const r=t[0][0],l=(i,a,c)=>{e.push(a),c.forEach(u=>this.updateCellValue(a,u,r,s,EXPORT_TYPE_CLIPBOARD,o))};this.iterateActiveRanges(!1,l)}hasOnlyOneValueToPaste(t){return t.length===1&&t[0].length===1}copyRangeDown(){if(!this.rangeService||this.rangeService.isEmpty())return;const t=[],e=(s,o,r,l)=>{const i=this.gos.getCallback("processCellForClipboard"),a=this.gos.getCallback("processCellFromClipboard"),c=(u,n,d)=>{t.length?(o.push(n),d.forEach((p,h)=>{if(!p.isCellEditable(n)||p.isSuppressPaste(n))return;const g=this.processCell(n,p,t[h],EXPORT_TYPE_DRAG_COPY,a,!0);n.setDataValue(p,g,SOURCE_PASTE),l&&l.addParentNode(n.parent,[p]);const{rowIndex:f,rowPinned:C}=u,v=this.cellPositionUtils.createIdFromValues({rowIndex:f,column:p,rowPinned:C});s[v]=!0})):d.forEach(p=>{const h=this.processCell(n,p,this.valueService.getValue(p,n),EXPORT_TYPE_DRAG_COPY,i,!1,!0);t.push(h)})};this.iterateActiveRanges(!0,c)};this.doPasteOperation(e)}removeLastLineIfBlank(t){const e=import_core._.last(t);if(e&&e.length===1&&e[0]===""){if(t.length===1)return;import_core._.removeFromArray(t,e)}}fireRowChanged(t){this.gos.get("editType")==="fullRow"&&t.forEach(e=>{const s={type:import_core.Events.EVENT_ROW_VALUE_CHANGED,node:e,data:e.data,rowIndex:e.rowIndex,rowPinned:e.rowPinned};this.eventService.dispatchEvent(s)})}pasteMultipleValues(t,e,s,o,r,l,i){let a=e;const c=this.clientSideRowModel!=null&&!this.gos.get("enableGroupEdit")&&!this.gos.get("treeData"),u=()=>{for(;;){if(!a)return null;const n=this.rowPositionUtils.getRowNode(a);if(a=this.cellNavigationService.getRowBelow({rowPinned:a.rowPinned,rowIndex:a.rowIndex}),n==null)return null;if(!(n.detail||n.footer||c&&n.group))return n}};t.forEach(n=>{const d=u();d&&(n.forEach((p,h)=>this.updateCellValue(d,o[h],p,r,l,i)),s.push(d))})}updateCellValue(t,e,s,o,r,l){if(!t||!e||!e.isCellEditable(t)||e.isSuppressPaste(t)||t.group&&e.isValueActive())return;const i=this.processCell(t,e,s,r,this.gos.getCallback("processCellFromClipboard"),!0);t.setDataValue(e,i,SOURCE_PASTE);const{rowIndex:a,rowPinned:c}=t,u=this.cellPositionUtils.createIdFromValues({rowIndex:a,column:e,rowPinned:c});o[u]=!0,l&&l.addParentNode(t.parent,[e])}copyToClipboard(t={}){this.copyOrCutToClipboard(t)}cutToClipboard(t={},e="api"){if(this.gos.get("suppressCutToClipboard"))return;const s={type:import_core.Events.EVENT_CUT_START,source:e};this.eventService.dispatchEvent(s),this.copyOrCutToClipboard(t,!0);const o={type:import_core.Events.EVENT_CUT_END,source:e};this.eventService.dispatchEvent(o)}copyOrCutToClipboard(t,e){let{includeHeaders:s,includeGroupHeaders:o}=t;this.logger.log(`copyToClipboard: includeHeaders = ${s}`),s==null&&(s=this.gos.get("copyHeadersToClipboard")),o==null&&(o=this.gos.get("copyGroupHeadersToClipboard"));const r={includeHeaders:s,includeGroupHeaders:o},l=!this.gos.get("suppressCopyRowsToClipboard");let i=null;this.rangeService&&!this.rangeService.isEmpty()&&!this.shouldSkipSingleCellRange(this.rangeService)?(this.copySelectedRangeToClipboard(r),i=0):l&&!this.selectionService.isEmpty()?(this.copySelectedRowsToClipboard(r),i=1):this.focusService.isAnyCellFocused()&&(this.copyFocusedCellToClipboard(r),i=2),e&&i!==null&&this.clearCellsAfterCopy(i)}clearCellsAfterCopy(t){if(this.eventService.dispatchEvent({type:import_core.Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_START}),t===0)this.rangeService.clearCellRangeCellValues({cellEventSource:"clipboardService"});else if(t===1)this.clearSelectedRows();else{const e=this.focusService.getFocusedCell();if(e==null)return;const s=this.rowPositionUtils.getRowNode(e);s&&this.clearCellValue(s,e.column)}this.eventService.dispatchEvent({type:import_core.Events.EVENT_KEY_SHORTCUT_CHANGED_CELL_END})}clearSelectedRows(){const t=this.selectionService.getSelectedNodes(),e=this.columnModel.getAllDisplayedColumns();for(const s of t)for(const o of e)this.clearCellValue(s,o)}clearCellValue(t,e){var s;if(!e.isCellEditable(t))return;const o=(s=this.valueService.parseValue(e,t,"",t.getValueFromValueService(e)))!=null?s:null;t.setDataValue(e,o,"clipboardService")}shouldSkipSingleCellRange(t){return this.gos.get("suppressCopySingleCellRanges")&&!t.isMoreThanOneCell()}iterateActiveRanges(t,e,s){if(!this.rangeService||this.rangeService.isEmpty())return;const o=this.rangeService.getCellRanges();t?this.iterateActiveRange(o[0],e,s,!0):o.forEach((r,l)=>this.iterateActiveRange(r,e,s,l===o.length-1))}iterateActiveRange(t,e,s,o){if(!this.rangeService)return;let r=this.rangeService.getRangeStartRow(t);const l=this.rangeService.getRangeEndRow(t);s&&t.columns&&s(t.columns);let i=0,a=!1;for(;!a&&r!=null;){const c=this.rowPositionUtils.getRowNode(r);a=this.rowPositionUtils.sameRow(r,l),e(r,c,t.columns,i++,a&&o),r=this.cellNavigationService.getRowBelow(r)}}copySelectedRangeToClipboard(t={}){if(!this.rangeService||this.rangeService.isEmpty())return;const e=this.rangeService.areAllRangesAbleToMerge(),{data:s,cellsToFlash:o}=e?this.buildDataFromMergedRanges(this.rangeService,t):this.buildDataFromRanges(this.rangeService,t);this.copyDataToClipboard(s),this.dispatchFlashCells(o)}buildDataFromMergedRanges(t,e){const s=new Set,o=t.getCellRanges(),r=new Map,l=[],i={};o.forEach(n=>{n.columns.forEach(h=>s.add(h));const{rowPositions:d,cellsToFlash:p}=this.getRangeRowPositionsAndCellsToFlash(t,n);d.forEach(h=>{const g=`${h.rowIndex}-${h.rowPinned||"null"}`;r.get(g)||(r.set(g,!0),l.push(h))}),Object.assign(i,p)});const a=this.columnModel.getAllDisplayedColumns(),c=Array.from(s);return c.sort((n,d)=>{const p=a.indexOf(n),h=a.indexOf(d);return p-h}),{data:this.buildExportParams({columns:c,rowPositions:l,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}),cellsToFlash:i}}buildDataFromRanges(t,e){const s=t.getCellRanges(),o=[],r={};return s.forEach(l=>{const{rowPositions:i,cellsToFlash:a}=this.getRangeRowPositionsAndCellsToFlash(t,l);Object.assign(r,a),o.push(this.buildExportParams({columns:l.columns,rowPositions:i,includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders}))}),{data:o.join(`
`),cellsToFlash:r}}getRangeRowPositionsAndCellsToFlash(t,e){const s=[],o={},r=t.getRangeStartRow(e),l=t.getRangeEndRow(e);let i=r;for(;i&&(s.push(i),e.columns.forEach(a=>{const{rowIndex:c,rowPinned:u}=i,n=this.cellPositionUtils.createIdFromValues({rowIndex:c,column:a,rowPinned:u});o[n]=!0}),!this.rowPositionUtils.sameRow(i,l));)i=this.cellNavigationService.getRowBelow(i);return{rowPositions:s,cellsToFlash:o}}getCellsToFlashFromRowNodes(t){const e=this.columnModel.getAllDisplayedColumns(),s={};for(let o=0;o<t.length;o++){const{rowIndex:r,rowPinned:l}=t[o];if(r!=null)for(let i=0;i<e.length;i++){const a=e[i],c=this.cellPositionUtils.createIdFromValues({rowIndex:r,column:a,rowPinned:l});s[c]=!0}}return s}copyFocusedCellToClipboard(t={}){const e=this.focusService.getFocusedCell();if(e==null)return;const s=this.cellPositionUtils.createId(e),o={rowPinned:e.rowPinned,rowIndex:e.rowIndex},r=e.column,l=this.buildExportParams({columns:[r],rowPositions:[o],includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders});this.copyDataToClipboard(l),this.dispatchFlashCells({[s]:!0})}copySelectedRowsToClipboard(t={}){const{columnKeys:e,includeHeaders:s,includeGroupHeaders:o}=t,r=this.buildExportParams({columns:e,includeHeaders:s,includeGroupHeaders:o});this.copyDataToClipboard(r);const l=this.selectionService.getSelectedNodes()||[];this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(l))}buildExportParams(t){const{columns:e,rowPositions:s,includeHeaders:o=!1,includeGroupHeaders:r=!1}=t,l={columnKeys:e,rowPositions:s,skipColumnHeaders:!o,skipColumnGroupHeaders:!r,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!s,processCellCallback:this.gos.getCallback("processCellForClipboard"),processRowGroupCallback:i=>this.processRowGroupCallback(i),processHeaderCallback:this.gos.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:this.gos.getCallback("processGroupHeaderForClipboard")};return this.csvCreator.getDataAsCsv(l,!0)}processRowGroupCallback(t){const{node:e,column:s}=t,o=this.gos.get("treeData"),r=this.gos.get("suppressGroupMaintainValueType");let i=(()=>{var c,u;if(o||r||!s)return e.key;const n=(c=e.groupData)==null?void 0:c[s.getId()];return!n||!e.rowGroupColumn||e.rowGroupColumn.getColDef().useValueFormatterForExport===!1?n:(u=this.valueService.formatValue(e.rowGroupColumn,e,n))!=null?u:n})();if(t.node.footer){let c="";i&&i.length&&(c=` ${i}`),i=`Total${c}`}const a=this.gos.getCallback("processCellForClipboard");if(a){let c=e.rowGroupColumn;return!c&&e.footer&&e.level===-1&&(c=this.columnModel.getRowGroupColumns()[0]),a({value:i,node:e,column:c,type:"clipboard",formatValue:u=>{var n;return(n=this.valueService.formatValue(c,e,u))!=null?n:u},parseValue:u=>this.valueService.parseValue(c,e,u,this.valueService.getValue(c,e))})}return i}dispatchFlashCells(t){window.setTimeout(()=>{const e={type:import_core.Events.EVENT_FLASH_CELLS,cells:t};this.eventService.dispatchEvent(e)},0)}processCell(t,e,s,o,r,l,i){var a;return r?r({column:e,node:t,value:s,type:o,formatValue:u=>{var n;return(n=this.valueService.formatValue(e,t??null,u))!=null?n:u},parseValue:u=>this.valueService.parseValue(e,t??null,u,this.valueService.getValue(e,t))}):l&&e.getColDef().useValueParserForImport!==!1?this.valueService.parseValue(e,t??null,s,this.valueService.getValue(e,t)):i&&e.getColDef().useValueFormatterForExport!==!1&&(a=this.valueService.formatValue(e,t??null,s))!=null?a:s}copyDataToClipboard(t){const e=this.gos.getCallback("sendToClipboard");if(e){e({data:t});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(t).catch(o=>{import_core._.doOnce(()=>{console.warn(o),console.warn(apiError("writeText"))},"clipboardApiError"),this.copyDataToClipboardLegacy(t)});return}this.copyDataToClipboardLegacy(t)}copyDataToClipboardLegacy(t){this.executeOnTempElement(e=>{const s=this.gos.getDocument(),o=this.gos.getActiveDomElement();e.value=t||" ",e.select(),e.focus({preventScroll:!0}),s.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."),o!=null&&o.focus!=null&&o.focus({preventScroll:!0})})}executeOnTempElement(t,e){const s=this.gos.getDocument(),o=s.createElement("textarea");o.style.width="1px",o.style.height="1px",o.style.top=s.documentElement.scrollTop+"px",o.style.left=s.documentElement.scrollLeft+"px",o.style.position="absolute",o.style.opacity="0";const r=this.gridCtrl.getGui();r.appendChild(o);try{t(o)}catch{console.warn("AG Grid: Browser does not support document.execCommand('copy') for clipboard operations")}e?window.setTimeout(()=>{e(o),r.removeChild(o)},100):r.removeChild(o)}getRangeSize(t){const e=t.getCellRanges();let s=0,o=0;return e.length>0&&(s=t.getRangeStartRow(e[0]).rowIndex,o=t.getRangeEndRow(e[0]).rowIndex),s-o+1}};__decorateClass([(0,import_core.Autowired)("csvCreator")],ClipboardService.prototype,"csvCreator",2),__decorateClass([(0,import_core.Autowired)("loggerFactory")],ClipboardService.prototype,"loggerFactory",2),__decorateClass([(0,import_core.Autowired)("selectionService")],ClipboardService.prototype,"selectionService",2),__decorateClass([(0,import_core.Autowired)("rowModel")],ClipboardService.prototype,"rowModel",2),__decorateClass([(0,import_core.Autowired)("ctrlsService")],ClipboardService.prototype,"ctrlsService",2),__decorateClass([(0,import_core.Autowired)("valueService")],ClipboardService.prototype,"valueService",2),__decorateClass([(0,import_core.Autowired)("focusService")],ClipboardService.prototype,"focusService",2),__decorateClass([(0,import_core.Autowired)("rowRenderer")],ClipboardService.prototype,"rowRenderer",2),__decorateClass([(0,import_core.Autowired)("columnModel")],ClipboardService.prototype,"columnModel",2),__decorateClass([(0,import_core.Autowired)("cellNavigationService")],ClipboardService.prototype,"cellNavigationService",2),__decorateClass([(0,import_core.Autowired)("cellPositionUtils")],ClipboardService.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core.Autowired)("rowPositionUtils")],ClipboardService.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core.Optional)("rangeService")],ClipboardService.prototype,"rangeService",2),__decorateClass([import_core.PostConstruct],ClipboardService.prototype,"init",1),ClipboardService=__decorateClass([(0,import_core.Bean)("clipboardService")],ClipboardService);var VERSION="31.3.2",ClipboardModule={version:VERSION,moduleName:import_core2.ModuleNames.ClipboardModule,beans:[ClipboardService],dependantModules:[import_core3.EnterpriseCoreModule,import_csv_export.CsvExportModule]};
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(p,e)=>{for(var t in e)__defProp(p,t,{get:e[t],enumerable:!0})},__copyProps=(p,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of __getOwnPropNames(e))!__hasOwnProp.call(p,o)&&o!==t&&__defProp(p,o,{get:()=>e[o],enumerable:!(s=__getOwnPropDesc(e,o))||s.enumerable});return p},__toCommonJS=p=>__copyProps(__defProp({},"__esModule",{value:!0}),p),main_exports={};__export(main_exports,{ClipboardModule:()=>ClipboardModule}),module.exports=__toCommonJS(main_exports);var import_core2=require("@ag-grid-community/core"),import_csv_export=require("@ag-grid-community/csv-export"),import_core3=require("@ag-grid-enterprise/core");function copyToClipboard(p,e){p.clipboardService?.copyToClipboard(e)}function cutToClipboard(p,e){p.clipboardService?.cutToClipboard(e)}function copySelectedRowsToClipboard(p,e){p.clipboardService?.copySelectedRowsToClipboard(e)}function copySelectedRangeToClipboard(p,e){p.clipboardService?.copySelectedRangeToClipboard(e)}function copySelectedRangeDown(p){p.clipboardService?.copyRangeDown()}function pasteFromClipboard(p){p.clipboardService?.pasteFromClipboard()}var import_core=require("@ag-grid-community/core"),SOURCE_PASTE="paste",EXPORT_TYPE_DRAG_COPY="dragCopy",EXPORT_TYPE_CLIPBOARD="clipboard",apiError=p=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${p}()). 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.`,ClipboardService=class S extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="clipboardService",this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}wireBeans(e){this.csvCreator=e.csvCreator,this.selectionService=e.selectionService,this.rowModel=e.rowModel,this.ctrlsService=e.ctrlsService,this.valueService=e.valueService,this.focusService=e.focusService,this.rowRenderer=e.rowRenderer,this.visibleColsService=e.visibleColsService,this.funcColsService=e.funcColsService,this.cellNavigationService=e.cellNavigationService,this.cellPositionUtils=e.cellPositionUtils,this.rowPositionUtils=e.rowPositionUtils,this.rangeService=e.rangeService}postConstruct(){this.rowModel.getType()==="clientSide"&&(this.clientSideRowModel=this.rowModel),this.ctrlsService.whenReady(e=>{this.gridCtrl=e.gridCtrl})}pasteFromClipboard(){!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&navigator.clipboard&&navigator.clipboard.readText?navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch(t=>{(0,import_core._warnOnce)(`${t}
${apiError("readText")}`),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()}):this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let e=!1;const t=s=>{const o=new Date().getTime();o-this.lastPasteOperationTime<50&&(e=!0,s.preventDefault()),this.lastPasteOperationTime=o};this.executeOnTempElement(s=>{s.addEventListener("paste",t),s.focus({preventScroll:!0})},s=>{const o=s.value;e?this.refocusLastFocusedCell():this.processClipboardData(o),s.removeEventListener("paste",t)})}refocusLastFocusedCell(){const e=this.focusService.getFocusedCell();e&&this.focusService.setFocusedCell({rowIndex:e.rowIndex,column:e.column,rowPinned:e.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){const e=this.gos.get("clipboardDelimiter");return(0,import_core._exists)(e)?e:" "}processClipboardData(e){if(e==null)return;let t=S.stringToArray(e,this.getClipboardDelimiter());const s=this.gos.getCallback("processDataFromClipboard");if(s&&(t=s({data:t})),t==null)return;this.gos.get("suppressLastEmptyLineOnPaste")&&this.removeLastLineIfBlank(t);const o=(i,l,r,n)=>{this.rangeService?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(t)?this.pasteIntoActiveRange(this.rangeService,t,i,l,n):this.pasteStartingFromFocusedCell(t,i,l,r,n)};this.doPasteOperation(o)}static stringToArray(e,t=","){const s=[],o=l=>l==="\r"||l===`
`;let i=!1;if(e==="")return[[""]];for(let l=0,r=0,n=0;n<e.length;n++){const a=e[n-1],u=e[n],c=e[n+1],h=()=>{s[l]||(s[l]=[]),s[l][r]||(s[l][r]="")};if(h(),u==='"'&&(i?c==='"'?(s[l][r]+='"',n++):i=!1:(a===void 0||a===t||o(a))&&(i=!0)),!i&&u!=='"'){if(u===t){r++,h();continue}else if(o(u)){r=0,l++,h(),u==="\r"&&c===`
`&&n++;continue}}s[l][r]+=u}return s}doPasteOperation(e){const t="clipboard";this.eventService.dispatchEvent({type:"pasteStart",source:t});let s;if(this.clientSideRowModel){const a=this.gos.get("aggregateOnlyChangedColumns");s=new import_core.ChangedPath(a,this.clientSideRowModel.getRootNode())}const o={},i=[],l=this.focusService.getFocusedCell();e(o,i,l,s);const r=[...i];s&&(this.clientSideRowModel.doAggregate(s),s.forEachChangedNodeDepthFirst(a=>{r.push(a)})),this.rowRenderer.refreshCells({rowNodes:r}),this.dispatchFlashCells(o),this.fireRowChanged(i),this.refocusLastFocusedCell();const n={type:"pasteEnd",source:t};this.eventService.dispatchEvent(n)}pasteIntoActiveRange(e,t,s,o,i){const l=this.getRangeSize(e)%t.length!=0;let r=0,n=0;const a=(u,c,h,d)=>{if(d-r>=t.length){if(l)return;r+=n,n=0}const C=t[d-r];o.push(c);const w=this.gos.getCallback("processCellFromClipboard");h.forEach((v,f)=>{if(!v.isCellEditable(c)||v.isSuppressPaste(c))return;f>=C.length&&(f=f%C.length);const b=this.processCell(c,v,C[f],EXPORT_TYPE_DRAG_COPY,w,!0);c.setDataValue(v,b,SOURCE_PASTE),i&&i.addParentNode(c.parent,[v]);const{rowIndex:m,rowPinned:R}=u,y=this.cellPositionUtils.createIdFromValues({rowIndex:m,column:v,rowPinned:R});s[y]=!0}),n++};this.iterateActiveRanges(!1,a)}getDisplayedColumnsStartingAt(e){let t=e;const s=[];for(;t!=null;)s.push(t),t=this.visibleColsService.getColAfter(t);return s}pasteStartingFromFocusedCell(e,t,s,o,i){if(!o)return;const l={rowIndex:o.rowIndex,rowPinned:o.rowPinned},r=this.getDisplayedColumnsStartingAt(o.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,s,t,i):this.pasteMultipleValues(e,l,s,r,t,EXPORT_TYPE_CLIPBOARD,i)}isPasteSingleValueIntoRange(e){return this.hasOnlyOneValueToPaste(e)&&this.rangeService!=null&&!this.rangeService.isEmpty()}pasteSingleValueIntoRange(e,t,s,o){const i=e[0][0],l=(r,n,a)=>{t.push(n),a.forEach(u=>this.updateCellValue(n,u,i,s,EXPORT_TYPE_CLIPBOARD,o))};this.iterateActiveRanges(!1,l)}hasOnlyOneValueToPaste(e){return e.length===1&&e[0].length===1}copyRangeDown(){if(!this.rangeService||this.rangeService.isEmpty())return;const e=[],t=(s,o,i,l)=>{const r=this.gos.getCallback("processCellForClipboard"),n=this.gos.getCallback("processCellFromClipboard"),a=(u,c,h)=>{e.length?(o.push(c),h.forEach((d,g)=>{if(!d.isCellEditable(c)||d.isSuppressPaste(c))return;const C=this.processCell(c,d,e[g],EXPORT_TYPE_DRAG_COPY,n,!0);c.setDataValue(d,C,SOURCE_PASTE),l&&l.addParentNode(c.parent,[d]);const{rowIndex:w,rowPinned:v}=u,f=this.cellPositionUtils.createIdFromValues({rowIndex:w,column:d,rowPinned:v});s[f]=!0})):h.forEach(d=>{const g=this.processCell(c,d,this.valueService.getValue(d,c),EXPORT_TYPE_DRAG_COPY,r,!1,!0);e.push(g)})};this.iterateActiveRanges(!0,a)};this.doPasteOperation(t)}removeLastLineIfBlank(e){const t=(0,import_core._last)(e);if(t&&t.length===1&&t[0]===""){if(e.length===1)return;(0,import_core._removeFromArray)(e,t)}}fireRowChanged(e){this.gos.get("editType")==="fullRow"&&e.forEach(t=>{const s={type:"rowValueChanged",node:t,data:t.data,rowIndex:t.rowIndex,rowPinned:t.rowPinned};this.eventService.dispatchEvent(s)})}pasteMultipleValues(e,t,s,o,i,l,r){let n=t;const a=this.clientSideRowModel!=null&&!this.gos.get("enableGroupEdit")&&!this.gos.get("treeData"),u=()=>{for(;;){if(!n)return null;const c=this.rowPositionUtils.getRowNode(n);if(n=this.cellNavigationService.getRowBelow({rowPinned:n.rowPinned,rowIndex:n.rowIndex}),c==null)return null;if(!(c.detail||c.footer||a&&c.group))return c}};e.forEach(c=>{const h=u();h&&(c.forEach((d,g)=>this.updateCellValue(h,o[g],d,i,l,r)),s.push(h))})}updateCellValue(e,t,s,o,i,l){if(!e||!t||!t.isCellEditable(e)||t.isSuppressPaste(e)||e.group&&t.isValueActive())return;const r=this.processCell(e,t,s,i,this.gos.getCallback("processCellFromClipboard"),!0);e.setDataValue(t,r,SOURCE_PASTE);const{rowIndex:n,rowPinned:a}=e,u=this.cellPositionUtils.createIdFromValues({rowIndex:n,column:t,rowPinned:a});o[u]=!0,l&&l.addParentNode(e.parent,[t])}copyToClipboard(e={}){this.copyOrCutToClipboard(e)}cutToClipboard(e={},t="api"){if(this.gos.get("suppressCutToClipboard"))return;const s={type:"cutStart",source:t};this.eventService.dispatchEvent(s),this.copyOrCutToClipboard(e,!0);const o={type:"cutEnd",source:t};this.eventService.dispatchEvent(o)}copyOrCutToClipboard(e,t){let{includeHeaders:s,includeGroupHeaders:o}=e;s==null&&(s=this.gos.get("copyHeadersToClipboard")),o==null&&(o=this.gos.get("copyGroupHeadersToClipboard"));const i={includeHeaders:s,includeGroupHeaders:o},l=!this.gos.get("suppressCopyRowsToClipboard");let r=null;this.rangeService&&!this.rangeService.isEmpty()&&!this.shouldSkipSingleCellRange(this.rangeService)?(this.copySelectedRangeToClipboard(i),r=0):l&&!this.selectionService.isEmpty()?(this.copySelectedRowsToClipboard(i),r=1):this.focusService.isAnyCellFocused()&&(this.copyFocusedCellToClipboard(i),r=2),t&&r!==null&&this.clearCellsAfterCopy(r)}clearCellsAfterCopy(e){if(this.eventService.dispatchEvent({type:"keyShortcutChangedCellStart"}),e===0)this.rangeService.clearCellRangeCellValues({cellEventSource:"clipboardService"});else if(e===1)this.clearSelectedRows();else{const t=this.focusService.getFocusedCell();if(t==null)return;const s=this.rowPositionUtils.getRowNode(t);s&&this.clearCellValue(s,t.column)}this.eventService.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){const e=this.selectionService.getSelectedNodes(),t=this.visibleColsService.getAllCols();for(const s of e)for(const o of t)this.clearCellValue(s,o)}clearCellValue(e,t){if(!t.isCellEditable(e))return;const s=this.valueService.parseValue(t,e,"",e.getValueFromValueService(t))??null;e.setDataValue(t,s,"clipboardService")}shouldSkipSingleCellRange(e){return this.gos.get("suppressCopySingleCellRanges")&&!e.isMoreThanOneCell()}iterateActiveRanges(e,t,s){if(!this.rangeService||this.rangeService.isEmpty())return;const o=this.rangeService.getCellRanges();e?this.iterateActiveRange(o[0],t,s,!0):o.forEach((i,l)=>this.iterateActiveRange(i,t,s,l===o.length-1))}iterateActiveRange(e,t,s,o){if(!this.rangeService)return;let i=this.rangeService.getRangeStartRow(e);const l=this.rangeService.getRangeEndRow(e);s&&e.columns&&s(e.columns);let r=0,n=!1;for(;!n&&i!=null;){const a=this.rowPositionUtils.getRowNode(i);n=this.rowPositionUtils.sameRow(i,l),t(i,a,e.columns,r++,n&&o),i=this.cellNavigationService.getRowBelow(i)}}copySelectedRangeToClipboard(e={}){if(!this.rangeService||this.rangeService.isEmpty())return;const t=this.rangeService.areAllRangesAbleToMerge(),{data:s,cellsToFlash:o}=t?this.buildDataFromMergedRanges(this.rangeService,e):this.buildDataFromRanges(this.rangeService,e);this.copyDataToClipboard(s),this.dispatchFlashCells(o)}buildDataFromMergedRanges(e,t){const s=new Set,o=e.getCellRanges(),i=new Map,l=[],r={};o.forEach(c=>{c.columns.forEach(g=>s.add(g));const{rowPositions:h,cellsToFlash:d}=this.getRangeRowPositionsAndCellsToFlash(e,c);h.forEach(g=>{const C=`${g.rowIndex}-${g.rowPinned||"null"}`;i.get(C)||(i.set(C,!0),l.push(g))}),Object.assign(r,d)});const n=this.visibleColsService.getAllCols(),a=Array.from(s);return a.sort((c,h)=>{const d=n.indexOf(c),g=n.indexOf(h);return d-g}),{data:this.buildExportParams({columns:a,rowPositions:l,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}),cellsToFlash:r}}buildDataFromRanges(e,t){const s=e.getCellRanges(),o=[],i={};return s.forEach(l=>{const{rowPositions:r,cellsToFlash:n}=this.getRangeRowPositionsAndCellsToFlash(e,l);Object.assign(i,n),o.push(this.buildExportParams({columns:l.columns,rowPositions:r,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}))}),{data:o.join(`
`),cellsToFlash:i}}getRangeRowPositionsAndCellsToFlash(e,t){const s=[],o={},i=e.getRangeStartRow(t),l=e.getRangeEndRow(t);let r=i;for(;r&&(s.push(r),t.columns.forEach(n=>{const{rowIndex:a,rowPinned:u}=r,c=this.cellPositionUtils.createIdFromValues({rowIndex:a,column:n,rowPinned:u});o[c]=!0}),!this.rowPositionUtils.sameRow(r,l));)r=this.cellNavigationService.getRowBelow(r);return{rowPositions:s,cellsToFlash:o}}getCellsToFlashFromRowNodes(e){const t=this.visibleColsService.getAllCols(),s={};for(let o=0;o<e.length;o++){const{rowIndex:i,rowPinned:l}=e[o];if(i!=null)for(let r=0;r<t.length;r++){const n=t[r],a=this.cellPositionUtils.createIdFromValues({rowIndex:i,column:n,rowPinned:l});s[a]=!0}}return s}copyFocusedCellToClipboard(e={}){const t=this.focusService.getFocusedCell();if(t==null)return;const s=this.cellPositionUtils.createId(t),o={rowPinned:t.rowPinned,rowIndex:t.rowIndex},i=t.column,l=this.buildExportParams({columns:[i],rowPositions:[o],includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders});this.copyDataToClipboard(l),this.dispatchFlashCells({[s]:!0})}copySelectedRowsToClipboard(e={}){const{columnKeys:t,includeHeaders:s,includeGroupHeaders:o}=e,i=this.buildExportParams({columns:t,includeHeaders:s,includeGroupHeaders:o});this.copyDataToClipboard(i);const l=this.selectionService.getSelectedNodes()||[];this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(l))}buildExportParams(e){const{columns:t,rowPositions:s,includeHeaders:o=!1,includeGroupHeaders:i=!1}=e,l={columnKeys:t,rowPositions:s,skipColumnHeaders:!o,skipColumnGroupHeaders:!i,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!s,processCellCallback:this.gos.getCallback("processCellForClipboard"),processRowGroupCallback:r=>this.processRowGroupCallback(r),processHeaderCallback:this.gos.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:this.gos.getCallback("processGroupHeaderForClipboard")};return this.csvCreator.getDataAsCsv(l,!0)}processRowGroupCallback(e){const{node:t,column:s}=e,o=this.gos.get("treeData"),i=this.gos.get("suppressGroupMaintainValueType");let r=(()=>{if(o||i||!s)return t.key;const a=t.groupData?.[s.getId()];return!a||!t.rowGroupColumn||t.rowGroupColumn.getColDef().useValueFormatterForExport===!1?a:this.valueService.formatValue(t.rowGroupColumn,t,a)??a})();if(e.node.footer){let a="";r&&r.length&&(a=` ${r}`),r=`Total${a}`}const n=this.gos.getCallback("processCellForClipboard");if(n){let a=t.rowGroupColumn;return!a&&t.footer&&t.level===-1&&(a=this.funcColsService.getRowGroupColumns()[0]),n({value:r,node:t,column:a,type:"clipboard",formatValue:u=>this.valueService.formatValue(a,t,u)??u,parseValue:u=>this.valueService.parseValue(a,t,u,this.valueService.getValue(a,t))})}return r}dispatchFlashCells(e){window.setTimeout(()=>{const t={type:"flashCells",cells:e};this.eventService.dispatchEvent(t)},0)}processCell(e,t,s,o,i,l,r){return i?i({column:t,node:e,value:s,type:o,formatValue:a=>this.valueService.formatValue(t,e??null,a)??a,parseValue:a=>this.valueService.parseValue(t,e??null,a,this.valueService.getValue(t,e))}):l&&t.getColDef().useValueParserForImport!==!1?this.valueService.parseValue(t,e??null,s,this.valueService.getValue(t,e)):r&&t.getColDef().useValueFormatterForExport!==!1?this.valueService.formatValue(t,e??null,s)??s:s}copyDataToClipboard(e){const t=this.gos.getCallback("sendToClipboard");if(t){t({data:e});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(e).catch(o=>{(0,import_core._warnOnce)(`${o}
${apiError("writeText")}`),this.copyDataToClipboardLegacy(e)});return}this.copyDataToClipboardLegacy(e)}copyDataToClipboardLegacy(e){this.executeOnTempElement(t=>{const s=this.gos.getDocument(),o=this.gos.getActiveDomElement();t.value=e||" ",t.select(),t.focus({preventScroll:!0}),s.execCommand("copy")||(0,import_core._warnOnce)("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."),o!=null&&o.focus!=null&&o.focus({preventScroll:!0})})}executeOnTempElement(e,t){const s=this.gos.getDocument(),o=s.createElement("textarea");o.style.width="1px",o.style.height="1px",o.style.top=s.documentElement.scrollTop+"px",o.style.left=s.documentElement.scrollLeft+"px",o.style.position="absolute",o.style.opacity="0";const i=this.gridCtrl.getGui();i.appendChild(o);try{e(o)}catch{(0,import_core._warnOnce)("Browser does not support document.execCommand('copy') for clipboard operations")}t?window.setTimeout(()=>{t(o),i.removeChild(o)},100):i.removeChild(o)}getRangeSize(e){const t=e.getCellRanges();let s=0,o=0;return t.length>0&&(s=e.getRangeStartRow(t[0]).rowIndex,o=e.getRangeEndRow(t[0]).rowIndex),s-o+1}},VERSION="32.0.0",ClipboardCoreModule={version:VERSION,moduleName:`${import_core2.ModuleNames.ClipboardModule}-core`,beans:[ClipboardService],dependantModules:[import_core3.EnterpriseCoreModule,import_csv_export.CsvExportModule]},ClipboardApiModule={version:VERSION,moduleName:`${import_core2.ModuleNames.ClipboardModule}-api`,apiFunctions:{copyToClipboard,cutToClipboard,copySelectedRowsToClipboard,copySelectedRangeToClipboard,copySelectedRangeDown,pasteFromClipboard},dependantModules:[ClipboardCoreModule]},ClipboardModule={version:VERSION,moduleName:import_core2.ModuleNames.ClipboardModule,dependantModules:[ClipboardCoreModule,ClipboardApiModule]};
{
"name": "@ag-grid-enterprise/clipboard",
"version": "31.3.2",
"version": "32.0.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

@@ -14,6 +14,7 @@ "main": "./dist/package/main.cjs.js",

},
"sideEffects": false,
"dependencies": {
"@ag-grid-community/core": "31.3.2",
"@ag-grid-community/csv-export": "31.3.2",
"@ag-grid-enterprise/core": "31.3.2"
"@ag-grid-community/core": "32.0.0",
"@ag-grid-community/csv-export": "32.0.0",
"@ag-grid-enterprise/core": "32.0.0"
},

@@ -20,0 +21,0 @@ "devDependencies": {

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

@@ -14,6 +14,7 @@ "main": "./src/main.js",

},
"sideEffects": false,
"dependencies": {
"@ag-grid-community/core": "31.3.2",
"@ag-grid-community/csv-export": "31.3.2",
"@ag-grid-enterprise/core": "31.3.2"
"@ag-grid-community/core": "32.0.0",
"@ag-grid-community/csv-export": "32.0.0",
"@ag-grid-enterprise/core": "32.0.0"
},

@@ -20,0 +21,0 @@ "devDependencies": {

@@ -1,22 +0,24 @@

import { BeanStub, CellPositionUtils, IClipboardCopyParams, IClipboardCopyRowsParams, IClipboardService, RowPositionUtils, CtrlsService } from "@ag-grid-community/core";
export declare class ClipboardService extends BeanStub implements IClipboardService {
import type { BeanCollection, IClipboardCopyParams, IClipboardCopyRowsParams, IClipboardService, NamedBean, RowPositionUtils } from '@ag-grid-community/core';
import { BeanStub } from '@ag-grid-community/core';
export declare class ClipboardService extends BeanStub implements NamedBean, IClipboardService {
beanName: "clipboardService";
private csvCreator;
private loggerFactory;
private selectionService;
private rowModel;
ctrlsService: CtrlsService;
private ctrlsService;
private valueService;
private focusService;
private rowRenderer;
private columnModel;
private visibleColsService;
private funcColsService;
private cellNavigationService;
cellPositionUtils: CellPositionUtils;
private cellPositionUtils;
rowPositionUtils: RowPositionUtils;
private rangeService?;
wireBeans(beans: BeanCollection): void;
private clientSideRowModel;
private logger;
private gridCtrl;
private lastPasteOperationTime;
private navigatorApiFailed;
private init;
postConstruct(): void;
pasteFromClipboard(): void;

@@ -23,0 +25,0 @@ private pasteFromClipboardLegacy;

@@ -1,2 +0,4 @@

import { Module } from "@ag-grid-community/core";
import type { Module } from '@ag-grid-community/core';
export declare const ClipboardCoreModule: Module;
export declare const ClipboardApiModule: Module;
export declare const ClipboardModule: Module;

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

export { ClipboardModule } from "./clipboardModule";
export { ClipboardModule } from './clipboardModule';

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

export declare const VERSION = "31.3.2";
export declare const VERSION = "32.0.0";
{
"name": "@ag-grid-enterprise/clipboard",
"version": "31.3.2",
"version": "32.0.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",

@@ -14,6 +14,7 @@ "main": "./dist/package/main.cjs.js",

},
"sideEffects": false,
"dependencies": {
"@ag-grid-community/core": "31.3.2",
"@ag-grid-community/csv-export": "31.3.2",
"@ag-grid-enterprise/core": "31.3.2"
"@ag-grid-community/core": "32.0.0",
"@ag-grid-community/csv-export": "32.0.0",
"@ag-grid-enterprise/core": "32.0.0"
},

@@ -20,0 +21,0 @@ "devDependencies": {

@@ -1,3 +0,2 @@

AG Grid Enterprise
==============
# AG Grid Enterprise

@@ -8,4 +7,4 @@ This project contains AG Grid Enterprise features.

Frameworks Supported
====================
# Frameworks Supported
Framework specific Getting Started guides:

@@ -21,4 +20,3 @@

Issue Reporting
==============
# Issue Reporting

@@ -29,2 +27,1 @@ If you are an Enterprise customer (or are evaluating AG Grid Enterprise) and wish to report a Bug or raise a new Feature Request please do so on our [Support Portal](https://ag-grid.zendesk.com/).

Send an email to accounts@ag-grid.com with your license key

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

Support and Maintenance document is now merged into the licence document. Please see the licence.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc