Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
291dfd1
Cut copy paste first cut
marks0351 Jun 18, 2021
2076c29
removed different parent groups logic
marks0351 Jun 23, 2021
08d094f
mouseup on the outer canvas removes selections.
marks0351 Jun 23, 2021
74dfbeb
bug fix
marks0351 Jun 23, 2021
15b7782
remove unwanted dead code.
marks0351 Jun 23, 2021
cd00c64
Adding tests
marks0351 Jun 23, 2021
1cab557
build fix
marks0351 Jun 23, 2021
5c0ee14
min height fixes
marks0351 Jun 24, 2021
b5b916b
fixing specs.
marks0351 Jun 24, 2021
915eb2b
fixing specs.
marks0351 Jun 24, 2021
b77c46b
fix merge conflcits
Jun 25, 2021
9e7c60e
fix border positioning
Jun 25, 2021
591b193
fix canvas widgets incorrect bouding box
Jun 25, 2021
f599143
fix bounding box position issue
Jun 25, 2021
485c8db
fix bounding box position issue
Jun 25, 2021
2985fa5
fix
marks0351 Jun 25, 2021
4c57996
border issue fix
Jun 25, 2021
a92bae0
update imports
Jun 25, 2021
da2c80b
update test case
Jun 25, 2021
530eeb4
add colors in theme
Jun 28, 2021
0ea55c0
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jun 28, 2021
bd48ea0
use layers + use click capture on actions
Jun 30, 2021
0630278
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jun 30, 2021
30139ed
add icon for grouping
Jun 30, 2021
6d3a6b6
fix overflow issue in contextmenu in containers
Jun 30, 2021
5640b51
fix context menu display issue
Jun 30, 2021
11ce874
update position of context menu
Jul 1, 2021
fcc57f2
fix container box-shadow issue
Jul 1, 2021
6bea2d8
fix container box-shadow issue
Jul 1, 2021
c2b8b17
revert container box shadow
Jul 1, 2021
22be1ce
stop opening of property pane on shift clicking a widget
Jul 1, 2021
00b4d3b
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 2, 2021
523e0e4
remove console.log
Jul 2, 2021
5051385
fix multiselect box issue
Jul 2, 2021
8748485
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 2, 2021
46bea97
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 6, 2021
22ac68a
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 6, 2021
46eedef
add container on copy
Jul 6, 2021
4e23e49
add analytics middleware
Jul 7, 2021
e07fa0d
refactor paste widget saga
Jul 7, 2021
a2eb691
change flash element to accept array + revert refactor
Jul 7, 2021
92c81f7
add logic to create containers from selected widgets
Jul 7, 2021
4ac8304
fix selection issue
Jul 8, 2021
d7d93b0
fix merge conflicts
Jul 8, 2021
18f2f12
Merge branch 'feature/widget-grouping-3-container' of github.com:apps…
Jul 8, 2021
f825295
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 9, 2021
6868e46
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 12, 2021
93bb7e1
update positions of grouped widgets
Jul 12, 2021
8dfcb73
fix comments + remove console
Jul 12, 2021
3c774ac
update flashElementbyId to flashElementsById
Jul 12, 2021
37da87a
remove analytics middleware + remove unecessary imports
Jul 12, 2021
86dff94
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 12, 2021
d078c06
add shorcut for grouping
Jul 12, 2021
6098d33
fix position issue when pasting
Jul 13, 2021
e38bb8d
allow grouping only when multi widgets are selected
Jul 13, 2021
142fde6
fix ux issues with widget grouping
Jul 13, 2021
b3e70fc
fix help text for grouping actions
Jul 13, 2021
8bed5ec
filter out the modal widget when calculting next row
Jul 14, 2021
316d4e6
fix delete issue when grouping
Jul 14, 2021
90554a0
persist positin when grouping if there is no collision
Jul 16, 2021
5d2657c
fix typo for new position
Jul 16, 2021
a30cf37
changes for review comments
Jul 19, 2021
7ac99c0
Merge branch 'release' of github.com:appsmithorg/appsmith into featur…
Jul 19, 2021
e5bfb84
changes for review comments
Jul 19, 2021
b6684db
fix position issue when pasting
Jul 19, 2021
0633515
fix new container position issue
Aug 3, 2021
1c6db9f
fix merge conflicts
Aug 10, 2021
5cafdd8
move utils function to utils
Aug 10, 2021
1764a19
Merge branch 'feature/widget-grouping-3-container' of github.com:apps…
Aug 10, 2021
f932860
fix import issue
Aug 10, 2021
b17d934
fix merge conflict
Aug 10, 2021
1c45539
fix the composite widget grouping issue
Aug 11, 2021
4d4f9ab
fix merge conflicts
Aug 12, 2021
b94e630
fix table name bug
Aug 12, 2021
7472a58
fix table name bug
Aug 12, 2021
a157df6
remove repeated code
Aug 12, 2021
edb1daf
move copied groups existence check;
Aug 16, 2021
fac4dfa
Merge branch 'feature/widget-grouping-3-container' of github.com:apps…
Aug 16, 2021
c7f46c4
fix merge conflicts
Aug 16, 2021
09a58ba
fix copied group check
Aug 16, 2021
46b184b
fix merge conficts
Aug 20, 2021
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
17 changes: 16 additions & 1 deletion app/client/src/actions/widgetActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ export const copyWidget = (isShortcut: boolean) => {
};
};

