@revolist/revogrid 3.3.0 → 3.3.2

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.
@@ -2576,7 +2576,7 @@ class ViewportService {
2576
2576
  * First we render vertical parts - pinned start, data, pinned end
2577
2577
  * Per each column we render data collections: headers, pinned top, center data, pinned bottom
2578
2578
  */
2579
- const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onScroll }) => {
2579
+ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onCancelEdit, onScroll }) => {
2580
2580
  const viewPortHtml = [];
2581
2581
  /** render viewports columns */
2582
2582
  for (let view of columns) {
@@ -2586,7 +2586,7 @@ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns,
2586
2586
  ];
2587
2587
  view.dataPorts.forEach((data, j) => {
2588
2588
  const key = view.prop.key + (j + 1);
2589
- const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onSetEdit: ({ detail }) => onEdit(detail) }),
2589
+ const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onCancelEdit: () => onCancelEdit(), onSetEdit: ({ detail }) => onEdit(detail) }),
2590
2590
  h("revogr-data", Object.assign({}, data, { [UUID]: data.uuid }, { key: key, readonly: readonly, range: range, rowClass: rowClass, rowSelectionStore: data.rowSelectionStore, slot: DATA_SLOT })),
2591
2591
  h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }),
2592
2592
  h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol })));
@@ -3147,7 +3147,8 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
3147
3147
  return;
3148
3148
  }
3149
3149
  await timeout();
3150
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
3150
+ const colGroup = rgCol.pin || 'rgCol';
3151
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
3151
3152
  }
