trithuc-mvc-react 3.5.6 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -416,14 +416,14 @@ export const FilterGod = ({
|
|
|
416
416
|
{/* Action Buttons */}
|
|
417
417
|
{filterButtons.length > 0 && (
|
|
418
418
|
<>
|
|
419
|
-
<Divider sx={{ my:
|
|
419
|
+
<Divider sx={{ my: "5px", opacity: 0.6 }} />
|
|
420
420
|
<Box sx={{ display: "flex", justifyContent: "flex-end", gap: 2 }}>
|
|
421
421
|
{filterButtons.map((btn, idx) => (
|
|
422
422
|
<ActionButton
|
|
423
423
|
key={idx}
|
|
424
424
|
size={elementSize}
|
|
425
|
-
variant={btn.variant || "
|
|
426
|
-
color={btn.color || "
|
|
425
|
+
variant={btn.variant || "outlined"}
|
|
426
|
+
color={btn.color || "#1976d2 !important"}
|
|
427
427
|
onClick={() => btn.onClick({ dataSearch })}
|
|
428
428
|
startIcon={btn.element}
|
|
429
429
|
disableElevation
|
|
@@ -135,18 +135,20 @@ export const TableRowRender = ({
|
|
|
135
135
|
</IconButton>
|
|
136
136
|
</Tooltip>
|
|
137
137
|
)}
|
|
138
|
-
{tableActionsOnTable.map(({ title, onClick, element, visible }) =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
>
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
{tableActionsOnTable.map(({ title, onClick, element, visible }) => {
|
|
139
|
+
// Kiểm tra điều kiện hiển thị ở đây
|
|
140
|
+
if (typeof visible === "function" && !visible(row)) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Tooltip key={title} title={title}>
|
|
146
|
+
<IconButton size={downXl ? "small" : "medium"} onClick={() => onClick(row)}>
|
|
147
|
+
{element}
|
|
148
|
+
</IconButton>
|
|
149
|
+
</Tooltip>
|
|
150
|
+
);
|
|
151
|
+
})}
|
|
150
152
|
|
|
151
153
|
{<MoreMenu actions={tableActionsOnMoreMenu} data={row} />}
|
|
152
154
|
</TableCell>
|
|
@@ -148,15 +148,7 @@ export const TableRowRenderSM = ({
|
|
|
148
148
|
)}
|
|
149
149
|
|
|
150
150
|
{/* Các nút thao tác */}
|
|
151
|
-
<Box
|
|
152
|
-
mt={2}
|
|
153
|
-
pt={1}
|
|
154
|
-
borderTop="1px solid"
|
|
155
|
-
borderColor="divider"
|
|
156
|
-
display="flex"
|
|
157
|
-
flexDirection="column"
|
|
158
|
-
gap={1}
|
|
159
|
-
>
|
|
151
|
+
<Box mt={2} pt={1} borderTop="1px solid" borderColor="divider" display="flex" flexDirection="column" gap={1}>
|
|
160
152
|
{!disableCellThaoTac && (
|
|
161
153
|
<>
|
|
162
154
|
<Box display="grid" gridTemplateColumns={isMobile ? "repeat(3, 1fr)" : "auto"} gap={0.5}>
|
|
@@ -295,52 +287,56 @@ export const TableRowRenderSM = ({
|
|
|
295
287
|
</Tooltip>
|
|
296
288
|
)}
|
|
297
289
|
|
|
298
|
-
{tableActionsOnTable.map(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<Tooltip key={idx} title={title} arrow placement="top">
|
|
302
|
-
<span>
|
|
303
|
-
<Button
|
|
304
|
-
fullWidth
|
|
305
|
-
size="small"
|
|
306
|
-
variant="outlined"
|
|
307
|
-
onClick={() => onClick(row)}
|
|
308
|
-
startIcon={element}
|
|
309
|
-
sx={{
|
|
310
|
-
...modernButtonStyle,
|
|
311
|
-
minHeight: 36,
|
|
312
|
-
paddingX: 1,
|
|
313
|
-
gap: 0.5,
|
|
314
|
-
whiteSpace: "normal",
|
|
290
|
+
{tableActionsOnTable.map(({ title, onClick, element, visible = true }, idx) => {
|
|
291
|
+
// Kiểm tra điều kiện hiển thị: nếu là function thì thực thi, nếu không thì lấy giá trị bool
|
|
292
|
+
const isVisible = typeof visible === "function" ? visible(row) : visible;
|
|
315
293
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
294
|
+
if (!isVisible) return null;
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<Tooltip key={idx} title={title} arrow placement="top">
|
|
298
|
+
<span>
|
|
299
|
+
<Button
|
|
300
|
+
fullWidth
|
|
301
|
+
size="small"
|
|
302
|
+
variant="outlined"
|
|
303
|
+
onClick={() => onClick(row)}
|
|
304
|
+
startIcon={element}
|
|
305
|
+
sx={{
|
|
306
|
+
...modernButtonStyle,
|
|
307
|
+
minHeight: 36,
|
|
308
|
+
paddingX: 1,
|
|
309
|
+
gap: 0.5,
|
|
310
|
+
whiteSpace: "normal",
|
|
311
|
+
"& .MuiButton-startIcon": {
|
|
312
|
+
marginRight: 0.5,
|
|
313
|
+
marginLeft: 0,
|
|
314
|
+
alignSelf: "center"
|
|
315
|
+
},
|
|
316
|
+
"& .MuiButton-startIcon svg": {
|
|
317
|
+
fontSize: 18
|
|
318
|
+
}
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
<span
|
|
322
|
+
style={{
|
|
323
|
+
display: "-webkit-box",
|
|
324
|
+
WebkitLineClamp: 2,
|
|
325
|
+
WebkitBoxOrient: "vertical",
|
|
326
|
+
overflow: "hidden",
|
|
327
|
+
textOverflow: "ellipsis",
|
|
328
|
+
lineHeight: 1.25,
|
|
329
|
+
textAlign: "center"
|
|
324
330
|
}}
|
|
325
331
|
>
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
textAlign: "center"
|
|
335
|
-
}}
|
|
336
|
-
>
|
|
337
|
-
{title === "xem chi tiết" ? "Xem" : title}
|
|
338
|
-
</span>
|
|
339
|
-
</Button>
|
|
340
|
-
</span>
|
|
341
|
-
</Tooltip>
|
|
342
|
-
)
|
|
343
|
-
)}
|
|
332
|
+
{/* Logic đổi tên title nếu cần */}
|
|
333
|
+
{title.toLowerCase() === "xem chi tiết" ? "Xem" : title}
|
|
334
|
+
</span>
|
|
335
|
+
</Button>
|
|
336
|
+
</span>
|
|
337
|
+
</Tooltip>
|
|
338
|
+
);
|
|
339
|
+
})}
|
|
344
340
|
</Box>
|
|
345
341
|
|
|
346
342
|
{/* More menu luôn nằm riêng 1 hàng */}
|