UI: Mobile center page name add warnings 256 limit/only white spaces.

This commit is contained in:
deaflynx 2025-02-24 15:41:43 +02:00
parent 8e13e3b5de
commit 09ecfa8d60
4 changed files with 27 additions and 3 deletions

View File

@ -43,6 +43,22 @@
<mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic" floatLabel="always"> <mat-form-field class="flex-1" appearance="outline" subscriptSizing="dynamic" floatLabel="always">
<mat-label translate>mobile.page-name</mat-label> <mat-label translate>mobile.page-name</mat-label>
<input matInput formControlName="label" placeholder="{{ defaultItemName }}"> <input matInput formControlName="label" placeholder="{{ defaultItemName }}">
<mat-icon matSuffix
matTooltipPosition="above"
matTooltipClass="tb-error-tooltip"
matTooltip="{{ 'mobile.page-name-cannot-contain-only-spaces' | translate }}"
*ngIf="mobilePageFormGroup.get('label').hasError('pattern') && mobilePageFormGroup.get('label').touched"
class="tb-error">
warning
</mat-icon>
<mat-icon matSuffix
matTooltipPosition="above"
matTooltipClass="tb-error-tooltip"
matTooltip="{{ 'mobile.page-name-max-length' | translate }}"
*ngIf="mobilePageFormGroup.get('label').hasError('maxlength') && mobilePageFormGroup.get('label').touched"
class="tb-error">
warning
</mat-icon>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>

View File

@ -17,7 +17,7 @@
import { Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewEncapsulation } from '@angular/core'; import { Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
import { DefaultMobilePage, defaultMobilePageMap, hideDefaultMenuItems } from '@shared/models/mobile-app.models'; import { DefaultMobilePage, defaultMobilePageMap, hideDefaultMenuItems } from '@shared/models/mobile-app.models';
import { TbPopoverComponent } from '@shared/components/popover.component'; import { TbPopoverComponent } from '@shared/components/popover.component';
import { FormBuilder } from '@angular/forms'; import { FormBuilder, Validators } from '@angular/forms';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({ @Component({
@ -43,7 +43,7 @@ export class DefaultMobilePagePanelComponent implements OnInit {
mobilePageFormGroup = this.fb.group({ mobilePageFormGroup = this.fb.group({
visible: [true], visible: [true],
icon: [''], icon: [''],
label: [''], label: ['', [Validators.pattern(/\S/), Validators.maxLength(255)]],
}); });
isCleanupEnabled = false; isCleanupEnabled = false;

View File

@ -50,6 +50,14 @@
class="tb-error"> class="tb-error">
warning warning
</mat-icon> </mat-icon>
<mat-icon matSuffix
matTooltipPosition="above"
matTooltipClass="tb-error-tooltip"
matTooltip="{{ 'mobile.page-name-max-length' | translate }}"
*ngIf="mobilePageRowForm.get('label').hasError('maxlength') && mobilePageRowForm.get('label').touched"
class="tb-error">
warning
</mat-icon>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="isCustomMenuItem" <mat-form-field *ngIf="isCustomMenuItem"
class="tb-mobile-page-item-info flex" appearance="outline" subscriptSizing="dynamic"> class="tb-mobile-page-item-info flex" appearance="outline" subscriptSizing="dynamic">

View File

@ -99,7 +99,7 @@ export class MobilePageItemRowComponent implements ControlValueAccessor, OnInit,
mobilePageRowForm = this.fb.group({ mobilePageRowForm = this.fb.group({
visible: [true, []], visible: [true, []],
icon: ['', []], icon: ['', []],
label: ['', [Validators.pattern(/\S/)]], label: ['', [Validators.pattern(/\S/), Validators.maxLength(255)]],
type: [MobilePageType.DEFAULT] type: [MobilePageType.DEFAULT]
}); });