PromucFlow_constructor/app/client/cypress/fixtures/multiSelectDsl.json
Hetu Nandu aa9b19c995
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 07:47:06 +05:30

473 lines
16 KiB
JSON

{
"dsl": {
"widgetName": "MainContainer",
"backgroundColor": "none",
"rightColumn": 966,
"snapColumns": 64,
"detachFromLayout": true,
"widgetId": "0",
"topRow": 0,
"bottomRow": 5016,
"containerStyle": "none",
"snapRows": 125,
"parentRowSpace": 1,
"type": "CANVAS_WIDGET",
"canExtend": true,
"version": 59,
"minHeight": 360,
"parentColumnSpace": 1,
"dynamicBindingPathList": [],
"leftColumn": 0,
"children": [
{
"labelTextSize": "0.875rem",
"boxShadow": "none",
"backgroundColor": "#FFFFFF",
"widgetName": "Container3",
"rightColumn": 60,
"orientation": "VERTICAL",
"snapColumns": 16,
"widgetId": "jaftzrmtin",
"containerStyle": "card",
"topRow": 0,
"bottomRow": 80,
"parentRowSpace": 38,
"isVisible": true,
"type": "CONTAINER_WIDGET",
"version": 1,
"isLoading": false,
"parentColumnSpace": 75.25,
"dynamicBindingPathList": [],
"leftColumn": 0,
"borderRadius": "0px",
"parentId": "0",
"children": [
{
"boxShadow": "none",
"widgetName": "7hf8kkvvgv",
"topRow": 0,
"bottomRow": 790,
"parentRowSpace": 1,
"type": "CANVAS_WIDGET",
"canExtend": false,
"minHeight": 800,
"parentColumnSpace": 1,
"dynamicTriggerPathList": [],
"leftColumn": 0,
"dynamicBindingPathList": [],
"children": [
{
"labelTextSize": "0.875rem",
"boxShadow": "none",
"widgetName": "Text1",
"rightColumn": 10,
"dynamicPropertyPathList": [],
"widgetId": "4d8d2eh4xg",
"topRow": 0,
"bottomRow": 3,
"parentRowSpace": 38,
"isVisible": true,
"type": "TEXT_WIDGET",
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 71.75,
"overflow": "SCROLL",
"fontFamily": "System Default",
"dynamicBindingPathList": [],
"leftColumn": 1,
"borderRadius": "0px",
"text": "Test text",
"textStyle": "HEADING"
},
{
"labelTextSize": "0.875rem",
"isRequired": false,
"boxShadow": "none",
"widgetName": "Input1",
"rightColumn": 20,
"widgetId": "i9cuq42zmc",
"accentColor": "{{appsmith.theme.colors.primaryColor}}",
"topRow": 4,
"bottomRow": 8,
"parentRowSpace": 38,
"isVisible": true,
"label": "",
"type": "INPUT_WIDGET_V2",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 71.75,
"resetOnSubmit": false,
"leftColumn": 0,
"dynamicBindingPathList": [
{
"key": "accentColor"
}
],
"borderRadius": "0px",
"inputType": "TEXT",
"isDisabled": false
},
{
"labelTextSize": "0.875rem",
"isRequired": false,
"boxShadow": "none",
"widgetName": "Dropdown1",
"rightColumn": 60,
"isFilterable": true,
"widgetId": "nl5sy9cuaa",
"accentColor": "{{appsmith.theme.colors.primaryColor}}",
"topRow": 4,
"bottomRow": 8,
"parentRowSpace": 38,
"isVisible": true,
"label": "",
"type": "SELECT_WIDGET",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 71.75,
"leftColumn": 40,
"dynamicBindingPathList": [
{
"key": "accentColor"
}
],
"borderRadius": "0px",
"options": "",
"isDisabled": false
},
{
"labelTextSize": "0.875rem",
"boxShadow": "none",
"widgetName": "Button1",
"rightColumn": 12,
"isDefaultClickDisabled": true,
"buttonColor": "#03B365",
"widgetId": "gn6ug210ef",
"topRow": 16,
"bottomRow": 20,
"parentRowSpace": 38,
"isVisible": true,
"type": "BUTTON_WIDGET",
"version": 1,
"recaptchaType": "V3",
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 71.75,
"leftColumn": 4,
"dynamicBindingPathList": [],
"borderRadius": "0px",
"buttonVariant": "PRIMARY",
"text": "Submit",
"isDisabled": false
},
{
"boxShadow": "none",
"widgetName": "Checkbox1",
"topRow": 16,
"bottomRow": 20,
"parentRowSpace": 38,
"type": "CHECKBOX_WIDGET",
"alignWidget": "LEFT",
"parentColumnSpace": 71.75,
"leftColumn": 40,
"dynamicBindingPathList": [],
"labelPosition": "Right",
"isDisabled": false,
"labelTextSize": "0.875rem",
"isRequired": false,
"rightColumn": 52,
"widgetId": "szjhneuog5",
"accentColor": "#03B365",
"isVisible": true,
"label": "Label",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"borderRadius": "0px",
"defaultCheckedState": true
},
{
"labelTextSize": "0.875rem",
"boxShadow": "none",
"widgetName": "Switch1",
"rightColumn": 52,
"widgetId": "szjhneuog9",
"accentColor": "#03B365",
"topRow": 73,
"bottomRow": 77,
"parentRowSpace": 38,
"isVisible": true,
"label": "Switch",
"type": "SWITCH_WIDGET",
"defaultSwitchState": true,
"version": 1,
"parentId": "e3tq9qwta6",
"alignWidget": "LEFT",
"isLoading": false,
"parentColumnSpace": 71.75,
"leftColumn": 40,
"dynamicBindingPathList": [],
"borderRadius": "0px",
"labelPosition": "Right",
"isDisabled": false
},
{
"labelTextSize": "0.875rem",
"isRequired": false,
"boxShadow": "none",
"widgetName": "RadioGroup1",
"rightColumn": 12,
"widgetId": "nb2usgp3hv",
"topRow": 28,
"bottomRow": 36,
"parentRowSpace": 38,
"isVisible": true,
"label": "",
"type": "RADIO_GROUP_WIDGET",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"defaultOptionValue": "1",
"parentColumnSpace": 71.75,
"leftColumn": 0,
"dynamicBindingPathList": [],
"borderRadius": "0px",
"options": [
{
"label": "Male",
"value": "M"
},
{
"label": "Female",
"value": "F"
}
],
"isDisabled": false,
"alignment": "left"
},
{
"boxShadow": "none",
"widgetName": "DatePicker1",
"dateFormat": "DD/MM/YYYY",
"topRow": 28,
"bottomRow": 32,
"parentRowSpace": 38,
"type": "DATE_PICKER_WIDGET",
"parentColumnSpace": 71.75,
"dynamicTriggerPathList": [
{
"key": "onDateSelected"
}
],
"leftColumn": 40,
"dynamicBindingPathList": [],
"isDisabled": false,
"onDateSelected": "{{showModal()}}",
"labelTextSize": "0.875rem",
"defaultDate": "2020-06-03T12:05:44.699+05:30",
"rightColumn": 60,
"widgetId": "kyrvcdcm4e",
"isVisible": true,
"datePickerType": "DATE_PICKER",
"label": "",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"borderRadius": "0px"
},
{
"labelTextSize": "0.875rem",
"isRequired": false,
"boxShadow": "none",
"widgetName": "FilePicker1",
"rightColumn": 56,
"isDefaultClickDisabled": true,
"widgetId": "ca22py6vlv",
"topRow": 44,
"bottomRow": 48,
"parentRowSpace": 38,
"isVisible": true,
"label": "Select Files",
"allowedFileTypes": [],
"type": "FILE_PICKER_WIDGET",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 67.1171875,
"leftColumn": 40,
"dynamicBindingPathList": [],
"borderRadius": "0px",
"files": [],
"isDisabled": false
},
{
"labelTextSize": "0.875rem",
"boxShadow": "none",
"widgetName": "RichTextEditor1",
"rightColumn": 32,
"isDefaultClickDisabled": true,
"widgetId": "2uvezzlkn5",
"topRow": 44,
"bottomRow": 64,
"parentRowSpace": 38,
"isVisible": true,
"type": "RICH_TEXT_EDITOR_WIDGET",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"parentColumnSpace": 67.1171875,
"leftColumn": 0,
"dynamicBindingPathList": [],
"borderRadius": "0px",
"defaultText": "",
"inputType": "html",
"isDisabled": false
},
{
"boxShadow": "none",
"widgetName": "MultiSelect2",
"topRow": 49,
"bottomRow": 60,
"parentRowSpace": 10,
"type": "MULTI_SELECT_WIDGET_V2",
"defaultOptionValue": "",
"parentColumnSpace": 13.662109375,
"dynamicTriggerPathList": [],
"leftColumn": 37,
"dynamicBindingPathList": [
{
"key": "accentColor"
}
],
"options": "",
"placeholderText": "",
"isDisabled": false,
"labelTextSize": "0.875rem",
"isRequired": false,
"rightColumn": 62,
"widgetId": "p6qkmj8uo1",
"accentColor": "{{appsmith.theme.colors.primaryColor}}",
"isVisible": true,
"label": "",
"version": 1,
"parentId": "e3tq9qwta6",
"isLoading": false,
"borderRadius": "0px"
},
{
"boxShadow": "none",
"widgetName": "Button2",
"onClick": "{{resetWidget('MultiSelect2')}}",
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
"dynamicPropertyPathList": [
{
"key": "onClick"
}
],
"displayName": "Button",
"iconSVG": "/static/media/icon.cca02633.svg",
"topRow": 68,
"bottomRow": 72,
"parentRowSpace": 10,
"type": "BUTTON_WIDGET",
"hideCard": false,
"animateLoading": true,
"parentColumnSpace": 18.49609375,
"dynamicTriggerPathList": [
{
"key": "onClick"
}
],
"leftColumn": 41,
"dynamicBindingPathList": [
{
"key": "buttonColor"
},
{
"key": "borderRadius"
}
],
"text": "Reset MultiSelect",
"isDisabled": false,
"key": "sv7prcomh7",
"isDeprecated": false,
"rightColumn": 58,
"isDefaultClickDisabled": true,
"widgetId": "tzstqq5xjt",
"isVisible": true,
"recaptchaType": "V3",
"version": 1,
"parentId": "e3tq9qwta6",
"renderMode": "CANVAS",
"isLoading": false,
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"buttonVariant": "PRIMARY",
"placement": "CENTER"
},
{
"widgetName": "Text2",
"displayName": "Text",
"iconSVG": "/static/media/icon.97c59b52.svg",
"topRow": 60,
"bottomRow": 68,
"parentRowSpace": 10,
"type": "TEXT_WIDGET",
"hideCard": false,
"animateLoading": true,
"overflow": "NONE",
"fontFamily": "{{appsmith.theme.fontFamily.appFont}}",
"parentColumnSpace": 18.49609375,
"dynamicTriggerPathList": [],
"leftColumn": 37,
"dynamicBindingPathList": [
{
"key": "fontFamily"
},
{
"key": "borderRadius"
},
{
"key": "text"
}
],
"shouldTruncate": false,
"truncateButtonColor": "#FFC13D",
"text": "{{MultiSelect2.selectedOptionValues.toString()}}",
"key": "a4y7w4uxvg",
"isDeprecated": false,
"rightColumn": 62,
"textAlign": "LEFT",
"widgetId": "6mabocqffh",
"isVisible": true,
"fontStyle": "BOLD",
"textColor": "#231F20",
"version": 1,
"parentId": "e3tq9qwta6",
"renderMode": "CANVAS",
"isLoading": false,
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
"fontSize": "1rem"
}
],
"labelTextSize": "0.875rem",
"backgroundColor": "transparent",
"rightColumn": 4816,
"orientation": "VERTICAL",
"snapColumns": 16,
"detachFromLayout": true,
"widgetId": "e3tq9qwta6",
"containerStyle": "none",
"isVisible": true,
"version": 1,
"isLoading": false,
"borderRadius": "0px",
"parentId": "jaftzrmtin"
}
]
}
]
}
}