@gobolt/genesis 0.4.37 → 0.4.39
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,5 +1,6 @@
|
|
|
1
1
|
import { Change } from '../Table';
|
|
2
2
|
import { InfiniteScrollChangeEvent } from '../InfiniteScrollTable/types';
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
export type Groups = {
|
|
4
5
|
[key: string]: string[];
|
|
5
6
|
};
|
|
@@ -10,6 +11,8 @@ export interface SecondaryTableControlsRowProps {
|
|
|
10
11
|
infiniteScrollData?: InfiniteScrollChangeEvent;
|
|
11
12
|
intialRowTotal?: number;
|
|
12
13
|
hasExternalFilters?: boolean;
|
|
14
|
+
getCustomIcon?: (title: string) => React.ReactNode | null;
|
|
15
|
+
filteredResultsCount?: number;
|
|
13
16
|
}
|
|
14
|
-
declare const SecondaryTableControlsRow: ({ groups, totalRecords, onChange, infiniteScrollData, intialRowTotal, hasExternalFilters, }: SecondaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const SecondaryTableControlsRow: ({ groups, totalRecords, onChange, infiniteScrollData, intialRowTotal, hasExternalFilters, getCustomIcon, filteredResultsCount, }: SecondaryTableControlsRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
export default SecondaryTableControlsRow;
|
package/dist/index.cjs
CHANGED
|
@@ -85734,7 +85734,12 @@ const PrimaryTableControlsRow = ({
|
|
|
85734
85734
|
}
|
|
85735
85735
|
);
|
|
85736
85736
|
};
|
|
85737
|
-
const GroupItem = ({
|
|
85737
|
+
const GroupItem = ({
|
|
85738
|
+
title,
|
|
85739
|
+
items,
|
|
85740
|
+
onGroupItemClick,
|
|
85741
|
+
getCustomIcon
|
|
85742
|
+
}) => {
|
|
85738
85743
|
if (items.length === 0) return null;
|
|
85739
85744
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
85740
85745
|
/* @__PURE__ */ jsxRuntime.jsx(Tooltip2, { tip: title, isAbsolutePositioned: false, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -85747,7 +85752,7 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
|
|
|
85747
85752
|
width: 24,
|
|
85748
85753
|
height: 24
|
|
85749
85754
|
},
|
|
85750
|
-
children: getIcon$1(title)
|
|
85755
|
+
children: getCustomIcon ? getCustomIcon(title) : getIcon$1(title)
|
|
85751
85756
|
}
|
|
85752
85757
|
) }),
|
|
85753
85758
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 4 }, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -85764,7 +85769,11 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
|
|
|
85764
85769
|
)) })
|
|
85765
85770
|
] });
|
|
85766
85771
|
};
|
|
85767
|
-
const GroupsRow = ({
|
|
85772
|
+
const GroupsRow = ({
|
|
85773
|
+
groups,
|
|
85774
|
+
onGroupItemClick,
|
|
85775
|
+
getCustomIcon
|
|
85776
|
+
}) => {
|
|
85768
85777
|
if (!groups) return null;
|
|
85769
85778
|
const groupArray = Object.entries(groups).map(([title, items]) => ({
|
|
85770
85779
|
title,
|
|
@@ -85775,7 +85784,8 @@ const GroupsRow = ({ groups, onGroupItemClick }) => {
|
|
|
85775
85784
|
{
|
|
85776
85785
|
title: group.title,
|
|
85777
85786
|
items: group.items,
|
|
85778
|
-
onGroupItemClick
|
|
85787
|
+
onGroupItemClick,
|
|
85788
|
+
getCustomIcon
|
|
85779
85789
|
},
|
|
85780
85790
|
group.title
|
|
85781
85791
|
)) : null });
|
|
@@ -85786,7 +85796,9 @@ const SecondaryTableControlsRow = ({
|
|
|
85786
85796
|
onChange,
|
|
85787
85797
|
infiniteScrollData,
|
|
85788
85798
|
intialRowTotal = 40,
|
|
85789
|
-
hasExternalFilters = false
|
|
85799
|
+
hasExternalFilters = false,
|
|
85800
|
+
getCustomIcon,
|
|
85801
|
+
filteredResultsCount
|
|
85790
85802
|
}) => {
|
|
85791
85803
|
const [hasChanged, setHasChanged] = React__namespace.useState(false);
|
|
85792
85804
|
const onGroupItemClick = (title, item) => {
|
|
@@ -85818,7 +85830,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85818
85830
|
};
|
|
85819
85831
|
}, [infiniteScrollData, groups, hasExternalFilters]);
|
|
85820
85832
|
const isGroupsEmpty = groups ? Object.values(groups).every((items) => items.length === 0) : true;
|
|
85821
|
-
|
|
85833
|
+
infiniteScrollData && Number(infiniteScrollData?.resultsShown) > intialRowTotal || !isGroupsEmpty;
|
|
85822
85834
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
85823
85835
|
"div",
|
|
85824
85836
|
{
|
|
@@ -85829,8 +85841,14 @@ const SecondaryTableControlsRow = ({
|
|
|
85829
85841
|
marginTop: 8
|
|
85830
85842
|
},
|
|
85831
85843
|
children: [
|
|
85832
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
85833
|
-
|
|
85844
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
85845
|
+
GroupsRow,
|
|
85846
|
+
{
|
|
85847
|
+
groups,
|
|
85848
|
+
onGroupItemClick,
|
|
85849
|
+
getCustomIcon
|
|
85850
|
+
}
|
|
85851
|
+
) }),
|
|
85834
85852
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
85835
85853
|
"div",
|
|
85836
85854
|
{
|
|
@@ -85842,7 +85860,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85842
85860
|
marginRight: 16
|
|
85843
85861
|
},
|
|
85844
85862
|
children: [
|
|
85845
|
-
|
|
85863
|
+
filteredResultsCount && hasChanged ? /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body3", color: "#6C6C6C", children: `${filteredResultsCount} results` }) : null,
|
|
85846
85864
|
!isGroupsEmpty || hasExternalFilters ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
85847
85865
|
"button",
|
|
85848
85866
|
{
|
|
@@ -85905,7 +85923,9 @@ const TableControls = ({
|
|
|
85905
85923
|
onChange: onSecondaryChange,
|
|
85906
85924
|
infiniteScrollData: secondaryTableRowData.infiniteScrollData,
|
|
85907
85925
|
hasExternalFilters: secondaryTableRowData.hasExternalFilters,
|
|
85908
|
-
intialRowTotal: secondaryTableRowData.intialRowTotal
|
|
85926
|
+
intialRowTotal: secondaryTableRowData.intialRowTotal,
|
|
85927
|
+
filteredResultsCount: secondaryTableRowData.filteredResultsCount,
|
|
85928
|
+
getCustomIcon: secondaryTableRowData.getCustomIcon
|
|
85909
85929
|
}
|
|
85910
85930
|
) : null
|
|
85911
85931
|
]
|
package/dist/index.js
CHANGED
|
@@ -85716,7 +85716,12 @@ const PrimaryTableControlsRow = ({
|
|
|
85716
85716
|
}
|
|
85717
85717
|
);
|
|
85718
85718
|
};
|
|
85719
|
-
const GroupItem = ({
|
|
85719
|
+
const GroupItem = ({
|
|
85720
|
+
title,
|
|
85721
|
+
items,
|
|
85722
|
+
onGroupItemClick,
|
|
85723
|
+
getCustomIcon
|
|
85724
|
+
}) => {
|
|
85720
85725
|
if (items.length === 0) return null;
|
|
85721
85726
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
85722
85727
|
/* @__PURE__ */ jsx(Tooltip2, { tip: title, isAbsolutePositioned: false, children: /* @__PURE__ */ jsx(
|
|
@@ -85729,7 +85734,7 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
|
|
|
85729
85734
|
width: 24,
|
|
85730
85735
|
height: 24
|
|
85731
85736
|
},
|
|
85732
|
-
children: getIcon$1(title)
|
|
85737
|
+
children: getCustomIcon ? getCustomIcon(title) : getIcon$1(title)
|
|
85733
85738
|
}
|
|
85734
85739
|
) }),
|
|
85735
85740
|
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4 }, children: items.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -85746,7 +85751,11 @@ const GroupItem = ({ title, items, onGroupItemClick }) => {
|
|
|
85746
85751
|
)) })
|
|
85747
85752
|
] });
|
|
85748
85753
|
};
|
|
85749
|
-
const GroupsRow = ({
|
|
85754
|
+
const GroupsRow = ({
|
|
85755
|
+
groups,
|
|
85756
|
+
onGroupItemClick,
|
|
85757
|
+
getCustomIcon
|
|
85758
|
+
}) => {
|
|
85750
85759
|
if (!groups) return null;
|
|
85751
85760
|
const groupArray = Object.entries(groups).map(([title, items]) => ({
|
|
85752
85761
|
title,
|
|
@@ -85757,7 +85766,8 @@ const GroupsRow = ({ groups, onGroupItemClick }) => {
|
|
|
85757
85766
|
{
|
|
85758
85767
|
title: group.title,
|
|
85759
85768
|
items: group.items,
|
|
85760
|
-
onGroupItemClick
|
|
85769
|
+
onGroupItemClick,
|
|
85770
|
+
getCustomIcon
|
|
85761
85771
|
},
|
|
85762
85772
|
group.title
|
|
85763
85773
|
)) : null });
|
|
@@ -85768,7 +85778,9 @@ const SecondaryTableControlsRow = ({
|
|
|
85768
85778
|
onChange,
|
|
85769
85779
|
infiniteScrollData,
|
|
85770
85780
|
intialRowTotal = 40,
|
|
85771
|
-
hasExternalFilters = false
|
|
85781
|
+
hasExternalFilters = false,
|
|
85782
|
+
getCustomIcon,
|
|
85783
|
+
filteredResultsCount
|
|
85772
85784
|
}) => {
|
|
85773
85785
|
const [hasChanged, setHasChanged] = React.useState(false);
|
|
85774
85786
|
const onGroupItemClick = (title, item) => {
|
|
@@ -85800,7 +85812,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85800
85812
|
};
|
|
85801
85813
|
}, [infiniteScrollData, groups, hasExternalFilters]);
|
|
85802
85814
|
const isGroupsEmpty = groups ? Object.values(groups).every((items) => items.length === 0) : true;
|
|
85803
|
-
|
|
85815
|
+
infiniteScrollData && Number(infiniteScrollData?.resultsShown) > intialRowTotal || !isGroupsEmpty;
|
|
85804
85816
|
return /* @__PURE__ */ jsxs(
|
|
85805
85817
|
"div",
|
|
85806
85818
|
{
|
|
@@ -85811,8 +85823,14 @@ const SecondaryTableControlsRow = ({
|
|
|
85811
85823
|
marginTop: 8
|
|
85812
85824
|
},
|
|
85813
85825
|
children: [
|
|
85814
|
-
/* @__PURE__ */ jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsx(
|
|
85815
|
-
|
|
85826
|
+
/* @__PURE__ */ jsx("div", { style: { minWidth: 100 }, children: /* @__PURE__ */ jsx(
|
|
85827
|
+
GroupsRow,
|
|
85828
|
+
{
|
|
85829
|
+
groups,
|
|
85830
|
+
onGroupItemClick,
|
|
85831
|
+
getCustomIcon
|
|
85832
|
+
}
|
|
85833
|
+
) }),
|
|
85816
85834
|
/* @__PURE__ */ jsxs(
|
|
85817
85835
|
"div",
|
|
85818
85836
|
{
|
|
@@ -85824,7 +85842,7 @@ const SecondaryTableControlsRow = ({
|
|
|
85824
85842
|
marginRight: 16
|
|
85825
85843
|
},
|
|
85826
85844
|
children: [
|
|
85827
|
-
|
|
85845
|
+
filteredResultsCount && hasChanged ? /* @__PURE__ */ jsx(Typography, { variant: "body3", color: "#6C6C6C", children: `${filteredResultsCount} results` }) : null,
|
|
85828
85846
|
!isGroupsEmpty || hasExternalFilters ? /* @__PURE__ */ jsx(
|
|
85829
85847
|
"button",
|
|
85830
85848
|
{
|
|
@@ -85887,7 +85905,9 @@ const TableControls = ({
|
|
|
85887
85905
|
onChange: onSecondaryChange,
|
|
85888
85906
|
infiniteScrollData: secondaryTableRowData.infiniteScrollData,
|
|
85889
85907
|
hasExternalFilters: secondaryTableRowData.hasExternalFilters,
|
|
85890
|
-
intialRowTotal: secondaryTableRowData.intialRowTotal
|
|
85908
|
+
intialRowTotal: secondaryTableRowData.intialRowTotal,
|
|
85909
|
+
filteredResultsCount: secondaryTableRowData.filteredResultsCount,
|
|
85910
|
+
getCustomIcon: secondaryTableRowData.getCustomIcon
|
|
85891
85911
|
}
|
|
85892
85912
|
) : null
|
|
85893
85913
|
]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
export declare const getIcon: (name: string) => import("react/jsx-runtime").JSX.Element | null;
|
|
2
3
|
export declare const getIconColor: (state: any, theme: any) => any;
|
|
3
|
-
export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: React.ReactNode | null | undefined) => string | number | true | Iterable<
|
|
4
|
+
export declare const getBadgeStateIcon: (state: any, color: any, isFilled?: boolean, hasIcon?: boolean, customIcon?: React.ReactNode | null | undefined) => string | number | true | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|