dce-reactkit 3.5.9 → 3.5.10
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/dist/cjs/index.js +11 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/AutoscrollToBottomContainer.d.ts +2 -0
- package/dist/esm/index.js +11 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/AutoscrollToBottomContainer.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/AutoscrollToBottomContainer.tsx +14 -0
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -35,6 +35,10 @@ type Props = {
|
|
|
35
35
|
items: AutoScrollItem[],
|
|
36
36
|
// Custom variant for the "Jump to Bottom" button
|
|
37
37
|
jumpToBottomButtonVariant?: Variant,
|
|
38
|
+
// Optional element to display before last item (but within the scrollpane)
|
|
39
|
+
messageBeforeItems?: React.ReactNode,
|
|
40
|
+
// Optional element to display after the last item (but within the scrollpane)
|
|
41
|
+
messageAfterItems?: React.ReactNode,
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
// AutoScrollItem definition
|
|
@@ -187,6 +191,8 @@ const AutoscrollToBottomContainer: React.FC<Props> = (props) => {
|
|
|
187
191
|
itemsName,
|
|
188
192
|
items,
|
|
189
193
|
jumpToBottomButtonVariant = Variant.Danger,
|
|
194
|
+
messageBeforeItems,
|
|
195
|
+
messageAfterItems,
|
|
190
196
|
} = props;
|
|
191
197
|
|
|
192
198
|
/* -------------- State ------------- */
|
|
@@ -319,6 +325,8 @@ const AutoscrollToBottomContainer: React.FC<Props> = (props) => {
|
|
|
319
325
|
// Check if new content appeared at bottom
|
|
320
326
|
const newContentAppeared = (
|
|
321
327
|
currentItemIds.length > 0
|
|
328
|
+
&& lastItemIds.current
|
|
329
|
+
&& lastItemIds.current.length > 0
|
|
322
330
|
&& (
|
|
323
331
|
currentItemIds[currentItemIds.length - 1]
|
|
324
332
|
!== lastItemIds.current[lastItemIds.current.length - 1]
|
|
@@ -400,6 +408,9 @@ const AutoscrollToBottomContainer: React.FC<Props> = (props) => {
|
|
|
400
408
|
onScroll={handleScroll}
|
|
401
409
|
ref={container}
|
|
402
410
|
>
|
|
411
|
+
{/* Message before items */}
|
|
412
|
+
{messageBeforeItems}
|
|
413
|
+
|
|
403
414
|
{/* Items */}
|
|
404
415
|
{
|
|
405
416
|
items
|
|
@@ -415,6 +426,9 @@ const AutoscrollToBottomContainer: React.FC<Props> = (props) => {
|
|
|
415
426
|
);
|
|
416
427
|
})
|
|
417
428
|
}
|
|
429
|
+
|
|
430
|
+
{/* Message after items */}
|
|
431
|
+
{messageAfterItems}
|
|
418
432
|
</div>
|
|
419
433
|
</div>
|
|
420
434
|
);
|