Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fields): adiciona limite na exibição de mensagens de erro #2345

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ export interface PoDynamicFormField extends PoDynamicField {
*/
errorMessage?: string;

/**
* @optional
*
* @description
*
* Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
*
* > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
* e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
*
* **Componentes compatíveis:** `po-datepicker`, `po-input`, `po-number`, `po-decimal`, `po-password`, `po-datepicker-range`,
* `po-select`, `po-checkbox-group`, `po-radio-group`, `po-multiselect`, `po-combo`, `po-lookup`, `po-textarea`.
*
* @default `false`
*/
errorLimit?: boolean;

errorAppendBox?: boolean;

/**
* Função executada para realizar a validação assíncrona personalizada.
* Executada ao disparar o output `change` ou `change-model`, dependendo do valor da propriedade `triggerMode`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[p-clean]="field.clean"
[p-disabled]="isDisabled(field)"
[p-error-pattern]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-error-async]="field.errorAsyncFunction"
[p-auto-focus]="field.focus"
[p-format]="field.format"
Expand Down Expand Up @@ -59,6 +60,7 @@
[p-readonly]="field.readonly"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field)"
>
Expand All @@ -73,6 +75,7 @@
[p-clean]="field.clean"
[p-disabled]="isDisabled(field)"
[p-error-pattern]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-error-async-properties]="field.errorAsyncProperties"
[p-auto-focus]="field.focus"
[p-help]="field.help"
Expand Down Expand Up @@ -104,6 +107,7 @@
[p-clean]="field.clean"
[p-disabled]="isDisabled(field)"
[p-error-pattern]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-error-async-properties]="field.errorAsyncProperties"
[p-auto-focus]="field.focus"
[p-help]="field.help"
Expand Down Expand Up @@ -134,6 +138,7 @@
[ngClass]="field.componentClass"
[p-clean]="field.clean"
[p-error-pattern]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-error-async-properties]="field.errorAsyncProperties"
[p-disabled]="isDisabled(field)"
[p-decimals-length]="field.decimalsLength"
Expand Down Expand Up @@ -174,6 +179,7 @@
[p-options]="field.options"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field)"
[p-placeholder]="field.placeholder"
Expand All @@ -196,6 +202,7 @@
[p-options]="field.options"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field)"
>
Expand Down Expand Up @@ -257,6 +264,7 @@
[p-sort]="field.sort"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field, $event)"
[p-icon]="field.icon"
Expand Down Expand Up @@ -297,6 +305,7 @@
[p-optional]="field.optional"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field)"
[p-placeholder]="field.placeholder"
Expand All @@ -322,6 +331,7 @@
[p-required]="field.required"
[p-show-required]="field.showRequired"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
(p-change)="onChangeField(field)"
>
</po-checkbox-group>
Expand All @@ -342,6 +352,7 @@
[p-options]="field.options"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
(p-change)="onChangeField(field)"
[p-placeholder]="field.placeholder"
Expand Down Expand Up @@ -373,6 +384,7 @@
[p-readonly]="field.readonly"
[p-required]="field.required"
[p-field-error-message]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-show-required]="field.showRequired"
[p-rows]="field.rows"
(p-change)="onChangeField(field)"
Expand All @@ -390,6 +402,7 @@
[p-clean]="field.clean"
[p-disabled]="isDisabled(field)"
[p-error-pattern]="field.errorMessage"
[p-error-limit]="field.errorLimit"
[p-error-async-properties]="field.errorAsyncProperties"
[p-auto-focus]="field.focus"
[p-help]="field.help"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ export class PoCheckboxGroupBaseComponent implements ControlValueAccessor, Valid
*/
@Input('p-field-error-message') fieldErrorMessage: string;

/**
* @optional
*
* @description
*
* Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
*
* > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
* e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
*
* @default `false`
*/
@Input('p-error-limit') errorLimit: boolean = false;

/**
* @optional
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
</ul>
</div>

<po-field-container-bottom [p-error-pattern]="getErrorPattern()"></po-field-container-bottom>
<po-field-container-bottom
[p-error-pattern]="getErrorPattern()"
[p-error-limit]="errorLimit"
></po-field-container-bottom>
</po-field-container>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[p-options]="options"
[p-required]="properties.includes('required')"
[p-field-error-message]="fieldErrorMessage"
[p-error-limit]="properties?.includes('errorLimit')"
[p-show-required]="properties.includes('showRequired')"
(p-change)="changeEvent('p-change')"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export class SamplePoCheckboxGroupLabsComponent implements OnInit {
{ value: 'indeterminate', label: 'Indeterminate' },
{ value: 'optional', label: 'Optional' },
{ value: 'required', label: 'Required' },
{ value: 'showRequired', label: 'Show Required' }
{ value: 'showRequired', label: 'Show Required' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@ export abstract class PoComboBaseComponent implements ControlValueAccessor, OnIn
*/
@Input('p-field-error-message') fieldErrorMessage: string;

/**
* @optional
*
* @description
*
* Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
*
* > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
* e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
*
* @default `false`
*/
@Input('p-error-limit') errorLimit: boolean = false;

@Input({ alias: 'p-error-append-in-body', transform: convertToBoolean }) errorAppendBox?: boolean = false;

/**
* @optional
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
[p-help]="help"
[p-disabled]="disabled"
[p-error-pattern]="getErrorPattern()"
[p-error-limit]="errorLimit"
[p-append-in-body]="errorAppendBox"
></po-field-container-bottom>
</po-field-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
[p-show-required]="properties.includes('showRequired')"
[p-sort]="properties.includes('sort')"
(p-change)="changeEvent('p-change')"
[p-error-limit]="properties?.includes('errorLimit')"
>
</po-combo>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class SamplePoComboLabsComponent implements OnInit {
{ value: 'showRequired', label: 'Show Required' },
{ value: 'sort', label: 'Sort' },
{ value: 'clean', label: 'Clean' },
{ value: 'disabledTabFilter', label: 'Disabled Tab Filter' }
{ value: 'disabledTabFilter', label: 'Disabled Tab Filter' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

ngOnInit() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ export abstract class PoDatepickerRangeBaseComponent implements ControlValueAcce
*/
@Input('p-field-error-message') fieldErrorMessage: string;

/**
* @optional
*
* @description
*
* Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
*
* > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
* e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
*
* @default `false`
*/
@Input('p-error-limit') errorLimit: boolean = false;

/**
* @optional
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
[p-help]="help"
[p-disabled]="disabled"
[p-error-pattern]="getErrorMessage"
[p-error-limit]="errorLimit"
></po-field-container-bottom>
</po-field-container>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[p-start-date]="startDate"
[p-locale]="locale"
(p-change)="changeEvent('p-change')"
[p-error-limit]="properties?.includes('errorLimit')"
>
</po-datepicker-range>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class SamplePoDatepickerRangeLabsComponent implements OnInit {
{ value: 'optional', label: 'Optional' },
{ value: 'readonly', label: 'Read Only' },
{ value: 'required', label: 'Required' },
{ value: 'showRequired', label: 'Show Required' }
{ value: 'showRequired', label: 'Show Required' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

public readonly localeOptions: Array<PoSelectOption> = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ export abstract class PoDatepickerBaseComponent implements ControlValueAccessor,
*/
@Input('p-error-pattern') errorPattern?: string = '';

/**
* @optional
*
* @description
*
* Limita a exibição da mensagem de erro a duas linhas e exibe um tooltip com o texto completo.
*
* > Caso essa propriedade seja definida como `true`, a mensagem de erro será limitada a duas linhas
* e um tooltip será exibido ao passar o mouse sobre a mensagem para mostrar o conteúdo completo.
*
* @default `false`
*/
@Input('p-error-limit') errorLimit: boolean = false;

@Input({ alias: 'p-error-append-in-body', transform: convertToBoolean }) errorAppendBox?: boolean = false;

/**
* @optional
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@
[p-help]="help"
[p-disabled]="disabled"
[p-error-pattern]="getErrorPattern()"
[p-error-limit]="errorLimit"
[p-append-in-body]="errorAppendBox"
></po-field-container-bottom>
</po-field-container>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[p-show-required]="properties.includes('showRequired')"
(p-blur)="changeEvent('p-blur')"
(p-change)="changeEvent('p-change')"
[p-error-limit]="properties?.includes('errorLimit')"
>
</po-datepicker>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export class SamplePoDatepickerLabsComponent implements OnInit {
{ value: 'readonly', label: 'Read Only' },
{ value: 'required', label: 'Required' },
{ value: 'requiredFieldErrorMessage', label: 'Required Field Error Message' },
{ value: 'showRequired', label: 'Show Required' }
{ value: 'showRequired', label: 'Show Required' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

public readonly formatOptions: Array<PoRadioGroupOption> = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
</div>
</div>

<po-field-container-bottom [p-help]="help" [p-disabled]="disabled" [p-error-pattern]="getErrorPatternMessage()">
<po-field-container-bottom
[p-help]="help"
[p-disabled]="disabled"
[p-error-limit]="errorLimit"
[p-error-pattern]="getErrorPatternMessage()"
[p-append-in-body]="errorAppendBox"
>
</po-field-container-bottom>
</po-field-container>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
(p-blur)="changeEvent('p-blur')"
(p-change)="changeEvent('p-change')"
(p-change-model)="changeEvent('p-change-model')"
[p-error-limit]="properties?.includes('errorLimit')"
>
</po-decimal>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class SamplePoDecimalLabsComponent implements OnInit {
{ value: 'readonly', label: 'Read Only' },
{ value: 'required', label: 'Required' },
{ value: 'requiredFieldErrorMessage', label: 'Required Field Error Message' },
{ value: 'showRequired', label: 'Show Required' }
{ value: 'showRequired', label: 'Show Required' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

get maxDecimalsLength() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
(p-change)="changeEvent('p-change')"
(p-change-model)="changeEvent('p-change-model')"
(p-enter)="changeEvent('p-enter')"
[p-error-limit]="properties?.includes('errorLimit')"
>
</po-email>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class SamplePoEmailLabsComponent implements OnInit {
{ value: 'optional', label: 'Optional' },
{ value: 'readonly', label: 'Read Only' },
{ value: 'required', label: 'Required' },
{ value: 'requiredFieldErrorMessage', label: 'Required Field Error Message' }
{ value: 'requiredFieldErrorMessage', label: 'Required Field Error Message' },
{ value: 'errorLimit', label: 'Limit Error Message' }
];

ngOnInit() {
Expand Down
Loading
Loading