mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
* feat: Multi-select in the users settings table Adds multi-selection to the base settings table — a table opts in by supplying `isRowSelectable` and a `selectionToolbar`, reusing the model selection and toolbar infrastructure built for document lists. User actions are updated to the context based format so the same definitions drive the row menu and the bulk toolbar. * feat: Multi-select in the groups settings table Group deletion now operates on every active group so it can be performed from the bulk selection toolbar as well as the row menu. * feat: Multi-select in the group members settings table Group member removal and permission changes now operate on every active user, so they can be performed from the bulk selection toolbar as well as the row menu. * fix: Table selection styling feedback Lighten the selected row tint and drop the opaque background from the sticky actions cell so the row shows through. The selection checkbox is positioned absolutely so it centers in the row without influencing the cell's inline layout. * fix: Bleed the selected table row highlight past the table edges The highlight is drawn on a pseudo element behind the cells so it can extend 8px either side of the table and be rounded. * fix: Join the highlight of adjacent selected table rows Square off the corners between neighbouring selected rows so a run of them reads as one rounded block. * tweaks * Add new icons, styling tweaks * fix: Make the base key of new count strings singular i18next resolves the base key for count=1, which happens on a partial batch success, so the singular form belongs there and the plural in the _plural value.
31 lines
927 B
TypeScript
31 lines
927 B
TypeScript
import type { ColumnSort } from "@tanstack/react-table";
|
|
import { useCallback } from "react";
|
|
import { useHistory } from "react-router-dom";
|
|
import lazyWithRetry from "~/utils/lazyWithRetry";
|
|
import type { Props as TableProps, RowData } from "./Table";
|
|
|
|
const Table = lazyWithRetry(() => import("~/components/Table"));
|
|
|
|
export type Props<T> = Omit<TableProps<T>, "onChangeSort">;
|
|
|
|
export function SortableTable<T extends RowData>(props: Props<T>) {
|
|
const history = useHistory();
|
|
|
|
const handleChangeSort = useCallback(
|
|
(sort: ColumnSort) => {
|
|
const { pathname, search } = history.location;
|
|
const params = new URLSearchParams(search);
|
|
params.set("sort", sort.id);
|
|
params.set("direction", sort.desc ? "desc" : "asc");
|
|
|
|
history.replace({
|
|
pathname,
|
|
search: params.toString(),
|
|
});
|
|
},
|
|
[history]
|
|
);
|
|
|
|
return <Table onChangeSort={handleChangeSort} {...props} />;
|
|
}
|