PromucFlow_constructor/app/client/src/components/editorComponents/ResizableComponent.tsx

353 lines
11 KiB
TypeScript
Raw Normal View History

List Widget Phase 2 (#4189) * update meta properties + default properties map * update widget registery * update get meta property * update metahoc + widgetfactory + data tree evaluator * try sending function as string to worker * revert data tree evaluator update * pass default props map from dataTreeWidget file * wip * save child meta properties * remove console.log * save meta and default map in list * update listwidget * remove console.log + unused variables * revert getMetaPropertiesMap function * fix data tree test * fix list widget test * fix entity definition test * fix overriting of item in updatedItems * remove todo comments * fix meta prop issue * revert making meta properties from undefiend to "" & fix filepicker bug * fix test case * change items to listData and updatedItems to items * remove console.log * fix test * extract derived properties to dervied.js * disabled top, left, right resize handler list widget container * add test for dervied js * add test for selectedItem * fix background color bug on hover * remove console.log * fix chart widget inside list widget * fix checkbox issue + points raised by yogesh * revert the createImmerReducer usage * fix parse derived properties * remove internal props object that fails the test * fix import typo * allow bottom resize handler * fix template height check * fix template height check * update template size check * fix the is visible invalid prop issue * fix migration of list widget phase 2 * fix migration * remove unused import * fix migration * fix migration * remove console.log * hide delete option for container in entity explorer * fix testcases * remove unused import * fix switch widget meta prop Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-06-18 07:42:57 +00:00
import React, { useContext, useRef, memo, useMemo } from "react";
import { XYCord } from "utils/hooks/useCanvasDragging";
2020-02-18 19:56:58 +00:00
import {
WidgetOperations,
WidgetRowCols,
WidgetProps,
} from "widgets/BaseWidget";
import { EditorContext } from "components/editorComponents/EditorContextProvider";
import { generateClassName } from "utils/generators";
2020-01-16 11:46:21 +00:00
import { DropTargetContext } from "./DropTargetComponent";
import {
UIElementSize,
2020-02-18 19:56:58 +00:00
computeFinalRowCols,
computeRowCols,
} from "./ResizableUtils";
2020-01-20 09:00:37 +00:00
import {
useShowPropertyPane,
useShowTableFilterPane,
2020-01-20 09:00:37 +00:00
useWidgetDragResize,
} from "utils/hooks/dragResizeHooks";
2020-01-21 07:14:47 +00:00
import { useSelector } from "react-redux";
import { AppState } from "reducers";
2020-02-18 19:56:58 +00:00
import Resizable from "resizable";
import { omit, get, ceil } from "lodash";
import { getSnapColumns, isDropZoneOccupied } from "utils/WidgetPropsUtils";
import {
VisibilityContainer,
LeftHandleStyles,
RightHandleStyles,
TopHandleStyles,
BottomHandleStyles,
TopLeftHandleStyles,
TopRightHandleStyles,
BottomLeftHandleStyles,
BottomRightHandleStyles,
} from "./ResizeStyledComponents";
2020-03-03 07:02:53 +00:00
import AnalyticsUtil from "utils/AnalyticsUtil";
import { scrollElementIntoParentCanvasView } from "utils/helpers";
import { getNearestParentCanvas } from "utils/generators";
import { getOccupiedSpaces } from "selectors/editorSelectors";
2021-06-09 10:35:10 +00:00
import { commentModeSelector } from "selectors/commentsSelectors";
[Feature] new nav sniping mode (#5746) * added sniping mode toggle option to header * added cover to components on hover in sniping mode * fixed the transition time * using filled icon * Show dependencies in action pane * Added a wrapper to make a widget snipeable * removed older parts of sniping from Positioned Container * removed onclick action from snipeable wrapper * Showing widget name in different color * Added a mechanism to send user to sniping mode from successful API screen * created new property pane saga to bind the data * Fix datasource list width issue * Fix sidebar going out of view when the response is a table * Minor refactor * Show add widgets section on the sidebar * Stop showing autocomplete option after adding a widget * fetching pageId, appId from store * Get suggested widget from response * Fix table data not getting evaluated after adding binding * Fix property pane going below the entity explorer while navigating from query/api pane * Fix width of sidepane shifting for apis * Fix vertical margins of connections * Fix api pane suggested widget showing up for errors * Fix margins * can show select in canvas btn in sidebar * can get the action object at the end to bind the data * updated saga and action names * can bind data to table * Use themes * Use new image url for Table widget * Added conditional mapping for sniping mode binding. * updated the widget name tags and seq of calls to open property pane * pushed all sniping mode decoration to header * moved setting sniping mode logic to editor reducer * Added keyboard short cut to get out of sniping mode * updated reset sniping mechanism * removed a divider line * if there are no relationships, will not show the complete section * Connect Data will automatically show relevant tab in integrations * Update list and dropdown image urls * Remove create table button * no wrapping bind to text * minor review considerations * showing the widget name to left in sniping mode * can set data to datepicker * will not show snipe btn if there are no widgets in canvas * Changes for multiple suggested widgets * removed dependency of sniping from suggested widgets * Added analytics events for sniping mode * logic for binding data to a widget, moved to snipeable component * changed binding widget func from capture to onClick and took care of sniping from widget wrapper too. * added tests to check sniping mode for table * updated test spec * minor fix * Fix copy changes * Update test to use table widget from suggested widget list * if fails to bind will generate warning and keep user in sniping mode * in sniping mode will only show name plate if it is under focus * fixed the test case * added a comment * minor fix to capture on click event in sniping mode * updated text * Hide connections UI when there are no connections * Increase width to 90% * Show placeholder text and back button in sidepane * Show tooltip on hover * Add analyitcs events for suggested widgets and connections * Update label based on whether widgets are there or not * binding related changes * renamed the saga file containing sinping mode sagas * Changes for inspect entity * Revert "binding related changes" temporarily This reverts commit 54ae9667fecf24bc3cf9912a5356d06600b25c84. * Update suggested widgets url * Update table url * Fix chart data field not getting evaluated * a minor fix to show proper tool tip when user hovers on widget name * Show sidepane when there is output * Update locators * Use constants for messages * Update file name to ApiRightPane * Remove delay * Revert "Revert "binding related changes" temporarily" This reverts commit ee7f75e83218137250b4b9a28fcf63080c185150. * Fix width * Fix overlap Co-authored-by: Akash N <akash@codemonk.in>
2021-07-26 16:44:10 +00:00
import { snipingModeSelector } from "selectors/editorSelectors";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
import { getCanvasWidgets } from "selectors/entitiesSelector";
import { focusWidget } from "actions/widgetActions";
import { getParentToOpenIfAny } from "utils/hooks/useClickToSelectWidget";
2020-02-18 19:56:58 +00:00
export type ResizableComponentProps = WidgetProps & {
2020-02-18 19:56:58 +00:00
paddingOffset: number;
};
export const ResizableComponent = memo(function ResizableComponent(
props: ResizableComponentProps,
) {
const resizableRef = useRef<HTMLDivElement>(null);
// Fetch information from the context
const { updateWidget } = useContext(EditorContext);
const occupiedSpaces = useSelector(getOccupiedSpaces);
const canvasWidgets = useSelector(getCanvasWidgets);
feat: Undo/Redo (#6654) * Scaffolding for undo-redo * undo redo working Poc commit * memory performance improvements by diffing * dont run update on undo/redo" * merging widget postion update and canvas bottom row update into one dsl update. * fix tabs widget * Visible updates per undo redo action (#6838) Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> * resize atomic operation * fix switch control state issue * disallow undo/redo for snipping and comment mode * disallow undo/redo for snipping and comment mode * fix color picker issue in undo/redo * add test for replayDSL * option control fix, adding logs * minor position change undo redo updates * add test cases for replayHelpers * property Upade visual change * remove unused code * global hot key jest test for undo redo * Fixing batch updates on property change.. * add tests for toggle control in property pane * unwanted utils. * add tests for text control * add tests for deletion * add tests for dropping a new widget * adding jest test for replayUtils * add move widget tests * add tests for color picker control * add analytics for undo/redo * add analytics for undo/redo * tab addition atomic * cypress tests for propertyPane, toasts and radiowidget optionControl * replayDSL end of redo stack fix * property update changes * menu option control debounce input * color picker empty undo fix * fix cypress tests * widget add/remove atomic * revert alternative approach to handle atomic operations * update replayDSL test * add some comments * addressing review comments * flash color for property pane controls * Fixing adding of tabs widget as well. * code review comments. * merging widget postion update and canvas bottom row update into one dsl update. * fix ordering of tabs property control * meta property update canvas min height. * fixing failed specs. * Fixing entity explorer update on deleting tab from entity explorer. * address review comments and minor property update changes * fixing failing tests * merge conflicts * changes to cater widget api. * fix suggested widget table issue * draggable list for undo redo * fix widget name focus * excluding canvas updates. * fixing codeEditor update on propertySection collapse * fixed failing test case Co-authored-by: Abhinav Jha <abhinav@appsmith.com> Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-09-21 07:55:56 +00:00
const { updateDropTargetRows } = useContext(DropTargetContext);
2020-01-17 12:34:58 +00:00
2021-06-09 10:35:10 +00:00
const isCommentMode = useSelector(commentModeSelector);
[Feature] new nav sniping mode (#5746) * added sniping mode toggle option to header * added cover to components on hover in sniping mode * fixed the transition time * using filled icon * Show dependencies in action pane * Added a wrapper to make a widget snipeable * removed older parts of sniping from Positioned Container * removed onclick action from snipeable wrapper * Showing widget name in different color * Added a mechanism to send user to sniping mode from successful API screen * created new property pane saga to bind the data * Fix datasource list width issue * Fix sidebar going out of view when the response is a table * Minor refactor * Show add widgets section on the sidebar * Stop showing autocomplete option after adding a widget * fetching pageId, appId from store * Get suggested widget from response * Fix table data not getting evaluated after adding binding * Fix property pane going below the entity explorer while navigating from query/api pane * Fix width of sidepane shifting for apis * Fix vertical margins of connections * Fix api pane suggested widget showing up for errors * Fix margins * can show select in canvas btn in sidebar * can get the action object at the end to bind the data * updated saga and action names * can bind data to table * Use themes * Use new image url for Table widget * Added conditional mapping for sniping mode binding. * updated the widget name tags and seq of calls to open property pane * pushed all sniping mode decoration to header * moved setting sniping mode logic to editor reducer * Added keyboard short cut to get out of sniping mode * updated reset sniping mechanism * removed a divider line * if there are no relationships, will not show the complete section * Connect Data will automatically show relevant tab in integrations * Update list and dropdown image urls * Remove create table button * no wrapping bind to text * minor review considerations * showing the widget name to left in sniping mode * can set data to datepicker * will not show snipe btn if there are no widgets in canvas * Changes for multiple suggested widgets * removed dependency of sniping from suggested widgets * Added analytics events for sniping mode * logic for binding data to a widget, moved to snipeable component * changed binding widget func from capture to onClick and took care of sniping from widget wrapper too. * added tests to check sniping mode for table * updated test spec * minor fix * Fix copy changes * Update test to use table widget from suggested widget list * if fails to bind will generate warning and keep user in sniping mode * in sniping mode will only show name plate if it is under focus * fixed the test case * added a comment * minor fix to capture on click event in sniping mode * updated text * Hide connections UI when there are no connections * Increase width to 90% * Show placeholder text and back button in sidepane * Show tooltip on hover * Add analyitcs events for suggested widgets and connections * Update label based on whether widgets are there or not * binding related changes * renamed the saga file containing sinping mode sagas * Changes for inspect entity * Revert "binding related changes" temporarily This reverts commit 54ae9667fecf24bc3cf9912a5356d06600b25c84. * Update suggested widgets url * Update table url * Fix chart data field not getting evaluated * a minor fix to show proper tool tip when user hovers on widget name * Show sidepane when there is output * Update locators * Use constants for messages * Update file name to ApiRightPane * Remove delay * Revert "Revert "binding related changes" temporarily" This reverts commit ee7f75e83218137250b4b9a28fcf63080c185150. * Fix width * Fix overlap Co-authored-by: Akash N <akash@codemonk.in>
2021-07-26 16:44:10 +00:00
const isSnipingMode = useSelector(snipingModeSelector);
2021-06-09 10:35:10 +00:00
2020-01-20 09:00:37 +00:00
const showPropertyPane = useShowPropertyPane();
const showTableFilterPane = useShowTableFilterPane();
2020-01-20 09:00:37 +00:00
const { selectWidget } = useWidgetSelection();
const { setIsResizing } = useWidgetDragResize();
const selectedWidget = useSelector(
(state: AppState) => state.ui.widgetDragResize.lastSelectedWidget,
);
const selectedWidgets = useSelector(
(state: AppState) => state.ui.widgetDragResize.selectedWidgets,
2020-01-20 09:00:37 +00:00
);
const focusedWidget = useSelector(
(state: AppState) => state.ui.widgetDragResize.focusedWidget,
2020-01-20 09:00:37 +00:00
);
const isDragging = useSelector(
(state: AppState) => state.ui.widgetDragResize.isDragging,
);
2020-02-18 19:56:58 +00:00
const isResizing = useSelector(
(state: AppState) => state.ui.widgetDragResize.isResizing,
);
const parentWidgetToSelect = getParentToOpenIfAny(
props.widgetId,
canvasWidgets,
);
const occupiedSpacesBySiblingWidgets = useMemo(() => {
return occupiedSpaces && props.parentId && occupiedSpaces[props.parentId]
? occupiedSpaces[props.parentId]
: undefined;
}, [occupiedSpaces, props.parentId]);
// isFocused (string | boolean) -> isWidgetFocused (boolean)
2020-01-06 11:02:22 +00:00
const isWidgetFocused =
focusedWidget === props.widgetId ||
selectedWidget === props.widgetId ||
selectedWidgets.includes(props.widgetId);
2019-10-08 06:19:10 +00:00
// Calculate the dimensions of the widget,
// The ResizableContainer's size prop is controlled
const dimensions: UIElementSize = {
width:
(props.rightColumn - props.leftColumn) * props.parentColumnSpace -
2 * props.paddingOffset,
height:
(props.bottomRow - props.topRow) * props.parentRowSpace -
2 * props.paddingOffset,
};
// Resize bound's className - defaults to body
// ResizableContainer accepts the className of the element,
// whose clientRect will act as the bounds for resizing.
// Note, if there are many containers with the same className
// the bounding container becomes the nearest parent with the className
2020-02-18 19:56:58 +00:00
const boundingElementClassName = generateClassName(props.parentId);
const possibleBoundingElements = document.getElementsByClassName(
boundingElementClassName,
);
const boundingElement =
possibleBoundingElements.length > 0
? possibleBoundingElements[0]
: undefined;
2019-10-08 06:19:10 +00:00
// onResize handler
// Checks if the current resize position has any collisions
// If yes, set isColliding flag to true.
// If no, set isColliding flag to false.
const isColliding = (newDimensions: UIElementSize, position: XYCord) => {
// Moving the bounding element calculations inside
// to make this expensive operation only whne
const boundingElementClientRect = boundingElement
? boundingElement.getBoundingClientRect()
: undefined;
2020-01-16 11:46:21 +00:00
const bottom =
2020-02-18 19:56:58 +00:00
props.topRow +
position.y / props.parentRowSpace +
newDimensions.height / props.parentRowSpace;
2020-01-16 11:46:21 +00:00
// Make sure to calculate collision IF we don't update the main container's rows
let updated = false;
if (updateDropTargetRows) {
updated = !!updateDropTargetRows(props.widgetId, bottom);
const el = resizableRef.current;
if (el) {
const { height } = el?.getBoundingClientRect();
const scrollParent = getNearestParentCanvas(resizableRef.current);
scrollElementIntoParentCanvasView(
{
top: 40,
height,
},
scrollParent,
el,
);
}
2020-02-18 19:56:58 +00:00
}
const delta: UIElementSize = {
height: newDimensions.height - dimensions.height,
width: newDimensions.width - dimensions.width,
};
const newRowCols: WidgetRowCols | false = computeRowCols(
delta,
position,
props,
);
if (newRowCols.rightColumn > getSnapColumns()) {
return true;
}
// Minimum row and columns to be set to a widget.
if (
newRowCols.rightColumn - newRowCols.leftColumn < 2 ||
newRowCols.bottomRow - newRowCols.topRow < 4
) {
return true;
}
2020-02-18 19:56:58 +00:00
if (
boundingElementClientRect &&
newRowCols.rightColumn * props.parentColumnSpace >
ceil(boundingElementClientRect.width)
2020-02-18 19:56:58 +00:00
) {
return true;
}
if (newRowCols && newRowCols.leftColumn < 0) {
return true;
}
2020-01-16 11:46:21 +00:00
if (!updated) {
2020-02-18 19:56:58 +00:00
if (
boundingElementClientRect &&
newRowCols.bottomRow * props.parentRowSpace >
ceil(boundingElementClientRect.height)
2020-02-18 19:56:58 +00:00
) {
return true;
}
if (newRowCols && newRowCols.topRow < 0) {
return true;
2020-01-16 11:46:21 +00:00
}
2019-10-08 06:19:10 +00:00
}
// this is required for list widget so that template have no collision
if (props.ignoreCollision) return false;
2020-02-18 19:56:58 +00:00
// Check if new row cols are occupied by sibling widgets
return isDropZoneOccupied(
{
left: newRowCols.leftColumn,
top: newRowCols.topRow,
bottom: newRowCols.bottomRow,
right: newRowCols.rightColumn,
},
props.widgetId,
occupiedSpacesBySiblingWidgets,
);
2019-10-08 06:19:10 +00:00
};
// onResizeStop handler
// when done resizing, check if;
// 1) There is no collision
// 2) There is a change in widget size
// Update widget, if both of the above are true.
const updateSize = (newDimensions: UIElementSize, position: XYCord) => {
// Get the difference in size of the widget, before and after resizing.
const delta: UIElementSize = {
2020-02-18 19:56:58 +00:00
height: newDimensions.height - dimensions.height,
width: newDimensions.width - dimensions.width,
};
// Get the updated Widget rows and columns props
// False, if there is collision
// False, if none of the rows and cols have changed.
2020-02-18 19:56:58 +00:00
const newRowCols: WidgetRowCols | false = computeFinalRowCols(
delta,
position,
props,
);
if (newRowCols) {
updateWidget &&
feat: Undo/Redo (#6654) * Scaffolding for undo-redo * undo redo working Poc commit * memory performance improvements by diffing * dont run update on undo/redo" * merging widget postion update and canvas bottom row update into one dsl update. * fix tabs widget * Visible updates per undo redo action (#6838) Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> * resize atomic operation * fix switch control state issue * disallow undo/redo for snipping and comment mode * disallow undo/redo for snipping and comment mode * fix color picker issue in undo/redo * add test for replayDSL * option control fix, adding logs * minor position change undo redo updates * add test cases for replayHelpers * property Upade visual change * remove unused code * global hot key jest test for undo redo * Fixing batch updates on property change.. * add tests for toggle control in property pane * unwanted utils. * add tests for text control * add tests for deletion * add tests for dropping a new widget * adding jest test for replayUtils * add move widget tests * add tests for color picker control * add analytics for undo/redo * add analytics for undo/redo * tab addition atomic * cypress tests for propertyPane, toasts and radiowidget optionControl * replayDSL end of redo stack fix * property update changes * menu option control debounce input * color picker empty undo fix * fix cypress tests * widget add/remove atomic * revert alternative approach to handle atomic operations * update replayDSL test * add some comments * addressing review comments * flash color for property pane controls * Fixing adding of tabs widget as well. * code review comments. * merging widget postion update and canvas bottom row update into one dsl update. * fix ordering of tabs property control * meta property update canvas min height. * fixing failed specs. * Fixing entity explorer update on deleting tab from entity explorer. * address review comments and minor property update changes * fixing failing tests * merge conflicts * changes to cater widget api. * fix suggested widget table issue * draggable list for undo redo * fix widget name focus * excluding canvas updates. * fixing codeEditor update on propertySection collapse * fixed failing test case Co-authored-by: Abhinav Jha <abhinav@appsmith.com> Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-09-21 07:55:56 +00:00
updateWidget(WidgetOperations.RESIZE, props.widgetId, {
...newRowCols,
parentId: props.parentId,
});
}
// Tell the Canvas that we've stopped resizing
2020-03-04 08:10:40 +00:00
// Put it later in the stack so that other updates like click, are not propagated to the parent container
setTimeout(() => {
setIsResizing && setIsResizing(false);
2020-01-17 12:34:58 +00:00
}, 0);
// Tell the Canvas to put the focus back to this widget
// By setting the focus, we enable the control buttons on the widget
2020-03-04 08:10:40 +00:00
selectWidget &&
selectedWidget !== props.widgetId &&
parentWidgetToSelect?.widgetId !== props.widgetId &&
2020-03-04 08:10:40 +00:00
selectWidget(props.widgetId);
if (parentWidgetToSelect) {
selectWidget &&
selectedWidget !== parentWidgetToSelect.widgetId &&
selectWidget(parentWidgetToSelect.widgetId);
focusWidget(parentWidgetToSelect.widgetId);
} else {
selectWidget &&
selectedWidget !== props.widgetId &&
selectWidget(props.widgetId);
}
// Property pane closes after a resize/drag
showPropertyPane && showPropertyPane();
2020-03-03 07:02:53 +00:00
AnalyticsUtil.logEvent("WIDGET_RESIZE_END", {
widgetName: props.widgetName,
widgetType: props.type,
startHeight: dimensions.height,
startWidth: dimensions.width,
endHeight: newDimensions.height,
endWidth: newDimensions.width,
});
2020-02-18 19:56:58 +00:00
};
const handleResizeStart = () => {
setIsResizing && !isResizing && setIsResizing(true);
selectWidget &&
selectedWidget !== props.widgetId &&
selectWidget(props.widgetId);
// Make sure that this tableFilterPane should close
showTableFilterPane && showTableFilterPane();
2020-03-03 07:02:53 +00:00
AnalyticsUtil.logEvent("WIDGET_RESIZE_START", {
widgetName: props.widgetName,
widgetType: props.type,
});
};
List Widget Phase 2 (#4189) * update meta properties + default properties map * update widget registery * update get meta property * update metahoc + widgetfactory + data tree evaluator * try sending function as string to worker * revert data tree evaluator update * pass default props map from dataTreeWidget file * wip * save child meta properties * remove console.log * save meta and default map in list * update listwidget * remove console.log + unused variables * revert getMetaPropertiesMap function * fix data tree test * fix list widget test * fix entity definition test * fix overriting of item in updatedItems * remove todo comments * fix meta prop issue * revert making meta properties from undefiend to "" & fix filepicker bug * fix test case * change items to listData and updatedItems to items * remove console.log * fix test * extract derived properties to dervied.js * disabled top, left, right resize handler list widget container * add test for dervied js * add test for selectedItem * fix background color bug on hover * remove console.log * fix chart widget inside list widget * fix checkbox issue + points raised by yogesh * revert the createImmerReducer usage * fix parse derived properties * remove internal props object that fails the test * fix import typo * allow bottom resize handler * fix template height check * fix template height check * update template size check * fix the is visible invalid prop issue * fix migration of list widget phase 2 * fix migration * remove unused import * fix migration * fix migration * remove console.log * hide delete option for container in entity explorer * fix testcases * remove unused import * fix switch widget meta prop Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-06-18 07:42:57 +00:00
const handles = useMemo(() => {
const allHandles = {
left: LeftHandleStyles,
top: TopHandleStyles,
bottom: BottomHandleStyles,
right: RightHandleStyles,
bottomRight: BottomRightHandleStyles,
topLeft: TopLeftHandleStyles,
topRight: TopRightHandleStyles,
bottomLeft: BottomLeftHandleStyles,
};
return omit(allHandles, get(props, "disabledResizeHandles", []));
}, [props]);
2020-02-18 19:56:58 +00:00
2021-06-09 10:35:10 +00:00
const isEnabled =
[Feature] new nav sniping mode (#5746) * added sniping mode toggle option to header * added cover to components on hover in sniping mode * fixed the transition time * using filled icon * Show dependencies in action pane * Added a wrapper to make a widget snipeable * removed older parts of sniping from Positioned Container * removed onclick action from snipeable wrapper * Showing widget name in different color * Added a mechanism to send user to sniping mode from successful API screen * created new property pane saga to bind the data * Fix datasource list width issue * Fix sidebar going out of view when the response is a table * Minor refactor * Show add widgets section on the sidebar * Stop showing autocomplete option after adding a widget * fetching pageId, appId from store * Get suggested widget from response * Fix table data not getting evaluated after adding binding * Fix property pane going below the entity explorer while navigating from query/api pane * Fix width of sidepane shifting for apis * Fix vertical margins of connections * Fix api pane suggested widget showing up for errors * Fix margins * can show select in canvas btn in sidebar * can get the action object at the end to bind the data * updated saga and action names * can bind data to table * Use themes * Use new image url for Table widget * Added conditional mapping for sniping mode binding. * updated the widget name tags and seq of calls to open property pane * pushed all sniping mode decoration to header * moved setting sniping mode logic to editor reducer * Added keyboard short cut to get out of sniping mode * updated reset sniping mechanism * removed a divider line * if there are no relationships, will not show the complete section * Connect Data will automatically show relevant tab in integrations * Update list and dropdown image urls * Remove create table button * no wrapping bind to text * minor review considerations * showing the widget name to left in sniping mode * can set data to datepicker * will not show snipe btn if there are no widgets in canvas * Changes for multiple suggested widgets * removed dependency of sniping from suggested widgets * Added analytics events for sniping mode * logic for binding data to a widget, moved to snipeable component * changed binding widget func from capture to onClick and took care of sniping from widget wrapper too. * added tests to check sniping mode for table * updated test spec * minor fix * Fix copy changes * Update test to use table widget from suggested widget list * if fails to bind will generate warning and keep user in sniping mode * in sniping mode will only show name plate if it is under focus * fixed the test case * added a comment * minor fix to capture on click event in sniping mode * updated text * Hide connections UI when there are no connections * Increase width to 90% * Show placeholder text and back button in sidepane * Show tooltip on hover * Add analyitcs events for suggested widgets and connections * Update label based on whether widgets are there or not * binding related changes * renamed the saga file containing sinping mode sagas * Changes for inspect entity * Revert "binding related changes" temporarily This reverts commit 54ae9667fecf24bc3cf9912a5356d06600b25c84. * Update suggested widgets url * Update table url * Fix chart data field not getting evaluated * a minor fix to show proper tool tip when user hovers on widget name * Show sidepane when there is output * Update locators * Use constants for messages * Update file name to ApiRightPane * Remove delay * Revert "Revert "binding related changes" temporarily" This reverts commit ee7f75e83218137250b4b9a28fcf63080c185150. * Fix width * Fix overlap Co-authored-by: Akash N <akash@codemonk.in>
2021-07-26 16:44:10 +00:00
!isDragging &&
isWidgetFocused &&
!props.resizeDisabled &&
!isCommentMode &&
!isSnipingMode;
const isMultiSelectedWidget =
selectedWidgets &&
selectedWidgets.length > 1 &&
selectedWidgets.includes(props.widgetId);
2021-06-09 10:35:10 +00:00
return (
2020-02-18 19:56:58 +00:00
<Resizable
allowResize={!isMultiSelectedWidget}
componentHeight={dimensions.height}
componentWidth={dimensions.width}
2021-06-09 10:35:10 +00:00
enable={isEnabled}
List Widget Phase 2 (#4189) * update meta properties + default properties map * update widget registery * update get meta property * update metahoc + widgetfactory + data tree evaluator * try sending function as string to worker * revert data tree evaluator update * pass default props map from dataTreeWidget file * wip * save child meta properties * remove console.log * save meta and default map in list * update listwidget * remove console.log + unused variables * revert getMetaPropertiesMap function * fix data tree test * fix list widget test * fix entity definition test * fix overriting of item in updatedItems * remove todo comments * fix meta prop issue * revert making meta properties from undefiend to "" & fix filepicker bug * fix test case * change items to listData and updatedItems to items * remove console.log * fix test * extract derived properties to dervied.js * disabled top, left, right resize handler list widget container * add test for dervied js * add test for selectedItem * fix background color bug on hover * remove console.log * fix chart widget inside list widget * fix checkbox issue + points raised by yogesh * revert the createImmerReducer usage * fix parse derived properties * remove internal props object that fails the test * fix import typo * allow bottom resize handler * fix template height check * fix template height check * update template size check * fix the is visible invalid prop issue * fix migration of list widget phase 2 * fix migration * remove unused import * fix migration * fix migration * remove console.log * hide delete option for container in entity explorer * fix testcases * remove unused import * fix switch widget meta prop Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
2021-06-18 07:42:57 +00:00
handles={handles}
isColliding={isColliding}
2020-02-18 19:56:58 +00:00
onStart={handleResizeStart}
onStop={updateSize}
ref={resizableRef}
2020-02-18 19:56:58 +00:00
snapGrid={{ x: props.parentColumnSpace, y: props.parentRowSpace }}
// Used only for performance tracking, can be removed after optimization.
zWidgetId={props.widgetId}
zWidgetType={props.type}
>
<VisibilityContainer
padding={props.paddingOffset}
visible={!!props.isVisible}
>
{props.children}
</VisibilityContainer>
2020-02-18 19:56:58 +00:00
</Resizable>
);
});
export default ResizableComponent;