Browse Source

Merge branch 'develop' into fix/ui-ux-2

pull/7218/head
Raju Udava 11 months ago
parent
commit
1c29d400e6
  1. 13
      packages/nc-gui/components/cell/RichText.vue
  2. 10
      packages/nc-gui/components/smartsheet/grid/Table.vue
  3. 13
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  4. 10
      packages/nc-gui/components/webhook/Editor.vue
  5. 10
      packages/nc-gui/composables/useMultiSelect/index.ts
  6. 36
      packages/nocodb/src/helpers/webhookHelpers.ts

13
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(() => {

10
packages/nc-gui/components/smartsheet/grid/Table.vue

@ -1037,13 +1037,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)
}
})

13
packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue

@ -208,8 +208,17 @@ const filtersCount = computed(() => {
}, 0)
})
const applyChanges = async (hookId?: string, _nested = false) => {
await sync(hookId, _nested)
const applyChanges = async (hookId?: string, nested = false, isConditionSupported = true) => {
// if condition is not supported, delete all filters present
// it's used for bulk webhooks with filters since bulk webhooks don't support conditions at the moment
if (!isConditionSupported) {
// iterate in reverse order and delete all filters, reverse order is for getting the correct index
for (let i = filters.value.length - 1; i >= 0; i--) {
await deleteFilter(filters.value[i], i)
}
}
await sync(hookId, nested)
if (!localNestedFilters.value?.length) return

10
packages/nc-gui/components/webhook/Editor.vue

@ -403,6 +403,10 @@ async function loadPluginList() {
}
}
const isConditionSupport = computed(() => {
return hookRef.eventOperation && !hookRef.eventOperation.includes('bulk')
})
async function saveHooks() {
loading.value = true
try {
@ -446,7 +450,7 @@ async function saveHooks() {
}
if (filterRef.value) {
await filterRef.value.applyChanges(hookRef.id)
await filterRef.value.applyChanges(hookRef.id, false, isConditionSupport.value)
}
// Webhook details updated successfully
@ -772,8 +776,7 @@ onMounted(async () => {
</a-form-item>
</a-col>
</a-row>
<a-row class="mb-5" type="flex">
<a-row v-show="isConditionSupport" class="mb-5" type="flex">
<a-col :span="24">
<div class="rounded-lg border-1 p-6">
<a-checkbox
@ -792,6 +795,7 @@ onMounted(async () => {
:show-loading="false"
:hook-id="hookRef.id"
:web-hook="true"
@update:filtersLength="hookRef.condition = $event > 0"
/>
</div>
</a-col>

10
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] === '<br />') {
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
}

36
packages/nocodb/src/helpers/webhookHelpers.ts

@ -301,9 +301,26 @@ export async function invokeWebhook(
}
if (hook.condition && !testHook) {
const filters = testFilters || (await hook.getFilters());
if (isBulkOperation) {
const filteredData = [];
for (const data of newData) {
for (let i = 0; i < newData.length; i++) {
const data = newData[i];
// disable until we have a way to extract prevData for bulk operations
// 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 &&
// filters.length &&
// (await validateCondition(filters, pData))
// ) {
// continue;
// }
if (
await validateCondition(
testFilters || (await hook.getFilters()),
@ -312,12 +329,21 @@ export async function invokeWebhook(
) {
filteredData.push(data);
}
if (!filteredData.length) {
return;
}
newData = filteredData;
}
if (!filteredData.length) {
return;
}
newData = filteredData;
} else {
// if condition is satisfied for prevData then return
// if filters are not defined then skip the check
if (
prevData &&
filters.length &&
(await validateCondition(filters, prevData))
) {
return;
}
if (
!(await validateCondition(
testFilters || (await hook.getFilters()),

Loading…
Cancel
Save