mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fix disabled cell styles
This commit is contained in:
@@ -55,6 +55,7 @@ export default function EditorCellTextField({
|
||||
width: "100%",
|
||||
height: "calc(100% - 1px)",
|
||||
marginTop: "1px",
|
||||
padding: 0,
|
||||
paddingBottom: "1px",
|
||||
|
||||
backgroundColor: "var(--cell-background-color)",
|
||||
@@ -70,7 +71,7 @@ export default function EditorCellTextField({
|
||||
lineHeight: (theme) => theme.typography.body2.lineHeight,
|
||||
maxHeight: "100%",
|
||||
boxSizing: "border-box",
|
||||
py: 3 / 8,
|
||||
py: 2 / 8,
|
||||
},
|
||||
},
|
||||
...spreadSx(InputProps.sx),
|
||||
|
||||
@@ -111,7 +111,7 @@ export default function withTableCell(
|
||||
row: row.original,
|
||||
column: column.columnDef.meta!,
|
||||
_rowy_ref: row.original._rowy_ref,
|
||||
disabled: column.columnDef.meta!.editable === false,
|
||||
disabled,
|
||||
tabIndex: focusInsideCell ? 0 : -1,
|
||||
showPopoverCell,
|
||||
setFocusInsideCell,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IDisplayCellProps } from "@src/components/fields/types";
|
||||
import { get } from "lodash-es";
|
||||
import { sanitiseCallableName, isUrl } from "./utils";
|
||||
|
||||
export const getActionName = (column: IDisplayCellProps["column"]) => {
|
||||
const config = get(column, "config");
|
||||
@@ -10,5 +11,19 @@ export const getActionName = (column: IDisplayCellProps["column"]) => {
|
||||
};
|
||||
|
||||
export default function Action({ value, column }: IDisplayCellProps) {
|
||||
return <>{value ? value.status : getActionName(column)}</>;
|
||||
const hasRan = value && ![null, undefined].includes(value.status);
|
||||
|
||||
return (
|
||||
<div style={{ padding: "0 var(--cell-padding)" }}>
|
||||
{hasRan && isUrl(value.status) ? (
|
||||
<a href={value.status} target="_blank" rel="noopener noreferrer">
|
||||
{value.status}
|
||||
</a>
|
||||
) : hasRan ? (
|
||||
value.status
|
||||
) : (
|
||||
sanitiseCallableName(getActionName(column))
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,16 @@ export default function Checkbox({ column, value }: IDisplayCellProps) {
|
||||
return (
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch checked={!!value} disabled color="success" tabIndex={-1} />
|
||||
<Switch
|
||||
checked={!!value}
|
||||
color="success"
|
||||
tabIndex={-1}
|
||||
readOnly
|
||||
sx={{
|
||||
pointerEvents: "none",
|
||||
"& .MuiSwitch-thumb:active": { transform: "none" },
|
||||
}}
|
||||
/>
|
||||
}
|
||||
label={column.name as string}
|
||||
labelPlacement="start"
|
||||
@@ -15,6 +24,8 @@ export default function Checkbox({ column, value }: IDisplayCellProps) {
|
||||
width: "100%",
|
||||
alignItems: "center",
|
||||
|
||||
cursor: "default",
|
||||
|
||||
"& .MuiFormControlLabel-label": {
|
||||
font: "inherit",
|
||||
letterSpacing: "inherit",
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function Code({ value }: IDisplayCellProps) {
|
||||
style={{
|
||||
width: "100%",
|
||||
maxHeight: "100%",
|
||||
padding: theme.spacing(1, 0),
|
||||
padding: "3px 0",
|
||||
|
||||
whiteSpace: "pre-wrap",
|
||||
lineHeight: theme.typography.body2.lineHeight,
|
||||
|
||||
@@ -26,11 +26,13 @@ export default function File_({
|
||||
<Chip
|
||||
icon={<FileIcon />}
|
||||
label={file.name}
|
||||
onClick={(e) => {
|
||||
window.open(file.downloadURL);
|
||||
e.stopPropagation();
|
||||
}}
|
||||
style={{ width: "100%" }}
|
||||
onClick={(e: any) => e.stopPropagation()}
|
||||
component="a"
|
||||
href={file.downloadURL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
clickable
|
||||
style={{ width: "100%", cursor: "pointer" }}
|
||||
tabIndex={tabIndex}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@@ -117,10 +117,12 @@ export default function File_({
|
||||
<Chip
|
||||
icon={<FileIcon />}
|
||||
label={file.name}
|
||||
onClick={(e) => {
|
||||
window.open(file.downloadURL);
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onClick={(e: any) => e.stopPropagation()}
|
||||
component="a"
|
||||
href={file.downloadURL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
clickable
|
||||
onDelete={
|
||||
disabled
|
||||
? undefined
|
||||
@@ -134,7 +136,7 @@ export default function File_({
|
||||
})
|
||||
}
|
||||
tabIndex={tabIndex}
|
||||
style={{ width: "100%" }}
|
||||
style={{ width: "100%", cursor: "pointer" }}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Grid>
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function Json({ value }: IDisplayCellProps) {
|
||||
style={{
|
||||
width: "100%",
|
||||
maxHeight: "100%",
|
||||
padding: theme.spacing(1, 0),
|
||||
padding: "3px 0",
|
||||
|
||||
whiteSpace: "pre-wrap",
|
||||
lineHeight: theme.typography.body2.lineHeight,
|
||||
|
||||
@@ -9,7 +9,7 @@ export default function LongText({ value }: IDisplayCellProps) {
|
||||
<div
|
||||
style={{
|
||||
maxHeight: "100%",
|
||||
padding: theme.spacing(1, 0),
|
||||
padding: "3px 0",
|
||||
|
||||
whiteSpace: "pre-line",
|
||||
lineHeight: theme.typography.body2.lineHeight,
|
||||
|
||||
@@ -41,6 +41,7 @@ export const StatusSingleSelect = forwardRef(function StatusSingleSelect({
|
||||
paddingLeft: "var(--cell-padding)",
|
||||
}}
|
||||
>
|
||||
{value}
|
||||
{getLabel(value, sortedConditions)}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user