chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { AppState } from "@appsmith/reducers";
|
2023-03-04 07:25:54 +00:00
|
|
|
import { getColorWithOpacity } from "constants/DefaultTheme";
|
|
|
|
|
import { WIDGET_PADDING } from "constants/WidgetConstants";
|
2023-09-11 15:55:11 +00:00
|
|
|
import type { CSSProperties, DragEventHandler, ReactNode } from "react";
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import React, { useMemo, useRef } from "react";
|
2019-09-22 20:25:05 +00:00
|
|
|
import styled from "styled-components";
|
2020-01-06 11:02:22 +00:00
|
|
|
import { useSelector } from "react-redux";
|
2022-11-27 17:12:00 +00:00
|
|
|
import {
|
|
|
|
|
previewModeSelector,
|
|
|
|
|
snipingModeSelector,
|
|
|
|
|
} from "selectors/editorSelectors";
|
2022-09-14 06:55:08 +00:00
|
|
|
import {
|
|
|
|
|
isCurrentWidgetFocused,
|
|
|
|
|
isWidgetSelected,
|
|
|
|
|
} from "selectors/widgetSelectors";
|
2023-01-28 02:17:06 +00:00
|
|
|
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
|
2023-03-04 07:25:54 +00:00
|
|
|
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
|
|
|
|
|
import {
|
|
|
|
|
useShowTableFilterPane,
|
|
|
|
|
useWidgetDragResize,
|
|
|
|
|
} from "utils/hooks/dragResizeHooks";
|
2023-03-23 11:41:58 +00:00
|
|
|
import { getIsAppSettingsPaneWithNavigationTabOpen } from "selectors/appSettingsPaneSelectors";
|
2019-04-02 16:12:08 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
const DraggableWrapper = styled.div`
|
2019-10-02 19:42:25 +00:00
|
|
|
display: block;
|
2020-03-06 09:33:20 +00:00
|
|
|
flex-direction: column;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2020-03-27 09:02:11 +00:00
|
|
|
user-select: none;
|
2020-01-07 07:22:12 +00:00
|
|
|
cursor: grab;
|
2019-09-30 03:25:14 +00:00
|
|
|
`;
|
|
|
|
|
|
2023-09-11 15:55:11 +00:00
|
|
|
type DraggableComponentProps = {
|
|
|
|
|
widgetId: string;
|
|
|
|
|
parentId?: string;
|
|
|
|
|
isFlexChild?: boolean;
|
|
|
|
|
resizeDisabled?: boolean;
|
|
|
|
|
type: string;
|
|
|
|
|
bottomRow: number;
|
|
|
|
|
topRow: number;
|
|
|
|
|
leftColumn: number;
|
|
|
|
|
rightColumn: number;
|
|
|
|
|
parentRowSpace: number;
|
|
|
|
|
parentColumnSpace: number;
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
};
|
2023-02-03 05:47:40 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// Widget Boundaries which is shown to indicate the boundaries of the widget
|
2020-01-08 05:19:01 +00:00
|
|
|
const WidgetBoundaries = styled.div`
|
2020-01-16 11:46:21 +00:00
|
|
|
z-index: 0;
|
2020-03-06 09:33:20 +00:00
|
|
|
width: calc(100% + ${WIDGET_PADDING - 2}px);
|
|
|
|
|
height: calc(100% + ${WIDGET_PADDING - 2}px);
|
|
|
|
|
position: absolute;
|
2020-01-08 05:19:01 +00:00
|
|
|
border: 1px dashed
|
2020-12-24 04:32:25 +00:00
|
|
|
${(props) => getColorWithOpacity(props.theme.colors.textAnchor, 0.5)};
|
2020-01-10 12:15:54 +00:00
|
|
|
pointer-events: none;
|
2023-02-03 05:47:40 +00:00
|
|
|
top: 0;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
2020-01-08 05:19:01 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-04-23 05:43:13 +00:00
|
|
|
/**
|
2023-03-15 16:40:06 +00:00
|
|
|
* can drag helper function to know if drag and drop should apply
|
2021-04-23 05:43:13 +00:00
|
|
|
*
|
2021-08-12 05:45:38 +00:00
|
|
|
* @param isResizingOrDragging
|
2021-04-23 05:43:13 +00:00
|
|
|
* @param isDraggingDisabled
|
|
|
|
|
* @param props
|
2022-08-03 07:02:49 +00:00
|
|
|
* @param isSnipingMode
|
|
|
|
|
* @param isPreviewMode
|
2021-04-23 05:43:13 +00:00
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
export const canDrag = (
|
2021-08-12 05:45:38 +00:00
|
|
|
isResizingOrDragging: boolean,
|
2021-04-23 05:43:13 +00:00
|
|
|
isDraggingDisabled: boolean,
|
|
|
|
|
props: any,
|
2021-07-26 16:44:10 +00:00
|
|
|
isSnipingMode: boolean,
|
2022-11-27 17:12:00 +00:00
|
|
|
isPreviewMode: boolean,
|
2023-03-23 11:41:58 +00:00
|
|
|
isAppSettingsPaneWithNavigationTabOpen: boolean,
|
2021-04-23 05:43:13 +00:00
|
|
|
) => {
|
2021-06-09 10:35:10 +00:00
|
|
|
return (
|
2021-08-12 05:45:38 +00:00
|
|
|
!isResizingOrDragging &&
|
2021-07-26 16:44:10 +00:00
|
|
|
!isDraggingDisabled &&
|
|
|
|
|
!props?.dragDisabled &&
|
2022-11-27 17:12:00 +00:00
|
|
|
!isSnipingMode &&
|
2023-03-23 11:41:58 +00:00
|
|
|
!isPreviewMode &&
|
|
|
|
|
!isAppSettingsPaneWithNavigationTabOpen
|
2021-06-09 10:35:10 +00:00
|
|
|
);
|
2021-04-23 05:43:13 +00:00
|
|
|
};
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
function DraggableComponent(props: DraggableComponentProps) {
|
2020-03-27 09:02:11 +00:00
|
|
|
// Dispatch hook handy to set a widget as focused/selected
|
2021-05-13 08:35:39 +00:00
|
|
|
const { focusWidget, selectWidget } = useWidgetSelection();
|
2021-07-26 16:44:10 +00:00
|
|
|
const isSnipingMode = useSelector(snipingModeSelector);
|
2022-11-27 17:12:00 +00:00
|
|
|
const isPreviewMode = useSelector(previewModeSelector);
|
2023-03-23 11:41:58 +00:00
|
|
|
const isAppSettingsPaneWithNavigationTabOpen = useSelector(
|
|
|
|
|
getIsAppSettingsPaneWithNavigationTabOpen,
|
|
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
// Dispatch hook handy to set any `DraggableComponent` as dragging/ not dragging
|
|
|
|
|
// The value is boolean
|
2023-03-04 07:25:54 +00:00
|
|
|
const { setDraggingState } = useWidgetDragResize();
|
2021-08-12 05:45:38 +00:00
|
|
|
const showTableFilterPane = useShowTableFilterPane();
|
2022-09-14 06:55:08 +00:00
|
|
|
|
|
|
|
|
const isSelected = useSelector(isWidgetSelected(props.widgetId));
|
2020-03-27 09:02:11 +00:00
|
|
|
// This state tels us which widget is focused
|
|
|
|
|
// The value is the widgetId of the focused widget.
|
2022-09-14 06:55:08 +00:00
|
|
|
const isFocused = useSelector(isCurrentWidgetFocused(props.widgetId));
|
2020-01-20 09:00:37 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// This state tells us whether a `ResizableComponent` is resizing
|
2020-01-20 09:00:37 +00:00
|
|
|
const isResizing = useSelector(
|
|
|
|
|
(state: AppState) => state.ui.widgetDragResize.isResizing,
|
|
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
|
|
|
|
|
// This state tells us whether a `DraggableComponent` is dragging
|
2020-01-20 09:00:37 +00:00
|
|
|
const isDragging = useSelector(
|
|
|
|
|
(state: AppState) => state.ui.widgetDragResize.isDragging,
|
|
|
|
|
);
|
2020-01-06 11:02:22 +00:00
|
|
|
|
2023-02-24 13:21:56 +00:00
|
|
|
const isDraggingSibling = useSelector(
|
|
|
|
|
(state) =>
|
|
|
|
|
state.ui.widgetDragResize?.dragDetails?.draggedOn === props.parentId,
|
|
|
|
|
);
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// This state tells us to disable dragging,
|
|
|
|
|
// This is usually true when widgets themselves implement drag/drop
|
|
|
|
|
// This flag resolves conflicting drag/drop triggers.
|
2020-01-20 09:00:37 +00:00
|
|
|
const isDraggingDisabled: boolean = useSelector(
|
|
|
|
|
(state: AppState) => state.ui.widgetDragResize.isDraggingDisabled,
|
2020-01-09 11:39:26 +00:00
|
|
|
);
|
2019-10-21 11:40:24 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// True when any widget is dragging or resizing, including this one
|
2020-03-04 08:10:40 +00:00
|
|
|
const isResizingOrDragging = !!isResizing || !!isDragging;
|
2022-09-14 06:55:08 +00:00
|
|
|
const isCurrentWidgetDragging = isDragging && isSelected;
|
|
|
|
|
const isCurrentWidgetResizing = isResizing && isSelected;
|
2023-03-04 07:25:54 +00:00
|
|
|
const showBoundary =
|
|
|
|
|
!props.isFlexChild && (isCurrentWidgetDragging || isDraggingSibling);
|
2023-02-03 05:47:40 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// When mouse is over this draggable
|
|
|
|
|
const handleMouseOver = (e: any) => {
|
|
|
|
|
focusWidget &&
|
|
|
|
|
!isResizingOrDragging &&
|
2022-09-14 06:55:08 +00:00
|
|
|
!isFocused &&
|
2021-08-09 05:35:01 +00:00
|
|
|
!props.resizeDisabled &&
|
2020-03-27 09:02:11 +00:00
|
|
|
focusWidget(props.widgetId);
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
};
|
2023-09-11 15:55:11 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// Display this draggable based on the current drag state
|
2021-08-12 05:45:38 +00:00
|
|
|
const dragWrapperStyle: CSSProperties = {
|
2023-03-04 07:25:54 +00:00
|
|
|
display: !props.isFlexChild && isCurrentWidgetDragging ? "none" : "block",
|
2020-03-27 09:02:11 +00:00
|
|
|
};
|
2021-08-12 05:45:38 +00:00
|
|
|
const dragBoundariesStyle: React.CSSProperties = useMemo(() => {
|
|
|
|
|
return {
|
|
|
|
|
opacity: !isResizingOrDragging || isCurrentWidgetResizing ? 0 : 1,
|
|
|
|
|
};
|
|
|
|
|
}, [isResizingOrDragging, isCurrentWidgetResizing]);
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
const classNameForTesting = `t--draggable-${props.type
|
2020-02-27 03:56:30 +00:00
|
|
|
.split("_")
|
|
|
|
|
.join("")
|
|
|
|
|
.toLowerCase()}`;
|
2020-03-06 09:33:20 +00:00
|
|
|
|
2021-08-12 05:45:38 +00:00
|
|
|
const allowDrag = canDrag(
|
|
|
|
|
isResizingOrDragging,
|
|
|
|
|
isDraggingDisabled,
|
|
|
|
|
props,
|
|
|
|
|
isSnipingMode,
|
2022-11-27 17:12:00 +00:00
|
|
|
isPreviewMode,
|
2023-03-23 11:41:58 +00:00
|
|
|
isAppSettingsPaneWithNavigationTabOpen,
|
2021-08-12 05:45:38 +00:00
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
const className = `${classNameForTesting}`;
|
2021-08-12 05:45:38 +00:00
|
|
|
const draggableRef = useRef<HTMLDivElement>(null);
|
2023-09-11 15:55:11 +00:00
|
|
|
const onDragStart: DragEventHandler = (e) => {
|
2021-08-12 05:45:38 +00:00
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
2021-09-22 07:18:46 +00:00
|
|
|
// allowDrag check is added as react jest test simulation is not respecting default behaviour
|
|
|
|
|
// of draggable=false and triggering onDragStart. allowDrag condition check is purely for the test cases.
|
|
|
|
|
if (allowDrag && draggableRef.current && !(e.metaKey || e.ctrlKey)) {
|
2022-09-14 06:55:08 +00:00
|
|
|
if (!isFocused) return;
|
2021-09-22 07:18:46 +00:00
|
|
|
|
2022-09-14 06:55:08 +00:00
|
|
|
if (!isSelected) {
|
2023-01-28 02:17:06 +00:00
|
|
|
selectWidget(SelectionRequestType.One, [props.widgetId]);
|
2021-08-12 05:45:38 +00:00
|
|
|
}
|
|
|
|
|
const widgetHeight = props.bottomRow - props.topRow;
|
|
|
|
|
const widgetWidth = props.rightColumn - props.leftColumn;
|
|
|
|
|
const bounds = draggableRef.current.getBoundingClientRect();
|
|
|
|
|
const startPoints = {
|
|
|
|
|
top: Math.min(
|
|
|
|
|
Math.max((e.clientY - bounds.top) / props.parentRowSpace, 0),
|
|
|
|
|
widgetHeight - 1,
|
|
|
|
|
),
|
|
|
|
|
left: Math.min(
|
|
|
|
|
Math.max((e.clientX - bounds.left) / props.parentColumnSpace, 0),
|
|
|
|
|
widgetWidth - 1,
|
|
|
|
|
),
|
|
|
|
|
};
|
|
|
|
|
showTableFilterPane();
|
|
|
|
|
setDraggingState({
|
|
|
|
|
isDragging: true,
|
|
|
|
|
dragGroupActualParent: props.parentId || "",
|
|
|
|
|
draggingGroupCenter: { widgetId: props.widgetId },
|
|
|
|
|
startPoints,
|
2023-03-04 07:25:54 +00:00
|
|
|
draggedOn: props.parentId,
|
2021-08-12 05:45:38 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-01-24 10:44:15 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
return (
|
|
|
|
|
<DraggableWrapper
|
|
|
|
|
className={className}
|
2022-09-14 06:55:08 +00:00
|
|
|
data-testid={isSelected ? "t--selected" : ""}
|
2021-08-12 05:45:38 +00:00
|
|
|
draggable={allowDrag}
|
|
|
|
|
onDragStart={onDragStart}
|
2021-04-28 10:28:39 +00:00
|
|
|
onMouseOver={handleMouseOver}
|
2021-08-12 05:45:38 +00:00
|
|
|
ref={draggableRef}
|
|
|
|
|
style={dragWrapperStyle}
|
2020-03-27 09:02:11 +00:00
|
|
|
>
|
2023-09-11 15:55:11 +00:00
|
|
|
{props.children}
|
2023-02-24 13:21:56 +00:00
|
|
|
{showBoundary && (
|
|
|
|
|
<WidgetBoundaries
|
|
|
|
|
className={`widget-boundary-${props.widgetId}`}
|
|
|
|
|
style={dragBoundariesStyle}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2020-03-27 09:02:11 +00:00
|
|
|
</DraggableWrapper>
|
2019-09-17 10:09:00 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-04-02 16:12:08 +00:00
|
|
|
|
2019-09-17 10:09:00 +00:00
|
|
|
export default DraggableComponent;
|