PromucFlow_constructor/app/client/src/layoutSystems/common/draggable/DraggableComponent.tsx

176 lines
5.9 KiB
TypeScript
Raw Normal View History

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";
import { getColorWithOpacity } from "constants/DefaultTheme";
import { WIDGET_PADDING } from "constants/WidgetConstants";
chore: BaseWidget Restructuring (#26562) ## Description Create a Basewidget wrapper that supplies Widget Onion as per the layout system. involves extracting widget layers presently in the BaseWidget into HOCs and hooks and make sure layout systems can be scaled. Make sure Modal widget is handled as a overlay widget whose wrappers are supplied by basewidget instead of modal widget implementing its own editing blocks. This PR also separates the drag n drop logic for both auto layout and fixed layout. They are moved into respective Layout system folders to have clear sepsration of concern #### PR fixes following issue(s) Fixes #26674 Fixes #26675 Fixes #26676 Fixes #26570 Fixes #26590 Fixes #26591 Fixes #26592 <img width="931" alt="BaseWidgetHOC" src="https://github.com/appsmithorg/appsmith/assets/35134347/22f4cf1e-e4c5-4475-83a8-6818e7cebe70"> [Miro Link to view the new system](https://miro.com/app/board/uXjVM6vRgf8=/?moveToWidget=3458764560239189204&cot=14) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Aswath K <aswath.sana@gmail.com>
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";
import styled from "styled-components";
2020-01-06 11:02:22 +00:00
import { useSelector } from "react-redux";
import {
isCurrentWidgetFocused,
isWidgetSelected,
} from "selectors/widgetSelectors";
refactor: Widget Selection (#19643) ## Description This change is a refactor of widget selection logic. It consolidates all the business logic to make it easy to maintain. It also improves the performance a bit. It touched a lot of features as we heavily rely on this ``` Select one Select multiple with drag Select multiple with shift Select multiple with cmd/ctrl Selections should be on the same level of hierarchy Unselect all by clicking on the canvas Unselect all by pressing esc Select all with cmd + a Paste in main container Paste in another container Undo Redo Modal Selection Modal child selection Context switching cmd click snipping mode new widget suggestion onboarding ``` > Refactor widget selection logic Fixes #19570 ## Type of change - Refactor ## How Has This Been Tested? All existing tests should pass ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383570810 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383607820 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1385095478 [Bug bash issues](https://www.notion.so/appsmith/610aa302f3e146a7b090b7dc6bc63ef9?v=0d277a9b07bf4aac9d717bcaf138c33a) ## Checklist: ### Dev activity - [ ] 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 - [ ] 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
2023-01-28 02:17:06 +00:00
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
import { useWidgetSelection } from "utils/hooks/useWidgetSelection";
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
import type { SetDraggingStateActionPayload } from "utils/hooks/dragResizeHooks";
import {
useShowTableFilterPane,
useWidgetDragResize,
} from "utils/hooks/dragResizeHooks";
chore: code changes for widget position observer and widget name on canvas (#27367) ## Description The PR contains non integrated code changes for below new features, The changes are not integrated to work but only contains the ground work code changes that can be added to css based layout/ Anvil once that is available in Release. - **Widget Position observer-** Since we are moving to css based layout, the positions of widgets will be unknown. To solve the issue we have introduced the above feature that stores/updates position of widgets on Redux state whenever a widget position updates. without manually triggering any action - **Widget Name on Canvas-** For the New Layout the existing widget name is inconsistent as it would cut off or visually not visible. to solve that the widget name will now be drawn on html canvas than it being a dom node component #### PR fixes following issue(s) Fixes #26945 Fixes #26948 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Abhinav Jha <abhinav@appsmith.com>
2023-10-06 10:07:43 +00:00
import { getShouldAllowDrag } from "selectors/widgetDragSelectors";
feat: branch protection (#28526) ## Description - Adds server endpoints for getting and setting protected branches - Adds protected canvas view for branch protection - Adds default branch and protected branch in git modal settings #### PR fixes following issue(s) Fixes #28434, #28056 #### Media Protected View - <img width="1728" alt="image" src="https://github.com/appsmithorg/appsmith/assets/8724051/4fb26450-61e1-4fc0-a66d-0ebaa28ff90c"> Branch Protection Settings - <img width="1728" alt="image" src="https://github.com/appsmithorg/appsmith/assets/8724051/fb6d16b6-0a3c-42fd-be1a-9b3677048663"> #### Type of change - New feature (non-breaking change which adds functionality) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Nayan <nayan@appsmith.com>
2023-11-03 17:13:36 +00:00
import { combinedPreviewModeSelector } from "selectors/editorSelectors";
feat: Anvil section space redistribution (#29632) ## Description Anvil Section Space distribution In this pr, we are adding a feature to sections to redistribute a sections space within its zones. you can find details of it over [here](https://www.notion.so/Sections-and-Zones-design-WIP-cbcb8b0ab2514aaf90d04aa3309ad56c) As part of it we have three parts of changes - UI components - Middleware(Redux and Sagas) - Space redistribution algorithm UI/UX: https://github.com/appsmithorg/appsmith/assets/35134347/092ba31f-d2e5-400e-80d7-45878d75ff98 Middleware changes: - have added a new state in WidgetDragResizeState `anvil` and into it have added `isDistributingSpace` to capture when space distribution is active. - added `anvilSpaceDistributionSagas` to capture all sagas wrt space redistribution Space redistribution algorithm: - Have added algorithm for redistributing space, have noted down details about it [here](https://www.notion.so/appsmith/Space-distribution-and-responsiveness-questions-517d140e83864c2287765c99dcd7c8da?pvs=4#9b33c84bcea24cfca63d7caef036f896). > #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced widget resizing capabilities with space distribution handles in Anvil layout system. - Introduced preview mode support for widget size configuration. - **Enhancements** - Improved Anvil layout system with dynamic space distribution during resizing. - Added flexibility to widget size configuration by considering preview mode. - **Bug Fixes** - Corrected widget border styles to reflect space distribution and resizing states. - **Refactor** - Streamlined space distribution logic in Anvil layout sagas and selectors. - Updated `AnvilFlexComponent` to conditionally assign `flexGrow` property. - **Documentation** - Updated comments to clarify new space distribution behavior in Anvil layout. - **Style** - Adjusted styles for space distribution handles in section layouts. - **Chores** - Added new action types for Anvil space distribution process. - Enhanced Redux state structure for drag and resize operations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Preet <preetsidhu.bits@gmail.com>
2023-12-27 10:35:41 +00:00
import { getAnvilSpaceDistributionStatus } from "layoutSystems/anvil/integrations/selectors";
chore: Block Selections when Canvas is in Side by Side mode (#31587) ## Description This pull request aims to enhance the user experience within the application by modifying the canvas behavior when it is displayed in "Side by Side" mode alongside Queries or JavaScript sections. The key change is the disabling of direct selections on the canvas, allowing interactions with canvas elements only through cmd + click or by clicking on the widget's name. This adjustment is intended to facilitate a view-only mode for the canvas during Queries or JS editing, thereby improving layout and user interaction. Additionally, the PR introduces enhancements to the application's testing framework, focusing on improving test reliability in scenarios involving UI interaction and state changes. Notable updates include: - Improved error tooltip handling in CurrencyInput_spec.js. - Ensured page state saving before verifying element presence in Listv2_BasicChildWidgetInteraction_spec.js. - Replaced cy.wait("@updateLayout") with cy.assertPageSave() and introduced a delay in Listv2_spec.js to accommodate functionality changes. - Implemented visibility checks in TableV2_Button_Icon_validation_spec.js to prevent timing-related test failures. These technical updates collectively aim to bolster the application's testing framework, enhancing the reliability and accuracy of automated tests, especially in UI interaction and state change scenarios. #### PR fixes following issue(s) Fixes #30864 ## Automation /ok-to-test tags="@tag.Widget" <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8259916944> > Commit: `15e1cf937a9d15adaea68e16a55006d993a07cbf` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8259916944&attempt=1" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for widget selection and focus management. - Introduced a new event type for tracking widget selections in code mode. - **Tests** - Enhanced test assertions and interactions for better reliability and error handling in various widgets. - **Refactor** - Improved widget selection logic and URL handling for a more intuitive user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-13 06:23:49 +00:00
const DraggableWrapper = styled.div<{ draggable: boolean }>`
display: block;
flex-direction: column;
width: 100%;
height: 100%;
user-select: none;
chore: Block Selections when Canvas is in Side by Side mode (#31587) ## Description This pull request aims to enhance the user experience within the application by modifying the canvas behavior when it is displayed in "Side by Side" mode alongside Queries or JavaScript sections. The key change is the disabling of direct selections on the canvas, allowing interactions with canvas elements only through cmd + click or by clicking on the widget's name. This adjustment is intended to facilitate a view-only mode for the canvas during Queries or JS editing, thereby improving layout and user interaction. Additionally, the PR introduces enhancements to the application's testing framework, focusing on improving test reliability in scenarios involving UI interaction and state changes. Notable updates include: - Improved error tooltip handling in CurrencyInput_spec.js. - Ensured page state saving before verifying element presence in Listv2_BasicChildWidgetInteraction_spec.js. - Replaced cy.wait("@updateLayout") with cy.assertPageSave() and introduced a delay in Listv2_spec.js to accommodate functionality changes. - Implemented visibility checks in TableV2_Button_Icon_validation_spec.js to prevent timing-related test failures. These technical updates collectively aim to bolster the application's testing framework, enhancing the reliability and accuracy of automated tests, especially in UI interaction and state change scenarios. #### PR fixes following issue(s) Fixes #30864 ## Automation /ok-to-test tags="@tag.Widget" <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8259916944> > Commit: `15e1cf937a9d15adaea68e16a55006d993a07cbf` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8259916944&attempt=1" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for widget selection and focus management. - Introduced a new event type for tracking widget selections in code mode. - **Tests** - Enhanced test assertions and interactions for better reliability and error handling in various widgets. - **Refactor** - Improved widget selection logic and URL handling for a more intuitive user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-13 06:23:49 +00:00
cursor: ${(props) => (props.draggable ? "grab" : "unset")};
`;
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
export interface DraggableComponentProps {
chore: BaseWidget Restructuring (#26562) ## Description Create a Basewidget wrapper that supplies Widget Onion as per the layout system. involves extracting widget layers presently in the BaseWidget into HOCs and hooks and make sure layout systems can be scaled. Make sure Modal widget is handled as a overlay widget whose wrappers are supplied by basewidget instead of modal widget implementing its own editing blocks. This PR also separates the drag n drop logic for both auto layout and fixed layout. They are moved into respective Layout system folders to have clear sepsration of concern #### PR fixes following issue(s) Fixes #26674 Fixes #26675 Fixes #26676 Fixes #26570 Fixes #26590 Fixes #26591 Fixes #26592 <img width="931" alt="BaseWidgetHOC" src="https://github.com/appsmithorg/appsmith/assets/35134347/22f4cf1e-e4c5-4475-83a8-6818e7cebe70"> [Miro Link to view the new system](https://miro.com/app/board/uXjVM6vRgf8=/?moveToWidget=3458764560239189204&cot=14) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Aswath K <aswath.sana@gmail.com>
2023-09-11 15:55:11 +00:00
widgetId: string;
parentId?: string;
isFlexChild?: boolean;
resizeDisabled?: boolean;
type: string;
children: ReactNode;
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
generateDragState: (
chore: Block Selections when Canvas is in Side by Side mode (#31587) ## Description This pull request aims to enhance the user experience within the application by modifying the canvas behavior when it is displayed in "Side by Side" mode alongside Queries or JavaScript sections. The key change is the disabling of direct selections on the canvas, allowing interactions with canvas elements only through cmd + click or by clicking on the widget's name. This adjustment is intended to facilitate a view-only mode for the canvas during Queries or JS editing, thereby improving layout and user interaction. Additionally, the PR introduces enhancements to the application's testing framework, focusing on improving test reliability in scenarios involving UI interaction and state changes. Notable updates include: - Improved error tooltip handling in CurrencyInput_spec.js. - Ensured page state saving before verifying element presence in Listv2_BasicChildWidgetInteraction_spec.js. - Replaced cy.wait("@updateLayout") with cy.assertPageSave() and introduced a delay in Listv2_spec.js to accommodate functionality changes. - Implemented visibility checks in TableV2_Button_Icon_validation_spec.js to prevent timing-related test failures. These technical updates collectively aim to bolster the application's testing framework, enhancing the reliability and accuracy of automated tests, especially in UI interaction and state change scenarios. #### PR fixes following issue(s) Fixes #30864 ## Automation /ok-to-test tags="@tag.Widget" <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8259916944> > Commit: `15e1cf937a9d15adaea68e16a55006d993a07cbf` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8259916944&attempt=1" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for widget selection and focus management. - Introduced a new event type for tracking widget selections in code mode. - **Tests** - Enhanced test assertions and interactions for better reliability and error handling in various widgets. - **Refactor** - Improved widget selection logic and URL handling for a more intuitive user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-13 06:23:49 +00:00
e: React.DragEvent,
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
draggableRef: HTMLElement,
) => SetDraggingStateActionPayload;
dragDisabled: boolean;
}
// Widget Boundaries which is shown to indicate the boundaries of the widget
const WidgetBoundaries = styled.div`
2020-01-16 11:46:21 +00:00
z-index: 0;
width: calc(100% + ${WIDGET_PADDING - 2}px);
height: calc(100% + ${WIDGET_PADDING - 2}px);
position: absolute;
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;
top: 0;
left: 0;
`;
function DraggableComponent(props: DraggableComponentProps) {
// Dispatch hook handy to set a widget as focused/selected
const { focusWidget, selectWidget } = useWidgetSelection();
chore: code changes for widget position observer and widget name on canvas (#27367) ## Description The PR contains non integrated code changes for below new features, The changes are not integrated to work but only contains the ground work code changes that can be added to css based layout/ Anvil once that is available in Release. - **Widget Position observer-** Since we are moving to css based layout, the positions of widgets will be unknown. To solve the issue we have introduced the above feature that stores/updates position of widgets on Redux state whenever a widget position updates. without manually triggering any action - **Widget Name on Canvas-** For the New Layout the existing widget name is inconsistent as it would cut off or visually not visible. to solve that the widget name will now be drawn on html canvas than it being a dom node component #### PR fixes following issue(s) Fixes #26945 Fixes #26948 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Abhinav Jha <abhinav@appsmith.com>
2023-10-06 10:07:43 +00:00
const shouldAllowDrag = useSelector(getShouldAllowDrag);
// Dispatch hook handy to set any `DraggableComponent` as dragging/ not dragging
// The value is boolean
const { setDraggingState } = useWidgetDragResize();
const showTableFilterPane = useShowTableFilterPane();
const isSelected = useSelector(isWidgetSelected(props.widgetId));
// This state tels us which widget is focused
// The value is the widgetId of the focused widget.
const isFocused = useSelector(isCurrentWidgetFocused(props.widgetId));
2020-01-20 09:00:37 +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,
);
feat: Anvil section space redistribution (#29632) ## Description Anvil Section Space distribution In this pr, we are adding a feature to sections to redistribute a sections space within its zones. you can find details of it over [here](https://www.notion.so/Sections-and-Zones-design-WIP-cbcb8b0ab2514aaf90d04aa3309ad56c) As part of it we have three parts of changes - UI components - Middleware(Redux and Sagas) - Space redistribution algorithm UI/UX: https://github.com/appsmithorg/appsmith/assets/35134347/092ba31f-d2e5-400e-80d7-45878d75ff98 Middleware changes: - have added a new state in WidgetDragResizeState `anvil` and into it have added `isDistributingSpace` to capture when space distribution is active. - added `anvilSpaceDistributionSagas` to capture all sagas wrt space redistribution Space redistribution algorithm: - Have added algorithm for redistributing space, have noted down details about it [here](https://www.notion.so/appsmith/Space-distribution-and-responsiveness-questions-517d140e83864c2287765c99dcd7c8da?pvs=4#9b33c84bcea24cfca63d7caef036f896). > #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced widget resizing capabilities with space distribution handles in Anvil layout system. - Introduced preview mode support for widget size configuration. - **Enhancements** - Improved Anvil layout system with dynamic space distribution during resizing. - Added flexibility to widget size configuration by considering preview mode. - **Bug Fixes** - Corrected widget border styles to reflect space distribution and resizing states. - **Refactor** - Streamlined space distribution logic in Anvil layout sagas and selectors. - Updated `AnvilFlexComponent` to conditionally assign `flexGrow` property. - **Documentation** - Updated comments to clarify new space distribution behavior in Anvil layout. - **Style** - Adjusted styles for space distribution handles in section layouts. - **Chores** - Added new action types for Anvil space distribution process. - Enhanced Redux state structure for drag and resize operations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Preet <preetsidhu.bits@gmail.com>
2023-12-27 10:35:41 +00:00
// This state tells us whether space redistribution is in process
const isDistributingSpace = useSelector(getAnvilSpaceDistributionStatus);
// 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
fix:Only show boundaries when siblings are dragged (#20752) ## Description Today in Appsmith, when dragging a widget, all the widgets present in the canvas get boundary lines shown around them. For very large Apps, this can be a visually unappealing view. ### Solution To reduce this visual noise, we show boundary lines only when sibling widgets are dragged. Fixes #20755 Media #### Before <img width="503" alt="Screenshot 2023-02-17 at 15 02 10" src="https://user-images.githubusercontent.com/46670083/219676811-787256ae-178b-4e08-9b26-0c100be16b75.png"> #### After <img width="503" alt="Screenshot 2023-02-17 at 15 02 25" src="https://user-images.githubusercontent.com/46670083/219676851-1e39b27e-cb46-4d06-9cdb-397fa115e674.png"> ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - Jest - Cypress ### 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 - [ ] 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 - [ ] 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: Aishwarya UR <aishwarya@appsmith.com>
2023-02-24 13:21:56 +00:00
const isDraggingSibling = useSelector(
(state) =>
state.ui.widgetDragResize?.dragDetails?.draggedOn === props.parentId,
);
feat: branch protection (#28526) ## Description - Adds server endpoints for getting and setting protected branches - Adds protected canvas view for branch protection - Adds default branch and protected branch in git modal settings #### PR fixes following issue(s) Fixes #28434, #28056 #### Media Protected View - <img width="1728" alt="image" src="https://github.com/appsmithorg/appsmith/assets/8724051/4fb26450-61e1-4fc0-a66d-0ebaa28ff90c"> Branch Protection Settings - <img width="1728" alt="image" src="https://github.com/appsmithorg/appsmith/assets/8724051/fb6d16b6-0a3c-42fd-be1a-9b3677048663"> #### Type of change - New feature (non-breaking change which adds functionality) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Nayan <nayan@appsmith.com>
2023-11-03 17:13:36 +00:00
const isPreviewMode = useSelector(combinedPreviewModeSelector);
// True when any widget is dragging or resizing, including this one
2020-03-04 08:10:40 +00:00
const isResizingOrDragging = !!isResizing || !!isDragging;
const isCurrentWidgetDragging = isDragging && isSelected;
const isCurrentWidgetResizing = isResizing && isSelected;
const showBoundary =
!props.isFlexChild && (isCurrentWidgetDragging || isDraggingSibling);
// When mouse is over this draggable
chore: Block Selections when Canvas is in Side by Side mode (#31587) ## Description This pull request aims to enhance the user experience within the application by modifying the canvas behavior when it is displayed in "Side by Side" mode alongside Queries or JavaScript sections. The key change is the disabling of direct selections on the canvas, allowing interactions with canvas elements only through cmd + click or by clicking on the widget's name. This adjustment is intended to facilitate a view-only mode for the canvas during Queries or JS editing, thereby improving layout and user interaction. Additionally, the PR introduces enhancements to the application's testing framework, focusing on improving test reliability in scenarios involving UI interaction and state changes. Notable updates include: - Improved error tooltip handling in CurrencyInput_spec.js. - Ensured page state saving before verifying element presence in Listv2_BasicChildWidgetInteraction_spec.js. - Replaced cy.wait("@updateLayout") with cy.assertPageSave() and introduced a delay in Listv2_spec.js to accommodate functionality changes. - Implemented visibility checks in TableV2_Button_Icon_validation_spec.js to prevent timing-related test failures. These technical updates collectively aim to bolster the application's testing framework, enhancing the reliability and accuracy of automated tests, especially in UI interaction and state change scenarios. #### PR fixes following issue(s) Fixes #30864 ## Automation /ok-to-test tags="@tag.Widget" <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8259916944> > Commit: `15e1cf937a9d15adaea68e16a55006d993a07cbf` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8259916944&attempt=1" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for widget selection and focus management. - Introduced a new event type for tracking widget selections in code mode. - **Tests** - Enhanced test assertions and interactions for better reliability and error handling in various widgets. - **Refactor** - Improved widget selection logic and URL handling for a more intuitive user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-13 06:23:49 +00:00
const handleMouseOver = (e: React.MouseEvent) => {
focusWidget &&
!isResizingOrDragging &&
!isFocused &&
feat: Anvil section space redistribution (#29632) ## Description Anvil Section Space distribution In this pr, we are adding a feature to sections to redistribute a sections space within its zones. you can find details of it over [here](https://www.notion.so/Sections-and-Zones-design-WIP-cbcb8b0ab2514aaf90d04aa3309ad56c) As part of it we have three parts of changes - UI components - Middleware(Redux and Sagas) - Space redistribution algorithm UI/UX: https://github.com/appsmithorg/appsmith/assets/35134347/092ba31f-d2e5-400e-80d7-45878d75ff98 Middleware changes: - have added a new state in WidgetDragResizeState `anvil` and into it have added `isDistributingSpace` to capture when space distribution is active. - added `anvilSpaceDistributionSagas` to capture all sagas wrt space redistribution Space redistribution algorithm: - Have added algorithm for redistributing space, have noted down details about it [here](https://www.notion.so/appsmith/Space-distribution-and-responsiveness-questions-517d140e83864c2287765c99dcd7c8da?pvs=4#9b33c84bcea24cfca63d7caef036f896). > #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced widget resizing capabilities with space distribution handles in Anvil layout system. - Introduced preview mode support for widget size configuration. - **Enhancements** - Improved Anvil layout system with dynamic space distribution during resizing. - Added flexibility to widget size configuration by considering preview mode. - **Bug Fixes** - Corrected widget border styles to reflect space distribution and resizing states. - **Refactor** - Streamlined space distribution logic in Anvil layout sagas and selectors. - Updated `AnvilFlexComponent` to conditionally assign `flexGrow` property. - **Documentation** - Updated comments to clarify new space distribution behavior in Anvil layout. - **Style** - Adjusted styles for space distribution handles in section layouts. - **Chores** - Added new action types for Anvil space distribution process. - Enhanced Redux state structure for drag and resize operations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Preet <preetsidhu.bits@gmail.com>
2023-12-27 10:35:41 +00:00
!isDistributingSpace &&
!props.resizeDisabled &&
!isPreviewMode &&
chore: Block Selections when Canvas is in Side by Side mode (#31587) ## Description This pull request aims to enhance the user experience within the application by modifying the canvas behavior when it is displayed in "Side by Side" mode alongside Queries or JavaScript sections. The key change is the disabling of direct selections on the canvas, allowing interactions with canvas elements only through cmd + click or by clicking on the widget's name. This adjustment is intended to facilitate a view-only mode for the canvas during Queries or JS editing, thereby improving layout and user interaction. Additionally, the PR introduces enhancements to the application's testing framework, focusing on improving test reliability in scenarios involving UI interaction and state changes. Notable updates include: - Improved error tooltip handling in CurrencyInput_spec.js. - Ensured page state saving before verifying element presence in Listv2_BasicChildWidgetInteraction_spec.js. - Replaced cy.wait("@updateLayout") with cy.assertPageSave() and introduced a delay in Listv2_spec.js to accommodate functionality changes. - Implemented visibility checks in TableV2_Button_Icon_validation_spec.js to prevent timing-related test failures. These technical updates collectively aim to bolster the application's testing framework, enhancing the reliability and accuracy of automated tests, especially in UI interaction and state change scenarios. #### PR fixes following issue(s) Fixes #30864 ## Automation /ok-to-test tags="@tag.Widget" <!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8259916944> > Commit: `15e1cf937a9d15adaea68e16a55006d993a07cbf` > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8259916944&attempt=1" target="_blank">Click here!</a> > All cypress tests have passed 🎉🎉🎉 <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new constants for widget selection and focus management. - Introduced a new event type for tracking widget selections in code mode. - **Tests** - Enhanced test assertions and interactions for better reliability and error handling in various widgets. - **Refactor** - Improved widget selection logic and URL handling for a more intuitive user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-03-13 06:23:49 +00:00
focusWidget(props.widgetId, e.metaKey);
e.stopPropagation();
};
chore: BaseWidget Restructuring (#26562) ## Description Create a Basewidget wrapper that supplies Widget Onion as per the layout system. involves extracting widget layers presently in the BaseWidget into HOCs and hooks and make sure layout systems can be scaled. Make sure Modal widget is handled as a overlay widget whose wrappers are supplied by basewidget instead of modal widget implementing its own editing blocks. This PR also separates the drag n drop logic for both auto layout and fixed layout. They are moved into respective Layout system folders to have clear sepsration of concern #### PR fixes following issue(s) Fixes #26674 Fixes #26675 Fixes #26676 Fixes #26570 Fixes #26590 Fixes #26591 Fixes #26592 <img width="931" alt="BaseWidgetHOC" src="https://github.com/appsmithorg/appsmith/assets/35134347/22f4cf1e-e4c5-4475-83a8-6818e7cebe70"> [Miro Link to view the new system](https://miro.com/app/board/uXjVM6vRgf8=/?moveToWidget=3458764560239189204&cot=14) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Aswath K <aswath.sana@gmail.com>
2023-09-11 15:55:11 +00:00
const handleMouseLeave = () => {
// on leaving a widget, we reset the focused widget
focusWidget && focusWidget();
};
// Display this draggable based on the current drag state
const dragWrapperStyle: CSSProperties = {
display: !props.isFlexChild && isCurrentWidgetDragging ? "none" : "block",
};
const dragBoundariesStyle: React.CSSProperties = useMemo(() => {
return {
opacity: !isResizingOrDragging || isCurrentWidgetResizing ? 0 : 1,
};
}, [isResizingOrDragging, isCurrentWidgetResizing]);
const classNameForTesting = `t--draggable-${props.type
2020-02-27 03:56:30 +00:00
.split("_")
.join("")
.toLowerCase()}`;
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
const allowDrag = !props.dragDisabled && shouldAllowDrag;
const className = `${classNameForTesting}`;
const draggableRef = useRef<HTMLDivElement>(null);
chore: BaseWidget Restructuring (#26562) ## Description Create a Basewidget wrapper that supplies Widget Onion as per the layout system. involves extracting widget layers presently in the BaseWidget into HOCs and hooks and make sure layout systems can be scaled. Make sure Modal widget is handled as a overlay widget whose wrappers are supplied by basewidget instead of modal widget implementing its own editing blocks. This PR also separates the drag n drop logic for both auto layout and fixed layout. They are moved into respective Layout system folders to have clear sepsration of concern #### PR fixes following issue(s) Fixes #26674 Fixes #26675 Fixes #26676 Fixes #26570 Fixes #26590 Fixes #26591 Fixes #26592 <img width="931" alt="BaseWidgetHOC" src="https://github.com/appsmithorg/appsmith/assets/35134347/22f4cf1e-e4c5-4475-83a8-6818e7cebe70"> [Miro Link to view the new system](https://miro.com/app/board/uXjVM6vRgf8=/?moveToWidget=3458764560239189204&cot=14) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Aswath K <aswath.sana@gmail.com>
2023-09-11 15:55:11 +00:00
const onDragStart: DragEventHandler = (e) => {
e.preventDefault();
e.stopPropagation();
// 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)) {
if (!isFocused) return;
if (!isSelected) {
refactor: Widget Selection (#19643) ## Description This change is a refactor of widget selection logic. It consolidates all the business logic to make it easy to maintain. It also improves the performance a bit. It touched a lot of features as we heavily rely on this ``` Select one Select multiple with drag Select multiple with shift Select multiple with cmd/ctrl Selections should be on the same level of hierarchy Unselect all by clicking on the canvas Unselect all by pressing esc Select all with cmd + a Paste in main container Paste in another container Undo Redo Modal Selection Modal child selection Context switching cmd click snipping mode new widget suggestion onboarding ``` > Refactor widget selection logic Fixes #19570 ## Type of change - Refactor ## How Has This Been Tested? All existing tests should pass ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383570810 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383607820 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1385095478 [Bug bash issues](https://www.notion.so/appsmith/610aa302f3e146a7b090b7dc6bc63ef9?v=0d277a9b07bf4aac9d717bcaf138c33a) ## Checklist: ### Dev activity - [ ] 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 - [ ] 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
2023-01-28 02:17:06 +00:00
selectWidget(SelectionRequestType.One, [props.widgetId]);
}
showTableFilterPane();
chore: add highlight calculation logic for layouts. (#27980) ## Description 1. Add LayoutComponent functionality. 2. Create Basic LayoutComponents. 3. Create LayoutPresets needed for Container-like widgets. 4. Add highlight calculation logic for all basic Layout Components. 5. Create dragging sagas for Anvil. 6. Create DraggingArena associated functionality to handle DnD in Anvil. #### PR fixes following issue(s) Fixes #27004 #### Type of change > Please delete options that are not relevant. - New feature (non-breaking change which adds functionality) ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [x] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
2023-10-19 20:27:40 +00:00
const draggingState = props.generateDragState(e, draggableRef.current);
setDraggingState(draggingState);
}
};
return (
<DraggableWrapper
className={className}
data-testid={isSelected ? "t--selected" : ""}
draggable={allowDrag}
onDragStart={onDragStart}
onMouseLeave={handleMouseLeave}
onMouseOver={handleMouseOver}
ref={draggableRef}
style={dragWrapperStyle}
>
chore: BaseWidget Restructuring (#26562) ## Description Create a Basewidget wrapper that supplies Widget Onion as per the layout system. involves extracting widget layers presently in the BaseWidget into HOCs and hooks and make sure layout systems can be scaled. Make sure Modal widget is handled as a overlay widget whose wrappers are supplied by basewidget instead of modal widget implementing its own editing blocks. This PR also separates the drag n drop logic for both auto layout and fixed layout. They are moved into respective Layout system folders to have clear sepsration of concern #### PR fixes following issue(s) Fixes #26674 Fixes #26675 Fixes #26676 Fixes #26570 Fixes #26590 Fixes #26591 Fixes #26592 <img width="931" alt="BaseWidgetHOC" src="https://github.com/appsmithorg/appsmith/assets/35134347/22f4cf1e-e4c5-4475-83a8-6818e7cebe70"> [Miro Link to view the new system](https://miro.com/app/board/uXjVM6vRgf8=/?moveToWidget=3458764560239189204&cot=14) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### 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 - [ ] 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 - [ ] 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: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Aswath K <aswath.sana@gmail.com>
2023-09-11 15:55:11 +00:00
{props.children}
fix:Only show boundaries when siblings are dragged (#20752) ## Description Today in Appsmith, when dragging a widget, all the widgets present in the canvas get boundary lines shown around them. For very large Apps, this can be a visually unappealing view. ### Solution To reduce this visual noise, we show boundary lines only when sibling widgets are dragged. Fixes #20755 Media #### Before <img width="503" alt="Screenshot 2023-02-17 at 15 02 10" src="https://user-images.githubusercontent.com/46670083/219676811-787256ae-178b-4e08-9b26-0c100be16b75.png"> #### After <img width="503" alt="Screenshot 2023-02-17 at 15 02 25" src="https://user-images.githubusercontent.com/46670083/219676851-1e39b27e-cb46-4d06-9cdb-397fa115e674.png"> ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Provide instructions, so we can reproduce. > Please also list any relevant details for your test configuration. > Delete anything that is not important - Manual - Jest - Cypress ### 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 - [ ] 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 - [ ] 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: Aishwarya UR <aishwarya@appsmith.com>
2023-02-24 13:21:56 +00:00
{showBoundary && (
<WidgetBoundaries
className={`widget-boundary-${props.widgetId}`}
style={dragBoundariesStyle}
/>
)}
</DraggableWrapper>
);
}
export default DraggableComponent;