@vectara/vectara-ui 20.2.1 → 20.3.0
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.
|
@@ -17,6 +17,7 @@ type Props<T> = {
|
|
|
17
17
|
pagination?: Pagination | Pager;
|
|
18
18
|
selection?: Selection<T>;
|
|
19
19
|
search?: Search;
|
|
20
|
+
activeRowId?: string;
|
|
20
21
|
customControls?: React.ReactNode;
|
|
21
22
|
onSort?: OnSort;
|
|
22
23
|
onReload?: () => void;
|
|
@@ -41,5 +42,5 @@ type Selection<T> = {
|
|
|
41
42
|
selectedRows?: T[];
|
|
42
43
|
};
|
|
43
44
|
type Search = TextInputProps;
|
|
44
|
-
export declare const VuiTable: <T extends Row>({ isLoading, idField, rowDecorator, columns, rows, actions, actionsTestIdProvider, reloadTestId, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, isDisabled, bodyStyle, isHeaderSticky, isResponsive, collapsedContent, defaultSortColumn, defaultSortDirection, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const VuiTable: <T extends Row>({ isLoading, idField, rowDecorator, columns, rows, actions, actionsTestIdProvider, reloadTestId, pagination, selection, search, activeRowId, customControls, onSort, onReload, content, className, fluid, isDisabled, bodyStyle, isHeaderSticky, isResponsive, collapsedContent, defaultSortColumn, defaultSortDirection, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
45
46
|
export {};
|
|
@@ -45,7 +45,7 @@ const extractId = (row, idField) => {
|
|
|
45
45
|
// https://github.com/typescript-eslint/typescript-eslint/issues/4062
|
|
46
46
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
47
47
|
export const VuiTable = (_a) => {
|
|
48
|
-
var { isLoading, idField, rowDecorator, columns, rows, actions, actionsTestIdProvider, reloadTestId, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, isDisabled = false, bodyStyle, isHeaderSticky, isResponsive = true, collapsedContent, defaultSortColumn, defaultSortDirection } = _a, rest = __rest(_a, ["isLoading", "idField", "rowDecorator", "columns", "rows", "actions", "actionsTestIdProvider", "reloadTestId", "pagination", "selection", "search", "customControls", "onSort", "onReload", "content", "className", "fluid", "isDisabled", "bodyStyle", "isHeaderSticky", "isResponsive", "collapsedContent", "defaultSortColumn", "defaultSortDirection"]);
|
|
48
|
+
var { isLoading, idField, rowDecorator, columns, rows, actions, actionsTestIdProvider, reloadTestId, pagination, selection, search, activeRowId, customControls, onSort, onReload, content, className, fluid, isDisabled = false, bodyStyle, isHeaderSticky, isResponsive = true, collapsedContent, defaultSortColumn, defaultSortDirection } = _a, rest = __rest(_a, ["isLoading", "idField", "rowDecorator", "columns", "rows", "actions", "actionsTestIdProvider", "reloadTestId", "pagination", "selection", "search", "activeRowId", "customControls", "onSort", "onReload", "content", "className", "fluid", "isDisabled", "bodyStyle", "isHeaderSticky", "isResponsive", "collapsedContent", "defaultSortColumn", "defaultSortDirection"]);
|
|
49
49
|
const [rowBeingActedUpon, setRowBeingActedUpon] = useState(undefined);
|
|
50
50
|
const [sortColumn, setSortColumn] = useState(defaultSortColumn !== null && defaultSortColumn !== void 0 ? defaultSortColumn : null);
|
|
51
51
|
const [sortDirection, setSortDirection] = useState(defaultSortDirection !== null && defaultSortDirection !== void 0 ? defaultSortDirection : "none");
|
|
@@ -108,7 +108,8 @@ export const VuiTable = (_a) => {
|
|
|
108
108
|
"vuiTableRow-isBeingActedUpon": rowBeingActedUpon === row,
|
|
109
109
|
"vuiTableRow--hasActions": Boolean(actions) || hasExpandableRows,
|
|
110
110
|
"vuiTableRow--isSelectable": Boolean(onSelectRow),
|
|
111
|
-
"vuiTableRow--expanded": isExpanded
|
|
111
|
+
"vuiTableRow--expanded": isExpanded,
|
|
112
|
+
"vuiTableRow-isActive": activeRowId === rowId
|
|
112
113
|
});
|
|
113
114
|
const toggleExpand = () => {
|
|
114
115
|
setExpandedRowIds((prev) => {
|
|
@@ -35,7 +35,6 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
35
35
|
|
|
36
36
|
&.vuiTableRow-isBeingActedUpon,
|
|
37
37
|
&:not(.vuiTableRow--inert):hover {
|
|
38
|
-
background-color: rgba(var(--vui-color-light-shade-rgb), 0.25);
|
|
39
38
|
box-shadow: $shadowSmallEnd;
|
|
40
39
|
border-bottom-color: transparent;
|
|
41
40
|
}
|
|
@@ -60,6 +59,10 @@ $tableResponsiveBreakpointSmall: 500px;
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
|
|
62
|
+
& > tbody > .vuiTableRow-isActive {
|
|
63
|
+
background-color: var(--vui-color-primary-background);
|
|
64
|
+
}
|
|
65
|
+
|
|
63
66
|
& > thead > tr > th {
|
|
64
67
|
font-size: $fontSizeStandard;
|
|
65
68
|
font-weight: $fontWeightBold;
|
package/lib/styles/index.css
CHANGED
|
@@ -5835,7 +5835,6 @@ h2.react-datepicker__current-month {
|
|
|
5835
5835
|
border-bottom: 1px solid var(--vui-color-border-light);
|
|
5836
5836
|
}
|
|
5837
5837
|
.vuiTable > tbody > tr.vuiTableRow-isBeingActedUpon, .vuiTable > tbody > tr:not(.vuiTableRow--inert):hover {
|
|
5838
|
-
background-color: rgba(var(--vui-color-light-shade-rgb), 0.25);
|
|
5839
5838
|
box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
|
|
5840
5839
|
border-bottom-color: transparent;
|
|
5841
5840
|
}
|
|
@@ -5855,6 +5854,9 @@ h2.react-datepicker__current-month {
|
|
|
5855
5854
|
align-items: center;
|
|
5856
5855
|
justify-content: flex-start;
|
|
5857
5856
|
}
|
|
5857
|
+
.vuiTable > tbody > .vuiTableRow-isActive {
|
|
5858
|
+
background-color: var(--vui-color-primary-background);
|
|
5859
|
+
}
|
|
5858
5860
|
.vuiTable > thead > tr > th {
|
|
5859
5861
|
font-size: 14px;
|
|
5860
5862
|
font-weight: 600;
|
package/package.json
CHANGED
|
@@ -41,8 +41,9 @@ export const Table = () => {
|
|
|
41
41
|
const [searchValue, setSearchValue] = useState<string>("");
|
|
42
42
|
const [selectedRows, setSelectedRows] = useState<Person[]>([]);
|
|
43
43
|
const [currentPage, setCurrentPage] = useState(1);
|
|
44
|
-
const [sortColumn, setSortColumn] = useState<string
|
|
44
|
+
const [sortColumn, setSortColumn] = useState<string>();
|
|
45
45
|
const [sortDirection, setSortDirection] = useState<"asc" | "desc" | "none">("asc");
|
|
46
|
+
const [activeRowId, setActiveRowId] = useState<string>();
|
|
46
47
|
|
|
47
48
|
const fetchPeople = () => {
|
|
48
49
|
setIsLoading(true);
|
|
@@ -66,7 +67,7 @@ export const Table = () => {
|
|
|
66
67
|
|
|
67
68
|
const handleSort = (column: string, direction: "asc" | "desc" | "none") => {
|
|
68
69
|
if (direction === "none") {
|
|
69
|
-
setSortColumn(
|
|
70
|
+
setSortColumn(undefined);
|
|
70
71
|
setSortDirection("none");
|
|
71
72
|
} else {
|
|
72
73
|
setSortColumn(column);
|
|
@@ -138,7 +139,7 @@ export const Table = () => {
|
|
|
138
139
|
render: (person: Person) => (
|
|
139
140
|
<div>
|
|
140
141
|
<div>
|
|
141
|
-
<VuiLink onClick={() =>
|
|
142
|
+
<VuiLink onClick={() => setActiveRowId(person.id)}>{person.name}</VuiLink>
|
|
142
143
|
</div>
|
|
143
144
|
|
|
144
145
|
{areNicknamesVisible && (
|
|
@@ -419,6 +420,7 @@ export const Table = () => {
|
|
|
419
420
|
reloadTestId="reloadButton"
|
|
420
421
|
pagination={pagination}
|
|
421
422
|
selection={selection}
|
|
423
|
+
activeRowId={activeRowId}
|
|
422
424
|
onSort={handleSort}
|
|
423
425
|
onReload={onReload}
|
|
424
426
|
search={search}
|