@vectara/vectara-ui 15.5.0 → 15.5.2
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.
|
@@ -28,6 +28,8 @@ type Props<T> = {
|
|
|
28
28
|
isHeaderSticky?: boolean;
|
|
29
29
|
isResponsive?: boolean;
|
|
30
30
|
collapsedContent?: (row: T) => React.ReactNode;
|
|
31
|
+
defaultSortColumn?: string;
|
|
32
|
+
defaultSortDirection?: "asc" | "desc";
|
|
31
33
|
};
|
|
32
34
|
type BodyStyle = {
|
|
33
35
|
verticalAlign?: "top" | "middle" | "bottom";
|
|
@@ -39,5 +41,5 @@ type Selection<T> = {
|
|
|
39
41
|
selectedRows?: T[];
|
|
40
42
|
};
|
|
41
43
|
type Search = TextInputProps;
|
|
42
|
-
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, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
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;
|
|
43
45
|
export {};
|
|
@@ -44,10 +44,10 @@ const extractId = (row, idField) => {
|
|
|
44
44
|
// https://github.com/typescript-eslint/typescript-eslint/issues/4062
|
|
45
45
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
46
46
|
export const VuiTable = (_a) => {
|
|
47
|
-
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 } = _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"]);
|
|
47
|
+
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
48
|
const [rowBeingActedUpon, setRowBeingActedUpon] = useState(undefined);
|
|
49
|
-
const [sortColumn, setSortColumn] = useState(null);
|
|
50
|
-
const [sortDirection, setSortDirection] = useState("none");
|
|
49
|
+
const [sortColumn, setSortColumn] = useState(defaultSortColumn !== null && defaultSortColumn !== void 0 ? defaultSortColumn : null);
|
|
50
|
+
const [sortDirection, setSortDirection] = useState(defaultSortDirection !== null && defaultSortDirection !== void 0 ? defaultSortDirection : "none");
|
|
51
51
|
const [expandedRowIds, setExpandedRowIds] = useState(new Set());
|
|
52
52
|
const { bulkActions, isRowSelectable, onSelectRow, selectedRows } = selection || {};
|
|
53
53
|
const { value: searchValue } = search || {};
|
|
@@ -147,7 +147,7 @@ export const VuiTable = (_a) => {
|
|
|
147
147
|
else {
|
|
148
148
|
setRowBeingActedUpon(undefined);
|
|
149
149
|
}
|
|
150
|
-
}, testId: (_c = actionsTestIdProvider === null || actionsTestIdProvider === void 0 ? void 0 : actionsTestIdProvider(row)) !== null && _c !== void 0 ? _c : undefined }) }))), hasExpandableRows && (_jsx(VuiFlexItem, Object.assign({ grow: false, className: "vuiTableRowExpandToggle" }, { children: _jsx(VuiIconButton, { icon: _jsx(VuiIcon, { children: isExpanded ? _jsx(BiChevronDown, {}) : _jsx(BiChevronRight, {}) }), size: "s", color: "neutral", "aria-label": isExpanded ? "Collapse row" : "Expand row", onClick: toggleExpand }) })))] })) })))] })), hasExpandableRows && isExpanded && (_jsx("tr", Object.assign({ className: "vuiTableRowExpandedContent vuiTableRow--inert" }, { children: _jsx("td", Object.assign({ className: "vuiTableRowExpandedContent__cell", colSpan: columnCount }, { children: collapsedContent(row) })) })))] }, rowId));
|
|
150
|
+
}, testId: (_c = actionsTestIdProvider === null || actionsTestIdProvider === void 0 ? void 0 : actionsTestIdProvider(row)) !== null && _c !== void 0 ? _c : undefined }) }))), hasExpandableRows && (_jsx(VuiFlexItem, Object.assign({ grow: false, className: "vuiTableRowExpandToggle" }, { children: _jsx(VuiIconButton, { icon: _jsx(VuiIcon, { children: isExpanded ? _jsx(BiChevronDown, {}) : _jsx(BiChevronRight, {}) }), size: "s", color: "neutral", "aria-label": isExpanded ? "Collapse row" : "Expand row", onClick: toggleExpand, "data-testid": `expandToggle-${rowId}` }) })))] })) })))] })), hasExpandableRows && isExpanded && (_jsx("tr", Object.assign({ className: "vuiTableRowExpandedContent vuiTableRow--inert" }, { children: _jsx("td", Object.assign({ className: "vuiTableRowExpandedContent__cell", colSpan: columnCount }, { children: collapsedContent(row) })) })))] }, rowId));
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
const selectAllCheckboxProps = {
|