diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue index 0d27545f3f..b49dab2551 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/formulaCell.vue @@ -25,12 +25,13 @@ export default { const rawText = this.row[this.column.title].toString() let found = false - const out = rawText.match(/URI::\((.*?)\)/g, (_, url) => { + const out = rawText.replace(/URI::\((.*?)\)/g, (_, url) => { found = true const a = document.createElement('a') a.textContent = url a.setAttribute('href', url) - return a.innerHTML + a.setAttribute('target', '_blank') + return a.outerHTML }) return found && out diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts index 55cac2ffee..632b32f33f 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/formulav2/formulaQueryBuilderv2.ts @@ -564,6 +564,41 @@ export default async function formulaQueryBuilderv2( } } break; + case 'DATEADD': + if (pt.arguments[1].value) { + pt.callee.name = 'DATE_ADD'; + return fn(pt, alias, prevBinaryOp); + } else if (pt.arguments[1].operator == '-') { + pt.callee.name = 'DATE_SUB'; + return fn(pt, alias, prevBinaryOp); + } + break; + case 'URL': + return fn( + { + type: 'CallExpression', + arguments: [ + { + type: 'Literal', + value: 'URI::(', + raw: '"URI::("' + }, + pt.arguments[0], + { + type: 'Literal', + value: ')', + raw: '")"' + } + ], + callee: { + type: 'Identifier', + name: 'CONCAT' + } + }, + alias, + prevBinaryOp + ); + break; default: { const res = mapFunctionName({