feat: users row actions accept plugin entries

The per-row user actions menu was hard-wired to a fixed list and any
plugin-contributed control had to sit as a separate trigger beside
the dropdown. Move the seam: plugins now contribute dropdown items
directly via `users.rowActions`, and we dispatch the click to the
plugin entry by key while the host's `handleSelect` keeps owning
the built-in keys.

Each entry is `{ key, labelId, icon?, danger?, show?(user), onClick(user) }`.
For UI state the onClick might need (drawers, modals), plugins can
mount a single `components.UsersPageGlobal` slot that the page now
renders once outside the table — typical pattern is a jotai atom
the rowAction writes to and the global slot reads from.

Drop the side-mounted `PluginExtraFields name="UserRowActions"` and
its surrounding `<Space>`; the action column is back to a single
DropdownButtons with all entries in one menu.
This commit is contained in:
gitlawr
2026-05-11 19:30:21 +08:00
committed by jialin
parent df53774628
commit 8d17000272
2 changed files with 79 additions and 17 deletions
+6
View File
@@ -1,3 +1,4 @@
import PluginExtraFields from '@/components/plugin-extra-fields';
import { PageAction } from '@/config';
import { PaginationKey, TABLE_SORT_DIRECTIONS } from '@/config/settings';
import type { PageActionType } from '@/config/types';
@@ -216,6 +217,11 @@ const Users: React.FC = () => {
onOk={handleModalOk}
></AddModal>
<DeleteModal ref={modalRef}></DeleteModal>
{/* Plugin mount point for global Users-page UI (e.g. a
memberships drawer driven from a `users.rowActions`
entry's onClick). Renders nothing when no plugin is
registered. */}
<PluginExtraFields name="UsersPageGlobal" />
</>
);
};