@revolist/revogrid 3.7.5 → 3.7.7

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.
@@ -615,10 +615,12 @@ class ColumnService {
615
615
  const copyColLength = d.oldProps.length;
616
616
  const copyFrom = this.copyRangeArray(d.oldRange, d.oldProps, this.dataStore);
617
617
  const copyRowLength = copyFrom.length;
618
+ const mapping = {};
618
619
  // rows
619
620
  for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
620
621
  // copy original data link
621
622
  const copyRow = copyFrom[i % copyRowLength];
623
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
622
624
  // columns
623
625
  for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
624
626
  // check if old range area
@@ -626,6 +628,8 @@ class ColumnService {
626
628
  continue;
627
629
  }
628
630
  const p = this.columns[colIndex].prop;
631
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
632
+ const copyColumnProp = this.columns[copyColIndex].prop;
629
633
  const currentCol = j % copyColLength;
630
634
  /** if can write */
631
635
  if (!this.isReadOnly(rowIndex, colIndex)) {
@@ -634,10 +638,22 @@ class ColumnService {
634
638
  changed[rowIndex] = {};
635
639
  }
636
640
  changed[rowIndex][p] = copyRow[currentCol];
641
+ /** Generate mapping object */
642
+ if (!mapping[rowIndex]) {
643
+ mapping[rowIndex] = {};
644
+ }
645
+ mapping[rowIndex][p] = {
646
+ colIndex: copyColIndex,
647
+ colProp: copyColumnProp,
648
+ rowIndex: oldRowIndex,
649
+ };
637
650
  }
638
651
  }
639
652
  }
640
- return changed;
653
+ return {
654
+ changed,
655
+ mapping,
656
+ };
641
657
  }
