@revolist/revogrid 4.23.3 → 4.23.4
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.
- package/dist/cjs/{column.drag.plugin-DJueWxN_.js → column.drag.plugin-_W9mYaRy.js} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/revo-grid.cjs.entry.js +12 -3
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +16 -5
- package/dist/cjs/{viewport.store-BlKQ4x9H.js → viewport.store-BscUCiUk.js} +23 -0
- package/dist/collection/components/revoGrid/viewport.resize.service.js +1 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +15 -5
- package/dist/collection/services/dimension.provider.js +11 -2
- package/dist/collection/store/vp/viewport.helpers.js +23 -0
- package/dist/{revo-grid/column.drag.plugin-DCZW62Uc.js → esm/column.drag.plugin-B9t9kBO5.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/revo-grid.entry.js +12 -3
- package/dist/esm/revogr-attribution_7.entry.js +1 -1
- package/dist/esm/revogr-data_4.entry.js +16 -5
- package/dist/{revo-grid/viewport.store-COAfzAyu.js → esm/viewport.store-_c579YyM.js} +23 -0
- package/dist/{esm/column.drag.plugin-DCZW62Uc.js → revo-grid/column.drag.plugin-B9t9kBO5.js} +1 -1
- package/dist/revo-grid/index.esm.js +3 -3
- package/dist/revo-grid/revo-grid.entry.js +12 -3
- package/dist/revo-grid/revogr-attribution_7.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +16 -5
- package/dist/{esm/viewport.store-COAfzAyu.js → revo-grid/viewport.store-_c579YyM.js} +23 -0
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +1 -0
- package/dist/types/services/scroll.dimension.helpers.d.ts +19 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +23 -0
- package/hydrate/index.js +49 -6
- package/hydrate/index.mjs +49 -6
- package/package.json +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
|
@@ -90,6 +90,7 @@ export declare class RevogrViewportScroll implements ElementScroll {
|
|
|
90
90
|
setScrollVisibility(type: DimensionType, size: number, innerContentSize: number): void;
|
|
91
91
|
disconnectedCallback(): void;
|
|
92
92
|
componentDidRender(): Promise<void>;
|
|
93
|
+
private setScrollParams;
|
|
93
94
|
render(): any;
|
|
94
95
|
/**
|
|
95
96
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
|
@@ -5,11 +5,30 @@ export type ScrollDimensionInput = {
|
|
|
5
5
|
maxScrollSize?: number;
|
|
6
6
|
};
|
|
7
7
|
export type ScrollDimension = {
|
|
8
|
+
/**
|
|
9
|
+
* Real logical grid content size
|
|
10
|
+
* e.g. 1_000_000 rows * 46px = 46_000_000px.
|
|
11
|
+
*/
|
|
8
12
|
contentSize: number;
|
|
13
|
+
/**
|
|
14
|
+
* Visible viewport size provided by the browser
|
|
15
|
+
* e.g. 600px height of the scrollable container.
|
|
16
|
+
*/
|
|
9
17
|
clientSize: number;
|
|
10
18
|
viewportSize: number;
|
|
19
|
+
/**
|
|
20
|
+
* Fake DOM scrollable size that RevoGrid gives the browser scrollbar.
|
|
21
|
+
* Grid maps between physical scrollbar coordinates and logical grid coordinates so rows still represent the full dataset.
|
|
22
|
+
*/
|
|
11
23
|
physicalContentSize: number;
|
|
24
|
+
/**
|
|
25
|
+
* How far the grid should be scrollable logically.
|
|
26
|
+
* contentSize - viewportSize, meaning the largest valid logical scroll coordinate.
|
|
27
|
+
*/
|
|
12
28
|
logicalScrollSize: number;
|
|
29
|
+
/**
|
|
30
|
+
* How far the browser scrollbar can actually move.
|
|
31
|
+
*/
|
|
13
32
|
physicalScrollSize: number;
|
|
14
33
|
isCompressed: boolean;
|
|
15
34
|
toLogicalCoordinate(coordinate: number): number;
|
|
@@ -2,6 +2,29 @@ import type { DimensionSettingsState, PositionItem, ViewSettingSizeProp, Viewpor
|
|
|
2
2
|
export type DimensionDataViewport = Pick<DimensionSettingsState, 'indexes' | 'positionIndexes' | 'positionIndexToItem' | 'sizes' | 'originItemSize' | 'realSize'>;
|
|
3
3
|
export type ItemsToUpdate = Pick<ViewportStateItems, 'items' | 'start' | 'end'>;
|
|
4
4
|
export declare function getViewportMaxCoordinate(dimension: Pick<DimensionSettingsState, 'realSize' | 'originItemSize'>, viewportSize: number, frameOffset?: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Clamp the viewport coordinate within the valid range.
|
|
7
|
+
* Given a scroll position, pick a safe starting point for rendering visible items.
|
|
8
|
+
*
|
|
9
|
+
* Do not use it when you need the exact scroll position for positioning math.
|
|
10
|
+
*
|
|
11
|
+
* It does two things:
|
|
12
|
+
* 1. If the coordinate is below 0, use 0.
|
|
13
|
+
* 2. If the coordinate is too close to the very end, pull it back a bit.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
*
|
|
17
|
+
* content height: 1000px
|
|
18
|
+
* viewport height: 200px
|
|
19
|
+
* row height: 30px
|
|
20
|
+
* The real max scroll is:
|
|
21
|
+
*
|
|
22
|
+
* 1000 - 200 = 800
|
|
23
|
+
* But clampViewportCoordinate may clamp to:
|
|
24
|
+
*
|
|
25
|
+
* 1000 - 200 - 30 = 770
|
|
26
|
+
* Ask for 800 -> it returns 770.
|
|
27
|
+
*/
|
|
5
28
|
export declare function clampViewportCoordinate(coordinate: number, dimension: Pick<DimensionSettingsState, 'realSize' | 'originItemSize'>, viewportSize: number, frameOffset?: number): number;
|
|
6
29
|
/**
|
|
7
30
|
* Update items based on new scroll position
|
package/hydrate/index.js
CHANGED
|
@@ -12051,6 +12051,29 @@ function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
|
12051
12051
|
}
|
|
12052
12052
|
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
12053
12053
|
}
|
|
12054
|
+
/**
|
|
12055
|
+
* Clamp the viewport coordinate within the valid range.
|
|
12056
|
+
* Given a scroll position, pick a safe starting point for rendering visible items.
|
|
12057
|
+
*
|
|
12058
|
+
* Do not use it when you need the exact scroll position for positioning math.
|
|
12059
|
+
*
|
|
12060
|
+
* It does two things:
|
|
12061
|
+
* 1. If the coordinate is below 0, use 0.
|
|
12062
|
+
* 2. If the coordinate is too close to the very end, pull it back a bit.
|
|
12063
|
+
*
|
|
12064
|
+
* Example:
|
|
12065
|
+
*
|
|
12066
|
+
* content height: 1000px
|
|
12067
|
+
* viewport height: 200px
|
|
12068
|
+
* row height: 30px
|
|
12069
|
+
* The real max scroll is:
|
|
12070
|
+
*
|
|
12071
|
+
* 1000 - 200 = 800
|
|
12072
|
+
* But clampViewportCoordinate may clamp to:
|
|
12073
|
+
*
|
|
12074
|
+
* 1000 - 200 - 30 = 770
|
|
12075
|
+
* Ask for 800 -> it returns 770.
|
|
12076
|
+
*/
|
|
12054
12077
|
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
12055
12078
|
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
12056
12079
|
}
|
|
@@ -14946,7 +14969,16 @@ class DimensionProvider {
|
|
|
14946
14969
|
clientSize,
|
|
14947
14970
|
virtualSize: viewportSize,
|
|
14948
14971
|
});
|
|
14949
|
-
|
|
14972
|
+
// Render offset must use the true logical scroll coordinate
|
|
14973
|
+
// It is the logical scroll position that should be used for compressed-scroll offset math.
|
|
14974
|
+
const renderCoordinate = Math.min(Math.max(0, coordinate), // prevents negative scroll positions
|
|
14975
|
+
scrollDimension.logicalScrollSize); // prevents positions past the logical end
|
|
14976
|
+
/**
|
|
14977
|
+
* If viewport sizing is initialized (clientSize and viewportSize are truthy), calculate the offset needed for compressed scroll.
|
|
14978
|
+
* Otherwise keep renderOffset at 0, because there is not enough measurement data yet.
|
|
14979
|
+
*
|
|
14980
|
+
* In normal scrolling, logical and physical coordinates are the same, so offset is 0.
|
|
14981
|
+
*/
|
|
14950
14982
|
const renderOffset = clientSize && viewportSize
|
|
14951
14983
|
? scrollDimension.getRenderOffset(renderCoordinate)
|
|
14952
14984
|
: 0;
|
|
@@ -21603,6 +21635,7 @@ class GridResizeService {
|
|
|
21603
21635
|
}
|
|
21604
21636
|
destroy() {
|
|
21605
21637
|
var _a;
|
|
21638
|
+
this.apply.cancel();
|
|
21606
21639
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
21607
21640
|
this.resizeObserver = null;
|
|
21608
21641
|
}
|
|
@@ -21747,6 +21780,10 @@ class RevogrViewportScroll {
|
|
|
21747
21780
|
scroll: this.horizontalScroll.scrollLeft,
|
|
21748
21781
|
noScroll: this.colType !== 'rgCol',
|
|
21749
21782
|
};
|
|
21783
|
+
this.setScrollParams({
|
|
21784
|
+
rgRow: calculatedHeight,
|
|
21785
|
+
rgCol: calculatedWidth,
|
|
21786
|
+
});
|
|
21750
21787
|
// Process changes in order: width first, then height
|
|
21751
21788
|
const dimensions = ['rgCol', 'rgRow'];
|
|
21752
21789
|
for (const dimension of dimensions) {
|
|
@@ -21803,24 +21840,30 @@ class RevogrViewportScroll {
|
|
|
21803
21840
|
}
|
|
21804
21841
|
async componentDidRender() {
|
|
21805
21842
|
var _a, _b, _c, _d;
|
|
21843
|
+
this.setScrollParams({
|
|
21844
|
+
rgRow: (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0,
|
|
21845
|
+
rgCol: this.horizontalScroll.clientWidth,
|
|
21846
|
+
});
|
|
21847
|
+
this.setScrollVisibility('rgRow', (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0, this.contentHeight);
|
|
21848
|
+
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21849
|
+
}
|
|
21850
|
+
setScrollParams(clientSize) {
|
|
21806
21851
|
this.localScrollService.setParams({
|
|
21807
21852
|
contentSize: this.contentHeight,
|
|
21808
|
-
clientSize:
|
|
21853
|
+
clientSize: clientSize.rgRow,
|
|
21809
21854
|
virtualSize: 0,
|
|
21810
21855
|
}, 'rgRow');
|
|
21811
21856
|
this.localScrollService.setParams({
|
|
21812
21857
|
contentSize: this.contentWidth,
|
|
21813
|
-
clientSize:
|
|
21858
|
+
clientSize: clientSize.rgCol,
|
|
21814
21859
|
virtualSize: 0,
|
|
21815
21860
|
}, 'rgCol');
|
|
21816
|
-
this.setScrollVisibility('rgRow', (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0, this.contentHeight);
|
|
21817
|
-
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21818
21861
|
}
|
|
21819
21862
|
render() {
|
|
21820
21863
|
var _a, _b;
|
|
21821
21864
|
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
21822
21865
|
const physicalContentWidth = getContentSize(this.contentWidth, 0);
|
|
21823
|
-
return (hAsync(Host, { key: '
|
|
21866
|
+
return (hAsync(Host, { key: 'ec8d907976c1d50f7aab3c263be3f0249a274df6', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: 'e35696a7993ac94261426b45c28d488cdc42b7f0', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, hAsync("div", { key: 'a6997451e01eacda1d27d4efa1d74e1748626218', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '1d401e87d32d5b1531c2211723b552bbc894f22c', name: HEADER_SLOT })), hAsync("div", { key: 'ceab6f9e812d6ca9a0aa376afcd2562a17f505e0', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'a9556578a23d6efddec2e982e863aec064042154', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, hAsync("slot", { key: '0ae01f9736b9740612e75261f6e3abebda533377', name: CONTENT_SLOT }))), hAsync("div", { key: '09c2565d4ed449a43820f92d97b6558fca3758e7', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: '1ffb08ff8138a560cc09d82e3fe22a53e502aafe', name: FOOTER_SLOT })))));
|
|
21824
21867
|
}
|
|
21825
21868
|
/**
|
|
21826
21869
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|
package/hydrate/index.mjs
CHANGED
|
@@ -12049,6 +12049,29 @@ function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
|
12049
12049
|
}
|
|
12050
12050
|
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
12051
12051
|
}
|
|
12052
|
+
/**
|
|
12053
|
+
* Clamp the viewport coordinate within the valid range.
|
|
12054
|
+
* Given a scroll position, pick a safe starting point for rendering visible items.
|
|
12055
|
+
*
|
|
12056
|
+
* Do not use it when you need the exact scroll position for positioning math.
|
|
12057
|
+
*
|
|
12058
|
+
* It does two things:
|
|
12059
|
+
* 1. If the coordinate is below 0, use 0.
|
|
12060
|
+
* 2. If the coordinate is too close to the very end, pull it back a bit.
|
|
12061
|
+
*
|
|
12062
|
+
* Example:
|
|
12063
|
+
*
|
|
12064
|
+
* content height: 1000px
|
|
12065
|
+
* viewport height: 200px
|
|
12066
|
+
* row height: 30px
|
|
12067
|
+
* The real max scroll is:
|
|
12068
|
+
*
|
|
12069
|
+
* 1000 - 200 = 800
|
|
12070
|
+
* But clampViewportCoordinate may clamp to:
|
|
12071
|
+
*
|
|
12072
|
+
* 1000 - 200 - 30 = 770
|
|
12073
|
+
* Ask for 800 -> it returns 770.
|
|
12074
|
+
*/
|
|
12052
12075
|
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
12053
12076
|
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
12054
12077
|
}
|
|
@@ -14944,7 +14967,16 @@ class DimensionProvider {
|
|
|
14944
14967
|
clientSize,
|
|
14945
14968
|
virtualSize: viewportSize,
|
|
14946
14969
|
});
|
|
14947
|
-
|
|
14970
|
+
// Render offset must use the true logical scroll coordinate
|
|
14971
|
+
// It is the logical scroll position that should be used for compressed-scroll offset math.
|
|
14972
|
+
const renderCoordinate = Math.min(Math.max(0, coordinate), // prevents negative scroll positions
|
|
14973
|
+
scrollDimension.logicalScrollSize); // prevents positions past the logical end
|
|
14974
|
+
/**
|
|
14975
|
+
* If viewport sizing is initialized (clientSize and viewportSize are truthy), calculate the offset needed for compressed scroll.
|
|
14976
|
+
* Otherwise keep renderOffset at 0, because there is not enough measurement data yet.
|
|
14977
|
+
*
|
|
14978
|
+
* In normal scrolling, logical and physical coordinates are the same, so offset is 0.
|
|
14979
|
+
*/
|
|
14948
14980
|
const renderOffset = clientSize && viewportSize
|
|
14949
14981
|
? scrollDimension.getRenderOffset(renderCoordinate)
|
|
14950
14982
|
: 0;
|
|
@@ -21601,6 +21633,7 @@ class GridResizeService {
|
|
|
21601
21633
|
}
|
|
21602
21634
|
destroy() {
|
|
21603
21635
|
var _a;
|
|
21636
|
+
this.apply.cancel();
|
|
21604
21637
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
21605
21638
|
this.resizeObserver = null;
|
|
21606
21639
|
}
|
|
@@ -21745,6 +21778,10 @@ class RevogrViewportScroll {
|
|
|
21745
21778
|
scroll: this.horizontalScroll.scrollLeft,
|
|
21746
21779
|
noScroll: this.colType !== 'rgCol',
|
|
21747
21780
|
};
|
|
21781
|
+
this.setScrollParams({
|
|
21782
|
+
rgRow: calculatedHeight,
|
|
21783
|
+
rgCol: calculatedWidth,
|
|
21784
|
+
});
|
|
21748
21785
|
// Process changes in order: width first, then height
|
|
21749
21786
|
const dimensions = ['rgCol', 'rgRow'];
|
|
21750
21787
|
for (const dimension of dimensions) {
|
|
@@ -21801,24 +21838,30 @@ class RevogrViewportScroll {
|
|
|
21801
21838
|
}
|
|
21802
21839
|
async componentDidRender() {
|
|
21803
21840
|
var _a, _b, _c, _d;
|
|
21841
|
+
this.setScrollParams({
|
|
21842
|
+
rgRow: (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0,
|
|
21843
|
+
rgCol: this.horizontalScroll.clientWidth,
|
|
21844
|
+
});
|
|
21845
|
+
this.setScrollVisibility('rgRow', (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0, this.contentHeight);
|
|
21846
|
+
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21847
|
+
}
|
|
21848
|
+
setScrollParams(clientSize) {
|
|
21804
21849
|
this.localScrollService.setParams({
|
|
21805
21850
|
contentSize: this.contentHeight,
|
|
21806
|
-
clientSize:
|
|
21851
|
+
clientSize: clientSize.rgRow,
|
|
21807
21852
|
virtualSize: 0,
|
|
21808
21853
|
}, 'rgRow');
|
|
21809
21854
|
this.localScrollService.setParams({
|
|
21810
21855
|
contentSize: this.contentWidth,
|
|
21811
|
-
clientSize:
|
|
21856
|
+
clientSize: clientSize.rgCol,
|
|
21812
21857
|
virtualSize: 0,
|
|
21813
21858
|
}, 'rgCol');
|
|
21814
|
-
this.setScrollVisibility('rgRow', (_d = (_c = this.verticalScroll) === null || _c === void 0 ? void 0 : _c.clientHeight) !== null && _d !== void 0 ? _d : 0, this.contentHeight);
|
|
21815
|
-
this.setScrollVisibility('rgCol', this.horizontalScroll.clientWidth, this.contentWidth);
|
|
21816
21859
|
}
|
|
21817
21860
|
render() {
|
|
21818
21861
|
var _a, _b;
|
|
21819
21862
|
const physicalContentHeight = getContentSize(this.contentHeight, (_b = (_a = this.verticalScroll) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0);
|
|
21820
21863
|
const physicalContentWidth = getContentSize(this.contentWidth, 0);
|
|
21821
|
-
return (hAsync(Host, { key: '
|
|
21864
|
+
return (hAsync(Host, { key: 'ec8d907976c1d50f7aab3c263be3f0249a274df6', onWheel: this.horizontalMouseWheel, onScroll: (e) => this.applyScroll('rgCol', e) }, hAsync("div", { key: 'e35696a7993ac94261426b45c28d488cdc42b7f0', class: "inner-content-table", style: { width: `${physicalContentWidth}px` } }, hAsync("div", { key: 'a6997451e01eacda1d27d4efa1d74e1748626218', class: "header-wrapper", ref: e => (this.header = e) }, hAsync("slot", { key: '1d401e87d32d5b1531c2211723b552bbc894f22c', name: HEADER_SLOT })), hAsync("div", { key: 'ceab6f9e812d6ca9a0aa376afcd2562a17f505e0', class: "vertical-inner", ref: el => (this.verticalScroll = el), onWheel: this.verticalMouseWheel, onScroll: (e) => this.applyScroll('rgRow', e) }, hAsync("div", { key: 'a9556578a23d6efddec2e982e863aec064042154', class: "content-wrapper", style: { height: `${physicalContentHeight}px` } }, hAsync("slot", { key: '0ae01f9736b9740612e75261f6e3abebda533377', name: CONTENT_SLOT }))), hAsync("div", { key: '09c2565d4ed449a43820f92d97b6558fca3758e7', class: "footer-wrapper", ref: e => (this.footer = e) }, hAsync("slot", { key: '1ffb08ff8138a560cc09d82e3fe22a53e502aafe', name: FOOTER_SLOT })))));
|
|
21822
21865
|
}
|
|
21823
21866
|
/**
|
|
21824
21867
|
* Extra layer for scroll event monitoring, where MouseWheel event is not passing
|