AAE-36582 Fix forms misalignment in form renderer [ng18 backup] (#11063)

This commit is contained in:
Tomasz Nastaly
2025-08-04 10:04:30 +02:00
committed by GitHub
parent 623a345e6e
commit d094c23712
6 changed files with 52 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
<div id="adf-form-renderer" class="{{ formDefinition.className }}" <div id="adf-form-renderer" class="{{ formDefinition.className }} adf-form-renderer"
[ngClass]="{ 'adf-readonly-form': formDefinition.readOnly }"> [ngClass]="{ 'adf-readonly-form': formDefinition.readOnly }">
<div *ngIf="formDefinition.hasTabs()"> <div *ngIf="formDefinition.hasTabs()">
<div *ngIf="hasTabs()" class="alfresco-tabs-widget"> <div *ngIf="hasTabs()" class="alfresco-tabs-widget">

View File

@@ -13,6 +13,14 @@
height: 100%; height: 100%;
} }
.adf-form-renderer {
// override Material styles, otherwise fields collapse on some screen widths
// related issue: https://hyland.atlassian.net/browse/AAE-36582
.mat-mdc-form-field-infix {
width: auto;
}
}
.alfresco-tabs-widget { .alfresco-tabs-widget {
width: 100%; width: 100%;
@@ -256,6 +264,18 @@
line-height: 64px; line-height: 64px;
margin-right: 15px; margin-right: 15px;
} }
&-error-messages-container {
min-height: 35px;
}
&-error-messages-container-visible {
visibility: visible;
}
&-error-messages-container-hidden {
visibility: hidden;
}
} }
form-field { form-field {
@@ -267,7 +287,3 @@ form-field {
line-height: normal; line-height: normal;
} }
} }
.adf-error-messages-container {
min-height: 35px;
}

View File

@@ -2,30 +2,31 @@
.adf-grid-list { .adf-grid-list {
&-section { &-section {
&-single-column { &-single-column {
display: flex; display: flex;
flex-wrap: inherit; flex-wrap: inherit;
align-items: baseline; align-items: center;
gap: 1%; gap: 1%;
@include flex.layout-bp(lt-md) { @include flex.layout-bp(lt-md) {
/* stylelint-disable-next-line declaration-no-important */
flex: 1 1 100% !important; flex: 1 1 100% !important;
flex-direction: column; flex-direction: column;
} }
.adf-section-widget { .adf-section-widget {
@include flex.layout-bp(lt-md) { @include flex.layout-bp(lt-md) {
/* stylelint-disable-next-line declaration-no-important */
width: 100% !important; width: 100% !important;
} }
} }
> div { > div {
@include flex.layout-bp(lt-md) { @include flex.layout-bp(lt-md) {
/* stylelint-disable-next-line declaration-no-important */
width: 100% !important; width: 100% !important;
} }
} }
} }
&-column-view-item { &-column-view-item {

View File

@@ -13,29 +13,30 @@
<div> <div>
<mat-form-field class="adf-form-field-input" [floatLabel]="field.placeholder ? 'always' : null"> <mat-form-field class="adf-form-field-input" [floatLabel]="field.placeholder ? 'always' : null">
@if( (field.name || field?.required) && !field.leftLabels) { @if( (field.name || field?.required) && !field.leftLabels) {
<mat-label class="adf-label" [attr.for]="field.id"> <mat-label class="adf-label" [attr.for]="field.id"> {{ field.name | translate }} </mat-label>
{{ field.name | translate }} }
</mat-label> <input
} matInput
<input matInput class="adf-input"
class="adf-input" type="text"
type="text" data-automation-id="adf-display-external-property-widget"
data-automation-id="adf-display-external-property-widget" [id]="field.id"
[id]="field.id" [formControl]="propertyControl"
[formControl]="propertyControl" [required]="field.required"
[required]="field.required" />
>
<ng-container *ngIf="previewState"> <ng-container *ngIf="previewState">
<span class="adf-display-external-property-widget-preview" <span class="adf-display-external-property-widget-preview" data-automation-id="adf-display-external-property-widget-preview">
data-automation-id="adf-display-external-property-widget-preview"
>
{{ field.params.externalPropertyLabel }} {{ field.params.externalPropertyLabel }}
</span> </span>
</ng-container> </ng-container>
</mat-form-field> </mat-form-field>
<ng-container *ngIf="!previewState"> <div
class="adf-error-messages-container"
[ngClass]="!previewState ? 'adf-error-messages-container-visible' : 'adf-error-messages-container-hidden'"
>
<error-widget *ngIf="propertyLoadFailed" [required]="'FORM.FIELD.EXTERNAL_PROPERTY_LOAD_FAILED' | translate" /> <error-widget *ngIf="propertyLoadFailed" [required]="'FORM.FIELD.EXTERNAL_PROPERTY_LOAD_FAILED' | translate" />
</ng-container> </div>
</div>
</div> </div>

View File

@@ -11,7 +11,8 @@
</div> </div>
<div> <div>
<mat-form-field class="adf-form-field-input"> <mat-form-field class="adf-form-field-input">
@if ( (field.name || this.field?.required) && !field.leftLabels) { <mat-label class="adf-label" [attr.for]="field.id">{{ field.name | translate }}</mat-label> } @if ( (field.name || this.field?.required) && !field.leftLabels) {
<mat-label class="adf-label" [attr.for]="field.id">{{ field.name | translate }}</mat-label> }
<mat-select <mat-select
class="adf-select" class="adf-select"
[formControl]="dropdownControl" [formControl]="dropdownControl"
@@ -29,12 +30,11 @@
<mat-option id="readonlyOption" *ngIf="isReadOnlyType" [value]="field.value">{{field.value}}</mat-option> <mat-option id="readonlyOption" *ngIf="isReadOnlyType" [value]="field.value">{{field.value}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<div class="adf-error-messages-container" *ngIf="!previewState && !field.readOnly"> <div
<error-widget class="adf-error-messages-container"
class="adf-dropdown-required-message" [ngClass]="!previewState && !field.readOnly ? 'adf-error-messages-container-visible' : 'adf-error-messages-container-hidden'"
*ngIf="showRequiredMessage" >
required="{{ 'FORM.FIELD.REQUIRED' | translate }}" <error-widget class="adf-dropdown-required-message" *ngIf="showRequiredMessage" required="{{ 'FORM.FIELD.REQUIRED' | translate }}" />
/>
<error-widget <error-widget
class="adf-dropdown-failed-message" class="adf-dropdown-failed-message"
*ngIf="isRestApiFailed" *ngIf="isRestApiFailed"

View File

@@ -29,7 +29,7 @@ import {
SelectFilterInputComponent, SelectFilterInputComponent,
WidgetComponent WidgetComponent
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { AsyncPipe, NgFor, NgIf } from '@angular/common'; import { AsyncPipe, NgClass, NgFor, NgIf } from '@angular/common';
import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms'; import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field'; import { MatFormFieldModule } from '@angular/material/form-field';
@@ -60,6 +60,7 @@ export const HIDE_FILTER_LIMIT = 5;
imports: [ imports: [
NgIf, NgIf,
NgFor, NgFor,
NgClass,
AsyncPipe, AsyncPipe,
ReactiveFormsModule, ReactiveFormsModule,
MatFormFieldModule, MatFormFieldModule,