@proteinjs/ui 2.1.2 → 2.1.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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/dist/generated/index.js +1 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/src/table/InfiniteScroll.d.ts +3 -8
- package/dist/src/table/InfiniteScroll.d.ts.map +1 -1
- package/dist/src/table/InfiniteScroll.js +34 -3
- package/dist/src/table/InfiniteScroll.js.map +1 -1
- package/generated/index.ts +1 -1
- package/package.json +4 -3
- package/src/table/InfiniteScroll.tsx +15 -19
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.1.3](https://github.com/proteinjs/ui/compare/@proteinjs/ui@2.1.2...@proteinjs/ui@2.1.3) (2024-07-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* add all props for infinite scroll component ([b66170a](https://github.com/proteinjs/ui/commit/b66170ac00f473bc09b547818d58a911931186fe))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.1.1](https://github.com/proteinjs/ui/compare/@proteinjs/ui@2.1.0...@proteinjs/ui@2.1.1) (2024-07-07)
|
|
7
18
|
|
|
8
19
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Brent Bahry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/generated/index.js
CHANGED
|
@@ -33,7 +33,7 @@ require("react-router-dom");
|
|
|
33
33
|
require("string");
|
|
34
34
|
require("uuid");
|
|
35
35
|
/** Generate Source Graph */
|
|
36
|
-
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/
|
|
36
|
+
var sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/home/runner/work/ui/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string | string[]\",\"filePath\":null,\"qualifiedName\":\"/string | string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/React.FC\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"},{\"v\":\"/(value: ColumnValue\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
|
|
37
37
|
/** Generate Source Links */
|
|
38
38
|
var sourceLinks = {};
|
|
39
39
|
/** Load Source Graph and Links */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,iCAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,kBAAgB;AAChB,wBAAsB;AACtB,iBAAe;AACf,qBAAmB;AACnB,2CAAyC;AACzC,uBAAqB;AACrB,wBAAsB;AACtB,4BAA0B;AAC1B,kBAAgB;AAChB,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../generated/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,0BAAwB;AACxB,2BAAyB;AACzB,+BAA6B;AAC7B,yBAAuB;AACvB,iCAA+B;AAC/B,2BAAyB;AACzB,mBAAiB;AACjB,kBAAgB;AAChB,wBAAsB;AACtB,iBAAe;AACf,qBAAmB;AACnB,2CAAyC;AACzC,uBAAqB;AACrB,wBAAsB;AACtB,4BAA0B;AAC1B,kBAAgB;AAChB,gBAAc;AAGd,4BAA4B;AAE5B,IAAM,WAAW,GAAG,o+GAAo+G,CAAC;AAGz/G,4BAA4B;AAG5B,IAAM,WAAW,GAAG,EACnB,CAAC;AAGF,kCAAkC;AAElC,oDAAyD;AACzD,6BAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAGjD,2CAAyB"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { BoxProps } from '@mui/material';
|
|
2
|
-
import React
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
dataLength: number;
|
|
6
|
-
next: () => void;
|
|
7
|
-
hasMore: boolean;
|
|
8
|
-
loader?: ReactNode;
|
|
9
|
-
scrollableTarget?: string;
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Props as InfiniteScrollComponentProps } from 'react-infinite-scroll-component';
|
|
4
|
+
interface InfiniteScrollProps extends InfiniteScrollComponentProps {
|
|
10
5
|
sx?: BoxProps['sx'];
|
|
11
6
|
}
|
|
12
7
|
export declare const InfiniteScroll: React.FC<InfiniteScrollProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../../src/table/InfiniteScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.d.ts","sourceRoot":"","sources":["../../../src/table/InfiniteScroll.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAgC,EAAE,KAAK,IAAI,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAEjH,UAAU,mBAAoB,SAAQ,4BAA4B;IAChE,EAAE,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA6DxD,CAAC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -22,6 +33,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
33
|
__setModuleDefault(result, mod);
|
|
23
34
|
return result;
|
|
24
35
|
};
|
|
36
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
+
var t = {};
|
|
38
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
+
t[p] = s[p];
|
|
40
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
+
t[p[i]] = s[p[i]];
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
};
|
|
25
47
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
49
|
};
|
|
@@ -31,12 +53,21 @@ var material_1 = require("@mui/material");
|
|
|
31
53
|
var react_1 = __importStar(require("react"));
|
|
32
54
|
var react_infinite_scroll_component_1 = __importDefault(require("react-infinite-scroll-component"));
|
|
33
55
|
var InfiniteScroll = function (_a) {
|
|
34
|
-
var children = _a.children,
|
|
56
|
+
var children = _a.children, next = _a.next, hasMore = _a.hasMore, scrollableTarget = _a.scrollableTarget, sx = _a.sx, otherProps = __rest(_a, ["children", "next", "hasMore", "scrollableTarget", "sx"]);
|
|
35
57
|
var observerTarget = (0, react_1.useRef)(null);
|
|
36
58
|
var containerRef = (0, react_1.useRef)(null);
|
|
37
59
|
(0, react_1.useEffect)(function () {
|
|
60
|
+
var getScrollableTarget = function () {
|
|
61
|
+
if (typeof scrollableTarget === 'string') {
|
|
62
|
+
return document.getElementById(scrollableTarget);
|
|
63
|
+
}
|
|
64
|
+
else if (scrollableTarget instanceof HTMLElement) {
|
|
65
|
+
return scrollableTarget;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
38
69
|
var options = {
|
|
39
|
-
root:
|
|
70
|
+
root: getScrollableTarget(),
|
|
40
71
|
rootMargin: '0px 0px 100px 0px',
|
|
41
72
|
threshold: 0.1,
|
|
42
73
|
};
|
|
@@ -56,7 +87,7 @@ var InfiniteScroll = function (_a) {
|
|
|
56
87
|
};
|
|
57
88
|
}, [next, hasMore, scrollableTarget]);
|
|
58
89
|
return (react_1.default.createElement(material_1.Box, { ref: containerRef, sx: sx },
|
|
59
|
-
react_1.default.createElement(react_infinite_scroll_component_1.default, {
|
|
90
|
+
react_1.default.createElement(react_infinite_scroll_component_1.default, __assign({ next: next, hasMore: hasMore, scrollableTarget: scrollableTarget }, otherProps), children),
|
|
60
91
|
hasMore && (react_1.default.createElement(material_1.Box, { ref: observerTarget, sx: {
|
|
61
92
|
height: '100px',
|
|
62
93
|
visibility: 'hidden',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfiniteScroll.js","sourceRoot":"","sources":["../../../src/table/InfiniteScroll.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InfiniteScroll.js","sourceRoot":"","sources":["../../../src/table/InfiniteScroll.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA8C;AAC9C,6CAAiD;AACjD,oGAAiH;AAM1G,IAAM,cAAc,GAAkC,UAAC,EAO7D;IANC,IAAA,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,gBAAgB,sBAAA,EAChB,EAAE,QAAA,EACC,UAAU,cAN+C,yDAO7D,CADc;IAEb,IAAM,cAAc,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IACpD,IAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC;QACR,IAAM,mBAAmB,GAAG;YAC1B,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE;gBACxC,OAAO,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;aAClD;iBAAM,IAAI,gBAAgB,YAAY,WAAW,EAAE;gBAClD,OAAO,gBAAgB,CAAC;aACzB;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,IAAM,OAAO,GAAG;YACd,IAAI,EAAE,mBAAmB,EAAE;YAC3B,UAAU,EAAE,mBAAmB;YAC/B,SAAS,EAAE,GAAG;SACf,CAAC;QAEF,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,OAAO;YACzC,IAAA,KAAK,GAAI,OAAO,GAAX,CAAY;YACxB,IAAI,KAAK,CAAC,cAAc,IAAI,OAAO,EAAE;gBACnC,IAAI,EAAE,CAAC;aACR;QACH,CAAC,EAAE,OAAO,CAAC,CAAC;QAEZ,IAAI,cAAc,CAAC,OAAO,EAAE;YAC1B,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;SAC1C;QAED,OAAO;YACL,IAAI,cAAc,CAAC,OAAO,EAAE;gBAC1B,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEtC,OAAO,CACL,8BAAC,cAAG,IAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE;QAC5B,8BAAC,yCAAuB,aAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,IAAM,UAAU,GACtG,QAAQ,CACe;QACzB,OAAO,IAAI,CACV,8BAAC,cAAG,IACF,GAAG,EAAE,cAAc,EACnB,EAAE,EAAE;gBACF,MAAM,EAAE,OAAO;gBACf,UAAU,EAAE,QAAQ;aACrB,GACD,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AA7DW,QAAA,cAAc,kBA6DzB"}
|
package/generated/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ import 'uuid';
|
|
|
21
21
|
|
|
22
22
|
/** Generate Source Graph */
|
|
23
23
|
|
|
24
|
-
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/
|
|
24
|
+
const sourceGraph = "{\"options\":{\"directed\":true,\"multigraph\":false,\"compound\":false},\"nodes\":[{\"v\":\"@proteinjs/ui/Page\",\"value\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"Page\",\"filePath\":\"/home/runner/work/ui/ui/packages/ui/src/router/Page.ts\",\"qualifiedName\":\"@proteinjs/ui/Page\",\"properties\":[{\"name\":\"name\",\"type\":{\"packageName\":\"\",\"name\":\"string\",\"filePath\":null,\"qualifiedName\":\"/string\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"path\",\"type\":{\"packageName\":\"\",\"name\":\"string | string[]\",\"filePath\":null,\"qualifiedName\":\"/string | string[]\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"component\",\"type\":{\"packageName\":\"\",\"name\":\"React.ComponentType<PageComponentProps>\",\"filePath\":null,\"qualifiedName\":\"/React.ComponentType<PageComponentProps>\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":false,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"noPageContainer\",\"type\":{\"packageName\":\"\",\"name\":\"boolean\",\"filePath\":null,\"qualifiedName\":\"/boolean\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"auth\",\"type\":{\"packageName\":\"@proteinjs/ui\",\"name\":\"{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/ui/{\\n /** If true, the user does not need to be logged in or have any roles to access this page. If blank, defaults to false. */\\n public?: boolean;\\n /** If true, the user does not need to have any roles to access this page, but must be logged in. If blank, defaults to false. */\\n allUsers?: boolean;\\n /** The user must be logged in and have these roles to access this page. If blank, defaults to requiring the 'admin' role. */\\n roles?: string[];\\n }\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"},{\"name\":\"pageContainerSxProps\",\"type\":{\"packageName\":\"\",\"name\":\"(theme: Theme) => SxProps\",\"filePath\":null,\"qualifiedName\":\"/(theme: Theme) => SxProps\",\"typeParameters\":null,\"directParents\":null},\"isOptional\":true,\"isAbstract\":false,\"isStatic\":false,\"visibility\":\"public\"}],\"methods\":[],\"typeParameters\":[],\"directParents\":[{\"packageName\":\"@proteinjs/reflection\",\"name\":\"Loadable\",\"filePath\":null,\"qualifiedName\":\"@proteinjs/reflection/Loadable\",\"properties\":[],\"methods\":[],\"typeParameters\":[],\"directParents\":[]}],\"sourceType\":3}},{\"v\":\"@proteinjs/reflection/Loadable\"},{\"v\":\"/React.FC\"},{\"v\":\"/string | React.ComponentType\"},{\"v\":\"/Partial\"},{\"v\":\"/React.Component\"},{\"v\":\"/(value: ColumnValue\"}],\"edges\":[{\"v\":\"@proteinjs/ui/Page\",\"w\":\"@proteinjs/reflection/Loadable\",\"value\":\"extends interface\"}]}";
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
/** Generate Source Links */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "UI libs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -56,5 +56,6 @@
|
|
|
56
56
|
"typescript": "5.2.2"
|
|
57
57
|
},
|
|
58
58
|
"main": "./dist/generated/index.js",
|
|
59
|
-
"types": "./dist/generated/index.d.ts"
|
|
60
|
-
|
|
59
|
+
"types": "./dist/generated/index.d.ts",
|
|
60
|
+
"gitHead": "0531920127a0b4266252bf6fceec9f623d9815d4"
|
|
61
|
+
}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { Box, BoxProps } from '@mui/material';
|
|
2
|
-
import React, { useEffect, useRef
|
|
3
|
-
import InfiniteScrollComponent from 'react-infinite-scroll-component';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import InfiniteScrollComponent, { Props as InfiniteScrollComponentProps } from 'react-infinite-scroll-component';
|
|
4
4
|
|
|
5
|
-
interface InfiniteScrollProps {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
dataLength: number;
|
|
8
|
-
next: () => void;
|
|
9
|
-
hasMore: boolean;
|
|
10
|
-
loader?: ReactNode;
|
|
11
|
-
scrollableTarget?: string;
|
|
5
|
+
interface InfiniteScrollProps extends InfiniteScrollComponentProps {
|
|
12
6
|
sx?: BoxProps['sx'];
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
export const InfiniteScroll: React.FC<InfiniteScrollProps> = ({
|
|
16
10
|
children,
|
|
17
|
-
dataLength,
|
|
18
11
|
next,
|
|
19
12
|
hasMore,
|
|
20
|
-
loader,
|
|
21
13
|
scrollableTarget,
|
|
22
14
|
sx,
|
|
15
|
+
...otherProps
|
|
23
16
|
}) => {
|
|
24
17
|
const observerTarget = useRef<HTMLDivElement>(null);
|
|
25
18
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
26
19
|
|
|
27
20
|
useEffect(() => {
|
|
21
|
+
const getScrollableTarget = () => {
|
|
22
|
+
if (typeof scrollableTarget === 'string') {
|
|
23
|
+
return document.getElementById(scrollableTarget);
|
|
24
|
+
} else if (scrollableTarget instanceof HTMLElement) {
|
|
25
|
+
return scrollableTarget;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
|
|
28
30
|
const options = {
|
|
29
|
-
root:
|
|
31
|
+
root: getScrollableTarget(),
|
|
30
32
|
rootMargin: '0px 0px 100px 0px',
|
|
31
33
|
threshold: 0.1,
|
|
32
34
|
};
|
|
@@ -51,13 +53,7 @@ export const InfiniteScroll: React.FC<InfiniteScrollProps> = ({
|
|
|
51
53
|
|
|
52
54
|
return (
|
|
53
55
|
<Box ref={containerRef} sx={sx}>
|
|
54
|
-
<InfiniteScrollComponent
|
|
55
|
-
dataLength={dataLength}
|
|
56
|
-
next={next}
|
|
57
|
-
hasMore={hasMore}
|
|
58
|
-
loader={loader}
|
|
59
|
-
scrollableTarget={scrollableTarget}
|
|
60
|
-
>
|
|
56
|
+
<InfiniteScrollComponent next={next} hasMore={hasMore} scrollableTarget={scrollableTarget} {...otherProps}>
|
|
61
57
|
{children}
|
|
62
58
|
</InfiniteScrollComponent>
|
|
63
59
|
{hasMore && (
|