@onesy/ui-react 1.0.140 → 1.0.142
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 +5 -7
- package/TableHead/TableHead.js +16 -4
- package/esm/TableCell/TableCell.js +6 -8
- package/esm/TableHead/TableHead.js +17 -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';
|
|
@@ -233,12 +233,10 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
233
233
|
offsetOriginal = root.offsetLeft;
|
|
234
234
|
root.style.position = 'sticky';
|
|
235
235
|
method();
|
|
236
|
-
},
|
|
237
|
-
if (parentOverflow) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
}
|
|
236
|
+
}, 400);
|
|
237
|
+
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
238
|
+
passive: false
|
|
239
|
+
});
|
|
242
240
|
return () => {
|
|
243
241
|
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
244
242
|
};
|
package/TableHead/TableHead.js
CHANGED
|
@@ -92,17 +92,29 @@ 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();
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
root.style.position = 'unset';
|
|
109
|
+
offsetOriginal = root.offsetTop;
|
|
110
|
+
root.style.position = 'sticky';
|
|
111
|
+
method();
|
|
112
|
+
}, 400);
|
|
101
113
|
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
102
114
|
passive: false
|
|
103
115
|
});
|
|
104
116
|
return () => {
|
|
105
|
-
parentOverflow.removeEventListener('scroll', method);
|
|
117
|
+
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
106
118
|
};
|
|
107
119
|
}
|
|
108
120
|
}
|
|
@@ -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';
|
|
@@ -210,12 +210,10 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
210
210
|
offsetOriginal = root.offsetLeft;
|
|
211
211
|
root.style.position = 'sticky';
|
|
212
212
|
method();
|
|
213
|
-
},
|
|
214
|
-
if (parentOverflow) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
218
|
-
}
|
|
213
|
+
}, 400);
|
|
214
|
+
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
215
|
+
passive: false
|
|
216
|
+
});
|
|
219
217
|
return () => {
|
|
220
218
|
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
221
219
|
};
|
|
@@ -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,29 @@ 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();
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
root.style.position = 'unset';
|
|
90
|
+
offsetOriginal = root.offsetTop;
|
|
91
|
+
root.style.position = 'sticky';
|
|
92
|
+
method();
|
|
93
|
+
}, 400);
|
|
82
94
|
if (parentOverflow) parentOverflow.addEventListener('scroll', method, {
|
|
83
95
|
passive: false
|
|
84
96
|
});
|
|
85
97
|
return () => {
|
|
86
|
-
parentOverflow.removeEventListener('scroll', method);
|
|
98
|
+
if (parentOverflow) parentOverflow.removeEventListener('scroll', method);
|
|
87
99
|
};
|
|
88
100
|
}
|
|
89
101
|
}
|
package/esm/index.js
CHANGED
package/index.js
CHANGED