AddRelationshipComponent
Component Metadata
Section titled “Component Metadata”Selector: yuv-add-relationship
Standalone: No
Inputs
Section titled “Inputs”config
Section titled “config”Type: RelationshipComponentConfig
Default Value: this.#dialogData.config
object
Section titled “object”Type: DmsObject
Default Value: this.#dialogData.object
Properties
Section titled “Properties”availableTargetTypes
Section titled “availableTargetTypes”Type: unknown
Default Value: computed<string[]>(() => \{ const rel = this.supportedRelationships(); const types = Array.from(new Set(rel.map((r) => r.allowedTargetTypes).flat())); this.targetTypeLabels = types.reduce( (acc, type) => \{ acc[type] = this.#system.getLocalizedLabel(type) || type; return acc; \}, \{\} as Record<string, string> ); this.targetTypeFilterControl.patchValue(types); return types; \})
Type: unknown
Default Value: signal<boolean>(false)
Type: unknown
Default Value: signal<string | null>(null)
filteredRelationships
Section titled “filteredRelationships”Type: unknown
Default Value: computed<Relationship[]>(() => \{ // filter the supported relationships of the object by the allowed target types // if target types are selected const tt = this.targetTypeFilterValue(); return this.supportedRelationships().filter((r) => \{ return !tt || r.allowedTargetTypes.some((t) => tt.includes(t)); \}); \})
Type: unknown
Default Value: new FormGroup( \{ relation: new FormControl<Relationship | null>(null, \{ nonNullable: true, validators: [Validators.required] \}), targetObject: new FormControl<Record<string, unknown> | null>(null, \{ nonNullable: true, validators: [Validators.required] \}) \}, \{ validators: this.#relationMatchesTargetObjectValidator \} )
labeledTargetTypes
Section titled “labeledTargetTypes”Type: unknown
Default Value: computed<\{ id: string; label: string \}[]>(() => this.availableTargetTypes().map((t) => (\{ id: t, label: this.targetTypeLabels[t] || t \})) )
sourceNode
Section titled “sourceNode”Type: unknown
Default Value: computed(() => \{ const obj = this.object(); const config = this.config(); return \{ title: obj.data[config.rootNode.labelField] as string, description: obj.data[config.rootNode.descriptionField || ''] as string | undefined, icon: config.rootNode.icon \}; \})
supportedRelationships
Section titled “supportedRelationships”Type: unknown
Default Value: computed<Relationship[]>(() => \{ const obj = this.object(); return obj ? this.#system.getSupportedRelationships(obj, true) : []; \})
targetTypeFilterControl
Section titled “targetTypeFilterControl”Type: unknown
Default Value: new FormControl<string[]>([])
targetTypeFilterValue
Section titled “targetTypeFilterValue”Type: unknown
Default Value: toSignal(this.targetTypeFilterControl.valueChanges, \{ initialValue: this.targetTypeFilterControl.value || null \})
targetTypeLabels
Section titled “targetTypeLabels”Type: Record<string | string>
Default Value: \{\}
translate
Section titled “translate”Type: unknown
Default Value: inject(TranslateService)
Methods
Section titled “Methods”close(): voidonRelationSelect
Section titled “onRelationSelect”onRelationSelect(idx: number[]): voidArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| idx | number[] |
optionCompareWith
Section titled “optionCompareWith”optionCompareWith(o1: Relationship | undefined, o2: Relationship | undefined): booleanArguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
| o1 | Relationship | undefined | |
| o2 | Relationship | undefined |
submit
Section titled “submit”submit(): void