diff --git a/core/app/common/src/lib/metadata/metadata.model.ts b/core/app/common/src/lib/metadata/metadata.model.ts index 307bd6e8b..051a71ac4 100644 --- a/core/app/common/src/lib/metadata/metadata.model.ts +++ b/core/app/common/src/lib/metadata/metadata.model.ts @@ -30,6 +30,8 @@ import {FieldLogicMap} from '../actions/field-logic-action.model'; export interface ViewFieldDefinition { name?: string; label?: string; + labelKey?: string; + dynamicLabelKey?: string; link?: boolean; type?: string; display?: string; diff --git a/core/app/common/src/lib/record/field.model.ts b/core/app/common/src/lib/record/field.model.ts index ec0e2347e..bb47d84db 100644 --- a/core/app/common/src/lib/record/field.model.ts +++ b/core/app/common/src/lib/record/field.model.ts @@ -56,6 +56,7 @@ export interface FieldDefinition { name?: string; type?: string; // label key to use vname?: string; // original label + dynamicLabelKey?: string; options?: string; reportable?: boolean; required?: boolean; @@ -94,6 +95,8 @@ export interface FieldDefinition { modes?: ViewMode[]; relationship?: string; relationshipMetadata?: RelationshipMetadata + + [key: string]: any; } export interface RelationshipMetadata { @@ -115,6 +118,8 @@ export interface FieldMetadata { format?: boolean; target?: string; link?: boolean; + linkRoute?: string; + linkAsyncAction?: string; rows?: number; cols?: number; digits?: number; @@ -124,6 +129,8 @@ export interface FieldMetadata { extraOptions?: Option[]; onClick?: FieldClickCallback; tinymce?: any; + + [key: string]: any; } export interface FieldAttributeMap { @@ -153,6 +160,7 @@ export interface Field { name?: string; label?: string; labelKey?: string; + dynamicLabelKey?: string; parentKey?: string; attributes?: FieldAttributeMap; items?: Record[]; @@ -179,6 +187,7 @@ export class BaseField implements Field { name?: string; label?: string; labelKey?: string; + dynamicLabelKey?: string; display?: string; defaultDisplay?: string; source?: 'field' | 'attribute'; diff --git a/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.html b/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.html index 0ee8f84e6..a98e6f6ad 100644 --- a/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.html +++ b/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.html @@ -64,6 +64,11 @@ [labelKey]="field.labelKey" [ngClass]="getLabelClass(col)"> + + + @@ -74,6 +79,7 @@ diff --git a/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.ts b/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.ts index 830a95054..e8f5be47e 100644 --- a/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.ts +++ b/core/app/core/src/lib/components/record-flexbox/record-flexbox.component.ts @@ -200,7 +200,7 @@ export class RecordFlexboxComponent implements OnInit, OnDestroy { return null; } - return record.fields[field.name] || null; + return record.fields[field.name] ?? null; } getFieldClass(col: FieldFlexboxCol): { [key: string]: any } { diff --git a/core/app/core/src/lib/components/record-flexbox/record-flexbox.module.ts b/core/app/core/src/lib/components/record-flexbox/record-flexbox.module.ts index c76f9a893..c58478e3d 100644 --- a/core/app/core/src/lib/components/record-flexbox/record-flexbox.module.ts +++ b/core/app/core/src/lib/components/record-flexbox/record-flexbox.module.ts @@ -31,6 +31,7 @@ import {ButtonModule} from '../button/button.module'; import {LabelModule} from '../label/label.module'; import {RecordFlexboxComponent} from './record-flexbox.component'; import {ActionGroupMenuModule} from '../action-group-menu/action-group-menu.module'; +import {DynamicLabelModule} from '../dynamic-label/dynamic-label.module'; @NgModule({ declarations: [RecordFlexboxComponent], @@ -42,7 +43,8 @@ import {ActionGroupMenuModule} from '../action-group-menu/action-group-menu.modu ButtonModule, FieldModule, LabelModule, - ActionGroupMenuModule + ActionGroupMenuModule, + DynamicLabelModule ] }) export class RecordFlexboxModule { diff --git a/core/app/core/src/lib/services/record/field/field.builder.ts b/core/app/core/src/lib/services/record/field/field.builder.ts index cb6d8556d..96c292f1b 100644 --- a/core/app/core/src/lib/services/record/field/field.builder.ts +++ b/core/app/core/src/lib/services/record/field/field.builder.ts @@ -40,6 +40,7 @@ import { import {AsyncValidatorFn, FormArray, FormControl, ValidatorFn} from '@angular/forms'; import {LanguageStore} from '../../../store/language/language.store'; import get from 'lodash-es/get'; +import {merge} from 'lodash-es'; @Injectable({ @@ -165,7 +166,7 @@ export class FieldBuilder { const formattedValue = this.typeFormatter.toUserFormat(viewField.type, value, {mode: 'edit'}); - const metadata = viewField.metadata || definition.metadata || {}; + const metadata = merge(definition?.metadata ?? {}, viewField?.metadata ?? {}); if (viewField.link) { metadata.link = viewField.link; @@ -181,6 +182,7 @@ export class FieldBuilder { field.metadata = metadata; field.definition = definition; field.labelKey = viewField.label || definition.vname || ''; + field.dynamicLabelKey = viewField.dynamicLabelKey || definition.dynamicLabelKey || ''; field.validators = validators; field.asyncValidators = asyncValidators;