export const pasteWidget = () => {
export const pasteWidget = (groupWidgets = false) => {
return {
type: ReduxActionTypes.PASTE_COPIED_WIDGET_INIT,
payload: {
groupWidgets: groupWidgets,
},
};
};

Expand Down Expand Up @@ -152,3 +155,15 @@ export const addSuggestedWidget = (payload: Partial<WidgetProps>) => {
payload,
};
};

/**
* action to group selected widgets into container
*
* @param queryName
* @returns
*/
export const groupWidgets = () => {
return {
type: ReduxActionTypes.GROUP_WIDGETS_INIT,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SuggestedWidget } from "api/ActionAPI";
import { useSelector } from "store";
import { getDataTree } from "selectors/dataTreeSelectors";
import { getWidgets } from "sagas/selectors";
import { getNextWidgetName } from "sagas/WidgetOperationSagas";
import { getNextWidgetName } from "sagas/WidgetOperationUtils";

const WidgetList = styled.div`
${(props) => getTypographyByKey(props, "p1")}
Expand Down
1 change: 1 addition & 0 deletions app/client/src/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ export const ReduxActionTypes = {
SET_CRUD_INFO_MODAL_OPEN: "SET_CRUD_INFO_MODAL_OPEN",
SET_PAGE_ORDER_INIT: "SET_PAGE_ORDER_INIT",
SET_PAGE_ORDER_SUCCESS: "SET_PAGE_ORDER_SUCCESS",
GROUP_WIDGETS_INIT: "GROUP_WIDGETS_INIT",
};

export type ReduxActionType = typeof ReduxActionTypes[keyof typeof ReduxActionTypes];
Expand Down
17 changes: 15 additions & 2 deletions app/client/src/entities/Widget/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import {
PropertyPaneConfig,
ValidationConfig,
} from "constants/PropertyControlConstants";
import { get, isObject, isUndefined } from "lodash";
import { get, isObject, isUndefined, omitBy } from "lodash";
import { FlattenedWidgetProps } from "reducers/entityReducers/canvasWidgetsReducer";
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
import { WidgetTypes } from "constants/WidgetConstants";

export const getAllPathsFromPropertyConfig = (
widget: WidgetProps,
Expand Down Expand Up @@ -146,12 +147,24 @@ export const getAllPathsFromPropertyConfig = (
return { bindingPaths, triggerPaths, validationPaths };
};

/**
* this function gets the next available row for pasting widgets
* NOTE: this function excludes modal widget when calculating next available row
*
* @param parentContainerId
* @param canvasWidgets
* @returns
*/
export const nextAvailableRowInContainer = (
parentContainerId: string,
canvasWidgets: { [widgetId: string]: FlattenedWidgetProps },
) => {
const filteredCanvasWidgets = omitBy(canvasWidgets, (widget) => {
return widget.type === WidgetTypes.MODAL_WIDGET;
});

return (
Object.values(canvasWidgets).reduce(
Object.values(filteredCanvasWidgets).reduce(
(prev: number, next: any) =>
next?.parentId === parentContainerId && next.bottomRow > prev
? next.bottomRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback } from "react";
import { WidgetTypes, WidgetType } from "constants/WidgetConstants";
import { useParams } from "react-router";
import { ExplorerURLParams } from "../helpers";
import { flashElementById } from "utils/helpers";
import { flashElementsById } from "utils/helpers";
import { useDispatch, useSelector } from "react-redux";
import {
forceOpenPropertyPane,
Expand All @@ -23,7 +23,7 @@ export const useNavigateToWidget = () => {
} = useWidgetSelection();
const multiSelectWidgets = (widgetId: string, pageId: string) => {
navigateToCanvas(params, window.location.pathname, pageId, widgetId);
flashElementById(widgetId);
flashElementsById(widgetId);
selectWidget(widgetId, true);
};

Expand All @@ -41,7 +41,8 @@ export const useNavigateToWidget = () => {
else dispatch(closeAllModals());
selectWidget(widgetId, false);
navigateToCanvas(params, window.location.pathname, pageId, widgetId);
flashElementById(widgetId);

flashElementsById(widgetId);
// Navigating to a widget from query pane seems to make the property pane
// appear below the entity explorer hence adding a timeout here
setTimeout(() => {
Expand Down
14 changes: 14 additions & 0 deletions app/client/src/pages/Editor/GlobalHotKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
copyWidget,
cutWidget,
deleteSelectedWidget,
groupWidgets,
pasteWidget,
} from "actions/widgetActions";
import {
Expand Down Expand Up @@ -41,6 +42,7 @@ type Props = {
pasteCopiedWidget: () => void;
deleteSelectedWidget: () => void;
cutSelectedWidget: () => void;
groupSelectedWidget: () => void;
toggleShowGlobalSearchModal: (category: SearchCategory) => void;
resetSnipingMode: () => void;
openDebugger: () => void;
Expand Down Expand Up @@ -235,6 +237,17 @@ class GlobalHotKeys extends React.Component<Props> {
preventDefault
stopPropagation
/>
<Hotkey
combo="mod + g"
global
group="Canvas"
label="Cut Widgets for grouping"
onKeyDown={(e: any) => {
if (this.stopPropagationIfWidgetSelected(e)) {
this.props.groupSelectedWidget();
}
}}
/>
</Hotkeys>
);
}
Expand All @@ -256,6 +269,7 @@ const mapDispatchToProps = (dispatch: any) => {
pasteCopiedWidget: () => dispatch(pasteWidget()),
deleteSelectedWidget: () => dispatch(deleteSelectedWidget(true)),
cutSelectedWidget: () => dispatch(cutWidget()),
groupSelectedWidget: () => dispatch(groupWidgets()),
toggleShowGlobalSearchModal: (category: SearchCategory) =>
dispatch(toggleShowGlobalSearchModal(category)),
resetSnipingMode: () => dispatch(resetSnipingModeAction()),
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/pages/Editor/WidgetsEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Spinner } from "@blueprintjs/core";
import AnalyticsUtil from "utils/AnalyticsUtil";
import * as log from "loglevel";
import { getCanvasClassName } from "utils/generators";
import { flashElementById } from "utils/helpers";
import { flashElementsById } from "utils/helpers";
import { useParams } from "react-router";
import { fetchPage } from "actions/pageActions";
import PerformanceTracker, {
Expand Down Expand Up @@ -92,7 +92,7 @@ function WidgetsEditor() {
useEffect(() => {
if (!isFetchingPage && window.location.hash.length > 0) {
const widgetIdFromURLHash = window.location.hash.substr(1);
flashElementById(widgetIdFromURLHash);
flashElementsById(widgetIdFromURLHash);
if (document.getElementById(widgetIdFromURLHash))
selectWidget(widgetIdFromURLHash);
}
Expand Down
36 changes: 36 additions & 0 deletions app/client/src/pages/Editor/WidgetsMultiSelectBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useSelector, useDispatch } from "react-redux";
import {
copyWidget,
cutWidget,
groupWidgets,
deleteSelectedWidget,
} from "actions/widgetActions";
import { isMac } from "utils/helpers";
Expand Down Expand Up @@ -127,6 +128,7 @@ export const PopoverModifiers: IPopoverSharedProps["modifiers"] = {
const CopyIcon = ControlIcons.COPY2_CONTROL;
const DeleteIcon = FormIcons.DELETE_ICON;
const CutIcon = ControlIcons.CUT_CONTROL;
const GroupIcon = ControlIcons.GROUP_CONTROL;

/**
* helper text that comes in popover on hover of actions in context menu
Expand All @@ -148,6 +150,11 @@ const deleteHelpText = (
Click or <b> Del </b>
</>
);
const groupHelpText = (
<>
Click or <b>{modText()} + G to group</b>
</>
);

interface OffsetBox {
top: number;
Expand Down Expand Up @@ -299,6 +306,20 @@ function WidgetsMultiSelectBox(props: {
dispatch(deleteSelectedWidget(true));
};

/**
* group widgets into container
*
* @param e
*/
const onGroupWidgets = (
e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
) => {
e.preventDefault();
e.stopPropagation();

dispatch(groupWidgets());
};

if (!shouldRender) return false;

return (
Expand Down Expand Up @@ -371,6 +392,21 @@ function WidgetsMultiSelectBox(props: {
<DeleteIcon color="black" height={16} width={16} />
</StyledAction>
</Tooltip>
{/* group widgets */}
<Tooltip
boundary="viewport"
content={groupHelpText}
maxWidth="400px"
modifiers={PopoverModifiers}
position={Position.RIGHT}
>
<StyledAction
onClick={stopEventPropagation}
onClickCapture={onGroupWidgets}
>
<GroupIcon color="black" height={16} width={16} />
</StyledAction>
</Tooltip>
</StyledActions>
</StyledActionsContainer>
</StyledSelectionBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import { MAIN_CONTAINER_WIDGET_ID } from "constants/WidgetConstants";

const initialState: CanvasWidgetsReduxState = {};

export type FlattenedWidgetProps = WidgetProps & {
children?: string[];
};
export type FlattenedWidgetProps<orType = never> =
| (WidgetProps & {
children?: string[];
})
| orType;

const canvasWidgetsReducer = createImmerReducer(initialState, {
[ReduxActionTypes.INIT_CANVAS_LAYOUT]: (
Expand Down
Loading