@revolist/revogrid 4.23.17 → 4.23.20

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.
Files changed (39) hide show
  1. package/dist/cjs/revo-grid.cjs.entry.js +5 -2
  2. package/dist/cjs/revogr-attribution_7.cjs.entry.js +10 -10
  3. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +8 -8
  4. package/dist/cjs/revogr-data_4.cjs.entry.js +2 -1
  5. package/dist/cjs/revogr-filter-panel.cjs.entry.js +33 -9
  6. package/dist/cjs/{throttle-BCwEuJJq.js → throttle-fV6BUmM7.js} +4 -0
  7. package/dist/collection/components/order/order-row.service.js +8 -8
  8. package/dist/collection/components/overlay/revogr-overlay-selection.js +9 -9
  9. package/dist/collection/components/scroll/revogr-viewport-scroll.js +1 -0
  10. package/dist/collection/plugins/filter/filter.panel.js +33 -9
  11. package/dist/collection/services/data.provider.js +5 -2
  12. package/dist/collection/services/local.scroll.timer.js +4 -0
  13. package/dist/esm/revo-grid.entry.js +5 -2
  14. package/dist/esm/revogr-attribution_7.entry.js +10 -10
  15. package/dist/esm/revogr-clipboard_3.entry.js +8 -8
  16. package/dist/esm/revogr-data_4.entry.js +2 -1
  17. package/dist/esm/revogr-filter-panel.entry.js +34 -10
  18. package/dist/esm/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
  19. package/dist/revo-grid/revo-grid.entry.js +5 -2
  20. package/dist/revo-grid/revogr-attribution_7.entry.js +10 -10
  21. package/dist/revo-grid/revogr-clipboard_3.entry.js +8 -8
  22. package/dist/revo-grid/revogr-data_4.entry.js +2 -1
  23. package/dist/revo-grid/revogr-filter-panel.entry.js +34 -10
  24. package/dist/revo-grid/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
  25. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +1 -1
  26. package/dist/types/plugins/filter/filter.button.d.ts +1 -1
  27. package/dist/types/plugins/filter/filter.panel.d.ts +3 -0
  28. package/dist/types/services/local.scroll.timer.d.ts +4 -0
  29. package/dist/types/types/interfaces.d.ts +4 -0
  30. package/dist/types/types/selection.d.ts +4 -0
  31. package/hydrate/index.js +60 -28
  32. package/hydrate/index.mjs +60 -28
  33. package/package.json +1 -1
  34. package/standalone/local.scroll.timer.js +1 -1
  35. package/standalone/revo-grid.js +1 -1
  36. package/standalone/revogr-filter-panel.js +1 -1
  37. package/standalone/revogr-order-editor2.js +1 -1
  38. package/standalone/revogr-overlay-selection2.js +1 -1
  39. package/standalone/revogr-viewport-scroll2.js +1 -1
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { r as registerInstance, d as createEvent, h, e as Host, g as getElement } from './index-Chp_81rd.js';
5
5
  import { d as debounce } from './debounce-PCRWZliA.js';
6
- import { i as isFilterBtn, e as AndOrButton, f as ReorderButton, d as TrashButton } from './filter.button-B-RBiF67.js';
6
+ import { e as AndOrButton, f as ReorderButton, d as TrashButton, i as isFilterBtn } from './filter.button-B-RBiF67.js';
7
7
 
