@revolist/revogrid 4.22.0 → 4.23.0
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/{cell-renderer-uZmDBXz7.js → cell-renderer-DWJ9Px9f.js} +9 -3
- package/dist/cjs/{column.drag.plugin-CM_5mKV3.js → column.drag.plugin-CaEBDG-Q.js} +409 -267
- package/dist/cjs/{column.service-DvQDqxxx.js → column.service-f612L4ql.js} +1 -1
- package/dist/cjs/{dimension.helpers-CaIsYC99.js → dimension.helpers-B9HgANnM.js} +14 -146
- package/dist/cjs/{edit.utils-CwMzSIVF.js → edit.utils-pKeiYFLJ.js} +22 -1
- package/dist/cjs/{header-cell-renderer-B1dJwgTO.js → header-cell-renderer-4yq9_WbM.js} +1 -1
- package/dist/cjs/index-DxaSE5uZ.js +136 -0
- package/dist/cjs/index.cjs.js +45 -31
- package/dist/cjs/revo-grid.cjs.entry.js +35 -15
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +44 -26
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +11 -9
- package/dist/cjs/revogr-data_4.cjs.entry.js +132 -178
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -1
- package/dist/cjs/{text-editor-BTnGaIl3.js → text-editor-B4W-m-r-.js} +3 -3
- package/dist/cjs/{throttle-CI4MsAqs.js → throttle-BCwEuJJq.js} +59 -24
- package/dist/cjs/viewport.helpers-BND76K2j.js +140 -0
- package/dist/cjs/{viewport.store-Dcjud-a-.js → viewport.store-BlKQ4x9H.js} +16 -16
- package/dist/collection/components/clipboard/revogr-clipboard.js +1 -1
- package/dist/collection/components/data/revogr-data.js +5 -3
- package/dist/collection/components/header/header-group-renderer.js +2 -1
- package/dist/collection/components/header/header-renderer.js +6 -5
- package/dist/collection/components/header/revogr-header-style.css +13 -3
- package/dist/collection/components/header/revogr-header.js +105 -42
- package/dist/collection/components/order/order-row.service.js +6 -5
- package/dist/collection/components/overlay/keyboard.service.js +25 -3
- package/dist/collection/components/overlay/selection.utils.js +8 -6
- package/dist/collection/components/revoGrid/revo-grid.js +6 -5
- package/dist/collection/components/revoGrid/viewport.service.js +2 -1
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +10 -6
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +4 -10
- package/dist/collection/plugins/filter/filter.panel.js +2 -1
- package/dist/collection/plugins/filter/filter.plugin.js +11 -4
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +25 -1
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +18 -15
- package/dist/collection/plugins/sorting/sorting.func.js +173 -15
- package/dist/collection/plugins/sorting/sorting.plugin.js +167 -84
- package/dist/collection/plugins/sorting/sorting.sign.js +7 -1
- package/dist/collection/serve/controller.js +98 -37
- package/dist/collection/serve/data.js +273 -144
- package/dist/collection/services/dimension.provider.js +16 -1
- package/dist/collection/services/local.scroll.service.js +59 -24
- package/dist/collection/services/scroll.dimension.helpers.js +83 -0
- package/dist/collection/services/selection.store.connector.js +4 -1
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +22 -9
- package/dist/collection/store/dimension/dimension.store.js +4 -2
- package/dist/collection/store/vp/viewport.helpers.js +9 -0
- package/dist/collection/store/vp/viewport.store.js +5 -16
- package/dist/collection/types/events.js +4 -0
- package/dist/collection/utils/key.utils.js +20 -0
- package/dist/collection/utils/store.utils.js +3 -3
- package/dist/{revo-grid/cell-renderer-K_BKH7Kx.js → esm/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/esm/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
- package/dist/esm/{column.service-Cdz3dYqZ.js → column.service-DbpulTog.js} +1 -1
- package/dist/{revo-grid/debounce-BfO9dz9v.js → esm/debounce-PCRWZliA.js} +1 -1
- package/dist/{revo-grid/dimension.helpers-DzxqJQqN.js → esm/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/esm/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
- package/dist/{revo-grid/header-cell-renderer-DXhxZMly.js → esm/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/esm/index-Db3qZoW5.js +127 -0
- package/dist/esm/index.js +15 -10
- package/dist/esm/revo-grid.entry.js +34 -14
- package/dist/esm/revogr-attribution_7.entry.js +43 -25
- package/dist/esm/revogr-clipboard_3.entry.js +12 -10
- package/dist/esm/revogr-data_4.entry.js +133 -179
- package/dist/esm/revogr-filter-panel.entry.js +3 -2
- package/dist/esm/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/esm/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/esm/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{revo-grid/viewport.store-saAZJHRo.js → esm/viewport.store-COAfzAyu.js} +15 -17
- package/dist/{esm/cell-renderer-K_BKH7Kx.js → revo-grid/cell-renderer-8UiGd-s7.js} +9 -3
- package/dist/revo-grid/{column.drag.plugin-DEqZ2qXJ.js → column.drag.plugin-BsfhsfmB.js} +402 -266
- package/dist/revo-grid/{column.service-Cdz3dYqZ.js → column.service-DbpulTog.js} +1 -1
- package/dist/{esm/debounce-BfO9dz9v.js → revo-grid/debounce-PCRWZliA.js} +1 -1
- package/dist/{esm/dimension.helpers-DzxqJQqN.js → revo-grid/dimension.helpers-CGKwSvw6.js} +7 -128
- package/dist/revo-grid/{edit.utils-CzfeG98N.js → edit.utils-Dnnbd0xG.js} +22 -2
- package/dist/{esm/header-cell-renderer-DXhxZMly.js → revo-grid/header-cell-renderer-DGI2FAD8.js} +1 -1
- package/dist/revo-grid/index-Db3qZoW5.js +127 -0
- package/dist/revo-grid/index.esm.js +15 -10
- package/dist/revo-grid/revo-grid.entry.js +34 -14
- package/dist/revo-grid/revogr-attribution_7.entry.js +43 -25
- package/dist/revo-grid/revogr-clipboard_3.entry.js +12 -10
- package/dist/revo-grid/revogr-data_4.entry.js +133 -179
- package/dist/revo-grid/revogr-filter-panel.entry.js +3 -2
- package/dist/revo-grid/{text-editor-C1ks5eQ4.js → text-editor-C3RUSwH5.js} +2 -2
- package/dist/revo-grid/{throttle-BEjFQa2l.js → throttle-CaUDyxyU.js} +60 -25
- package/dist/revo-grid/viewport.helpers-CoCAvmZs.js +133 -0
- package/dist/{esm/viewport.store-saAZJHRo.js → revo-grid/viewport.store-COAfzAyu.js} +15 -17
- package/dist/types/components/header/header-group-renderer.d.ts +1 -0
- package/dist/types/components/header/header-renderer.d.ts +1 -0
- package/dist/types/components/header/revogr-header.d.ts +6 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +5 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +8 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +29 -3
- package/dist/types/plugins/sorting/sorting.func.d.ts +25 -2
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +84 -9
- package/dist/types/plugins/sorting/sorting.sign.d.ts +5 -1
- package/dist/types/plugins/sorting/sorting.types.d.ts +46 -1
- package/dist/types/services/local.scroll.service.d.ts +10 -2
- package/dist/types/services/scroll.dimension.helpers.d.ts +20 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +2 -0
- package/dist/types/types/events.d.ts +1 -1
- package/dist/types/types/interfaces.d.ts +11 -0
- package/dist/types/utils/key.utils.d.ts +8 -0
- package/hydrate/index.js +791 -539
- package/hydrate/index.mjs +791 -539
- package/package.json +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +1 -1
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +1 -1
- package/standalone/local.scroll.timer.js +1 -1
- package/standalone/revo-grid.js +1 -1
- package/standalone/revogr-clipboard2.js +1 -1
- package/standalone/revogr-data2.js +1 -1
- package/standalone/revogr-edit.js +1 -1
- package/standalone/revogr-edit2.js +1 -1
- package/standalone/revogr-filter-panel.js +1 -1
- package/standalone/revogr-header2.js +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +1 -1
- package/standalone/revogr-row-headers.js +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/revogr-scroll-virtual2.js +1 -1
- package/standalone/revogr-viewport-scroll2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/viewport.helpers-BAovztDd.js +0 -58
- package/dist/esm/viewport.helpers-VXhsJZtn.js +0 -52
- package/dist/revo-grid/viewport.helpers-VXhsJZtn.js +0 -52
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { d as debounce,
|
|
4
|
+
import { g as getScrollDimension } from './viewport.helpers-CoCAvmZs.js';
|
|
5
|
+
import { d as debounce, i as isObject } from './debounce-PCRWZliA.js';
|
|
6
6
|
|
|
7
7
|
const initialParams = {
|
|
8
8
|
contentSize: 0,
|
|
@@ -16,10 +16,11 @@ const NO_COORDINATE = -1;
|
|
|
16
16
|
* return full size
|
|
17
17
|
*/
|
|
18
18
|
function getContentSize(contentSize, clientSize, virtualSize = 0) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return getScrollDimension({
|
|
20
|
+
contentSize,
|
|
21
|
+
clientSize,
|
|
22
|
+
virtualSize,
|
|
23
|
+
}).physicalContentSize;
|
|
23
24
|
}
|
|
24
25
|
class LocalScrollService {
|
|
25
26
|
constructor(cfg) {
|
|
@@ -33,14 +34,20 @@ class LocalScrollService {
|
|
|
33
34
|
rgRow: NO_COORDINATE,
|
|
34
35
|
rgCol: NO_COORDINATE,
|
|
35
36
|
};
|
|
37
|
+
this.previousLogicalScroll = {
|
|
38
|
+
rgRow: 0,
|
|
39
|
+
rgCol: 0,
|
|
40
|
+
};
|
|
36
41
|
this.params = {
|
|
37
42
|
rgRow: Object.assign({}, initialParams),
|
|
38
43
|
rgCol: Object.assign({}, initialParams),
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
46
|
setParams(params, dimension) {
|
|
42
|
-
const
|
|
43
|
-
|
|
47
|
+
const scrollDimension = getScrollDimension(params);
|
|
48
|
+
const virtualContentSize = scrollDimension.physicalContentSize;
|
|
49
|
+
this.params[dimension] = Object.assign(Object.assign({}, params), { maxSize: virtualContentSize - params.clientSize, virtualContentSize,
|
|
50
|
+
scrollDimension });
|
|
44
51
|
}
|
|
45
52
|
// apply scroll values after scroll done
|
|
46
53
|
async setScroll(e) {
|
|
@@ -60,16 +67,27 @@ class LocalScrollService {
|
|
|
60
67
|
await frameAnimation;
|
|
61
68
|
const params = this.getParams(e.dimension);
|
|
62
69
|
e.coordinate = Math.ceil(e.coordinate);
|
|
63
|
-
this.
|
|
70
|
+
this.previousLogicalScroll[e.dimension] = this.wrapLogicalCoordinate(e.coordinate, params);
|
|
71
|
+
const physicalCoordinate = this.toPhysicalCoordinate(e.coordinate, params);
|
|
72
|
+
this.previousScroll[e.dimension] = this.wrapPhysicalCoordinate(physicalCoordinate, params);
|
|
64
73
|
this.preventArtificialScroll[e.dimension] = null;
|
|
65
|
-
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate:
|
|
66
|
-
? this.convert(e.coordinate, params, false)
|
|
67
|
-
: e.coordinate }));
|
|
74
|
+
this.cfg.applyScroll(Object.assign(Object.assign({}, e), { coordinate: physicalCoordinate }));
|
|
68
75
|
}
|
|
69
76
|
catch (id) {
|
|
70
77
|
window.cancelAnimationFrame(id);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
80
|
+
async setScrollByDelta(e, currentPhysicalCoordinate) {
|
|
81
|
+
var _a;
|
|
82
|
+
const params = this.getParams(e.dimension);
|
|
83
|
+
const baseCoordinate = this.previousScroll[e.dimension] === NO_COORDINATE
|
|
84
|
+
? this.toLogicalCoordinate(currentPhysicalCoordinate, params)
|
|
85
|
+
: this.previousLogicalScroll[e.dimension];
|
|
86
|
+
const coordinate = this.wrapLogicalCoordinate(baseCoordinate + ((_a = e.delta) !== null && _a !== void 0 ? _a : 0), params);
|
|
87
|
+
const nextEvent = Object.assign(Object.assign({}, e), { coordinate });
|
|
88
|
+
await this.setScroll(nextEvent);
|
|
89
|
+
return nextEvent;
|
|
90
|
+
}
|
|
73
91
|
/**
|
|
74
92
|
* On scroll event started
|
|
75
93
|
*/
|
|
@@ -82,21 +100,21 @@ class LocalScrollService {
|
|
|
82
100
|
return;
|
|
83
101
|
}
|
|
84
102
|
const param = this.getParams(dimension);
|
|
103
|
+
const logicalCoordinate = this.toLogicalScrollCoordinate(coordinate, dimension, param, delta);
|
|
85
104
|
// let component know about scroll event started
|
|
86
105
|
this.cfg.runScroll({
|
|
87
106
|
dimension: dimension,
|
|
88
|
-
coordinate:
|
|
89
|
-
? this.convert(coordinate, param)
|
|
90
|
-
: coordinate,
|
|
107
|
+
coordinate: logicalCoordinate,
|
|
91
108
|
delta,
|
|
92
109
|
outside,
|
|
93
110
|
});
|
|
111
|
+
this.previousLogicalScroll[dimension] = logicalCoordinate;
|
|
94
112
|
}
|
|
95
113
|
getParams(dimension) {
|
|
96
114
|
return this.params[dimension];
|
|
97
115
|
}
|
|
98
116
|
// check if scroll outside of region to avoid looping
|
|
99
|
-
|
|
117
|
+
wrapPhysicalCoordinate(c, param) {
|
|
100
118
|
if (c < 0) {
|
|
101
119
|
return NO_COORDINATE;
|
|
102
120
|
}
|
|
@@ -105,22 +123,39 @@ class LocalScrollService {
|
|
|
105
123
|
}
|
|
106
124
|
return c;
|
|
107
125
|
}
|
|
126
|
+
wrapLogicalCoordinate(c, param) {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
if (c < 0) {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
return Math.min(c, (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.logicalScrollSize) !== null && _b !== void 0 ? _b : c);
|
|
132
|
+
}
|
|
108
133
|
// prevent already started scroll, performance optimization
|
|
109
134
|
cancelScroll(dimension) {
|
|
110
135
|
var _a, _b;
|
|
111
136
|
(_b = (_a = this.preventArtificialScroll)[dimension]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
112
137
|
this.preventArtificialScroll[dimension] = null;
|
|
113
138
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
toLogicalScrollCoordinate(coordinate, dimension, param, delta) {
|
|
140
|
+
const scrollDimension = param.scrollDimension;
|
|
141
|
+
if (!scrollDimension) {
|
|
142
|
+
return coordinate;
|
|
143
|
+
}
|
|
144
|
+
if (typeof delta === 'number' && scrollDimension.isCompressed) {
|
|
145
|
+
const base = this.previousScroll[dimension] === NO_COORDINATE
|
|
146
|
+
? scrollDimension.toLogicalCoordinate(coordinate - delta)
|
|
147
|
+
: this.previousLogicalScroll[dimension];
|
|
148
|
+
return scrollDimension.toLogicalCoordinate(scrollDimension.toPhysicalCoordinate(base + delta));
|
|
122
149
|
}
|
|
123
|
-
return
|
|
150
|
+
return scrollDimension.toLogicalCoordinate(coordinate);
|
|
151
|
+
}
|
|
152
|
+
toPhysicalCoordinate(coordinate, param) {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toPhysicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
155
|
+
}
|
|
156
|
+
toLogicalCoordinate(coordinate, param) {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
return (_b = (_a = param.scrollDimension) === null || _a === void 0 ? void 0 : _a.toLogicalCoordinate(coordinate)) !== null && _b !== void 0 ? _b : coordinate;
|
|
124
159
|
}
|
|
125
160
|
}
|
|
126
161
|
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by Revolist OU ❤️
|
|
3
|
+
*/
|
|
4
|
+
const FALLBACK_MAX_SCROLL_SIZE = 16000000;
|
|
5
|
+
const SCROLL_SIZE_GUARD = 1000000;
|
|
6
|
+
let detectedMaxScrollSize;
|
|
7
|
+
function getMaxScrollSize(doc = typeof document === 'undefined' ? undefined : document) {
|
|
8
|
+
if (typeof detectedMaxScrollSize === 'number') {
|
|
9
|
+
return detectedMaxScrollSize;
|
|
10
|
+
}
|
|
11
|
+
const body = doc === null || doc === void 0 ? void 0 : doc.body;
|
|
12
|
+
if (body) {
|
|
13
|
+
const ownerDocument = body.ownerDocument;
|
|
14
|
+
const element = ownerDocument.createElement('div');
|
|
15
|
+
element.style.cssText = [
|
|
16
|
+
'height:1px',
|
|
17
|
+
'left:-10000px',
|
|
18
|
+
'overflow:scroll',
|
|
19
|
+
'position:absolute',
|
|
20
|
+
'top:-10000px',
|
|
21
|
+
'visibility:hidden',
|
|
22
|
+
'width:1px',
|
|
23
|
+
].join(';');
|
|
24
|
+
const content = ownerDocument.createElement('div');
|
|
25
|
+
content.style.height = `${FALLBACK_MAX_SCROLL_SIZE * 4}px`;
|
|
26
|
+
element.appendChild(content);
|
|
27
|
+
body.appendChild(element);
|
|
28
|
+
detectedMaxScrollSize = Math.max(0, Math.min(element.scrollHeight, FALLBACK_MAX_SCROLL_SIZE * 4) - SCROLL_SIZE_GUARD);
|
|
29
|
+
element.remove();
|
|
30
|
+
if (detectedMaxScrollSize > SCROLL_SIZE_GUARD) {
|
|
31
|
+
return detectedMaxScrollSize;
|
|
32
|
+
}
|
|
33
|
+
detectedMaxScrollSize = FALLBACK_MAX_SCROLL_SIZE;
|
|
34
|
+
return detectedMaxScrollSize;
|
|
35
|
+
}
|
|
36
|
+
return FALLBACK_MAX_SCROLL_SIZE;
|
|
37
|
+
}
|
|
38
|
+
function getScrollDimension({ contentSize, clientSize, virtualSize = 0, maxScrollSize = getMaxScrollSize(), }) {
|
|
39
|
+
const safeContentSize = Math.max(0, maxScrollSize - SCROLL_SIZE_GUARD);
|
|
40
|
+
const size = Math.max(0, contentSize);
|
|
41
|
+
const client = Math.max(0, clientSize);
|
|
42
|
+
const viewport = Math.max(0, virtualSize || client);
|
|
43
|
+
const logicalScrollSize = Math.max(0, size - viewport);
|
|
44
|
+
const maxPhysicalScrollSize = Math.max(0, safeContentSize - client);
|
|
45
|
+
const physicalScrollSize = Math.min(logicalScrollSize, maxPhysicalScrollSize);
|
|
46
|
+
const physicalContentSize = client + physicalScrollSize;
|
|
47
|
+
const isCompressed = logicalScrollSize > physicalScrollSize && physicalScrollSize > 0;
|
|
48
|
+
const clampLogical = (coordinate) => Math.min(Math.max(0, coordinate || 0), logicalScrollSize);
|
|
49
|
+
const clampPhysical = (coordinate) => Math.min(Math.max(0, coordinate || 0), physicalScrollSize);
|
|
50
|
+
const toLogicalCoordinate = (coordinate) => {
|
|
51
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
if (!isCompressed) {
|
|
55
|
+
return clampLogical(coordinate);
|
|
56
|
+
}
|
|
57
|
+
return clampLogical((clampPhysical(coordinate) / physicalScrollSize) * logicalScrollSize);
|
|
58
|
+
};
|
|
59
|
+
const toPhysicalCoordinate = (coordinate) => {
|
|
60
|
+
if (!logicalScrollSize || !physicalScrollSize) {
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
if (!isCompressed) {
|
|
64
|
+
return clampPhysical(coordinate);
|
|
65
|
+
}
|
|
66
|
+
return clampPhysical((clampLogical(coordinate) / logicalScrollSize) * physicalScrollSize);
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
contentSize: size,
|
|
70
|
+
clientSize: client,
|
|
71
|
+
viewportSize: viewport,
|
|
72
|
+
physicalContentSize,
|
|
73
|
+
logicalScrollSize,
|
|
74
|
+
physicalScrollSize,
|
|
75
|
+
isCompressed,
|
|
76
|
+
toLogicalCoordinate,
|
|
77
|
+
toPhysicalCoordinate,
|
|
78
|
+
getRenderOffset(coordinate) {
|
|
79
|
+
const logical = clampLogical(coordinate);
|
|
80
|
+
return logical - toPhysicalCoordinate(logical);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Collects data for pinned columns in the required @ViewportProps format.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Represents the slot names for the viewport slots.
|
|
90
|
+
*/
|
|
91
|
+
const HEADER_SLOT = 'header'; // Slot name for the header slot
|
|
92
|
+
const FOOTER_SLOT = 'footer'; // Slot name for the footer slot
|
|
93
|
+
const CONTENT_SLOT = 'content'; // Slot name for the content slot
|
|
94
|
+
const DATA_SLOT = 'data'; // Slot name for the data slot
|
|
95
|
+
/**
|
|
96
|
+
* Returns the last visible cell in the viewport for a given row type.
|
|
97
|
+
* Coordinates are not zero-based and are relative to the viewport.
|
|
98
|
+
* If needed to be zero-based they can be adjusted by subtracting 1.
|
|
99
|
+
*/
|
|
100
|
+
function getLastCell(data, rowType) {
|
|
101
|
+
// Get the last visible column count from the viewport column data.
|
|
102
|
+
const lastVisibleColumnCount = data.viewports[data.colType].store.get('realCount');
|
|
103
|
+
// Get the last visible row count for the given row type from the viewport column data.
|
|
104
|
+
const lastVisibleRowCount = data.viewports[rowType].store.get('realCount');
|
|
105
|
+
// Return the last visible cell with the last visible column count and row count.
|
|
106
|
+
return {
|
|
107
|
+
x: lastVisibleColumnCount,
|
|
108
|
+
y: lastVisibleRowCount,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function viewportDataPartition(data, type, slot, fixed) {
|
|
112
|
+
return {
|
|
113
|
+
colData: data.colStore,
|
|
114
|
+
viewportCol: data.viewports[data.colType].store,
|
|
115
|
+
viewportRow: data.viewports[type].store,
|
|
116
|
+
/**
|
|
117
|
+
* lastCell is the last real coordinate + 1, saved to selection store
|
|
118
|
+
*/
|
|
119
|
+
lastCell: getLastCell(data, type),
|
|
120
|
+
slot,
|
|
121
|
+
type,
|
|
122
|
+
canDrag: !fixed,
|
|
123
|
+
position: data.position,
|
|
124
|
+
dataStore: data.rowStores[type].store,
|
|
125
|
+
dimensionCol: data.dimensions[data.colType].store,
|
|
126
|
+
dimensionRow: data.dimensions[type].store,
|
|
127
|
+
style: fixed
|
|
128
|
+
? { height: `${data.dimensions[type].store.get('realSize')}px` }
|
|
129
|
+
: undefined,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { CONTENT_SLOT as C, DATA_SLOT as D, FOOTER_SLOT as F, HEADER_SLOT as H, getScrollDimension as g, viewportDataPartition as v };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import { j as getItemByPosition,
|
|
4
|
+
import { j as getItemByPosition, K as createStore, l as setStore } from './dimension.helpers-CGKwSvw6.js';
|
|
5
5
|
|
|
6
6
|
const LETTER_BLOCK_SIZE = 10;
|
|
7
7
|
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
@@ -9,6 +9,15 @@ const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) =>
|
|
|
9
9
|
Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE, minWidth));
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
function getViewportMaxCoordinate(dimension, viewportSize, frameOffset = 1) {
|
|
13
|
+
if (!viewportSize || dimension.realSize <= viewportSize) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
return Math.max(0, dimension.realSize - viewportSize - dimension.originItemSize * frameOffset);
|
|
17
|
+
}
|
|
18
|
+
function clampViewportCoordinate(coordinate, dimension, viewportSize, frameOffset = 1) {
|
|
19
|
+
return Math.min(Math.max(0, coordinate), getViewportMaxCoordinate(dimension, viewportSize, frameOffset));
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Update items based on new scroll position
|
|
14
23
|
* If viewport wasn't changed fully simple recombination of positions
|
|
@@ -274,6 +283,8 @@ function initialState() {
|
|
|
274
283
|
realCount: 0,
|
|
275
284
|
// size of viewport in px
|
|
276
285
|
clientSize: 0,
|
|
286
|
+
// logical-to-physical render offset used when scroll space is compressed
|
|
287
|
+
renderOffset: 0,
|
|
277
288
|
};
|
|
278
289
|
}
|
|
279
290
|
/**
|
|
@@ -309,21 +320,8 @@ class ViewportStore {
|
|
|
309
320
|
const outsize = singleOffsetInPx * 2;
|
|
310
321
|
// math virtual size is based on visible area + 2 items outside of visible area
|
|
311
322
|
const virtualSize = viewportSize + outsize;
|
|
312
|
-
|
|
313
|
-
let
|
|
314
|
-
// if there is nodes outside of viewport, max coordinate has to be adjusted
|
|
315
|
-
if (dimension.realSize > viewportSize) {
|
|
316
|
-
// max coordinate is real size minus virtual/rendered space
|
|
317
|
-
maxCoordinate = dimension.realSize - viewportSize - singleOffsetInPx;
|
|
318
|
-
}
|
|
319
|
-
let pos = position;
|
|
320
|
-
// limit position to max and min coordinates
|
|
321
|
-
if (pos < 0) {
|
|
322
|
-
pos = 0;
|
|
323
|
-
}
|
|
324
|
-
else if (pos > maxCoordinate) {
|
|
325
|
-
pos = maxCoordinate;
|
|
326
|
-
}
|
|
323
|
+
const maxCoordinate = getViewportMaxCoordinate(dimension, viewportSize, frameOffset);
|
|
324
|
+
let pos = clampViewportCoordinate(position, dimension, viewportSize, frameOffset);
|
|
327
325
|
// store last coordinate for further restore on redraw
|
|
328
326
|
this.lastCoordinate = pos;
|
|
329
327
|
// actual position is less than first item start based on offset
|
|
@@ -401,4 +399,4 @@ class ViewportStore {
|
|
|
401
399
|
}
|
|
402
400
|
}
|
|
403
401
|
|
|
404
|
-
export { ViewportStore as V,
|
|
402
|
+
export { ViewportStore as V, getUpdatedItemsByPosition as a, addMissingItems as b, clampViewportCoordinate as c, getItems as d, isActiveRangeOutsideLastItem as e, getFirstItem as f, getViewportMaxCoordinate as g, getLastItem as h, isActiveRange as i, calculateRowHeaderSize as j, recombineByOffset as r, setItemSizes as s, updateMissingAndRange as u };
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
4
|
import { h, f as Build } from './index-Chp_81rd.js';
|
|
5
|
-
import {
|
|
6
|
-
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-
|
|
5
|
+
import { n as DATA_ROW, w as DRAG_ICON_CLASS, x as DRAGGABLE_CLASS } from './dimension.helpers-CGKwSvw6.js';
|
|
6
|
+
import { l as GROUP_EXPAND_BTN, m as GROUP_EXPAND_EVENT, G as GROUP_DEPTH, h as GROUP_EXPANDED, P as PSEUDO_GROUP_ITEM, O as isRowDragService, B as getCellDataParsed } from './column.service-DbpulTog.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Renders sorting direction and optional additive sorting rank.
|
|
10
|
+
*/
|
|
8
11
|
const SortingSign = ({ column }) => {
|
|
9
12
|
var _a;
|
|
10
|
-
|
|
13
|
+
const indicatorAttrs = { class: 'sort-indicator' };
|
|
14
|
+
const iconAttrs = { class: (_a = column === null || column === void 0 ? void 0 : column.order) !== null && _a !== void 0 ? _a : 'sort-off' };
|
|
15
|
+
const orderIndexAttrs = { class: 'sort-order-index' };
|
|
16
|
+
return (h("span", Object.assign({}, indicatorAttrs), h("i", Object.assign({}, iconAttrs)), (column === null || column === void 0 ? void 0 : column.sortIndex) ? (h("sup", Object.assign({}, orderIndexAttrs), column.sortIndex)) : null));
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
const PADDING_DEPTH = 10;
|