pjc-fields 0.0.43 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/pjc-fields.mjs +902 -766
- package/fesm2022/pjc-fields.mjs.map +1 -1
- package/package.json +1 -1
- package/types/pjc-fields.d.ts +289 -222
package/fesm2022/pjc-fields.mjs
CHANGED
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, output, inject, Injector, ChangeDetectorRef, DestroyRef, forwardRef, ChangeDetectionStrategy, Component, Directive, Injectable, InjectionToken, signal, effect, computed, ElementRef } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NgControl, FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/inputmask';
|
|
6
6
|
import { InputMaskModule } from 'primeng/inputmask';
|
|
7
|
-
import * as i3 from 'primeng/
|
|
7
|
+
import * as i3 from 'primeng/inputgroup';
|
|
8
|
+
import { InputGroupModule } from 'primeng/inputgroup';
|
|
9
|
+
import * as i4 from 'primeng/inputgroupaddon';
|
|
10
|
+
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
11
|
+
import { ButtonModule } from 'primeng/button';
|
|
12
|
+
import * as i3$1 from 'primeng/floatlabel';
|
|
8
13
|
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
9
|
-
import * as i4 from 'primeng/message';
|
|
14
|
+
import * as i4$1 from 'primeng/message';
|
|
10
15
|
import { MessageModule } from 'primeng/message';
|
|
11
16
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
17
|
import * as i1$1 from 'primeng/inputtext';
|
|
13
18
|
import { InputTextModule } from 'primeng/inputtext';
|
|
14
|
-
import * as i2$1 from 'primeng/
|
|
15
|
-
import { DatePickerModule } from 'primeng/datepicker';
|
|
16
|
-
import * as i3$1 from 'primeng/inputgroup';
|
|
17
|
-
import { InputGroupModule } from 'primeng/inputgroup';
|
|
18
|
-
import * as i4$1 from 'primeng/inputgroupaddon';
|
|
19
|
-
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
20
|
-
import { ButtonModule } from 'primeng/button';
|
|
21
|
-
import * as i2$2 from 'primeng/select';
|
|
22
|
-
import { SelectModule } from 'primeng/select';
|
|
23
|
-
import * as i2$3 from 'primeng/inputnumber';
|
|
24
|
-
import { InputNumberModule } from 'primeng/inputnumber';
|
|
25
|
-
import { KeyValuePipe } from '@angular/common';
|
|
26
|
-
import * as i2$4 from 'primeng/autocomplete';
|
|
19
|
+
import * as i2$1 from 'primeng/autocomplete';
|
|
27
20
|
import { AutoCompleteModule } from 'primeng/autocomplete';
|
|
28
21
|
import { HttpClient } from '@angular/common/http';
|
|
29
22
|
import { map } from 'rxjs/operators';
|
|
30
23
|
import * as i3$2 from 'primeng/api';
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
args: [{ selector: 'lib-pjc-fields', imports: [], template: ` <p>pjc-fields works!</p> ` }]
|
|
39
|
-
}] });
|
|
24
|
+
import * as i2$2 from 'primeng/datepicker';
|
|
25
|
+
import { DatePickerModule } from 'primeng/datepicker';
|
|
26
|
+
import * as i2$3 from 'primeng/select';
|
|
27
|
+
import { SelectModule } from 'primeng/select';
|
|
28
|
+
import { KeyValuePipe } from '@angular/common';
|
|
29
|
+
import * as i2$4 from 'primeng/inputnumber';
|
|
30
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
|
40
31
|
|
|
41
32
|
class PjcValidators {
|
|
42
33
|
static cpf() {
|
|
@@ -441,14 +432,16 @@ function getErrorMessage(ngControl, erros) {
|
|
|
441
432
|
return errorKey ? erros[errorKey] : '';
|
|
442
433
|
}
|
|
443
434
|
|
|
444
|
-
class
|
|
435
|
+
class PjcCepFieldComponent {
|
|
445
436
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
446
437
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
447
|
-
placeholder = input('000
|
|
448
|
-
id = input(`pjc-
|
|
438
|
+
placeholder = input('00000-000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
439
|
+
id = input(`pjc-cep-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
449
440
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
450
441
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
442
|
+
showSearchButton = input(true, ...(ngDevMode ? [{ debugName: "showSearchButton" }] : /* istanbul ignore next */ []));
|
|
451
443
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
444
|
+
busca = output();
|
|
452
445
|
injector = inject(Injector);
|
|
453
446
|
cdr = inject(ChangeDetectorRef);
|
|
454
447
|
destroyRef = inject(DestroyRef);
|
|
@@ -485,44 +478,84 @@ class PjcCpfFieldComponent {
|
|
|
485
478
|
onModelTouched() {
|
|
486
479
|
this.onTouched();
|
|
487
480
|
}
|
|
481
|
+
onComplete() {
|
|
482
|
+
this.busca.emit(this.value);
|
|
483
|
+
}
|
|
484
|
+
onSearch() {
|
|
485
|
+
if (this.value?.length === 8) {
|
|
486
|
+
this.busca.emit(this.value);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
488
489
|
validate(control) {
|
|
489
|
-
return PjcValidators.
|
|
490
|
+
return PjcValidators.cep()(control);
|
|
490
491
|
}
|
|
491
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
492
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
492
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCepFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
493
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCepFieldComponent, isStandalone: true, selector: "pjc-cep-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, showSearchButton: { classPropertyName: "showSearchButton", publicName: "showSearchButton", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { busca: "busca" }, providers: [
|
|
493
494
|
{
|
|
494
495
|
provide: NG_VALUE_ACCESSOR,
|
|
495
|
-
useExisting: forwardRef(() =>
|
|
496
|
+
useExisting: forwardRef(() => PjcCepFieldComponent),
|
|
496
497
|
multi: true,
|
|
497
498
|
},
|
|
498
499
|
{
|
|
499
500
|
provide: NG_VALIDATORS,
|
|
500
|
-
useExisting: forwardRef(() =>
|
|
501
|
+
useExisting: forwardRef(() => PjcCepFieldComponent),
|
|
501
502
|
multi: true,
|
|
502
503
|
},
|
|
503
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n
|
|
504
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999-999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n @if (showSearchButton()) {\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled || readonly()\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n }\n </p-inputgroup>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999-999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n @if (showSearchButton()) {\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n }\n </p-inputgroup>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: InputGroupModule }, { kind: "component", type: i3.InputGroup, selector: "p-inputgroup, p-inputGroup, p-input-group", inputs: ["styleClass"] }, { kind: "ngmodule", type: InputGroupAddonModule }, { kind: "component", type: i4.InputGroupAddon, selector: "p-inputgroup-addon, p-inputGroupAddon", inputs: ["style", "styleClass"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
504
505
|
}
|
|
505
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
506
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCepFieldComponent, decorators: [{
|
|
506
507
|
type: Component,
|
|
507
|
-
args: [{ selector: 'pjc-
|
|
508
|
+
args: [{ selector: 'pjc-cep-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, InputGroupModule, InputGroupAddonModule, ButtonModule, FloatLabelModule, MessageModule], providers: [
|
|
508
509
|
{
|
|
509
510
|
provide: NG_VALUE_ACCESSOR,
|
|
510
|
-
useExisting: forwardRef(() =>
|
|
511
|
+
useExisting: forwardRef(() => PjcCepFieldComponent),
|
|
511
512
|
multi: true,
|
|
512
513
|
},
|
|
513
514
|
{
|
|
514
515
|
provide: NG_VALIDATORS,
|
|
515
|
-
useExisting: forwardRef(() =>
|
|
516
|
+
useExisting: forwardRef(() => PjcCepFieldComponent),
|
|
516
517
|
multi: true,
|
|
517
518
|
},
|
|
518
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n
|
|
519
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
519
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999-999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n @if (showSearchButton()) {\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled || readonly()\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n }\n </p-inputgroup>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputgroup [class.opacity-60]=\"disabled\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999-999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (onComplete)=\"onComplete()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n inputStyleClass=\"w-full outline-none bg-transparent\"\n ></p-inputMask>\n\n @if (showSearchButton()) {\n <p-inputgroup-addon>\n <button\n type=\"button\"\n (click)=\"onSearch()\"\n [disabled]=\"disabled\"\n class=\"cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n aria-label=\"Buscar CEP\"\n >\n <i class=\"pi pi-search\"></i>\n </button>\n </p-inputgroup-addon>\n }\n </p-inputgroup>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
520
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], showSearchButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSearchButton", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }], busca: [{ type: i0.Output, args: ["busca"] }] } });
|
|
520
521
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
522
|
+
const VIN_ALLOWED = /^[A-HJ-NPR-Z0-9]$/;
|
|
523
|
+
class PjcChassiInputDirective {
|
|
524
|
+
onKeyDown(event) {
|
|
525
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey)
|
|
526
|
+
return;
|
|
527
|
+
if (!VIN_ALLOWED.test(event.key.toUpperCase())) {
|
|
528
|
+
event.preventDefault();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
onInput(event) {
|
|
532
|
+
const input = event.target;
|
|
533
|
+
const sanitized = input.value
|
|
534
|
+
.toUpperCase()
|
|
535
|
+
.replace(/[^A-HJ-NPR-Z0-9]/g, '')
|
|
536
|
+
.substring(0, 17);
|
|
537
|
+
if (input.value !== sanitized) {
|
|
538
|
+
input.value = sanitized;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
542
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: PjcChassiInputDirective, isStandalone: true, selector: "input[pjcChassi]", host: { listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" } }, ngImport: i0 });
|
|
543
|
+
}
|
|
544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, decorators: [{
|
|
545
|
+
type: Directive,
|
|
546
|
+
args: [{
|
|
547
|
+
selector: 'input[pjcChassi]',
|
|
548
|
+
host: {
|
|
549
|
+
'(keydown)': 'onKeyDown($event)',
|
|
550
|
+
'(input)': 'onInput($event)',
|
|
551
|
+
},
|
|
552
|
+
}]
|
|
553
|
+
}] });
|
|
554
|
+
|
|
555
|
+
class PjcChassiFieldComponent {
|
|
556
|
+
label = input('Chassi', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
557
|
+
placeholder = input('Digite o chassi', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
558
|
+
id = input(`pjc-chassi-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
526
559
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
527
560
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
528
561
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -544,7 +577,7 @@ class PjcCnpjFieldComponent {
|
|
|
544
577
|
return getErrorMessage(this.ngControl, this.erros());
|
|
545
578
|
}
|
|
546
579
|
writeValue(val) {
|
|
547
|
-
this.value = val ?? '';
|
|
580
|
+
this.value = val?.toUpperCase().replace(/[^A-HJ-NPR-Z0-9]/g, '').substring(0, 17) ?? '';
|
|
548
581
|
}
|
|
549
582
|
registerOnChange(fn) {
|
|
550
583
|
this.onChange = fn;
|
|
@@ -555,60 +588,89 @@ class PjcCnpjFieldComponent {
|
|
|
555
588
|
setDisabledState(isDisabled) {
|
|
556
589
|
this.disabled = isDisabled;
|
|
557
590
|
}
|
|
558
|
-
onModelChange(value) {
|
|
559
|
-
this.value = value ?? '';
|
|
560
|
-
this.onChange(this.value);
|
|
561
|
-
}
|
|
562
|
-
onModelTouched() {
|
|
563
|
-
this.onTouched();
|
|
564
|
-
}
|
|
565
591
|
validate(control) {
|
|
566
|
-
return PjcValidators.
|
|
592
|
+
return PjcValidators.chassi()(control);
|
|
567
593
|
}
|
|
568
|
-
|
|
569
|
-
|
|
594
|
+
onInput(event) {
|
|
595
|
+
const val = event.target.value;
|
|
596
|
+
this.value = val;
|
|
597
|
+
this.onChange(val);
|
|
598
|
+
}
|
|
599
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
600
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcChassiFieldComponent, isStandalone: true, selector: "pjc-chassi-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
570
601
|
{
|
|
571
602
|
provide: NG_VALUE_ACCESSOR,
|
|
572
|
-
useExisting: forwardRef(() =>
|
|
603
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
573
604
|
multi: true,
|
|
574
605
|
},
|
|
575
606
|
{
|
|
576
607
|
provide: NG_VALIDATORS,
|
|
577
|
-
useExisting: forwardRef(() =>
|
|
608
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
578
609
|
multi: true,
|
|
579
610
|
},
|
|
580
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
611
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"17\"\n class=\"w-full p-2 outline-none bg-transparent uppercase\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"17\"\n class=\"w-full p-2 outline-none bg-transparent uppercase\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "directive", type: PjcChassiInputDirective, selector: "input[pjcChassi]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
581
612
|
}
|
|
582
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
613
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiFieldComponent, decorators: [{
|
|
583
614
|
type: Component,
|
|
584
|
-
args: [{ selector: 'pjc-
|
|
615
|
+
args: [{ selector: 'pjc-chassi-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputTextModule, FloatLabelModule, MessageModule, PjcChassiInputDirective], providers: [
|
|
585
616
|
{
|
|
586
617
|
provide: NG_VALUE_ACCESSOR,
|
|
587
|
-
useExisting: forwardRef(() =>
|
|
618
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
588
619
|
multi: true,
|
|
589
620
|
},
|
|
590
621
|
{
|
|
591
622
|
provide: NG_VALIDATORS,
|
|
592
|
-
useExisting: forwardRef(() =>
|
|
623
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
593
624
|
multi: true,
|
|
594
625
|
},
|
|
595
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
596
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }],
|
|
626
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"17\"\n class=\"w-full p-2 outline-none bg-transparent uppercase\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"17\"\n class=\"w-full p-2 outline-none bg-transparent uppercase\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
627
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
597
628
|
|
|
598
|
-
class
|
|
599
|
-
|
|
600
|
-
|
|
629
|
+
class PjcCidadeService {
|
|
630
|
+
http = inject(HttpClient);
|
|
631
|
+
API_URL = 'https://servicodados.ibge.gov.br/api/v1/localidades/estados';
|
|
632
|
+
getMunicipiosByUf(uf) {
|
|
633
|
+
return this.http
|
|
634
|
+
.get(`${this.API_URL}/${uf}/municipios`)
|
|
635
|
+
.pipe(map((data) => data
|
|
636
|
+
.map((m) => ({ id: m.id, nome: m.nome, descricao: m.descricao }))
|
|
637
|
+
.sort((a, b) => {
|
|
638
|
+
const aDisplay = a.nome || a.descricao || '';
|
|
639
|
+
const bDisplay = b.nome || b.descricao || '';
|
|
640
|
+
return aDisplay.localeCompare(bDisplay);
|
|
641
|
+
})));
|
|
642
|
+
}
|
|
643
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
644
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, providedIn: 'root' });
|
|
645
|
+
}
|
|
646
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, decorators: [{
|
|
647
|
+
type: Injectable,
|
|
648
|
+
args: [{
|
|
649
|
+
providedIn: 'root',
|
|
650
|
+
}]
|
|
651
|
+
}] });
|
|
652
|
+
|
|
653
|
+
const PJC_CIDADE_SERVICE = new InjectionToken('PjcCidadeService');
|
|
654
|
+
|
|
655
|
+
class PjcCidadeFieldComponent {
|
|
656
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
657
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
658
|
+
placeholder = input('Digite o nome da cidade', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
659
|
+
id = input(`pjc-cidade-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
601
660
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
602
661
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
662
|
+
uf = input('', ...(ngDevMode ? [{ debugName: "uf" }] : /* istanbul ignore next */ []));
|
|
603
663
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
604
664
|
injector = inject(Injector);
|
|
605
665
|
cdr = inject(ChangeDetectorRef);
|
|
606
666
|
destroyRef = inject(DestroyRef);
|
|
607
667
|
ngControl = null;
|
|
608
|
-
|
|
609
|
-
|
|
668
|
+
service = inject(PJC_CIDADE_SERVICE, { optional: true }) ?? inject(PjcCidadeService);
|
|
669
|
+
municipios = signal([], ...(ngDevMode ? [{ debugName: "municipios" }] : /* istanbul ignore next */ []));
|
|
670
|
+
filteredMunicipios = signal([], ...(ngDevMode ? [{ debugName: "filteredMunicipios" }] : /* istanbul ignore next */ []));
|
|
671
|
+
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
672
|
+
value = null;
|
|
610
673
|
disabled = false;
|
|
611
|
-
rawValue = '';
|
|
612
674
|
onChange = () => { };
|
|
613
675
|
onTouched = () => { };
|
|
614
676
|
ngOnInit() {
|
|
@@ -620,10 +682,29 @@ class PjcCpfCnpjFieldComponent {
|
|
|
620
682
|
get errorMessage() {
|
|
621
683
|
return getErrorMessage(this.ngControl, this.erros());
|
|
622
684
|
}
|
|
685
|
+
constructor() {
|
|
686
|
+
effect(() => {
|
|
687
|
+
const uf = this.uf();
|
|
688
|
+
if (uf) {
|
|
689
|
+
this.fetchMunicipios(uf);
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
this.municipios.set([]);
|
|
693
|
+
this.filteredMunicipios.set([]);
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
623
697
|
writeValue(val) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
698
|
+
if (val === null || val === undefined) {
|
|
699
|
+
this.value = null;
|
|
700
|
+
}
|
|
701
|
+
else if (typeof val === 'string') {
|
|
702
|
+
const found = this.municipios().find(m => m.nome === val || m.descricao === val);
|
|
703
|
+
this.value = found ?? { id: 0, nome: val };
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
this.value = val;
|
|
707
|
+
}
|
|
627
708
|
}
|
|
628
709
|
registerOnChange(fn) {
|
|
629
710
|
this.onChange = fn;
|
|
@@ -634,89 +715,158 @@ class PjcCpfCnpjFieldComponent {
|
|
|
634
715
|
setDisabledState(isDisabled) {
|
|
635
716
|
this.disabled = isDisabled;
|
|
636
717
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
let newCursor = this.displayValue.length;
|
|
646
|
-
let digitCount = 0;
|
|
647
|
-
for (let i = 0; i < this.displayValue.length; i++) {
|
|
648
|
-
if (/\d/.test(this.displayValue[i]))
|
|
649
|
-
digitCount++;
|
|
650
|
-
if (digitCount === digitsBeforeCursor) {
|
|
651
|
-
newCursor = i + 1;
|
|
652
|
-
break;
|
|
653
|
-
}
|
|
718
|
+
onModelChange(value) {
|
|
719
|
+
if (typeof value === 'string') {
|
|
720
|
+
this.value = null;
|
|
721
|
+
this.onChange(null);
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
this.value = value;
|
|
725
|
+
this.onChange(value);
|
|
654
726
|
}
|
|
655
|
-
setTimeout(() => input.setSelectionRange(newCursor, newCursor));
|
|
656
727
|
}
|
|
657
728
|
onModelTouched() {
|
|
658
729
|
this.onTouched();
|
|
659
730
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
return '';
|
|
663
|
-
if (digits.length <= 11) {
|
|
664
|
-
return digits
|
|
665
|
-
.replace(/(\d{3})(\d)/, '$1.$2')
|
|
666
|
-
.replace(/(\d{3}\.\d{3})(\d)/, '$1.$2')
|
|
667
|
-
.replace(/(\d{3}\.\d{3}\.\d{3})(\d{1,2})/, '$1-$2');
|
|
668
|
-
}
|
|
669
|
-
return digits
|
|
670
|
-
.replace(/(\d{2})(\d)/, '$1.$2')
|
|
671
|
-
.replace(/(\d{2}\.\d{3})(\d)/, '$1.$2')
|
|
672
|
-
.replace(/(\d{2}\.\d{3}\.\d{3})(\d)/, '$1/$2')
|
|
673
|
-
.replace(/(\d{2}\.\d{3}\.\d{3}\/\d{4})(\d{1,2})/, '$1-$2');
|
|
731
|
+
getMunicipioDisplay(m) {
|
|
732
|
+
return m.nome || m.descricao || '';
|
|
674
733
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
734
|
+
filterMunicipios(event) {
|
|
735
|
+
const query = event.query.toLowerCase();
|
|
736
|
+
this.filteredMunicipios.set(this.municipios().filter(m => this.getMunicipioDisplay(m).toLowerCase().includes(query)));
|
|
737
|
+
}
|
|
738
|
+
fetchMunicipios(uf) {
|
|
739
|
+
this.loading.set(true);
|
|
740
|
+
const previousValue = this.value;
|
|
741
|
+
this.service.getMunicipiosByUf(uf).subscribe({
|
|
742
|
+
next: (data) => {
|
|
743
|
+
const normalized = data.map(m => ({ ...m, nome: m.nome || m.descricao || '' }));
|
|
744
|
+
this.municipios.set(normalized);
|
|
745
|
+
this.filteredMunicipios.set(normalized);
|
|
746
|
+
this.loading.set(false);
|
|
747
|
+
if (previousValue) {
|
|
748
|
+
const match = normalized.find(m => m.id === previousValue.id || m.nome === previousValue.nome);
|
|
749
|
+
if (match) {
|
|
750
|
+
this.value = match;
|
|
751
|
+
this.onChange(match);
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
this.value = null;
|
|
755
|
+
this.onChange(null);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
error: () => {
|
|
760
|
+
this.municipios.set([]);
|
|
761
|
+
this.filteredMunicipios.set([]);
|
|
762
|
+
this.loading.set(false);
|
|
763
|
+
this.value = null;
|
|
764
|
+
this.onChange(null);
|
|
765
|
+
},
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
769
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCidadeFieldComponent, isStandalone: true, selector: "pjc-cidade-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, uf: { classPropertyName: "uf", publicName: "uf", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
770
|
+
{
|
|
771
|
+
provide: NG_VALUE_ACCESSOR,
|
|
772
|
+
useExisting: forwardRef(() => PjcCidadeFieldComponent),
|
|
773
|
+
multi: true,
|
|
774
|
+
},
|
|
775
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-autocomplete\n [inputId]=\"id()\"\n [suggestions]=\"filteredMunicipios()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (completeMethod)=\"filterMunicipios($event)\"\n dataKey=\"id\"\n optionLabel=\"nome\"\n [forceSelection]=\"true\"\n [disabled]=\"disabled || readonly() || !uf() || loading()\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n >\n <ng-template pTemplate=\"item\" let-option>\n {{ getMunicipioDisplay(option) }}\n </ng-template>\n </p-autocomplete>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-autocomplete\n [inputId]=\"id()\"\n [suggestions]=\"filteredMunicipios()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (completeMethod)=\"filterMunicipios($event)\"\n dataKey=\"id\"\n optionLabel=\"nome\"\n [forceSelection]=\"true\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled || readonly() || !uf() || loading()\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n >\n <ng-template pTemplate=\"item\" let-option>\n {{ getMunicipioDisplay(option) }}\n </ng-template>\n </p-autocomplete>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AutoCompleteModule }, { kind: "component", type: i2$1.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "directive", type: i3$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
776
|
+
}
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeFieldComponent, decorators: [{
|
|
778
|
+
type: Component,
|
|
779
|
+
args: [{ selector: 'pjc-cidade-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, AutoCompleteModule, FloatLabelModule, MessageModule], providers: [
|
|
780
|
+
{
|
|
781
|
+
provide: NG_VALUE_ACCESSOR,
|
|
782
|
+
useExisting: forwardRef(() => PjcCidadeFieldComponent),
|
|
783
|
+
multi: true,
|
|
784
|
+
},
|
|
785
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-autocomplete\n [inputId]=\"id()\"\n [suggestions]=\"filteredMunicipios()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (completeMethod)=\"filterMunicipios($event)\"\n dataKey=\"id\"\n optionLabel=\"nome\"\n [forceSelection]=\"true\"\n [disabled]=\"disabled || readonly() || !uf() || loading()\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n >\n <ng-template pTemplate=\"item\" let-option>\n {{ getMunicipioDisplay(option) }}\n </ng-template>\n </p-autocomplete>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-autocomplete\n [inputId]=\"id()\"\n [suggestions]=\"filteredMunicipios()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n (completeMethod)=\"filterMunicipios($event)\"\n dataKey=\"id\"\n optionLabel=\"nome\"\n [forceSelection]=\"true\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled || readonly() || !uf() || loading()\"\n appendTo=\"body\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n >\n <ng-template pTemplate=\"item\" let-option>\n {{ getMunicipioDisplay(option) }}\n </ng-template>\n </p-autocomplete>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
786
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], uf: [{ type: i0.Input, args: [{ isSignal: true, alias: "uf", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
787
|
+
|
|
788
|
+
class PjcCnhFieldComponent {
|
|
789
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
790
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
791
|
+
placeholder = input('00000000000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
792
|
+
id = input(`pjc-cnh-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
793
|
+
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
794
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
795
|
+
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
796
|
+
injector = inject(Injector);
|
|
797
|
+
cdr = inject(ChangeDetectorRef);
|
|
798
|
+
destroyRef = inject(DestroyRef);
|
|
799
|
+
ngControl = null;
|
|
800
|
+
value = '';
|
|
801
|
+
disabled = false;
|
|
802
|
+
onChange = () => { };
|
|
803
|
+
onTouched = () => { };
|
|
804
|
+
ngOnInit() {
|
|
805
|
+
this.ngControl = initFormValidation(this.injector, this.cdr, this.destroyRef);
|
|
806
|
+
}
|
|
807
|
+
get invalid() {
|
|
808
|
+
return isFormControlInvalid(this.ngControl);
|
|
809
|
+
}
|
|
810
|
+
get errorMessage() {
|
|
811
|
+
return getErrorMessage(this.ngControl, this.erros());
|
|
812
|
+
}
|
|
813
|
+
writeValue(val) {
|
|
814
|
+
this.value = val ?? '';
|
|
815
|
+
}
|
|
816
|
+
registerOnChange(fn) {
|
|
817
|
+
this.onChange = fn;
|
|
818
|
+
}
|
|
819
|
+
registerOnTouched(fn) {
|
|
820
|
+
this.onTouched = fn;
|
|
821
|
+
}
|
|
822
|
+
setDisabledState(isDisabled) {
|
|
823
|
+
this.disabled = isDisabled;
|
|
824
|
+
}
|
|
825
|
+
onModelChange(value) {
|
|
826
|
+
this.value = value ?? '';
|
|
827
|
+
this.onChange(this.value);
|
|
828
|
+
}
|
|
829
|
+
onModelTouched() {
|
|
830
|
+
this.onTouched();
|
|
682
831
|
}
|
|
683
832
|
validate(control) {
|
|
684
|
-
return PjcValidators.
|
|
833
|
+
return PjcValidators.cnh()(control);
|
|
685
834
|
}
|
|
686
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
687
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
835
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnhFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
836
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCnhFieldComponent, isStandalone: true, selector: "pjc-cnh-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
688
837
|
{
|
|
689
838
|
provide: NG_VALUE_ACCESSOR,
|
|
690
|
-
useExisting: forwardRef(() =>
|
|
839
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
691
840
|
multi: true,
|
|
692
841
|
},
|
|
693
842
|
{
|
|
694
843
|
provide: NG_VALIDATORS,
|
|
695
|
-
useExisting: forwardRef(() =>
|
|
844
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
696
845
|
multi: true,
|
|
697
846
|
},
|
|
698
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
847
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
699
848
|
}
|
|
700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
849
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnhFieldComponent, decorators: [{
|
|
701
850
|
type: Component,
|
|
702
|
-
args: [{ selector: 'pjc-
|
|
851
|
+
args: [{ selector: 'pjc-cnh-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
703
852
|
{
|
|
704
853
|
provide: NG_VALUE_ACCESSOR,
|
|
705
|
-
useExisting: forwardRef(() =>
|
|
854
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
706
855
|
multi: true,
|
|
707
856
|
},
|
|
708
857
|
{
|
|
709
858
|
provide: NG_VALIDATORS,
|
|
710
|
-
useExisting: forwardRef(() =>
|
|
859
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
711
860
|
multi: true,
|
|
712
861
|
},
|
|
713
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
714
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
862
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
863
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
715
864
|
|
|
716
|
-
class
|
|
717
|
-
label = input('
|
|
718
|
-
|
|
719
|
-
|
|
865
|
+
class PjcCnpjFieldComponent {
|
|
866
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
867
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
868
|
+
placeholder = input('00.000.000/0000-00', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
869
|
+
id = input(`pjc-cnpj-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
720
870
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
721
871
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
722
872
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -738,7 +888,7 @@ class PjcPlacaFieldComponent {
|
|
|
738
888
|
return getErrorMessage(this.ngControl, this.erros());
|
|
739
889
|
}
|
|
740
890
|
writeValue(val) {
|
|
741
|
-
this.value = val
|
|
891
|
+
this.value = val ?? '';
|
|
742
892
|
}
|
|
743
893
|
registerOnChange(fn) {
|
|
744
894
|
this.onChange = fn;
|
|
@@ -749,46 +899,49 @@ class PjcPlacaFieldComponent {
|
|
|
749
899
|
setDisabledState(isDisabled) {
|
|
750
900
|
this.disabled = isDisabled;
|
|
751
901
|
}
|
|
752
|
-
onModelChange(
|
|
753
|
-
|
|
754
|
-
this.onChange(
|
|
902
|
+
onModelChange(value) {
|
|
903
|
+
this.value = value ?? '';
|
|
904
|
+
this.onChange(this.value);
|
|
905
|
+
}
|
|
906
|
+
onModelTouched() {
|
|
907
|
+
this.onTouched();
|
|
755
908
|
}
|
|
756
909
|
validate(control) {
|
|
757
|
-
return PjcValidators.
|
|
910
|
+
return PjcValidators.cnpj()(control);
|
|
758
911
|
}
|
|
759
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
760
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
912
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnpjFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
913
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCnpjFieldComponent, isStandalone: true, selector: "pjc-cnpj-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
761
914
|
{
|
|
762
915
|
provide: NG_VALUE_ACCESSOR,
|
|
763
|
-
useExisting: forwardRef(() =>
|
|
916
|
+
useExisting: forwardRef(() => PjcCnpjFieldComponent),
|
|
764
917
|
multi: true,
|
|
765
918
|
},
|
|
766
919
|
{
|
|
767
920
|
provide: NG_VALIDATORS,
|
|
768
|
-
useExisting: forwardRef(() =>
|
|
921
|
+
useExisting: forwardRef(() => PjcCnpjFieldComponent),
|
|
769
922
|
multi: true,
|
|
770
923
|
},
|
|
771
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"
|
|
924
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
772
925
|
}
|
|
773
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
926
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnpjFieldComponent, decorators: [{
|
|
774
927
|
type: Component,
|
|
775
|
-
args: [{ selector: 'pjc-
|
|
928
|
+
args: [{ selector: 'pjc-cnpj-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
776
929
|
{
|
|
777
930
|
provide: NG_VALUE_ACCESSOR,
|
|
778
|
-
useExisting: forwardRef(() =>
|
|
931
|
+
useExisting: forwardRef(() => PjcCnpjFieldComponent),
|
|
779
932
|
multi: true,
|
|
780
933
|
},
|
|
781
934
|
{
|
|
782
935
|
provide: NG_VALIDATORS,
|
|
783
|
-
useExisting: forwardRef(() =>
|
|
936
|
+
useExisting: forwardRef(() => PjcCnpjFieldComponent),
|
|
784
937
|
multi: true,
|
|
785
938
|
},
|
|
786
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"
|
|
787
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
939
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99.999.999/9999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
940
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
788
941
|
|
|
789
|
-
class
|
|
790
|
-
label = input('
|
|
791
|
-
id = input(`pjc-
|
|
942
|
+
class PjcCpfCnpjFieldComponent {
|
|
943
|
+
label = input('CPF/CNPJ', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
944
|
+
id = input(`pjc-cpf-cnpj-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
792
945
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
793
946
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
794
947
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -797,7 +950,7 @@ class PjcTelefoneFieldComponent {
|
|
|
797
950
|
destroyRef = inject(DestroyRef);
|
|
798
951
|
ngControl = null;
|
|
799
952
|
displayValue = '';
|
|
800
|
-
placeholder = '
|
|
953
|
+
placeholder = '000.000.000-00';
|
|
801
954
|
disabled = false;
|
|
802
955
|
rawValue = '';
|
|
803
956
|
onChange = () => { };
|
|
@@ -829,7 +982,7 @@ class PjcTelefoneFieldComponent {
|
|
|
829
982
|
const input = event.target;
|
|
830
983
|
const cursorPos = input.selectionStart ?? 0;
|
|
831
984
|
const digitsBeforeCursor = input.value.substring(0, cursorPos).replace(/\D/g, '').length;
|
|
832
|
-
this.rawValue = input.value.replaceAll(/\D/g, '').substring(0,
|
|
985
|
+
this.rawValue = input.value.replaceAll(/\D/g, '').substring(0, 14);
|
|
833
986
|
this.displayValue = this.formatValue(this.rawValue);
|
|
834
987
|
this.updatePlaceholder();
|
|
835
988
|
this.onChange(this.rawValue);
|
|
@@ -851,84 +1004,75 @@ class PjcTelefoneFieldComponent {
|
|
|
851
1004
|
formatValue(digits) {
|
|
852
1005
|
if (!digits)
|
|
853
1006
|
return '';
|
|
854
|
-
if (digits.length <=
|
|
855
|
-
// Fixo: (99) 9999-9999
|
|
1007
|
+
if (digits.length <= 11) {
|
|
856
1008
|
return digits
|
|
857
|
-
.replace(/(\d{
|
|
858
|
-
.replace(/(\
|
|
1009
|
+
.replace(/(\d{3})(\d)/, '$1.$2')
|
|
1010
|
+
.replace(/(\d{3}\.\d{3})(\d)/, '$1.$2')
|
|
1011
|
+
.replace(/(\d{3}\.\d{3}\.\d{3})(\d{1,2})/, '$1-$2');
|
|
859
1012
|
}
|
|
860
|
-
// Celular: (99) 99999-9999
|
|
861
1013
|
return digits
|
|
862
|
-
.replace(/(\d{2})(\d)/, '
|
|
863
|
-
.replace(/(\
|
|
1014
|
+
.replace(/(\d{2})(\d)/, '$1.$2')
|
|
1015
|
+
.replace(/(\d{2}\.\d{3})(\d)/, '$1.$2')
|
|
1016
|
+
.replace(/(\d{2}\.\d{3}\.\d{3})(\d)/, '$1/$2')
|
|
1017
|
+
.replace(/(\d{2}\.\d{3}\.\d{3}\/\d{4})(\d{1,2})/, '$1-$2');
|
|
864
1018
|
}
|
|
865
1019
|
updatePlaceholder() {
|
|
866
|
-
if (this.rawValue.length >
|
|
867
|
-
this.placeholder = '
|
|
1020
|
+
if (this.rawValue.length > 11) {
|
|
1021
|
+
this.placeholder = '00.000.000/0000-00';
|
|
868
1022
|
}
|
|
869
1023
|
else {
|
|
870
|
-
this.placeholder = '
|
|
1024
|
+
this.placeholder = '000.000.000-00';
|
|
871
1025
|
}
|
|
872
1026
|
}
|
|
873
1027
|
validate(control) {
|
|
874
|
-
return PjcValidators.
|
|
1028
|
+
return PjcValidators.cpfCnpj()(control);
|
|
875
1029
|
}
|
|
876
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
877
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
1030
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfCnpjFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1031
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCpfCnpjFieldComponent, isStandalone: true, selector: "pjc-cpf-cnpj-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
878
1032
|
{
|
|
879
1033
|
provide: NG_VALUE_ACCESSOR,
|
|
880
|
-
useExisting: forwardRef(() =>
|
|
1034
|
+
useExisting: forwardRef(() => PjcCpfCnpjFieldComponent),
|
|
881
1035
|
multi: true,
|
|
882
1036
|
},
|
|
883
1037
|
{
|
|
884
1038
|
provide: NG_VALIDATORS,
|
|
885
|
-
useExisting: forwardRef(() =>
|
|
1039
|
+
useExisting: forwardRef(() => PjcCpfCnpjFieldComponent),
|
|
886
1040
|
multi: true,
|
|
887
1041
|
},
|
|
888
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"
|
|
1042
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"18\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"18\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
889
1043
|
}
|
|
890
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfCnpjFieldComponent, decorators: [{
|
|
891
1045
|
type: Component,
|
|
892
|
-
args: [{ selector: 'pjc-
|
|
1046
|
+
args: [{ selector: 'pjc-cpf-cnpj-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, FloatLabelModule, InputTextModule, MessageModule], providers: [
|
|
893
1047
|
{
|
|
894
1048
|
provide: NG_VALUE_ACCESSOR,
|
|
895
|
-
useExisting: forwardRef(() =>
|
|
1049
|
+
useExisting: forwardRef(() => PjcCpfCnpjFieldComponent),
|
|
896
1050
|
multi: true,
|
|
897
1051
|
},
|
|
898
1052
|
{
|
|
899
1053
|
provide: NG_VALIDATORS,
|
|
900
|
-
useExisting: forwardRef(() =>
|
|
1054
|
+
useExisting: forwardRef(() => PjcCpfCnpjFieldComponent),
|
|
901
1055
|
multi: true,
|
|
902
1056
|
},
|
|
903
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"
|
|
1057
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"18\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"18\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
904
1058
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
905
1059
|
|
|
906
|
-
class
|
|
907
|
-
label = input('
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1060
|
+
class PjcCpfFieldComponent {
|
|
1061
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1062
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1063
|
+
placeholder = input('000.000.000-00', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1064
|
+
id = input(`pjc-cpf-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
911
1065
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
912
1066
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
913
|
-
mostrarAniversario = input(false, ...(ngDevMode ? [{ debugName: "mostrarAniversario" }] : /* istanbul ignore next */ []));
|
|
914
1067
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
915
|
-
value = null;
|
|
916
|
-
disabled = false;
|
|
917
|
-
valueSignal = signal(null, ...(ngDevMode ? [{ debugName: "valueSignal" }] : /* istanbul ignore next */ []));
|
|
918
|
-
age = computed(() => {
|
|
919
|
-
const date = this.valueSignal();
|
|
920
|
-
if (!date)
|
|
921
|
-
return null;
|
|
922
|
-
return this.calculateAge(date);
|
|
923
|
-
}, ...(ngDevMode ? [{ debugName: "age" }] : /* istanbul ignore next */ []));
|
|
924
|
-
onChange = () => { };
|
|
925
|
-
onTouched = () => { };
|
|
926
1068
|
injector = inject(Injector);
|
|
927
1069
|
cdr = inject(ChangeDetectorRef);
|
|
928
1070
|
destroyRef = inject(DestroyRef);
|
|
929
1071
|
ngControl = null;
|
|
930
|
-
|
|
931
|
-
|
|
1072
|
+
value = '';
|
|
1073
|
+
disabled = false;
|
|
1074
|
+
onChange = () => { };
|
|
1075
|
+
onTouched = () => { };
|
|
932
1076
|
ngOnInit() {
|
|
933
1077
|
this.ngControl = initFormValidation(this.injector, this.cdr, this.destroyRef);
|
|
934
1078
|
}
|
|
@@ -938,21 +1082,108 @@ class PjcDataFieldComponent {
|
|
|
938
1082
|
get errorMessage() {
|
|
939
1083
|
return getErrorMessage(this.ngControl, this.erros());
|
|
940
1084
|
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
if (input) {
|
|
944
|
-
input.addEventListener('input', this.handleDateInput);
|
|
945
|
-
}
|
|
1085
|
+
writeValue(val) {
|
|
1086
|
+
this.value = val ?? '';
|
|
946
1087
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
if (input) {
|
|
950
|
-
input.removeEventListener('input', this.handleDateInput);
|
|
951
|
-
}
|
|
1088
|
+
registerOnChange(fn) {
|
|
1089
|
+
this.onChange = fn;
|
|
952
1090
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1091
|
+
registerOnTouched(fn) {
|
|
1092
|
+
this.onTouched = fn;
|
|
1093
|
+
}
|
|
1094
|
+
setDisabledState(isDisabled) {
|
|
1095
|
+
this.disabled = isDisabled;
|
|
1096
|
+
}
|
|
1097
|
+
onModelChange(value) {
|
|
1098
|
+
this.value = value ?? '';
|
|
1099
|
+
this.onChange(this.value);
|
|
1100
|
+
}
|
|
1101
|
+
onModelTouched() {
|
|
1102
|
+
this.onTouched();
|
|
1103
|
+
}
|
|
1104
|
+
validate(control) {
|
|
1105
|
+
return PjcValidators.cpf()(control);
|
|
1106
|
+
}
|
|
1107
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1108
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCpfFieldComponent, isStandalone: true, selector: "pjc-cpf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1109
|
+
{
|
|
1110
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1111
|
+
useExisting: forwardRef(() => PjcCpfFieldComponent),
|
|
1112
|
+
multi: true,
|
|
1113
|
+
},
|
|
1114
|
+
{
|
|
1115
|
+
provide: NG_VALIDATORS,
|
|
1116
|
+
useExisting: forwardRef(() => PjcCpfFieldComponent),
|
|
1117
|
+
multi: true,
|
|
1118
|
+
},
|
|
1119
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1120
|
+
}
|
|
1121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfFieldComponent, decorators: [{
|
|
1122
|
+
type: Component,
|
|
1123
|
+
args: [{ selector: 'pjc-cpf-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
1124
|
+
{
|
|
1125
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1126
|
+
useExisting: forwardRef(() => PjcCpfFieldComponent),
|
|
1127
|
+
multi: true,
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
provide: NG_VALIDATORS,
|
|
1131
|
+
useExisting: forwardRef(() => PjcCpfFieldComponent),
|
|
1132
|
+
multi: true,
|
|
1133
|
+
},
|
|
1134
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999.999.999-99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1135
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1136
|
+
|
|
1137
|
+
class PjcDataFieldComponent {
|
|
1138
|
+
label = input('Data', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1139
|
+
id = input(`pjc-data-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1140
|
+
minDate = input(undefined, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
1141
|
+
maxDate = input(undefined, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
1142
|
+
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1143
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1144
|
+
mostrarAniversario = input(false, ...(ngDevMode ? [{ debugName: "mostrarAniversario" }] : /* istanbul ignore next */ []));
|
|
1145
|
+
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1146
|
+
value = null;
|
|
1147
|
+
disabled = false;
|
|
1148
|
+
valueSignal = signal(null, ...(ngDevMode ? [{ debugName: "valueSignal" }] : /* istanbul ignore next */ []));
|
|
1149
|
+
age = computed(() => {
|
|
1150
|
+
const date = this.valueSignal();
|
|
1151
|
+
if (!date)
|
|
1152
|
+
return null;
|
|
1153
|
+
return this.calculateAge(date);
|
|
1154
|
+
}, ...(ngDevMode ? [{ debugName: "age" }] : /* istanbul ignore next */ []));
|
|
1155
|
+
onChange = () => { };
|
|
1156
|
+
onTouched = () => { };
|
|
1157
|
+
injector = inject(Injector);
|
|
1158
|
+
cdr = inject(ChangeDetectorRef);
|
|
1159
|
+
destroyRef = inject(DestroyRef);
|
|
1160
|
+
ngControl = null;
|
|
1161
|
+
el = inject(ElementRef);
|
|
1162
|
+
isFormatting = false;
|
|
1163
|
+
ngOnInit() {
|
|
1164
|
+
this.ngControl = initFormValidation(this.injector, this.cdr, this.destroyRef);
|
|
1165
|
+
}
|
|
1166
|
+
get invalid() {
|
|
1167
|
+
return isFormControlInvalid(this.ngControl);
|
|
1168
|
+
}
|
|
1169
|
+
get errorMessage() {
|
|
1170
|
+
return getErrorMessage(this.ngControl, this.erros());
|
|
1171
|
+
}
|
|
1172
|
+
ngAfterViewInit() {
|
|
1173
|
+
const input = this.el.nativeElement.querySelector('input');
|
|
1174
|
+
if (input) {
|
|
1175
|
+
input.addEventListener('input', this.handleDateInput);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
ngOnDestroy() {
|
|
1179
|
+
const input = this.el.nativeElement.querySelector('input');
|
|
1180
|
+
if (input) {
|
|
1181
|
+
input.removeEventListener('input', this.handleDateInput);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
handleDateInput = (event) => {
|
|
1185
|
+
if (this.isFormatting)
|
|
1186
|
+
return;
|
|
956
1187
|
const input = event.target;
|
|
957
1188
|
const raw = input.value;
|
|
958
1189
|
const cursor = input.selectionStart ?? raw.length;
|
|
@@ -1034,7 +1265,7 @@ class PjcDataFieldComponent {
|
|
|
1034
1265
|
useExisting: forwardRef(() => PjcDataFieldComponent),
|
|
1035
1266
|
multi: true,
|
|
1036
1267
|
},
|
|
1037
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n placeholder=\"dd/mm/aaaa\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n }\n\n @if (mostrarAniversario() && age()) {\n <p class=\"text-xs text-surface-600\">Idade: {{ age() }} {{ age() === 1 ? 'ano' : 'anos' }}</p>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$
|
|
1268
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n placeholder=\"dd/mm/aaaa\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n }\n\n @if (mostrarAniversario() && age()) {\n <p class=\"text-xs text-surface-600\">Idade: {{ age() }} {{ age() === 1 ? 'ano' : 'anos' }}</p>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1038
1269
|
}
|
|
1039
1270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataFieldComponent, decorators: [{
|
|
1040
1271
|
type: Component,
|
|
@@ -1170,7 +1401,7 @@ class PjcDataHoraFieldComponent {
|
|
|
1170
1401
|
useExisting: forwardRef(() => PjcDataHoraFieldComponent),
|
|
1171
1402
|
multi: true,
|
|
1172
1403
|
},
|
|
1173
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$
|
|
1404
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2$2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1174
1405
|
}
|
|
1175
1406
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataHoraFieldComponent, decorators: [{
|
|
1176
1407
|
type: Component,
|
|
@@ -1188,9 +1419,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1188
1419
|
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-datePicker\n [inputId]=\"id()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n dateFormat=\"dd/mm/yy\"\n [showTime]=\"true\"\n [hourFormat]=\"'24'\"\n [showIcon]=\"true\"\n [showClear]=\"true\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabled]=\"disabled\"\n [readonlyInput]=\"readonly()\"\n placeholder=\"dd/mm/aaaa HH:MM\"\n appendTo=\"body\"\n class=\"w-full\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n ></p-datePicker>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1189
1420
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], minDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "minDate", required: false }] }], maxDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxDate", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1190
1421
|
|
|
1191
|
-
class
|
|
1192
|
-
label = input('
|
|
1193
|
-
|
|
1422
|
+
class PjcEmailFieldComponent {
|
|
1423
|
+
label = input('E-mail', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1424
|
+
placeholder = input('Digite o e-mail', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1425
|
+
id = input(`pjc-email-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1194
1426
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1195
1427
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1196
1428
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -1212,7 +1444,7 @@ class PjcHoraFieldComponent {
|
|
|
1212
1444
|
return getErrorMessage(this.ngControl, this.erros());
|
|
1213
1445
|
}
|
|
1214
1446
|
writeValue(val) {
|
|
1215
|
-
this.value = val ?? '';
|
|
1447
|
+
this.value = val?.toLowerCase() ?? '';
|
|
1216
1448
|
}
|
|
1217
1449
|
registerOnChange(fn) {
|
|
1218
1450
|
this.onChange = fn;
|
|
@@ -1223,58 +1455,101 @@ class PjcHoraFieldComponent {
|
|
|
1223
1455
|
setDisabledState(isDisabled) {
|
|
1224
1456
|
this.disabled = isDisabled;
|
|
1225
1457
|
}
|
|
1226
|
-
onModelChange(value) {
|
|
1227
|
-
this.value = value ?? '';
|
|
1228
|
-
this.onChange(this.value);
|
|
1229
|
-
}
|
|
1230
|
-
onModelTouched() {
|
|
1231
|
-
this.onTouched();
|
|
1232
|
-
}
|
|
1233
1458
|
validate(control) {
|
|
1234
|
-
return PjcValidators.
|
|
1459
|
+
return PjcValidators.email()(control);
|
|
1235
1460
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1461
|
+
onInput(event) {
|
|
1462
|
+
const lower = event.target.value.toLowerCase();
|
|
1463
|
+
this.value = lower;
|
|
1464
|
+
this.onChange(lower);
|
|
1465
|
+
}
|
|
1466
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEmailFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1467
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcEmailFieldComponent, isStandalone: true, selector: "pjc-email-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1238
1468
|
{
|
|
1239
1469
|
provide: NG_VALUE_ACCESSOR,
|
|
1240
|
-
useExisting: forwardRef(() =>
|
|
1470
|
+
useExisting: forwardRef(() => PjcEmailFieldComponent),
|
|
1241
1471
|
multi: true,
|
|
1242
1472
|
},
|
|
1243
1473
|
{
|
|
1244
1474
|
provide: NG_VALIDATORS,
|
|
1245
|
-
useExisting: forwardRef(() =>
|
|
1475
|
+
useExisting: forwardRef(() => PjcEmailFieldComponent),
|
|
1246
1476
|
multi: true,
|
|
1247
1477
|
},
|
|
1248
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1478
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1249
1479
|
}
|
|
1250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1480
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEmailFieldComponent, decorators: [{
|
|
1251
1481
|
type: Component,
|
|
1252
|
-
args: [{ selector: 'pjc-
|
|
1482
|
+
args: [{ selector: 'pjc-email-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputTextModule, FloatLabelModule, MessageModule], providers: [
|
|
1253
1483
|
{
|
|
1254
1484
|
provide: NG_VALUE_ACCESSOR,
|
|
1255
|
-
useExisting: forwardRef(() =>
|
|
1485
|
+
useExisting: forwardRef(() => PjcEmailFieldComponent),
|
|
1256
1486
|
multi: true,
|
|
1257
1487
|
},
|
|
1258
1488
|
{
|
|
1259
1489
|
provide: NG_VALIDATORS,
|
|
1260
|
-
useExisting: forwardRef(() =>
|
|
1490
|
+
useExisting: forwardRef(() => PjcEmailFieldComponent),
|
|
1261
1491
|
multi: true,
|
|
1262
1492
|
},
|
|
1263
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1264
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1493
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n type=\"email\"\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1494
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1265
1495
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1496
|
+
const PJC_ENUM_SERVICE = new InjectionToken('PjcEnumService');
|
|
1497
|
+
|
|
1498
|
+
class PjcEnumService {
|
|
1499
|
+
http = inject(HttpClient);
|
|
1500
|
+
getItems(url) {
|
|
1501
|
+
return this.http
|
|
1502
|
+
.get(url)
|
|
1503
|
+
.pipe(map((data) => data
|
|
1504
|
+
.map((item) => ({ nome: item.nome, descricao: item.descricao }))
|
|
1505
|
+
.sort((a, b) => {
|
|
1506
|
+
const aDisplay = a.descricao || a.nome || '';
|
|
1507
|
+
const bDisplay = b.descricao || b.nome || '';
|
|
1508
|
+
return aDisplay.localeCompare(bDisplay);
|
|
1509
|
+
})));
|
|
1510
|
+
}
|
|
1511
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEnumService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1512
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEnumService, providedIn: 'root' });
|
|
1513
|
+
}
|
|
1514
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEnumService, decorators: [{
|
|
1515
|
+
type: Injectable,
|
|
1516
|
+
args: [{
|
|
1517
|
+
providedIn: 'root',
|
|
1518
|
+
}]
|
|
1519
|
+
}] });
|
|
1520
|
+
|
|
1521
|
+
class PjcEnumFieldComponent {
|
|
1522
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1523
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1524
|
+
placeholder = input('Selecione uma opção', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1525
|
+
id = input(`pjc-enum-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1270
1526
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1271
1527
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1272
1528
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1529
|
+
/** URL of the endpoint that returns the list of items. */
|
|
1530
|
+
url = input.required(...(ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []));
|
|
1531
|
+
/**
|
|
1532
|
+
* Key of the object property displayed as the option label in the select.
|
|
1533
|
+
* Defaults to 'descricao'.
|
|
1534
|
+
*/
|
|
1535
|
+
optionLabel = input('descricao', ...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
1536
|
+
/**
|
|
1537
|
+
* Key of the object property used as the option value bound to the formControl.
|
|
1538
|
+
* When left as undefined (default), the entire selected object is used as the value.
|
|
1539
|
+
*/
|
|
1540
|
+
optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
1541
|
+
/** Whether the select should have a filter/search input. */
|
|
1542
|
+
filter = input(false, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
1543
|
+
/** Whether to show a clear button to reset the selection. */
|
|
1544
|
+
showClear = input(false, ...(ngDevMode ? [{ debugName: "showClear" }] : /* istanbul ignore next */ []));
|
|
1273
1545
|
injector = inject(Injector);
|
|
1274
1546
|
cdr = inject(ChangeDetectorRef);
|
|
1275
1547
|
destroyRef = inject(DestroyRef);
|
|
1276
1548
|
ngControl = null;
|
|
1277
|
-
|
|
1549
|
+
service = inject(PJC_ENUM_SERVICE, { optional: true }) ?? inject(PjcEnumService);
|
|
1550
|
+
items = signal([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
1551
|
+
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1552
|
+
value = null;
|
|
1278
1553
|
disabled = false;
|
|
1279
1554
|
onChange = () => { };
|
|
1280
1555
|
onTouched = () => { };
|
|
@@ -1287,13 +1562,19 @@ class PjcUppercaseFieldComponent {
|
|
|
1287
1562
|
get errorMessage() {
|
|
1288
1563
|
return getErrorMessage(this.ngControl, this.erros());
|
|
1289
1564
|
}
|
|
1565
|
+
constructor() {
|
|
1566
|
+
effect(() => {
|
|
1567
|
+
const url = this.url();
|
|
1568
|
+
if (url) {
|
|
1569
|
+
this.fetchItems(url);
|
|
1570
|
+
}
|
|
1571
|
+
else {
|
|
1572
|
+
this.items.set([]);
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1290
1576
|
writeValue(val) {
|
|
1291
|
-
|
|
1292
|
-
this.value.set('');
|
|
1293
|
-
}
|
|
1294
|
-
else {
|
|
1295
|
-
this.value.set(String(val).toUpperCase());
|
|
1296
|
-
}
|
|
1577
|
+
this.value = val ?? null;
|
|
1297
1578
|
}
|
|
1298
1579
|
registerOnChange(fn) {
|
|
1299
1580
|
this.onChange = fn;
|
|
@@ -1304,41 +1585,80 @@ class PjcUppercaseFieldComponent {
|
|
|
1304
1585
|
setDisabledState(isDisabled) {
|
|
1305
1586
|
this.disabled = isDisabled;
|
|
1306
1587
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
this.value
|
|
1310
|
-
this.onChange(upper);
|
|
1588
|
+
onModelChange(value) {
|
|
1589
|
+
this.value = value;
|
|
1590
|
+
this.onChange(value);
|
|
1311
1591
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1592
|
+
onModelTouched() {
|
|
1593
|
+
this.onTouched();
|
|
1594
|
+
}
|
|
1595
|
+
fetchItems(url) {
|
|
1596
|
+
this.loading.set(true);
|
|
1597
|
+
this.service.getItems(url).subscribe({
|
|
1598
|
+
next: (data) => {
|
|
1599
|
+
this.items.set(data);
|
|
1600
|
+
this.loading.set(false);
|
|
1601
|
+
this.cdr.markForCheck();
|
|
1602
|
+
},
|
|
1603
|
+
error: () => {
|
|
1604
|
+
this.items.set([]);
|
|
1605
|
+
this.loading.set(false);
|
|
1606
|
+
this.value = null;
|
|
1607
|
+
this.onChange(null);
|
|
1608
|
+
this.cdr.markForCheck();
|
|
1609
|
+
},
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEnumFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1613
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcEnumFieldComponent, isStandalone: true, selector: "pjc-enum-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null }, url: { classPropertyName: "url", publicName: "url", isSignal: true, isRequired: true, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, showClear: { classPropertyName: "showClear", publicName: "showClear", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1314
1614
|
{
|
|
1315
1615
|
provide: NG_VALUE_ACCESSOR,
|
|
1316
|
-
useExisting: forwardRef(() =>
|
|
1616
|
+
useExisting: forwardRef(() => PjcEnumFieldComponent),
|
|
1317
1617
|
multi: true,
|
|
1318
1618
|
},
|
|
1319
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1619
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"items()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n appendTo=\"body\"\n [filter]=\"filter()\"\n [showClear]=\"showClear()\"\n [disabled]=\"disabled || readonly() || loading()\"\n [loading]=\"loading()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"items()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n appendTo=\"body\"\n [filter]=\"filter()\"\n [showClear]=\"showClear()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled || readonly() || loading()\"\n [loading]=\"loading()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1320
1620
|
}
|
|
1321
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1621
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEnumFieldComponent, decorators: [{
|
|
1322
1622
|
type: Component,
|
|
1323
|
-
args: [{ selector: 'pjc-
|
|
1623
|
+
args: [{ selector: 'pjc-enum-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule, MessageModule], providers: [
|
|
1324
1624
|
{
|
|
1325
1625
|
provide: NG_VALUE_ACCESSOR,
|
|
1326
|
-
useExisting: forwardRef(() =>
|
|
1626
|
+
useExisting: forwardRef(() => PjcEnumFieldComponent),
|
|
1327
1627
|
multi: true,
|
|
1328
1628
|
},
|
|
1329
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1330
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1629
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"items()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n appendTo=\"body\"\n [filter]=\"filter()\"\n [showClear]=\"showClear()\"\n [disabled]=\"disabled || readonly() || loading()\"\n [loading]=\"loading()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"items()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [optionLabel]=\"optionLabel()\"\n [optionValue]=\"optionValue()\"\n appendTo=\"body\"\n [filter]=\"filter()\"\n [showClear]=\"showClear()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled || readonly() || loading()\"\n [loading]=\"loading()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1630
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }], url: [{ type: i0.Input, args: [{ isSignal: true, alias: "url", required: true }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], showClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClear", required: false }] }] } });
|
|
1331
1631
|
|
|
1332
|
-
class
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1632
|
+
class PjcErroValidacaoComponent {
|
|
1633
|
+
container = inject(ControlContainer);
|
|
1634
|
+
cdr = inject(ChangeDetectorRef);
|
|
1635
|
+
destroyRef = inject(DestroyRef);
|
|
1636
|
+
controlName = input.required(...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
1637
|
+
erros = input.required(...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1638
|
+
control = null;
|
|
1639
|
+
ngOnInit() {
|
|
1640
|
+
const group = this.container.control;
|
|
1641
|
+
this.control = group?.get(this.controlName()) ?? null;
|
|
1642
|
+
if (this.control) {
|
|
1643
|
+
this.control.events
|
|
1644
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1645
|
+
.subscribe(() => this.cdr.markForCheck());
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcErroValidacaoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1649
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcErroValidacaoComponent, isStandalone: true, selector: "pjc-erro-validacao", inputs: { controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: true, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (control; as ctrl) {\n @if (ctrl.touched && ctrl.errors) {\n @for (entry of erros() | keyvalue; track entry.key) {\n @if (ctrl.errors[entry.key]) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ entry.value }}</p-message>\n }\n }\n }\n}\n", dependencies: [{ kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1650
|
+
}
|
|
1651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcErroValidacaoComponent, decorators: [{
|
|
1652
|
+
type: Component,
|
|
1653
|
+
args: [{ selector: 'pjc-erro-validacao', changeDetection: ChangeDetectionStrategy.OnPush, imports: [KeyValuePipe, MessageModule], template: "@if (control; as ctrl) {\n @if (ctrl.touched && ctrl.errors) {\n @for (entry of erros() | keyvalue; track entry.key) {\n @if (ctrl.errors[entry.key]) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ entry.value }}</p-message>\n }\n }\n }\n}\n" }]
|
|
1654
|
+
}], propDecorators: { controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: true }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: true }] }] } });
|
|
1655
|
+
|
|
1656
|
+
class PjcHoraFieldComponent {
|
|
1657
|
+
label = input('Hora', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1658
|
+
id = input(`pjc-hora-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1337
1659
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1338
1660
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1339
|
-
showSearchButton = input(true, ...(ngDevMode ? [{ debugName: "showSearchButton" }] : /* istanbul ignore next */ []));
|
|
1340
1661
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1341
|
-
busca = output();
|
|
1342
1662
|
injector = inject(Injector);
|
|
1343
1663
|
cdr = inject(ChangeDetectorRef);
|
|
1344
1664
|
destroyRef = inject(DestroyRef);
|
|
@@ -1375,82 +1695,44 @@ class PjcCepFieldComponent {
|
|
|
1375
1695
|
onModelTouched() {
|
|
1376
1696
|
this.onTouched();
|
|
1377
1697
|
}
|
|
1378
|
-
onComplete() {
|
|
1379
|
-
this.busca.emit(this.value);
|
|
1380
|
-
}
|
|
1381
|
-
onSearch() {
|
|
1382
|
-
if (this.value?.length === 8) {
|
|
1383
|
-
this.busca.emit(this.value);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
1698
|
validate(control) {
|
|
1387
|
-
return PjcValidators.
|
|
1699
|
+
return PjcValidators.hora()(control);
|
|
1388
1700
|
}
|
|
1389
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1390
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
1701
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcHoraFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1702
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcHoraFieldComponent, isStandalone: true, selector: "pjc-hora-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1391
1703
|
{
|
|
1392
1704
|
provide: NG_VALUE_ACCESSOR,
|
|
1393
|
-
useExisting: forwardRef(() =>
|
|
1705
|
+
useExisting: forwardRef(() => PjcHoraFieldComponent),
|
|
1394
1706
|
multi: true,
|
|
1395
1707
|
},
|
|
1396
1708
|
{
|
|
1397
1709
|
provide: NG_VALIDATORS,
|
|
1398
|
-
useExisting: forwardRef(() =>
|
|
1710
|
+
useExisting: forwardRef(() => PjcHoraFieldComponent),
|
|
1399
1711
|
multi: true,
|
|
1400
1712
|
},
|
|
1401
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-
|
|
1713
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99:99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n placeholder=\"HH:MM\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99:99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n placeholder=\"HH:MM\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1402
1714
|
}
|
|
1403
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1715
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcHoraFieldComponent, decorators: [{
|
|
1404
1716
|
type: Component,
|
|
1405
|
-
args: [{ selector: 'pjc-
|
|
1717
|
+
args: [{ selector: 'pjc-hora-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
1406
1718
|
{
|
|
1407
1719
|
provide: NG_VALUE_ACCESSOR,
|
|
1408
|
-
useExisting: forwardRef(() =>
|
|
1720
|
+
useExisting: forwardRef(() => PjcHoraFieldComponent),
|
|
1409
1721
|
multi: true,
|
|
1410
1722
|
},
|
|
1411
1723
|
{
|
|
1412
1724
|
provide: NG_VALIDATORS,
|
|
1413
|
-
useExisting: forwardRef(() =>
|
|
1725
|
+
useExisting: forwardRef(() => PjcHoraFieldComponent),
|
|
1414
1726
|
multi: true,
|
|
1415
1727
|
},
|
|
1416
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-
|
|
1417
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }],
|
|
1418
|
-
|
|
1419
|
-
const ESTADOS = [
|
|
1420
|
-
{ uf: 'MT', descricao: 'Mato Grosso' },
|
|
1421
|
-
{ uf: 'AC', descricao: 'Acre' },
|
|
1422
|
-
{ uf: 'AL', descricao: 'Alagoas' },
|
|
1423
|
-
{ uf: 'AP', descricao: 'Amapá' },
|
|
1424
|
-
{ uf: 'AM', descricao: 'Amazonas' },
|
|
1425
|
-
{ uf: 'BA', descricao: 'Bahia' },
|
|
1426
|
-
{ uf: 'CE', descricao: 'Ceará' },
|
|
1427
|
-
{ uf: 'DF', descricao: 'Distrito Federal' },
|
|
1428
|
-
{ uf: 'ES', descricao: 'Espírito Santo' },
|
|
1429
|
-
{ uf: 'GO', descricao: 'Goiás' },
|
|
1430
|
-
{ uf: 'MA', descricao: 'Maranhão' },
|
|
1431
|
-
{ uf: 'MS', descricao: 'Mato Grosso do Sul' },
|
|
1432
|
-
{ uf: 'MG', descricao: 'Minas Gerais' },
|
|
1433
|
-
{ uf: 'PA', descricao: 'Pará' },
|
|
1434
|
-
{ uf: 'PB', descricao: 'Paraíba' },
|
|
1435
|
-
{ uf: 'PR', descricao: 'Paraná' },
|
|
1436
|
-
{ uf: 'PE', descricao: 'Pernambuco' },
|
|
1437
|
-
{ uf: 'PI', descricao: 'Piauí' },
|
|
1438
|
-
{ uf: 'RJ', descricao: 'Rio de Janeiro' },
|
|
1439
|
-
{ uf: 'RN', descricao: 'Rio Grande do Norte' },
|
|
1440
|
-
{ uf: 'RS', descricao: 'Rio Grande do Sul' },
|
|
1441
|
-
{ uf: 'RO', descricao: 'Rondônia' },
|
|
1442
|
-
{ uf: 'RR', descricao: 'Roraima' },
|
|
1443
|
-
{ uf: 'SC', descricao: 'Santa Catarina' },
|
|
1444
|
-
{ uf: 'SP', descricao: 'São Paulo' },
|
|
1445
|
-
{ uf: 'SE', descricao: 'Sergipe' },
|
|
1446
|
-
{ uf: 'TO', descricao: 'Tocantins' },
|
|
1447
|
-
];
|
|
1728
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99:99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n placeholder=\"HH:MM\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99:99\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n placeholder=\"HH:MM\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1729
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1448
1730
|
|
|
1449
|
-
class
|
|
1450
|
-
label = input('
|
|
1731
|
+
class PjcImeiFieldComponent {
|
|
1732
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1451
1733
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1452
|
-
placeholder = input('
|
|
1453
|
-
id = input(`pjc-
|
|
1734
|
+
placeholder = input('000000000000000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1735
|
+
id = input(`pjc-imei-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1454
1736
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1455
1737
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1456
1738
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -1458,8 +1740,7 @@ class PjcUfFieldComponent {
|
|
|
1458
1740
|
cdr = inject(ChangeDetectorRef);
|
|
1459
1741
|
destroyRef = inject(DestroyRef);
|
|
1460
1742
|
ngControl = null;
|
|
1461
|
-
|
|
1462
|
-
value = null;
|
|
1743
|
+
value = '';
|
|
1463
1744
|
disabled = false;
|
|
1464
1745
|
onChange = () => { };
|
|
1465
1746
|
onTouched = () => { };
|
|
@@ -1473,7 +1754,7 @@ class PjcUfFieldComponent {
|
|
|
1473
1754
|
return getErrorMessage(this.ngControl, this.erros());
|
|
1474
1755
|
}
|
|
1475
1756
|
writeValue(val) {
|
|
1476
|
-
this.value = val
|
|
1757
|
+
this.value = val ?? '';
|
|
1477
1758
|
}
|
|
1478
1759
|
registerOnChange(fn) {
|
|
1479
1760
|
this.onChange = fn;
|
|
@@ -1485,105 +1766,44 @@ class PjcUfFieldComponent {
|
|
|
1485
1766
|
this.disabled = isDisabled;
|
|
1486
1767
|
}
|
|
1487
1768
|
onModelChange(value) {
|
|
1488
|
-
this.value = value;
|
|
1489
|
-
this.onChange(value);
|
|
1769
|
+
this.value = value ?? '';
|
|
1770
|
+
this.onChange(this.value);
|
|
1490
1771
|
}
|
|
1491
1772
|
onModelTouched() {
|
|
1492
1773
|
this.onTouched();
|
|
1493
1774
|
}
|
|
1494
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1495
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcUfFieldComponent, isStandalone: true, selector: "pjc-uf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1496
|
-
{
|
|
1497
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1498
|
-
useExisting: forwardRef(() => PjcUfFieldComponent),
|
|
1499
|
-
multi: true,
|
|
1500
|
-
},
|
|
1501
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$2.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1502
|
-
}
|
|
1503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, decorators: [{
|
|
1504
|
-
type: Component,
|
|
1505
|
-
args: [{ selector: 'pjc-uf-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule, MessageModule], providers: [
|
|
1506
|
-
{
|
|
1507
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1508
|
-
useExisting: forwardRef(() => PjcUfFieldComponent),
|
|
1509
|
-
multi: true,
|
|
1510
|
-
},
|
|
1511
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1512
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1513
|
-
|
|
1514
|
-
class PjcEmailFieldComponent {
|
|
1515
|
-
label = input('E-mail', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1516
|
-
placeholder = input('Digite o e-mail', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1517
|
-
id = input(`pjc-email-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1518
|
-
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1519
|
-
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1520
|
-
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1521
|
-
injector = inject(Injector);
|
|
1522
|
-
cdr = inject(ChangeDetectorRef);
|
|
1523
|
-
destroyRef = inject(DestroyRef);
|
|
1524
|
-
ngControl = null;
|
|
1525
|
-
value = '';
|
|
1526
|
-
disabled = false;
|
|
1527
|
-
onChange = () => { };
|
|
1528
|
-
onTouched = () => { };
|
|
1529
|
-
ngOnInit() {
|
|
1530
|
-
this.ngControl = initFormValidation(this.injector, this.cdr, this.destroyRef);
|
|
1531
|
-
}
|
|
1532
|
-
get invalid() {
|
|
1533
|
-
return isFormControlInvalid(this.ngControl);
|
|
1534
|
-
}
|
|
1535
|
-
get errorMessage() {
|
|
1536
|
-
return getErrorMessage(this.ngControl, this.erros());
|
|
1537
|
-
}
|
|
1538
|
-
writeValue(val) {
|
|
1539
|
-
this.value = val?.toLowerCase() ?? '';
|
|
1540
|
-
}
|
|
1541
|
-
registerOnChange(fn) {
|
|
1542
|
-
this.onChange = fn;
|
|
1543
|
-
}
|
|
1544
|
-
registerOnTouched(fn) {
|
|
1545
|
-
this.onTouched = fn;
|
|
1546
|
-
}
|
|
1547
|
-
setDisabledState(isDisabled) {
|
|
1548
|
-
this.disabled = isDisabled;
|
|
1549
|
-
}
|
|
1550
1775
|
validate(control) {
|
|
1551
|
-
return PjcValidators.
|
|
1552
|
-
}
|
|
1553
|
-
onInput(event) {
|
|
1554
|
-
const lower = event.target.value.toLowerCase();
|
|
1555
|
-
this.value = lower;
|
|
1556
|
-
this.onChange(lower);
|
|
1776
|
+
return PjcValidators.imei()(control);
|
|
1557
1777
|
}
|
|
1558
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1559
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
1778
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcImeiFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1779
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcImeiFieldComponent, isStandalone: true, selector: "pjc-imei-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1560
1780
|
{
|
|
1561
1781
|
provide: NG_VALUE_ACCESSOR,
|
|
1562
|
-
useExisting: forwardRef(() =>
|
|
1782
|
+
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1563
1783
|
multi: true,
|
|
1564
1784
|
},
|
|
1565
1785
|
{
|
|
1566
1786
|
provide: NG_VALIDATORS,
|
|
1567
|
-
useExisting: forwardRef(() =>
|
|
1787
|
+
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1568
1788
|
multi: true,
|
|
1569
1789
|
},
|
|
1570
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1790
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999999999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999999999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1571
1791
|
}
|
|
1572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcImeiFieldComponent, decorators: [{
|
|
1573
1793
|
type: Component,
|
|
1574
|
-
args: [{ selector: 'pjc-
|
|
1794
|
+
args: [{ selector: 'pjc-imei-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
1575
1795
|
{
|
|
1576
1796
|
provide: NG_VALUE_ACCESSOR,
|
|
1577
|
-
useExisting: forwardRef(() =>
|
|
1797
|
+
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1578
1798
|
multi: true,
|
|
1579
1799
|
},
|
|
1580
1800
|
{
|
|
1581
1801
|
provide: NG_VALIDATORS,
|
|
1582
|
-
useExisting: forwardRef(() =>
|
|
1802
|
+
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1583
1803
|
multi: true,
|
|
1584
1804
|
},
|
|
1585
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1586
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1805
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"999999999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"999999999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1806
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1587
1807
|
|
|
1588
1808
|
class PjcIntegerFieldComponent {
|
|
1589
1809
|
label = input('Número', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -1637,7 +1857,7 @@ class PjcIntegerFieldComponent {
|
|
|
1637
1857
|
useExisting: forwardRef(() => PjcIntegerFieldComponent),
|
|
1638
1858
|
multi: true,
|
|
1639
1859
|
},
|
|
1640
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i2$
|
|
1860
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i2$4.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1641
1861
|
}
|
|
1642
1862
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcIntegerFieldComponent, decorators: [{
|
|
1643
1863
|
type: Component,
|
|
@@ -1650,19 +1870,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1650
1870
|
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputnumber\n [inputId]=\"id()\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (onBlur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [useGrouping]=\"useGrouping()\"\n [prefix]=\"prefix()\"\n [suffix]=\"suffix()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [disabled]=\"disabled\"\n [maxFractionDigits]=\"0\"\n inputStyleClass=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n styleClass=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1651
1871
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], prefix: [{ type: i0.Input, args: [{ isSignal: true, alias: "prefix", required: false }] }], suffix: [{ type: i0.Input, args: [{ isSignal: true, alias: "suffix", required: false }] }], useGrouping: [{ type: i0.Input, args: [{ isSignal: true, alias: "useGrouping", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1652
1872
|
|
|
1653
|
-
class
|
|
1873
|
+
class PjcMoedaFieldComponent {
|
|
1654
1874
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1655
1875
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1656
|
-
|
|
1657
|
-
id = input(`pjc-imei-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1876
|
+
id = input(`pjc-moeda-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1658
1877
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1878
|
+
mode = input('currency', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1879
|
+
currency = input('BRL', ...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
1880
|
+
locale = input('pt-BR', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
1881
|
+
minFractionDigits = input(2, ...(ngDevMode ? [{ debugName: "minFractionDigits" }] : /* istanbul ignore next */ []));
|
|
1882
|
+
maxFractionDigits = input(2, ...(ngDevMode ? [{ debugName: "maxFractionDigits" }] : /* istanbul ignore next */ []));
|
|
1659
1883
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1660
1884
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
1661
1885
|
injector = inject(Injector);
|
|
1662
1886
|
cdr = inject(ChangeDetectorRef);
|
|
1663
1887
|
destroyRef = inject(DestroyRef);
|
|
1664
1888
|
ngControl = null;
|
|
1665
|
-
|
|
1889
|
+
divisor = computed(() => Math.pow(10, this.minFractionDigits()), ...(ngDevMode ? [{ debugName: "divisor" }] : /* istanbul ignore next */ []));
|
|
1890
|
+
cents = signal(0, ...(ngDevMode ? [{ debugName: "cents" }] : /* istanbul ignore next */ []));
|
|
1891
|
+
displayValue = computed(() => {
|
|
1892
|
+
const value = this.cents() / this.divisor();
|
|
1893
|
+
return new Intl.NumberFormat(this.locale(), {
|
|
1894
|
+
style: this.mode() === 'currency' ? 'currency' : 'decimal',
|
|
1895
|
+
currency: this.mode() === 'currency' ? this.currency() : undefined,
|
|
1896
|
+
minimumFractionDigits: this.minFractionDigits(),
|
|
1897
|
+
maximumFractionDigits: this.maxFractionDigits(),
|
|
1898
|
+
}).format(value);
|
|
1899
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
1666
1900
|
disabled = false;
|
|
1667
1901
|
onChange = () => { };
|
|
1668
1902
|
onTouched = () => { };
|
|
@@ -1675,8 +1909,41 @@ class PjcImeiFieldComponent {
|
|
|
1675
1909
|
get errorMessage() {
|
|
1676
1910
|
return getErrorMessage(this.ngControl, this.erros());
|
|
1677
1911
|
}
|
|
1912
|
+
onKeyDown(event) {
|
|
1913
|
+
if (this.disabled || this.readonly())
|
|
1914
|
+
return;
|
|
1915
|
+
if (/^\d$/.test(event.key)) {
|
|
1916
|
+
event.preventDefault();
|
|
1917
|
+
if (this.cents() < 9_999_999_999) {
|
|
1918
|
+
this.cents.update(c => c * 10 + Number.parseInt(event.key, 10));
|
|
1919
|
+
this.emitValue();
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
else if (event.key === 'Backspace') {
|
|
1923
|
+
event.preventDefault();
|
|
1924
|
+
this.cents.update(c => Math.floor(c / 10));
|
|
1925
|
+
this.emitValue();
|
|
1926
|
+
}
|
|
1927
|
+
else if (event.key === 'Delete') {
|
|
1928
|
+
event.preventDefault();
|
|
1929
|
+
this.cents.set(0);
|
|
1930
|
+
this.emitValue();
|
|
1931
|
+
}
|
|
1932
|
+
else if (event.key.length === 1) {
|
|
1933
|
+
// Block all other printable characters (letters, symbols, etc.)
|
|
1934
|
+
event.preventDefault();
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
onPaste(event) {
|
|
1938
|
+
event.preventDefault();
|
|
1939
|
+
}
|
|
1940
|
+
emitValue() {
|
|
1941
|
+
const value = this.cents() === 0 ? null : this.cents() / this.divisor();
|
|
1942
|
+
this.onChange(value);
|
|
1943
|
+
}
|
|
1678
1944
|
writeValue(val) {
|
|
1679
|
-
|
|
1945
|
+
const cents = val == null ? 0 : Math.round(val * this.divisor());
|
|
1946
|
+
this.cents.set(cents);
|
|
1680
1947
|
}
|
|
1681
1948
|
registerOnChange(fn) {
|
|
1682
1949
|
this.onChange = fn;
|
|
@@ -1687,45 +1954,25 @@ class PjcImeiFieldComponent {
|
|
|
1687
1954
|
setDisabledState(isDisabled) {
|
|
1688
1955
|
this.disabled = isDisabled;
|
|
1689
1956
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
this.onChange(this.value);
|
|
1693
|
-
}
|
|
1694
|
-
onModelTouched() {
|
|
1695
|
-
this.onTouched();
|
|
1696
|
-
}
|
|
1697
|
-
validate(control) {
|
|
1698
|
-
return PjcValidators.imei()(control);
|
|
1699
|
-
}
|
|
1700
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcImeiFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1701
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcImeiFieldComponent, isStandalone: true, selector: "pjc-imei-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1957
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcMoedaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1958
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcMoedaFieldComponent, isStandalone: true, selector: "pjc-moeda-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, minFractionDigits: { classPropertyName: "minFractionDigits", publicName: "minFractionDigits", isSignal: true, isRequired: false, transformFunction: null }, maxFractionDigits: { classPropertyName: "maxFractionDigits", publicName: "maxFractionDigits", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1702
1959
|
{
|
|
1703
1960
|
provide: NG_VALUE_ACCESSOR,
|
|
1704
|
-
useExisting: forwardRef(() =>
|
|
1705
|
-
multi: true,
|
|
1706
|
-
},
|
|
1707
|
-
{
|
|
1708
|
-
provide: NG_VALIDATORS,
|
|
1709
|
-
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1961
|
+
useExisting: forwardRef(() => PjcMoedaFieldComponent),
|
|
1710
1962
|
multi: true,
|
|
1711
1963
|
},
|
|
1712
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1964
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n (blur)=\"onTouched()\"\n (keydown)=\"onKeyDown($event)\"\n (paste)=\"onPaste($event)\"\n class=\"w-full\"\n styleClass=\"w-full\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n (blur)=\"onTouched()\"\n (keydown)=\"onKeyDown($event)\"\n (paste)=\"onPaste($event)\"\n class=\"w-full\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1713
1965
|
}
|
|
1714
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcMoedaFieldComponent, decorators: [{
|
|
1715
1967
|
type: Component,
|
|
1716
|
-
args: [{ selector: 'pjc-
|
|
1968
|
+
args: [{ selector: 'pjc-moeda-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FloatLabelModule, InputTextModule, MessageModule], providers: [
|
|
1717
1969
|
{
|
|
1718
1970
|
provide: NG_VALUE_ACCESSOR,
|
|
1719
|
-
useExisting: forwardRef(() =>
|
|
1720
|
-
multi: true,
|
|
1721
|
-
},
|
|
1722
|
-
{
|
|
1723
|
-
provide: NG_VALIDATORS,
|
|
1724
|
-
useExisting: forwardRef(() => PjcImeiFieldComponent),
|
|
1971
|
+
useExisting: forwardRef(() => PjcMoedaFieldComponent),
|
|
1725
1972
|
multi: true,
|
|
1726
1973
|
},
|
|
1727
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
1728
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }],
|
|
1974
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n (blur)=\"onTouched()\"\n (keydown)=\"onKeyDown($event)\"\n (paste)=\"onPaste($event)\"\n class=\"w-full\"\n styleClass=\"w-full\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n (blur)=\"onTouched()\"\n (keydown)=\"onKeyDown($event)\"\n (paste)=\"onPaste($event)\"\n class=\"w-full\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1975
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], minFractionDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "minFractionDigits", required: false }] }], maxFractionDigits: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxFractionDigits", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1729
1976
|
|
|
1730
1977
|
class PjcNumeroCartaoFieldComponent {
|
|
1731
1978
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -1786,7 +2033,7 @@ class PjcNumeroCartaoFieldComponent {
|
|
|
1786
2033
|
useExisting: forwardRef(() => PjcNumeroCartaoFieldComponent),
|
|
1787
2034
|
multi: true,
|
|
1788
2035
|
},
|
|
1789
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2036
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1790
2037
|
}
|
|
1791
2038
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcNumeroCartaoFieldComponent, decorators: [{
|
|
1792
2039
|
type: Component,
|
|
@@ -1804,11 +2051,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1804
2051
|
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"9999 9999 9999 9999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1805
2052
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1806
2053
|
|
|
1807
|
-
class
|
|
2054
|
+
class PjcPasswordFieldComponent {
|
|
1808
2055
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1809
2056
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1810
|
-
placeholder = input('
|
|
1811
|
-
id = input(`pjc-
|
|
2057
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2058
|
+
id = input(`pjc-password-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1812
2059
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1813
2060
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1814
2061
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -1818,6 +2065,7 @@ class PjcRenavamFieldComponent {
|
|
|
1818
2065
|
ngControl = null;
|
|
1819
2066
|
value = '';
|
|
1820
2067
|
disabled = false;
|
|
2068
|
+
showPassword = signal(false, ...(ngDevMode ? [{ debugName: "showPassword" }] : /* istanbul ignore next */ []));
|
|
1821
2069
|
onChange = () => { };
|
|
1822
2070
|
onTouched = () => { };
|
|
1823
2071
|
ngOnInit() {
|
|
@@ -1841,83 +2089,37 @@ class PjcRenavamFieldComponent {
|
|
|
1841
2089
|
setDisabledState(isDisabled) {
|
|
1842
2090
|
this.disabled = isDisabled;
|
|
1843
2091
|
}
|
|
1844
|
-
|
|
1845
|
-
this.value = value
|
|
2092
|
+
onInput(event) {
|
|
2093
|
+
this.value = event.target.value;
|
|
1846
2094
|
this.onChange(this.value);
|
|
1847
2095
|
}
|
|
1848
|
-
|
|
1849
|
-
this.
|
|
1850
|
-
}
|
|
1851
|
-
validate(control) {
|
|
1852
|
-
return PjcValidators.renavam()(control);
|
|
2096
|
+
toggleVisibility() {
|
|
2097
|
+
this.showPassword.update(v => !v);
|
|
1853
2098
|
}
|
|
1854
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1855
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
2099
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcPasswordFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2100
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcPasswordFieldComponent, isStandalone: true, selector: "pjc-password-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1856
2101
|
{
|
|
1857
2102
|
provide: NG_VALUE_ACCESSOR,
|
|
1858
|
-
useExisting: forwardRef(() =>
|
|
1859
|
-
multi: true,
|
|
1860
|
-
},
|
|
1861
|
-
{
|
|
1862
|
-
provide: NG_VALIDATORS,
|
|
1863
|
-
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2103
|
+
useExisting: forwardRef(() => PjcPasswordFieldComponent),
|
|
1864
2104
|
multi: true,
|
|
1865
2105
|
},
|
|
1866
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2106
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <div class=\"password-wrapper\" [class.opacity-60]=\"disabled\">\n <input\n pInputText\n [id]=\"id()\"\n [type]=\"showPassword() ? 'text' : 'password'\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full pr-10 outline-none bg-transparent\"\n />\n <button\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [disabled]=\"disabled\"\n class=\"password-toggle cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n [attr.aria-label]=\"showPassword() ? 'Ocultar senha' : 'Mostrar senha'\"\n >\n <i [class]=\"showPassword() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n </div>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <div class=\"password-wrapper\" [class.opacity-60]=\"disabled\">\n <input\n pInputText\n [id]=\"id()\"\n [type]=\"showPassword() ? 'text' : 'password'\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full pr-10 outline-none bg-transparent\"\n />\n <button\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [disabled]=\"disabled\"\n class=\"password-toggle cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n [attr.aria-label]=\"showPassword() ? 'Ocultar senha' : 'Mostrar senha'\"\n >\n <i [class]=\"showPassword() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n </div>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [".password-wrapper{position:relative;width:100%}.password-toggle{position:absolute;right:.5rem;top:50%;transform:translateY(-50%)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1867
2107
|
}
|
|
1868
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcPasswordFieldComponent, decorators: [{
|
|
1869
2109
|
type: Component,
|
|
1870
|
-
args: [{ selector: 'pjc-
|
|
2110
|
+
args: [{ selector: 'pjc-password-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputTextModule, FloatLabelModule, MessageModule], providers: [
|
|
1871
2111
|
{
|
|
1872
2112
|
provide: NG_VALUE_ACCESSOR,
|
|
1873
|
-
useExisting: forwardRef(() =>
|
|
1874
|
-
multi: true,
|
|
1875
|
-
},
|
|
1876
|
-
{
|
|
1877
|
-
provide: NG_VALIDATORS,
|
|
1878
|
-
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2113
|
+
useExisting: forwardRef(() => PjcPasswordFieldComponent),
|
|
1879
2114
|
multi: true,
|
|
1880
2115
|
},
|
|
1881
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2116
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <div class=\"password-wrapper\" [class.opacity-60]=\"disabled\">\n <input\n pInputText\n [id]=\"id()\"\n [type]=\"showPassword() ? 'text' : 'password'\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full pr-10 outline-none bg-transparent\"\n />\n <button\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [disabled]=\"disabled\"\n class=\"password-toggle cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n [attr.aria-label]=\"showPassword() ? 'Ocultar senha' : 'Mostrar senha'\"\n >\n <i [class]=\"showPassword() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n </div>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <div class=\"password-wrapper\" [class.opacity-60]=\"disabled\">\n <input\n pInputText\n [id]=\"id()\"\n [type]=\"showPassword() ? 'text' : 'password'\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full pr-10 outline-none bg-transparent\"\n />\n <button\n type=\"button\"\n (click)=\"toggleVisibility()\"\n [disabled]=\"disabled\"\n class=\"password-toggle cursor-pointer bg-transparent border-none text-surface-500 hover:text-surface-700 disabled:text-surface-300 disabled:cursor-not-allowed transition-colors\"\n [attr.aria-label]=\"showPassword() ? 'Ocultar senha' : 'Mostrar senha'\"\n >\n <i [class]=\"showPassword() ? 'pi pi-eye-slash' : 'pi pi-eye'\"></i>\n </button>\n </div>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", styles: [".password-wrapper{position:relative;width:100%}.password-toggle{position:absolute;right:.5rem;top:50%;transform:translateY(-50%)}\n"] }]
|
|
1882
2117
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1883
2118
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
return;
|
|
1889
|
-
if (!VIN_ALLOWED.test(event.key.toUpperCase())) {
|
|
1890
|
-
event.preventDefault();
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
onInput(event) {
|
|
1894
|
-
const input = event.target;
|
|
1895
|
-
const sanitized = input.value
|
|
1896
|
-
.toUpperCase()
|
|
1897
|
-
.replace(/[^A-HJ-NPR-Z0-9]/g, '')
|
|
1898
|
-
.substring(0, 17);
|
|
1899
|
-
if (input.value !== sanitized) {
|
|
1900
|
-
input.value = sanitized;
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1904
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.4", type: PjcChassiInputDirective, isStandalone: true, selector: "input[pjcChassi]", host: { listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" } }, ngImport: i0 });
|
|
1905
|
-
}
|
|
1906
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, decorators: [{
|
|
1907
|
-
type: Directive,
|
|
1908
|
-
args: [{
|
|
1909
|
-
selector: 'input[pjcChassi]',
|
|
1910
|
-
host: {
|
|
1911
|
-
'(keydown)': 'onKeyDown($event)',
|
|
1912
|
-
'(input)': 'onInput($event)',
|
|
1913
|
-
},
|
|
1914
|
-
}]
|
|
1915
|
-
}] });
|
|
1916
|
-
|
|
1917
|
-
class PjcChassiFieldComponent {
|
|
1918
|
-
label = input('Chassi', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1919
|
-
placeholder = input('Digite o chassi', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1920
|
-
id = input(`pjc-chassi-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2119
|
+
class PjcPlacaFieldComponent {
|
|
2120
|
+
label = input('Placa do Veículo', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2121
|
+
placeholder = input('ABC-1234', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2122
|
+
id = input(`pjc-placa-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1921
2123
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1922
2124
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1923
2125
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -1939,7 +2141,7 @@ class PjcChassiFieldComponent {
|
|
|
1939
2141
|
return getErrorMessage(this.ngControl, this.erros());
|
|
1940
2142
|
}
|
|
1941
2143
|
writeValue(val) {
|
|
1942
|
-
this.value = val?.toUpperCase()
|
|
2144
|
+
this.value = val?.toUpperCase() || '';
|
|
1943
2145
|
}
|
|
1944
2146
|
registerOnChange(fn) {
|
|
1945
2147
|
this.onChange = fn;
|
|
@@ -1950,49 +2152,48 @@ class PjcChassiFieldComponent {
|
|
|
1950
2152
|
setDisabledState(isDisabled) {
|
|
1951
2153
|
this.disabled = isDisabled;
|
|
1952
2154
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
2155
|
+
onModelChange(event) {
|
|
2156
|
+
const val = event.target?.value ?? '';
|
|
2157
|
+
this.onChange(val.toUpperCase());
|
|
1955
2158
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
this.value = val;
|
|
1959
|
-
this.onChange(val);
|
|
2159
|
+
validate(control) {
|
|
2160
|
+
return PjcValidators.placaVeiculo()(control);
|
|
1960
2161
|
}
|
|
1961
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
1962
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
2162
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcPlacaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2163
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcPlacaFieldComponent, isStandalone: true, selector: "pjc-placa-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
1963
2164
|
{
|
|
1964
2165
|
provide: NG_VALUE_ACCESSOR,
|
|
1965
|
-
useExisting: forwardRef(() =>
|
|
2166
|
+
useExisting: forwardRef(() => PjcPlacaFieldComponent),
|
|
1966
2167
|
multi: true,
|
|
1967
2168
|
},
|
|
1968
2169
|
{
|
|
1969
2170
|
provide: NG_VALIDATORS,
|
|
1970
|
-
useExisting: forwardRef(() =>
|
|
2171
|
+
useExisting: forwardRef(() => PjcPlacaFieldComponent),
|
|
1971
2172
|
multi: true,
|
|
1972
2173
|
},
|
|
1973
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2174
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"aaa-9*99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"aaa-9*99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 p-2 outline-none bg-transparent uppercase\"\n ></p-inputMask>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1974
2175
|
}
|
|
1975
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcPlacaFieldComponent, decorators: [{
|
|
1976
2177
|
type: Component,
|
|
1977
|
-
args: [{ selector: 'pjc-
|
|
2178
|
+
args: [{ selector: 'pjc-placa-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
1978
2179
|
{
|
|
1979
2180
|
provide: NG_VALUE_ACCESSOR,
|
|
1980
|
-
useExisting: forwardRef(() =>
|
|
2181
|
+
useExisting: forwardRef(() => PjcPlacaFieldComponent),
|
|
1981
2182
|
multi: true,
|
|
1982
2183
|
},
|
|
1983
2184
|
{
|
|
1984
2185
|
provide: NG_VALIDATORS,
|
|
1985
|
-
useExisting: forwardRef(() =>
|
|
2186
|
+
useExisting: forwardRef(() => PjcPlacaFieldComponent),
|
|
1986
2187
|
multi: true,
|
|
1987
2188
|
},
|
|
1988
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2189
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"aaa-9*99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"aaa-9*99\"\n [(ngModel)]=\"value\"\n (onInput)=\"onModelChange($event)\"\n (onBlur)=\"onTouched()\"\n [unmask]=\"false\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 p-2 outline-none bg-transparent uppercase\"\n ></p-inputMask>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
1989
2190
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
1990
2191
|
|
|
1991
|
-
class
|
|
2192
|
+
class PjcRenavamFieldComponent {
|
|
1992
2193
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1993
2194
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1994
2195
|
placeholder = input('00000000000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1995
|
-
id = input(`pjc-
|
|
2196
|
+
id = input(`pjc-renavam-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1996
2197
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1997
2198
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
1998
2199
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -2033,66 +2234,52 @@ class PjcCnhFieldComponent {
|
|
|
2033
2234
|
this.onTouched();
|
|
2034
2235
|
}
|
|
2035
2236
|
validate(control) {
|
|
2036
|
-
return PjcValidators.
|
|
2237
|
+
return PjcValidators.renavam()(control);
|
|
2037
2238
|
}
|
|
2038
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2039
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
2239
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcRenavamFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2240
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcRenavamFieldComponent, isStandalone: true, selector: "pjc-renavam-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2040
2241
|
{
|
|
2041
2242
|
provide: NG_VALUE_ACCESSOR,
|
|
2042
|
-
useExisting: forwardRef(() =>
|
|
2243
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2043
2244
|
multi: true,
|
|
2044
2245
|
},
|
|
2045
2246
|
{
|
|
2046
2247
|
provide: NG_VALIDATORS,
|
|
2047
|
-
useExisting: forwardRef(() =>
|
|
2248
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2048
2249
|
multi: true,
|
|
2049
2250
|
},
|
|
2050
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2251
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "component", type: i2.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabel", "ariaLabelledBy", "ariaRequired", "readonly", "unmask", "characterPattern", "autofocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2051
2252
|
}
|
|
2052
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcRenavamFieldComponent, decorators: [{
|
|
2053
2254
|
type: Component,
|
|
2054
|
-
args: [{ selector: 'pjc-
|
|
2255
|
+
args: [{ selector: 'pjc-renavam-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule, MessageModule], providers: [
|
|
2055
2256
|
{
|
|
2056
2257
|
provide: NG_VALUE_ACCESSOR,
|
|
2057
|
-
useExisting: forwardRef(() =>
|
|
2258
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2058
2259
|
multi: true,
|
|
2059
2260
|
},
|
|
2060
2261
|
{
|
|
2061
2262
|
provide: NG_VALIDATORS,
|
|
2062
|
-
useExisting: forwardRef(() =>
|
|
2263
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
2063
2264
|
multi: true,
|
|
2064
2265
|
},
|
|
2065
2266
|
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-inputMask\n [id]=\"id()\"\n mask=\"99999999999\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n [unmask]=\"true\"\n [autoClear]=\"false\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n inputStyleClass=\"w-full p-2 outline-none bg-transparent\"\n ></p-inputMask>\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
2066
2267
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
2067
2268
|
|
|
2068
|
-
class
|
|
2069
|
-
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2070
|
-
|
|
2071
|
-
id = input(`pjc-moeda-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2269
|
+
class PjcTelefoneFieldComponent {
|
|
2270
|
+
label = input('Telefone', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2271
|
+
id = input(`pjc-telefone-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2072
2272
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
2073
|
-
mode = input('currency', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
2074
|
-
currency = input('BRL', ...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
2075
|
-
locale = input('pt-BR', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
|
|
2076
|
-
minFractionDigits = input(2, ...(ngDevMode ? [{ debugName: "minFractionDigits" }] : /* istanbul ignore next */ []));
|
|
2077
|
-
maxFractionDigits = input(2, ...(ngDevMode ? [{ debugName: "maxFractionDigits" }] : /* istanbul ignore next */ []));
|
|
2078
2273
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2079
2274
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
2080
2275
|
injector = inject(Injector);
|
|
2081
2276
|
cdr = inject(ChangeDetectorRef);
|
|
2082
2277
|
destroyRef = inject(DestroyRef);
|
|
2083
2278
|
ngControl = null;
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
displayValue = computed(() => {
|
|
2087
|
-
const value = this.cents() / this.divisor();
|
|
2088
|
-
return new Intl.NumberFormat(this.locale(), {
|
|
2089
|
-
style: this.mode() === 'currency' ? 'currency' : 'decimal',
|
|
2090
|
-
currency: this.mode() === 'currency' ? this.currency() : undefined,
|
|
2091
|
-
minimumFractionDigits: this.minFractionDigits(),
|
|
2092
|
-
maximumFractionDigits: this.maxFractionDigits(),
|
|
2093
|
-
}).format(value);
|
|
2094
|
-
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
2279
|
+
displayValue = '';
|
|
2280
|
+
placeholder = '(00) 0000-0000';
|
|
2095
2281
|
disabled = false;
|
|
2282
|
+
rawValue = '';
|
|
2096
2283
|
onChange = () => { };
|
|
2097
2284
|
onTouched = () => { };
|
|
2098
2285
|
ngOnInit() {
|
|
@@ -2104,41 +2291,10 @@ class PjcMoedaFieldComponent {
|
|
|
2104
2291
|
get errorMessage() {
|
|
2105
2292
|
return getErrorMessage(this.ngControl, this.erros());
|
|
2106
2293
|
}
|
|
2107
|
-
onKeyDown(event) {
|
|
2108
|
-
if (this.disabled || this.readonly())
|
|
2109
|
-
return;
|
|
2110
|
-
if (/^\d$/.test(event.key)) {
|
|
2111
|
-
event.preventDefault();
|
|
2112
|
-
if (this.cents() < 9_999_999_999) {
|
|
2113
|
-
this.cents.update(c => c * 10 + Number.parseInt(event.key, 10));
|
|
2114
|
-
this.emitValue();
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
else if (event.key === 'Backspace') {
|
|
2118
|
-
event.preventDefault();
|
|
2119
|
-
this.cents.update(c => Math.floor(c / 10));
|
|
2120
|
-
this.emitValue();
|
|
2121
|
-
}
|
|
2122
|
-
else if (event.key === 'Delete') {
|
|
2123
|
-
event.preventDefault();
|
|
2124
|
-
this.cents.set(0);
|
|
2125
|
-
this.emitValue();
|
|
2126
|
-
}
|
|
2127
|
-
else if (event.key.length === 1) {
|
|
2128
|
-
// Block all other printable characters (letters, symbols, etc.)
|
|
2129
|
-
event.preventDefault();
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
onPaste(event) {
|
|
2133
|
-
event.preventDefault();
|
|
2134
|
-
}
|
|
2135
|
-
emitValue() {
|
|
2136
|
-
const value = this.cents() === 0 ? null : this.cents() / this.divisor();
|
|
2137
|
-
this.onChange(value);
|
|
2138
|
-
}
|
|
2139
2294
|
writeValue(val) {
|
|
2140
|
-
|
|
2141
|
-
this.
|
|
2295
|
+
this.rawValue = val?.replaceAll(/\D/g, '') ?? '';
|
|
2296
|
+
this.displayValue = this.formatValue(this.rawValue);
|
|
2297
|
+
this.updatePlaceholder();
|
|
2142
2298
|
}
|
|
2143
2299
|
registerOnChange(fn) {
|
|
2144
2300
|
this.onChange = fn;
|
|
@@ -2149,31 +2305,92 @@ class PjcMoedaFieldComponent {
|
|
|
2149
2305
|
setDisabledState(isDisabled) {
|
|
2150
2306
|
this.disabled = isDisabled;
|
|
2151
2307
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2308
|
+
onInputChange(event) {
|
|
2309
|
+
const input = event.target;
|
|
2310
|
+
const cursorPos = input.selectionStart ?? 0;
|
|
2311
|
+
const digitsBeforeCursor = input.value.substring(0, cursorPos).replace(/\D/g, '').length;
|
|
2312
|
+
this.rawValue = input.value.replaceAll(/\D/g, '').substring(0, 11);
|
|
2313
|
+
this.displayValue = this.formatValue(this.rawValue);
|
|
2314
|
+
this.updatePlaceholder();
|
|
2315
|
+
this.onChange(this.rawValue);
|
|
2316
|
+
let newCursor = this.displayValue.length;
|
|
2317
|
+
let digitCount = 0;
|
|
2318
|
+
for (let i = 0; i < this.displayValue.length; i++) {
|
|
2319
|
+
if (/\d/.test(this.displayValue[i]))
|
|
2320
|
+
digitCount++;
|
|
2321
|
+
if (digitCount === digitsBeforeCursor) {
|
|
2322
|
+
newCursor = i + 1;
|
|
2323
|
+
break;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
setTimeout(() => input.setSelectionRange(newCursor, newCursor));
|
|
2327
|
+
}
|
|
2328
|
+
onModelTouched() {
|
|
2329
|
+
this.onTouched();
|
|
2330
|
+
}
|
|
2331
|
+
formatValue(digits) {
|
|
2332
|
+
if (!digits)
|
|
2333
|
+
return '';
|
|
2334
|
+
if (digits.length <= 10) {
|
|
2335
|
+
// Fixo: (99) 9999-9999
|
|
2336
|
+
return digits
|
|
2337
|
+
.replace(/(\d{2})(\d)/, '($1) $2')
|
|
2338
|
+
.replace(/(\(\d{2}\) \d{4})(\d)/, '$1-$2');
|
|
2339
|
+
}
|
|
2340
|
+
// Celular: (99) 99999-9999
|
|
2341
|
+
return digits
|
|
2342
|
+
.replace(/(\d{2})(\d)/, '($1) $2')
|
|
2343
|
+
.replace(/(\(\d{2}\) \d{5})(\d)/, '$1-$2');
|
|
2344
|
+
}
|
|
2345
|
+
updatePlaceholder() {
|
|
2346
|
+
if (this.rawValue.length > 10) {
|
|
2347
|
+
this.placeholder = '(00) 90000-0000';
|
|
2348
|
+
}
|
|
2349
|
+
else {
|
|
2350
|
+
this.placeholder = '(00) 0000-0000';
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
validate(control) {
|
|
2354
|
+
return PjcValidators.telefone()(control);
|
|
2355
|
+
}
|
|
2356
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTelefoneFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2357
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcTelefoneFieldComponent, isStandalone: true, selector: "pjc-telefone-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2154
2358
|
{
|
|
2155
2359
|
provide: NG_VALUE_ACCESSOR,
|
|
2156
|
-
useExisting: forwardRef(() =>
|
|
2360
|
+
useExisting: forwardRef(() => PjcTelefoneFieldComponent),
|
|
2361
|
+
multi: true,
|
|
2362
|
+
},
|
|
2363
|
+
{
|
|
2364
|
+
provide: NG_VALIDATORS,
|
|
2365
|
+
useExisting: forwardRef(() => PjcTelefoneFieldComponent),
|
|
2157
2366
|
multi: true,
|
|
2158
2367
|
},
|
|
2159
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n
|
|
2368
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"15\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"15\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2160
2369
|
}
|
|
2161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTelefoneFieldComponent, decorators: [{
|
|
2162
2371
|
type: Component,
|
|
2163
|
-
args: [{ selector: 'pjc-
|
|
2372
|
+
args: [{ selector: 'pjc-telefone-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, FloatLabelModule, InputTextModule, MessageModule], providers: [
|
|
2164
2373
|
{
|
|
2165
2374
|
provide: NG_VALUE_ACCESSOR,
|
|
2166
|
-
useExisting: forwardRef(() =>
|
|
2375
|
+
useExisting: forwardRef(() => PjcTelefoneFieldComponent),
|
|
2167
2376
|
multi: true,
|
|
2168
2377
|
},
|
|
2169
|
-
|
|
2170
|
-
|
|
2378
|
+
{
|
|
2379
|
+
provide: NG_VALIDATORS,
|
|
2380
|
+
useExisting: forwardRef(() => PjcTelefoneFieldComponent),
|
|
2381
|
+
multi: true,
|
|
2382
|
+
},
|
|
2383
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"15\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"displayValue\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onModelTouched()\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n maxlength=\"15\"\n class=\"w-full p-2 outline-none bg-transparent border border-surface-300 rounded-md focus:border-primary-500\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
2384
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
2171
2385
|
|
|
2172
|
-
|
|
2173
|
-
label
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2386
|
+
const TIPOS_PESSOA = [
|
|
2387
|
+
{ label: 'Pessoa Fisica', value: 'FISICA' },
|
|
2388
|
+
{ label: 'Pessoa Juridica', value: 'JURIDICA' },
|
|
2389
|
+
];
|
|
2390
|
+
class PjcTipoPessoaFieldComponent {
|
|
2391
|
+
label = input('Tipo de Pessoa', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2392
|
+
placeholder = input('Selecione o tipo de pessoa', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2393
|
+
id = input(`pjc-tipo-pessoa-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2177
2394
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
2178
2395
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2179
2396
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -2181,9 +2398,9 @@ class PjcPasswordFieldComponent {
|
|
|
2181
2398
|
cdr = inject(ChangeDetectorRef);
|
|
2182
2399
|
destroyRef = inject(DestroyRef);
|
|
2183
2400
|
ngControl = null;
|
|
2184
|
-
|
|
2401
|
+
tiposPessoa = TIPOS_PESSOA;
|
|
2402
|
+
value = null;
|
|
2185
2403
|
disabled = false;
|
|
2186
|
-
showPassword = signal(false, ...(ngDevMode ? [{ debugName: "showPassword" }] : /* istanbul ignore next */ []));
|
|
2187
2404
|
onChange = () => { };
|
|
2188
2405
|
onTouched = () => { };
|
|
2189
2406
|
ngOnInit() {
|
|
@@ -2196,7 +2413,7 @@ class PjcPasswordFieldComponent {
|
|
|
2196
2413
|
return getErrorMessage(this.ngControl, this.erros());
|
|
2197
2414
|
}
|
|
2198
2415
|
writeValue(val) {
|
|
2199
|
-
this.value = val
|
|
2416
|
+
this.value = val;
|
|
2200
2417
|
}
|
|
2201
2418
|
registerOnChange(fn) {
|
|
2202
2419
|
this.onChange = fn;
|
|
@@ -2207,100 +2424,76 @@ class PjcPasswordFieldComponent {
|
|
|
2207
2424
|
setDisabledState(isDisabled) {
|
|
2208
2425
|
this.disabled = isDisabled;
|
|
2209
2426
|
}
|
|
2210
|
-
|
|
2211
|
-
this.value =
|
|
2212
|
-
this.onChange(
|
|
2427
|
+
onModelChange(value) {
|
|
2428
|
+
this.value = value;
|
|
2429
|
+
this.onChange(value);
|
|
2213
2430
|
}
|
|
2214
|
-
|
|
2215
|
-
this.
|
|
2431
|
+
onModelTouched() {
|
|
2432
|
+
this.onTouched();
|
|
2216
2433
|
}
|
|
2217
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2218
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
2434
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTipoPessoaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2435
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcTipoPessoaFieldComponent, isStandalone: true, selector: "pjc-tipo-pessoa-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2219
2436
|
{
|
|
2220
2437
|
provide: NG_VALUE_ACCESSOR,
|
|
2221
|
-
useExisting: forwardRef(() =>
|
|
2438
|
+
useExisting: forwardRef(() => PjcTipoPessoaFieldComponent),
|
|
2222
2439
|
multi: true,
|
|
2223
2440
|
},
|
|
2224
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2441
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"tiposPessoa\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"tiposPessoa\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2225
2442
|
}
|
|
2226
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2443
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTipoPessoaFieldComponent, decorators: [{
|
|
2227
2444
|
type: Component,
|
|
2228
|
-
args: [{ selector: 'pjc-
|
|
2445
|
+
args: [{ selector: 'pjc-tipo-pessoa-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule, MessageModule], providers: [
|
|
2229
2446
|
{
|
|
2230
2447
|
provide: NG_VALUE_ACCESSOR,
|
|
2231
|
-
useExisting: forwardRef(() =>
|
|
2448
|
+
useExisting: forwardRef(() => PjcTipoPessoaFieldComponent),
|
|
2232
2449
|
multi: true,
|
|
2233
2450
|
},
|
|
2234
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2235
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }],
|
|
2236
|
-
|
|
2237
|
-
class PjcErroValidacaoComponent {
|
|
2238
|
-
container = inject(ControlContainer);
|
|
2239
|
-
cdr = inject(ChangeDetectorRef);
|
|
2240
|
-
destroyRef = inject(DestroyRef);
|
|
2241
|
-
controlName = input.required(...(ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []));
|
|
2242
|
-
erros = input.required(...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
2243
|
-
control = null;
|
|
2244
|
-
ngOnInit() {
|
|
2245
|
-
const group = this.container.control;
|
|
2246
|
-
this.control = group?.get(this.controlName()) ?? null;
|
|
2247
|
-
if (this.control) {
|
|
2248
|
-
this.control.events
|
|
2249
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2250
|
-
.subscribe(() => this.cdr.markForCheck());
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcErroValidacaoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2254
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcErroValidacaoComponent, isStandalone: true, selector: "pjc-erro-validacao", inputs: { controlName: { classPropertyName: "controlName", publicName: "controlName", isSignal: true, isRequired: true, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@if (control; as ctrl) {\n @if (ctrl.touched && ctrl.errors) {\n @for (entry of erros() | keyvalue; track entry.key) {\n @if (ctrl.errors[entry.key]) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ entry.value }}</p-message>\n }\n }\n }\n}\n", dependencies: [{ kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2255
|
-
}
|
|
2256
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcErroValidacaoComponent, decorators: [{
|
|
2257
|
-
type: Component,
|
|
2258
|
-
args: [{ selector: 'pjc-erro-validacao', changeDetection: ChangeDetectionStrategy.OnPush, imports: [KeyValuePipe, MessageModule], template: "@if (control; as ctrl) {\n @if (ctrl.touched && ctrl.errors) {\n @for (entry of erros() | keyvalue; track entry.key) {\n @if (ctrl.errors[entry.key]) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ entry.value }}</p-message>\n }\n }\n }\n}\n" }]
|
|
2259
|
-
}], propDecorators: { controlName: [{ type: i0.Input, args: [{ isSignal: true, alias: "controlName", required: true }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: true }] }] } });
|
|
2260
|
-
|
|
2261
|
-
class PjcCidadeService {
|
|
2262
|
-
http = inject(HttpClient);
|
|
2263
|
-
API_URL = 'https://servicodados.ibge.gov.br/api/v1/localidades/estados';
|
|
2264
|
-
getMunicipiosByUf(uf) {
|
|
2265
|
-
return this.http
|
|
2266
|
-
.get(`${this.API_URL}/${uf}/municipios`)
|
|
2267
|
-
.pipe(map((data) => data
|
|
2268
|
-
.map((m) => ({ id: m.id, nome: m.nome, descricao: m.descricao }))
|
|
2269
|
-
.sort((a, b) => {
|
|
2270
|
-
const aDisplay = a.nome || a.descricao || '';
|
|
2271
|
-
const bDisplay = b.nome || b.descricao || '';
|
|
2272
|
-
return aDisplay.localeCompare(bDisplay);
|
|
2273
|
-
})));
|
|
2274
|
-
}
|
|
2275
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2276
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, providedIn: 'root' });
|
|
2277
|
-
}
|
|
2278
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeService, decorators: [{
|
|
2279
|
-
type: Injectable,
|
|
2280
|
-
args: [{
|
|
2281
|
-
providedIn: 'root',
|
|
2282
|
-
}]
|
|
2283
|
-
}] });
|
|
2451
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"tiposPessoa\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"tiposPessoa\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"label\"\n optionValue=\"value\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
2452
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
2284
2453
|
|
|
2285
|
-
const
|
|
2454
|
+
const ESTADOS = [
|
|
2455
|
+
{ uf: 'MT', descricao: 'Mato Grosso' },
|
|
2456
|
+
{ uf: 'AC', descricao: 'Acre' },
|
|
2457
|
+
{ uf: 'AL', descricao: 'Alagoas' },
|
|
2458
|
+
{ uf: 'AP', descricao: 'Amapá' },
|
|
2459
|
+
{ uf: 'AM', descricao: 'Amazonas' },
|
|
2460
|
+
{ uf: 'BA', descricao: 'Bahia' },
|
|
2461
|
+
{ uf: 'CE', descricao: 'Ceará' },
|
|
2462
|
+
{ uf: 'DF', descricao: 'Distrito Federal' },
|
|
2463
|
+
{ uf: 'ES', descricao: 'Espírito Santo' },
|
|
2464
|
+
{ uf: 'GO', descricao: 'Goiás' },
|
|
2465
|
+
{ uf: 'MA', descricao: 'Maranhão' },
|
|
2466
|
+
{ uf: 'MS', descricao: 'Mato Grosso do Sul' },
|
|
2467
|
+
{ uf: 'MG', descricao: 'Minas Gerais' },
|
|
2468
|
+
{ uf: 'PA', descricao: 'Pará' },
|
|
2469
|
+
{ uf: 'PB', descricao: 'Paraíba' },
|
|
2470
|
+
{ uf: 'PR', descricao: 'Paraná' },
|
|
2471
|
+
{ uf: 'PE', descricao: 'Pernambuco' },
|
|
2472
|
+
{ uf: 'PI', descricao: 'Piauí' },
|
|
2473
|
+
{ uf: 'RJ', descricao: 'Rio de Janeiro' },
|
|
2474
|
+
{ uf: 'RN', descricao: 'Rio Grande do Norte' },
|
|
2475
|
+
{ uf: 'RS', descricao: 'Rio Grande do Sul' },
|
|
2476
|
+
{ uf: 'RO', descricao: 'Rondônia' },
|
|
2477
|
+
{ uf: 'RR', descricao: 'Roraima' },
|
|
2478
|
+
{ uf: 'SC', descricao: 'Santa Catarina' },
|
|
2479
|
+
{ uf: 'SP', descricao: 'São Paulo' },
|
|
2480
|
+
{ uf: 'SE', descricao: 'Sergipe' },
|
|
2481
|
+
{ uf: 'TO', descricao: 'Tocantins' },
|
|
2482
|
+
];
|
|
2286
2483
|
|
|
2287
|
-
class
|
|
2288
|
-
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2484
|
+
class PjcUfFieldComponent {
|
|
2485
|
+
label = input('UF', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2289
2486
|
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
2290
|
-
placeholder = input('
|
|
2291
|
-
id = input(`pjc-
|
|
2487
|
+
placeholder = input('Selecione o estado', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2488
|
+
id = input(`pjc-uf-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2292
2489
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
2293
2490
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2294
|
-
uf = input('', ...(ngDevMode ? [{ debugName: "uf" }] : /* istanbul ignore next */ []));
|
|
2295
2491
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
2296
2492
|
injector = inject(Injector);
|
|
2297
2493
|
cdr = inject(ChangeDetectorRef);
|
|
2298
2494
|
destroyRef = inject(DestroyRef);
|
|
2299
2495
|
ngControl = null;
|
|
2300
|
-
|
|
2301
|
-
municipios = signal([], ...(ngDevMode ? [{ debugName: "municipios" }] : /* istanbul ignore next */ []));
|
|
2302
|
-
filteredMunicipios = signal([], ...(ngDevMode ? [{ debugName: "filteredMunicipios" }] : /* istanbul ignore next */ []));
|
|
2303
|
-
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
2496
|
+
estados = ESTADOS;
|
|
2304
2497
|
value = null;
|
|
2305
2498
|
disabled = false;
|
|
2306
2499
|
onChange = () => { };
|
|
@@ -2314,29 +2507,8 @@ class PjcCidadeFieldComponent {
|
|
|
2314
2507
|
get errorMessage() {
|
|
2315
2508
|
return getErrorMessage(this.ngControl, this.erros());
|
|
2316
2509
|
}
|
|
2317
|
-
constructor() {
|
|
2318
|
-
effect(() => {
|
|
2319
|
-
const uf = this.uf();
|
|
2320
|
-
if (uf) {
|
|
2321
|
-
this.fetchMunicipios(uf);
|
|
2322
|
-
}
|
|
2323
|
-
else {
|
|
2324
|
-
this.municipios.set([]);
|
|
2325
|
-
this.filteredMunicipios.set([]);
|
|
2326
|
-
}
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
2510
|
writeValue(val) {
|
|
2330
|
-
|
|
2331
|
-
this.value = null;
|
|
2332
|
-
}
|
|
2333
|
-
else if (typeof val === 'string') {
|
|
2334
|
-
const found = this.municipios().find(m => m.nome === val || m.descricao === val);
|
|
2335
|
-
this.value = found ?? { id: 0, nome: val };
|
|
2336
|
-
}
|
|
2337
|
-
else {
|
|
2338
|
-
this.value = val;
|
|
2339
|
-
}
|
|
2511
|
+
this.value = val?.uf ? (ESTADOS.find(e => e.uf === val.uf) ?? null) : null;
|
|
2340
2512
|
}
|
|
2341
2513
|
registerOnChange(fn) {
|
|
2342
2514
|
this.onChange = fn;
|
|
@@ -2348,83 +2520,36 @@ class PjcCidadeFieldComponent {
|
|
|
2348
2520
|
this.disabled = isDisabled;
|
|
2349
2521
|
}
|
|
2350
2522
|
onModelChange(value) {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
this.onChange(null);
|
|
2354
|
-
}
|
|
2355
|
-
else {
|
|
2356
|
-
this.value = value;
|
|
2357
|
-
this.onChange(value);
|
|
2358
|
-
}
|
|
2523
|
+
this.value = value;
|
|
2524
|
+
this.onChange(value);
|
|
2359
2525
|
}
|
|
2360
2526
|
onModelTouched() {
|
|
2361
2527
|
this.onTouched();
|
|
2362
2528
|
}
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
}
|
|
2366
|
-
filterMunicipios(event) {
|
|
2367
|
-
const query = event.query.toLowerCase();
|
|
2368
|
-
this.filteredMunicipios.set(this.municipios().filter(m => this.getMunicipioDisplay(m).toLowerCase().includes(query)));
|
|
2369
|
-
}
|
|
2370
|
-
fetchMunicipios(uf) {
|
|
2371
|
-
this.loading.set(true);
|
|
2372
|
-
const previousValue = this.value;
|
|
2373
|
-
this.service.getMunicipiosByUf(uf).subscribe({
|
|
2374
|
-
next: (data) => {
|
|
2375
|
-
const normalized = data.map(m => ({ ...m, nome: m.nome || m.descricao || '' }));
|
|
2376
|
-
this.municipios.set(normalized);
|
|
2377
|
-
this.filteredMunicipios.set(normalized);
|
|
2378
|
-
this.loading.set(false);
|
|
2379
|
-
if (previousValue) {
|
|
2380
|
-
const match = normalized.find(m => m.id === previousValue.id || m.nome === previousValue.nome);
|
|
2381
|
-
if (match) {
|
|
2382
|
-
this.value = match;
|
|
2383
|
-
this.onChange(match);
|
|
2384
|
-
}
|
|
2385
|
-
else {
|
|
2386
|
-
this.value = null;
|
|
2387
|
-
this.onChange(null);
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
},
|
|
2391
|
-
error: () => {
|
|
2392
|
-
this.municipios.set([]);
|
|
2393
|
-
this.filteredMunicipios.set([]);
|
|
2394
|
-
this.loading.set(false);
|
|
2395
|
-
this.value = null;
|
|
2396
|
-
this.onChange(null);
|
|
2397
|
-
},
|
|
2398
|
-
});
|
|
2399
|
-
}
|
|
2400
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCidadeFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2401
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcCidadeFieldComponent, isStandalone: true, selector: "pjc-cidade-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, uf: { classPropertyName: "uf", publicName: "uf", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2529
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2530
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcUfFieldComponent, isStandalone: true, selector: "pjc-uf-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2402
2531
|
{
|
|
2403
2532
|
provide: NG_VALUE_ACCESSOR,
|
|
2404
|
-
useExisting: forwardRef(() =>
|
|
2533
|
+
useExisting: forwardRef(() => PjcUfFieldComponent),
|
|
2405
2534
|
multi: true,
|
|
2406
2535
|
},
|
|
2407
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-
|
|
2536
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i2$3.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2408
2537
|
}
|
|
2409
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2538
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, decorators: [{
|
|
2410
2539
|
type: Component,
|
|
2411
|
-
args: [{ selector: 'pjc-
|
|
2540
|
+
args: [{ selector: 'pjc-uf-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule, MessageModule], providers: [
|
|
2412
2541
|
{
|
|
2413
2542
|
provide: NG_VALUE_ACCESSOR,
|
|
2414
|
-
useExisting: forwardRef(() =>
|
|
2543
|
+
useExisting: forwardRef(() => PjcUfFieldComponent),
|
|
2415
2544
|
multi: true,
|
|
2416
2545
|
},
|
|
2417
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-
|
|
2418
|
-
}],
|
|
2546
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [disabled]=\"disabled || readonly()\"\n styleClass=\"w-full\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <p-select\n [inputId]=\"id()\"\n [options]=\"estados\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onModelChange($event)\"\n (onBlur)=\"onModelTouched()\"\n optionLabel=\"descricao\"\n dataKey=\"uf\"\n appendTo=\"body\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
2547
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
2419
2548
|
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
];
|
|
2424
|
-
class PjcTipoPessoaFieldComponent {
|
|
2425
|
-
label = input('Tipo de Pessoa', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2426
|
-
placeholder = input('Selecione o tipo de pessoa', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2427
|
-
id = input(`pjc-tipo-pessoa-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2549
|
+
class PjcUppercaseFieldComponent {
|
|
2550
|
+
label = input('Nome', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
2551
|
+
placeholder = input('Digite o nome', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
2552
|
+
id = input(`pjc-uppercase-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
2428
2553
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
2429
2554
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
2430
2555
|
erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
|
|
@@ -2432,8 +2557,7 @@ class PjcTipoPessoaFieldComponent {
|
|
|
2432
2557
|
cdr = inject(ChangeDetectorRef);
|
|
2433
2558
|
destroyRef = inject(DestroyRef);
|
|
2434
2559
|
ngControl = null;
|
|
2435
|
-
|
|
2436
|
-
value = null;
|
|
2560
|
+
value = signal('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
2437
2561
|
disabled = false;
|
|
2438
2562
|
onChange = () => { };
|
|
2439
2563
|
onTouched = () => { };
|
|
@@ -2447,7 +2571,12 @@ class PjcTipoPessoaFieldComponent {
|
|
|
2447
2571
|
return getErrorMessage(this.ngControl, this.erros());
|
|
2448
2572
|
}
|
|
2449
2573
|
writeValue(val) {
|
|
2450
|
-
|
|
2574
|
+
if (val == null) {
|
|
2575
|
+
this.value.set('');
|
|
2576
|
+
}
|
|
2577
|
+
else {
|
|
2578
|
+
this.value.set(String(val).toUpperCase());
|
|
2579
|
+
}
|
|
2451
2580
|
}
|
|
2452
2581
|
registerOnChange(fn) {
|
|
2453
2582
|
this.onChange = fn;
|
|
@@ -2458,33 +2587,40 @@ class PjcTipoPessoaFieldComponent {
|
|
|
2458
2587
|
setDisabledState(isDisabled) {
|
|
2459
2588
|
this.disabled = isDisabled;
|
|
2460
2589
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
this.
|
|
2464
|
-
|
|
2465
|
-
onModelTouched() {
|
|
2466
|
-
this.onTouched();
|
|
2590
|
+
onInput(event) {
|
|
2591
|
+
const upper = event.target.value.toUpperCase();
|
|
2592
|
+
this.value.set(upper);
|
|
2593
|
+
this.onChange(upper);
|
|
2467
2594
|
}
|
|
2468
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2469
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type:
|
|
2595
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUppercaseFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2596
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcUppercaseFieldComponent, isStandalone: true, selector: "pjc-uppercase-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, labelVariant: { classPropertyName: "labelVariant", publicName: "labelVariant", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, erros: { classPropertyName: "erros", publicName: "erros", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
2470
2597
|
{
|
|
2471
2598
|
provide: NG_VALUE_ACCESSOR,
|
|
2472
|
-
useExisting: forwardRef(() =>
|
|
2599
|
+
useExisting: forwardRef(() => PjcUppercaseFieldComponent),
|
|
2473
2600
|
multi: true,
|
|
2474
2601
|
},
|
|
2475
|
-
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2602
|
+
], ngImport: i0, template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3$1.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4$1.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2476
2603
|
}
|
|
2477
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type:
|
|
2604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUppercaseFieldComponent, decorators: [{
|
|
2478
2605
|
type: Component,
|
|
2479
|
-
args: [{ selector: 'pjc-
|
|
2606
|
+
args: [{ selector: 'pjc-uppercase-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputTextModule, FloatLabelModule, MessageModule], providers: [
|
|
2480
2607
|
{
|
|
2481
2608
|
provide: NG_VALUE_ACCESSOR,
|
|
2482
|
-
useExisting: forwardRef(() =>
|
|
2609
|
+
useExisting: forwardRef(() => PjcUppercaseFieldComponent),
|
|
2483
2610
|
multi: true,
|
|
2484
2611
|
},
|
|
2485
|
-
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <
|
|
2612
|
+
], template: "<div class=\"flex flex-col gap-1 w-full\">\n @if (label()) {\n <p-floatlabel [variant]=\"labelVariant()\" class=\"w-full\">\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n <label [for]=\"id()\">{{ label() }}</label>\n </p-floatlabel>\n } @else {\n <input\n pInputText\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n [class.ng-invalid]=\"invalid\"\n [class.ng-dirty]=\"invalid\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\n\n @if (errorMessage) {\n <p-message severity=\"error\" variant=\"simple\" size=\"small\">{{ errorMessage }}</p-message>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
2486
2613
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], labelVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelVariant", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], erros: [{ type: i0.Input, args: [{ isSignal: true, alias: "erros", required: false }] }] } });
|
|
2487
2614
|
|
|
2615
|
+
class PjcFields {
|
|
2616
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcFields, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2617
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.4", type: PjcFields, isStandalone: true, selector: "lib-pjc-fields", ngImport: i0, template: ` <p>pjc-fields works!</p> `, isInline: true, styles: [""] });
|
|
2618
|
+
}
|
|
2619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcFields, decorators: [{
|
|
2620
|
+
type: Component,
|
|
2621
|
+
args: [{ selector: 'lib-pjc-fields', imports: [], template: ` <p>pjc-fields works!</p> ` }]
|
|
2622
|
+
}] });
|
|
2623
|
+
|
|
2488
2624
|
/*
|
|
2489
2625
|
* Public API Surface of pjc-fields
|
|
2490
2626
|
*/
|
|
@@ -2493,5 +2629,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2493
2629
|
* Generated bundle index. Do not edit.
|
|
2494
2630
|
*/
|
|
2495
2631
|
|
|
2496
|
-
export { ESTADOS, PJC_CIDADE_SERVICE, PjcCepFieldComponent, PjcChassiFieldComponent, PjcChassiInputDirective, PjcCidadeFieldComponent, PjcCidadeService, PjcCnhFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcDataHoraFieldComponent, PjcEmailFieldComponent, PjcErroValidacaoComponent, PjcFields, PjcHoraFieldComponent, PjcImeiFieldComponent, PjcIntegerFieldComponent, PjcMoedaFieldComponent, PjcNumeroCartaoFieldComponent, PjcPasswordFieldComponent, PjcPlacaFieldComponent, PjcRenavamFieldComponent, PjcTelefoneFieldComponent, PjcTipoPessoaFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators, TIPOS_PESSOA };
|
|
2632
|
+
export { ESTADOS, PJC_CIDADE_SERVICE, PJC_ENUM_SERVICE, PjcCepFieldComponent, PjcChassiFieldComponent, PjcChassiInputDirective, PjcCidadeFieldComponent, PjcCidadeService, PjcCnhFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcDataHoraFieldComponent, PjcEmailFieldComponent, PjcEnumFieldComponent, PjcEnumService, PjcErroValidacaoComponent, PjcFields, PjcHoraFieldComponent, PjcImeiFieldComponent, PjcIntegerFieldComponent, PjcMoedaFieldComponent, PjcNumeroCartaoFieldComponent, PjcPasswordFieldComponent, PjcPlacaFieldComponent, PjcRenavamFieldComponent, PjcTelefoneFieldComponent, PjcTipoPessoaFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators, TIPOS_PESSOA };
|
|
2497
2633
|
//# sourceMappingURL=pjc-fields.mjs.map
|