mirror of
https://github.com/outline/outline.git
synced 2026-11-28 08:14:58 +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.
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import {
|
|
archiveDocument,
|
|
deleteDocument,
|
|
pinDocumentToCollection,
|
|
restoreDocument,
|
|
starDocument,
|
|
unpinDocument,
|
|
unpublishDocument,
|
|
unstarDocument,
|
|
} from "~/actions/definitions/documents";
|
|
import { ModelSelectionActionToolbar } from "~/components/ModelSelectionActionToolbar";
|
|
import { useModelSelection } from "~/components/ModelSelectionContext";
|
|
import useStores from "~/hooks/useStores";
|
|
import type Document from "~/models/Document";
|
|
import type { Action } from "~/types";
|
|
|
|
/**
|
|
* The document actions offered in the bulk selection toolbar. These are the
|
|
* same action definitions used by document menus — they operate on the active
|
|
* models, which the toolbar feeds from the current selection.
|
|
*/
|
|
const toolbarActions: Action[] = [
|
|
starDocument,
|
|
unstarDocument,
|
|
pinDocumentToCollection,
|
|
unpinDocument,
|
|
archiveDocument,
|
|
unpublishDocument,
|
|
restoreDocument,
|
|
deleteDocument,
|
|
];
|
|
|
|
/**
|
|
* Renders the selection toolbar with the standard document actions.
|
|
*
|
|
* @returns the toolbar element, or null when no list selection is in scope.
|
|
*/
|
|
function DocumentSelectionToolbar() {
|
|
const selection = useModelSelection();
|
|
const { documents } = useStores();
|
|
|
|
if (!selection) {
|
|
return null;
|
|
}
|
|
|
|
const selectedDocuments = selection.selectedIds
|
|
.map((id) => documents.get(id))
|
|
.filter((document): document is Document => !!document);
|
|
|
|
return (
|
|
<ModelSelectionActionToolbar
|
|
models={selectedDocuments}
|
|
actions={toolbarActions}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default observer(DocumentSelectionToolbar);
|