@onesy/ui-react 1.0.133 → 1.0.134
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 +14 -7
- package/esm/TableCell/TableCell.js +14 -7
- package/esm/index.js +1 -1
- package/esm/utils.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils.d.ts +1 -1
- package/utils.js +1 -1
package/TableCell/TableCell.js
CHANGED
|
@@ -214,15 +214,22 @@ const TableCell = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
|
214
214
|
_react.default.useEffect(() => {
|
|
215
215
|
if (sticky) {
|
|
216
216
|
if (root) {
|
|
217
|
-
const parentOverflow = (0, _utils2.getOverflowParent)(root, false);
|
|
218
|
-
|
|
217
|
+
const parentOverflow = (0, _utils2.getOverflowParent)(root.parentElement, false);
|
|
218
|
+
root.style.position = 'unset';
|
|
219
|
+
const offsetOriginal = root.offsetLeft;
|
|
220
|
+
root.style.position = 'sticky';
|
|
219
221
|
const method = () => {
|
|
220
|
-
const offsetNew =
|
|
221
|
-
setStickyActive(
|
|
222
|
+
const offsetNew = root.offsetLeft;
|
|
223
|
+
setStickyActive(offsetOriginal !== offsetNew);
|
|
222
224
|
};
|
|
223
|
-
if (parentOverflow)
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
if (parentOverflow) {
|
|
226
|
+
parentOverflow.addEventListener('scroll', method, {
|
|
227
|
+
passive: false
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// initial
|
|
231
|
+
method();
|
|
232
|
+
}
|
|
226
233
|
return () => {
|
|
227
234
|
parentOverflow.removeEventListener('scroll', method);
|
|
228
235
|
};
|
|
@@ -191,15 +191,22 @@ const TableCell = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
|
191
191
|
React.useEffect(() => {
|
|
192
192
|
if (sticky) {
|
|
193
193
|
if (root) {
|
|
194
|
-
const parentOverflow = getOverflowParent(root, false);
|
|
195
|
-
|
|
194
|
+
const parentOverflow = getOverflowParent(root.parentElement, false);
|
|
195
|
+
root.style.position = 'unset';
|
|
196
|
+
const offsetOriginal = root.offsetLeft;
|
|
197
|
+
root.style.position = 'sticky';
|
|
196
198
|
const method = () => {
|
|
197
|
-
const offsetNew =
|
|
198
|
-
setStickyActive(
|
|
199
|
+
const offsetNew = root.offsetLeft;
|
|
200
|
+
setStickyActive(offsetOriginal !== offsetNew);
|
|
199
201
|
};
|
|
200
|
-
if (parentOverflow)
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
if (parentOverflow) {
|
|
203
|
+
parentOverflow.addEventListener('scroll', method, {
|
|
204
|
+
passive: false
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// initial
|
|
208
|
+
method();
|
|
209
|
+
}
|
|
203
210
|
return () => {
|
|
204
211
|
parentOverflow.removeEventListener('scroll', method);
|
|
205
212
|
};
|
package/esm/index.js
CHANGED
package/esm/utils.js
CHANGED
|
@@ -216,7 +216,7 @@ export const getOverflowParent = (element, vertical = true) => {
|
|
|
216
216
|
|
|
217
217
|
// width
|
|
218
218
|
if (!vertical && element.scrollWidth > element.clientWidth) return element;
|
|
219
|
-
return getOverflowParent(element.parentElement);
|
|
219
|
+
return getOverflowParent(element.parentElement, vertical);
|
|
220
220
|
};
|
|
221
221
|
export const keyboardStandardCommands = ['a', 'c', 'v', 'y', 'z'];
|
|
222
222
|
export const keyboardStyleCommands = ['b', 'i', 'u'];
|
package/index.js
CHANGED
package/package.json
CHANGED
package/utils.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare const minMaxBetweenNumbers: (value?: number, min?: number, max?:
|
|
|
26
26
|
export declare const sanitize: (value: string) => string;
|
|
27
27
|
export declare const replace: (value: string, split: string, join: string) => string;
|
|
28
28
|
export declare const importIframeStyles: (iframeDocument: Document) => void;
|
|
29
|
-
export declare const getOverflowParent: (element: HTMLElement, vertical?: boolean) =>
|
|
29
|
+
export declare const getOverflowParent: (element: HTMLElement, vertical?: boolean) => any;
|
|
30
30
|
export declare const keyboardStandardCommands: string[];
|
|
31
31
|
export declare const keyboardStyleCommands: string[];
|
|
32
32
|
export declare const caret: any;
|
package/utils.js
CHANGED
|
@@ -246,7 +246,7 @@ const getOverflowParent = (element, vertical = true) => {
|
|
|
246
246
|
|
|
247
247
|
// width
|
|
248
248
|
if (!vertical && element.scrollWidth > element.clientWidth) return element;
|
|
249
|
-
return getOverflowParent(element.parentElement);
|
|
249
|
+
return getOverflowParent(element.parentElement, vertical);
|
|
250
250
|
};
|
|
251
251
|
exports.getOverflowParent = getOverflowParent;
|
|
252
252
|
const keyboardStandardCommands = exports.keyboardStandardCommands = ['a', 'c', 'v', 'y', 'z'];
|