pjc-fields 0.0.12 → 0.0.13
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 +293 -13
- package/fesm2022/pjc-fields.mjs.map +1 -1
- package/package.json +1 -1
- package/types/pjc-fields.d.ts +72 -1
package/fesm2022/pjc-fields.mjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, input, forwardRef, ChangeDetectionStrategy, inject, ElementRef, output } from '@angular/core';
|
|
2
|
+
import { Component, input, forwardRef, ChangeDetectionStrategy, inject, ElementRef, output, Directive } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
5
5
|
import * as i2 from 'primeng/inputmask';
|
|
6
6
|
import { InputMaskModule } from 'primeng/inputmask';
|
|
7
7
|
import * as i3 from 'primeng/floatlabel';
|
|
8
8
|
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i1$1 from 'primeng/inputtext';
|
|
10
10
|
import { InputTextModule } from 'primeng/inputtext';
|
|
11
|
-
import * as i2$
|
|
11
|
+
import * as i2$1 from 'primeng/datepicker';
|
|
12
12
|
import { DatePickerModule } from 'primeng/datepicker';
|
|
13
13
|
import * as i3$1 from 'primeng/inputgroup';
|
|
14
14
|
import { InputGroupModule } from 'primeng/inputgroup';
|
|
15
15
|
import * as i4 from 'primeng/inputgroupaddon';
|
|
16
16
|
import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
|
|
17
17
|
import { ButtonModule } from 'primeng/button';
|
|
18
|
-
import * as i2$
|
|
18
|
+
import * as i2$2 from 'primeng/select';
|
|
19
19
|
import { SelectModule } from 'primeng/select';
|
|
20
|
-
import * as i2$
|
|
20
|
+
import * as i2$3 from 'primeng/inputnumber';
|
|
21
21
|
import { InputNumberModule } from 'primeng/inputnumber';
|
|
22
22
|
|
|
23
23
|
class PjcFields {
|
|
@@ -184,6 +184,74 @@ class PjcValidators {
|
|
|
184
184
|
}
|
|
185
185
|
return sum % 10 === 0;
|
|
186
186
|
}
|
|
187
|
+
static renavam() {
|
|
188
|
+
return (control) => {
|
|
189
|
+
const digits = control.value?.replace(/\D/g, '');
|
|
190
|
+
if (!digits)
|
|
191
|
+
return null;
|
|
192
|
+
if (!PjcValidators.validateRenavam(digits)) {
|
|
193
|
+
return { renavamInvalido: true };
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
static validateRenavam(digits) {
|
|
199
|
+
if (digits.length < 1 || digits.length > 11)
|
|
200
|
+
return false;
|
|
201
|
+
const padded = digits.padStart(11, '0');
|
|
202
|
+
const weights = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3];
|
|
203
|
+
const reversed = padded.substring(0, 10).split('').reverse();
|
|
204
|
+
let sum = 0;
|
|
205
|
+
for (let i = 0; i < 10; i++) {
|
|
206
|
+
sum += Number.parseInt(reversed[i]) * weights[i];
|
|
207
|
+
}
|
|
208
|
+
let digit = (sum * 10) % 11;
|
|
209
|
+
if (digit === 10)
|
|
210
|
+
digit = 0;
|
|
211
|
+
return digit === Number.parseInt(padded[10]);
|
|
212
|
+
}
|
|
213
|
+
static chassi() {
|
|
214
|
+
return (control) => {
|
|
215
|
+
const value = control.value;
|
|
216
|
+
if (!value)
|
|
217
|
+
return null;
|
|
218
|
+
const chassiRegex = /^[A-HJ-NPR-Z0-9]{17}$/;
|
|
219
|
+
return chassiRegex.test(value) ? null : { chassiInvalido: true };
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
static cnh() {
|
|
223
|
+
return (control) => {
|
|
224
|
+
const digits = control.value?.replace(/\D/g, '');
|
|
225
|
+
if (!digits)
|
|
226
|
+
return null;
|
|
227
|
+
if (!PjcValidators.validateCnh(digits)) {
|
|
228
|
+
return { cnhInvalida: true };
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
static validateCnh(digits) {
|
|
234
|
+
if (digits.length !== 11 || /^(\d)\1+$/.test(digits))
|
|
235
|
+
return false;
|
|
236
|
+
const weights1 = [9, 8, 7, 6, 5, 4, 3, 2, 1];
|
|
237
|
+
let sum1 = 0;
|
|
238
|
+
for (let i = 0; i < 9; i++) {
|
|
239
|
+
sum1 += Number.parseInt(digits[i]) * weights1[i];
|
|
240
|
+
}
|
|
241
|
+
const remainder1 = sum1 % 11;
|
|
242
|
+
const dv1 = remainder1 >= 10 ? 0 : remainder1;
|
|
243
|
+
const variation = remainder1 > 9 ? -2 : 0;
|
|
244
|
+
const weights2 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
245
|
+
let sum2 = 0;
|
|
246
|
+
for (let i = 0; i < 9; i++) {
|
|
247
|
+
sum2 += Number.parseInt(digits[i]) * weights2[i];
|
|
248
|
+
}
|
|
249
|
+
let result2 = (sum2 % 11) + variation;
|
|
250
|
+
if (result2 < 0)
|
|
251
|
+
result2 += 11;
|
|
252
|
+
const dv2 = result2 >= 10 ? 0 : result2;
|
|
253
|
+
return dv1 === Number.parseInt(digits[9]) && dv2 === Number.parseInt(digits[10]);
|
|
254
|
+
}
|
|
187
255
|
static cep() {
|
|
188
256
|
return (control) => {
|
|
189
257
|
const digits = control.value?.replace(/\D/g, '');
|
|
@@ -467,7 +535,7 @@ class PjcCpfCnpjFieldComponent {
|
|
|
467
535
|
useExisting: forwardRef(() => PjcCpfCnpjFieldComponent),
|
|
468
536
|
multi: true,
|
|
469
537
|
},
|
|
470
|
-
], 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 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 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</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type:
|
|
538
|
+
], 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 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 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</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
471
539
|
}
|
|
472
540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCpfCnpjFieldComponent, decorators: [{
|
|
473
541
|
type: Component,
|
|
@@ -623,7 +691,7 @@ class PjcTelefoneFieldComponent {
|
|
|
623
691
|
useExisting: forwardRef(() => PjcTelefoneFieldComponent),
|
|
624
692
|
multi: true,
|
|
625
693
|
},
|
|
626
|
-
], 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 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 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</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type:
|
|
694
|
+
], 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 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 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</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
627
695
|
}
|
|
628
696
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcTelefoneFieldComponent, decorators: [{
|
|
629
697
|
type: Component,
|
|
@@ -735,7 +803,7 @@ class PjcDataFieldComponent {
|
|
|
735
803
|
useExisting: forwardRef(() => PjcDataFieldComponent),
|
|
736
804
|
multi: true,
|
|
737
805
|
},
|
|
738
|
-
], 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 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</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$
|
|
806
|
+
], 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 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</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 });
|
|
739
807
|
}
|
|
740
808
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcDataFieldComponent, decorators: [{
|
|
741
809
|
type: Component,
|
|
@@ -842,7 +910,7 @@ class PjcUppercaseFieldComponent {
|
|
|
842
910
|
useExisting: forwardRef(() => PjcUppercaseFieldComponent),
|
|
843
911
|
multi: true,
|
|
844
912
|
},
|
|
845
|
-
], 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 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=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type:
|
|
913
|
+
], 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 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=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
846
914
|
}
|
|
847
915
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUppercaseFieldComponent, decorators: [{
|
|
848
916
|
type: Component,
|
|
@@ -992,7 +1060,7 @@ class PjcUfFieldComponent {
|
|
|
992
1060
|
useExisting: forwardRef(() => PjcUfFieldComponent),
|
|
993
1061
|
multi: true,
|
|
994
1062
|
},
|
|
995
|
-
], 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\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\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 />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\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$
|
|
1063
|
+
], 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\"\n styleClass=\"w-full border border-surface-300 rounded-md focus:border-primary-500 transition-colors\"\n class=\"w-full\"\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 />\n }\n\n @if (hint()) {\n <small class=\"text-xs text-surface-500\">{{ hint() }}</small>\n }\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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
996
1064
|
}
|
|
997
1065
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcUfFieldComponent, decorators: [{
|
|
998
1066
|
type: Component,
|
|
@@ -1042,7 +1110,7 @@ class PjcEmailFieldComponent {
|
|
|
1042
1110
|
useExisting: forwardRef(() => PjcEmailFieldComponent),
|
|
1043
1111
|
multi: true,
|
|
1044
1112
|
},
|
|
1045
|
-
], 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 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=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type:
|
|
1113
|
+
], 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 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=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500\"\n />\n }\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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1046
1114
|
}
|
|
1047
1115
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcEmailFieldComponent, decorators: [{
|
|
1048
1116
|
type: Component,
|
|
@@ -1097,7 +1165,7 @@ class PjcIntegerFieldComponent {
|
|
|
1097
1165
|
useExisting: forwardRef(() => PjcIntegerFieldComponent),
|
|
1098
1166
|
multi: true,
|
|
1099
1167
|
},
|
|
1100
|
-
], 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 [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 />\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 />\n }\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$
|
|
1168
|
+
], 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 [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 />\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 />\n }\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$3.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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1101
1169
|
}
|
|
1102
1170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcIntegerFieldComponent, decorators: [{
|
|
1103
1171
|
type: Component,
|
|
@@ -1172,6 +1240,218 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1172
1240
|
], 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 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 <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 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</div>\n" }]
|
|
1173
1241
|
}], 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 }] }] } });
|
|
1174
1242
|
|
|
1243
|
+
class PjcRenavamFieldComponent {
|
|
1244
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1245
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1246
|
+
placeholder = input('00000000000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1247
|
+
id = input(`pjc-renavam-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1248
|
+
labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1249
|
+
value = '';
|
|
1250
|
+
disabled = false;
|
|
1251
|
+
onChange = () => { };
|
|
1252
|
+
onTouched = () => { };
|
|
1253
|
+
writeValue(val) {
|
|
1254
|
+
this.value = val ?? '';
|
|
1255
|
+
}
|
|
1256
|
+
registerOnChange(fn) {
|
|
1257
|
+
this.onChange = fn;
|
|
1258
|
+
}
|
|
1259
|
+
registerOnTouched(fn) {
|
|
1260
|
+
this.onTouched = fn;
|
|
1261
|
+
}
|
|
1262
|
+
setDisabledState(isDisabled) {
|
|
1263
|
+
this.disabled = isDisabled;
|
|
1264
|
+
}
|
|
1265
|
+
onModelChange(value) {
|
|
1266
|
+
this.value = value ?? '';
|
|
1267
|
+
this.onChange(this.value);
|
|
1268
|
+
}
|
|
1269
|
+
onModelTouched() {
|
|
1270
|
+
this.onTouched();
|
|
1271
|
+
}
|
|
1272
|
+
validate(control) {
|
|
1273
|
+
return PjcValidators.renavam()(control);
|
|
1274
|
+
}
|
|
1275
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcRenavamFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1276
|
+
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 } }, providers: [
|
|
1277
|
+
{
|
|
1278
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1279
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
1280
|
+
multi: true,
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
provide: NG_VALIDATORS,
|
|
1284
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
1285
|
+
multi: true,
|
|
1286
|
+
},
|
|
1287
|
+
], 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 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 <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 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</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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1288
|
+
}
|
|
1289
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcRenavamFieldComponent, decorators: [{
|
|
1290
|
+
type: Component,
|
|
1291
|
+
args: [{ selector: 'pjc-renavam-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule], providers: [
|
|
1292
|
+
{
|
|
1293
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1294
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
1295
|
+
multi: true,
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
provide: NG_VALIDATORS,
|
|
1299
|
+
useExisting: forwardRef(() => PjcRenavamFieldComponent),
|
|
1300
|
+
multi: true,
|
|
1301
|
+
},
|
|
1302
|
+
], 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 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 <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 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</div>\n" }]
|
|
1303
|
+
}], 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 }] }] } });
|
|
1304
|
+
|
|
1305
|
+
const VIN_ALLOWED = /^[A-HJ-NPR-Z0-9]$/;
|
|
1306
|
+
class PjcChassiInputDirective {
|
|
1307
|
+
onKeyDown(event) {
|
|
1308
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey)
|
|
1309
|
+
return;
|
|
1310
|
+
if (!VIN_ALLOWED.test(event.key.toUpperCase())) {
|
|
1311
|
+
event.preventDefault();
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
onInput(event) {
|
|
1315
|
+
const input = event.target;
|
|
1316
|
+
const sanitized = input.value
|
|
1317
|
+
.toUpperCase()
|
|
1318
|
+
.replace(/[^A-HJ-NPR-Z0-9]/g, '')
|
|
1319
|
+
.substring(0, 17);
|
|
1320
|
+
if (input.value !== sanitized) {
|
|
1321
|
+
input.value = sanitized;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1325
|
+
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 });
|
|
1326
|
+
}
|
|
1327
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiInputDirective, decorators: [{
|
|
1328
|
+
type: Directive,
|
|
1329
|
+
args: [{
|
|
1330
|
+
selector: 'input[pjcChassi]',
|
|
1331
|
+
host: {
|
|
1332
|
+
'(keydown)': 'onKeyDown($event)',
|
|
1333
|
+
'(input)': 'onInput($event)',
|
|
1334
|
+
},
|
|
1335
|
+
}]
|
|
1336
|
+
}] });
|
|
1337
|
+
|
|
1338
|
+
class PjcChassiFieldComponent {
|
|
1339
|
+
label = input('Chassi', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1340
|
+
placeholder = input('Digite o chassi', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1341
|
+
id = input(`pjc-chassi-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1342
|
+
labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1343
|
+
value = '';
|
|
1344
|
+
onChange = () => { };
|
|
1345
|
+
onTouched = () => { };
|
|
1346
|
+
writeValue(val) {
|
|
1347
|
+
this.value = val?.toUpperCase().replace(/[^A-HJ-NPR-Z0-9]/g, '').substring(0, 17) ?? '';
|
|
1348
|
+
}
|
|
1349
|
+
registerOnChange(fn) {
|
|
1350
|
+
this.onChange = fn;
|
|
1351
|
+
}
|
|
1352
|
+
registerOnTouched(fn) {
|
|
1353
|
+
this.onTouched = fn;
|
|
1354
|
+
}
|
|
1355
|
+
validate(control) {
|
|
1356
|
+
return PjcValidators.chassi()(control);
|
|
1357
|
+
}
|
|
1358
|
+
onInput(event) {
|
|
1359
|
+
const val = event.target.value;
|
|
1360
|
+
this.value = val;
|
|
1361
|
+
this.onChange(val);
|
|
1362
|
+
}
|
|
1363
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1364
|
+
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 } }, providers: [
|
|
1365
|
+
{
|
|
1366
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1367
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
1368
|
+
multi: true,
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
provide: NG_VALIDATORS,
|
|
1372
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
1373
|
+
multi: true,
|
|
1374
|
+
},
|
|
1375
|
+
], 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 maxlength=\"17\"\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 pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n maxlength=\"17\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\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.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "directive", type: PjcChassiInputDirective, selector: "input[pjcChassi]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1376
|
+
}
|
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcChassiFieldComponent, decorators: [{
|
|
1378
|
+
type: Component,
|
|
1379
|
+
args: [{ selector: 'pjc-chassi-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputTextModule, FloatLabelModule, PjcChassiInputDirective], providers: [
|
|
1380
|
+
{
|
|
1381
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1382
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
1383
|
+
multi: true,
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
provide: NG_VALIDATORS,
|
|
1387
|
+
useExisting: forwardRef(() => PjcChassiFieldComponent),
|
|
1388
|
+
multi: true,
|
|
1389
|
+
},
|
|
1390
|
+
], 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 maxlength=\"17\"\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 pjcChassi\n [id]=\"id()\"\n [value]=\"value\"\n (input)=\"onInput($event)\"\n (blur)=\"onTouched()\"\n [placeholder]=\"placeholder()\"\n maxlength=\"17\"\n class=\"w-full p-2 border border-surface-300 rounded-md outline-none bg-transparent focus:border-primary-500 uppercase\"\n />\n }\n</div>\n" }]
|
|
1391
|
+
}], 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 }] }] } });
|
|
1392
|
+
|
|
1393
|
+
class PjcCnhFieldComponent {
|
|
1394
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1395
|
+
hint = input('', ...(ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
1396
|
+
placeholder = input('00000000000', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1397
|
+
id = input(`pjc-cnh-${Math.random().toString(36).substring(2, 9)}`, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
1398
|
+
labelVariant = input('over', ...(ngDevMode ? [{ debugName: "labelVariant" }] : /* istanbul ignore next */ []));
|
|
1399
|
+
value = '';
|
|
1400
|
+
disabled = false;
|
|
1401
|
+
onChange = () => { };
|
|
1402
|
+
onTouched = () => { };
|
|
1403
|
+
writeValue(val) {
|
|
1404
|
+
this.value = val ?? '';
|
|
1405
|
+
}
|
|
1406
|
+
registerOnChange(fn) {
|
|
1407
|
+
this.onChange = fn;
|
|
1408
|
+
}
|
|
1409
|
+
registerOnTouched(fn) {
|
|
1410
|
+
this.onTouched = fn;
|
|
1411
|
+
}
|
|
1412
|
+
setDisabledState(isDisabled) {
|
|
1413
|
+
this.disabled = isDisabled;
|
|
1414
|
+
}
|
|
1415
|
+
onModelChange(value) {
|
|
1416
|
+
this.value = value ?? '';
|
|
1417
|
+
this.onChange(this.value);
|
|
1418
|
+
}
|
|
1419
|
+
onModelTouched() {
|
|
1420
|
+
this.onTouched();
|
|
1421
|
+
}
|
|
1422
|
+
validate(control) {
|
|
1423
|
+
return PjcValidators.cnh()(control);
|
|
1424
|
+
}
|
|
1425
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnhFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1426
|
+
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 } }, providers: [
|
|
1427
|
+
{
|
|
1428
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1429
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
1430
|
+
multi: true,
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
provide: NG_VALIDATORS,
|
|
1434
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
1435
|
+
multi: true,
|
|
1436
|
+
},
|
|
1437
|
+
], 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 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 <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 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</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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1438
|
+
}
|
|
1439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: PjcCnhFieldComponent, decorators: [{
|
|
1440
|
+
type: Component,
|
|
1441
|
+
args: [{ selector: 'pjc-cnh-field', changeDetection: ChangeDetectionStrategy.OnPush, imports: [FormsModule, InputMaskModule, FloatLabelModule], providers: [
|
|
1442
|
+
{
|
|
1443
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1444
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
1445
|
+
multi: true,
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
provide: NG_VALIDATORS,
|
|
1449
|
+
useExisting: forwardRef(() => PjcCnhFieldComponent),
|
|
1450
|
+
multi: true,
|
|
1451
|
+
},
|
|
1452
|
+
], 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 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 <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 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</div>\n" }]
|
|
1453
|
+
}], 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 }] }] } });
|
|
1454
|
+
|
|
1175
1455
|
/*
|
|
1176
1456
|
* Public API Surface of pjc-fields
|
|
1177
1457
|
*/
|
|
@@ -1180,5 +1460,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1180
1460
|
* Generated bundle index. Do not edit.
|
|
1181
1461
|
*/
|
|
1182
1462
|
|
|
1183
|
-
export { PjcCepFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcEmailFieldComponent, PjcFields, PjcHoraFieldComponent, PjcIntegerFieldComponent, PjcNumeroCartaoFieldComponent, PjcPlacaFieldComponent, PjcTelefoneFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators };
|
|
1463
|
+
export { PjcCepFieldComponent, PjcChassiFieldComponent, PjcChassiInputDirective, PjcCnhFieldComponent, PjcCnpjFieldComponent, PjcCpfCnpjFieldComponent, PjcCpfFieldComponent, PjcDataFieldComponent, PjcEmailFieldComponent, PjcFields, PjcHoraFieldComponent, PjcIntegerFieldComponent, PjcNumeroCartaoFieldComponent, PjcPlacaFieldComponent, PjcRenavamFieldComponent, PjcTelefoneFieldComponent, PjcUfFieldComponent, PjcUppercaseFieldComponent, PjcValidators };
|
|
1184
1464
|
//# sourceMappingURL=pjc-fields.mjs.map
|