3152
3153
  /**
3153
3154
  * Register new virtual node inside of grid
@@ -3518,10 +3519,12 @@ const RevoGridComponent = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
3518
3519
  const anyView = this.viewport.columns[0];
3519
3520
  views.push(h("revogr-row-headers", { height: contentHeight, resize: this.resize, dataPorts: anyView.dataPorts, headerProp: anyView.headerProp, uiid: anyView.prop[UUID], rowHeaderColumn: typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined, onScrollViewport: ({ detail: e }) => this.scrollingService.onScroll(e, 'headerRow'), onElementToScroll: ({ detail: e }) => this.scrollingService.registerElement(e, 'headerRow') }));
3520
3521
  }
3521
- views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onEdit: detail => {
3522
+ views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onCancelEdit: () => {
3523
+ this.selectionStoreConnector.setEdit(false);
3524
+ }, onEdit: detail => {
3522
3525
  const event = this.beforeeditstart.emit(detail);
3523
3526
  if (!event.defaultPrevented) {
3524
- this.selectionStoreConnector.setEdit(detail.isCancel ? false : detail.val);
3527
+ this.selectionStoreConnector.setEdit(detail.val);
3525
3528
  }
3526
3529
  }, registerElement: (e, k) => this.scrollingService.registerElement(e, k), onScroll: details => this.scrollingService.onScroll(details) }));
3527
3530
  return (h(Host, Object.assign({}, { [`${UUID}`]: this.uuid }), h(RevoViewPort, { viewports: this.viewportProvider.stores, dimensions: this.dimensionProvider.stores, orderRef: e => (this.orderService = e), registerElement: (e, k) => this.scrollingService.registerElement(e, k), nakedClick: () => this.viewport.clearEdit(), onScroll: details => this.scrollingService.onScroll(details) }, views), this.extraElements));
@@ -332,7 +332,11 @@ const Edit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
332
332
  this.closeEdit = createEvent(this, "closeEdit", 3);
333
333
  this.currentEditor = null;
334
334
  }
335
- /** Callback triggered on cell editor save */
335
+ /**
336
+ * Callback triggered on cell editor save
337
+ * Closes editor when called
338
+ * @param preventFocus - if true editor will not be closed and next cell will not be focused
339
+ */
336
340
  onSave(val, preventFocus) {
337
341
  if (this.editCell) {
338
342
  this.cellEdit.emit({
@@ -76,7 +76,7 @@ class KeyboardService {
76
76
  if (this.sv.selectionStoreService.edited) {
77
77
  switch (e.code) {
78
78
  case codesLetter.ESCAPE:
79
- this.sv.doEdit(undefined, true);
79
+ this.sv.cancelEdit();
80
80
  break;
81
81
  }
82
82
  return;
@@ -466,6 +466,7 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
466
466
  this.internalCellEdit = createEvent(this, "internalCellEdit", 7);
467
467
  this.internalFocusCell = createEvent(this, "internalFocusCell", 7);
468
468
  this.setEdit = createEvent(this, "setEdit", 3);
469
+ this.cancelEdit = createEvent(this, "cancelEdit", 7);
469
470
  this.setRange = createEvent(this, "setRange", 7);
470
471
  this.setTempRange = createEvent(this, "setTempRange", 7);
471
472
  this.focusCell = createEvent(this, "focusCell", 3);
@@ -528,7 +529,8 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
528
529
  this.keyboardService = new KeyboardService({
529
530
  selectionStoreService: this.selectionStoreService,
530
531
  selectionStore: s,
531
- doEdit: (v, c) => this.doEdit(v, c),
532
+ doEdit: (v) => this.doEdit(v),
533
+ cancelEdit: () => this.closeEdit(),
532
534
  clearCell: () => this.clearCell(),
533
535
  getData: () => this.getData(),
534
536
  internalPaste: () => this.internalPaste.emit()
@@ -628,17 +630,20 @@ const OverlaySelection = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
628
630
  this.autoFillService.selectionStart(e, data);
629
631
  }
630
632
  }
631
- doEdit(val = '', isCancel = false) {
633
+ doEdit(val = '') {
632
634
  var _a;
633
635
  if (this.canEdit()) {
634
636
  const editCell = this.selectionStore.get('focus');
635
637
  const data = this.columnService.getSaveData(editCell.y, editCell.x);
636
- (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { isCancel,
637
- val }));
638
+ (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
638
639
  }
639
640
  }
641
+ /**
642
+ * Close editor event triggered
643
+ * @param details - if requires focus next
644
+ */
640
645
  closeEdit(e) {
641
- this.doEdit(undefined, true);
646
+ this.cancelEdit.emit();
642
647
  if (e === null || e === void 0 ? void 0 : e.detail) {
643
648
  this.focusNext();
644
649
  }
@@ -24433,7 +24433,7 @@ class ViewportService {
24433
24433
  * First we render vertical parts - pinned start, data, pinned end
24434
24434
  * Per each column we render data collections: headers, pinned top, center data, pinned bottom
24435
24435
  */
24436
- const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onScroll }) => {
24436
+ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onCancelEdit, onScroll }) => {
24437
24437
  const viewPortHtml = [];
24438
24438
  /** render viewports columns */
24439
24439
  for (let view of columns) {
@@ -24443,7 +24443,7 @@ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns,
24443
24443
  ];
24444
24444
  view.dataPorts.forEach((data, j) => {
24445
24445
  const key = view.prop.key + (j + 1);
24446
- const dataView = (index.h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onSetEdit: ({ detail }) => onEdit(detail) }),
24446
+ const dataView = (index.h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onCancelEdit: () => onCancelEdit(), onSetEdit: ({ detail }) => onEdit(detail) }),
24447
24447
  index.h("revogr-data", Object.assign({}, data, { [UUID]: data.uuid }, { key: key, readonly: readonly, range: range, rowClass: rowClass, rowSelectionStore: data.rowSelectionStore, slot: DATA_SLOT })),
24448
24448
  index.h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }),
24449
24449
  index.h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol })));
@@ -25016,7 +25016,8 @@ const RevoGridComponent = class {
25016
25016
  return;
25017
25017
  }
25018
25018
  await timeout();
25019
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
25019
+ const colGroup = rgCol.pin || 'rgCol';
25020
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
25020
25021
  }
