Browse Source

Merge pull request #2652 from nocodb/enhancement/formula-display

enhancement: formula display
pull/2672/head
mertmit 2 years ago committed by GitHub
parent
commit
24720519a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      packages/nc-gui/components/project/spreadsheet/components/VirtualHeaderCell.vue
  2. 5
      packages/nc-gui/components/project/spreadsheet/components/editColumn/FormulaOptions.vue

9
packages/nc-gui/components/project/spreadsheet/components/VirtualHeaderCell.vue

@ -101,7 +101,7 @@
</div> </div>
</template> </template>
<script> <script>
import { UITypes } from 'nocodb-sdk'; import { UITypes, substituteColumnIdWithAliasInFormula } from 'nocodb-sdk';
import { getUIDTIcon } from '../helpers/uiTypes'; import { getUIDTIcon } from '../helpers/uiTypes';
import EditVirtualColumn from '~/components/project/spreadsheet/components/EditVirtualColumn'; import EditVirtualColumn from '~/components/project/spreadsheet/components/EditVirtualColumn';
@ -198,7 +198,12 @@ export default {
} else if (this.type === 'lk') { } else if (this.type === 'lk') {
return `'${this.childColumn.title}' from '${this.childTable}' (${this.childColumn.uidt})`; return `'${this.childColumn.title}' from '${this.childTable}' (${this.childColumn.uidt})`;
} else if (this.type === 'formula') { } else if (this.type === 'formula') {
return `Formula - ${this.column.colOptions.formula}`; const formula = substituteColumnIdWithAliasInFormula(
this.column.colOptions.formula,
this.meta.columns,
this.column.colOptions.formula_raw
);
return `Formula - ${formula}`;
} else if (this.type === 'rl') { } else if (this.type === 'rl') {
return `'${this.childColumn.title}' of '${this.childTable}' (${this.childColumn.uidt})`; return `'${this.childColumn.title}' of '${this.childTable}' (${this.childColumn.uidt})`;
} }

5
packages/nc-gui/components/project/spreadsheet/components/editColumn/FormulaOptions.vue

@ -136,7 +136,10 @@ export default {
examples: formulas[fn].examples, examples: formulas[fn].examples,
})), })),
...this.meta.columns ...this.meta.columns
.filter(c => !this.column || this.column.id !== c.id) .filter(
c =>
!this.column || (this.column.id !== c.id && !(c.uidt === UITypes.LinkToAnotherRecord && c.system === 1))
)
.map(c => ({ .map(c => ({
text: c.title, text: c.title,
type: 'column', type: 'column',

Loading…
Cancel
Save