8
8
  (function closest() {
9
9
  if (!Element.prototype.matches) {
@@ -118,7 +118,7 @@ const FilterPanel = class {
118
118
  return;
119
119
  }
120
120
  const path = e.composedPath();
121
- const select = document.getElementById(FILTER_ID);
121
+ const select = this.getAddFilterSelect();
122
122
  if (select instanceof HTMLSelectElement) {
123
123
  // click on select should be skipped
124
124
  if (path.includes(select)) {
@@ -132,9 +132,8 @@ const FilterPanel = class {
132
132
  }
133
133
  this.currentFilterId = -1;
134
134
  const isOutside = !path.includes(this.element);
135
- if (e.target instanceof HTMLElement &&
136
- isOutside &&
137
- !isFilterBtn(e.target) &&
135
+ if (isOutside &&
136
+ !this.isOwnFilterButton(e.target) &&
138
137
  this.closeOnOutsideClick) {
139
138
  this.changes = undefined;
140
139
  }
@@ -258,7 +257,7 @@ const FilterPanel = class {
258
257
  this.currentFilterType = el.value;
259
258
  this.addNewFilterToProp();
260
259
  // reset value after adding new filter
261
- const select = document.getElementById('add-filter');
260
+ const select = this.getAddFilterSelect();
262
261
  if (select) {
263
262
  select.value = defaultType;
264
263
  this.currentFilterType = defaultType;
@@ -462,7 +461,7 @@ const FilterPanel = class {
462
461
  }
463
462
  };
464
463
  const focusNext = () => {
465
- const select = document.getElementById('add-filter');
464
+ const select = this.getAddFilterSelect();
466
465
  if (select) {
467
466
  select.value = defaultType;
468
467
  this.currentFilterType = defaultType;
@@ -496,7 +495,7 @@ const FilterPanel = class {
496
495
  }
497
496
  }, onKeyDown: e => {
498
497
  if (e.key.toLowerCase() === 'enter') {
499
- const select = document.getElementById('add-filter');
498
+ const select = this.getAddFilterSelect();
500
499
  if (select) {
501
500
  focusNext();
502
501
  }
@@ -506,6 +505,31 @@ const FilterPanel = class {
506
505
  e.stopPropagation();
507
506
  } }));
508
507
  }
508
+ getAddFilterSelect() {
509
+ return this.element.querySelector(`#${FILTER_ID}`);
510
+ }
511
+ isOwnFilterButton(target) {
512
+ if (!(target instanceof Element)) {
513
+ return false;
514
+ }
515
+ if (!isFilterBtn(target)) {
516
+ return false;
517
+ }
518
+ const panelGrid = this.getOwningGrid(this.element);
519
+ const targetGrid = this.getOwningGrid(target);
520
+ return !!panelGrid && panelGrid === targetGrid;
521
+ }
522
+ getOwningGrid(element) {
523
+ const grid = element.closest('revo-grid');
524
+ if (grid) {
525
+ return grid;
526
+ }
527
+ const root = element.getRootNode();
528
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
529
+ return root.host;
530
+ }
531
+ return undefined;
532
+ }
509
533
  render() {
510
534
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
511
535
  const style = {
@@ -513,7 +537,7 @@ const FilterPanel = class {
513
537
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
514
538
  };
515
539
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
516
- return (h(Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, h("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
540
+ return (h(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
517
541
  e.preventDefault();
518
542
  this.onCancel();
519
543
  } }, this.changes && [
@@ -522,7 +546,7 @@ const FilterPanel = class {
522
546
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
523
547
  h("label", { key: "filter-title" }, capts.title),
524
548
  h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
525
- h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: 'fc894bdfae1ff35d5c49adc7646dd3182b7bd49e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
549
+ h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
526
550
  ],
527
551
  h("slot", { key: "default-slot" }),
528
552
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -187,6 +187,10 @@ class LocalScrollTimer {
187
187
  setCoordinate(e) {
188
188
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
189
189
  }
190
+ setCoordinateFromScroll(e) {
191
+ this.setCoordinate(e);
192
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
193
+ }
190
194
  /**
191
195
  * Remember last mw event time
192
196
  */
@@ -176,9 +176,12 @@ class DataProvider {
176
176
  // take out
177
177
  const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
178
178
  1);
179
+ const targetItem = prevItems[from < to ? to + 1 : to];
180
+ const targetIndex = targetItem === undefined
181
+ ? newItemsOrder.length
182
+ : newItemsOrder.indexOf(targetItem);
179
183
  // insert before
180
- newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
181
- 0, ...toMove);
184
+ newItemsOrder.splice(targetIndex, 0, ...toMove);
182
185
  storeService.setData({
183
186
  proxyItems: newItemsOrder,
184
187
  });
@@ -10,7 +10,7 @@ import { t as timeout, g as getScrollbarSize } from './index-Db3qZoW5.js';
10
10
  import { d as debounce } from './debounce-PCRWZliA.js';
11
11
  import { V as ViewportStore, j as calculateRowHeaderSize } from './viewport.store-_c579YyM.js';
12
12
  import { H as HEADER_SLOT } from './viewport.helpers-CoCAvmZs.js';
13
- import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-CaUDyxyU.js';
13
+ import { L as LocalScrollTimer, a as LocalScrollService, g as getContentSize, t as throttle } from './throttle-Cpk1LoGk.js';
14
14
 
15
15
  const Attribution = class {
16
16
  constructor(hostRef) {
@@ -927,13 +927,13 @@ const OverlaySelection = class {
927
927
  /**
928
928
  * Executes the focus operation on the specified range of cells.
929
929
  */
930
- doFocus(focus, end, changes) {
930
+ doFocus(focus, end, changes, originalEvent) {
931
931
  // 1. Trigger beforeFocus event
932
- const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
932
+ const { defaultPrevented } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(focus.y, focus.x)), { originalEvent }));
933
933
  if (defaultPrevented) {
934
934
  return false;
935
935
  }
936
- const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
936
+ const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent });
937
937
  // 2. Trigger apply focus event
938
938
  const applyEvent = this.applyFocus.emit(evData);
939
939
  if (applyEvent.defaultPrevented) {
@@ -949,10 +949,10 @@ const OverlaySelection = class {
949
949
  y: range.y1,
950
950
  } }, applyEvent.detail)).defaultPrevented;
951
951
  }
952
- triggerRangeEvent(range) {
952
+ triggerRangeEvent(range, originalEvent) {
953
953
  const type = this.types.rowType;
954
954
  // 1. Apply range
955
- const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
955
+ const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent }));
956
956
  if (applyEvent.defaultPrevented) {
957
957
  return false;
958
958
  }
@@ -1003,7 +1003,7 @@ const OverlaySelection = class {
1003
1003
  return;
1004
1004
  }
1005
1005
  // Set focus on the current cell
1006
- this.focus(focusCell, this.range && e.shiftKey);
1006
+ this.focus(focusCell, this.range && e.shiftKey, e);
1007
1007
  // Initiate autofill selection
1008
1008
  if (this.range) {
1009
1009
  targetElement &&
@@ -1157,7 +1157,7 @@ const OverlaySelection = class {
1157
1157
  /**
1158
1158
  * Sets the focus on a cell and optionally edits a range.
1159
1159
  */
1160
- focus(cell, isRangeEdit = false) {
1160
+ focus(cell, isRangeEdit = false, originalEvent) {
1161
1161
  if (!cell)
1162
1162
  return false;
1163
1163
  const end = cell;
@@ -1165,10 +1165,10 @@ const OverlaySelection = class {
1165
1165
  if (isRangeEdit && start) {
1166
1166
  const range = getRange(start, end);
1167
1167
  if (range) {
1168
- return this.triggerRangeEvent(range);
1168
+ return this.triggerRangeEvent(range, originalEvent);
1169
1169
  }
1170
1170
  }
1171
- return this.doFocus(cell, end);
1171
+ return this.doFocus(cell, end, undefined, originalEvent);
1172
1172
  }
1173
1173
  get types() {
1174
1174
  return {
@@ -296,16 +296,16 @@ class RowOrderService {
296
296
  return;
297
297
  }
298
298
  const newRow = this.getCell(e, data);
299
+ // rgRow dragged out table
300
+ if (newRow.y < 0) {
301
+ newRow.y = 0;
302
+ }
303
+ // rgRow dragged to the top
304
+ else if (newRow.y < this.currentCell.y) {
305
+ newRow.y++;
306
+ }
299
307
  // if position changed
300
308
  if (newRow.y !== this.currentCell.y) {
301
- // rgRow dragged out table
302
- if (newRow.y < 0) {
303
- newRow.y = 0;
304
- }
305
- // rgRow dragged to the top
306
- else if (newRow.y < this.currentCell.y) {
307
- newRow.y++;
308
- }
309
309
  this.config.positionChanged(this.currentCell.y, newRow.y);
310
310
  }
311
311
  this.clear();
@@ -7,7 +7,7 @@ import { B as ROW_FOCUSED_CLASS, b as getSourceItem, n as DATA_ROW, m as DATA_CO
7
7
  import { G as GroupingRowRenderer, C as CellRenderer, R as RowRenderer, P as PADDING_DEPTH, S as SortingSign } from './cell-renderer-CLTRlCa5.js';
8
8
  import { c as FilterButton } from './filter.button-B-RBiF67.js';
9
9
  import { H as HeaderCellRenderer } from './header-cell-renderer-BMmXRsd_.js';
10
- import { t as throttle, L as LocalScrollTimer, a as LocalScrollService, g as getContentSize } from './throttle-CaUDyxyU.js';
10
+ import { t as throttle, L as LocalScrollTimer, a as LocalScrollService, g as getContentSize } from './throttle-Cpk1LoGk.js';
11
11
  import { H as HEADER_SLOT, C as CONTENT_SLOT, F as FOOTER_SLOT } from './viewport.helpers-CoCAvmZs.js';
12
12
  import './debounce-PCRWZliA.js';
13
13
 
@@ -871,6 +871,7 @@ const RevogrViewportScroll = class {
871
871
  const lastScrollUpdate = () => {
872
872
  var _a;
873
873
  (_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
874
+ this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
874
875
  };
875
876
  // apply after throttling
876
877
  if (this.localScrollTimer.isReady(type, coordinate)) {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { r as registerInstance, d as createEvent, h, e as Host, g as getElement } from './index-Chp_81rd.js';
5
5
  import { d as debounce } from './debounce-PCRWZliA.js';
6
- import { i as isFilterBtn, e as AndOrButton, f as ReorderButton, d as TrashButton } from './filter.button-B-RBiF67.js';
6
+ import { e as AndOrButton, f as ReorderButton, d as TrashButton, i as isFilterBtn } from './filter.button-B-RBiF67.js';
7
7
 
8
8
  (function closest() {
9
9
  if (!Element.prototype.matches) {
@@ -118,7 +118,7 @@ const FilterPanel = class {
118
118
  return;
119
119
  }
120
120
  const path = e.composedPath();
121
- const select = document.getElementById(FILTER_ID);
121
+ const select = this.getAddFilterSelect();
122
122
  if (select instanceof HTMLSelectElement) {
123
123
  // click on select should be skipped
124
124
  if (path.includes(select)) {
@@ -132,9 +132,8 @@ const FilterPanel = class {
132
132
  }
133
133
  this.currentFilterId = -1;
134
134
  const isOutside = !path.includes(this.element);
135
- if (e.target instanceof HTMLElement &&
136
- isOutside &&
137
- !isFilterBtn(e.target) &&
135
+ if (isOutside &&
136
+ !this.isOwnFilterButton(e.target) &&
138
137
  this.closeOnOutsideClick) {
139
138
  this.changes = undefined;
140
139
  }
@@ -258,7 +257,7 @@ const FilterPanel = class {
258
257
  this.currentFilterType = el.value;
259
258
  this.addNewFilterToProp();
260
259
  // reset value after adding new filter
261
- const select = document.getElementById('add-filter');
260
+ const select = this.getAddFilterSelect();
262
261
  if (select) {
263
262
  select.value = defaultType;
264
263
  this.currentFilterType = defaultType;
@@ -462,7 +461,7 @@ const FilterPanel = class {
462
461
  }
463
462
  };
464
463
  const focusNext = () => {
465
- const select = document.getElementById('add-filter');
464
+ const select = this.getAddFilterSelect();
466
465
  if (select) {
467
466
  select.value = defaultType;
468
467
  this.currentFilterType = defaultType;
@@ -496,7 +495,7 @@ const FilterPanel = class {
496
495
  }
497
496
  }, onKeyDown: e => {
498
497
  if (e.key.toLowerCase() === 'enter') {
499
- const select = document.getElementById('add-filter');
498
+ const select = this.getAddFilterSelect();
500
499
  if (select) {
501
500
  focusNext();
502
501
  }
@@ -506,6 +505,31 @@ const FilterPanel = class {
506
505
  e.stopPropagation();
507
506
  } }));
508
507
  }
508
+ getAddFilterSelect() {
509
+ return this.element.querySelector(`#${FILTER_ID}`);
510
+ }
511
+ isOwnFilterButton(target) {
512
+ if (!(target instanceof Element)) {
513
+ return false;
514
+ }
515
+ if (!isFilterBtn(target)) {
516
+ return false;
517
+ }
518
+ const panelGrid = this.getOwningGrid(this.element);
519
+ const targetGrid = this.getOwningGrid(target);
520
+ return !!panelGrid && panelGrid === targetGrid;
521
+ }
522
+ getOwningGrid(element) {
523
+ const grid = element.closest('revo-grid');
524
+ if (grid) {
525
+ return grid;
526
+ }
527
+ const root = element.getRootNode();
528
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
529
+ return root.host;
530
+ }
531
+ return undefined;
532
+ }
509
533
  render() {
510
534
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
511
535
  const style = {
@@ -513,7 +537,7 @@ const FilterPanel = class {
513
537
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
514
538
  };
515
539
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
516
- return (h(Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, h("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
540
+ return (h(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
517
541
  e.preventDefault();
518
542
  this.onCancel();
519
543
  } }, this.changes && [
@@ -522,7 +546,7 @@ const FilterPanel = class {
522
546
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
523
547
  h("label", { key: "filter-title" }, capts.title),
524
548
  h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
525
- h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: 'fc894bdfae1ff35d5c49adc7646dd3182b7bd49e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
549
+ h("div", { key: "add-filter", class: "add-filter" }, h("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
526
550
  ],
527
551
  h("slot", { key: "default-slot" }),
528
552
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -187,6 +187,10 @@ class LocalScrollTimer {
187
187
  setCoordinate(e) {
188
188
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
189
189
  }
190
+ setCoordinateFromScroll(e) {
191
+ this.setCoordinate(e);
192
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
193
+ }
190
194
  /**
191
195
  * Remember last mw event time
192
196
  */
@@ -268,7 +268,7 @@ export declare class OverlaySelection {
268
268
  /**
269
269
  * Sets the focus on a cell and optionally edits a range.
270
270
  */
271
- focus(cell?: Cell, isRangeEdit?: boolean): boolean;
271
+ focus(cell?: Cell, isRangeEdit?: boolean, originalEvent?: MouseEvent | TouchEvent | KeyboardEvent): boolean;
272
272
  get types(): AllDimensionType;
273
273
  /**
274
274
  * Collect data
@@ -31,5 +31,5 @@ type ReorderButtonProps = {
31
31
  onKeyDown?: (event: KeyboardEvent) => void;
32
32
  };
33
33
  export declare const ReorderButton: ({ ariaLabel, dragging, dragOver, onDragStart, onDragEnd, onDragOver, onDragLeave, onDrop, onKeyDown, }: ReorderButtonProps) => any;
34
- export declare function isFilterBtn(e: HTMLElement): true | Element | null;
34
+ export declare function isFilterBtn(e: Element): true | Element | null;
35
35
  export {};
@@ -60,5 +60,8 @@ export declare class FilterPanel {
60
60
  private assertChanges;
61
61
  renderSelectOptions(type: FilterType, isDefaultTypeRemoved?: boolean): VNode[] | undefined;
62
62
  renderExtra(prop: ColumnProp, index: number): any;
63
+ private getAddFilterSelect;
64
+ private isOwnFilterButton;
65
+ private getOwningGrid;
63
66
  render(): any;
64
67
  }
@@ -15,6 +15,10 @@ export declare class LocalScrollTimer {
15
15
  dimension: DimensionType;
16
16
  coordinate: number;
17
17
  }): void;
18
+ setCoordinateFromScroll(e: {
19
+ dimension: DimensionType;
20
+ coordinate: number;
21
+ }): void;
18
22
  /**
19
23
  * Remember last mw event time
20
24
  */
@@ -742,6 +742,10 @@ export interface FocusRenderEvent extends AllDimensionType {
742
742
  * Changes for the next cell to focus. @example { y: -1 }
743
743
  */
744
744
  next?: Partial<Cell>;
745
+ /**
746
+ * Original user input event that initiated the focus/range change, when available.
747
+ */
748
+ originalEvent?: MouseEvent | TouchEvent | KeyboardEvent;
745
749
  }
746
750
  export interface FocusAfterRenderEvent<TModel extends DataType = DataType> extends AllDimensionType {
747
751
  model?: TModel;
@@ -117,6 +117,10 @@ export interface BeforeSaveDataDetails<TModel extends DataType = DataType, TColu
117
117
  * Value from editor to save, not part of the model value yet
118
118
  */
119
119
  val?: any;
120
+ /**
121
+ * Original user input event that initiated the save/focus flow, when available.
122
+ */
123
+ originalEvent?: MouseEvent | TouchEvent | KeyboardEvent;
120
124
  }
121
125
  export type BeforeRangeSaveDataDetails<TModel extends DataType = DataType> = {
122
126
  data: {
package/hydrate/index.js CHANGED
@@ -7505,7 +7505,7 @@ class FilterPanel {
7505
7505
  return;
7506
7506
  }
7507
7507
  const path = e.composedPath();
7508
- const select = document.getElementById(FILTER_ID);
7508
+ const select = this.getAddFilterSelect();
7509
7509
  if (select instanceof HTMLSelectElement) {
7510
7510
  // click on select should be skipped
7511
7511
  if (path.includes(select)) {
@@ -7519,9 +7519,8 @@ class FilterPanel {
7519
7519
  }
7520
7520
  this.currentFilterId = -1;
7521
7521
  const isOutside = !path.includes(this.element);
7522
- if (e.target instanceof HTMLElement &&
7523
- isOutside &&
7524
- !isFilterBtn(e.target) &&
7522
+ if (isOutside &&
7523
+ !this.isOwnFilterButton(e.target) &&
7525
7524
  this.closeOnOutsideClick) {
7526
7525
  this.changes = undefined;
7527
7526
  }
@@ -7645,7 +7644,7 @@ class FilterPanel {
7645
7644
  this.currentFilterType = el.value;
7646
7645
  this.addNewFilterToProp();
7647
7646
  // reset value after adding new filter
7648
- const select = document.getElementById('add-filter');
7647
+ const select = this.getAddFilterSelect();
7649
7648
  if (select) {
7650
7649
  select.value = defaultType;
7651
7650
  this.currentFilterType = defaultType;
@@ -7849,7 +7848,7 @@ class FilterPanel {
7849
7848
  }
7850
7849
  };
7851
7850
  const focusNext = () => {
7852
- const select = document.getElementById('add-filter');
7851
+ const select = this.getAddFilterSelect();
7853
7852
  if (select) {
7854
7853
  select.value = defaultType;
7855
7854
  this.currentFilterType = defaultType;
@@ -7883,7 +7882,7 @@ class FilterPanel {
7883
7882
  }
7884
7883
  }, onKeyDown: e => {
7885
7884
  if (e.key.toLowerCase() === 'enter') {
7886
- const select = document.getElementById('add-filter');
7885
+ const select = this.getAddFilterSelect();
7887
7886
  if (select) {
7888
7887
  focusNext();
7889
7888
  }
@@ -7893,6 +7892,31 @@ class FilterPanel {
7893
7892
  e.stopPropagation();
7894
7893
  } }));
7895
7894
  }
7895
+ getAddFilterSelect() {
7896
+ return this.element.querySelector(`#${FILTER_ID}`);
7897
+ }
7898
+ isOwnFilterButton(target) {
7899
+ if (!(target instanceof Element)) {
7900
+ return false;
7901
+ }
7902
+ if (!isFilterBtn(target)) {
7903
+ return false;
7904
+ }
7905
+ const panelGrid = this.getOwningGrid(this.element);
7906
+ const targetGrid = this.getOwningGrid(target);
7907
+ return !!panelGrid && panelGrid === targetGrid;
7908
+ }
7909
+ getOwningGrid(element) {
7910
+ const grid = element.closest('revo-grid');
7911
+ if (grid) {
7912
+ return grid;
7913
+ }
7914
+ const root = element.getRootNode();
7915
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
7916
+ return root.host;
7917
+ }
7918
+ return undefined;
7919
+ }
7896
7920
  render() {
7897
7921
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7898
7922
  const style = {
@@ -7900,7 +7924,7 @@ class FilterPanel {
7900
7924
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
7901
7925
  };
7902
7926
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
7903
- return (hAsync(Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, hAsync("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
7927
+ return (hAsync(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, hAsync("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
7904
7928
  e.preventDefault();
7905
7929
  this.onCancel();
7906
7930
  } }, this.changes && [
@@ -7909,7 +7933,7 @@ class FilterPanel {
7909
7933
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
7910
7934
  hAsync("label", { key: "filter-title" }, capts.title),
7911
7935
  hAsync("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
7912
- hAsync("div", { key: "add-filter", class: "add-filter" }, hAsync("select", { key: 'fc894bdfae1ff35d5c49adc7646dd3182b7bd49e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
7936
+ hAsync("div", { key: "add-filter", class: "add-filter" }, hAsync("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
7913
7937
  ],
7914
7938
  hAsync("slot", { key: "default-slot" }),
7915
7939
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -12655,16 +12679,16 @@ class RowOrderService {
12655
12679
  return;
12656
12680
  }
12657
12681
  const newRow = this.getCell(e, data);
12682
+ // rgRow dragged out table
12683
+ if (newRow.y < 0) {
12684
+ newRow.y = 0;
12685
+ }
12686
+ // rgRow dragged to the top
12687
+ else if (newRow.y < this.currentCell.y) {
12688
+ newRow.y++;
12689
+ }
12658
12690
  // if position changed
12659
12691
  if (newRow.y !== this.currentCell.y) {
12660
- // rgRow dragged out table
12661
- if (newRow.y < 0) {
12662
- newRow.y = 0;
12663
- }
12664
- // rgRow dragged to the top
12665
- else if (newRow.y < this.currentCell.y) {
12666
- newRow.y++;
12667
- }
12668
12692
  this.config.positionChanged(this.currentCell.y, newRow.y);
12669
12693
  }
12670
12694
  this.clear();
@@ -14246,13 +14270,13 @@ class OverlaySelection {
14246
14270
  /**
14247
14271
  * Executes the focus operation on the specified range of cells.
14248
14272
  */
14249
- doFocus(focus, end, changes) {
14273
+ doFocus(focus, end, changes, originalEvent) {
14250
14274
  // 1. Trigger beforeFocus event
14251
- const { defaultPrevented } = this.beforeFocusCell.emit(this.columnService.getSaveData(focus.y, focus.x));
14275
+ const { defaultPrevented } = this.beforeFocusCell.emit(Object.assign(Object.assign({}, this.columnService.getSaveData(focus.y, focus.x)), { originalEvent }));
14252
14276
  if (defaultPrevented) {
14253
14277
  return false;
14254
14278
  }
14255
- const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) });
14279
+ const evData = Object.assign(Object.assign({ range: Object.assign(Object.assign({}, focus), { x1: end.x, y1: end.y }), next: changes }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent });
14256
14280
  // 2. Trigger apply focus event
14257
14281
  const applyEvent = this.applyFocus.emit(evData);
14258
14282
  if (applyEvent.defaultPrevented) {
@@ -14268,10 +14292,10 @@ class OverlaySelection {
14268
14292
  y: range.y1,
14269
14293
  } }, applyEvent.detail)).defaultPrevented;
14270
14294
  }
14271
- triggerRangeEvent(range) {
14295
+ triggerRangeEvent(range, originalEvent) {
14272
14296
  const type = this.types.rowType;
14273
14297
  // 1. Apply range
14274
- const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state) }));
14298
+ const applyEvent = this.beforeApplyRange.emit(Object.assign(Object.assign({ range: Object.assign({}, range) }, this.types), { rowDimension: Object.assign({}, this.dimensionRow.state), colDimension: Object.assign({}, this.dimensionCol.state), originalEvent }));
14275
14299
  if (applyEvent.defaultPrevented) {
14276
14300
  return false;
14277
14301
  }
@@ -14322,7 +14346,7 @@ class OverlaySelection {
14322
14346
  return;
14323
14347
  }
14324
14348
  // Set focus on the current cell
14325
- this.focus(focusCell, this.range && e.shiftKey);
14349
+ this.focus(focusCell, this.range && e.shiftKey, e);
14326
14350
  // Initiate autofill selection
14327
14351
  if (this.range) {
14328
14352
  targetElement &&
@@ -14476,7 +14500,7 @@ class OverlaySelection {
14476
14500
  /**
14477
14501
  * Sets the focus on a cell and optionally edits a range.
14478
14502
  */
14479
- focus(cell, isRangeEdit = false) {
14503
+ focus(cell, isRangeEdit = false, originalEvent) {
14480
14504
  if (!cell)
14481
14505
  return false;
14482
14506
  const end = cell;
@@ -14484,10 +14508,10 @@ class OverlaySelection {
14484
14508
  if (isRangeEdit && start) {
14485
14509
  const range = getRange(start, end);
14486
14510
  if (range) {
14487
- return this.triggerRangeEvent(range);
14511
+ return this.triggerRangeEvent(range, originalEvent);
14488
14512
  }
14489
14513
  }
14490
- return this.doFocus(cell, end);
14514
+ return this.doFocus(cell, end, undefined, originalEvent);
14491
14515
  }
14492
14516
  get types() {
14493
14517
  return {
@@ -14942,9 +14966,12 @@ class DataProvider {
14942
14966
  // take out
14943
14967
  const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
14944
14968
  1);
14969
+ const targetItem = prevItems[from < to ? to + 1 : to];
14970
+ const targetIndex = targetItem === undefined
14971
+ ? newItemsOrder.length
14972
+ : newItemsOrder.indexOf(targetItem);
14945
14973
  // insert before
14946
- newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
14947
- 0, ...toMove);
14974
+ newItemsOrder.splice(targetIndex, 0, ...toMove);
14948
14975
  storeService.setData({
14949
14976
  proxyItems: newItemsOrder,
14950
14977
  });
@@ -21704,6 +21731,10 @@ class LocalScrollTimer {
21704
21731
  setCoordinate(e) {
21705
21732
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
21706
21733
  }
21734
+ setCoordinateFromScroll(e) {
21735
+ this.setCoordinate(e);
21736
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
21737
+ }
21707
21738
  /**
21708
21739
  * Remember last mw event time
21709
21740
  */
@@ -22192,6 +22223,7 @@ class RevogrViewportScroll {
22192
22223
  const lastScrollUpdate = () => {
22193
22224
  var _a;
22194
22225
  (_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
22226
+ this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
22195
22227
  };
22196
22228
  // apply after throttling
22197
22229
  if (this.localScrollTimer.isReady(type, coordinate)) {