pjc-fields 0.0.42 → 0.0.43

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.
@@ -2417,6 +2417,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2417
2417
  ], 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" }]
2418
2418
  }], 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 }] }] } });
2419
2419
 
2420
+ const TIPOS_PESSOA = [
2421
+ { label: 'Pessoa Fisica', value: 'FISICA' },
2422
+ { label: 'Pessoa Juridica', value: 'JURIDICA' },
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 */ []));
2428
+ labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
2429
+ readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
2430
+ erros = input({}, ...(ngDevMode ? [{ debugName: "erros" }] : /* istanbul ignore next */ []));
2431
+ injector = inject(Injector);
2432
+ cdr = inject(ChangeDetectorRef);
2433
+ destroyRef = inject(DestroyRef);
2434
+ ngControl = null;
2435
+ tiposPessoa = TIPOS_PESSOA;
2436
+ value = null;
2437
+ disabled = false;
2438
+ onChange = () => { };
2439
+ onTouched = () => { };
2440
+ ngOnInit() {
2441
+ this.ngControl = initFormValidation(this.injector, this.cdr, this.destroyRef);
2442
+ }
2443
+ get invalid() {
2444
+ return isFormControlInvalid(this.ngControl);
2445
+ }
2446
+ get errorMessage() {
2447
+ return getErrorMessage(this.ngControl, this.erros());
2448
+ }
2449
+ writeValue(val) {
2450
+ this.value = val;
2451
+ }
2452
+ registerOnChange(fn) {
2453
+ this.onChange = fn;
2454
+ }
2455
+ registerOnTouched(fn) {
2456
+ this.onTouched = fn;
2457
+ }
2458
+ setDisabledState(isDisabled) {
2459
+ this.disabled = isDisabled;
2460
+ }
2461
+ onModelChange(value) {
2462
+ this.value = value;
2463
+ this.onChange(value);
2464
+ }
2465
+ onModelTouched() {
2466
+ this.onTouched();
2467
+ }
2468
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTipoPessoaFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2469
+ 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: [
2470
+ {
2471
+ provide: NG_VALUE_ACCESSOR,
2472
+ useExisting: forwardRef(() => PjcTipoPessoaFieldComponent),
2473
+ multi: true,
2474
+ },
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 <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$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 });
2476
+ }
2477
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTipoPessoaFieldComponent, decorators: [{
2478
+ type: Component,
2479
+ args: [{ selector: 'pjc-tipo-pessoa-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, SelectModule, FloatLabelModule, MessageModule], providers: [
2480
+ {
2481
+ provide: NG_VALUE_ACCESSOR,
2482
+ useExisting: forwardRef(() => PjcTipoPessoaFieldComponent),
2483
+ multi: true,
2484
+ },
2485
+ ], 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" }]
2486
+ }], 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
+
2420
2488
  /*
2421
2489
  * Public API Surface of pjc-fields
2422
2490
  */
@@ -2425,5 +2493,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
2425
2493
  * Generated bundle index. Do not edit.
2426
2494
  */
2427
2495
 
2428
- 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, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators };
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 };
2429
2497
  //# sourceMappingURL=pjc-fields.mjs.map