diff --git a/packages/web/src/datagrid/ReferenceHeader.js b/packages/web/src/datagrid/ReferenceHeader.js
new file mode 100644
index 00000000..8c3270da
--- /dev/null
+++ b/packages/web/src/datagrid/ReferenceHeader.js
@@ -0,0 +1,43 @@
+import React from 'react';
+import ToolbarButton from '../widgets/ToolbarButton';
+import styled from 'styled-components';
+import { ReferenceIcon } from '../icons';
+import theme from '../theme';
+
+const Container = styled.div`
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: #ddeeee;
+ height: ${theme.toolBar.height}px;
+ overflow: hidden;
+ border-top: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+`;
+
+const Header = styled.div`
+ font-weight: bold;
+ margin-left: 10px;
+ display: flex;
+`;
+
+const HeaderText = styled.div`
+ margin-left: 10px;
+`;
+
+export default function ReferenceHeader({ reference, onClose }) {
+ return (
+
+
+
+
+ {reference.pureName} [{reference.columns.map((x) => x.refName).join(', ')}] = master [
+ {reference.columns.map((x) => x.baseName).join(', ')}]
+
+
+
+ Close
+
+
+ );
+}
diff --git a/packages/web/src/datagrid/TableDataGrid.js b/packages/web/src/datagrid/TableDataGrid.js
index 60d6769c..e7421e4f 100644
--- a/packages/web/src/datagrid/TableDataGrid.js
+++ b/packages/web/src/datagrid/TableDataGrid.js
@@ -1,6 +1,7 @@
import React from 'react';
import _ from 'lodash';
import DataGrid from './DataGrid';
+import styled from 'styled-components';
import { TableGridDisplay, createGridConfig, createGridCache } from '@dbgate/datalib';
import { getFilterValueExpression } from '@dbgate/filterparser';
import { useConnectionInfo, getTableInfo } from '../utility/metadataLoaders';
@@ -8,6 +9,23 @@ import engines from '@dbgate/engines';
import useSocket from '../utility/SocketProvider';
import { VerticalSplitter } from '../widgets/Splitter';
import stableStringify from 'json-stable-stringify';
+import ReferenceHeader from './ReferenceHeader';
+
+const ReferenceContainer = styled.div`
+ position: absolute;
+ display: flex;
+ flex-direction: column;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+`;
+
+const ReferenceGridWrapper = styled.div`
+ position: relative;
+ flex: 1;
+ display: flex;
+`;
export default function TableDataGrid({
conid,
@@ -98,6 +116,10 @@ export default function TableDataGrid({
[config || childConfig, reference]
);
+ const handleCloseReference = () => {
+ setReference(null);
+ };
+
if (!display) return null;
return (
@@ -118,22 +140,27 @@ export default function TableDataGrid({
masterLoadedTime={masterLoadedTime}
/>
{reference && (
-
+
+
+
+
+
+
)}
);
diff --git a/packages/web/src/widgets/ToolbarButton.js b/packages/web/src/widgets/ToolbarButton.js
index 5722542b..c331b9ad 100644
--- a/packages/web/src/widgets/ToolbarButton.js
+++ b/packages/web/src/widgets/ToolbarButton.js
@@ -37,10 +37,10 @@ const StyledIconSpan = styled.span`
const ButtonDivInner = styled.div`
position: relative;
- top: 2px;
+ top: ${(props) => props.patchY}px;
`;
-export default function ToolbarButton({ children, onClick, icon = undefined, disabled = undefined }) {
+export default function ToolbarButton({ children, onClick, icon = undefined, disabled = undefined, patchY = 2 }) {
const Icon = icon;
return (
-
+
{Icon && (