canvas-datagrid 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1679,9 +1679,34 @@ export default function (self) {
1679
1679
  };
1680
1680
  self.cut = function (e) {
1681
1681
  self.copy(e);
1682
- self.forEachSelectedCell(function (data, index, colName) {
1683
- data[index][colName] = '';
1684
- });
1682
+ const schema = self.getSchema();
1683
+
1684
+ var affectedCells = [];
1685
+ for (const [rowIndex, row] of self.selections.entries()) {
1686
+ if (!row) continue;
1687
+
1688
+ const boundRowIndex = self.getBoundRowIndexFromViewRowIndex(rowIndex);
1689
+
1690
+ for (const columnIndex of row) {
1691
+ const boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(
1692
+ columnIndex,
1693
+ );
1694
+ const colName = schema[boundColumnIndex].name;
1695
+
1696
+ self.viewData[rowIndex][colName] = '';
1697
+
1698
+ affectedCells.push([
1699
+ rowIndex,
1700
+ columnIndex,
1701
+ boundRowIndex,
1702
+ boundColumnIndex,
1703
+ ]);
1704
+ }
1705
+ }
1706
+
1707
+ if (self.dispatchEvent('cut', { NativeEvent: e, cells: affectedCells })) {
1708
+ return;
1709
+ }
1685
1710
  };
1686
1711
  self.copy = function (e) {
1687
1712
  if (self.dispatchEvent('copy', { NativeEvent: e })) {
package/lib/intf.js CHANGED
@@ -801,6 +801,7 @@ export default function (self, ctor) {
801
801
  self.intf.clearPxColorAssertions = self.clearPxColorAssertions;
802
802
  self.intf.integerToAlpha = self.integerToAlpha;
803
803
  self.intf.copy = self.copy;
804
+ self.intf.cut = self.cut;
804
805
  self.intf.paste = self.paste;
805
806
  self.intf.setStyleProperty = self.setStyleProperty;
806
807
  Object.defineProperty(self.intf, 'defaults', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-datagrid",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Canvas based data grid web component. Capable of displaying millions of contiguous hierarchical rows and columns without paging or loading, on a single canvas element.",
5
5
  "main": "./dist/canvas-datagrid.js",
6
6
  "module": "./dist/canvas-datagrid.module.js",