fix: remove dead code
This commit is contained in:
parent
22db2edf42
commit
3a331558ff
|
|
@ -93,7 +93,6 @@ export const WIDGET_CLASSNAME_PREFIX = "WIDGET_";
|
||||||
export const MAIN_CONTAINER_WIDGET_ID = "0";
|
export const MAIN_CONTAINER_WIDGET_ID = "0";
|
||||||
export const MAIN_CONTAINER_WIDGET_NAME = "MainContainer";
|
export const MAIN_CONTAINER_WIDGET_NAME = "MainContainer";
|
||||||
export const MODAL_PORTAL_CLASSNAME = "bp3-modal-widget";
|
export const MODAL_PORTAL_CLASSNAME = "bp3-modal-widget";
|
||||||
export const MAIN_CANVAS_CLASSNAME = ".appsmith_widget_0";
|
|
||||||
export const CANVAS_SELECTOR = ".canvas";
|
export const CANVAS_SELECTOR = ".canvas";
|
||||||
|
|
||||||
export const DEFAULT_CENTER = { lat: -34.397, lng: 150.644 };
|
export const DEFAULT_CENTER = { lat: -34.397, lng: 150.644 };
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ import {
|
||||||
} from "actions/controlActions";
|
} from "actions/controlActions";
|
||||||
import { setAppViewHeaderHeight } from "actions/appViewActions";
|
import { setAppViewHeaderHeight } from "actions/appViewActions";
|
||||||
import { showPostCompletionMessage } from "selectors/onboardingSelectors";
|
import { showPostCompletionMessage } from "selectors/onboardingSelectors";
|
||||||
|
import { CANVAS_SELECTOR } from "constants/WidgetConstants";
|
||||||
|
|
||||||
const AppViewerBody = styled.section<{
|
const AppViewerBody = styled.section<{
|
||||||
hasPages: boolean;
|
hasPages: boolean;
|
||||||
|
|
@ -220,7 +221,7 @@ function AppViewer(props: Props) {
|
||||||
backgroundColor={selectedTheme.properties.colors.backgroundColor}
|
backgroundColor={selectedTheme.properties.colors.backgroundColor}
|
||||||
>
|
>
|
||||||
<AppViewerBody
|
<AppViewerBody
|
||||||
className="canvas"
|
className={CANVAS_SELECTOR}
|
||||||
hasPages={pages.length > 1}
|
hasPages={pages.length > 1}
|
||||||
headerHeight={headerHeight}
|
headerHeight={headerHeight}
|
||||||
showGuidedTourMessage={showGuidedTourMessage}
|
showGuidedTourMessage={showGuidedTourMessage}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import { CheckedStrategy } from "rc-tree-select/lib/utils/strategyUtil";
|
||||||
import { RenderMode, RenderModes, TextSize } from "constants/WidgetConstants";
|
import { RenderMode, RenderModes, TextSize } from "constants/WidgetConstants";
|
||||||
import { Alignment, Button, Classes, InputGroup } from "@blueprintjs/core";
|
import { Alignment, Button, Classes, InputGroup } from "@blueprintjs/core";
|
||||||
import {
|
import {
|
||||||
getClosestCanvas,
|
|
||||||
getMainCanvas,
|
getMainCanvas,
|
||||||
labelMargin,
|
labelMargin,
|
||||||
WidgetContainerDiff,
|
WidgetContainerDiff,
|
||||||
|
|
@ -139,7 +138,6 @@ function MultiTreeSelectComponent({
|
||||||
const [filter, setFilter] = useState(filterText ?? "");
|
const [filter, setFilter] = useState(filterText ?? "");
|
||||||
|
|
||||||
const _menu = useRef<HTMLElement | null>(null);
|
const _menu = useRef<HTMLElement | null>(null);
|
||||||
const parentDropDownContainer = useRef<HTMLElement | null>(null);
|
|
||||||
const selectRef = useRef<Select<LabelValueType[]> | null>(null);
|
const selectRef = useRef<Select<LabelValueType[]> | null>(null);
|
||||||
|
|
||||||
const labelRef = useRef<HTMLDivElement>(null);
|
const labelRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
@ -177,11 +175,7 @@ function MultiTreeSelectComponent({
|
||||||
() => popupContainer.current as HTMLElement,
|
() => popupContainer.current as HTMLElement,
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
|
||||||
const node = _menu.current;
|
|
||||||
const parent = getClosestCanvas(node);
|
|
||||||
parentDropDownContainer.current = parent;
|
|
||||||
}, []);
|
|
||||||
const onQueryChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
|
const onQueryChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
setFilter(event.target.value);
|
setFilter(event.target.value);
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,15 @@ import {
|
||||||
MultiSelectContainer,
|
MultiSelectContainer,
|
||||||
StyledCheckbox,
|
StyledCheckbox,
|
||||||
} from "./index.styled";
|
} from "./index.styled";
|
||||||
import { TextSize } from "constants/WidgetConstants";
|
import {
|
||||||
|
CANVAS_SELECTOR,
|
||||||
|
MODAL_PORTAL_CLASSNAME,
|
||||||
|
TextSize,
|
||||||
|
} from "constants/WidgetConstants";
|
||||||
import debounce from "lodash/debounce";
|
import debounce from "lodash/debounce";
|
||||||
import Icon from "components/ads/Icon";
|
import Icon from "components/ads/Icon";
|
||||||
import { Alignment, Classes } from "@blueprintjs/core";
|
import { Alignment, Classes } from "@blueprintjs/core";
|
||||||
import { getClosestCanvas, WidgetContainerDiff } from "widgets/WidgetUtils";
|
import { WidgetContainerDiff } from "widgets/WidgetUtils";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { Colors } from "constants/Colors";
|
import { Colors } from "constants/Colors";
|
||||||
import { LabelPosition } from "components/constants";
|
import { LabelPosition } from "components/constants";
|
||||||
|
|
@ -98,9 +102,14 @@ function MultiSelectComponent({
|
||||||
}
|
}
|
||||||
}, [options, value]);
|
}, [options, value]);
|
||||||
|
|
||||||
const getPopupContainer = useCallback(() => {
|
const getDropdownPosition = useCallback(() => {
|
||||||
const node = _menu.current;
|
const node = _menu.current;
|
||||||
return getClosestCanvas(node);
|
if (Boolean(node?.closest(`.${MODAL_PORTAL_CLASSNAME}`))) {
|
||||||
|
return document.querySelector(
|
||||||
|
`.${MODAL_PORTAL_CLASSNAME}`,
|
||||||
|
) as HTMLElement;
|
||||||
|
}
|
||||||
|
return document.querySelector(`.${CANVAS_SELECTOR}`) as HTMLElement;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleSelectAll = () => {
|
const handleSelectAll = () => {
|
||||||
|
|
@ -195,7 +204,7 @@ function MultiSelectComponent({
|
||||||
dropdownRender={dropdownRender}
|
dropdownRender={dropdownRender}
|
||||||
dropdownStyle={dropdownStyle}
|
dropdownStyle={dropdownStyle}
|
||||||
filterOption={serverSideFiltering ? false : filterOption}
|
filterOption={serverSideFiltering ? false : filterOption}
|
||||||
getPopupContainer={getPopupContainer}
|
getPopupContainer={getDropdownPosition}
|
||||||
inputIcon={
|
inputIcon={
|
||||||
<Icon
|
<Icon
|
||||||
className="dropdown-icon"
|
className="dropdown-icon"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import { TreeNodeProps } from "rc-tree-select/lib/TreeNode";
|
||||||
import { RenderMode, RenderModes, TextSize } from "constants/WidgetConstants";
|
import { RenderMode, RenderModes, TextSize } from "constants/WidgetConstants";
|
||||||
import { Alignment, Button, Classes, InputGroup } from "@blueprintjs/core";
|
import { Alignment, Button, Classes, InputGroup } from "@blueprintjs/core";
|
||||||
import {
|
import {
|
||||||
getClosestCanvas,
|
|
||||||
getMainCanvas,
|
getMainCanvas,
|
||||||
labelMargin,
|
labelMargin,
|
||||||
WidgetContainerDiff,
|
WidgetContainerDiff,
|
||||||
|
|
@ -141,7 +140,6 @@ function SingleSelectTreeComponent({
|
||||||
const _menu = useRef<HTMLElement | null>(null);
|
const _menu = useRef<HTMLElement | null>(null);
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
const [memoDropDownWidth, setMemoDropDownWidth] = useState(0);
|
const [memoDropDownWidth, setMemoDropDownWidth] = useState(0);
|
||||||
const parentDropDownContainer = useRef<HTMLElement | null>(null);
|
|
||||||
|
|
||||||
// treeDefaultExpandAll is uncontrolled after first render,
|
// treeDefaultExpandAll is uncontrolled after first render,
|
||||||
// using this to force render to respond to changes in expandAll
|
// using this to force render to respond to changes in expandAll
|
||||||
|
|
@ -164,11 +162,7 @@ function SingleSelectTreeComponent({
|
||||||
() => popupContainer.current as HTMLElement,
|
() => popupContainer.current as HTMLElement,
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
|
||||||
const node = _menu.current;
|
|
||||||
const parent = getClosestCanvas(node);
|
|
||||||
parentDropDownContainer.current = parent;
|
|
||||||
}, []);
|
|
||||||
const onSelectionChange = useCallback(
|
const onSelectionChange = useCallback(
|
||||||
(value?: DefaultValueType, labelList?: ReactNode[]) => {
|
(value?: DefaultValueType, labelList?: ReactNode[]) => {
|
||||||
setFilter("");
|
setFilter("");
|
||||||
|
|
|
||||||
|
|
@ -541,8 +541,5 @@ export const parseSchemaItem = (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getClosestCanvas = (node: HTMLElement | null) => {
|
|
||||||
return node?.closest(CANVAS_SELECTOR) as HTMLElement;
|
|
||||||
};
|
|
||||||
export const getMainCanvas = () =>
|
export const getMainCanvas = () =>
|
||||||
document.querySelector(CANVAS_SELECTOR) as HTMLElement;
|
document.querySelector(CANVAS_SELECTOR) as HTMLElement;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user