pjc-fields 0.0.25 → 0.0.29
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 +145 -5
- package/fesm2022/pjc-fields.mjs.map +1 -1
- package/package.json +1 -1
- package/types/pjc-fields.d.ts +32 -2
package/fesm2022/pjc-fields.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, input, forwardRef, ChangeDetectionStrategy, inject, ElementRef, output, Directive,
|
|
2
|
+
import { Component, input, forwardRef, ChangeDetectionStrategy, signal, computed, inject, ElementRef, output, Directive, ChangeDetectorRef, DestroyRef } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS, ControlContainer } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/inputmask';
|
|
@@ -764,8 +764,16 @@ class PjcDataFieldComponent {
|
|
|
764
764
|
maxDate = input(undefined, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
765
765
|
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
766
766
|
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
767
|
+
mostrarAniversario = input(false, ...(ngDevMode ? [{ debugName: "mostrarAniversario" }] : /* istanbul ignore next */ []));
|
|
767
768
|
value = null;
|
|
768
769
|
disabled = false;
|
|
770
|
+
valueSignal = signal(null, ...(ngDevMode ? [{ debugName: "valueSignal" }] : /* istanbul ignore next */ []));
|
|
771
|
+
age = computed(() => {
|
|
772
|
+
const date = this.valueSignal();
|
|
773
|
+
if (!date)
|
|
774
|
+
return null;
|
|
775
|
+
return this.calculateAge(date);
|
|
776
|
+
}, ...(ngDevMode ? [{ debugName: "age" }] : /* istanbul ignore next */ []));
|
|
769
777
|
onChange = () => { };
|
|
770
778
|
onTouched = () => { };
|
|
771
779
|
el = inject(ElementRef);
|
|
@@ -828,8 +836,18 @@ class PjcDataFieldComponent {
|
|
|
828
836
|
this.disabled = isDisabled;
|
|
829
837
|
}
|
|
830
838
|
onValueChange(date) {
|
|
839
|
+
this.valueSignal.set(date);
|
|
831
840
|
this.onChange(date);
|
|
832
841
|
}
|
|
842
|
+
calculateAge(birthDate) {
|
|
843
|
+
const today = new Date();
|
|
844
|
+
let age = today.getFullYear() - birthDate.getFullYear();
|
|
845
|
+
const monthDiff = today.getMonth() - birthDate.getMonth();
|
|
846
|
+
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
|
|
847
|
+
age--;
|
|
848
|
+
}
|
|
849
|
+
return age;
|
|
850
|
+
}
|
|
833
851
|
validate(_control) {
|
|
834
852
|
const value = this.value;
|
|
835
853
|
if (!value)
|
|
@@ -845,7 +863,7 @@ class PjcDataFieldComponent {
|
|
|
845
863
|
return null;
|
|
846
864
|
}
|
|
847
865
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
848
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcDataFieldComponent, isStandalone: true, selector: "pjc-data-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", 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 } }, providers: [
|
|
866
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcDataFieldComponent, isStandalone: true, selector: "pjc-data-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", 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 }, mostrarAniversario: { classPropertyName: "mostrarAniversario", publicName: "mostrarAniversario", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
849
867
|
{
|
|
850
868
|
provide: NG_VALUE_ACCESSOR,
|
|
851
869
|
useExisting: forwardRef(() => PjcDataFieldComponent),
|
|
@@ -856,7 +874,7 @@ class PjcDataFieldComponent {
|
|
|
856
874
|
useExisting: forwardRef(() => PjcDataFieldComponent),
|
|
857
875
|
multi: true,
|
|
858
876
|
},
|
|
859
|
-
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></p-datePicker>\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$1.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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
877
|
+
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></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 <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$1.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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
860
878
|
}
|
|
861
879
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataFieldComponent, decorators: [{
|
|
862
880
|
type: Component,
|
|
@@ -871,7 +889,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
871
889
|
useExisting: forwardRef(() => PjcDataFieldComponent),
|
|
872
890
|
multi: true,
|
|
873
891
|
},
|
|
874
|
-
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></p-datePicker>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
892
|
+
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></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 <ng-content></ng-content>\n</div>\n" }]
|
|
893
|
+
}], 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 }] }], mostrarAniversario: [{ type: i0.Input, args: [{ isSignal: true, alias: "mostrarAniversario", required: false }] }] } });
|
|
894
|
+
|
|
895
|
+
class PjcDataHoraFieldComponent {
|
|
896
|
+
label = input('Data e Hora', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
897
|
+
id = input(`pjc-data-hora-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
898
|
+
minDate = input(undefined, ...(ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []));
|
|
899
|
+
maxDate = input(undefined, ...(ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []));
|
|
900
|
+
labelVariant = input('on', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
901
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
902
|
+
value = null;
|
|
903
|
+
disabled = false;
|
|
904
|
+
onChange = () => { };
|
|
905
|
+
onTouched = () => { };
|
|
906
|
+
el = inject(ElementRef);
|
|
907
|
+
isFormatting = false;
|
|
908
|
+
ngAfterViewInit() {
|
|
909
|
+
const input = this.el.nativeElement.querySelector('input');
|
|
910
|
+
if (input) {
|
|
911
|
+
input.addEventListener('input', this.handleDateInput);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
ngOnDestroy() {
|
|
915
|
+
const input = this.el.nativeElement.querySelector('input');
|
|
916
|
+
if (input) {
|
|
917
|
+
input.removeEventListener('input', this.handleDateInput);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
handleDateInput = (event) => {
|
|
921
|
+
if (this.isFormatting)
|
|
922
|
+
return;
|
|
923
|
+
const input = event.target;
|
|
924
|
+
const raw = input.value;
|
|
925
|
+
const cursor = input.selectionStart ?? raw.length;
|
|
926
|
+
const digits = raw.replace(/\D/g, '').substring(0, 12);
|
|
927
|
+
let formatted = digits;
|
|
928
|
+
if (digits.length > 2) {
|
|
929
|
+
formatted = `${digits.substring(0, 2)}/${digits.substring(2)}`;
|
|
930
|
+
}
|
|
931
|
+
if (digits.length > 4) {
|
|
932
|
+
formatted = `${digits.substring(0, 2)}/${digits.substring(2, 4)}/${digits.substring(4)}`;
|
|
933
|
+
}
|
|
934
|
+
if (digits.length > 8) {
|
|
935
|
+
formatted = `${digits.substring(0, 2)}/${digits.substring(2, 4)}/${digits.substring(4, 8)} ${digits.substring(8)}`;
|
|
936
|
+
}
|
|
937
|
+
if (digits.length > 10) {
|
|
938
|
+
formatted = `${digits.substring(0, 2)}/${digits.substring(2, 4)}/${digits.substring(4, 8)} ${digits.substring(8, 10)}:${digits.substring(10)}`;
|
|
939
|
+
}
|
|
940
|
+
if (raw === formatted)
|
|
941
|
+
return;
|
|
942
|
+
const digitsBeforeCursor = raw.substring(0, cursor).replace(/\D/g, '').length;
|
|
943
|
+
this.isFormatting = true;
|
|
944
|
+
input.value = formatted;
|
|
945
|
+
this.isFormatting = false;
|
|
946
|
+
let newCursor = 0;
|
|
947
|
+
let digitCount = 0;
|
|
948
|
+
for (let i = 0; i < formatted.length; i++) {
|
|
949
|
+
if (/\d/.test(formatted[i]))
|
|
950
|
+
digitCount++;
|
|
951
|
+
if (digitCount === digitsBeforeCursor) {
|
|
952
|
+
newCursor = i + 1;
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
input.setSelectionRange(newCursor, newCursor);
|
|
957
|
+
};
|
|
958
|
+
writeValue(val) {
|
|
959
|
+
this.value = val ?? null;
|
|
960
|
+
}
|
|
961
|
+
registerOnChange(fn) {
|
|
962
|
+
this.onChange = fn;
|
|
963
|
+
}
|
|
964
|
+
registerOnTouched(fn) {
|
|
965
|
+
this.onTouched = fn;
|
|
966
|
+
}
|
|
967
|
+
setDisabledState(isDisabled) {
|
|
968
|
+
this.disabled = isDisabled;
|
|
969
|
+
}
|
|
970
|
+
onValueChange(date) {
|
|
971
|
+
this.onChange(date);
|
|
972
|
+
}
|
|
973
|
+
validate(_control) {
|
|
974
|
+
const value = this.value;
|
|
975
|
+
if (!value)
|
|
976
|
+
return null;
|
|
977
|
+
const minDate = this.minDate();
|
|
978
|
+
if (minDate && value < minDate) {
|
|
979
|
+
return { dataMinima: { min: minDate, atual: value } };
|
|
980
|
+
}
|
|
981
|
+
const maxDate = this.maxDate();
|
|
982
|
+
if (maxDate && value > maxDate) {
|
|
983
|
+
return { dataMaxima: { max: maxDate, atual: value } };
|
|
984
|
+
}
|
|
985
|
+
return null;
|
|
986
|
+
}
|
|
987
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataHoraFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
988
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: PjcDataHoraFieldComponent, isStandalone: true, selector: "pjc-data-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 }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", 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 } }, providers: [
|
|
989
|
+
{
|
|
990
|
+
provide: NG_VALUE_ACCESSOR,
|
|
991
|
+
useExisting: forwardRef(() => PjcDataHoraFieldComponent),
|
|
992
|
+
multi: true,
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
provide: NG_VALIDATORS,
|
|
996
|
+
useExisting: forwardRef(() => PjcDataHoraFieldComponent),
|
|
997
|
+
multi: true,
|
|
998
|
+
},
|
|
999
|
+
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></p-datePicker>\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$1.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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1000
|
+
}
|
|
1001
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataHoraFieldComponent, decorators: [{
|
|
1002
|
+
type: Component,
|
|
1003
|
+
args: [{ selector: 'pjc-data-hora-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, DatePickerModule, FloatLabelModule], providers: [
|
|
1004
|
+
{
|
|
1005
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1006
|
+
useExisting: forwardRef(() => PjcDataHoraFieldComponent),
|
|
1007
|
+
multi: true,
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
provide: NG_VALIDATORS,
|
|
1011
|
+
useExisting: forwardRef(() => PjcDataHoraFieldComponent),
|
|
1012
|
+
multi: true,
|
|
1013
|
+
},
|
|
1014
|
+
], 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 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\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 ></p-datePicker>\n }\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
875
1015
|
}], 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 }] }] } });
|
|
876
1016
|
|
|
877
1017
|
class PjcHoraFieldComponent {
|
|
@@ -1701,5 +1841,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1701
1841
|
* Generated bundle index. Do not edit.
|
|
1702
1842
|
*/
|
|
1703
1843
|
|
|
1704
|
-
export { PjcCepFieldComponent, PjcChassiFieldComponent, PjcChassiInputDirective, PjcCnhFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcEmailFieldComponent, PjcErroValidacaoComponent, PjcFields, PjcHoraFieldComponent, PjcIntegerFieldComponent, PjcMoedaFieldComponent, PjcNumeroCartaoFieldComponent, PjcPasswordFieldComponent, PjcPlacaFieldComponent, PjcRenavamFieldComponent, PjcTelefoneFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators };
|
|
1844
|
+
export { PjcCepFieldComponent, PjcChassiFieldComponent, PjcChassiInputDirective, PjcCnhFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcDataHoraFieldComponent, PjcEmailFieldComponent, PjcErroValidacaoComponent, PjcFields, PjcHoraFieldComponent, PjcIntegerFieldComponent, PjcMoedaFieldComponent, PjcNumeroCartaoFieldComponent, PjcPasswordFieldComponent, PjcPlacaFieldComponent, PjcRenavamFieldComponent, PjcTelefoneFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators };
|
|
1705
1845
|
//# sourceMappingURL=pjc-fields.mjs.map
|