@revolist/revogrid 4.12.4 → 4.12.6

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 (56) hide show
  1. package/dist/cjs/revogr-attribution_7.cjs.entry.js +23 -8
  2. package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -1
  3. package/dist/cjs/revogr-data_4.cjs.entry.js +58 -36
  4. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  5. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
  6. package/dist/cjs/{throttle-08957661.js → throttle-5674040a.js} +4 -1
  7. package/dist/cjs/throttle-5674040a.js.map +1 -0
  8. package/dist/collection/components/overlay/revogr-overlay-selection.js +2 -2
  9. package/dist/collection/components/revoGrid/revo-grid.js +2 -2
  10. package/dist/collection/components/revoGrid/viewport.resize.service.js +19 -4
  11. package/dist/collection/components/revoGrid/viewport.resize.service.js.map +1 -1
  12. package/dist/collection/components/scroll/revogr-viewport-scroll.js +38 -31
  13. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -1
  14. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +23 -8
  15. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
  16. package/dist/collection/plugins/filter/filter.panel.js +8 -4
  17. package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
  18. package/dist/collection/plugins/filter/filter.types.js +7 -0
  19. package/dist/collection/plugins/filter/filter.types.js.map +1 -1
  20. package/dist/collection/services/local.scroll.service.js +3 -0
  21. package/dist/collection/services/local.scroll.service.js.map +1 -1
  22. package/dist/collection/types/interfaces.js.map +1 -1
  23. package/dist/esm/revogr-attribution_7.entry.js +23 -8
  24. package/dist/esm/revogr-attribution_7.entry.js.map +1 -1
  25. package/dist/esm/revogr-data_4.entry.js +58 -36
  26. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  27. package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
  28. package/dist/esm/{throttle-05489451.js → throttle-dec28f5b.js} +4 -1
  29. package/dist/esm/throttle-dec28f5b.js.map +1 -0
  30. package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
  31. package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -1
  32. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  33. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  34. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
  35. package/dist/revo-grid/throttle-dec28f5b.js +5 -0
  36. package/dist/revo-grid/throttle-dec28f5b.js.map +1 -0
  37. package/dist/types/components/revoGrid/viewport.resize.service.d.ts +8 -6
  38. package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +2 -2
  39. package/dist/types/components.d.ts +2 -2
  40. package/dist/types/plugins/filter/filter.panel.d.ts +1 -1
  41. package/dist/types/plugins/filter/filter.types.d.ts +19 -19
  42. package/dist/types/types/interfaces.d.ts +6 -6
  43. package/hydrate/index.js +82 -42
  44. package/hydrate/index.mjs +82 -42
  45. package/package.json +1 -1
  46. package/standalone/local.scroll.timer.js +3 -0
  47. package/standalone/local.scroll.timer.js.map +1 -1
  48. package/standalone/revogr-filter-panel.js.map +1 -1
  49. package/standalone/revogr-scroll-virtual2.js +22 -7
  50. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  51. package/standalone/revogr-viewport-scroll2.js +57 -35
  52. package/standalone/revogr-viewport-scroll2.js.map +1 -1
  53. package/dist/cjs/throttle-08957661.js.map +0 -1
  54. package/dist/esm/throttle-05489451.js.map +0 -1
  55. package/dist/revo-grid/throttle-05489451.js +0 -5
  56. package/dist/revo-grid/throttle-05489451.js.map +0 -1
@@ -1,11 +1,13 @@
1
- interface Events {
2
- resize(entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver): void;
3
- }
1
+ type ResizeEntry = {
2
+ width: number;
3
+ height: number;
4
+ };
4
5
  export default class GridResizeService {
5
- private events;
6
+ private readonly resize;
6
7
  private resizeObserver;
7
- private resize;
8
- constructor(el: HTMLElement, events: Events);
8
+ private previousSize;
9
+ private readonly apply;
10
+ constructor(el: HTMLElement, resize: (entry: ResizeEntry, previousSize: ResizeEntry) => void);
9
11
  init(el: HTMLElement): Promise<void>;
10
12
  destroy(): void;
11
13
  }
