@webilix/ngx-form-m3 0.0.66 → 0.0.67
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.
|
@@ -229,6 +229,8 @@ class InputErrorPipe {
|
|
|
229
229
|
return `شماره موبایل صحیح مشخص نشده است.`;
|
|
230
230
|
}
|
|
231
231
|
break;
|
|
232
|
+
case 'id':
|
|
233
|
+
return value;
|
|
232
234
|
case 'username':
|
|
233
235
|
return value;
|
|
234
236
|
case 'pattern':
|
|
@@ -373,7 +375,7 @@ class InputBankCardComponent {
|
|
|
373
375
|
setCard(card) {
|
|
374
376
|
card = card.replace(/-/g, '').substring(0, 6);
|
|
375
377
|
const bank = Helper.BANK.findCard(card);
|
|
376
|
-
this.bank.
|
|
378
|
+
this.bank.set(bank?.title || '');
|
|
377
379
|
}
|
|
378
380
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: InputBankCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
379
381
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: InputBankCardComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-bank-card" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\">\n <mat-label>{{ input.title || '\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0628\u0627\u0646\u06A9\u06CC' }}</mat-label>\n @if (formControl.invalid) {\n <mat-error>{{ formControl.errors | InputErrorPipe: input.type }}</mat-error>\n }\n\n <!-- HINT -->\n @if (input.hint) {\n <mat-hint>{{ input.hint }}</mat-hint>\n }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <div class=\"ngx-helper-form-m3-bank-card-input\">\n <!-- BANK NAME -->\n @if (!input.hideBank && bank() !== '') {\n <div class=\"bank\">{{ bank() }}</div>\n }\n\n <input\n matInput\n type=\"text\"\n inputmode=\"numeric\"\n [name]=\"input.name\"\n [formControl]=\"formControl\"\n class=\"ngx-form-m3-en\"\n [maskito]=\"maskitoOptions\"\n [AutoFocusDirective]=\"config.autoFocus === input.name\"\n (input)=\"setValue(); setCard(bankCardInput.value)\"\n #bankCardInput\n />\n </div>\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"], outputs: ["maskitoChange", "maskitoElementChange"] }, { kind: "directive", type: AutoCompleteDirective, selector: "input[type=\"text\"]" }, { kind: "directive", type: AutoFocusDirective, selector: "[AutoFocusDirective]", inputs: ["AutoFocusDirective"] }, { kind: "pipe", type: InputErrorPipe, name: "InputErrorPipe" }, { kind: "pipe", type: MultiLinePipe, name: "MultiLinePipe" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
@@ -528,6 +530,47 @@ const DuplicateValidator = (callback) => {
|
|
|
528
530
|
};
|
|
529
531
|
};
|
|
530
532
|
|
|
533
|
+
const IdValidator = (verify) => {
|
|
534
|
+
return (formControl) => {
|
|
535
|
+
const value = formControl.value;
|
|
536
|
+
if (Helper.IS.empty(value) || !Helper.IS.string(value))
|
|
537
|
+
return null;
|
|
538
|
+
// MINLENGTH
|
|
539
|
+
const minLength = verify?.minLength;
|
|
540
|
+
if (minLength && minLength > 0 && value.length < minLength)
|
|
541
|
+
return { id: `مقدار باید حداقل داری ${Helper.NUMBER.format(minLength)} کاراکتر باشد.` };
|
|
542
|
+
// MAXLENGTH
|
|
543
|
+
const maxLength = verify?.maxLength;
|
|
544
|
+
if (maxLength && maxLength > 0 && value.length > maxLength)
|
|
545
|
+
return { id: `مقدار میتواند حداکثر داری ${Helper.NUMBER.format(maxLength)} کاراکتر باشد.` };
|
|
546
|
+
// ID
|
|
547
|
+
const regExp = new RegExp(/^[a-z0-9-.]{1,}$/);
|
|
548
|
+
if (!regExp.test(value)) {
|
|
549
|
+
const chars = [].filter((char) => char !== '');
|
|
550
|
+
return { id: 'کاراکترهای مجاز: حروف انگلیسی کوچک و اعداد انگلیسی' };
|
|
551
|
+
}
|
|
552
|
+
// USE DASH
|
|
553
|
+
if (!verify?.useDash && value.indexOf('-') !== -1)
|
|
554
|
+
return { id: `امکان استفاده از خط فاصله در مقدار وجود ندارد.` };
|
|
555
|
+
// USE DOT
|
|
556
|
+
if (!verify?.useDot && value.indexOf('.') !== -1)
|
|
557
|
+
return { id: `امکان استفاده از نقطه در مقدار وجود ندارد.` };
|
|
558
|
+
// START WITH CHAR
|
|
559
|
+
if (!verify?.canStartWithNumber) {
|
|
560
|
+
const regExp = new RegExp(/^[a-z]{1}/);
|
|
561
|
+
if (!regExp.test(value))
|
|
562
|
+
return { id: 'مقدار باید با یک کاراکتر انگلیسی شروع شده باشد.' };
|
|
563
|
+
}
|
|
564
|
+
// END WITH CHAR
|
|
565
|
+
if (!verify?.canEndWithNumber) {
|
|
566
|
+
const regExp = new RegExp(/[a-z]{1}$/);
|
|
567
|
+
if (!regExp.test(value))
|
|
568
|
+
return { id: 'مقدار باید با یک کاراکتر انگلیسی تمام شده باشد.' };
|
|
569
|
+
}
|
|
570
|
+
return null;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
|
|
531
574
|
const LengthValidator = (length) => {
|
|
532
575
|
return (formControl) => {
|
|
533
576
|
const value = formControl.value;
|
|
@@ -573,10 +616,10 @@ const UsernameValidator = (verify) => {
|
|
|
573
616
|
}
|
|
574
617
|
// USE DASH
|
|
575
618
|
if (!verify?.useDash && value.indexOf('-') !== -1)
|
|
576
|
-
return { username: `امکان استفاده از خط فاصله در
|
|
619
|
+
return { username: `امکان استفاده از خط فاصله در نام کاربری وجود ندارد.` };
|
|
577
620
|
// USE DOT
|
|
578
621
|
if (!verify?.useDot && value.indexOf('.') !== -1)
|
|
579
|
-
return { username: `امکان استفاده از نقطه در
|
|
622
|
+
return { username: `امکان استفاده از نقطه در نام کاربری وجود ندارد.` };
|
|
580
623
|
// START WITH CHAR
|
|
581
624
|
if (!!verify?.startWithChar) {
|
|
582
625
|
const regExp = new RegExp(/^[a-z]{1}/);
|
|
@@ -1015,6 +1058,46 @@ class InputIconMethods extends InputMethods {
|
|
|
1015
1058
|
}
|
|
1016
1059
|
}
|
|
1017
1060
|
|
|
1061
|
+
class InputIdComponent {
|
|
1062
|
+
formControl = inject(INPUT_CONTROL);
|
|
1063
|
+
input = inject(INPUT_TYPE);
|
|
1064
|
+
config = inject(INPUT_CONFIG);
|
|
1065
|
+
values;
|
|
1066
|
+
isButtonDisabled;
|
|
1067
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: InputIdComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1068
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: InputIdComponent, isStandalone: true, selector: "ng-component", inputs: { values: "values", isButtonDisabled: "isButtonDisabled" }, host: { attributes: { "selector": "input-id" } }, ngImport: i0, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\">\n <mat-label>{{ input.title || '\u0634\u0646\u0627\u0633\u0647' }}</mat-label>\n @if (formControl.invalid) {\n <mat-error>{{ formControl.errors | InputErrorPipe: input.type }}</mat-error>\n }\n\n <!-- HINT -->\n @if (input.hint) {\n <mat-hint>{{ input.hint }}</mat-hint>\n }\n\n <!-- ICON -->\n @if (input.showIcon) {\n <span matTextSuffix class=\"ngx-form-m3-input-suffix\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon>label</mat-icon>\n </span>\n }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input\n matInput\n type=\"text\"\n [name]=\"input.name\"\n [formControl]=\"formControl\"\n class=\"ngx-form-m3-en\"\n [maxLength]=\"input.verify?.maxLength || 524288\"\n [AutoFocusDirective]=\"config.autoFocus === input.name\"\n />\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2$1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i2$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i2$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: AutoCompleteDirective, selector: "input[type=\"text\"]" }, { kind: "directive", type: AutoFocusDirective, selector: "[AutoFocusDirective]", inputs: ["AutoFocusDirective"] }, { kind: "pipe", type: InputErrorPipe, name: "InputErrorPipe" }, { kind: "pipe", type: MultiLinePipe, name: "MultiLinePipe" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
|
|
1069
|
+
}
|
|
1070
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: InputIdComponent, decorators: [{
|
|
1071
|
+
type: Component,
|
|
1072
|
+
args: [{ host: { selector: 'input-id' }, imports: [
|
|
1073
|
+
ReactiveFormsModule,
|
|
1074
|
+
MatFormField,
|
|
1075
|
+
MatIcon,
|
|
1076
|
+
MatIconButton,
|
|
1077
|
+
MatInputModule,
|
|
1078
|
+
AutoCompleteDirective,
|
|
1079
|
+
AutoFocusDirective,
|
|
1080
|
+
InputErrorPipe,
|
|
1081
|
+
MultiLinePipe,
|
|
1082
|
+
], changeDetection: ChangeDetectionStrategy.Eager, template: "<mat-form-field [appearance]=\"input.appearance || config.appearance\">\n <mat-label>{{ input.title || '\u0634\u0646\u0627\u0633\u0647' }}</mat-label>\n @if (formControl.invalid) {\n <mat-error>{{ formControl.errors | InputErrorPipe: input.type }}</mat-error>\n }\n\n <!-- HINT -->\n @if (input.hint) {\n <mat-hint>{{ input.hint }}</mat-hint>\n }\n\n <!-- ICON -->\n @if (input.showIcon) {\n <span matTextSuffix class=\"ngx-form-m3-input-suffix\" [class.ngx-form-m3-disabled-input]=\"formControl.disabled\">\n <span> </span>\n <mat-icon>label</mat-icon>\n </span>\n }\n\n <!-- BUTTON -->\n @if (input.button) {\n <span matIconSuffix>\n <button\n mat-icon-button\n type=\"button\"\n [disabled]=\"isButtonDisabled\"\n (click)=\"input.button.onClick(values)\"\n [tabIndex]=\"-1\"\n >\n <mat-icon [style.color]=\"isButtonDisabled ? undefined : input.button.color\">\n {{ input.button.icon }}\n </mat-icon>\n </button>\n </span>\n }\n\n <input\n matInput\n type=\"text\"\n [name]=\"input.name\"\n [formControl]=\"formControl\"\n class=\"ngx-form-m3-en\"\n [maxLength]=\"input.verify?.maxLength || 524288\"\n [AutoFocusDirective]=\"config.autoFocus === input.name\"\n />\n\n <!-- DESCRIPTION -->\n @if (input.description) {\n <div\n class=\"ngx-form-m3-input-description\"\n [class.ngx-form-m3-disabled-input]=\"formControl.disabled\"\n [innerHTML]=\"input.description | MultiLinePipe\"\n ></div>\n }\n</mat-form-field>\n" }]
|
|
1083
|
+
}], propDecorators: { values: [{
|
|
1084
|
+
type: Input,
|
|
1085
|
+
args: [{ required: true }]
|
|
1086
|
+
}], isButtonDisabled: [{
|
|
1087
|
+
type: Input,
|
|
1088
|
+
args: [{ required: true }]
|
|
1089
|
+
}] } });
|
|
1090
|
+
|
|
1091
|
+
class InputIdMethods extends InputMethods {
|
|
1092
|
+
control(input, validators) {
|
|
1093
|
+
validators.push(IdValidator(input.verify));
|
|
1094
|
+
return new FormControl(input.value || null, validators);
|
|
1095
|
+
}
|
|
1096
|
+
value(value, input) {
|
|
1097
|
+
return Helper.IS.string(value) && value !== '' ? value : null;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1018
1101
|
class InputIpComponent {
|
|
1019
1102
|
formControl = inject(INPUT_CONTROL);
|
|
1020
1103
|
input = inject(INPUT_TYPE);
|
|
@@ -2328,6 +2411,7 @@ const InputInfo = {
|
|
|
2328
2411
|
EMAIL: { title: 'ایمیل', methods: new InputEmailMethods(), component: InputEmailComponent },
|
|
2329
2412
|
FILE: { title: 'فایل', methods: new InputFileMethods(), component: InputFileComponent },
|
|
2330
2413
|
ICON: { title: 'آیکون', methods: new InputIconMethods(), component: InputIconComponent },
|
|
2414
|
+
ID: { title: 'شناسه', methods: new InputIdMethods(), component: InputIdComponent },
|
|
2331
2415
|
IP: { title: 'آدرس آیپی', methods: new InputIpMethods(), component: InputIpComponent },
|
|
2332
2416
|
'ITEM-LIST': { title: 'لیست مقادیر', methods: new InputItemListMethods(), component: InputItemListComponent },
|
|
2333
2417
|
MOBILE: { title: 'موبایل', methods: new InputMobileMethods(), component: InputMobileComponent },
|