2025-08-08 23:23:07 +03:00
|
|
|
import { ComponentChildren } from "preact";
|
2025-08-09 10:12:26 +03:00
|
|
|
import AbstractBulkAction from "./abstract_bulk_action";
|
2025-08-08 23:23:07 +03:00
|
|
|
|
2025-08-07 20:08:51 +03:00
|
|
|
interface BulkActionProps {
|
2025-08-08 23:23:07 +03:00
|
|
|
label: string;
|
|
|
|
|
children: ComponentChildren;
|
|
|
|
|
helpText?: ComponentChildren;
|
2025-08-09 10:12:26 +03:00
|
|
|
bulkAction: AbstractBulkAction;
|
2025-08-07 20:08:51 +03:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 10:12:26 +03:00
|
|
|
export default function BulkAction({ label, children, helpText, bulkAction }: BulkActionProps) {
|
2025-08-08 23:23:07 +03:00
|
|
|
return (
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2}>
|
|
|
|
|
<div style={{ display: "flex", alignItems: "center" }}>
|
|
|
|
|
<div style={{ marginRight: "10px" }} className="text-nowrap">{label}</div>
|
|
|
|
|
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td className="button-column">
|
|
|
|
|
{helpText && <div className="dropdown help-dropdown">
|
|
|
|
|
<span className="bx bx-help-circle icon-action" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></span>
|
|
|
|
|
<div className="dropdown-menu dropdown-menu-right p-4">
|
|
|
|
|
{helpText}
|
|
|
|
|
</div>
|
|
|
|
|
</div>}
|
|
|
|
|
|
2025-08-09 10:12:26 +03:00
|
|
|
<span
|
|
|
|
|
className="bx bx-x icon-action action-conf-del"
|
|
|
|
|
onClick={() => bulkAction?.deleteAction()}
|
|
|
|
|
/>
|
2025-08-08 23:23:07 +03:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-08-07 20:08:51 +03:00
|
|
|
|
2025-08-08 23:23:07 +03:00
|
|
|
export function BulkActionText({ text }: { text: string }) {
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
style={{ marginRight: "10px", marginLeft: "10px" }}
|
|
|
|
|
className="text-nowrap">
|
|
|
|
|
{text}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2025-08-07 20:08:51 +03:00
|
|
|
}
|