Skip to content

Commit

Permalink
take out props from viewColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
jgespinosa10 committed Sep 5, 2024
1 parent 1299a13 commit 11cd746
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ui",
"version": "0.5.23-beta.7",
"version": "0.5.23-beta.8",
"main": "./src/index.js",
"type": "module",
"exports": {
Expand Down
7 changes: 6 additions & 1 deletion packages/ui/src/DataTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ const DataTable = ({
schema.fields = [viewColumn, ...schema.fields];
}
if (isOpenable) {
schema.fields = [openColumn, ...schema.fields];
schema.fields = [
openColumn({ onDoubleClick, history }),
...schema.fields
];
}
// this must come before handling orderings.
schema.fields = schema.fields.map(field => {
Expand Down Expand Up @@ -632,10 +635,12 @@ const DataTable = ({
cellRenderer,
convertedSchema,
entities,
history,
isInfinite,
isOpenable,
isSimple,
isViewable,
onDoubleClick,
showForcedHiddenColumns,
tableConfig.columnOrderings,
tableConfig.fieldOptions,
Expand Down
14 changes: 5 additions & 9 deletions packages/ui/src/DataTable/viewColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@ export const viewColumn = {
return <Icon className="dt-eyeIcon" icon="eye-open" />;
}
};
export const openColumn = {
export const openColumn = ({ onDoubleClick, history }) => ({
...viewColumn,
render: (val, record, rowInfo, props) => {
render: (val, record, rowInfo) => {
return (
<Tooltip content="Open">
<Button
onClick={e => {
e.stopPropagation();
props.onDoubleClick &&
props.onDoubleClick(
rowInfo.original,
rowInfo.index,
props.history
);
onDoubleClick &&
onDoubleClick(rowInfo.original, rowInfo.index, history);
}}
minimal
small
Expand All @@ -34,4 +30,4 @@ export const openColumn = {
</Tooltip>
);
}
};
});

0 comments on commit 11cd746

Please sign in to comment.