@@ -15,7 +15,7 @@ type LocalScrollEvent = {
15
15
  export declare class RevogrViewportScroll implements ElementScroll {
16
16
  /**
17
17
  * Enable row header
18
- */
18
+ */
19
19
  readonly rowHeader: boolean;
20
20
  /**
21
21
  * Width of inner content
@@ -44,7 +44,7 @@ export declare class RevogrViewportScroll implements ElementScroll {
44
44
  /**
45
45
  * Silently scroll to coordinate
46
46
  * Made to align negative coordinates for mobile devices
47
- */
47
+ */
48
48
  silentScroll: EventEmitter<ViewPortScrollEvent>;
49
49
  horizontalScroll: HTMLElement;
50
50
  private verticalScroll?;
@@ -443,7 +443,7 @@ export namespace Components {
443
443
  * Disables dynamic filtering. A way to apply filters on Save only
444
444
  */
445
445
  "disableDynamicFiltering": boolean;
446
- "filterCaptions": FilterCaptions | undefined;
446
+ "filterCaptions": Partial<FilterCaptions> | undefined;
447
447
  "filterEntities": Record<string, LogicFunction>;
448
448
  "filterNames": Record<string, string>;
449
449
  "getChanges": () => Promise<ShowData | undefined>;
@@ -1835,7 +1835,7 @@ declare namespace LocalJSX {
1835
1835
  * Disables dynamic filtering. A way to apply filters on Save only
1836
1836
  */
1837
1837
  "disableDynamicFiltering"?: boolean;
1838
- "filterCaptions"?: FilterCaptions | undefined;
1838
+ "filterCaptions"?: Partial<FilterCaptions> | undefined;
1839
1839
  "filterEntities"?: Record<string, LogicFunction>;
1840
1840
  "filterNames"?: Record<string, string>;
1841
1841
  "onFilterChange"?: (event: RevogrFilterPanelCustomEvent<MultiFilterItem>) => void;
@@ -20,7 +20,7 @@ export declare class FilterPanel {
20
20
  filterItems: MultiFilterItem;
21
21
  filterNames: Record<string, string>;
22
22
  filterEntities: Record<string, LogicFunction>;
23
- filterCaptions: FilterCaptions | undefined;
23
+ filterCaptions: Partial<FilterCaptions> | undefined;
24
24
  /**
25
25
  * Disables dynamic filtering. A way to apply filters on Save only
26
26
  */
@@ -4,11 +4,11 @@ export type DateEnum = 'today' | 'yesterday' | 'tomorrow' | 'thisweek' | 'lastwe
4
4
  export type ExtraField = 'input' | 'select' | 'multi' | 'datepicker';
5
5
  export type LogicFunctionParam = any;
6
6
  export type LogicFunctionExtraParam = 'select' | 'input' | 'multi' | 'datepicker' | number | Date | DateEnum | null | undefined | string | string[] | number[];
7
- export type LogicFunction<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> = {
7
+ export interface LogicFunction<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> {
8
8
  (value: T1, extra?: T2): boolean;
9
9
  extra?: ExtraField;
10
- };
11
- export type CustomFilter<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> = {
10
+ }
11
+ export interface CustomFilter<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam> {
12
12
  /**
13
13
  * Property defined in column { filter: string/number/abstract/enum...etc }
14
14
  */
@@ -21,8 +21,8 @@ export type CustomFilter<T1 = LogicFunctionParam, T2 = LogicFunctionExtraParam>
21
21
  * Function to apply the filter
22
22
  */
23
23
  func: LogicFunction<T1, T2>;
24
- };
25
- export type FilterCaptions = {
24
+ }
25
+ export interface FilterCaptions {
26
26
  title: string;
27
27
  save: string;
28
28
  reset: string;
@@ -32,15 +32,15 @@ export type FilterCaptions = {
32
32
  placeholder: string;
33
33
  and: string;
34
34
  or: string;
35
- };
36
- export type FilterLocalization = {
37
- captions: FilterCaptions;
35
+ }
36
+ export interface FilterLocalization {
37
+ captions: Partial<FilterCaptions>;
38
38
  filterNames: Record<FilterType, string>;
39
- };
39
+ }
40
40
  /**
41
41
  * Filter configuration for a column. This is the type of the `filter` property on a column.
42
42
  */
43
- export type ColumnFilterConfig = {
43
+ export interface ColumnFilterConfig {
44
44
  /**
45
45
  * The collection of filters to be applied to the column.
46
46
  */
@@ -70,17 +70,17 @@ export type ColumnFilterConfig = {
70
70
  * when the user clicks on the filter button.
71
71
  */
72
72
  disableDynamicFiltering?: boolean;
73
- };
73
+ }
74
74
  export type FilterCollectionItem = {
75
75
  type: FilterType;
76
76
  value?: any;
77
77
  };
78
- export type FilterItem = {
78
+ export interface FilterItem {
79
79
  prop?: ColumnProp;
80
80
  type?: FilterType;
81
81
  value?: any;
82
- };
83
- export type FilterData = {
82
+ }
83
+ export interface FilterData {
84
84
  id: number;
85
85
  /**
86
86
  * Filter type
@@ -98,11 +98,11 @@ export type FilterData = {
98
98
  * Filter relation
99
99
  */
100
100
  relation?: 'and' | 'or';
101
- };
102
- export type MultiFilterItem = {
101
+ }
102
+ export interface MultiFilterItem {
103
103
  [prop: string]: FilterData[];
104
- };
105
- export type ShowData = {
104
+ }
105
+ export interface ShowData extends FilterItem, Omit<ColumnRegular, 'filter'> {
106
106
  x: number;
107
107
  y: number;
108
108
  /**
@@ -113,4 +113,4 @@ export type ShowData = {
113
113
  filterItems?: MultiFilterItem;
114
114
  hideDefaultFilters?: boolean;
115
115
  extraContent?: (data: ShowData) => any;
116
- } & FilterItem & Omit<ColumnRegular, 'filter'>;
116
+ }
@@ -74,7 +74,7 @@ export type RowDrag = boolean | {
74
74
  /**
75
75
  * `ColumnGrouping` type is used to define a grouping in a column.
76
76
  */
77
- export type ColumnGrouping<T = any> = {
77
+ export interface ColumnGrouping<T = any> {
78
78
  /**
79
79
  * An array of objects that represent the children of the grouping.
80
80
  */
@@ -83,7 +83,7 @@ export type ColumnGrouping<T = any> = {
83
83
  * A `DataFormat` object that represents the name of the grouping.
84
84
  */
85
85
  name: DataFormat<T>;
86
- };
86
+ }
87
87
  /**
88
88
  * Configuration for header inner template properties
89
89
  */
@@ -727,14 +727,14 @@ export type ScrollCoordinateEvent = {
727
727
  coordinate: number;
728
728
  };
729
729
  /** Range paste. */
730
- export type RangeClipboardPasteEvent = {
730
+ export interface RangeClipboardPasteEvent extends AllDimensionType {
731
731
  data: DataLookup;
732
732
  models: Partial<DataLookup>;
733
733
  range: RangeArea | null;
734
- } & AllDimensionType;
734
+ }
735
735
  /** Range copy. */
736
- export type RangeClipboardCopyEventProps<T = any> = {
736
+ export interface RangeClipboardCopyEventProps<T = any> extends AllDimensionType {
737
737
  data: DataFormat<T>[][];
738
738
  range: RangeArea;
739
739
  mapping: OldNewRangeMapping;
740
- } & AllDimensionType;
740
+ }
package/hydrate/index.js CHANGED
@@ -16327,6 +16327,9 @@ const NO_COORDINATE = -1;
16327
16327
  * return full size
16328
16328
  */
16329
16329
  function getContentSize(contentSize, clientSize, virtualSize = 0) {
16330
+ if (virtualSize > contentSize) {
16331
+ return 0;
16332
+ }
16330
16333
  return contentSize + (virtualSize ? clientSize - virtualSize : 0);
16331
16334
  }
16332
16335
  class LocalScrollService {
@@ -16594,15 +16597,31 @@ class RevogrScrollVirtual {
16594
16597
  }
16595
16598
  componentDidRender() {
16596
16599
  const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
16597
- if (this.element[type] > this.size) {
16598
- this.size = this.scrollSize;
16600
+ // Get scrollbar size once during component initialization
16601
+ const scrollbarSize = this.scrollSize;
16602
+ // Calculate if content exceeds viewport size
16603
+ // Add scrollbar size to the comparison to account for other dimension's scrollbar
16604
+ const hasScroll = this.element[type] > this.size + scrollbarSize;
16605
+ // Set scroll size based on whether scroll is needed
16606
+ this.size = hasScroll ? this.scrollSize : 0;
16607
+ let additionalScrollbarSize = 0;
16608
+ if (this.dimension === 'rgRow') {
16609
+ additionalScrollbarSize =
16610
+ this.element.scrollWidth > this.element.clientWidth
16611
+ ? scrollbarSize
16612
+ : 0;
16599
16613
  }
16600
16614
  else {
16601
- this.size = 0;
16615
+ additionalScrollbarSize =
16616
+ this.element.scrollHeight > this.element.clientHeight
16617
+ ? scrollbarSize
16618
+ : 0;
16602
16619
  }
16620
+ const clientSize = this.size + additionalScrollbarSize;
16603
16621
  this.localScrollService.setParams({
16604
16622
  contentSize: this.dimensionStore.get('realSize'),
16605
- clientSize: this.size,
16623
+ // Add scrollbar size to clientSize if other dimension has scroll
16624
+ clientSize,
16606
16625
  virtualSize: this.viewportStore.get('clientSize'),
16607
16626
  }, this.dimension);
16608
16627
  }
@@ -16623,9 +16642,8 @@ class RevogrScrollVirtual {
16623
16642
  }
16624
16643
  render() {
16625
16644
  const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
16626
- const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize') // content viewport size
16627
- );
16628
- return (hAsync(Host, { key: '2d11902403db45b805bde88b6fc40acff4b6b910', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '74978e90cbf66e3fb6dcc25bd5882346f1515c39', style: {
16645
+ const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize'));
16646
+ return (hAsync(Host, { key: '7789bd408d3e154836bcd2aed4ebaa1663e7f968', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '40549da97df3a580ad2ddef13fe7b4dbe6df54bc', style: {
16629
16647
  [sizeType]: `${size}px`,
16630
16648
  } })));
16631
16649
  }
@@ -16655,16 +16673,31 @@ async function resizeObserver$1() {
16655
16673
  }
16656
16674
 
16657
16675
  class GridResizeService {
16658
- constructor(el, events) {
16659
- this.events = events;
16676
+ constructor(el, resize) {
16677
+ this.resize = resize;
16660
16678
  this.resizeObserver = null;
16661
- this.resize = throttle((e, o) => { var _a; return (_a = this.events) === null || _a === void 0 ? void 0 : _a.resize(e, o); }, 10);
16679
+ this.previousSize = {
16680
+ width: 0,
16681
+ height: 0,
16682
+ };
16683
+ this.apply = throttle((e) => {
16684
+ var _a;
16685
+ if (!e.length) {
16686
+ return;
16687
+ }
16688
+ const entry = {
16689
+ width: e[0].contentRect.width,
16690
+ height: e[0].contentRect.height,
16691
+ };
16692
+ (_a = this.resize) === null || _a === void 0 ? void 0 : _a.call(this, entry, this.previousSize);
16693
+ this.previousSize = entry;
16694
+ }, 10);
16662
16695
  this.init(el);
16663
16696
  }
16664
16697
  async init(el) {
16665
16698
  var _a;
16666
16699
  await resizeObserver$1();
16667
- this.resizeObserver = new ResizeObserver(this.resize);
16700
+ this.resizeObserver = new ResizeObserver(this.apply);
16668
16701
  (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
16669
16702
  }
16670
16703
  destroy() {
@@ -16786,38 +16819,45 @@ class RevogrViewportScroll {
16786
16819
  }
16787
16820
  componentDidLoad() {
16788
16821
  // track horizontal viewport resize
16789
- this.resizeService = new GridResizeService(this.horizontalScroll, {
16790
- resize: entries => {
16791
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16792
- let height = ((_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect.height) || 0;
16822
+ this.resizeService = new GridResizeService(this.horizontalScroll, (entry, previousSize) => {
16823
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16824
+ const els = {};
16825
+ if (entry.height !== previousSize.height) {
16826
+ let height = entry.height || 0;
16793
16827
  if (height) {
16794
- height -= ((_c = (_b = this.header) === null || _b === void 0 ? void 0 : _b.clientHeight) !== null && _c !== void 0 ? _c : 0) + ((_e = (_d = this.footer) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 0);
16828
+ height -=
16829
+ ((_b = (_a = this.header) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0) +
16830
+ ((_d = (_c = this.footer) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0);
16795
16831
  }
16796
- const els = {
16797
- rgRow: {
16798
- size: height,
16799
- contentSize: this.contentHeight,
16800
- scroll: (_f = this.verticalScroll) === null || _f === void 0 ? void 0 : _f.scrollTop,
16801
- noScroll: false,
16802
- },
16803
- rgCol: {
16804
- size: ((_g = entries[0]) === null || _g === void 0 ? void 0 : _g.contentRect.width) || 0,
16805
- contentSize: this.contentWidth,
16806
- scroll: this.horizontalScroll.scrollLeft,
16807
- noScroll: this.colType !== 'rgCol',
16808
- },
16832
+ els.rgRow = {
16833
+ size: height,
16834
+ contentSize: this.contentHeight,
16835
+ scroll: (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollTop) !== null && _f !== void 0 ? _f : 0,
16836
+ noScroll: false,
16809
16837
  };
16810
- for (const [dim, item] of Object.entries(els)) {
16811
- const dimension = dim;
16812
- this.resizeViewport.emit({ dimension, size: item.size, rowHeader: this.rowHeader });
16813
- if (item.noScroll) {
16814
- continue;
16815
- }
16816
- (_h = this.localScrollService) === null || _h === void 0 ? void 0 : _h.scroll((_j = item.scroll) !== null && _j !== void 0 ? _j : 0, dimension, true);
16817
- // track scroll visibility on outer element change
16818
- this.setScrollVisibility(dimension, item.size, item.contentSize);
16838
+ }
16839
+ if (entry.width !== previousSize.width) {
16840
+ els.rgCol = {
16841
+ size: entry.width || 0,
16842
+ contentSize: this.contentWidth,
16843
+ scroll: this.horizontalScroll.scrollLeft,
16844
+ noScroll: this.colType !== 'rgCol',
16845
+ };
16846
+ }
16847
+ for (const [dim, item] of Object.entries(els)) {
16848
+ const dimension = dim;
16849
+ this.resizeViewport.emit({
16850
+ dimension,
16851
+ size: item.size,
16852
+ rowHeader: this.rowHeader,
16853
+ });
16854
+ if (item.noScroll) {
16855
+ continue;
16819
16856
  }
16820
- },
16857
+ (_g = this.localScrollService) === null || _g === void 0 ? void 0 : _g.scroll((_h = item.scroll) !== null && _h !== void 0 ? _h : 0, dimension, true);
16858
+ // track scroll visibility on outer element change
16859
+ this.setScrollVisibility(dimension, item.size, item.contentSize);
16860
+ }
16821
16861
  });
16822
16862
  }
16823
16863
  /**
@@ -16870,7 +16910,7 @@ class RevogrViewportScroll {
16870
16910
  this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
16871
16911
  }
16872
16912
  render() {
16873
- return (hAsync(Host, { key: '9727a9c83d740d8184e12acc06b72c3f28c3b5ac', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '44551981dda7401ac9290d003b1ac7e7f55ee006', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, hAsync("div", { key: '8b4962c352e81c343aed7136b7f7a9d71b10ed70', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '789868b91507bc50c18dc99c6bec8f1e4699cbab', name: HEADER_SLOT })), hAsync("div", { key: '0efb49db3fbcbe0bdfcfa24afad495c681de6218', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'eef434a04062b364805702d73c0b28c9e44a27c5', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, hAsync("slot", { key: '8490b9f01abebeeaa46da811e9ecdc62090ecb00', name: CONTENT_SLOT }))), hAsync("div", { key: 'c3c133d6e73816e9e3c33d5091fc00f959977874', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'e4aae0a9eb10c750306a6bd4c222bcab6d1050e3', name: FOOTER_SLOT })))));
16913
+ return (hAsync(Host, { key: '970ac2365588d1c894d9684113eb9beaf64e1a1d', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: 'dc57aab1bde4496e83131d80a7e189db25b93312', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, hAsync("div", { key: 'bd014cf0a67bb913016f00f7838344611a1b26df', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '772eb408b6ea670624cc338550215565ec36ef89', name: HEADER_SLOT })), hAsync("div", { key: '5dcf061c78864b0dc4e4ffbcc28c0ebb3536ce8b', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'b45f46aedefe82843b086cdca822e05339a77fda', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, hAsync("slot", { key: '8d07196c79741ace0f4c734138d69abdf96fee4f', name: CONTENT_SLOT }))), hAsync("div", { key: 'f6313f9394e99a3ad07895ed06e965540268b35a', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'b1bcdb75bb5e4dcc1e43493d7b4f01b2578352e4', name: FOOTER_SLOT })))));
16874
16914
  }
16875
16915
  /**
16876
16916
  * Extra layer for scroll event monitoring, where MouseWheel event is not passing
@@ -16918,7 +16958,7 @@ class RevogrViewportScroll {
16918
16958
  const clientHeight = (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0;
16919
16959
  const scrollHeight = (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollHeight) !== null && _f !== void 0 ? _f : 0;
16920
16960
  // Detect if the user has reached the bottom
16921
- const atBottom = (scrollTop + clientHeight >= scrollHeight) && e.deltaY > 0;
16961
+ const atBottom = scrollTop + clientHeight >= scrollHeight && e.deltaY > 0;
16922
16962
  const atTop = scrollTop === 0 && e.deltaY < 0;
16923
16963
  if (!atBottom && !atTop) {
16924
16964
  (_g = e.preventDefault) === null || _g === void 0 ? void 0 : _g.call(e);
@@ -16940,7 +16980,7 @@ class RevogrViewportScroll {
16940
16980
  }
16941
16981
  const { scrollLeft, scrollWidth, clientWidth } = this.horizontalScroll;
16942
16982
  // Detect if the user has reached the right end
16943
- const atRight = (scrollLeft + clientWidth >= scrollWidth) && e.deltaX > 0;
16983
+ const atRight = scrollLeft + clientWidth >= scrollWidth && e.deltaX > 0;
16944
16984
  // Detect if the user has reached the left end
16945
16985
  const atLeft = scrollLeft === 0 && e.deltaX < 0;
16946
16986
  if (!atRight && !atLeft) {
package/hydrate/index.mjs CHANGED
@@ -16323,6 +16323,9 @@ const NO_COORDINATE = -1;
16323
16323
  * return full size
16324
16324
  */
16325
16325
  function getContentSize(contentSize, clientSize, virtualSize = 0) {
16326
+ if (virtualSize > contentSize) {
16327
+ return 0;
16328
+ }
16326
16329
  return contentSize + (virtualSize ? clientSize - virtualSize : 0);
16327
16330
  }
16328
16331
  class LocalScrollService {
@@ -16590,15 +16593,31 @@ class RevogrScrollVirtual {
16590
16593
  }
16591
16594
  componentDidRender() {
16592
16595
  const type = this.dimension === 'rgRow' ? 'scrollHeight' : 'scrollWidth';
16593
- if (this.element[type] > this.size) {
16594
- this.size = this.scrollSize;
16596
+ // Get scrollbar size once during component initialization
16597
+ const scrollbarSize = this.scrollSize;
16598
+ // Calculate if content exceeds viewport size
16599
+ // Add scrollbar size to the comparison to account for other dimension's scrollbar
16600
+ const hasScroll = this.element[type] > this.size + scrollbarSize;
16601
+ // Set scroll size based on whether scroll is needed
16602
+ this.size = hasScroll ? this.scrollSize : 0;
16603
+ let additionalScrollbarSize = 0;
16604
+ if (this.dimension === 'rgRow') {
16605
+ additionalScrollbarSize =
16606
+ this.element.scrollWidth > this.element.clientWidth
16607
+ ? scrollbarSize
16608
+ : 0;
16595
16609
  }
16596
16610
  else {
16597
- this.size = 0;
16611
+ additionalScrollbarSize =
16612
+ this.element.scrollHeight > this.element.clientHeight
16613
+ ? scrollbarSize
16614
+ : 0;
16598
16615
  }
16616
+ const clientSize = this.size + additionalScrollbarSize;
16599
16617
  this.localScrollService.setParams({
16600
16618
  contentSize: this.dimensionStore.get('realSize'),
16601
- clientSize: this.size,
16619
+ // Add scrollbar size to clientSize if other dimension has scroll
16620
+ clientSize,
16602
16621
  virtualSize: this.viewportStore.get('clientSize'),
16603
16622
  }, this.dimension);
16604
16623
  }
@@ -16619,9 +16638,8 @@ class RevogrScrollVirtual {
16619
16638
  }
16620
16639
  render() {
16621
16640
  const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
16622
- const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize') // content viewport size
16623
- );
16624
- return (hAsync(Host, { key: '2d11902403db45b805bde88b6fc40acff4b6b910', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '74978e90cbf66e3fb6dcc25bd5882346f1515c39', style: {
16641
+ const size = getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('clientSize'));
16642
+ return (hAsync(Host, { key: '7789bd408d3e154836bcd2aed4ebaa1663e7f968', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '40549da97df3a580ad2ddef13fe7b4dbe6df54bc', style: {
16625
16643
  [sizeType]: `${size}px`,
16626
16644
  } })));
16627
16645
  }
@@ -16651,16 +16669,31 @@ async function resizeObserver$1() {
16651
16669
  }
16652
16670
 
16653
16671
  class GridResizeService {
16654
- constructor(el, events) {
16655
- this.events = events;
16672
+ constructor(el, resize) {
16673
+ this.resize = resize;
16656
16674
  this.resizeObserver = null;
16657
- this.resize = throttle((e, o) => { var _a; return (_a = this.events) === null || _a === void 0 ? void 0 : _a.resize(e, o); }, 10);
16675
+ this.previousSize = {
16676
+ width: 0,
16677
+ height: 0,
16678
+ };
16679
+ this.apply = throttle((e) => {
16680
+ var _a;
16681
+ if (!e.length) {
16682
+ return;
16683
+ }
16684
+ const entry = {
16685
+ width: e[0].contentRect.width,
16686
+ height: e[0].contentRect.height,
16687
+ };
16688
+ (_a = this.resize) === null || _a === void 0 ? void 0 : _a.call(this, entry, this.previousSize);
16689
+ this.previousSize = entry;
16690
+ }, 10);
16658
16691
  this.init(el);
16659
16692
  }
16660
16693
  async init(el) {
16661
16694
  var _a;
16662
16695
  await resizeObserver$1();
16663
- this.resizeObserver = new ResizeObserver(this.resize);
16696
+ this.resizeObserver = new ResizeObserver(this.apply);
16664
16697
  (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.observe(el);
16665
16698
  }
16666
16699
  destroy() {
@@ -16782,38 +16815,45 @@ class RevogrViewportScroll {
16782
16815
  }
16783
16816
  componentDidLoad() {
16784
16817
  // track horizontal viewport resize
16785
- this.resizeService = new GridResizeService(this.horizontalScroll, {
16786
- resize: entries => {
16787
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16788
- let height = ((_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect.height) || 0;
16818
+ this.resizeService = new GridResizeService(this.horizontalScroll, (entry, previousSize) => {
16819
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16820
+ const els = {};
16821
+ if (entry.height !== previousSize.height) {
16822
+ let height = entry.height || 0;
16789
16823
  if (height) {
16790
- height -= ((_c = (_b = this.header) === null || _b === void 0 ? void 0 : _b.clientHeight) !== null && _c !== void 0 ? _c : 0) + ((_e = (_d = this.footer) === null || _d === void 0 ? void 0 : _d.clientHeight) !== null && _e !== void 0 ? _e : 0);
16824
+ height -=
16825
+ ((_b = (_a = this.header) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0) +
16826
+ ((_d = (_c = this.footer) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0);
16791
16827
  }
16792
- const els = {
16793
- rgRow: {
16794
- size: height,
16795
- contentSize: this.contentHeight,
16796
- scroll: (_f = this.verticalScroll) === null || _f === void 0 ? void 0 : _f.scrollTop,
16797
- noScroll: false,
16798
- },
16799
- rgCol: {
16800
- size: ((_g = entries[0]) === null || _g === void 0 ? void 0 : _g.contentRect.width) || 0,
16801
- contentSize: this.contentWidth,
16802
- scroll: this.horizontalScroll.scrollLeft,
16803
- noScroll: this.colType !== 'rgCol',
16804
- },
16828
+ els.rgRow = {
16829
+ size: height,
16830
+ contentSize: this.contentHeight,
16831
+ scroll: (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollTop) !== null && _f !== void 0 ? _f : 0,
16832
+ noScroll: false,
16805
16833
  };
16806
- for (const [dim, item] of Object.entries(els)) {
16807
- const dimension = dim;
16808
- this.resizeViewport.emit({ dimension, size: item.size, rowHeader: this.rowHeader });
16809
- if (item.noScroll) {
16810
- continue;
16811
- }
16812
- (_h = this.localScrollService) === null || _h === void 0 ? void 0 : _h.scroll((_j = item.scroll) !== null && _j !== void 0 ? _j : 0, dimension, true);
16813
- // track scroll visibility on outer element change
16814
- this.setScrollVisibility(dimension, item.size, item.contentSize);
16834
+ }
16835
+ if (entry.width !== previousSize.width) {
16836
+ els.rgCol = {
16837
+ size: entry.width || 0,
16838
+ contentSize: this.contentWidth,
16839
+ scroll: this.horizontalScroll.scrollLeft,
16840
+ noScroll: this.colType !== 'rgCol',
16841
+ };
16842
+ }
16843
+ for (const [dim, item] of Object.entries(els)) {
16844
+ const dimension = dim;
16845
+ this.resizeViewport.emit({
16846
+ dimension,
16847
+ size: item.size,
16848
+ rowHeader: this.rowHeader,
16849
+ });
16850
+ if (item.noScroll) {
16851
+ continue;
16815
16852
  }
16816
- },
16853
+ (_g = this.localScrollService) === null || _g === void 0 ? void 0 : _g.scroll((_h = item.scroll) !== null && _h !== void 0 ? _h : 0, dimension, true);
16854
+ // track scroll visibility on outer element change
16855
+ this.setScrollVisibility(dimension, item.size, item.contentSize);
16856
+ }
16817
16857
  });
16818
16858
  }
16819
16859
  /**
@@ -16866,7 +16906,7 @@ class RevogrViewportScroll {
16866
16906
  this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
16867
16907
  }
16868
16908
  render() {
16869
- return (hAsync(Host, { key: '9727a9c83d740d8184e12acc06b72c3f28c3b5ac', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: '44551981dda7401ac9290d003b1ac7e7f55ee006', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, hAsync("div", { key: '8b4962c352e81c343aed7136b7f7a9d71b10ed70', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '789868b91507bc50c18dc99c6bec8f1e4699cbab', name: HEADER_SLOT })), hAsync("div", { key: '0efb49db3fbcbe0bdfcfa24afad495c681de6218', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'eef434a04062b364805702d73c0b28c9e44a27c5', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, hAsync("slot", { key: '8490b9f01abebeeaa46da811e9ecdc62090ecb00', name: CONTENT_SLOT }))), hAsync("div", { key: 'c3c133d6e73816e9e3c33d5091fc00f959977874', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'e4aae0a9eb10c750306a6bd4c222bcab6d1050e3', name: FOOTER_SLOT })))));
16909
+ return (hAsync(Host, { key: '970ac2365588d1c894d9684113eb9beaf64e1a1d', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: 'dc57aab1bde4496e83131d80a7e189db25b93312', class: "inner-content-table", style: { width: `${this.contentWidth}px` } }, hAsync("div", { key: 'bd014cf0a67bb913016f00f7838344611a1b26df', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '772eb408b6ea670624cc338550215565ec36ef89', name: HEADER_SLOT })), hAsync("div", { key: '5dcf061c78864b0dc4e4ffbcc28c0ebb3536ce8b', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'b45f46aedefe82843b086cdca822e05339a77fda', class: "content-wrapper", style: { height: `${this.contentHeight}px` } }, hAsync("slot", { key: '8d07196c79741ace0f4c734138d69abdf96fee4f', name: CONTENT_SLOT }))), hAsync("div", { key: 'f6313f9394e99a3ad07895ed06e965540268b35a', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: 'b1bcdb75bb5e4dcc1e43493d7b4f01b2578352e4', name: FOOTER_SLOT })))));
16870
16910
  }
16871
16911
  /**
16872
16912
  * Extra layer for scroll event monitoring, where MouseWheel event is not passing
@@ -16914,7 +16954,7 @@ class RevogrViewportScroll {
16914
16954
  const clientHeight = (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0;
16915
16955
  const scrollHeight = (_f = (_e = this.verticalScroll) === null || _e === void 0 ? void 0 : _e.scrollHeight) !== null && _f !== void 0 ? _f : 0;
16916
16956
  // Detect if the user has reached the bottom
16917
- const atBottom = (scrollTop + clientHeight >= scrollHeight) && e.deltaY > 0;
16957
+ const atBottom = scrollTop + clientHeight >= scrollHeight && e.deltaY > 0;
16918
16958
  const atTop = scrollTop === 0 && e.deltaY < 0;
16919
16959
  if (!atBottom && !atTop) {
16920
16960
  (_g = e.preventDefault) === null || _g === void 0 ? void 0 : _g.call(e);
@@ -16936,7 +16976,7 @@ class RevogrViewportScroll {
16936
16976
  }
16937
16977
  const { scrollLeft, scrollWidth, clientWidth } = this.horizontalScroll;
16938
16978
  // Detect if the user has reached the right end
16939
- const atRight = (scrollLeft + clientWidth >= scrollWidth) && e.deltaX > 0;
16979
+ const atRight = scrollLeft + clientWidth >= scrollWidth && e.deltaX > 0;
16940
16980
  // Detect if the user has reached the left end
16941
16981
  const atLeft = scrollLeft === 0 && e.deltaX < 0;
16942
16982
  if (!atRight && !atLeft) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revolist/revogrid",
3
- "version": "4.12.4",
3
+ "version": "4.12.6",
4
4
  "type": "module",
5
5
  "description": "Virtual reactive data grid spreadsheet component - RevoGrid.",
6
6
  "license": "MIT",
@@ -15,6 +15,9 @@ const NO_COORDINATE = -1;
15
15
  * return full size
16
16
  */
17
17
  function getContentSize(contentSize, clientSize, virtualSize = 0) {
18
+ if (virtualSize > contentSize) {
19
+ return 0;
20
+ }
18
21
  return contentSize + (virtualSize ? clientSize - virtualSize : 0);
19
22
  }
20
23
  class LocalScrollService {