diff --git a/packages/graphic-walker/src/Table.tsx b/packages/graphic-walker/src/Table.tsx index 9ccf452c..1d0ab289 100644 --- a/packages/graphic-walker/src/Table.tsx +++ b/packages/graphic-walker/src/Table.tsx @@ -82,8 +82,8 @@ export const TableApp = observer(function VizApp(props: BaseTableProps) { vegaThemeContext={{ vizThemeConfig: vizThemeConfig ?? themeConfig ?? themeKey }} portalContainerContext={portal} > -
-
+
+
{ vizStore.updateCurrentDatasetMetas(fid, diffMeta); @@ -92,6 +92,8 @@ export const TableApp = observer(function VizApp(props: BaseTableProps) { metas={metas} computation={wrappedComputation} displayOffset={props.displayOffset} + hidePaginationAtOnepage={props.hidePaginationAtOnepage} + hideProfiling={props.hideProfiling} />
diff --git a/packages/graphic-walker/src/components/dataTable/index.tsx b/packages/graphic-walker/src/components/dataTable/index.tsx index f0224a47..1f16fd28 100644 --- a/packages/graphic-walker/src/components/dataTable/index.tsx +++ b/packages/graphic-walker/src/components/dataTable/index.tsx @@ -25,10 +25,15 @@ interface DataTableProps { computation: IComputationFunction; onMetaChange?: (fid: string, fIndex: number, meta: Partial) => void; disableFilter?: boolean; + hideProfiling?: boolean; + hidePaginationAtOnepage?: boolean; displayOffset?: number; } const Container = styled.div` overflow-x: auto; + height: 100%; + display: flex; + flex-direction: column; table { box-sizing: content-box; border-collapse: collapse; @@ -228,7 +233,7 @@ function TruncateDector(props: { value: string }) { } const DataTable: React.FC = (props) => { - const { size = 10, onMetaChange, metas, computation, disableFilter, displayOffset } = props; + const { size = 10, onMetaChange, metas, computation, disableFilter, displayOffset, hidePaginationAtOnepage, hideProfiling } = props; const [pageIndex, setPageIndex] = useState(0); const { t } = useTranslation(); const computationFunction = computation; @@ -356,32 +361,33 @@ const DataTable: React.FC = (props) => { ))}
)} - - -
+ {!(hidePaginationAtOnepage && total <= size) && ( + + )} +
@@ -480,19 +486,21 @@ const DataTable: React.FC = (props) => { ))} ))} - - {metas.map((field) => ( - - ))} - + {!props.hideProfiling && ( + + {metas.map((field) => ( + + ))} + + )} {rows.map((row, index) => ( diff --git a/packages/graphic-walker/src/index.css b/packages/graphic-walker/src/index.css index f4e6bf3e..49e38986 100644 --- a/packages/graphic-walker/src/index.css +++ b/packages/graphic-walker/src/index.css @@ -3,6 +3,7 @@ code { } .App { + height: 100%; background-color: hsl(var(--background)); color: hsl(var(--foreground)); font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, diff --git a/packages/graphic-walker/src/interfaces.ts b/packages/graphic-walker/src/interfaces.ts index b66e359a..c1fae193 100644 --- a/packages/graphic-walker/src/interfaces.ts +++ b/packages/graphic-walker/src/interfaces.ts @@ -978,6 +978,8 @@ export interface ISpecProps { export interface ITableSpecProps { pageSize?: number; + hideProfiling?: boolean; + hidePaginationAtOnepage?: boolean; displayOffset?: number; /** @deprecated use vizThemeConfig instead */ themeKey?: IThemeKey; diff --git a/packages/graphic-walker/src/renderer/pureRenderer.tsx b/packages/graphic-walker/src/renderer/pureRenderer.tsx index c09dbc5b..790b92fe 100644 --- a/packages/graphic-walker/src/renderer/pureRenderer.tsx +++ b/packages/graphic-walker/src/renderer/pureRenderer.tsx @@ -173,7 +173,7 @@ const PureRenderer = forwardRef {waiting && } -
+
{isSpatial && (
@@ -193,7 +193,7 @@ const PureRenderer = forwardRef )} -
+
diff --git a/packages/graphic-walker/src/root.tsx b/packages/graphic-walker/src/root.tsx index af145e7f..fb7a08df 100644 --- a/packages/graphic-walker/src/root.tsx +++ b/packages/graphic-walker/src/root.tsx @@ -96,7 +96,12 @@ export const TableWalker = observer( return ( }> - + diff --git a/packages/playground/src/examples/pages/inModal.stories.tsx b/packages/playground/src/examples/pages/inModal.stories.tsx index 78362c89..f14e7f05 100644 --- a/packages/playground/src/examples/pages/inModal.stories.tsx +++ b/packages/playground/src/examples/pages/inModal.stories.tsx @@ -1,47 +1,52 @@ -import { useContext, useEffect, useRef } from 'react'; +import { useContext, useState } from 'react'; import spec from '../specs/student-chart.json'; -import { GraphicWalker, VizSpecStore, grayTheme } from '@kanaries/graphic-walker'; +import { GraphicWalker, grayTheme, IChart } from '@kanaries/graphic-walker'; import { themeContext } from '../context'; import { useFetch, IDataSource } from '../util'; export default function GraphicWalkerInModal() { - const ref = useRef(null); const { theme } = useContext(themeContext); const { dataSource, fields } = useFetch('https://pub-2422ed4100b443659f588f2382cfc7b1.r2.dev/datasets/ds-students-service.json'); + const [open, setOpen] = useState(false); - useEffect(() => { - setTimeout(() => { - if (ref.current) { - ref.current.importCode(spec as never); - } - }, 0); - }, []); return ( -
-
- -
+
+ + {open && ( +
setOpen(false)} + style={{ + position: 'fixed', + inset: 0, + backdropFilter: 'blur(10px)', + zIndex: 9999, + }} + > +
{ + e.stopPropagation(); + e.preventDefault(); + }} + style={{ + position: 'absolute', + borderRadius: 20, + border: '1px solid gray', + left: 80, + right: 80, + top: 80, + bottom: 80, + overflow: 'auto', + padding: 20, + boxSizing: 'border-box', + }} + > + +
+
+ )}
); } diff --git a/packages/playground/src/examples/pages/renderer.tsx b/packages/playground/src/examples/pages/renderer.tsx index d34e961a..49f5bae2 100644 --- a/packages/playground/src/examples/pages/renderer.tsx +++ b/packages/playground/src/examples/pages/renderer.tsx @@ -4,7 +4,7 @@ import Comp from './renderer.stories'; export default function GraphicWalkerComponent() { return ( - + );
- -
+ +