25021
25022
  /**
25022
25023
  * Register new virtual node inside of grid
@@ -25387,10 +25388,12 @@ const RevoGridComponent = class {
25387
25388
  const anyView = this.viewport.columns[0];
25388
25389
  views.push(index.h("revogr-row-headers", { height: contentHeight, resize: this.resize, dataPorts: anyView.dataPorts, headerProp: anyView.headerProp, uiid: anyView.prop[UUID], rowHeaderColumn: typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined, onScrollViewport: ({ detail: e }) => this.scrollingService.onScroll(e, 'headerRow'), onElementToScroll: ({ detail: e }) => this.scrollingService.registerElement(e, 'headerRow') }));
25389
25390
  }
25390
- views.push(index.h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onEdit: detail => {
25391
+ views.push(index.h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onCancelEdit: () => {
25392
+ this.selectionStoreConnector.setEdit(false);
25393
+ }, onEdit: detail => {
25391
25394
  const event = this.beforeeditstart.emit(detail);
25392
25395
  if (!event.defaultPrevented) {
25393
- this.selectionStoreConnector.setEdit(detail.isCancel ? false : detail.val);
25396
+ this.selectionStoreConnector.setEdit(detail.val);
25394
25397
  }
25395
25398
  }, registerElement: (e, k) => this.scrollingService.registerElement(e, k), onScroll: details => this.scrollingService.onScroll(details) }));
25396
25399
  return (index.h(index.Host, Object.assign({}, { [`${UUID}`]: this.uuid }), index.h(RevoViewPort, { viewports: this.viewportProvider.stores, dimensions: this.dimensionProvider.stores, orderRef: e => (this.orderService = e), registerElement: (e, k) => this.scrollingService.registerElement(e, k), nakedClick: () => this.viewport.clearEdit(), onScroll: details => this.scrollingService.onScroll(details) }, views), this.extraElements));
@@ -26086,7 +26089,11 @@ const Edit = class {
26086
26089
  this.closeEdit = index.createEvent(this, "closeEdit", 3);
26087
26090
  this.currentEditor = null;
26088
26091
  }
26089
- /** Callback triggered on cell editor save */
26092
+ /**
26093
+ * Callback triggered on cell editor save
26094
+ * Closes editor when called
26095
+ * @param preventFocus - if true editor will not be closed and next cell will not be focused
26096
+ */
26090
26097
  onSave(val, preventFocus) {
26091
26098
  if (this.editCell) {
26092
26099
  this.cellEdit.emit({
@@ -27028,7 +27035,7 @@ class KeyboardService {
27028
27035
  if (this.sv.selectionStoreService.edited) {
27029
27036
  switch (e.code) {
27030
27037
  case codesLetter.ESCAPE:
27031
- this.sv.doEdit(undefined, true);
27038
+ this.sv.cancelEdit();
27032
27039
  break;
27033
27040
  }
27034
27041
  return;
@@ -27417,6 +27424,7 @@ const OverlaySelection = class {
27417
27424
  this.internalCellEdit = index.createEvent(this, "internalCellEdit", 7);
27418
27425
  this.internalFocusCell = index.createEvent(this, "internalFocusCell", 7);
27419
27426
  this.setEdit = index.createEvent(this, "setEdit", 3);
27427
+ this.cancelEdit = index.createEvent(this, "cancelEdit", 7);
27420
27428
  this.setRange = index.createEvent(this, "setRange", 7);
27421
27429
  this.setTempRange = index.createEvent(this, "setTempRange", 7);
27422
27430
  this.focusCell = index.createEvent(this, "focusCell", 3);
@@ -27479,7 +27487,8 @@ const OverlaySelection = class {
27479
27487
  this.keyboardService = new KeyboardService({
27480
27488
  selectionStoreService: this.selectionStoreService,
27481
27489
  selectionStore: s,
27482
- doEdit: (v, c) => this.doEdit(v, c),
27490
+ doEdit: (v) => this.doEdit(v),
27491
+ cancelEdit: () => this.closeEdit(),
27483
27492
  clearCell: () => this.clearCell(),
27484
27493
  getData: () => this.getData(),
27485
27494
  internalPaste: () => this.internalPaste.emit()
@@ -27579,17 +27588,20 @@ const OverlaySelection = class {
27579
27588
  this.autoFillService.selectionStart(e, data);
27580
27589
  }
27581
27590
  }
27582
- doEdit(val = '', isCancel = false) {
27591
+ doEdit(val = '') {
27583
27592
  var _a;
27584
27593
  if (this.canEdit()) {
27585
27594
  const editCell = this.selectionStore.get('focus');
27586
27595
  const data = this.columnService.getSaveData(editCell.y, editCell.x);
27587
- (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { isCancel,
27588
- val }));
27596
+ (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
27589
27597
  }
27590
27598
  }
27599
+ /**
27600
+ * Close editor event triggered
27601
+ * @param details - if requires focus next
27602
+ */
27591
27603
  closeEdit(e) {
27592
- this.doEdit(undefined, true);
27604
+ this.cancelEdit.emit();
27593
27605
  if (e === null || e === void 0 ? void 0 : e.detail) {
27594
27606
  this.focusNext();
27595
27607
  }
@@ -29,7 +29,7 @@ export class KeyboardService {
29
29
  if (this.sv.selectionStoreService.edited) {
30
30
  switch (e.code) {
31
31
  case codesLetter.ESCAPE:
32
- this.sv.doEdit(undefined, true);
32
+ this.sv.cancelEdit();
33
33
  break;
34
34
  }
35
35
  return;
@@ -8,7 +8,11 @@ export class Edit {
8
8
  constructor() {
9
9
  this.currentEditor = null;
10
10
  }
11
- /** Callback triggered on cell editor save */
11
+ /**
12
+ * Callback triggered on cell editor save
13
+ * Closes editor when called
14
+ * @param preventFocus - if true editor will not be closed and next cell will not be focused
15
+ */
12
16
  onSave(val, preventFocus) {
13
17
  if (this.editCell) {
14
18
  this.cellEdit.emit({
@@ -150,7 +154,7 @@ export class Edit {
150
154
  "composed": true,
151
155
  "docs": {
152
156
  "tags": [],
153
- "text": "Close editor event"
157
+ "text": "Close editor event\npass true if requires focus next"
154
158
  },
155
159
  "complexType": {
156
160
  "original": "boolean | undefined",
@@ -71,7 +71,8 @@ export class OverlaySelection {
71
71
  this.keyboardService = new KeyboardService({
72
72
  selectionStoreService: this.selectionStoreService,
73
73
  selectionStore: s,
74
- doEdit: (v, c) => this.doEdit(v, c),
74
+ doEdit: (v) => this.doEdit(v),
75
+ cancelEdit: () => this.closeEdit(),
75
76
  clearCell: () => this.clearCell(),
76
77
  getData: () => this.getData(),
77
78
  internalPaste: () => this.internalPaste.emit()
@@ -173,17 +174,20 @@ export class OverlaySelection {
173
174
  this.autoFillService.selectionStart(e, data);
174
175
  }
175
176
  }
176
- doEdit(val = '', isCancel = false) {
177
+ doEdit(val = '') {
177
178
  var _a;
178
179
  if (this.canEdit()) {
179
180
  const editCell = this.selectionStore.get('focus');
180
181
  const data = this.columnService.getSaveData(editCell.y, editCell.x);
181
- (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { isCancel,
182
- val }));
182
+ (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
183
183
  }
184
184
  }
185
+ /**
186
+ * Close editor event triggered
187
+ * @param details - if requires focus next
188
+ */
185
189
  closeEdit(e) {
186
- this.doEdit(undefined, true);
190
+ this.cancelEdit.emit();
187
191
  if (e === null || e === void 0 ? void 0 : e.detail) {
188
192
  this.focusNext();
189
193
  }
@@ -563,7 +567,7 @@ export class OverlaySelection {
563
567
  },
564
568
  "complexType": {
565
569
  "original": "Edition.BeforeEdit",
566
- "resolved": "{ isCancel: boolean; } & BeforeSaveDataDetails",
570
+ "resolved": "{ prop: ColumnProp; model: DataType; val?: string; rowIndex: number; type: DimensionRows; }",
567
571
  "references": {
568
572
  "Edition": {
569
573
  "location": "import",
@@ -571,6 +575,21 @@ export class OverlaySelection {
571
575
  }
572
576
  }
573
577
  }
578
+ }, {
579
+ "method": "cancelEdit",
580
+ "name": "cancelEdit",
581
+ "bubbles": true,
582
+ "cancelable": true,
583
+ "composed": true,
584
+ "docs": {
585
+ "tags": [],
586
+ "text": "Used for editors support when close requested"
587
+ },
588
+ "complexType": {
589
+ "original": "any",
590
+ "resolved": "any",
591
+ "references": {}
592
+ }
574
593
  }, {
575
594
  "method": "setRange",
576
595
  "name": "setRange",
@@ -203,7 +203,8 @@ export class RevoGridComponent {
203
203
  return;
204
204
  }
205
205
  await timeout();
206
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
206
+ const colGroup = rgCol.pin || 'rgCol';
207
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
207
208
  }
208
209
  /**
209
210
  * Register new virtual node inside of grid
@@ -574,10 +575,12 @@ export class RevoGridComponent {
574
575
  const anyView = this.viewport.columns[0];
575
576
  views.push(h("revogr-row-headers", { height: contentHeight, resize: this.resize, dataPorts: anyView.dataPorts, headerProp: anyView.headerProp, uiid: anyView.prop[UUID], rowHeaderColumn: typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined, onScrollViewport: ({ detail: e }) => this.scrollingService.onScroll(e, 'headerRow'), onElementToScroll: ({ detail: e }) => this.scrollingService.registerElement(e, 'headerRow') }));
576
577
  }
577
- views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onEdit: detail => {
578
+ views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onCancelEdit: () => {
579
+ this.selectionStoreConnector.setEdit(false);
580
+ }, onEdit: detail => {
578
581
  const event = this.beforeeditstart.emit(detail);
579
582
  if (!event.defaultPrevented) {
580
- this.selectionStoreConnector.setEdit(detail.isCancel ? false : detail.val);
583
+ this.selectionStoreConnector.setEdit(detail.val);
581
584
  }
582
585
  }, registerElement: (e, k) => this.scrollingService.registerElement(e, k), onScroll: details => this.scrollingService.onScroll(details) }));
583
586
  return (h(Host, Object.assign({}, { [`${UUID}`]: this.uuid }),
@@ -9,7 +9,7 @@ import { DATA_SLOT, HEADER_SLOT } from './viewport.helpers';
9
9
  * First we render vertical parts - pinned start, data, pinned end
10
10
  * Per each column we render data collections: headers, pinned top, center data, pinned bottom
11
11
  */
12
- export const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onScroll }) => {
12
+ export const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onCancelEdit, onScroll }) => {
13
13
  const viewPortHtml = [];
14
14
  /** render viewports columns */
15
15
  for (let view of columns) {
@@ -19,7 +19,7 @@ export const ViewPortSections = ({ resize, editors, rowClass, readonly, range, c
19
19
  ];
20
20
  view.dataPorts.forEach((data, j) => {
21
21
  const key = view.prop.key + (j + 1);
22
- const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onSetEdit: ({ detail }) => onEdit(detail) }),
22
+ const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onCancelEdit: () => onCancelEdit(), onSetEdit: ({ detail }) => onEdit(detail) }),
23
23
  h("revogr-data", Object.assign({}, data, { [UUID]: data.uuid }, { key: key, readonly: readonly, range: range, rowClass: rowClass, rowSelectionStore: data.rowSelectionStore, slot: DATA_SLOT })),
24
24
  h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }),
25
25
  h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol })));
@@ -24429,7 +24429,7 @@ class ViewportService {
24429
24429
  * First we render vertical parts - pinned start, data, pinned end
24430
24430
  * Per each column we render data collections: headers, pinned top, center data, pinned bottom
24431
24431
  */
24432
- const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onScroll }) => {
24432
+ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns, useClipboard, columnFilter, registerElement, onEdit, onCancelEdit, onScroll }) => {
24433
24433
  const viewPortHtml = [];
24434
24434
  /** render viewports columns */
24435
24435
  for (let view of columns) {
@@ -24439,7 +24439,7 @@ const ViewPortSections = ({ resize, editors, rowClass, readonly, range, columns,
24439
24439
  ];
24440
24440
  view.dataPorts.forEach((data, j) => {
24441
24441
  const key = view.prop.key + (j + 1);
24442
- const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onSetEdit: ({ detail }) => onEdit(detail) }),
24442
+ const dataView = (h("revogr-overlay-selection", Object.assign({}, data, { slot: data.slot, selectionStore: data.segmentSelectionStore, editors: editors, readonly: readonly, range: range, useClipboard: useClipboard, onCancelEdit: () => onCancelEdit(), onSetEdit: ({ detail }) => onEdit(detail) }),
24443
24443
  h("revogr-data", Object.assign({}, data, { [UUID]: data.uuid }, { key: key, readonly: readonly, range: range, rowClass: rowClass, rowSelectionStore: data.rowSelectionStore, slot: DATA_SLOT })),
24444
24444
  h("revogr-temp-range", { selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol }),
24445
24445
  h("revogr-focus", { colData: data.colData, dataStore: data.dataStore, selectionStore: data.segmentSelectionStore, dimensionRow: data.dimensionRow, dimensionCol: data.dimensionCol })));
@@ -25012,7 +25012,8 @@ const RevoGridComponent = class {
25012
25012
  return;
25013
25013
  }
25014
25014
  await timeout();
25015
- (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, 'rgCol'), rgCol.pin || 'rgCol', rowSource);
25015
+ const colGroup = rgCol.pin || 'rgCol';
25016
+ (_a = this.viewport) === null || _a === void 0 ? void 0 : _a.setEdit(rgRow, this.columnProvider.getColumnIndexByProp(prop, colGroup), colGroup, rowSource);
25016
25017
  }
25017
25018
  /**
25018
25019
  * Register new virtual node inside of grid
@@ -25383,10 +25384,12 @@ const RevoGridComponent = class {
25383
25384
  const anyView = this.viewport.columns[0];
25384
25385
  views.push(h("revogr-row-headers", { height: contentHeight, resize: this.resize, dataPorts: anyView.dataPorts, headerProp: anyView.headerProp, uiid: anyView.prop[UUID], rowHeaderColumn: typeof this.rowHeaders === 'object' ? this.rowHeaders : undefined, onScrollViewport: ({ detail: e }) => this.scrollingService.onScroll(e, 'headerRow'), onElementToScroll: ({ detail: e }) => this.scrollingService.registerElement(e, 'headerRow') }));
25385
25386
  }
25386
- views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onEdit: detail => {
25387
+ views.push(h(ViewPortSections, { columnFilter: !!this.filter, resize: this.resize, readonly: this.readonly, range: this.range, rowClass: this.rowClass, editors: this.editors, useClipboard: this.useClipboard, columns: this.viewport.columns, onCancelEdit: () => {
25388
+ this.selectionStoreConnector.setEdit(false);
25389
+ }, onEdit: detail => {
25387
25390
  const event = this.beforeeditstart.emit(detail);
25388
25391
  if (!event.defaultPrevented) {
25389
- this.selectionStoreConnector.setEdit(detail.isCancel ? false : detail.val);
25392
+ this.selectionStoreConnector.setEdit(detail.val);
25390
25393
  }
25391
25394
  }, registerElement: (e, k) => this.scrollingService.registerElement(e, k), onScroll: details => this.scrollingService.onScroll(details) }));
25392
25395
  return (h(Host, Object.assign({}, { [`${UUID}`]: this.uuid }), h(RevoViewPort, { viewports: this.viewportProvider.stores, dimensions: this.dimensionProvider.stores, orderRef: e => (this.orderService = e), registerElement: (e, k) => this.scrollingService.registerElement(e, k), nakedClick: () => this.viewport.clearEdit(), onScroll: details => this.scrollingService.onScroll(details) }, views), this.extraElements));
@@ -26082,7 +26085,11 @@ const Edit = class {
26082
26085
  this.closeEdit = createEvent(this, "closeEdit", 3);
26083
26086
  this.currentEditor = null;
26084
26087
  }
26085
- /** Callback triggered on cell editor save */
26088
+ /**
26089
+ * Callback triggered on cell editor save
26090
+ * Closes editor when called
26091
+ * @param preventFocus - if true editor will not be closed and next cell will not be focused
26092
+ */
26086
26093
  onSave(val, preventFocus) {
26087
26094
  if (this.editCell) {
26088
26095
  this.cellEdit.emit({
@@ -27024,7 +27031,7 @@ class KeyboardService {
27024
27031
  if (this.sv.selectionStoreService.edited) {
27025
27032
  switch (e.code) {
27026
27033
  case codesLetter.ESCAPE:
27027
- this.sv.doEdit(undefined, true);
27034
+ this.sv.cancelEdit();
27028
27035
  break;
27029
27036
  }
27030
27037
  return;
@@ -27413,6 +27420,7 @@ const OverlaySelection = class {
27413
27420
  this.internalCellEdit = createEvent(this, "internalCellEdit", 7);
27414
27421
  this.internalFocusCell = createEvent(this, "internalFocusCell", 7);
27415
27422
  this.setEdit = createEvent(this, "setEdit", 3);
27423
+ this.cancelEdit = createEvent(this, "cancelEdit", 7);
27416
27424
  this.setRange = createEvent(this, "setRange", 7);
27417
27425
  this.setTempRange = createEvent(this, "setTempRange", 7);
27418
27426
  this.focusCell = createEvent(this, "focusCell", 3);
@@ -27475,7 +27483,8 @@ const OverlaySelection = class {
27475
27483
  this.keyboardService = new KeyboardService({
27476
27484
  selectionStoreService: this.selectionStoreService,
27477
27485
  selectionStore: s,
27478
- doEdit: (v, c) => this.doEdit(v, c),
27486
+ doEdit: (v) => this.doEdit(v),
27487
+ cancelEdit: () => this.closeEdit(),
27479
27488
  clearCell: () => this.clearCell(),
27480
27489
  getData: () => this.getData(),
27481
27490
  internalPaste: () => this.internalPaste.emit()
@@ -27575,17 +27584,20 @@ const OverlaySelection = class {
27575
27584
  this.autoFillService.selectionStart(e, data);
27576
27585
  }
27577
27586
  }
27578
- doEdit(val = '', isCancel = false) {
27587
+ doEdit(val = '') {
27579
27588
  var _a;
27580
27589
  if (this.canEdit()) {
27581
27590
  const editCell = this.selectionStore.get('focus');
27582
27591
  const data = this.columnService.getSaveData(editCell.y, editCell.x);
27583
- (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { isCancel,
27584
- val }));
27592
+ (_a = this.setEdit) === null || _a === void 0 ? void 0 : _a.emit(Object.assign(Object.assign({}, data), { val }));
27585
27593
  }
27586
27594
  }
27595
+ /**
27596
+ * Close editor event triggered
27597
+ * @param details - if requires focus next
27598
+ */
27587
27599
  closeEdit(e) {
27588
- this.doEdit(undefined, true);
27600
+ this.cancelEdit.emit();
27589
27601
  if (e === null || e === void 0 ? void 0 : e.detail) {
27590
27602
  this.focusNext();
27591
27603
  }