added dropdown mode
This commit is contained in:
parent
9dc2f811dd
commit
27cbd18fa1
@ -76,14 +76,12 @@ const PmGridCollection = ({ selectedProject, fromDate, toDate, isPending }) => {
|
|||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
|
|
||||||
// MUST use totalRows only
|
|
||||||
total: api.totalEntities,
|
total: api.totalEntities,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PmsGrid
|
<PmsGrid
|
||||||
|
|
||||||
columns={columns}
|
columns={columns}
|
||||||
serverMode
|
serverMode
|
||||||
fetcher={fetcher}
|
fetcher={fetcher}
|
||||||
@ -102,6 +100,19 @@ const PmGridCollection = ({ selectedProject, fromDate, toDate, isPending }) => {
|
|||||||
pinning: true,
|
pinning: true,
|
||||||
IsNumbering: true,
|
IsNumbering: true,
|
||||||
grouping: true,
|
grouping: true,
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: "Edit",
|
||||||
|
icon: "bx-edit ",
|
||||||
|
onClick: (row) => console.log("Edit", row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Delete",
|
||||||
|
icon: "bx-trash text-danger",
|
||||||
|
onClick: (row) => console.log("Delete", row),
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export default function PmsGrid({
|
|||||||
serverMode = false,
|
serverMode = false,
|
||||||
fetcher,
|
fetcher,
|
||||||
rowKey = "id",
|
rowKey = "id",
|
||||||
|
isDropdown = false,
|
||||||
features = {},
|
features = {},
|
||||||
renderExpanded,
|
renderExpanded,
|
||||||
}) {
|
}) {
|
||||||
@ -390,7 +391,7 @@ export default function PmsGrid({
|
|||||||
{!loading && groupBy && groupedRows && groupedRows.length > 0
|
{!loading && groupBy && groupedRows && groupedRows.length > 0
|
||||||
? groupedRows.map((g) => (
|
? groupedRows.map((g) => (
|
||||||
<React.Fragment key={g.key}>
|
<React.Fragment key={g.key}>
|
||||||
<tr className="table-secondary border-0">
|
<tr className="table-secondary border-0 tr-group" >
|
||||||
<td
|
<td
|
||||||
colSpan={
|
colSpan={
|
||||||
visibleColumns.length +
|
visibleColumns.length +
|
||||||
@ -529,6 +530,36 @@ export default function PmsGrid({
|
|||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{isDropdown ? (
|
||||||
|
<div className="dropdown z-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-icon btn-text-secondary rounded-pill dropdown-toggle hide-arrow p-0"
|
||||||
|
data-bs-toggle="dropdown"
|
||||||
|
aria-expanded="false"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="bx bx-dots-vertical-rounded bx-sm text-muted"
|
||||||
|
data-bs-toggle="tooltip"
|
||||||
|
data-bs-offset="0,8"
|
||||||
|
data-bs-placement="top"
|
||||||
|
data-bs-custom-class="tooltip-dark"
|
||||||
|
title="More Action"
|
||||||
|
></i>
|
||||||
|
</button>
|
||||||
|
<ul className="dropdown-menu dropdown-menu-end">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
aria-label="click to View details"
|
||||||
|
className="dropdown-item"
|
||||||
|
>
|
||||||
|
<i className="bx bx-detail me-2"></i>
|
||||||
|
<span className="align-left">View details</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<div
|
<div
|
||||||
className="d-inline-flex justify-content-center align-items-center gap-2"
|
className="d-inline-flex justify-content-center align-items-center gap-2"
|
||||||
style={{ minWidth: "fit-content", padding: "0 4px" }}
|
style={{ minWidth: "fit-content", padding: "0 4px" }}
|
||||||
@ -552,6 +583,7 @@ export default function PmsGrid({
|
|||||||
? features.actions(row, toggleExpand)
|
? features.actions(row, toggleExpand)
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
)}
|
)}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user