From 854dad6d14dce3392598856b7fbf2bae43b91686 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 19 Dec 2023 15:31:28 +0300 Subject: [PATCH 01/13] fix: clear fill handle properly on expanded form close Signed-off-by: mertmit --- packages/nc-gui/components/smartsheet/grid/Table.vue | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index e15bce4ee1..b1245ad5f0 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -1027,13 +1027,11 @@ eventBus.on(async (event, payload) => { addColumnDropdown.value = true } if (event === SmartsheetStoreEvents.CLEAR_NEW_ROW) { - const removed = removeRowIfNew?.(payload) + clearSelectedRange() + activeCell.row = null + activeCell.col = null - if (removed) { - clearSelectedRange() - activeCell.row = null - activeCell.col = null - } + removeRowIfNew?.(payload) } }) From 38ac18bab1316e7fe9ecab0ff0184df6915d9da3 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:18:03 +0530 Subject: [PATCH 02/13] fix: rich text first char issue Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- packages/nc-gui/components/cell/RichText.vue | 13 +++++++++++-- packages/nc-gui/composables/useMultiSelect/index.ts | 10 +++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index e2c6522d86..054f29ca31 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -108,7 +108,7 @@ const editor = useEditor({ editable: !props.readonly, }) -const setEditorContent = (contentMd: any) => { +const setEditorContent = (contentMd: any, focusEndOfDoc?: boolean) => { if (!editor.value) return const selection = editor.value.view.state.selection @@ -120,6 +120,15 @@ const setEditorContent = (contentMd: any) => { editor.value.chain().setContent(content).setTextSelection(selection.to).run() setTimeout(() => { + if (focusEndOfDoc) { + const docSize = editor.value!.state.doc.nodeSize + + editor.value + ?.chain() + .setTextSelection(docSize - 1) + .run() + } + ;(editor.value!.state as any).history$.prevRanges = null ;(editor.value!.state as any).history$.done.eventCount = 0 }, 100) @@ -134,7 +143,7 @@ if (props.syncValueChange) { watch(editorDom, () => { if (!editorDom.value) return - setEditorContent(vModel.value) + setEditorContent(vModel.value, true) // Focus editor after editor is mounted setTimeout(() => { diff --git a/packages/nc-gui/composables/useMultiSelect/index.ts b/packages/nc-gui/composables/useMultiSelect/index.ts index 35b3c0f20a..b6eeecffc0 100644 --- a/packages/nc-gui/composables/useMultiSelect/index.ts +++ b/packages/nc-gui/composables/useMultiSelect/index.ts @@ -718,7 +718,15 @@ export function useMultiSelect( return message.info(t('msg.info.updateNotAllowedWithoutPK')) } if (isTypableInputColumn(columnObj) && makeEditable(rowObj, columnObj) && columnObj.title) { - rowObj.row[columnObj.title] = '' + if (columnObj.uidt === UITypes.LongText) { + if (rowObj.row[columnObj.title] === '
') { + rowObj.row[columnObj.title] = e.key + } else { + rowObj.row[columnObj.title] = rowObj.row[columnObj.title] ? rowObj.row[columnObj.title] + e.key : e.key + } + } else { + rowObj.row[columnObj.title] = '' + } } // editEnabled = true } From 94fb9bc60ad8549b940611d79009f7613007e4a8 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:51 +0000 Subject: [PATCH 03/13] feat: add webhook v3 condition check --- packages/nocodb/src/helpers/webhookHelpers.ts | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 44118a8729..48261d83d6 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -303,7 +303,21 @@ export async function invokeWebhook( if (hook.condition && !testHook) { if (isBulkOperation) { const filteredData = []; - for (const data of newData) { + for (let i = 0; i < newData.length; i++) { + const data = newData[i]; + const prevData = prevData ? prevData[i] : null; + + if (hook.version === 'v3' && prevData) { + // if condition is satisfied for prevData then return + if ( + await validateCondition( + testFilters || (await hook.getFilters()), + prevData, + ) + ) { + continue; + } + } if ( await validateCondition( testFilters || (await hook.getFilters()), @@ -312,12 +326,23 @@ export async function invokeWebhook( ) { filteredData.push(data); } - if (!filteredData.length) { + } + if (!filteredData.length) { + return; + } + newData = filteredData; + } else { + if (hook.version === 'v3' && prevData) { + // if condition is satisfied for prevData then return + if ( + await validateCondition( + testFilters || (await hook.getFilters()), + prevData, + ) + ) { return; } - newData = filteredData; } - } else { if ( !(await validateCondition( testFilters || (await hook.getFilters()), From 9bd2d3fa0f6e7e74e400619ecf7bc8ac40e719dc Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:52 +0000 Subject: [PATCH 04/13] fix: condition correction --- packages/nocodb/src/helpers/webhookHelpers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 48261d83d6..ff97905f1a 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -307,7 +307,7 @@ export async function invokeWebhook( const data = newData[i]; const prevData = prevData ? prevData[i] : null; - if (hook.version === 'v3' && prevData) { + if (prevData) { // if condition is satisfied for prevData then return if ( await validateCondition( @@ -332,7 +332,7 @@ export async function invokeWebhook( } newData = filteredData; } else { - if (hook.version === 'v3' && prevData) { + if (prevData) { // if condition is satisfied for prevData then return if ( await validateCondition( From 69effe303397acfeae55af9cdac9f0e2facc8f56 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:52 +0000 Subject: [PATCH 05/13] refactor: avoid unnecessary nested if condition --- packages/nocodb/src/helpers/webhookHelpers.ts | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index ff97905f1a..08ca0a74c5 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -307,16 +307,15 @@ export async function invokeWebhook( const data = newData[i]; const prevData = prevData ? prevData[i] : null; - if (prevData) { - // if condition is satisfied for prevData then return - if ( - await validateCondition( - testFilters || (await hook.getFilters()), - prevData, - ) - ) { - continue; - } + // if condition is satisfied for prevData then return + if ( + prevData && + (await validateCondition( + testFilters || (await hook.getFilters()), + prevData, + )) + ) { + continue; } if ( await validateCondition( @@ -332,16 +331,15 @@ export async function invokeWebhook( } newData = filteredData; } else { - if (prevData) { - // if condition is satisfied for prevData then return - if ( - await validateCondition( - testFilters || (await hook.getFilters()), - prevData, - ) - ) { - return; - } + // if condition is satisfied for prevData then return + if ( + prevData && + (await validateCondition( + testFilters || (await hook.getFilters()), + prevData, + )) + ) { + return; } if ( !(await validateCondition( From c93545a19d5d0e059cf6b277ceef879590f300c8 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 20 Dec 2023 12:04:52 +0000 Subject: [PATCH 06/13] fix: ts error --- packages/nocodb/src/helpers/webhookHelpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 08ca0a74c5..26dc2fd532 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -305,14 +305,14 @@ export async function invokeWebhook( const filteredData = []; for (let i = 0; i < newData.length; i++) { const data = newData[i]; - const prevData = prevData ? prevData[i] : null; + const pData = prevData[i] ? prevData[i] : null; // if condition is satisfied for prevData then return if ( - prevData && + pData && (await validateCondition( testFilters || (await hook.getFilters()), - prevData, + pData, )) ) { continue; From 2168aff54b81ddbea5e3c41aacf247ec4525f761 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:52 +0000 Subject: [PATCH 07/13] fix: if no filter trigger on all change --- packages/nocodb/src/helpers/webhookHelpers.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 26dc2fd532..f143f9ec75 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -301,6 +301,8 @@ export async function invokeWebhook( } if (hook.condition && !testHook) { + const filters = testFilters || (await hook.getFilters()); + if (isBulkOperation) { const filteredData = []; for (let i = 0; i < newData.length; i++) { @@ -308,12 +310,11 @@ export async function invokeWebhook( const pData = prevData[i] ? prevData[i] : null; // if condition is satisfied for prevData then return + // if filters are not defined then skip the check if ( pData && - (await validateCondition( - testFilters || (await hook.getFilters()), - pData, - )) + filters.length && + (await validateCondition(filters, pData)) ) { continue; } @@ -332,12 +333,11 @@ export async function invokeWebhook( newData = filteredData; } else { // if condition is satisfied for prevData then return + // if filters are not defined then skip the check if ( prevData && - (await validateCondition( - testFilters || (await hook.getFilters()), - prevData, - )) + filters.length && + (await validateCondition(filters, prevData)) ) { return; } From 2627ca8495addec7ea692844ab7ad093c8e1b77a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:52 +0000 Subject: [PATCH 08/13] refactor: reset condition checkbox state on deleting filter --- packages/nc-gui/components/webhook/Editor.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/nc-gui/components/webhook/Editor.vue b/packages/nc-gui/components/webhook/Editor.vue index 9a767d8591..d2dba9bbc9 100644 --- a/packages/nc-gui/components/webhook/Editor.vue +++ b/packages/nc-gui/components/webhook/Editor.vue @@ -790,6 +790,7 @@ onMounted(async () => { :show-loading="false" :hook-id="hookRef.id" :web-hook="true" + @update:filtersLength="hookRef.condition = $event > 0" /> From 99e22135cc6c18221d3e7494c7efade54b646b62 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Dec 2023 12:04:53 +0000 Subject: [PATCH 09/13] refact: hide condition option for bulk operation hooks --- packages/nc-gui/components/webhook/Editor.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/webhook/Editor.vue b/packages/nc-gui/components/webhook/Editor.vue index d2dba9bbc9..a77751852b 100644 --- a/packages/nc-gui/components/webhook/Editor.vue +++ b/packages/nc-gui/components/webhook/Editor.vue @@ -520,6 +520,10 @@ onMounted(async () => { } }, 50) }) + +const isConditionSupport = computed(() => { + return !hookRef.eventOperation.includes('bulk') +})