@revolist/revogrid 4.23.16 → 4.23.19

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 (34) hide show
  1. package/dist/cjs/revo-grid.cjs.entry.js +5 -2
  2. package/dist/cjs/revogr-attribution_7.cjs.entry.js +1 -1
  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/scroll/revogr-viewport-scroll.js +1 -0
  9. package/dist/collection/plugins/filter/filter.panel.js +33 -9
  10. package/dist/collection/services/data.provider.js +5 -2
  11. package/dist/collection/services/local.scroll.timer.js +4 -0
  12. package/dist/esm/revo-grid.entry.js +5 -2
  13. package/dist/esm/revogr-attribution_7.entry.js +1 -1
  14. package/dist/esm/revogr-clipboard_3.entry.js +8 -8
  15. package/dist/esm/revogr-data_4.entry.js +2 -1
  16. package/dist/esm/revogr-filter-panel.entry.js +34 -10
  17. package/dist/esm/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
  18. package/dist/revo-grid/revo-grid.entry.js +5 -2
  19. package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
  20. package/dist/revo-grid/revogr-clipboard_3.entry.js +8 -8
  21. package/dist/revo-grid/revogr-data_4.entry.js +2 -1
  22. package/dist/revo-grid/revogr-filter-panel.entry.js +34 -10
  23. package/dist/revo-grid/{throttle-CaUDyxyU.js → throttle-Cpk1LoGk.js} +4 -0
  24. package/dist/types/plugins/filter/filter.button.d.ts +1 -1
  25. package/dist/types/plugins/filter/filter.panel.d.ts +3 -0
  26. package/dist/types/services/local.scroll.timer.d.ts +4 -0
  27. package/hydrate/index.js +51 -19
  28. package/hydrate/index.mjs +51 -19
  29. package/package.json +1 -1
  30. package/standalone/local.scroll.timer.js +1 -1
  31. package/standalone/revo-grid.js +1 -1
  32. package/standalone/revogr-filter-panel.js +1 -1
  33. package/standalone/revogr-order-editor2.js +1 -1
  34. package/standalone/revogr-viewport-scroll2.js +1 -1
@@ -178,9 +178,12 @@ class DataProvider {
178
178
  // take out
179
179
  const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
180
180
  1);
181
+ const targetItem = prevItems[from < to ? to + 1 : to];
182
+ const targetIndex = targetItem === undefined
183
+ ? newItemsOrder.length
184
+ : newItemsOrder.indexOf(targetItem);
181
185
  // insert before
182
- newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
183
- 0, ...toMove);
186
+ newItemsOrder.splice(targetIndex, 0, ...toMove);
184
187
  storeService.setData({
185
188
  proxyItems: newItemsOrder,
186
189
  });
@@ -12,7 +12,7 @@ var index$1 = require('./index-DxaSE5uZ.js');
12
12
  var debounce = require('./debounce-CcpHiH2p.js');
13
13
  var viewport_store = require('./viewport.store-BscUCiUk.js');
14
14
  var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
15
- var throttle = require('./throttle-BCwEuJJq.js');
15
+ var throttle = require('./throttle-fV6BUmM7.js');
16
16
 
17
17
  const Attribution = class {
18
18
  constructor(hostRef) {
@@ -298,16 +298,16 @@ class RowOrderService {
298
298
  return;
299
299
  }
300
300
  const newRow = this.getCell(e, data);
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
+ }
301
309
  // if position changed
302
310
  if (newRow.y !== this.currentCell.y) {
303
- // rgRow dragged out table
304
- if (newRow.y < 0) {
305
- newRow.y = 0;
306
- }
307
- // rgRow dragged to the top
308
- else if (newRow.y < this.currentCell.y) {
309
- newRow.y++;
310
- }
311
311
  this.config.positionChanged(this.currentCell.y, newRow.y);
312
312
  }
313
313
  this.clear();
@@ -9,7 +9,7 @@ var dimension_helpers = require('./dimension.helpers-B9HgANnM.js');
9
9
  var cellRenderer = require('./cell-renderer-DfUCisis.js');
10
10
  var filter_button = require('./filter.button-C4xpvyyE.js');
11
11
  var headerCellRenderer = require('./header-cell-renderer-DyjOxArm.js');
12
- var throttle = require('./throttle-BCwEuJJq.js');
12
+ var throttle = require('./throttle-fV6BUmM7.js');
13
13
  var viewport_helpers = require('./viewport.helpers-BND76K2j.js');
14
14
  require('./debounce-CcpHiH2p.js');
15
15
 
@@ -873,6 +873,7 @@ const RevogrViewportScroll = class {
873
873
  const lastScrollUpdate = () => {
874
874
  var _a;
875
875
  (_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
876
+ this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
876
877
  };
877
878
  // apply after throttling
878
879
  if (this.localScrollTimer.isReady(type, coordinate)) {
@@ -120,7 +120,7 @@ const FilterPanel = class {
120
120
  return;
121
121
  }
122
122
  const path = e.composedPath();
123
- const select = document.getElementById(FILTER_ID);
123
+ const select = this.getAddFilterSelect();
124
124
  if (select instanceof HTMLSelectElement) {
125
125
  // click on select should be skipped
126
126
  if (path.includes(select)) {
@@ -134,9 +134,8 @@ const FilterPanel = class {
134
134
  }
135
135
  this.currentFilterId = -1;
136
136
  const isOutside = !path.includes(this.element);
137
- if (e.target instanceof HTMLElement &&
138
- isOutside &&
139
- !filter_button.isFilterBtn(e.target) &&
137
+ if (isOutside &&
138
+ !this.isOwnFilterButton(e.target) &&
140
139
  this.closeOnOutsideClick) {
141
140
  this.changes = undefined;
142
141
  }
@@ -260,7 +259,7 @@ const FilterPanel = class {
260
259
  this.currentFilterType = el.value;
261
260
  this.addNewFilterToProp();
262
261
  // reset value after adding new filter
263
- const select = document.getElementById('add-filter');
262
+ const select = this.getAddFilterSelect();
264
263
  if (select) {
265
264
  select.value = defaultType;
266
265
  this.currentFilterType = defaultType;
@@ -464,7 +463,7 @@ const FilterPanel = class {
464
463
  }
465
464
  };
466
465
  const focusNext = () => {
467
- const select = document.getElementById('add-filter');
466
+ const select = this.getAddFilterSelect();
468
467
  if (select) {
469
468
  select.value = defaultType;
470
469
  this.currentFilterType = defaultType;
@@ -498,7 +497,7 @@ const FilterPanel = class {
498
497
  }
499
498
  }, onKeyDown: e => {
500
499
  if (e.key.toLowerCase() === 'enter') {
501
- const select = document.getElementById('add-filter');
500
+ const select = this.getAddFilterSelect();
502
501
  if (select) {
503
502
  focusNext();
504
503
  }
@@ -508,6 +507,31 @@ const FilterPanel = class {
508
507
  e.stopPropagation();
509
508
  } }));
510
509
  }
510
+ getAddFilterSelect() {
511
+ return this.element.querySelector(`#${FILTER_ID}`);
512
+ }
513
+ isOwnFilterButton(target) {
514
+ if (!(target instanceof Element)) {
515
+ return false;
516
+ }
517
+ if (!filter_button.isFilterBtn(target)) {
518
+ return false;
519
+ }
520
+ const panelGrid = this.getOwningGrid(this.element);
521
+ const targetGrid = this.getOwningGrid(target);
522
+ return !!panelGrid && panelGrid === targetGrid;
523
+ }
524
+ getOwningGrid(element) {
525
+ const grid = element.closest('revo-grid');
526
+ if (grid) {
527
+ return grid;
528
+ }
529
+ const root = element.getRootNode();
530
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
531
+ return root.host;
532
+ }
533
+ return undefined;
534
+ }
511
535
  render() {
512
536
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
513
537
  const style = {
@@ -515,7 +539,7 @@ const FilterPanel = class {
515
539
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
516
540
  };
517
541
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
518
- return (index.h(index.Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, index.h("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
542
+ return (index.h(index.Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, index.h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
519
543
  e.preventDefault();
520
544
  this.onCancel();
521
545
  } }, this.changes && [
@@ -524,7 +548,7 @@ const FilterPanel = class {
524
548
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
525
549
  index.h("label", { key: "filter-title" }, capts.title),
526
550
  index.h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
527
- index.h("div", { key: "add-filter", class: "add-filter" }, index.h("select", { key: 'fc894bdfae1ff35d5c49adc7646dd3182b7bd49e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
551
+ index.h("div", { key: "add-filter", class: "add-filter" }, index.h("select", { key: '4f7354e39d8e5cf9ae7b735290eff18d105ab87e', id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))),
528
552
  ],
529
553
  index.h("slot", { key: "default-slot" }),
530
554
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -189,6 +189,10 @@ class LocalScrollTimer {
189
189
  setCoordinate(e) {
190
190
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
191
191
  }
192
+ setCoordinateFromScroll(e) {
193
+ this.setCoordinate(e);
194
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
195
+ }
192
196
  /**
193
197
  * Remember last mw event time
194
198
  */
@@ -14,16 +14,16 @@ export default class RowOrderService {
14
14
  return;
15
15
  }
16
16
  const newRow = this.getCell(e, data);
17
+ // rgRow dragged out table
18
+ if (newRow.y < 0) {
19
+ newRow.y = 0;
20
+ }
21
+ // rgRow dragged to the top
22
+ else if (newRow.y < this.currentCell.y) {
23
+ newRow.y++;
24
+ }
17
25
  // if position changed
18
26
  if (newRow.y !== this.currentCell.y) {
19
- // rgRow dragged out table
20
- if (newRow.y < 0) {
21
- newRow.y = 0;
22
- }
23
- // rgRow dragged to the top
24
- else if (newRow.y < this.currentCell.y) {
25
- newRow.y++;
26
- }
27
27
  this.config.positionChanged(this.currentCell.y, newRow.y);
28
28
  }
29
29
  this.clear();
@@ -262,6 +262,7 @@ export class RevogrViewportScroll {
262
262
  const lastScrollUpdate = () => {
263
263
  var _a;
264
264
  (_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
265
+ this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
265
266
  };
266
267
  // apply after throttling
267
268
  if (this.localScrollTimer.isReady(type, coordinate)) {
@@ -60,7 +60,7 @@ export class FilterPanel {
60
60
  return;
61
61
  }
62
62
  const path = e.composedPath();
63
- const select = document.getElementById(FILTER_ID);
63
+ const select = this.getAddFilterSelect();
64
64
  if (select instanceof HTMLSelectElement) {
65
65
  // click on select should be skipped
66
66
  if (path.includes(select)) {
@@ -74,9 +74,8 @@ export class FilterPanel {
74
74
  }
75
75
  this.currentFilterId = -1;
76
76
  const isOutside = !path.includes(this.element);
77
- if (e.target instanceof HTMLElement &&
78
- isOutside &&
79
- !isFilterBtn(e.target) &&
77
+ if (isOutside &&
78
+ !this.isOwnFilterButton(e.target) &&
80
79
  this.closeOnOutsideClick) {
81
80
  this.changes = undefined;
82
81
  }
@@ -200,7 +199,7 @@ export class FilterPanel {
200
199
  this.currentFilterType = el.value;
201
200
  this.addNewFilterToProp();
202
201
  // reset value after adding new filter
203
- const select = document.getElementById('add-filter');
202
+ const select = this.getAddFilterSelect();
204
203
  if (select) {
205
204
  select.value = defaultType;
206
205
  this.currentFilterType = defaultType;
@@ -404,7 +403,7 @@ export class FilterPanel {
404
403
  }
405
404
  };
406
405
  const focusNext = () => {
407
- const select = document.getElementById('add-filter');
406
+ const select = this.getAddFilterSelect();
408
407
  if (select) {
409
408
  select.value = defaultType;
410
409
  this.currentFilterType = defaultType;
@@ -438,7 +437,7 @@ export class FilterPanel {
438
437
  }
439
438
  }, onKeyDown: e => {
440
439
  if (e.key.toLowerCase() === 'enter') {
441
- const select = document.getElementById('add-filter');
440
+ const select = this.getAddFilterSelect();
442
441
  if (select) {
443
442
  focusNext();
444
443
  }
@@ -448,6 +447,31 @@ export class FilterPanel {
448
447
  e.stopPropagation();
449
448
  } }));
450
449
  }
450
+ getAddFilterSelect() {
451
+ return this.element.querySelector(`#${FILTER_ID}`);
452
+ }
453
+ isOwnFilterButton(target) {
454
+ if (!(target instanceof Element)) {
455
+ return false;
456
+ }
457
+ if (!isFilterBtn(target)) {
458
+ return false;
459
+ }
460
+ const panelGrid = this.getOwningGrid(this.element);
461
+ const targetGrid = this.getOwningGrid(target);
462
+ return !!panelGrid && panelGrid === targetGrid;
463
+ }
464
+ getOwningGrid(element) {
465
+ const grid = element.closest('revo-grid');
466
+ if (grid) {
467
+ return grid;
468
+ }
469
+ const root = element.getRootNode();
470
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
471
+ return root.host;
472
+ }
473
+ return undefined;
474
+ }
451
475
  render() {
452
476
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
453
477
  const style = {
@@ -455,7 +479,7 @@ export class FilterPanel {
455
479
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
456
480
  };
457
481
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
458
- return (h(Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, h("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
482
+ return (h(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, h("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
459
483
  e.preventDefault();
460
484
  this.onCancel();
461
485
  } }, this.changes && [
@@ -464,7 +488,7 @@ export class FilterPanel {
464
488
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
465
489
  h("label", { key: "filter-title" }, capts.title),
466
490
  h("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
467
- 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))),
491
+ 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))),
468
492
  ],
469
493
  h("slot", { key: "default-slot" }),
470
494
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -52,9 +52,12 @@ export class DataProvider {
52
52
  // take out
53
53
  const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
54
54
  1);
55
+ const targetItem = prevItems[from < to ? to + 1 : to];
56
+ const targetIndex = targetItem === undefined
57
+ ? newItemsOrder.length
58
+ : newItemsOrder.indexOf(targetItem);
55
59
  // insert before
56
- newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
57
- 0, ...toMove);
60
+ newItemsOrder.splice(targetIndex, 0, ...toMove);
58
61
  storeService.setData({
59
62
  proxyItems: newItemsOrder,
60
63
  });
@@ -29,6 +29,10 @@ export class LocalScrollTimer {
29
29
  setCoordinate(e) {
30
30
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
31
31
  }
32
+ setCoordinateFromScroll(e) {
33
+ this.setCoordinate(e);
34
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
35
+ }
32
36
  /**
33
37
  * Remember last mw event time
34
38
  */
@@ -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) {
@@ -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
  */
@@ -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) {
@@ -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)) {