## Description <ins>Problem</ins> `currentRow` variable which is availabe in property pane of col settings - is not getting correct value during runtime if the table is sorted or filtered. <ins>Root cause</ins> * We are considering `processedTableData` to get the `currentRow`. * This property is not updated during filtering and sorting, another property `filteredTableData` is updated instead. * We CANNOT use `filteredTableData` as it depends on `primaryColumns` property which we intend to update as well - this is leading to cyclic dependency during evaluations. <ins>Solution</ins> Since the problem is related to edit cases and given the constraints around using `filteredTableData` directly, we fixed the problem by adding a new property to `editableCellValue` object called `__originalIndex__`. * This property stores the index of the row being edited in `processedTableData` * On top of this change, the PR adds a migration for updating the current row binding in TableWidgetV2, ensuring accurate current row calculation and improving the functionality of the widget. * We also added unit test for migration changes. * Additionally, This pull request refactors the DSLs for TableWidgetV2 migration test cases to update the DSLs to separate folder, drastically reducing the file size to its core logic, improving the readability of the code. * We also updated relevant test cases to account for this change. [Testing plan](https://www.notion.so/appsmith/Issue-34346-currentRow-doesn-t-work-correctly-when-the-table-is-filtered-449225ae822c485493036599c2b19487) [Counter part EE pr](https://github.com/appsmithorg/appsmith-ee/pull/4879) Fixes #34346 _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10451549845> > Commit: d1d65c6898c223bf3f6dfbfe93b8e8de214fcc7d > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10451549845&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Mon, 19 Aug 2024 11:15:04 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [x] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Updated DSL migration process to support version 90, enhancing compatibility and robustness. - Introduced new migration logic for table widget data bindings, improving inline editing capabilities. - Enhanced validation logic for editable cells in table widgets, allowing for more dynamic data handling. - Added a method to discard edits in specific table cells, improving user interaction. - Introduced a new message constant for required fields, enhancing user feedback. - **Bug Fixes** - Improved validation checks for table cells based on updated indices and values. - **Tests** - Added comprehensive tests to validate migration functions related to Table Widget, ensuring all aspects function correctly post-update. - Enhanced test specifications for improved validation logic and coverage in table widget functionalities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: sneha122 <sneha@appsmith.com>
316 lines
14 KiB
JSON
316 lines
14 KiB
JSON
{
|
|
"dsl": {
|
|
"widgetName": "MainContainer",
|
|
"backgroundColor": "none",
|
|
"rightColumn": 4896,
|
|
"snapColumns": 64,
|
|
"detachFromLayout": true,
|
|
"widgetId": "0",
|
|
"topRow": 0,
|
|
"bottomRow": 1130,
|
|
"containerStyle": "none",
|
|
"snapRows": 125,
|
|
"parentRowSpace": 1,
|
|
"type": "CANVAS_WIDGET",
|
|
"canExtend": true,
|
|
"version": 60,
|
|
"minHeight": 1292,
|
|
"dynamicTriggerPathList": [],
|
|
"parentColumnSpace": 1,
|
|
"dynamicBindingPathList": [],
|
|
"leftColumn": 0,
|
|
"children": [
|
|
{
|
|
"boxShadow": "{{appsmith.theme.boxShadow.appBoxShadow}}",
|
|
"isVisibleDownload": true,
|
|
"iconSVG": "/static/media/icon.db8a9cbd2acd22a31ea91cc37ea2a46c.svg",
|
|
"topRow": 83,
|
|
"isSortable": true,
|
|
"type": "TABLE_WIDGET_V2",
|
|
"inlineEditingSaveOption": "ROW_LEVEL",
|
|
"animateLoading": true,
|
|
"dynamicBindingPathList": [
|
|
{
|
|
"key": "accentColor"
|
|
},
|
|
{
|
|
"key": "borderRadius"
|
|
},
|
|
{
|
|
"key": "boxShadow"
|
|
},
|
|
{
|
|
"key": "childStylesheet.button.buttonColor"
|
|
},
|
|
{
|
|
"key": "childStylesheet.button.borderRadius"
|
|
},
|
|
{
|
|
"key": "childStylesheet.menuButton.menuColor"
|
|
},
|
|
{
|
|
"key": "childStylesheet.menuButton.borderRadius"
|
|
},
|
|
{
|
|
"key": "childStylesheet.iconButton.buttonColor"
|
|
},
|
|
{
|
|
"key": "childStylesheet.iconButton.borderRadius"
|
|
},
|
|
{
|
|
"key": "childStylesheet.editActions.saveButtonColor"
|
|
},
|
|
{
|
|
"key": "childStylesheet.editActions.saveBorderRadius"
|
|
},
|
|
{
|
|
"key": "childStylesheet.editActions.discardButtonColor"
|
|
},
|
|
{
|
|
"key": "childStylesheet.editActions.discardBorderRadius"
|
|
},
|
|
{
|
|
"key": "tableData"
|
|
},
|
|
{
|
|
"key": "primaryColumns.id.computedValue"
|
|
},
|
|
{
|
|
"key": "primaryColumns.email.computedValue"
|
|
},
|
|
{
|
|
"key": "primaryColumns.userName.computedValue"
|
|
},
|
|
{
|
|
"key": "primaryColumns.productName.computedValue"
|
|
},
|
|
{
|
|
"key": "primaryColumns.orderAmount.computedValue"
|
|
}
|
|
],
|
|
"leftColumn": 1,
|
|
"delimiter": ",",
|
|
"defaultSelectedRowIndex": 0,
|
|
"accentColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"isVisibleFilters": true,
|
|
"isVisible": true,
|
|
"enableClientSideSearch": true,
|
|
"version": 1,
|
|
"totalRecordsCount": 0,
|
|
"isLoading": false,
|
|
"childStylesheet": {
|
|
"button": {
|
|
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
|
"boxShadow": "none"
|
|
},
|
|
"menuButton": {
|
|
"menuColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
|
"boxShadow": "none"
|
|
},
|
|
"iconButton": {
|
|
"buttonColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
|
"boxShadow": "none"
|
|
},
|
|
"editActions": {
|
|
"saveButtonColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"saveBorderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
|
"discardButtonColor": "{{appsmith.theme.colors.primaryColor}}",
|
|
"discardBorderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}"
|
|
}
|
|
},
|
|
"borderRadius": "{{appsmith.theme.borderRadius.appBorderRadius}}",
|
|
"defaultSelectedRowIndices": [0],
|
|
"widgetName": "Table1",
|
|
"defaultPageSize": 0,
|
|
"columnOrder": [
|
|
"id",
|
|
"email",
|
|
"userName",
|
|
"productName",
|
|
"orderAmount"
|
|
],
|
|
"dynamicPropertyPathList": [{ "key": "tableData" }],
|
|
"displayName": "Table",
|
|
"bottomRow": 132,
|
|
"columnWidthMap": {
|
|
"task": 245,
|
|
"step": 62,
|
|
"status": 75
|
|
},
|
|
"parentRowSpace": 10,
|
|
"hideCard": false,
|
|
"parentColumnSpace": 9.96875,
|
|
"dynamicTriggerPathList": [],
|
|
"primaryColumns": {
|
|
"id": {
|
|
"allowCellWrapping": false,
|
|
"index": 0,
|
|
"width": 150,
|
|
"originalId": "id",
|
|
"id": "id",
|
|
"alias": "id",
|
|
"horizontalAlignment": "LEFT",
|
|
"verticalAlignment": "CENTER",
|
|
"columnType": "text",
|
|
"textSize": "0.875rem",
|
|
"enableFilter": true,
|
|
"enableSort": true,
|
|
"isVisible": true,
|
|
"isDisabled": false,
|
|
"isCellEditable": false,
|
|
"isEditable": false,
|
|
"isCellVisible": true,
|
|
"isDerived": false,
|
|
"label": "id",
|
|
"isSaveVisible": true,
|
|
"isDiscardVisible": true,
|
|
"computedValue": "{{Table1.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"id\"]))}}"
|
|
},
|
|
"email": {
|
|
"allowCellWrapping": false,
|
|
"index": 1,
|
|
"width": 150,
|
|
"originalId": "email",
|
|
"id": "email",
|
|
"alias": "email",
|
|
"horizontalAlignment": "LEFT",
|
|
"verticalAlignment": "CENTER",
|
|
"columnType": "text",
|
|
"textSize": "0.875rem",
|
|
"enableFilter": true,
|
|
"enableSort": true,
|
|
"isVisible": true,
|
|
"isDisabled": false,
|
|
"isCellEditable": false,
|
|
"isEditable": false,
|
|
"isCellVisible": true,
|
|
"isDerived": false,
|
|
"label": "email",
|
|
"isSaveVisible": true,
|
|
"isDiscardVisible": true,
|
|
"computedValue": "{{Table1.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"email\"]))}}"
|
|
},
|
|
"userName": {
|
|
"allowCellWrapping": false,
|
|
"index": 2,
|
|
"width": 150,
|
|
"originalId": "userName",
|
|
"id": "userName",
|
|
"alias": "userName",
|
|
"horizontalAlignment": "LEFT",
|
|
"verticalAlignment": "CENTER",
|
|
"columnType": "text",
|
|
"textSize": "0.875rem",
|
|
"enableFilter": true,
|
|
"enableSort": true,
|
|
"isVisible": true,
|
|
"isDisabled": false,
|
|
"isCellEditable": false,
|
|
"isEditable": false,
|
|
"isCellVisible": true,
|
|
"isDerived": false,
|
|
"label": "userName",
|
|
"isSaveVisible": true,
|
|
"isDiscardVisible": true,
|
|
"computedValue": "{{Table1.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"userName\"]))}}"
|
|
},
|
|
"productName": {
|
|
"allowCellWrapping": false,
|
|
"index": 3,
|
|
"width": 150,
|
|
"originalId": "productName",
|
|
"id": "productName",
|
|
"alias": "productName",
|
|
"horizontalAlignment": "LEFT",
|
|
"verticalAlignment": "CENTER",
|
|
"columnType": "text",
|
|
"textSize": "0.875rem",
|
|
"enableFilter": true,
|
|
"enableSort": true,
|
|
"isVisible": true,
|
|
"isDisabled": false,
|
|
"isCellEditable": false,
|
|
"isEditable": false,
|
|
"isCellVisible": true,
|
|
"isDerived": false,
|
|
"label": "productName",
|
|
"isSaveVisible": true,
|
|
"isDiscardVisible": true,
|
|
"computedValue": "{{Table1.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"productName\"]))}}"
|
|
},
|
|
"orderAmount": {
|
|
"allowCellWrapping": false,
|
|
"index": 4,
|
|
"width": 150,
|
|
"originalId": "orderAmount",
|
|
"id": "orderAmount",
|
|
"alias": "orderAmount",
|
|
"horizontalAlignment": "LEFT",
|
|
"verticalAlignment": "CENTER",
|
|
"columnType": "text",
|
|
"textSize": "0.875rem",
|
|
"enableFilter": true,
|
|
"enableSort": true,
|
|
"isVisible": true,
|
|
"isDisabled": false,
|
|
"isCellEditable": false,
|
|
"isEditable": false,
|
|
"isCellVisible": true,
|
|
"isDerived": false,
|
|
"label": "orderAmount",
|
|
"isSaveVisible": true,
|
|
"isDiscardVisible": true,
|
|
"computedValue": "{{Table1.processedTableData.map((currentRow, currentIndex) => ( currentRow[\"orderAmount\"]))}}"
|
|
}
|
|
},
|
|
"key": "rxs6wup9fz",
|
|
"isDeprecated": false,
|
|
"rightColumn": 50,
|
|
"textSize": "0.875rem",
|
|
"widgetId": "8o3mdylmxa",
|
|
"tableData": "{{[\n {\n \"id\": 1,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 2,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 3,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 4,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 5,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 6,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 7,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 8,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 9,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 10,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 11,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 12,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n }, {\n \"id\": 13,\n \"email\": \"michael.lawson@reqres.in\",\n \"userName\": \"Michael Lawson\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 14,\n \"email\": \"lindsay.ferguson@reqres.in\",\n \"userName\": \"Lindsay Ferguson\",\n \"productName\": \"Tuna Salad\",\n \"orderAmount\": 9.99\n },\n {\n \"id\": 15,\n \"email\": \"tobias.funke@reqres.in\",\n \"userName\": \"Tobias Funke\",\n \"productName\": \"Beef steak\",\n \"orderAmount\": 19.99\n },\n {\n \"id\": 16,\n \"email\": \"byron.fields@reqres.in\",\n \"userName\": \"Byron Fields\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 17,\n \"email\": \"ryan.holmes@reqres.in\",\n \"userName\": \"Ryan Holmes\",\n \"productName\": \"Avocado Panini\",\n \"orderAmount\": 7.99\n },\n {\n \"id\": 18,\n \"email\": \"byron.fields@reqres.in\",\n \"userName\": \"Byron Fields\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 19,\n \"email\": \"ryan.holmes@reqres.in\",\n \"userName\": \"Ryan Holmes\",\n \"productName\": \"Avocado Panini\",\n \"orderAmount\": 7.99\n },\n {\n \"id\": 20,\n \"email\": \"byron.fields@reqres.in\",\n \"userName\": \"Byron Fields\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 21,\n \"email\": \"ryan.holmes@reqres.in\",\n \"userName\": \"Ryan Holmes\",\n \"productName\": \"Avocado Panini\",\n \"orderAmount\": 7.99\n },\n {\n \"id\": 22,\n \"email\": \"byron.fields@reqres.in\",\n \"userName\": \"Byron Fields\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 23,\n \"email\": \"ryan.holmes@reqres.in\",\n \"userName\": \"Ryan Holmes\",\n \"productName\": \"Avocado Panini\",\n \"orderAmount\": 7.99\n },\n {\n \"id\": 24,\n \"email\": \"byron.fields@reqres.in\",\n \"userName\": \"Byron Fields\",\n \"productName\": \"Chicken Sandwich\",\n \"orderAmount\": 4.99\n },\n {\n \"id\": 25,\n \"email\": \"ryan.holmes@reqres.in\",\n \"userName\": \"Ryan Holmes\",\n \"productName\": \"Avocado Panini\",\n \"orderAmount\": 7.99\n }\n]}}",
|
|
"label": "Data",
|
|
"searchKey": "",
|
|
"parentId": "0",
|
|
"renderMode": "CANVAS",
|
|
"horizontalAlignment": "LEFT",
|
|
"isVisibleSearch": true,
|
|
"isVisiblePagination": true,
|
|
"verticalAlignment": "CENTER"
|
|
},
|
|
{
|
|
"widgetName": "Text1",
|
|
"rightColumn": 60,
|
|
"textAlign": "LEFT",
|
|
"displayName": "Text",
|
|
"widgetId": "16zkg2v0na",
|
|
"topRow": 83,
|
|
"bottomRow": 87,
|
|
"parentRowSpace": 10,
|
|
"isVisible": true,
|
|
"type": "TEXT_WIDGET",
|
|
"fontStyle": "BOLD",
|
|
"textColor": "#231F20",
|
|
"version": 1,
|
|
"hideCard": false,
|
|
"parentId": "0",
|
|
"isLoading": false,
|
|
"parentColumnSpace": 17.28125,
|
|
"dynamicTriggerPathList": [],
|
|
"leftColumn": 51,
|
|
"dynamicBindingPathList": [
|
|
{
|
|
"key": "text"
|
|
}
|
|
],
|
|
"fontSize": "PARAGRAPH",
|
|
"text": "{{Table1.previousPageVisited}} {{Table1.nextPageVisited}}",
|
|
"key": "r76o6tqjaz"
|
|
}
|
|
]
|
|
}
|
|
}
|