@tanstack/table-core 8.21.2 → 8.21.3
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/build/lib/features/ColumnSizing.js +2 -1
- package/build/lib/features/ColumnSizing.js.map +1 -1
- package/build/lib/index.esm.js +5 -1
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +5 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils/document.d.ts +2 -0
- package/build/lib/utils/document.js +18 -0
- package/build/lib/utils/document.js.map +1 -0
- package/build/umd/index.development.js +5 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/ColumnSizing.ts +2 -2
- package/src/utils/document.ts +12 -0
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../types'
|
|
11
11
|
import { getMemoOptions, makeStateUpdater, memo } from '../utils'
|
|
12
12
|
import { ColumnPinningPosition } from './ColumnPinning'
|
|
13
|
+
import { safelyAccessDocument } from '../utils/document'
|
|
13
14
|
|
|
14
15
|
//
|
|
15
16
|
|
|
@@ -428,8 +429,7 @@ export const ColumnSizing: TableFeature = {
|
|
|
428
429
|
}))
|
|
429
430
|
}
|
|
430
431
|
|
|
431
|
-
const contextDocument =
|
|
432
|
-
_contextDocument || typeof document !== 'undefined' ? document : null
|
|
432
|
+
const contextDocument = safelyAccessDocument(_contextDocument)
|
|
433
433
|
|
|
434
434
|
const mouseEvents = {
|
|
435
435
|
moveHandler: (e: MouseEvent) => onMove(e.clientX),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function safelyAccessDocument(_document?: Document): Document | null {
|
|
2
|
+
return _document || (typeof document !== 'undefined' ? document : null)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function safelyAccessDocumentEvent(event: Event): Document | null {
|
|
6
|
+
return !!event &&
|
|
7
|
+
!!event.target &&
|
|
8
|
+
typeof event.target === 'object' &&
|
|
9
|
+
'ownerDocument' in event.target
|
|
10
|
+
? (event.target.ownerDocument as Document | null)
|
|
11
|
+
: null
|
|
12
|
+
}
|