Socket
Socket
Sign inDemoInstall

@ag-grid-enterprise/clipboard

Package Overview
Dependencies
3
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 25.0.1 to 25.1.0

17

CONTRIBUTING.md

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

# Contributing to ag-Grid-Enterprise
# Contributing to AG Grid Enterprise
ag-Grid-Enterprise is copyright commercial software. If you provide a PR, you must also state that you agree to the following:
AG Grid Enterprise is copyright commercial software. If you provide a PR, you must also state that you agree to the following:
Retention of Intellectual Property Rights for ag-Grid-Enterprise component
Retention of Intellectual Property Rights for AG Grid Enterprise component
==============

@@ -11,3 +11,3 @@

“the Software” means the ag-Grid-Enterprise software as location the the repository
“the Software” means the AG Grid Enterprise software as location the the repository
https://github.com/ag-grid/ag-grid-enterprise.

@@ -37,8 +37,7 @@

Please, do not open issues for the general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on [StackOverflow](https://stackoverflow.com/questions/tagged/ag-grid) where the questions should be tagged with tag `ag-grig`,
or on our [Forum](https://ag-grid.com/forum)
Please, do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on [StackOverflow](https://stackoverflow.com/questions/tagged/ag-grid) where the questions should be tagged with tag `ag-grid`.
If you're using the Enterprise version of ag-Grid (ag-grid-enterprise), then the [Members Forum](https://ag-grid.com/forum/forumdisplay.php?fid=5) is the best place to ask - you'll get a much quicker response there. Please contact accounts@ag-grid.com for access.
If you're using the Enterprise version of AG Grid (ag-grid-enterprise), then you should use our [Support Portal](https://ag-grid.zendesk.com/) - you'll get a much quicker response there. Please contact accounts@ag-grid.com for access.
To save your and our time we will be systematically closing all the issues that are requests for general support (for ag-Grid Free) and redirecting people to StackOverflow.
To save your and our time we will be systematically closing all the issues that are requests for general support (for AG Grid Community) and redirecting people to StackOverflow.

@@ -61,3 +60,3 @@ ## <a name="issue"></a> Found a Bug?

- version of ag-Grid-Enterprise used
- version of AG Grid Enterprise used
- 3rd-party libraries and their versions

@@ -64,0 +63,0 @@ - and most importantly - a use-case that fails

@@ -23,2 +23,3 @@ import { BeanStub, CellPositionUtils, Column, GridCore, IClipboardService, RowPositionUtils } from "@ag-grid-community/core";

pasteFromClipboard(): void;
private pasteFromClipboardLegacy;
private processClipboardData;

@@ -46,4 +47,5 @@ private doPasteOperation;

private copyDataToClipboard;
private copyDataToClipboardLegacy;
private executeOnTempElement;
private getRangeSize;
}

@@ -42,12 +42,28 @@ "use strict";

var allowNavigator = !this.gridOptionsWrapper.isSuppressClipboardApi();
if (allowNavigator && navigator.clipboard) {
// Some browsers (Firefox) do not allow Web Applications to read from
// the clipboard so verify if not only the ClipboardAPI is available,
// but also if the `readText` method is public.
if (allowNavigator && navigator.clipboard && navigator.clipboard.readText) {
navigator.clipboard.readText()
.then(this.processClipboardData.bind(this))
.catch(function () {
// no processing, if fails, do nothing, paste doesn't happen
.catch(function (e) {
core_1._.doOnce(function () {
console.warn(e);
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');
_this.pasteFromClipboardLegacy();
});
return;
}
else {
this.pasteFromClipboardLegacy();
}
};
ClipboardService.prototype.pasteFromClipboardLegacy = function () {
var _this = this;
// Method 2 - if modern API fails, the old school hack
this.executeOnTempElement(function (textArea) { return textArea.focus(); }, function (element) {
this.executeOnTempElement(function (textArea) { return textArea.focus({ preventScroll: true }); }, function (element) {
var data = element.value;

@@ -59,3 +75,3 @@ _this.processClipboardData(data);

var _this = this;
if (core_1._.missingOrEmpty(data)) {
if (data == null) {
return;

@@ -68,3 +84,3 @@ }

}
if (core_1._.missingOrEmpty(parsedData)) {
if (parsedData == null) {
return;

@@ -105,4 +121,2 @@ }

var updatedRowNodes = [];
var doc = this.gridOptionsWrapper.getDocument();
var focusedElementBefore = doc.activeElement;
var focusedCell = this.focusController.getFocusedCell();

@@ -116,7 +130,6 @@ pasteOperationFunc(cellsToFlash, updatedRowNodes, focusedCell, changedPath);

this.fireRowChanged(updatedRowNodes);
var focusedElementAfter = doc.activeElement;
// if using the clipboard hack with a temp element, then the focus has been lost,
// so need to put it back. otherwise paste operation loosed focus on cell and keyboard
// navigation stops.
if (focusedCell && focusedElementBefore != focusedElementAfter) {
if (focusedCell) {
this.focusController.setFocusedCell(focusedCell.rowIndex, focusedCell.column, focusedCell.rowPinned, true);

@@ -503,7 +516,19 @@ }

if (allowNavigator && navigator.clipboard) {
navigator.clipboard.writeText(data).catch(function () {
// no processing, if fails, do nothing, copy doesn't happen
navigator.clipboard.writeText(data).catch(function (e) {
core_1._.doOnce(function () {
console.warn(e);
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');
_this.copyDataToClipboardLegacy(data);
});
return;
}
this.copyDataToClipboardLegacy(data);
};
ClipboardService.prototype.copyDataToClipboardLegacy = function (data) {
var _this = this;
// method 3 - if all else fails, the old school hack

@@ -514,3 +539,3 @@ this.executeOnTempElement(function (element) {

element.select();
element.focus();
element.focus({ preventScroll: true });
var result = document.execCommand('copy');

@@ -523,3 +548,3 @@ if (!result) {

if (focusedElementBefore != null && focusedElementBefore.focus != null) {
focusedElementBefore.focus();
focusedElementBefore.focus({ preventScroll: true });
}

@@ -529,9 +554,13 @@ });

ClipboardService.prototype.executeOnTempElement = function (callbackNow, callbackAfter) {
var eTempInput = document.createElement('textarea');
var eDoc = this.gridOptionsWrapper.getDocument();
var eTempInput = eDoc.createElement('textarea');
eTempInput.style.width = '1px';
eTempInput.style.height = '1px';
eTempInput.style.top = '0px';
eTempInput.style.left = '0px';
// removing items from the DOM causes the document element to scroll to the
// position where the element was positioned. Here we set scrollTop / scrollLeft
// to prevent the document element from scrolling when we remove it from the DOM.
eTempInput.style.top = eDoc.documentElement.scrollTop + 'px';
eTempInput.style.left = eDoc.documentElement.scrollLeft + 'px';
eTempInput.style.position = 'absolute';
eTempInput.style.opacity = '0.0';
eTempInput.style.opacity = '0';
var guiRoot = this.gridCore.getRootGui();

@@ -538,0 +567,0 @@ guiRoot.appendChild(eTempInput);

@@ -23,2 +23,3 @@ import { BeanStub, CellPositionUtils, Column, GridCore, IClipboardService, RowPositionUtils } from "@ag-grid-community/core";

pasteFromClipboard(): void;
private pasteFromClipboardLegacy;
private processClipboardData;

@@ -46,4 +47,5 @@ private doPasteOperation;

private copyDataToClipboard;
private copyDataToClipboardLegacy;
private executeOnTempElement;
private getRangeSize;
}

@@ -40,12 +40,28 @@ var __extends = (this && this.__extends) || (function () {

var allowNavigator = !this.gridOptionsWrapper.isSuppressClipboardApi();
if (allowNavigator && navigator.clipboard) {
// Some browsers (Firefox) do not allow Web Applications to read from
// the clipboard so verify if not only the ClipboardAPI is available,
// but also if the `readText` method is public.
if (allowNavigator && navigator.clipboard && navigator.clipboard.readText) {
navigator.clipboard.readText()
.then(this.processClipboardData.bind(this))
.catch(function () {
// no processing, if fails, do nothing, paste doesn't happen
.catch(function (e) {
_.doOnce(function () {
console.warn(e);
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');
_this.pasteFromClipboardLegacy();
});
return;
}
else {
this.pasteFromClipboardLegacy();
}
};
ClipboardService.prototype.pasteFromClipboardLegacy = function () {
var _this = this;
// Method 2 - if modern API fails, the old school hack
this.executeOnTempElement(function (textArea) { return textArea.focus(); }, function (element) {
this.executeOnTempElement(function (textArea) { return textArea.focus({ preventScroll: true }); }, function (element) {
var data = element.value;

@@ -57,3 +73,3 @@ _this.processClipboardData(data);

var _this = this;
if (_.missingOrEmpty(data)) {
if (data == null) {
return;

@@ -66,3 +82,3 @@ }

}
if (_.missingOrEmpty(parsedData)) {
if (parsedData == null) {
return;

@@ -103,4 +119,2 @@ }

var updatedRowNodes = [];
var doc = this.gridOptionsWrapper.getDocument();
var focusedElementBefore = doc.activeElement;
var focusedCell = this.focusController.getFocusedCell();

@@ -114,7 +128,6 @@ pasteOperationFunc(cellsToFlash, updatedRowNodes, focusedCell, changedPath);

this.fireRowChanged(updatedRowNodes);
var focusedElementAfter = doc.activeElement;
// if using the clipboard hack with a temp element, then the focus has been lost,
// so need to put it back. otherwise paste operation loosed focus on cell and keyboard
// navigation stops.
if (focusedCell && focusedElementBefore != focusedElementAfter) {
if (focusedCell) {
this.focusController.setFocusedCell(focusedCell.rowIndex, focusedCell.column, focusedCell.rowPinned, true);

@@ -501,7 +514,19 @@ }

if (allowNavigator && navigator.clipboard) {
navigator.clipboard.writeText(data).catch(function () {
// no processing, if fails, do nothing, copy doesn't happen
navigator.clipboard.writeText(data).catch(function (e) {
_.doOnce(function () {
console.warn(e);
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');
_this.copyDataToClipboardLegacy(data);
});
return;
}
this.copyDataToClipboardLegacy(data);
};
ClipboardService.prototype.copyDataToClipboardLegacy = function (data) {
var _this = this;
// method 3 - if all else fails, the old school hack

@@ -512,3 +537,3 @@ this.executeOnTempElement(function (element) {

element.select();
element.focus();
element.focus({ preventScroll: true });
var result = document.execCommand('copy');

@@ -521,3 +546,3 @@ if (!result) {

if (focusedElementBefore != null && focusedElementBefore.focus != null) {
focusedElementBefore.focus();
focusedElementBefore.focus({ preventScroll: true });
}

@@ -527,9 +552,13 @@ });

ClipboardService.prototype.executeOnTempElement = function (callbackNow, callbackAfter) {
var eTempInput = document.createElement('textarea');
var eDoc = this.gridOptionsWrapper.getDocument();
var eTempInput = eDoc.createElement('textarea');
eTempInput.style.width = '1px';
eTempInput.style.height = '1px';
eTempInput.style.top = '0px';
eTempInput.style.left = '0px';
// removing items from the DOM causes the document element to scroll to the
// position where the element was positioned. Here we set scrollTop / scrollLeft
// to prevent the document element from scrolling when we remove it from the DOM.
eTempInput.style.top = eDoc.documentElement.scrollTop + 'px';
eTempInput.style.left = eDoc.documentElement.scrollLeft + 'px';
eTempInput.style.position = 'absolute';
eTempInput.style.opacity = '0.0';
eTempInput.style.opacity = '0';
var guiRoot = this.gridCore.getRootGui();

@@ -536,0 +565,0 @@ guiRoot.appendChild(eTempInput);

{
"name": "@ag-grid-enterprise/clipboard",
"version": "25.0.1",
"version": "25.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": "~25.0.0",
"@ag-grid-community/csv-export": "~25.0.0",
"@ag-grid-enterprise/core": "~25.0.0"
"@ag-grid-community/core": "~25.1.0",
"@ag-grid-community/csv-export": "~25.1.0",
"@ag-grid-enterprise/core": "~25.1.0"
},

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

@@ -1,6 +0,5 @@

ag-Grid-Enterprise
AG Grid Enterprise
==============
This project contains ag-Grid-Enterprise features.
This project contains AG Grid Enterprise features.

@@ -24,3 +23,3 @@ See [www.ag-grid.com](http://www.ag-grid.com) for an overview and full documentation.

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 [Members Forum](https://ag-grid.com/forum/forumdisplay.php?fid=5).
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/).

@@ -27,0 +26,0 @@ To Sign Up:

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 too big to display

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

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

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc