@revolist/revogrid 4.23.17 → 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
@@ -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
  */
@@ -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
  */
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();
@@ -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)) {
package/hydrate/index.mjs CHANGED
@@ -7503,7 +7503,7 @@ class FilterPanel {
7503
7503
  return;
7504
7504
  }
7505
7505
  const path = e.composedPath();
7506
- const select = document.getElementById(FILTER_ID);
7506
+ const select = this.getAddFilterSelect();
7507
7507
  if (select instanceof HTMLSelectElement) {
7508
7508
  // click on select should be skipped
7509
7509
  if (path.includes(select)) {
@@ -7517,9 +7517,8 @@ class FilterPanel {
7517
7517
  }
7518
7518
  this.currentFilterId = -1;
7519
7519
  const isOutside = !path.includes(this.element);
7520
- if (e.target instanceof HTMLElement &&
7521
- isOutside &&
7522
- !isFilterBtn(e.target) &&
7520
+ if (isOutside &&
7521
+ !this.isOwnFilterButton(e.target) &&
7523
7522
  this.closeOnOutsideClick) {
7524
7523
  this.changes = undefined;
7525
7524
  }
@@ -7643,7 +7642,7 @@ class FilterPanel {
7643
7642
  this.currentFilterType = el.value;
7644
7643
  this.addNewFilterToProp();
7645
7644
  // reset value after adding new filter
7646
- const select = document.getElementById('add-filter');
7645
+ const select = this.getAddFilterSelect();
7647
7646
  if (select) {
7648
7647
  select.value = defaultType;
7649
7648
  this.currentFilterType = defaultType;
@@ -7847,7 +7846,7 @@ class FilterPanel {
7847
7846
  }
7848
7847
  };
7849
7848
  const focusNext = () => {
7850
- const select = document.getElementById('add-filter');
7849
+ const select = this.getAddFilterSelect();
7851
7850
  if (select) {
7852
7851
  select.value = defaultType;
7853
7852
  this.currentFilterType = defaultType;
@@ -7881,7 +7880,7 @@ class FilterPanel {
7881
7880
  }
7882
7881
  }, onKeyDown: e => {
7883
7882
  if (e.key.toLowerCase() === 'enter') {
7884
- const select = document.getElementById('add-filter');
7883
+ const select = this.getAddFilterSelect();
7885
7884
  if (select) {
7886
7885
  focusNext();
7887
7886
  }
@@ -7891,6 +7890,31 @@ class FilterPanel {
7891
7890
  e.stopPropagation();
7892
7891
  } }));
7893
7892
  }
7893
+ getAddFilterSelect() {
7894
+ return this.element.querySelector(`#${FILTER_ID}`);
7895
+ }
7896
+ isOwnFilterButton(target) {
7897
+ if (!(target instanceof Element)) {
7898
+ return false;
7899
+ }
7900
+ if (!isFilterBtn(target)) {
7901
+ return false;
7902
+ }
7903
+ const panelGrid = this.getOwningGrid(this.element);
7904
+ const targetGrid = this.getOwningGrid(target);
7905
+ return !!panelGrid && panelGrid === targetGrid;
7906
+ }
7907
+ getOwningGrid(element) {
7908
+ const grid = element.closest('revo-grid');
7909
+ if (grid) {
7910
+ return grid;
7911
+ }
7912
+ const root = element.getRootNode();
7913
+ if (root instanceof ShadowRoot && root.host.localName === 'revo-grid') {
7914
+ return root.host;
7915
+ }
7916
+ return undefined;
7917
+ }
7894
7918
  render() {
7895
7919
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7896
7920
  const style = {
@@ -7898,7 +7922,7 @@ class FilterPanel {
7898
7922
  top: `${(_d = (_c = this.changes) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 0}px`,
7899
7923
  };
7900
7924
  const capts = Object.assign(Object.assign({}, this.filterCaptionsInternal), this.filterCaptions);
7901
- return (hAsync(Host, { key: '4e969f8b7033363c885c94b1f7770917786669f2' }, hAsync("dialog", { key: '79b2713724684fa99f56621fe43645a0b0ad54bf', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
7925
+ return (hAsync(Host, { key: '2a19b35adb56fb7d23385fffebc768838edee162' }, hAsync("dialog", { key: '94386d7cbc4bd9c631f72928938b1d1550a3de82', class: "filter-panel-dialog", style: style, ref: el => (this.dialog = el), onCancel: e => {
7902
7926
  e.preventDefault();
7903
7927
  this.onCancel();
7904
7928
  } }, this.changes && [
@@ -7907,7 +7931,7 @@ class FilterPanel {
7907
7931
  ((_g = this.changes) === null || _g === void 0 ? void 0 : _g.hideDefaultFilters) !== true && [
7908
7932
  hAsync("label", { key: "filter-title" }, capts.title),
7909
7933
  hAsync("div", { key: "filter-holder", class: "filter-holder" }, this.getFilterItemsList()),
7910
- 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))),
7934
+ 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))),
7911
7935
  ],
7912
7936
  hAsync("slot", { key: "default-slot" }),
7913
7937
  ((_j = (_h = this.changes).extraBottomContent) === null || _j === void 0 ? void 0 : _j.call(_h, this.changes)) || '',
@@ -12653,16 +12677,16 @@ class RowOrderService {
12653
12677
  return;
12654
12678
  }
12655
12679
  const newRow = this.getCell(e, data);
12680
+ // rgRow dragged out table
12681
+ if (newRow.y < 0) {
12682
+ newRow.y = 0;
12683
+ }
12684
+ // rgRow dragged to the top
12685
+ else if (newRow.y < this.currentCell.y) {
12686
+ newRow.y++;
12687
+ }
12656
12688
  // if position changed
12657
12689
  if (newRow.y !== this.currentCell.y) {
12658
- // rgRow dragged out table
12659
- if (newRow.y < 0) {
12660
- newRow.y = 0;
12661
- }
12662
- // rgRow dragged to the top
12663
- else if (newRow.y < this.currentCell.y) {
12664
- newRow.y++;
12665
- }
12666
12690
  this.config.positionChanged(this.currentCell.y, newRow.y);
12667
12691
  }
12668
12692
  this.clear();
@@ -14940,9 +14964,12 @@ class DataProvider {
14940
14964
  // take out
14941
14965
  const toMove = newItemsOrder.splice(newItemsOrder.indexOf(prevItems[from]), // get index in proxy
14942
14966
  1);
14967
+ const targetItem = prevItems[from < to ? to + 1 : to];
14968
+ const targetIndex = targetItem === undefined
14969
+ ? newItemsOrder.length
14970
+ : newItemsOrder.indexOf(targetItem);
14943
14971
  // insert before
14944
- newItemsOrder.splice(newItemsOrder.indexOf(prevItems[to]), // get index in proxy
14945
- 0, ...toMove);
14972
+ newItemsOrder.splice(targetIndex, 0, ...toMove);
14946
14973
  storeService.setData({
14947
14974
  proxyItems: newItemsOrder,
14948
14975
  });
@@ -21702,6 +21729,10 @@ class LocalScrollTimer {
21702
21729
  setCoordinate(e) {
21703
21730
  this.lastKnownScrollCoordinate[e.dimension] = e.coordinate;
21704
21731
  }
21732
+ setCoordinateFromScroll(e) {
21733
+ this.setCoordinate(e);
21734
+ this.mouseWheelScrollTimestamp[e.dimension] = 0;
21735
+ }
21705
21736
  /**
21706
21737
  * Remember last mw event time
21707
21738
  */
@@ -22190,6 +22221,7 @@ class RevogrViewportScroll {
22190
22221
  const lastScrollUpdate = () => {
22191
22222
  var _a;
22192
22223
  (_a = this.localScrollService) === null || _a === void 0 ? void 0 : _a.scroll(coordinate, type, undefined, undefined, outside);
22224
+ this.localScrollTimer.setCoordinateFromScroll({ dimension: type, coordinate });
22193
22225
  };
22194
22226
  // apply after throttling
22195
22227
  if (this.localScrollTimer.isReady(type, coordinate)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolist/revogrid",
3
- "version": "4.23.17",
3
+ "version": "4.23.19",
4
4
  "type": "module",
5
5
  "description": "Virtual reactive data grid spreadsheet component - RevoGrid.",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Built by Revolist OU ❤️
3
3
  */
4
- const t=16e6,i=1e6;let e;function o(o=("undefined"==typeof document?void 0:document)){if("number"==typeof e)return e;const s=null==o?void 0:o.body;if(s){const o=s.ownerDocument,n=o.createElement("div");n.style.cssText=["height:1px","left:-10000px","overflow:scroll","position:absolute","top:-10000px","visibility:hidden","width:1px"].join(";");const r=o.createElement("div");return r.style.height="64000000px",n.appendChild(r),s.appendChild(n),e=Math.max(0,Math.min(n.scrollHeight,64e6)-i),n.remove(),e>i||(e=t),e}return t}function s({contentSize:t,clientSize:e,virtualSize:s=0,maxScrollSize:n=o()}){const r=Math.max(0,n-i),l=Math.max(0,t),a=Math.max(0,e),h=Math.max(0,s||a),c=Math.max(0,l-h),u=Math.max(0,r-a),d=Math.min(c,u),v=c>d&&d>0,S=t=>Math.min(Math.max(0,t||0),c),g=t=>Math.min(Math.max(0,t||0),d),p=t=>c&&d?g(v?S(t)/c*d:t):0;return{contentSize:l,clientSize:a,viewportSize:h,physicalContentSize:a+d,logicalScrollSize:c,physicalScrollSize:d,isCompressed:v,toLogicalCoordinate:t=>c&&d?S(v?g(t)/d*c:t):0,toPhysicalCoordinate:p,getRenderOffset(t){const i=S(t);return i-p(i)}}}const n={contentSize:0,clientSize:0,virtualSize:0,maxSize:0},r=-1;function l(t,i,e=0){return s({contentSize:t,clientSize:i,virtualSize:e}).physicalContentSize}class a{constructor(t){this.cfg=t,this.preventArtificialScroll={rgRow:null,rgCol:null},this.previousScroll={rgRow:r,rgCol:r},this.previousLogicalScroll={rgRow:0,rgCol:0},this.params={rgRow:Object.assign({},n),rgCol:Object.assign({},n)}}setParams(t,i){const e=s(t),o=e.physicalContentSize;this.params[i]=Object.assign(Object.assign({},t),{maxSize:o-t.clientSize,virtualContentSize:o,scrollDimension:e})}async setScroll(t){this.cancelScroll(t.dimension);const i=new Promise(((i,e)=>{if(this.cfg.skipAnimationFrame)return i();const o=window.requestAnimationFrame((()=>{i()}));this.preventArtificialScroll[t.dimension]=e.bind(null,o)}));try{await i;const e=this.getParams(t.dimension);t.coordinate=Math.ceil(t.coordinate),this.previousLogicalScroll[t.dimension]=this.wrapLogicalCoordinate(t.coordinate,e);const o=this.toPhysicalCoordinate(t.coordinate,e);this.previousScroll[t.dimension]=this.wrapPhysicalCoordinate(o,e),this.preventArtificialScroll[t.dimension]=null,this.cfg.applyScroll(Object.assign(Object.assign({},t),{coordinate:o}))}catch(t){window.cancelAnimationFrame(t)}}async setScrollByDelta(t,i){var e;const o=this.getParams(t.dimension),s=this.previousScroll[t.dimension]===r?this.toLogicalCoordinate(i,o):this.previousLogicalScroll[t.dimension],n=this.wrapLogicalCoordinate(s+(null!==(e=t.delta)&&void 0!==e?e:0),o),l=Object.assign(Object.assign({},t),{coordinate:n});return await this.setScroll(l),l}scroll(t,i,e=!1,o,s=!1){if(this.cancelScroll(i),!e&&this.previousScroll[i]===t)return void(this.previousScroll[i]=r);const n=this.getParams(i),l=this.toLogicalScrollCoordinate(t,i,n,o);this.cfg.runScroll({dimension:i,coordinate:l,delta:o,outside:s}),this.previousLogicalScroll[i]=l}getParams(t){return this.params[t]}wrapPhysicalCoordinate(t,i){return t<0?r:"number"==typeof i.maxSize&&t>i.maxSize?i.maxSize:t}wrapLogicalCoordinate(t,i){var e,o;return t<0?0:Math.min(t,null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.logicalScrollSize)&&void 0!==o?o:t)}cancelScroll(t){var i,e;null===(e=(i=this.preventArtificialScroll)[t])||void 0===e||e.call(i),this.preventArtificialScroll[t]=null}toLogicalScrollCoordinate(t,i,e,o){const s=e.scrollDimension;if(!s)return t;if("number"==typeof o&&s.isCompressed){const e=this.previousScroll[i]===r?s.toLogicalCoordinate(t-o):this.previousLogicalScroll[i];return s.toLogicalCoordinate(s.toPhysicalCoordinate(e+o))}return s.toLogicalCoordinate(t)}toPhysicalCoordinate(t,i){var e,o;return null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.toPhysicalCoordinate(t))&&void 0!==o?o:t}toLogicalCoordinate(t,i){var e,o;return null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.toLogicalCoordinate(t))&&void 0!==o?o:t}}class h{constructor(t=10){this.scrollThrottling=t,this.mouseWheelScrollTimestamp={rgCol:0,rgRow:0},this.lastKnownScrollCoordinate={rgCol:0,rgRow:0},this.lastScrollUpdateCallbacks={}}setCoordinate(t){this.lastKnownScrollCoordinate[t.dimension]=t.coordinate}latestScrollUpdate(t){this.mouseWheelScrollTimestamp[t]=(new Date).getTime()}isReady(t,i){return this.lastScrollUpdateCallbacks[t]&&this.clearLastScrollUpdate(t),this.verifyChange(t,i)}verifyChange(t,i){return(new Date).getTime()-this.mouseWheelScrollTimestamp[t]>this.scrollThrottling&&i!==this.lastKnownScrollCoordinate[t]}clearLastScrollUpdate(t){var i,e;clearTimeout(null!==(e=null===(i=this.lastScrollUpdateCallbacks[t])||void 0===i?void 0:i.timeout)&&void 0!==e?e:0),delete this.lastScrollUpdateCallbacks[t]}throttleLastScrollUpdate(t,i,e){if(this.scrollThrottling){this.clearLastScrollUpdate(t);const o=this.lastScrollUpdateCallbacks[t]={callback:e,timestamp:(new Date).getTime(),coordinate:i,timeout:0};o.timeout=setTimeout((()=>{this.clearLastScrollUpdate(t),this.mouseWheelScrollTimestamp[t]<o.timestamp&&this.verifyChange(t,o.coordinate)&&o.callback()}),this.scrollThrottling+50)}}}export{h as L,a,l as b,s as g}
4
+ const t=16e6,i=1e6;let e;function o(o=("undefined"==typeof document?void 0:document)){if("number"==typeof e)return e;const s=null==o?void 0:o.body;if(s){const o=s.ownerDocument,n=o.createElement("div");n.style.cssText=["height:1px","left:-10000px","overflow:scroll","position:absolute","top:-10000px","visibility:hidden","width:1px"].join(";");const r=o.createElement("div");return r.style.height="64000000px",n.appendChild(r),s.appendChild(n),e=Math.max(0,Math.min(n.scrollHeight,64e6)-i),n.remove(),e>i||(e=t),e}return t}function s({contentSize:t,clientSize:e,virtualSize:s=0,maxScrollSize:n=o()}){const r=Math.max(0,n-i),l=Math.max(0,t),a=Math.max(0,e),h=Math.max(0,s||a),c=Math.max(0,l-h),u=Math.max(0,r-a),d=Math.min(c,u),v=c>d&&d>0,S=t=>Math.min(Math.max(0,t||0),c),g=t=>Math.min(Math.max(0,t||0),d),p=t=>c&&d?g(v?S(t)/c*d:t):0;return{contentSize:l,clientSize:a,viewportSize:h,physicalContentSize:a+d,logicalScrollSize:c,physicalScrollSize:d,isCompressed:v,toLogicalCoordinate:t=>c&&d?S(v?g(t)/d*c:t):0,toPhysicalCoordinate:p,getRenderOffset(t){const i=S(t);return i-p(i)}}}const n={contentSize:0,clientSize:0,virtualSize:0,maxSize:0},r=-1;function l(t,i,e=0){return s({contentSize:t,clientSize:i,virtualSize:e}).physicalContentSize}class a{constructor(t){this.cfg=t,this.preventArtificialScroll={rgRow:null,rgCol:null},this.previousScroll={rgRow:r,rgCol:r},this.previousLogicalScroll={rgRow:0,rgCol:0},this.params={rgRow:Object.assign({},n),rgCol:Object.assign({},n)}}setParams(t,i){const e=s(t),o=e.physicalContentSize;this.params[i]=Object.assign(Object.assign({},t),{maxSize:o-t.clientSize,virtualContentSize:o,scrollDimension:e})}async setScroll(t){this.cancelScroll(t.dimension);const i=new Promise(((i,e)=>{if(this.cfg.skipAnimationFrame)return i();const o=window.requestAnimationFrame((()=>{i()}));this.preventArtificialScroll[t.dimension]=e.bind(null,o)}));try{await i;const e=this.getParams(t.dimension);t.coordinate=Math.ceil(t.coordinate),this.previousLogicalScroll[t.dimension]=this.wrapLogicalCoordinate(t.coordinate,e);const o=this.toPhysicalCoordinate(t.coordinate,e);this.previousScroll[t.dimension]=this.wrapPhysicalCoordinate(o,e),this.preventArtificialScroll[t.dimension]=null,this.cfg.applyScroll(Object.assign(Object.assign({},t),{coordinate:o}))}catch(t){window.cancelAnimationFrame(t)}}async setScrollByDelta(t,i){var e;const o=this.getParams(t.dimension),s=this.previousScroll[t.dimension]===r?this.toLogicalCoordinate(i,o):this.previousLogicalScroll[t.dimension],n=this.wrapLogicalCoordinate(s+(null!==(e=t.delta)&&void 0!==e?e:0),o),l=Object.assign(Object.assign({},t),{coordinate:n});return await this.setScroll(l),l}scroll(t,i,e=!1,o,s=!1){if(this.cancelScroll(i),!e&&this.previousScroll[i]===t)return void(this.previousScroll[i]=r);const n=this.getParams(i),l=this.toLogicalScrollCoordinate(t,i,n,o);this.cfg.runScroll({dimension:i,coordinate:l,delta:o,outside:s}),this.previousLogicalScroll[i]=l}getParams(t){return this.params[t]}wrapPhysicalCoordinate(t,i){return t<0?r:"number"==typeof i.maxSize&&t>i.maxSize?i.maxSize:t}wrapLogicalCoordinate(t,i){var e,o;return t<0?0:Math.min(t,null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.logicalScrollSize)&&void 0!==o?o:t)}cancelScroll(t){var i,e;null===(e=(i=this.preventArtificialScroll)[t])||void 0===e||e.call(i),this.preventArtificialScroll[t]=null}toLogicalScrollCoordinate(t,i,e,o){const s=e.scrollDimension;if(!s)return t;if("number"==typeof o&&s.isCompressed){const e=this.previousScroll[i]===r?s.toLogicalCoordinate(t-o):this.previousLogicalScroll[i];return s.toLogicalCoordinate(s.toPhysicalCoordinate(e+o))}return s.toLogicalCoordinate(t)}toPhysicalCoordinate(t,i){var e,o;return null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.toPhysicalCoordinate(t))&&void 0!==o?o:t}toLogicalCoordinate(t,i){var e,o;return null!==(o=null===(e=i.scrollDimension)||void 0===e?void 0:e.toLogicalCoordinate(t))&&void 0!==o?o:t}}class h{constructor(t=10){this.scrollThrottling=t,this.mouseWheelScrollTimestamp={rgCol:0,rgRow:0},this.lastKnownScrollCoordinate={rgCol:0,rgRow:0},this.lastScrollUpdateCallbacks={}}setCoordinate(t){this.lastKnownScrollCoordinate[t.dimension]=t.coordinate}setCoordinateFromScroll(t){this.setCoordinate(t),this.mouseWheelScrollTimestamp[t.dimension]=0}latestScrollUpdate(t){this.mouseWheelScrollTimestamp[t]=(new Date).getTime()}isReady(t,i){return this.lastScrollUpdateCallbacks[t]&&this.clearLastScrollUpdate(t),this.verifyChange(t,i)}verifyChange(t,i){return(new Date).getTime()-this.mouseWheelScrollTimestamp[t]>this.scrollThrottling&&i!==this.lastKnownScrollCoordinate[t]}clearLastScrollUpdate(t){var i,e;clearTimeout(null!==(e=null===(i=this.lastScrollUpdateCallbacks[t])||void 0===i?void 0:i.timeout)&&void 0!==e?e:0),delete this.lastScrollUpdateCallbacks[t]}throttleLastScrollUpdate(t,i,e){if(this.scrollThrottling){this.clearLastScrollUpdate(t);const o=this.lastScrollUpdateCallbacks[t]={callback:e,timestamp:(new Date).getTime(),coordinate:i,timeout:0};o.timeout=setTimeout((()=>{this.clearLastScrollUpdate(t),this.mouseWheelScrollTimestamp[t]<o.timestamp&&this.verifyChange(t,o.coordinate)&&o.callback()}),this.scrollThrottling+50)}}}export{h as L,a,l as b,s as g}