Skip to content

Commit

Permalink
fix(MD-4219): check for view data
Browse files Browse the repository at this point in the history
  • Loading branch information
vcellu authored and enell committed Mar 23, 2023
1 parent 6dff211 commit 72f5e4c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type ExpandCellAtom = {
expand: boolean;
data?: any;
titles?: Array<String>;
viewData?: boolean;
};

export type DragBoxAtom = {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ export type CellProps = {
rowData: any;
colData: any;
style?: StyleProp<ViewStyle>;
viewData?: boolean;
};

const Cell: React.FC<CellProps> = ({ rowData, colData, style }) => {
const Cell: React.FC<CellProps> = ({ rowData, colData, style, viewData }) => {
const getCell = useCallback(() => {
if (colData.representation.type === 'miniChart') {
return (
Expand All @@ -23,7 +24,7 @@ const Cell: React.FC<CellProps> = ({ rowData, colData, style }) => {
/>
);
}
if (colData.representation.type === 'image') {
if (colData.representation.type === 'image' && !viewData) {
return (
<ImageCell
style={styles.imageCell}
Expand Down
1 change: 1 addition & 0 deletions src/components/ExpandedTableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ExpandedTableCell = () => {
style={styles.cell}
colData={item}
rowData={expandedCell.data.row.cells[index]}
viewData={expandedCell.viewData}
/>
</DataTable.Row>
))}
Expand Down
1 change: 1 addition & 0 deletions src/components/SimpleGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const SimpleGrid: React.FC<SimpleGridProps> = ({
expand: true,
data: { row, col },
titles: translations.headerValues,
viewData: layout?.isDataView,
});
} catch (error) {}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TextCell: React.FC<TextCellProps> = ({ rowData, colData }) => {
const iconStyle = useMemo(() => {
let name;
let color;
if (colData?.representation.type === 'text') {
if (colData?.representation.type === 'text' || colData?.representation.type === 'image') {
return;
}
if (rowData?.indicator?.icon) {
Expand Down

0 comments on commit 72f5e4c

Please sign in to comment.