@onesy/ui-react 1.0.140 → 1.0.141
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/TableCell/TableCell.js +4 -12
- package/TableHead/TableHead.js +10 -4
- package/esm/TableCell/TableCell.js +5 -13
- package/esm/TableHead/TableHead.js +11 -5
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/TableCell/TableCell.js
CHANGED
|
@@ -217,7 +217,7 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
217
217
|
if (sticky) {
|
|
218
218
|
if (root) {
|
|
219
219
|
let offsetOriginal = root.offsetLeft;
|
|
220
|
-
const parentOverflow =
|
|
220
|
+
const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
|
|
221
221
|
root.style.position = 'unset';
|
|
222
222
|
offsetOriginal = root.offsetLeft;
|
|
223
223
|
root.style.position = 'sticky';
|
|
@@ -228,17 +228,9 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
228
228
|
|
|
229
229
|
// initial
|
|
230
230
|
method();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
root.style.position = 'sticky';
|
|
235
|
-
method();
|
|
236
|
-
}, 150);
|
|
237
|
-
if (parentOverflow) {
|
|
238
|
-
parentOverflow.addEventListener('scroll', method, {
|
|
239
|
-
passive: false
|
|
240
|
-
});
|
|
241
|
-
}
|
|
231
|
+
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
232
|
+
passive: false
|
|
233
|
+
});
|
|
242
234
|
return () => {
|
|
243
235
|
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
244
236
|
};
|
package/TableHead/TableHead.js
CHANGED
|
@@ -92,17 +92,23 @@ const TableHead = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
92
92
|
_react.default.useEffect(() => {
|
|
93
93
|
if (sticky) {
|
|
94
94
|
if (root) {
|
|
95
|
-
|
|
96
|
-
const
|
|
95
|
+
let offsetOriginal = root.offsetTop;
|
|
96
|
+
const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
|
|
97
|
+
root.style.position = 'unset';
|
|
98
|
+
offsetOriginal = root.offsetTop;
|
|
99
|
+
root.style.position = 'sticky';
|
|
97
100
|
const method = () => {
|
|
98
101
|
const offsetNew = root.offsetTop;
|
|
99
|
-
setStickyActive(
|
|
102
|
+
setStickyActive(offsetOriginal !== offsetNew);
|
|
100
103
|
};
|
|
104
|
+
|
|
105
|
+
// initial
|
|
106
|
+
method();
|
|
101
107
|
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
102
108
|
passive: false
|
|
103
109
|
});
|
|
104
110
|
return () => {
|
|
105
|
-
parentOverflow.removeEventListener('scroll', method);
|
|
111
|
+
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
106
112
|
};
|
|
107
113
|
}
|
|
108
114
|
}
|
|
@@ -12,7 +12,7 @@ import LineElement from '../Line';
|
|
|
12
12
|
import IconButtonElement from '../IconButton';
|
|
13
13
|
import TypeElement from '../Type';
|
|
14
14
|
import DividerElement from '../Divider';
|
|
15
|
-
import {
|
|
15
|
+
import { staticClassName } from '../utils';
|
|
16
16
|
import Tooltip from '../Tooltip';
|
|
17
17
|
import useResize from '../useResize';
|
|
18
18
|
const useStyle = styleMethod(theme => ({
|
|
@@ -194,7 +194,7 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
194
194
|
if (sticky) {
|
|
195
195
|
if (root) {
|
|
196
196
|
let offsetOriginal = root.offsetLeft;
|
|
197
|
-
const parentOverflow =
|
|
197
|
+
const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
|
|
198
198
|
root.style.position = 'unset';
|
|
199
199
|
offsetOriginal = root.offsetLeft;
|
|
200
200
|
root.style.position = 'sticky';
|
|
@@ -205,17 +205,9 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
205
205
|
|
|
206
206
|
// initial
|
|
207
207
|
method();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
root.style.position = 'sticky';
|
|
212
|
-
method();
|
|
213
|
-
}, 150);
|
|
214
|
-
if (parentOverflow) {
|
|
215
|
-
parentOverflow.addEventListener('scroll', method, {
|
|
216
|
-
passive: false
|
|
217
|
-
});
|
|
218
|
-
}
|
|
208
|
+
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
209
|
+
passive: false
|
|
210
|
+
});
|
|
219
211
|
return () => {
|
|
220
212
|
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
221
213
|
};
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { is } from '@onesy/utils';
|
|
9
9
|
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
|
|
10
10
|
import SurfaceElement from '../Surface';
|
|
11
|
-
import {
|
|
11
|
+
import { staticClassName } from '../utils';
|
|
12
12
|
import TableRowElement from '../TableRow';
|
|
13
13
|
import LinearProgressElement from '../LinearProgress';
|
|
14
14
|
const useStyle = styleMethod(theme => ({
|
|
@@ -73,17 +73,23 @@ const TableHead = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
73
73
|
React.useEffect(() => {
|
|
74
74
|
if (sticky) {
|
|
75
75
|
if (root) {
|
|
76
|
-
|
|
77
|
-
const
|
|
76
|
+
let offsetOriginal = root.offsetTop;
|
|
77
|
+
const parentOverflow = window.document.querySelector('.onesy-Table-wrapper');
|
|
78
|
+
root.style.position = 'unset';
|
|
79
|
+
offsetOriginal = root.offsetTop;
|
|
80
|
+
root.style.position = 'sticky';
|
|
78
81
|
const method = () => {
|
|
79
82
|
const offsetNew = root.offsetTop;
|
|
80
|
-
setStickyActive(
|
|
83
|
+
setStickyActive(offsetOriginal !== offsetNew);
|
|
81
84
|
};
|
|
85
|
+
|
|
86
|
+
// initial
|
|
87
|
+
method();
|
|
82
88
|
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
83
89
|
passive: false
|
|
84
90
|
});
|
|
85
91
|
return () => {
|
|
86
|
-
parentOverflow.removeEventListener('scroll', method);
|
|
92
|
+
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
87
93
|
};
|
|
88
94
|
}
|
|
89
95
|
}
|
package/esm/index.js
CHANGED
package/index.js
CHANGED