virtual-scroller 1.15.0 → 1.15.2
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/CHANGELOG.md +6 -0
- package/README.md +98 -8
- package/bundle/index-dom-bypass.html +3 -4
- package/bundle/index-dom-grid.html +3 -4
- package/bundle/index-dom-scrollableContainer.html +3 -4
- package/bundle/index-dom.html +3 -4
- package/bundle/index-react-bypass.html +56 -62
- package/bundle/index-react-grid.html +55 -61
- package/bundle/index-react-hook.html +209 -0
- package/bundle/index-react-scrollableContainer.html +56 -62
- package/bundle/index-react-strictMode.html +55 -61
- package/bundle/index-react-tbody-scrollableContainer.html +13 -15
- package/bundle/index-react-tbody.html +10 -12
- package/bundle/virtual-scroller-dom.js +1 -1
- package/bundle/virtual-scroller-dom.js.map +1 -1
- package/bundle/virtual-scroller-react.js +1 -1
- package/bundle/virtual-scroller-react.js.map +1 -1
- package/bundle/virtual-scroller.js +1 -1
- package/bundle/virtual-scroller.js.map +1 -1
- package/commonjs/VirtualScroller.constructor.js +3 -1
- package/commonjs/VirtualScroller.constructor.js.map +1 -1
- package/commonjs/VirtualScroller.items.js +19 -0
- package/commonjs/VirtualScroller.items.js.map +1 -1
- package/commonjs/react/VirtualScroller.js +69 -127
- package/commonjs/react/VirtualScroller.js.map +1 -1
- package/commonjs/react/useCreateVirtualScroller.js +64 -0
- package/commonjs/react/useCreateVirtualScroller.js.map +1 -0
- package/commonjs/react/useInstanceMethods.js +2 -2
- package/commonjs/react/useInstanceMethods.js.map +1 -1
- package/commonjs/react/useMergeRefs.js +52 -0
- package/commonjs/react/useMergeRefs.js.map +1 -0
- package/commonjs/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +1 -1
- package/commonjs/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map} +1 -1
- package/commonjs/react/useStyle.js +18 -0
- package/commonjs/react/useStyle.js.map +1 -1
- package/commonjs/react/useVirtualScroller.js +142 -43
- package/commonjs/react/useVirtualScroller.js.map +1 -1
- package/commonjs/test/VirtualScroller.js +17 -1
- package/commonjs/test/VirtualScroller.js.map +1 -1
- package/modules/VirtualScroller.constructor.js +3 -1
- package/modules/VirtualScroller.constructor.js.map +1 -1
- package/modules/VirtualScroller.items.js +19 -0
- package/modules/VirtualScroller.items.js.map +1 -1
- package/modules/react/VirtualScroller.js +68 -119
- package/modules/react/VirtualScroller.js.map +1 -1
- package/modules/react/useCreateVirtualScroller.js +53 -0
- package/modules/react/useCreateVirtualScroller.js.map +1 -0
- package/modules/react/useInstanceMethods.js +2 -2
- package/modules/react/useInstanceMethods.js.map +1 -1
- package/modules/react/useMergeRefs.js +44 -0
- package/modules/react/useMergeRefs.js.map +1 -0
- package/modules/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +1 -1
- package/modules/react/{useVirtualScrollerStartStop.js.map → useStartStopVirtualScroller.js.map} +1 -1
- package/modules/react/useStyle.js +17 -0
- package/modules/react/useStyle.js.map +1 -1
- package/modules/react/useVirtualScroller.js +136 -43
- package/modules/react/useVirtualScroller.js.map +1 -1
- package/modules/test/VirtualScroller.js +17 -1
- package/modules/test/VirtualScroller.js.map +1 -1
- package/package.json +4 -1
- package/react/index.cjs +2 -1
- package/react/index.d.ts +51 -7
- package/react/index.js +1 -0
- package/rollup.config.mjs +15 -1
- package/source/VirtualScroller.constructor.js +3 -0
- package/source/VirtualScroller.items.js +14 -0
- package/source/react/VirtualScroller.js +66 -127
- package/source/react/useCreateVirtualScroller.js +65 -0
- package/source/react/useInstanceMethods.js +2 -2
- package/source/react/useMergeRefs.js +45 -0
- package/source/react/useStyle.js +15 -0
- package/source/react/useVirtualScroller.js +155 -48
- package/source/test/VirtualScroller.js +11 -1
- package/website/index-dom-bypass.html +3 -4
- package/website/index-dom-grid.html +3 -4
- package/website/index-dom-scrollableContainer.html +3 -4
- package/website/index-dom.html +3 -4
- package/website/index-react-bypass.html +56 -62
- package/website/index-react-grid.html +55 -61
- package/website/index-react-hook.html +209 -0
- package/website/index-react-scrollableContainer.html +56 -62
- package/website/index-react-strictMode.html +55 -61
- package/website/index-react-tbody-scrollableContainer.html +13 -15
- package/website/index-react-tbody.html +10 -12
- package/website/index-react.html +55 -61
- package/website/index.html +55 -61
- package/commonjs/react/useForwardedRef.js +0 -50
- package/commonjs/react/useForwardedRef.js.map +0 -1
- package/modules/react/useForwardedRef.js +0 -42
- package/modules/react/useForwardedRef.js.map +0 -1
- package/source/react/useForwardedRef.js +0 -39
- /package/source/react/{useVirtualScrollerStartStop.js → useStartStopVirtualScroller.js} +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = useForwardedRef;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
// import type { MutableRefObject } from 'react'
|
|
11
|
-
// When a React component receives a `ref` which it is supposed to "forward"
|
|
12
|
-
// and when it would like to also read that `ref` in its internal implementation,
|
|
13
|
-
// this `useForwardedRef()` hook could be used to get read access to such "forwarded" ref
|
|
14
|
-
// inside the component's internal implementation.
|
|
15
|
-
//
|
|
16
|
-
// ```js
|
|
17
|
-
// const FormWithAutoFocus = forwardRef((props, ref) => {
|
|
18
|
-
// const { setRef, internalRef } = useForwardedRef<RefValueType>(ref)
|
|
19
|
-
//
|
|
20
|
-
// useEffect(() => {
|
|
21
|
-
// internalRef.current.focus()
|
|
22
|
-
// }, [])
|
|
23
|
-
//
|
|
24
|
-
// return (
|
|
25
|
-
// <Form ref={setRef} {...props}/>
|
|
26
|
-
// )
|
|
27
|
-
// })
|
|
28
|
-
// ```
|
|
29
|
-
//
|
|
30
|
-
// export default function useForwardedRef<T extends MutableRefObject<any>>(ref) {
|
|
31
|
-
function useForwardedRef(ref) {
|
|
32
|
-
var internalRef = (0, _react.useRef)(); // as T
|
|
33
|
-
|
|
34
|
-
var setRef = (0, _react.useCallback)(function (instance) {
|
|
35
|
-
internalRef.current = instance;
|
|
36
|
-
|
|
37
|
-
if (ref) {
|
|
38
|
-
if (typeof ref === 'function') {
|
|
39
|
-
ref(instance);
|
|
40
|
-
} else {
|
|
41
|
-
ref.current = instance;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}, [ref]);
|
|
45
|
-
return {
|
|
46
|
-
setRef: setRef,
|
|
47
|
-
internalRef: internalRef
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=useForwardedRef.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForwardedRef.js","names":["useForwardedRef","ref","internalRef","useRef","setRef","useCallback","instance","current"],"sources":["../../source/react/useForwardedRef.js"],"sourcesContent":["// import type { MutableRefObject } from 'react'\r\nimport { useCallback, useRef } from 'react'\r\n\r\n// When a React component receives a `ref` which it is supposed to \"forward\"\r\n// and when it would like to also read that `ref` in its internal implementation,\r\n// this `useForwardedRef()` hook could be used to get read access to such \"forwarded\" ref\r\n// inside the component's internal implementation.\r\n//\r\n// ```js\r\n// const FormWithAutoFocus = forwardRef((props, ref) => {\r\n// const { setRef, internalRef } = useForwardedRef<RefValueType>(ref)\r\n//\r\n// useEffect(() => {\r\n// internalRef.current.focus()\r\n// }, [])\r\n//\r\n// return (\r\n// <Form ref={setRef} {...props}/>\r\n// )\r\n// })\r\n// ```\r\n//\r\n// export default function useForwardedRef<T extends MutableRefObject<any>>(ref) {\r\nexport default function useForwardedRef(ref) {\r\n\tconst internalRef = useRef() // as T\r\n\r\n\tconst setRef = useCallback((instance) => {\r\n\t\tinternalRef.current = instance\r\n\t\tif (ref) {\r\n\t\t\tif (typeof ref === 'function') {\r\n\t\t\t\tref(instance)\r\n\t\t\t} else {\r\n\t\t\t\tref.current = instance\r\n\t\t\t}\r\n\t\t}\r\n\t}, [ref])\r\n\r\n\treturn { setRef, internalRef }\r\n}\r\n"],"mappings":";;;;;;;AACA;;AADA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,eAAT,CAAyBC,GAAzB,EAA8B;EAC5C,IAAMC,WAAW,GAAG,IAAAC,aAAA,GAApB,CAD4C,CACf;;EAE7B,IAAMC,MAAM,GAAG,IAAAC,kBAAA,EAAY,UAACC,QAAD,EAAc;IACxCJ,WAAW,CAACK,OAAZ,GAAsBD,QAAtB;;IACA,IAAIL,GAAJ,EAAS;MACR,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;QAC9BA,GAAG,CAACK,QAAD,CAAH;MACA,CAFD,MAEO;QACNL,GAAG,CAACM,OAAJ,GAAcD,QAAd;MACA;IACD;EACD,CATc,EASZ,CAACL,GAAD,CATY,CAAf;EAWA,OAAO;IAAEG,MAAM,EAANA,MAAF;IAAUF,WAAW,EAAXA;EAAV,CAAP;AACA"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// import type { MutableRefObject } from 'react'
|
|
2
|
-
import { useCallback, useRef } from 'react'; // When a React component receives a `ref` which it is supposed to "forward"
|
|
3
|
-
// and when it would like to also read that `ref` in its internal implementation,
|
|
4
|
-
// this `useForwardedRef()` hook could be used to get read access to such "forwarded" ref
|
|
5
|
-
// inside the component's internal implementation.
|
|
6
|
-
//
|
|
7
|
-
// ```js
|
|
8
|
-
// const FormWithAutoFocus = forwardRef((props, ref) => {
|
|
9
|
-
// const { setRef, internalRef } = useForwardedRef<RefValueType>(ref)
|
|
10
|
-
//
|
|
11
|
-
// useEffect(() => {
|
|
12
|
-
// internalRef.current.focus()
|
|
13
|
-
// }, [])
|
|
14
|
-
//
|
|
15
|
-
// return (
|
|
16
|
-
// <Form ref={setRef} {...props}/>
|
|
17
|
-
// )
|
|
18
|
-
// })
|
|
19
|
-
// ```
|
|
20
|
-
//
|
|
21
|
-
// export default function useForwardedRef<T extends MutableRefObject<any>>(ref) {
|
|
22
|
-
|
|
23
|
-
export default function useForwardedRef(ref) {
|
|
24
|
-
var internalRef = useRef(); // as T
|
|
25
|
-
|
|
26
|
-
var setRef = useCallback(function (instance) {
|
|
27
|
-
internalRef.current = instance;
|
|
28
|
-
|
|
29
|
-
if (ref) {
|
|
30
|
-
if (typeof ref === 'function') {
|
|
31
|
-
ref(instance);
|
|
32
|
-
} else {
|
|
33
|
-
ref.current = instance;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, [ref]);
|
|
37
|
-
return {
|
|
38
|
-
setRef: setRef,
|
|
39
|
-
internalRef: internalRef
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=useForwardedRef.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForwardedRef.js","names":["useCallback","useRef","useForwardedRef","ref","internalRef","setRef","instance","current"],"sources":["../../source/react/useForwardedRef.js"],"sourcesContent":["// import type { MutableRefObject } from 'react'\r\nimport { useCallback, useRef } from 'react'\r\n\r\n// When a React component receives a `ref` which it is supposed to \"forward\"\r\n// and when it would like to also read that `ref` in its internal implementation,\r\n// this `useForwardedRef()` hook could be used to get read access to such \"forwarded\" ref\r\n// inside the component's internal implementation.\r\n//\r\n// ```js\r\n// const FormWithAutoFocus = forwardRef((props, ref) => {\r\n// const { setRef, internalRef } = useForwardedRef<RefValueType>(ref)\r\n//\r\n// useEffect(() => {\r\n// internalRef.current.focus()\r\n// }, [])\r\n//\r\n// return (\r\n// <Form ref={setRef} {...props}/>\r\n// )\r\n// })\r\n// ```\r\n//\r\n// export default function useForwardedRef<T extends MutableRefObject<any>>(ref) {\r\nexport default function useForwardedRef(ref) {\r\n\tconst internalRef = useRef() // as T\r\n\r\n\tconst setRef = useCallback((instance) => {\r\n\t\tinternalRef.current = instance\r\n\t\tif (ref) {\r\n\t\t\tif (typeof ref === 'function') {\r\n\t\t\t\tref(instance)\r\n\t\t\t} else {\r\n\t\t\t\tref.current = instance\r\n\t\t\t}\r\n\t\t}\r\n\t}, [ref])\r\n\r\n\treturn { setRef, internalRef }\r\n}\r\n"],"mappings":"AAAA;AACA,SAASA,WAAT,EAAsBC,MAAtB,QAAoC,OAApC,C,CAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,eAAT,CAAyBC,GAAzB,EAA8B;EAC5C,IAAMC,WAAW,GAAGH,MAAM,EAA1B,CAD4C,CACf;;EAE7B,IAAMI,MAAM,GAAGL,WAAW,CAAC,UAACM,QAAD,EAAc;IACxCF,WAAW,CAACG,OAAZ,GAAsBD,QAAtB;;IACA,IAAIH,GAAJ,EAAS;MACR,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;QAC9BA,GAAG,CAACG,QAAD,CAAH;MACA,CAFD,MAEO;QACNH,GAAG,CAACI,OAAJ,GAAcD,QAAd;MACA;IACD;EACD,CATyB,EASvB,CAACH,GAAD,CATuB,CAA1B;EAWA,OAAO;IAAEE,MAAM,EAANA,MAAF;IAAUD,WAAW,EAAXA;EAAV,CAAP;AACA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// import type { MutableRefObject } from 'react'
|
|
2
|
-
import { useCallback, useRef } from 'react'
|
|
3
|
-
|
|
4
|
-
// When a React component receives a `ref` which it is supposed to "forward"
|
|
5
|
-
// and when it would like to also read that `ref` in its internal implementation,
|
|
6
|
-
// this `useForwardedRef()` hook could be used to get read access to such "forwarded" ref
|
|
7
|
-
// inside the component's internal implementation.
|
|
8
|
-
//
|
|
9
|
-
// ```js
|
|
10
|
-
// const FormWithAutoFocus = forwardRef((props, ref) => {
|
|
11
|
-
// const { setRef, internalRef } = useForwardedRef<RefValueType>(ref)
|
|
12
|
-
//
|
|
13
|
-
// useEffect(() => {
|
|
14
|
-
// internalRef.current.focus()
|
|
15
|
-
// }, [])
|
|
16
|
-
//
|
|
17
|
-
// return (
|
|
18
|
-
// <Form ref={setRef} {...props}/>
|
|
19
|
-
// )
|
|
20
|
-
// })
|
|
21
|
-
// ```
|
|
22
|
-
//
|
|
23
|
-
// export default function useForwardedRef<T extends MutableRefObject<any>>(ref) {
|
|
24
|
-
export default function useForwardedRef(ref) {
|
|
25
|
-
const internalRef = useRef() // as T
|
|
26
|
-
|
|
27
|
-
const setRef = useCallback((instance) => {
|
|
28
|
-
internalRef.current = instance
|
|
29
|
-
if (ref) {
|
|
30
|
-
if (typeof ref === 'function') {
|
|
31
|
-
ref(instance)
|
|
32
|
-
} else {
|
|
33
|
-
ref.current = instance
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}, [ref])
|
|
37
|
-
|
|
38
|
-
return { setRef, internalRef }
|
|
39
|
-
}
|
|
File without changes
|