@gobolt/genesis 0.4.30 → 0.4.31
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.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const MessageRow: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
2
|
state: string;
|
|
3
3
|
size: string;
|
|
4
|
-
isFullWidth: boolean;
|
|
4
|
+
$isFullWidth: boolean;
|
|
5
5
|
}>> & string;
|
|
6
6
|
export declare const MessageContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
7
7
|
size?: string;
|
|
8
8
|
action?: unknown;
|
|
9
|
-
isFullWidth?: boolean;
|
|
9
|
+
$isFullWidth?: boolean;
|
|
10
10
|
}>> & string;
|
|
11
11
|
export declare const ActionButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { InfiniteScrollTableProps } from './types';
|
|
2
|
-
declare const InfiniteScrollTable: <T>({ columns: initialColumns, fetchService, scrollHeight, scrollWidth, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, filterFn, }: InfiniteScrollTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const InfiniteScrollTable: <T>({ columns: initialColumns, fetchService, title, scrollHeight, scrollWidth, useWindowScroll, onChange, rowSelection, onRowClick, onRowSelectionChange, onDataChange, filterFn, }: InfiniteScrollTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default InfiniteScrollTable;
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import { ColumnType, TablePaginationConfig } from 'antd/es/table';
|
|
2
2
|
import { PaginationStyle } from './TableControls/CustomPagination';
|
|
3
3
|
import { ActionEvent } from '../../types/events';
|
|
4
|
+
import { FetchService } from './InfiniteScrollTable/types';
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
export type Change = (actionEvent: ActionEvent) => void;
|
|
6
7
|
export type SelectionType = "checkbox" | "radio";
|
|
7
8
|
export interface InfiniteScrollConfig<T = any> {
|
|
8
9
|
instanceId: string;
|
|
9
|
-
fetchService:
|
|
10
|
-
|
|
11
|
-
pageParam: number;
|
|
12
|
-
}) => Promise<{
|
|
13
|
-
docs: T[];
|
|
14
|
-
totalDocs: number;
|
|
15
|
-
limit: number;
|
|
16
|
-
page: number;
|
|
17
|
-
totalPages: number;
|
|
18
|
-
pagingCounter: number;
|
|
19
|
-
hasPrevPage: boolean;
|
|
20
|
-
hasNextPage: boolean;
|
|
21
|
-
prevPage?: number;
|
|
22
|
-
nextPage?: number;
|
|
23
|
-
}>;
|
|
24
|
-
queryKey: string[];
|
|
25
|
-
};
|
|
26
|
-
title: string;
|
|
10
|
+
fetchService: FetchService<T>;
|
|
11
|
+
title?: string;
|
|
27
12
|
scrollHeight?: number;
|
|
28
13
|
scrollWidth?: number;
|
|
29
|
-
|
|
14
|
+
useWindowScroll?: boolean;
|
|
30
15
|
}
|
|
31
16
|
export interface TableProps<T extends Record<string, any>> {
|
|
32
17
|
dataSource: T[];
|
package/dist/index.cjs
CHANGED
|
@@ -78958,7 +78958,7 @@ const MessageRow = styled.div`
|
|
|
78958
78958
|
gap: ${({ theme }) => theme.sizing.Size4}px;
|
|
78959
78959
|
padding: ${({ theme }) => theme.sizing.Size3}px;
|
|
78960
78960
|
background-color: ${({ theme, state }) => theme.colors.status[state].surface};
|
|
78961
|
-
width: ${({ theme, state, size, isFullWidth }) => isFullWidth ? "100%" : size === "standard" ? "320px" : "240px"};
|
|
78961
|
+
width: ${({ theme, state, size, $isFullWidth }) => $isFullWidth ? "100%" : size === "standard" ? "320px" : "240px"};
|
|
78962
78962
|
pointer-events: none;
|
|
78963
78963
|
cursor: default;
|
|
78964
78964
|
border-radius: ${({ theme }) => theme.borderRadius.BorderRadiusSm}px;
|
|
@@ -78968,7 +78968,7 @@ const MessageContent = styled.div`
|
|
|
78968
78968
|
align-items: center;
|
|
78969
78969
|
gap: ${({ theme }) => theme.sizing.Size2}px;
|
|
78970
78970
|
flex: 1;
|
|
78971
|
-
max-width: ${({ size, action, isFullWidth }) => isFullWidth ? "
|
|
78971
|
+
max-width: ${({ size, action, $isFullWidth }) => $isFullWidth ? "700px" : size === "standard" || !action ? "320px" : "240px"};
|
|
78972
78972
|
|
|
78973
78973
|
.ant-typography {
|
|
78974
78974
|
display: -webkit-box;
|
|
@@ -79044,8 +79044,8 @@ const Message = ({
|
|
|
79044
79044
|
const [linkColor, setLinkColor] = React.useState(
|
|
79045
79045
|
theme.colors.interactive.link.active
|
|
79046
79046
|
);
|
|
79047
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(MessageRow, { state, size, isFullWidth, children: [
|
|
79048
|
-
/* @__PURE__ */ jsxRuntime.jsxs(MessageContent, { action, size, isFullWidth, children: [
|
|
79047
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(MessageRow, { state, size, $isFullWidth: isFullWidth, children: [
|
|
79048
|
+
/* @__PURE__ */ jsxRuntime.jsxs(MessageContent, { action, size, $isFullWidth: isFullWidth, children: [
|
|
79049
79049
|
getIcon(state, color2),
|
|
79050
79050
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
79051
79051
|
Typography,
|
|
@@ -81625,7 +81625,10 @@ const Progress = ({
|
|
|
81625
81625
|
] });
|
|
81626
81626
|
}
|
|
81627
81627
|
if (isProgressCombined) {
|
|
81628
|
-
const combinedPercent = getCombinedPercent(
|
|
81628
|
+
const combinedPercent = getCombinedPercent(
|
|
81629
|
+
firstBarData,
|
|
81630
|
+
secondBarData || null
|
|
81631
|
+
);
|
|
81629
81632
|
const textColor = Number(combinedPercent) === 100 ? "green" : "black";
|
|
81630
81633
|
const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
|
|
81631
81634
|
const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
|
|
@@ -84812,8 +84815,10 @@ const ResizableTitle = (props) => {
|
|
|
84812
84815
|
const InfiniteScrollTable = ({
|
|
84813
84816
|
columns: initialColumns,
|
|
84814
84817
|
fetchService,
|
|
84818
|
+
title = "Data",
|
|
84815
84819
|
scrollHeight = 600,
|
|
84816
84820
|
scrollWidth = 1300,
|
|
84821
|
+
useWindowScroll = false,
|
|
84817
84822
|
onChange,
|
|
84818
84823
|
rowSelection,
|
|
84819
84824
|
onRowClick,
|
|
@@ -84882,19 +84887,37 @@ const InfiniteScrollTable = ({
|
|
|
84882
84887
|
}));
|
|
84883
84888
|
const lastRowRef = React.useCallback(
|
|
84884
84889
|
(node2) => {
|
|
84885
|
-
if (isFetchingNextPage
|
|
84890
|
+
if (isFetchingNextPage) return;
|
|
84886
84891
|
if (observer.current) observer.current.disconnect();
|
|
84887
|
-
|
|
84888
|
-
|
|
84889
|
-
|
|
84890
|
-
|
|
84891
|
-
|
|
84892
|
-
|
|
84893
|
-
|
|
84894
|
-
|
|
84892
|
+
if (useWindowScroll) {
|
|
84893
|
+
observer.current = new IntersectionObserver(
|
|
84894
|
+
(entries) => {
|
|
84895
|
+
if (entries[0].isIntersecting && hasNextPage) {
|
|
84896
|
+
fetchNextPage();
|
|
84897
|
+
}
|
|
84898
|
+
},
|
|
84899
|
+
{ root: null, threshold: 0.1, rootMargin: "100px" }
|
|
84900
|
+
);
|
|
84901
|
+
} else {
|
|
84902
|
+
if (!scrollableNode) return;
|
|
84903
|
+
observer.current = new IntersectionObserver(
|
|
84904
|
+
(entries) => {
|
|
84905
|
+
if (entries[0].isIntersecting && hasNextPage) {
|
|
84906
|
+
fetchNextPage();
|
|
84907
|
+
}
|
|
84908
|
+
},
|
|
84909
|
+
{ root: scrollableNode, threshold: 0.5 }
|
|
84910
|
+
);
|
|
84911
|
+
}
|
|
84895
84912
|
if (node2) observer.current.observe(node2);
|
|
84896
84913
|
},
|
|
84897
|
-
[
|
|
84914
|
+
[
|
|
84915
|
+
isFetchingNextPage,
|
|
84916
|
+
hasNextPage,
|
|
84917
|
+
fetchNextPage,
|
|
84918
|
+
scrollableNode,
|
|
84919
|
+
useWindowScroll
|
|
84920
|
+
]
|
|
84898
84921
|
);
|
|
84899
84922
|
const rawDataSource = data?.pages.flatMap((page) => page.docs) ?? [];
|
|
84900
84923
|
const filteredDataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
|
|
@@ -84975,7 +84998,7 @@ const InfiniteScrollTable = ({
|
|
|
84975
84998
|
pagination: false,
|
|
84976
84999
|
showSorterTooltip: false,
|
|
84977
85000
|
size: "small",
|
|
84978
|
-
scroll: { y: scrollHeight, x: scrollWidth },
|
|
85001
|
+
scroll: useWindowScroll ? { x: scrollWidth } : { y: scrollHeight, x: scrollWidth },
|
|
84979
85002
|
onChange: () => {
|
|
84980
85003
|
},
|
|
84981
85004
|
rowSelection: finalRowSelection,
|
|
@@ -85133,10 +85156,10 @@ function Table({
|
|
|
85133
85156
|
title: infiniteScrollConfig.title,
|
|
85134
85157
|
scrollHeight: infiniteScrollConfig.scrollHeight,
|
|
85135
85158
|
scrollWidth: infiniteScrollConfig.scrollWidth,
|
|
85159
|
+
useWindowScroll: infiniteScrollConfig.useWindowScroll,
|
|
85136
85160
|
onChange: isInfiniteScroll ? onChange : onChange,
|
|
85137
85161
|
onRowSelectionChange,
|
|
85138
|
-
onDataChange
|
|
85139
|
-
filterFn: infiniteScrollConfig.filterFn
|
|
85162
|
+
onDataChange
|
|
85140
85163
|
}
|
|
85141
85164
|
);
|
|
85142
85165
|
}
|
|
@@ -85778,8 +85801,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85778
85801
|
) : null
|
|
85779
85802
|
]
|
|
85780
85803
|
}
|
|
85781
|
-
)
|
|
85782
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: 100, height: 0 } })
|
|
85804
|
+
)
|
|
85783
85805
|
]
|
|
85784
85806
|
}
|
|
85785
85807
|
);
|
|
@@ -85893,9 +85915,10 @@ const TableWithControls = ({
|
|
|
85893
85915
|
instanceId: infiniteScrollConfig.instanceId,
|
|
85894
85916
|
columns: resizableColumns,
|
|
85895
85917
|
fetchService: infiniteScrollConfig.fetchService,
|
|
85896
|
-
title: infiniteScrollConfig.title,
|
|
85918
|
+
title: infiniteScrollConfig.title || "",
|
|
85897
85919
|
scrollHeight: infiniteScrollConfig.scrollHeight,
|
|
85898
85920
|
scrollWidth: infiniteScrollConfig.scrollWidth,
|
|
85921
|
+
useWindowScroll: infiniteScrollConfig.useWindowScroll,
|
|
85899
85922
|
onChange: onInfiniteScrollTableChange,
|
|
85900
85923
|
rowSelection,
|
|
85901
85924
|
onRowClick: tableOnRowClick || onRowClick,
|
package/dist/index.js
CHANGED
|
@@ -78940,7 +78940,7 @@ const MessageRow = styled.div`
|
|
|
78940
78940
|
gap: ${({ theme }) => theme.sizing.Size4}px;
|
|
78941
78941
|
padding: ${({ theme }) => theme.sizing.Size3}px;
|
|
78942
78942
|
background-color: ${({ theme, state }) => theme.colors.status[state].surface};
|
|
78943
|
-
width: ${({ theme, state, size, isFullWidth }) => isFullWidth ? "100%" : size === "standard" ? "320px" : "240px"};
|
|
78943
|
+
width: ${({ theme, state, size, $isFullWidth }) => $isFullWidth ? "100%" : size === "standard" ? "320px" : "240px"};
|
|
78944
78944
|
pointer-events: none;
|
|
78945
78945
|
cursor: default;
|
|
78946
78946
|
border-radius: ${({ theme }) => theme.borderRadius.BorderRadiusSm}px;
|
|
@@ -78950,7 +78950,7 @@ const MessageContent = styled.div`
|
|
|
78950
78950
|
align-items: center;
|
|
78951
78951
|
gap: ${({ theme }) => theme.sizing.Size2}px;
|
|
78952
78952
|
flex: 1;
|
|
78953
|
-
max-width: ${({ size, action, isFullWidth }) => isFullWidth ? "
|
|
78953
|
+
max-width: ${({ size, action, $isFullWidth }) => $isFullWidth ? "700px" : size === "standard" || !action ? "320px" : "240px"};
|
|
78954
78954
|
|
|
78955
78955
|
.ant-typography {
|
|
78956
78956
|
display: -webkit-box;
|
|
@@ -79026,8 +79026,8 @@ const Message = ({
|
|
|
79026
79026
|
const [linkColor, setLinkColor] = useState(
|
|
79027
79027
|
theme.colors.interactive.link.active
|
|
79028
79028
|
);
|
|
79029
|
-
return /* @__PURE__ */ jsxs(MessageRow, { state, size, isFullWidth, children: [
|
|
79030
|
-
/* @__PURE__ */ jsxs(MessageContent, { action, size, isFullWidth, children: [
|
|
79029
|
+
return /* @__PURE__ */ jsxs(MessageRow, { state, size, $isFullWidth: isFullWidth, children: [
|
|
79030
|
+
/* @__PURE__ */ jsxs(MessageContent, { action, size, $isFullWidth: isFullWidth, children: [
|
|
79031
79031
|
getIcon(state, color2),
|
|
79032
79032
|
/* @__PURE__ */ jsx(
|
|
79033
79033
|
Typography,
|
|
@@ -81607,7 +81607,10 @@ const Progress = ({
|
|
|
81607
81607
|
] });
|
|
81608
81608
|
}
|
|
81609
81609
|
if (isProgressCombined) {
|
|
81610
|
-
const combinedPercent = getCombinedPercent(
|
|
81610
|
+
const combinedPercent = getCombinedPercent(
|
|
81611
|
+
firstBarData,
|
|
81612
|
+
secondBarData || null
|
|
81613
|
+
);
|
|
81611
81614
|
const textColor = Number(combinedPercent) === 100 ? "green" : "black";
|
|
81612
81615
|
const adjustedFirstBar = secondBarData?.value === 100 ? 100 : firstBarData?.value || 0;
|
|
81613
81616
|
const firstBarStrokeColor = theme?.colors?.inputs?.progress?.[firstBarData?.status || "info"];
|
|
@@ -84794,8 +84797,10 @@ const ResizableTitle = (props) => {
|
|
|
84794
84797
|
const InfiniteScrollTable = ({
|
|
84795
84798
|
columns: initialColumns,
|
|
84796
84799
|
fetchService,
|
|
84800
|
+
title = "Data",
|
|
84797
84801
|
scrollHeight = 600,
|
|
84798
84802
|
scrollWidth = 1300,
|
|
84803
|
+
useWindowScroll = false,
|
|
84799
84804
|
onChange,
|
|
84800
84805
|
rowSelection,
|
|
84801
84806
|
onRowClick,
|
|
@@ -84864,19 +84869,37 @@ const InfiniteScrollTable = ({
|
|
|
84864
84869
|
}));
|
|
84865
84870
|
const lastRowRef = useCallback(
|
|
84866
84871
|
(node2) => {
|
|
84867
|
-
if (isFetchingNextPage
|
|
84872
|
+
if (isFetchingNextPage) return;
|
|
84868
84873
|
if (observer.current) observer.current.disconnect();
|
|
84869
|
-
|
|
84870
|
-
|
|
84871
|
-
|
|
84872
|
-
|
|
84873
|
-
|
|
84874
|
-
|
|
84875
|
-
|
|
84876
|
-
|
|
84874
|
+
if (useWindowScroll) {
|
|
84875
|
+
observer.current = new IntersectionObserver(
|
|
84876
|
+
(entries) => {
|
|
84877
|
+
if (entries[0].isIntersecting && hasNextPage) {
|
|
84878
|
+
fetchNextPage();
|
|
84879
|
+
}
|
|
84880
|
+
},
|
|
84881
|
+
{ root: null, threshold: 0.1, rootMargin: "100px" }
|
|
84882
|
+
);
|
|
84883
|
+
} else {
|
|
84884
|
+
if (!scrollableNode) return;
|
|
84885
|
+
observer.current = new IntersectionObserver(
|
|
84886
|
+
(entries) => {
|
|
84887
|
+
if (entries[0].isIntersecting && hasNextPage) {
|
|
84888
|
+
fetchNextPage();
|
|
84889
|
+
}
|
|
84890
|
+
},
|
|
84891
|
+
{ root: scrollableNode, threshold: 0.5 }
|
|
84892
|
+
);
|
|
84893
|
+
}
|
|
84877
84894
|
if (node2) observer.current.observe(node2);
|
|
84878
84895
|
},
|
|
84879
|
-
[
|
|
84896
|
+
[
|
|
84897
|
+
isFetchingNextPage,
|
|
84898
|
+
hasNextPage,
|
|
84899
|
+
fetchNextPage,
|
|
84900
|
+
scrollableNode,
|
|
84901
|
+
useWindowScroll
|
|
84902
|
+
]
|
|
84880
84903
|
);
|
|
84881
84904
|
const rawDataSource = data?.pages.flatMap((page) => page.docs) ?? [];
|
|
84882
84905
|
const filteredDataSource = filterFn ? filterFn(rawDataSource) : rawDataSource;
|
|
@@ -84957,7 +84980,7 @@ const InfiniteScrollTable = ({
|
|
|
84957
84980
|
pagination: false,
|
|
84958
84981
|
showSorterTooltip: false,
|
|
84959
84982
|
size: "small",
|
|
84960
|
-
scroll: { y: scrollHeight, x: scrollWidth },
|
|
84983
|
+
scroll: useWindowScroll ? { x: scrollWidth } : { y: scrollHeight, x: scrollWidth },
|
|
84961
84984
|
onChange: () => {
|
|
84962
84985
|
},
|
|
84963
84986
|
rowSelection: finalRowSelection,
|
|
@@ -85115,10 +85138,10 @@ function Table({
|
|
|
85115
85138
|
title: infiniteScrollConfig.title,
|
|
85116
85139
|
scrollHeight: infiniteScrollConfig.scrollHeight,
|
|
85117
85140
|
scrollWidth: infiniteScrollConfig.scrollWidth,
|
|
85141
|
+
useWindowScroll: infiniteScrollConfig.useWindowScroll,
|
|
85118
85142
|
onChange: isInfiniteScroll ? onChange : onChange,
|
|
85119
85143
|
onRowSelectionChange,
|
|
85120
|
-
onDataChange
|
|
85121
|
-
filterFn: infiniteScrollConfig.filterFn
|
|
85144
|
+
onDataChange
|
|
85122
85145
|
}
|
|
85123
85146
|
);
|
|
85124
85147
|
}
|
|
@@ -85760,8 +85783,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85760
85783
|
) : null
|
|
85761
85784
|
]
|
|
85762
85785
|
}
|
|
85763
|
-
)
|
|
85764
|
-
/* @__PURE__ */ jsx("div", { style: { width: 100, height: 0 } })
|
|
85786
|
+
)
|
|
85765
85787
|
]
|
|
85766
85788
|
}
|
|
85767
85789
|
);
|
|
@@ -85875,9 +85897,10 @@ const TableWithControls = ({
|
|
|
85875
85897
|
instanceId: infiniteScrollConfig.instanceId,
|
|
85876
85898
|
columns: resizableColumns,
|
|
85877
85899
|
fetchService: infiniteScrollConfig.fetchService,
|
|
85878
|
-
title: infiniteScrollConfig.title,
|
|
85900
|
+
title: infiniteScrollConfig.title || "",
|
|
85879
85901
|
scrollHeight: infiniteScrollConfig.scrollHeight,
|
|
85880
85902
|
scrollWidth: infiniteScrollConfig.scrollWidth,
|
|
85903
|
+
useWindowScroll: infiniteScrollConfig.useWindowScroll,
|
|
85881
85904
|
onChange: onInfiniteScrollTableChange,
|
|
85882
85905
|
rowSelection,
|
|
85883
85906
|
onRowClick: tableOnRowClick || onRowClick,
|