642
658
  getTransformedDataToApply(start, data) {
643
659
  const changed = {};
@@ -396,8 +396,11 @@ class AutoFillService {
396
396
  oldRange,
397
397
  newProps: slice_1(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
398
398
  oldProps: slice_1(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
399
+ mapping: {},
399
400
  };
400
- rangeData.newData = this.sv.columnService.getRangeData(rangeData);
401
+ const changesOnRange = this.sv.columnService.getRangeData(rangeData);
402
+ rangeData.newData = changesOnRange.changed;
403
+ rangeData.mapping = changesOnRange.mapping;
401
404
  const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
402
405
  if (selectionEndEvent.defaultPrevented) {
403
406
  this.sv.setTempRange(null);
@@ -471,6 +474,7 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
471
474
  this.focusCell = createEvent(this, "focusCell", 3);
472
475
  this.internalSelectionChanged = createEvent(this, "internalSelectionChanged", 7);
473
476
  this.internalRangeDataApply = createEvent(this, "internalRangeDataApply", 7);
477
+ this.beforeKeyDown = createEvent(this, "beforekeydown", 7);
474
478
  this.keyboardService = null;
475
479
  this.autoFillService = null;
476
480
  this.clipboardService = null;
@@ -508,7 +512,9 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
508
512
  /** Recived keyboard down from element */
509
513
  onKeyDown(e) {
510
514
  var _a;
511
- if (e.defaultPrevented) {
515
+ // Emit before key down event and check if default prevention is set.
516
+ const proxy = this.beforeKeyDown.emit(Object.assign(Object.assign({}, e), this.getData()));
517
+ if (e.defaultPrevented || proxy.defaultPrevented) {
512
518
  return;
513
519
  }
514
520
  (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
@@ -710,6 +716,9 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
710
716
  rows: this.dimensionRow.state,
711
717
  cols: this.dimensionCol.state,
712
718
  lastCell: this.lastCell,
719
+ focus: this.selectionStore.get('focus'),
720
+ range: this.selectionStore.get('range'),
721
+ edit: this.selectionStore.get('edit'),
713
722
  };
714
723
  }
715
724
  get element() { return this; }
@@ -25671,10 +25671,12 @@ class ColumnService {
25671
25671
  const copyColLength = d.oldProps.length;
25672
25672
  const copyFrom = this.copyRangeArray(d.oldRange, d.oldProps, this.dataStore);
25673
25673
  const copyRowLength = copyFrom.length;
25674
+ const mapping = {};
25674
25675
  // rows
25675
25676
  for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
25676
25677
  // copy original data link
25677
25678
  const copyRow = copyFrom[i % copyRowLength];
25679
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
25678
25680
  // columns
25679
25681
  for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
25680
25682
  // check if old range area
@@ -25682,6 +25684,8 @@ class ColumnService {
25682
25684
  continue;
25683
25685
  }
25684
25686
  const p = this.columns[colIndex].prop;
25687
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
25688
+ const copyColumnProp = this.columns[copyColIndex].prop;
25685
25689
  const currentCol = j % copyColLength;
25686
25690
  /** if can write */
25687
25691
  if (!this.isReadOnly(rowIndex, colIndex)) {
@@ -25690,10 +25694,22 @@ class ColumnService {
25690
25694
  changed[rowIndex] = {};
25691
25695
  }
25692
25696
  changed[rowIndex][p] = copyRow[currentCol];
25697
+ /** Generate mapping object */
25698
+ if (!mapping[rowIndex]) {
25699
+ mapping[rowIndex] = {};
25700
+ }
25701
+ mapping[rowIndex][p] = {
25702
+ colIndex: copyColIndex,
25703
+ colProp: copyColumnProp,
25704
+ rowIndex: oldRowIndex,
25705
+ };
25693
25706
  }
25694
25707
  }
25695
25708
  }
25696
- return changed;
25709
+ return {
25710
+ changed,
25711
+ mapping,
25712
+ };
25697
25713
  }
25698
25714
  getTransformedDataToApply(start, data) {
25699
25715
  const changed = {};
@@ -27473,8 +27489,11 @@ class AutoFillService {
27473
27489
  oldRange,
27474
27490
  newProps: slice_1(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
27475
27491
  oldProps: slice_1(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
27492
+ mapping: {},
27476
27493
  };
27477
- rangeData.newData = this.sv.columnService.getRangeData(rangeData);
27494
+ const changesOnRange = this.sv.columnService.getRangeData(rangeData);
27495
+ rangeData.newData = changesOnRange.changed;
27496
+ rangeData.mapping = changesOnRange.mapping;
27478
27497
  const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
27479
27498
  if (selectionEndEvent.defaultPrevented) {
27480
27499
  this.sv.setTempRange(null);
@@ -27547,6 +27566,7 @@ const OverlaySelection = class {
27547
27566
  this.focusCell = index.createEvent(this, "focusCell", 3);
27548
27567
  this.internalSelectionChanged = index.createEvent(this, "internalSelectionChanged", 7);
27549
27568
  this.internalRangeDataApply = index.createEvent(this, "internalRangeDataApply", 7);
27569
+ this.beforeKeyDown = index.createEvent(this, "beforekeydown", 7);
27550
27570
  this.keyboardService = null;
27551
27571
  this.autoFillService = null;
27552
27572
  this.clipboardService = null;
@@ -27584,7 +27604,9 @@ const OverlaySelection = class {
27584
27604
  /** Recived keyboard down from element */
27585
27605
  onKeyDown(e) {
27586
27606
  var _a;
27587
- if (e.defaultPrevented) {
27607
+ // Emit before key down event and check if default prevention is set.
27608
+ const proxy = this.beforeKeyDown.emit(Object.assign(Object.assign({}, e), this.getData()));
27609
+ if (e.defaultPrevented || proxy.defaultPrevented) {
27588
27610
  return;
27589
27611
  }
27590
27612
  (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
@@ -27786,6 +27808,9 @@ const OverlaySelection = class {
27786
27808
  rows: this.dimensionRow.state,
27787
27809
  cols: this.dimensionCol.state,
27788
27810
  lastCell: this.lastCell,
27811
+ focus: this.selectionStore.get('focus'),
27812
+ range: this.selectionStore.get('range'),
27813
+ edit: this.selectionStore.get('edit'),
27789
27814
  };
27790
27815
  }
27791
27816
  get element() { return index.getElement(this); }
@@ -132,10 +132,12 @@ export default class ColumnService {
132
132
  const copyColLength = d.oldProps.length;
133
133
  const copyFrom = this.copyRangeArray(d.oldRange, d.oldProps, this.dataStore);
134
134
  const copyRowLength = copyFrom.length;
135
+ const mapping = {};
135
136
  // rows
136
137
  for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
137
138
  // copy original data link
138
139
  const copyRow = copyFrom[i % copyRowLength];
140
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
139
141
  // columns
140
142
  for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
141
143
  // check if old range area
@@ -143,6 +145,8 @@ export default class ColumnService {
143
145
  continue;
144
146
  }
145
147
  const p = this.columns[colIndex].prop;
148
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
149
+ const copyColumnProp = this.columns[copyColIndex].prop;
146
150
  const currentCol = j % copyColLength;
147
151
  /** if can write */
148
152
  if (!this.isReadOnly(rowIndex, colIndex)) {
@@ -151,10 +155,22 @@ export default class ColumnService {
151
155
  changed[rowIndex] = {};
152
156
  }
153
157
  changed[rowIndex][p] = copyRow[currentCol];
158
+ /** Generate mapping object */
159
+ if (!mapping[rowIndex]) {
160
+ mapping[rowIndex] = {};
161
+ }
162
+ mapping[rowIndex][p] = {
163
+ colIndex: copyColIndex,
164
+ colProp: copyColumnProp,
165
+ rowIndex: oldRowIndex,
166
+ };
154
167
  }
155
168
  }
156
169
  }
157
- return changed;
170
+ return {
171
+ changed,
172
+ mapping,
173
+ };
158
174
  }
159
175
  getTransformedDataToApply(start, data) {
160
176
  const changed = {};
@@ -156,8 +156,11 @@ export class AutoFillService {
156
156
  oldRange,
157
157
  newProps: slice(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
158
158
  oldProps: slice(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
159
+ mapping: {},
159
160
  };
160
- rangeData.newData = this.sv.columnService.getRangeData(rangeData);
161
+ const changesOnRange = this.sv.columnService.getRangeData(rangeData);
162
+ rangeData.newData = changesOnRange.changed;
163
+ rangeData.mapping = changesOnRange.mapping;
161
164
  const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
162
165
  if (selectionEndEvent.defaultPrevented) {
163
166
  this.sv.setTempRange(null);
@@ -51,7 +51,9 @@ export class OverlaySelection {
51
51
  /** Recived keyboard down from element */
52
52
  onKeyDown(e) {
53
53
  var _a;
54
- if (e.defaultPrevented) {
54
+ // Emit before key down event and check if default prevention is set.
55
+ const proxy = this.beforeKeyDown.emit(Object.assign(Object.assign({}, e), this.getData()));
56
+ if (e.defaultPrevented || proxy.defaultPrevented) {
55
57
  return;
56
58
  }
57
59
  (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
@@ -255,6 +257,9 @@ export class OverlaySelection {
255
257
  rows: this.dimensionRow.state,
256
258
  cols: this.dimensionCol.state,
257
259
  lastCell: this.lastCell,
260
+ focus: this.selectionStore.get('focus'),
261
+ range: this.selectionStore.get('range'),
262
+ edit: this.selectionStore.get('edit'),
258
263
  };
259
264
  }
260
265
  static get is() { return "revogr-overlay-selection"; }
@@ -699,7 +704,7 @@ export class OverlaySelection {
699
704
  },
700
705
  "complexType": {
701
706
  "original": "Selection.ChangedRange",
702
- "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; }",
707
+ "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; mapping: OldNewRangeMapping; }",
703
708
  "references": {
704
709
  "Selection": {
705
710
  "location": "import",
@@ -727,6 +732,21 @@ export class OverlaySelection {
727
732
  }
728
733
  }
729
734
  }
735
+ }, {
736
+ "method": "beforeKeyDown",
737
+ "name": "beforekeydown",
738
+ "bubbles": true,
739
+ "cancelable": true,
740
+ "composed": true,
741
+ "docs": {
742
+ "tags": [],
743
+ "text": "Before key up event proxy, used to prevent key up trigger.\nIf you have some custom behaviour event, use this event to check if it wasn't processed by internal logic.\nCall preventDefault()."
744
+ },
745
+ "complexType": {
746
+ "original": "any",
747
+ "resolved": "any",
748
+ "references": {}
749
+ }
730
750
  }]; }
731
751
  static get elementRef() { return "element"; }
732
752
  static get watchers() { return [{
@@ -1190,7 +1190,7 @@ export class RevoGridComponent {
1190
1190
  },
1191
1191
  "complexType": {
1192
1192
  "original": "Selection.ChangedRange",
1193
- "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; }",
1193
+ "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; mapping: OldNewRangeMapping; }",
1194
1194
  "references": {
1195
1195
  "Selection": {
1196
1196
  "location": "import",
@@ -1210,7 +1210,7 @@ export class RevoGridComponent {
1210
1210
  },
1211
1211
  "complexType": {
1212
1212
  "original": "Selection.ChangedRange",
1213
- "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; }",
1213
+ "resolved": "{ type: DimensionRows; newRange: RangeArea; oldRange: RangeArea; newProps: ColumnProp[]; oldProps: ColumnProp[]; newData: { [key: number]: DataType; }; mapping: OldNewRangeMapping; }",
1214
1214
  "references": {
1215
1215
  "Selection": {
1216
1216
  "location": "import",
@@ -25667,10 +25667,12 @@ class ColumnService {
25667
25667
  const copyColLength = d.oldProps.length;
25668
25668
  const copyFrom = this.copyRangeArray(d.oldRange, d.oldProps, this.dataStore);
25669
25669
  const copyRowLength = copyFrom.length;
25670
+ const mapping = {};
25670
25671
  // rows
25671
25672
  for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
25672
25673
  // copy original data link
25673
25674
  const copyRow = copyFrom[i % copyRowLength];
25675
+ const oldRowIndex = d.oldRange.y + (i % copyRowLength);
25674
25676
  // columns
25675
25677
  for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
25676
25678
  // check if old range area
@@ -25678,6 +25680,8 @@ class ColumnService {
25678
25680
  continue;
25679
25681
  }
25680
25682
  const p = this.columns[colIndex].prop;
25683
+ const copyColIndex = d.oldRange.x + (j % copyColLength);
25684
+ const copyColumnProp = this.columns[copyColIndex].prop;
25681
25685
  const currentCol = j % copyColLength;
25682
25686
  /** if can write */
25683
25687
  if (!this.isReadOnly(rowIndex, colIndex)) {
@@ -25686,10 +25690,22 @@ class ColumnService {
25686
25690
  changed[rowIndex] = {};
25687
25691
  }
25688
25692
  changed[rowIndex][p] = copyRow[currentCol];
25693
+ /** Generate mapping object */
25694
+ if (!mapping[rowIndex]) {
25695
+ mapping[rowIndex] = {};
25696
+ }
25697
+ mapping[rowIndex][p] = {
25698
+ colIndex: copyColIndex,
25699
+ colProp: copyColumnProp,
25700
+ rowIndex: oldRowIndex,
25701
+ };
25689
25702
  }
25690
25703
  }
25691
25704
  }
25692
- return changed;
25705
+ return {
25706
+ changed,
25707
+ mapping,
25708
+ };
25693
25709
  }
25694
25710
  getTransformedDataToApply(start, data) {
25695
25711
  const changed = {};
@@ -27469,8 +27485,11 @@ class AutoFillService {
27469
27485
  oldRange,
27470
27486
  newProps: slice_1(columns, newRange.x, newRange.x1 + 1).map(v => v.prop),
27471
27487
  oldProps: slice_1(columns, oldRange.x, oldRange.x1 + 1).map(v => v.prop),
27488
+ mapping: {},
27472
27489
  };
27473
- rangeData.newData = this.sv.columnService.getRangeData(rangeData);
27490
+ const changesOnRange = this.sv.columnService.getRangeData(rangeData);
27491
+ rangeData.newData = changesOnRange.changed;
27492
+ rangeData.mapping = changesOnRange.mapping;
27474
27493
  const selectionEndEvent = this.sv.internalSelectionChanged(rangeData);
27475
27494
  if (selectionEndEvent.defaultPrevented) {
27476
27495
  this.sv.setTempRange(null);
@@ -27543,6 +27562,7 @@ const OverlaySelection = class {
27543
27562
  this.focusCell = createEvent(this, "focusCell", 3);
27544
27563
  this.internalSelectionChanged = createEvent(this, "internalSelectionChanged", 7);
27545
27564
  this.internalRangeDataApply = createEvent(this, "internalRangeDataApply", 7);
27565
+ this.beforeKeyDown = createEvent(this, "beforekeydown", 7);
27546
27566
  this.keyboardService = null;
27547
27567
  this.autoFillService = null;
27548
27568
  this.clipboardService = null;
@@ -27580,7 +27600,9 @@ const OverlaySelection = class {
27580
27600
  /** Recived keyboard down from element */
27581
27601
  onKeyDown(e) {
27582
27602
  var _a;
27583
- if (e.defaultPrevented) {
27603
+ // Emit before key down event and check if default prevention is set.
27604
+ const proxy = this.beforeKeyDown.emit(Object.assign(Object.assign({}, e), this.getData()));
27605
+ if (e.defaultPrevented || proxy.defaultPrevented) {
27584
27606
  return;
27585
27607
  }
27586
27608
  (_a = this.keyboardService) === null || _a === void 0 ? void 0 : _a.keyDown(e, this.range);
@@ -27782,6 +27804,9 @@ const OverlaySelection = class {
27782
27804
  rows: this.dimensionRow.state,
27783
27805
  cols: this.dimensionCol.state,
27784
27806
  lastCell: this.lastCell,
27807
+ focus: this.selectionStore.get('focus'),
27808
+ range: this.selectionStore.get('range'),
27809
+ edit: this.selectionStore.get('edit'),
27785
27810
  };
27786
27811
  }
27787
27812
  get element() { return getElement(this); }