Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/graphic-walker/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const VizApp = observer(function VizApp(props: BaseVizProps) {
vlSpec,
onError,
hideSegmentNav,
hideEmbedMenu
} = props;

const { t, i18n } = useTranslation();
Expand Down Expand Up @@ -273,7 +274,7 @@ export const VizApp = observer(function VizApp(props: BaseVizProps) {
scales={props.scales ?? props.channelScales}
/>
)}
<VizEmbedMenu />
<VizEmbedMenu hideEmbedMenu={hideEmbedMenu} />
</div>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion packages/graphic-walker/src/components/embedMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { useTranslation } from 'react-i18next';
import React from 'react';
import { GLOBAL_CONFIG } from '../config';
import { Transition } from '@headlessui/react';
import { VizEmbedMenuProps } from '@/interfaces';

export const VizEmbedMenu = observer(function VizEmbedMenu() {
export const VizEmbedMenu = observer(function VizEmbedMenu(props: VizEmbedMenuProps) {
if (props.hideEmbedMenu === true) return null;
const vizStore = useVizStore();
const { t } = useTranslation();
const { vizEmbededMenu } = vizStore;
Expand All @@ -25,6 +27,8 @@ export const VizEmbedMenu = observer(function VizEmbedMenu() {
>
<ClickMenu x={vizEmbededMenu.position[0]} y={vizEmbededMenu.position[1]}>
{GLOBAL_CONFIG.EMBEDED_MENU_LIST.map((key) => {
const isItemHidden = Array.isArray(props.hideEmbedMenu) && props.hideEmbedMenu.includes(key);
if (isItemHidden) return null;
switch (key) {
case 'data_interpretation':
return (
Expand Down
5 changes: 5 additions & 0 deletions packages/graphic-walker/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export interface IRow {
export type IAggregator = 'sum' | 'count' | 'max' | 'min' | 'mean' | 'median' | 'variance' | 'stdev' | 'distinctCount' | 'expr';

export type IEmbedMenuItem = 'data_interpretation' | 'data_view';
export interface VizEmbedMenuProps {
hideEmbedMenu?: boolean | IEmbedMenuItem[];
}
export interface Specification {
position?: string[];
color?: string[];
Expand Down Expand Up @@ -914,6 +917,8 @@ export interface IVizProps {
hideChartNav?: boolean;
/** hide the segment navigation so make user can only edit on the only segment. */
hideSegmentNav?: boolean;
/** hide the embedded menu */
hideEmbedMenu?: boolean | IEmbedMenuItem[];
geographicData?: IGeographicData & {
key: string;
};
Expand Down