Skip to content

Commit 81b6dfd

Browse files
disable comp select/drag/drop inside table expansions
1 parent 1cdbf34 commit 81b6dfd

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

client/packages/lowcoder/src/comps/comps/containerComp/containerView.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import { selectCompModifierKeyPressed } from "util/keyUtils";
6262
import { defaultLayout, GridItemComp, GridItemDataType } from "../gridItemComp";
6363
import { ThemeContext } from "comps/utils/themeContext";
6464
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
65+
import { ExpandViewContext } from "../tableComp/expansionControl";
6566

6667
const childrenMap = {
6768
layout: valueComp<Layout>({}),
@@ -357,11 +358,12 @@ export const InnerGrid = React.memo((props: ViewPropsWithSelect) => {
357358
|| String(DEFAULT_GRID_COLUMNS);
358359
}, [horizontalGridCells, positionParams.cols]);
359360

361+
const isExpandView = useContext(ExpandViewContext);
360362
const isDroppable =
361-
useContext(IsDroppable) && (_.isNil(props.isDroppable) || props.isDroppable) && !readOnly;
362-
const isDraggable = !readOnly && (_.isNil(props.isDraggable) || props.isDraggable);
363-
const isResizable = !readOnly && (_.isNil(props.isResizable) || props.isResizable);
364-
const isSelectable = !readOnly && (_.isNil(props.isSelectable) || props.isSelectable);
363+
useContext(IsDroppable) && (_.isNil(props.isDroppable) || props.isDroppable) && !readOnly && !isExpandView;
364+
const isDraggable = !readOnly && !isExpandView && (_.isNil(props.isDraggable) || props.isDraggable);
365+
const isResizable = !readOnly && !isExpandView && (_.isNil(props.isResizable) || props.isResizable);
366+
const isSelectable = !readOnly && !isExpandView && (_.isNil(props.isSelectable) || props.isSelectable);
365367
const extraLayout = useMemo(
366368
() =>
367369
getExtraLayout(

client/packages/lowcoder/src/comps/comps/tableComp/expansionControl.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
1111
import { trans } from "i18n";
1212
import _ from "lodash";
1313
import { ConstructorToView, wrapChildAction } from "lowcoder-core";
14-
import { useContext } from "react";
14+
import { createContext, useContext } from "react";
1515
import { tryToNumber } from "util/convertUtils";
1616
import { SimpleContainerComp } from "../containerBase/simpleContainerComp";
1717
import { OB_ROW_ORI_INDEX, RecordType } from "./tableUtils";
1818
import { NameGenerator } from "comps/utils";
1919
import { JSONValue } from "util/jsonTypes";
2020

2121
const ContextSlotControl = withSelectedMultiContext(SlotControl);
22+
export const ExpandViewContext = createContext(false);
2223

2324
const ContainerView = (props: ContainerBaseProps) => {
2425
return <InnerGrid {...props} emptyRows={15} autoHeight />;
@@ -85,7 +86,11 @@ export class ExpansionControl extends ExpansionControlTmp {
8586
String(record[OB_ROW_ORI_INDEX])
8687
);
8788
const containerProps = slotControl.children.container.getView();
88-
return <ExpandView key={record[OB_ROW_ORI_INDEX]} containerProps={containerProps} />;
89+
return (
90+
<ExpandViewContext.Provider value={true}>
91+
<ExpandView key={record[OB_ROW_ORI_INDEX]} containerProps={containerProps} />
92+
</ExpandViewContext.Provider>
93+
);
8994
},
9095
},
9196
expandModalView: selectedContainer.getView(),

0 commit comments

Comments
 (0)