@yakad/ui 1.3.142 → 1.3.144
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.
|
@@ -39,23 +39,25 @@ export const RenderByScroll = forwardRef(function RenderByScroll(_a, ref) {
|
|
|
39
39
|
const overRenderedOnLowSide = visibled.lowest - rendered.lowest;
|
|
40
40
|
const overRenderedOnHighSide = rendered.highest - visibled.highest;
|
|
41
41
|
// Is Visible Loading Box
|
|
42
|
-
const [
|
|
42
|
+
const [isVisibleLowSideLimitSensor, setIsVisibleLowSideLimitSensor] = useState(false);
|
|
43
43
|
// Render new Childs if needed
|
|
44
44
|
useEffect(() => {
|
|
45
|
+
const isPriorityBYHighSide = overRenderedOnHighSide < 1 ||
|
|
46
|
+
overRenderedOnHighSide - 1 <= overRenderedOnLowSide;
|
|
47
|
+
const isHighSideNewRenderRemains = rendered.highest < data.length - 1;
|
|
48
|
+
const isLowSideNewRenderRemains = rendered.lowest > 0;
|
|
45
49
|
if (!stopNewRenders) {
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
newChildRendered === null || newChildRendered === void 0 ? void 0 : newChildRendered(newHigh);
|
|
53
|
-
}
|
|
50
|
+
if (isPriorityBYHighSide &&
|
|
51
|
+
isHighSideNewRenderRemains &&
|
|
52
|
+
overRenderedOnHighSide < extraRender) {
|
|
53
|
+
const newHigh = rendered.highest + 1;
|
|
54
|
+
setRendered(Object.assign(Object.assign({}, rendered), { highest: newHigh }));
|
|
55
|
+
newChildRendered === null || newChildRendered === void 0 ? void 0 : newChildRendered(newHigh);
|
|
54
56
|
}
|
|
55
57
|
else {
|
|
56
|
-
if (
|
|
58
|
+
if (isLowSideNewRenderRemains &&
|
|
57
59
|
overRenderedOnLowSide < extraRender) {
|
|
58
|
-
if (
|
|
60
|
+
if (isVisibleLowSideLimitSensor) {
|
|
59
61
|
scrollTo(rendered.lowest);
|
|
60
62
|
}
|
|
61
63
|
const newLow = rendered.lowest - 1;
|
|
@@ -80,13 +82,11 @@ export const RenderByScroll = forwardRef(function RenderByScroll(_a, ref) {
|
|
|
80
82
|
// eslint-disable-next-line
|
|
81
83
|
}, [jumpToIndex]);
|
|
82
84
|
return (_jsxs(Stack, Object.assign({ ref: ref }, restProps, { style: Object.assign({ minHeight: "100vh" }, style), children: [rendered.lowest > 0 && (_jsx(WithInteractions, { style: {
|
|
83
|
-
height: "1px",
|
|
84
|
-
backgroundColor: "red",
|
|
85
85
|
marginBottom: `${scrollMarginTop}rem`,
|
|
86
|
-
}, onVisibilityChange: (v) =>
|
|
86
|
+
}, onVisibilityChange: (v) => setIsVisibleLowSideLimitSensor(v) })), childrenArray.map((child, i) => i >= rendered.lowest &&
|
|
87
87
|
i <= rendered.highest && (_jsx(WithInteractions, { ref: (el) => {
|
|
88
88
|
childRefs.current[i] = el;
|
|
89
|
-
},
|
|
89
|
+
}, style: {
|
|
90
90
|
scrollMarginTop: `${scrollMarginTop}rem`,
|
|
91
|
-
}, children: child }, i)))] })));
|
|
91
|
+
}, onVisible: () => handleOnVisible(i), children: child }, i)))] })));
|
|
92
92
|
});
|
package/dist/Stack/Stack.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface StackProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
align?: "start" | "space" | "center" | "end";
|
|
4
|
+
fullWidth?: boolean;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
}
|
|
6
7
|
export declare const Stack: import("react").ForwardRefExoticComponent<StackProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/Stack/Stack.js
CHANGED
|
@@ -15,7 +15,7 @@ import classNames from "classnames";
|
|
|
15
15
|
import boxingStyles from "../boxing.module.css";
|
|
16
16
|
import styles from "./Stack.module.css";
|
|
17
17
|
export const Stack = forwardRef(function Stack(_a, ref) {
|
|
18
|
-
var { align, className, children } = _a, restProps = __rest(_a, ["align", "className", "children"]);
|
|
19
|
-
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, {
|
|
18
|
+
var { align, fullWidth, className, children } = _a, restProps = __rest(_a, ["align", "fullWidth", "className", "children"]);
|
|
19
|
+
const joinedClassNames = classNames(boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { fullWidth: fullWidth }, styles.stack, className);
|
|
20
20
|
return (_jsx("div", Object.assign({ ref: ref }, restProps, { className: joinedClassNames, children: children })));
|
|
21
21
|
});
|