From b5813f06b57566df0153bb56a9c85016726d9bdf Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 2 Jun 2023 13:12:38 +0530 Subject: [PATCH 01/17] feat: sticky add new row Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 07b213120b..5015e40fef 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -1004,14 +1004,14 @@ const deleteSelectedRangeOfRows = () => { - - -
+ + +
@@ -1019,6 +1019,8 @@ const deleteSelectedRangeOfRows = () => {
+ + From 0b5c61320a6aa3e055dd1789f3022fcd5f4a981d Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 2 Jun 2023 14:44:31 +0530 Subject: [PATCH 02/17] fix: update `left` value of display value to stick properly Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 5015e40fef..b672cc628c 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -1182,14 +1182,14 @@ const deleteSelectedRangeOfRows = () => { thead th:nth-child(2) { position: sticky !important; - left: 80px; + left: 85px; z-index: 5; @apply border-r-2 border-r-gray-300; } tbody td:nth-child(2) { position: sticky !important; - left: 80px; + left: 85px; z-index: 4; background: white; @apply border-r-2 border-r-gray-300; From 11319d0f5f4aa3bdbfda05b94018b8e96f0d343f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 2 Jun 2023 14:47:52 +0530 Subject: [PATCH 03/17] fix: remove classname Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index b672cc628c..32d77ac326 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -1020,7 +1020,7 @@ const deleteSelectedRangeOfRows = () => {
- + From f154cb43e89696b023e25324921f6ebbb91e89b3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 2 Jun 2023 14:54:23 +0530 Subject: [PATCH 04/17] fix: width and z-index correction Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 32d77ac326..e472436bb8 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -827,7 +827,7 @@ const deleteSelectedRangeOfRows = () => { > - +
- - -
+ + +
- - - {{ $t('activity.addRow') }} -
- - @@ -1082,8 +1076,18 @@ const deleteSelectedRangeOfRows = () => {
- +
+ +
+ + + {{ $t('activity.addRow') }} + +
+
+
+ import { ChangePageInj, PaginationDataInj, computed, iconMap, inject } from '#imports' +const props = defineProps<{ + alignCountOnRight?: boolean +}>() + const paginatedData = inject(PaginationDataInj)! const changePage = inject(ChangePageInj)! @@ -19,11 +23,15 @@ const page = computed({ From 9679a6691fa5b13311c6d2adfebe58f463af3b68 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 2 Jun 2023 22:18:35 +0530 Subject: [PATCH 06/17] feat: on adding new ow scroll to new cell and make first cell active Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 12 +++++++++++- packages/nc-gui/composables/useMultiSelect/index.ts | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index f29c9c74f6..3fdcc326a1 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -117,7 +117,7 @@ const { formattedData: data, updateOrSaveRow, changePage, - addEmptyRow, + addEmptyRow: _addEmptyRow, deleteRow, deleteSelectedRows, selectedAllRecords, @@ -200,6 +200,7 @@ const { isCellActive, tbodyEl, resetSelectedRange, + makeActive, selectedRange, } = useMultiSelect( meta, @@ -804,6 +805,14 @@ const deleteSelectedRangeOfRows = () => { activeCell.col = null }) } + +function addEmptyRow(row?: number) { + _addEmptyRow(row) + nextTick().then(() => { + makeActive(row ?? data.value.length - 1, 0) + scrollToCell?.() + }) +} - - + +
+ From eaf0573e017ee6ebff5e5f95b92d3411a6c2feac Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 6 Jun 2023 22:05:42 +0530 Subject: [PATCH 11/17] fix: typo correction Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 2c529d4618..f9009e03e6 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -1096,7 +1096,7 @@ function addEmptyRow(row?: number) {
-
+
From 4b5d8481e4734b4ec0bb575b071240531c71d60f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 6 Jun 2023 22:16:40 +0530 Subject: [PATCH 12/17] fix: show pointer only if editable Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index f9009e03e6..891c1da9da 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -972,8 +972,9 @@ function addEmptyRow(row?: number) { +
diff --git a/tests/playwright/pages/Dashboard/Grid/index.ts b/tests/playwright/pages/Dashboard/Grid/index.ts index 94b133b393..81acfcff65 100644 --- a/tests/playwright/pages/Dashboard/Grid/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/index.ts @@ -77,8 +77,9 @@ export class GridPage extends BasePage { if (index !== 0) await this.get().locator('.nc-grid-row').nth(0).waitFor({ state: 'attached' }); const rowCount = await this.get().locator('.nc-grid-row').count(); - await (await this.get().locator('.nc-grid-add-new-cell').elementHandle())?.waitForElementState('stable'); - await this.get().locator('.nc-grid-add-new-cell').click(); + const addNewRowButton: Locator = await this.rootPage.locator(`[data-testid="nc-grid-add-new-row"]`); + await addNewRowButton.waitFor({ state: 'visible' }); + await addNewRowButton.click(); await expect(await this.get().locator('.nc-grid-row')).toHaveCount(rowCount + 1); From 8ba0dc024d4a23b28f5f66153e0466bd6def5e60 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 7 Jun 2023 19:01:35 +0530 Subject: [PATCH 15/17] test: kludge, context menu fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/tests/db/tableColumnOperation.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/playwright/tests/db/tableColumnOperation.spec.ts b/tests/playwright/tests/db/tableColumnOperation.spec.ts index 39fdc99de5..387a16be3a 100644 --- a/tests/playwright/tests/db/tableColumnOperation.spec.ts +++ b/tests/playwright/tests/db/tableColumnOperation.spec.ts @@ -68,6 +68,9 @@ test.describe('Table Column Operations', () => { value: 'value_a', }); + // kludge: fix me! + await dashboard.rootPage.reload(); + // add new row using right-click menu await grid.addRowRightClickMenu(0); }); From 27da12bf52da7781e227774e523e636ef4ae4df0 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 8 Jun 2023 09:48:30 +0530 Subject: [PATCH 16/17] test: remove kludge Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/tests/db/tableColumnOperation.spec.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/playwright/tests/db/tableColumnOperation.spec.ts b/tests/playwright/tests/db/tableColumnOperation.spec.ts index 387a16be3a..39fdc99de5 100644 --- a/tests/playwright/tests/db/tableColumnOperation.spec.ts +++ b/tests/playwright/tests/db/tableColumnOperation.spec.ts @@ -68,9 +68,6 @@ test.describe('Table Column Operations', () => { value: 'value_a', }); - // kludge: fix me! - await dashboard.rootPage.reload(); - // add new row using right-click menu await grid.addRowRightClickMenu(0); }); From e053bb5190b033d4edb35a0718d3c414ae366431 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 8 Jun 2023 10:33:31 +0530 Subject: [PATCH 17/17] test: right click context fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- tests/playwright/pages/Dashboard/Grid/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/playwright/pages/Dashboard/Grid/index.ts b/tests/playwright/pages/Dashboard/Grid/index.ts index 81acfcff65..1f78a2fb02 100644 --- a/tests/playwright/pages/Dashboard/Grid/index.ts +++ b/tests/playwright/pages/Dashboard/Grid/index.ts @@ -169,6 +169,7 @@ export class GridPage extends BasePage { async addRowRightClickMenu(index: number) { const rowCount = await this.get().locator('.nc-grid-row').count(); + await this.get().locator(`td[data-testid="cell-Title-${index}"]`).click(); await this.get().locator(`td[data-testid="cell-Title-${index}"]`).click({ button: 'right', });