File tree Expand file tree Collapse file tree
shared/components/ncTable/mixins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,10 +75,7 @@ export default {
7575 },
7676 methods: {
7777 getValueForColumn () {
78- if (this .column .type === ' relation_lookup' && this .column .customSettings ? .relationColumnId ) {
79- return this .value ? .[this .column .customSettings .relationColumnId ] ?? null
80- }
81- return this .value
78+ return this .column .getValueForForm (this .value )
8279 },
8380 snakeToCamel (str ) {
8481 str = str .toLowerCase ().replace (/ ([-_][a-z ] )/ g , group =>
Original file line number Diff line number Diff line change @@ -91,6 +91,17 @@ export class AbstractColumn {
9191 return this . id
9292 }
9393
94+ /**
95+ * Get the value for form input.
96+ * Default implementation returns the value as-is.
97+ *
98+ * @param {* } value The raw value
99+ * @return {* } The value for form input
100+ */
101+ getValueForForm ( value ) {
102+ return value
103+ }
104+
94105}
95106
96107export class AbstractUsergroupColumn extends AbstractColumn {
Original file line number Diff line number Diff line change @@ -45,6 +45,20 @@ export default class RelationLookupColumn extends AbstractColumn {
4545 return this . customSettings . relationColumnId
4646 }
4747
48+ /**
49+ * Get the value for form input.
50+ * For relation lookup, extracts the value from the relation column id.
51+ *
52+ * @param {* } value The raw value
53+ * @return {* } The value for form input
54+ */
55+ getValueForForm ( value ) {
56+ if ( this . customSettings ?. relationColumnId ) {
57+ return value ?. [ this . customSettings . relationColumnId ] ?? null
58+ }
59+ return value
60+ }
61+
4862 getValueString ( valueObject ) {
4963 valueObject = valueObject || this . value || null
5064 if ( ! valueObject || valueObject . value === null || valueObject . value === undefined ) {
You can’t perform that action at this time.
0 commit comments