aeb-ui-kit 2.2.0-preview.539 → 2.2.0-preview.542
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/esm2020/lib/code-input/code-input.component.mjs +60 -19
- package/esm2020/lib/code-input/code-input.module.mjs +5 -5
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/aeb-ui-kit.mjs +65 -22
- package/fesm2015/aeb-ui-kit.mjs.map +1 -1
- package/fesm2020/aeb-ui-kit.mjs +62 -22
- package/fesm2020/aeb-ui-kit.mjs.map +1 -1
- package/lib/code-input/code-input.component.d.ts +13 -9
- package/lib/code-input/code-input.module.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
package/fesm2020/aeb-ui-kit.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { Component, ViewEncapsulation, Input, ViewChild, NgModule, EventEmitter,
|
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DOCUMENT, formatDate, formatNumber } from '@angular/common';
|
|
5
5
|
import * as i1$1 from '@angular/forms';
|
|
6
|
-
import { NG_VALUE_ACCESSOR, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import { NG_VALUE_ACCESSOR, FormControl, Validators, FormsModule, ReactiveFormsModule, FormGroup, FormArray } from '@angular/forms';
|
|
7
7
|
import * as i2 from '@angular/platform-browser';
|
|
8
8
|
import * as i1$2 from 'ngx-mask';
|
|
9
9
|
import { NgxMaskModule } from 'ngx-mask';
|
|
@@ -254,18 +254,44 @@ class CodeInputComponent {
|
|
|
254
254
|
this.codeSet = new EventEmitter();
|
|
255
255
|
this.timeOut = new EventEmitter();
|
|
256
256
|
this.resendClick = new EventEmitter();
|
|
257
|
-
this.inputs = ['', '', '', '', '', ''];
|
|
258
|
-
this.isPaste = false;
|
|
259
257
|
this.sendAgain = false;
|
|
260
|
-
this.showLoader = false;
|
|
261
|
-
this.wrongCode = false;
|
|
262
258
|
this.showTimer = false;
|
|
263
|
-
this.isDisabled = true;
|
|
264
259
|
}
|
|
265
260
|
get classes() {
|
|
266
261
|
const mode = this.wrongCode ? 'input-wrong' : '';
|
|
267
262
|
return `code-input__${mode}`;
|
|
268
263
|
}
|
|
264
|
+
get inputs() {
|
|
265
|
+
return this.form.get('inputs');
|
|
266
|
+
}
|
|
267
|
+
ngOnInit() {
|
|
268
|
+
this.form = new FormGroup({
|
|
269
|
+
inputs: new FormArray([
|
|
270
|
+
new FormControl(),
|
|
271
|
+
new FormControl(),
|
|
272
|
+
new FormControl(),
|
|
273
|
+
new FormControl(),
|
|
274
|
+
new FormControl(),
|
|
275
|
+
new FormControl()
|
|
276
|
+
])
|
|
277
|
+
});
|
|
278
|
+
for (let i = 0; i < this.inputs.length; i++) {
|
|
279
|
+
if (i > 0) {
|
|
280
|
+
this.inputs.get(`${i}`)?.disable();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
writeValue(value) {
|
|
285
|
+
if (value) {
|
|
286
|
+
this.form.setValue(value, { emitEvent: false });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
registerOnChange(fn) {
|
|
290
|
+
this.form.valueChanges.subscribe(fn);
|
|
291
|
+
}
|
|
292
|
+
registerOnTouched(fn) {
|
|
293
|
+
this.onTouch = fn;
|
|
294
|
+
}
|
|
269
295
|
startTimer() {
|
|
270
296
|
clearInterval(this.interval);
|
|
271
297
|
this.time = this.secondsUntilRetry;
|
|
@@ -281,17 +307,14 @@ class CodeInputComponent {
|
|
|
281
307
|
}
|
|
282
308
|
}, 1000);
|
|
283
309
|
}
|
|
284
|
-
trackByInput(index) {
|
|
285
|
-
return index;
|
|
286
|
-
}
|
|
287
310
|
onMove(e, i) {
|
|
288
|
-
|
|
289
|
-
const value = this.inputs[i];
|
|
311
|
+
const value = this.inputs.controls[i].value;
|
|
290
312
|
if (value.length > 0) {
|
|
291
313
|
const nextIndex = i < 5 ? i + 1 : 5;
|
|
292
314
|
const nextInput = document.getElementById(`${nextIndex}`);
|
|
293
315
|
if (nextIndex <= 5) {
|
|
294
316
|
nextInput.disabled = false;
|
|
317
|
+
this.inputs.get(`${i}`)?.enable();
|
|
295
318
|
nextInput.focus();
|
|
296
319
|
}
|
|
297
320
|
}
|
|
@@ -309,10 +332,14 @@ class CodeInputComponent {
|
|
|
309
332
|
}
|
|
310
333
|
}
|
|
311
334
|
onPaste(e) {
|
|
335
|
+
for (let i = 0; i < this.inputs.length; i++) {
|
|
336
|
+
this.inputs.get(`${i}`)?.enable();
|
|
337
|
+
}
|
|
312
338
|
const data = e.clipboardData.getData('text');
|
|
313
339
|
const slicedData = data.split('');
|
|
314
|
-
for (
|
|
315
|
-
this.inputs[i]
|
|
340
|
+
for (let i = 0; i < slicedData.length; i++) {
|
|
341
|
+
const input = this.inputs.controls[i];
|
|
342
|
+
input.setValue(slicedData[i]);
|
|
316
343
|
}
|
|
317
344
|
if (!isFinite(Number(data))) {
|
|
318
345
|
this.clear();
|
|
@@ -323,14 +350,13 @@ class CodeInputComponent {
|
|
|
323
350
|
}
|
|
324
351
|
}
|
|
325
352
|
onSubmit() {
|
|
326
|
-
this.wrongCode = true;
|
|
327
353
|
this.showTimer = true;
|
|
328
354
|
this.startTimer();
|
|
329
355
|
this.codeSet.emit();
|
|
330
356
|
}
|
|
331
357
|
clear() {
|
|
332
|
-
for (const
|
|
333
|
-
|
|
358
|
+
for (const control of this.inputs.controls) {
|
|
359
|
+
control.setValue('');
|
|
334
360
|
}
|
|
335
361
|
}
|
|
336
362
|
resend() {
|
|
@@ -350,16 +376,30 @@ class CodeInputComponent {
|
|
|
350
376
|
}
|
|
351
377
|
}
|
|
352
378
|
CodeInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
353
|
-
CodeInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CodeInputComponent, selector: "aeb-code-input", inputs: { title: "title", secondsUntilRetry: "secondsUntilRetry", tip: "tip" }, outputs: { codeSet: "codeSet", timeOut: "timeOut", resendClick: "resendClick" },
|
|
379
|
+
CodeInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CodeInputComponent, selector: "aeb-code-input", inputs: { title: "title", secondsUntilRetry: "secondsUntilRetry", tip: "tip", wrongCode: "wrongCode" }, outputs: { codeSet: "codeSet", timeOut: "timeOut", resendClick: "resendClick" }, providers: [
|
|
380
|
+
{
|
|
381
|
+
provide: NG_VALUE_ACCESSOR,
|
|
382
|
+
useExisting: forwardRef(() => CodeInputComponent),
|
|
383
|
+
multi: true
|
|
384
|
+
}
|
|
385
|
+
], ngImport: i0, template: "<div class=\"code-input\">\n <h1>{{ title }}</h1>\n <span class=\"code-input__tip\">{{ tip }}</span>\n <div class=\"code-input__inputs\"[ngClass]=\"classes\">\n <form [formGroup]=\"form\">\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n autocomplete=\"off\"\n (keypress)=\"numberOnly($event)\"\n (keyup)=\"onMove($event, i)\"\n (paste)=\"onPaste($event)\"\n [maxLength]=\"1\"\n id=\"{{ i }}\"\n />\n </ng-container>\n </ng-container>\n </form>\n </div>\n <div class=\"code-input__text\">\n <span *ngIf=\"wrongCode\" class=\"code-input__text-wrong\">\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span>\n <div *ngIf=\"showTimer\">\n <span class=\"code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"code-input__text-time\">{{ time }}</span>\n </div>\n <span *ngIf=\"sendAgain\" class=\"code-input__text-again\" (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n </div>\n</div>\n", styles: [".code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--darkblue);background-color:#fff}.code-input h1{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:24px}.code-input span{text-align:center}.code-input__tip{margin-bottom:40px}.code-input__inputs form{display:flex;gap:16px}.code-input__inputs input{width:51px;height:56px;font-size:32px;text-align:center;border:solid 2px var(--gray);border-radius:10px;outline:none}.code-input__inputs input:focus{border:solid 2px var(--blue)}.code-input__inputs input:disabled{background-color:inherit}.code-input__input-wrong input{border:solid 2px var(--red)}.code-input__input-wrong input:focus{border:solid 2px var(--red)}.code-input__text{display:flex;flex-direction:column;margin-top:24px;font-size:16px;line-height:20px}.code-input__text-info{color:var(--gray)}.code-input__text-time{color:var(--blue)}.code-input__text-again{color:var(--blue);text-decoration:underline;cursor:pointer}.code-input__text-wrong{margin-bottom:8px;color:var(--red)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }] });
|
|
354
386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, decorators: [{
|
|
355
387
|
type: Component,
|
|
356
|
-
args: [{ selector: 'aeb-code-input',
|
|
388
|
+
args: [{ selector: 'aeb-code-input', providers: [
|
|
389
|
+
{
|
|
390
|
+
provide: NG_VALUE_ACCESSOR,
|
|
391
|
+
useExisting: forwardRef(() => CodeInputComponent),
|
|
392
|
+
multi: true
|
|
393
|
+
}
|
|
394
|
+
], template: "<div class=\"code-input\">\n <h1>{{ title }}</h1>\n <span class=\"code-input__tip\">{{ tip }}</span>\n <div class=\"code-input__inputs\"[ngClass]=\"classes\">\n <form [formGroup]=\"form\">\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n autocomplete=\"off\"\n (keypress)=\"numberOnly($event)\"\n (keyup)=\"onMove($event, i)\"\n (paste)=\"onPaste($event)\"\n [maxLength]=\"1\"\n id=\"{{ i }}\"\n />\n </ng-container>\n </ng-container>\n </form>\n </div>\n <div class=\"code-input__text\">\n <span *ngIf=\"wrongCode\" class=\"code-input__text-wrong\">\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043E\u0434</span>\n <div *ngIf=\"showTimer\">\n <span class=\"code-input__text-info\"\n >\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u0443\u044E \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0443 \u043C\u043E\u0436\u043D\u043E \u0447\u0435\u0440\u0435\u0437\n </span>\n <span class=\"code-input__text-time\">{{ time }}</span>\n </div>\n <span *ngIf=\"sendAgain\" class=\"code-input__text-again\" (click)=\"resend()\"\n >\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043A\u043E\u0434 \u043F\u043E\u0432\u0442\u043E\u0440\u043D\u043E</span\n >\n </div>\n</div>\n", styles: [".code-input{display:flex;flex-direction:column;align-items:center;width:632px;padding:48px;color:var(--darkblue);background-color:#fff}.code-input h1{width:-moz-fit-content;width:fit-content;margin:0 0 40px;font-size:24px}.code-input span{text-align:center}.code-input__tip{margin-bottom:40px}.code-input__inputs form{display:flex;gap:16px}.code-input__inputs input{width:51px;height:56px;font-size:32px;text-align:center;border:solid 2px var(--gray);border-radius:10px;outline:none}.code-input__inputs input:focus{border:solid 2px var(--blue)}.code-input__inputs input:disabled{background-color:inherit}.code-input__input-wrong input{border:solid 2px var(--red)}.code-input__input-wrong input:focus{border:solid 2px var(--red)}.code-input__text{display:flex;flex-direction:column;margin-top:24px;font-size:16px;line-height:20px}.code-input__text-info{color:var(--gray)}.code-input__text-time{color:var(--blue)}.code-input__text-again{color:var(--blue);text-decoration:underline;cursor:pointer}.code-input__text-wrong{margin-bottom:8px;color:var(--red)}\n"] }]
|
|
357
395
|
}], propDecorators: { title: [{
|
|
358
396
|
type: Input
|
|
359
397
|
}], secondsUntilRetry: [{
|
|
360
398
|
type: Input
|
|
361
399
|
}], tip: [{
|
|
362
400
|
type: Input
|
|
401
|
+
}], wrongCode: [{
|
|
402
|
+
type: Input
|
|
363
403
|
}], codeSet: [{
|
|
364
404
|
type: Output
|
|
365
405
|
}], timeOut: [{
|
|
@@ -371,13 +411,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
371
411
|
class CodeInputModule {
|
|
372
412
|
}
|
|
373
413
|
CodeInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
374
|
-
CodeInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, declarations: [CodeInputComponent], imports: [CommonModule, FormsModule], exports: [CodeInputComponent] });
|
|
375
|
-
CodeInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, imports: [CommonModule, FormsModule] });
|
|
414
|
+
CodeInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, declarations: [CodeInputComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule], exports: [CodeInputComponent] });
|
|
415
|
+
CodeInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, imports: [CommonModule, FormsModule, ReactiveFormsModule] });
|
|
376
416
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputModule, decorators: [{
|
|
377
417
|
type: NgModule,
|
|
378
418
|
args: [{
|
|
379
419
|
declarations: [CodeInputComponent],
|
|
380
|
-
imports: [CommonModule, FormsModule],
|
|
420
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
|
381
421
|
exports: [CodeInputComponent]
|
|
382
422
|
}]
|
|
383
423
|
}] });
|
|
@@ -5214,5 +5254,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
5214
5254
|
* Generated bundle index. Do not edit.
|
|
5215
5255
|
*/
|
|
5216
5256
|
|
|
5217
|
-
export { AccordionComponent, AccordionModule, ActionBarComponent, ActionBarModule, AebUiKitModule, BreadcrumpsComponent, CheckboxComponent, CheckboxGroupComponent, CheckboxModule, ClickOutsideDirective, ClickOutsideModule, CommentComponent, CommentModule, CreditItemCardComponent, CreditItemCardModule, DateToStrPipe, DatepickerComponent, DatepickerCoreComponent, DatepickerModule, DatepickerMonthComponent, DatepickerTilesComponent, DragAndDropDirective, DropdownComponent, DropdownModule, FieldSliderComponent, FieldSliderModule, FileAttachComponent, FileAttachModule, FilterTagComponent, FilterTagsComponent, FilterTagsModule, FooterBottomComponent, FooterComponent, FooterMenuComponent, FooterModule, FooterTopComponent, FormFieldComponent, FormFieldModule, HeaderComponent, HeaderModule, HeadingComponent, HeadingModule, IconDirective, InputDirective, LabelComponent, LabelDirective, LabelModule, LogoComponent, ModalComponent, ModalModule, NewButtonComponent, NewButtonModule, NewsCardComponent, NewsCardModule, NotificationComponent, NotificationsComponent, NotificationsModule, OptionComponent, PaginationComponent, PaginationModule, PaginationOldComponent, PaginationOldModule, PopUpComponent, PopUpDirective, PopUpModule, ProductTitleComponent, RadioButtonsComponent, RadioButtonsModule, ResponseComponent, ResponseModule, SearchComponent, SearchModule, SelectComponent, SelectModule, SidebarComponent, SidebarModule, SliderComponent, SliderModule, SpanSubtitleDirective, SpanTitleDirective, SpinnerComponent, SpinnerModule, StepperComponent, StepperModule, StepperStepComponent, TabDirective, TableComponent, TableModule, TabsComponent, TabsModule, TagTabComponent, TagTabModule, TextareaDirective, TooltipComponent, TooltipDirective, TooltipModule, VisaComponent, VisaItemComponent, VisaModule };
|
|
5257
|
+
export { AccordionComponent, AccordionModule, ActionBarComponent, ActionBarModule, AebUiKitModule, BreadcrumpsComponent, CheckboxComponent, CheckboxGroupComponent, CheckboxModule, ClickOutsideDirective, ClickOutsideModule, CodeInputComponent, CodeInputModule, CommentComponent, CommentModule, CreditItemCardComponent, CreditItemCardModule, DateToStrPipe, DatepickerComponent, DatepickerCoreComponent, DatepickerModule, DatepickerMonthComponent, DatepickerTilesComponent, DragAndDropDirective, DropdownComponent, DropdownModule, FieldSliderComponent, FieldSliderModule, FileAttachComponent, FileAttachModule, FilterTagComponent, FilterTagsComponent, FilterTagsModule, FooterBottomComponent, FooterComponent, FooterMenuComponent, FooterModule, FooterTopComponent, FormFieldComponent, FormFieldModule, HeaderComponent, HeaderModule, HeadingComponent, HeadingModule, IconDirective, InputDirective, LabelComponent, LabelDirective, LabelModule, LogoComponent, ModalComponent, ModalModule, NewButtonComponent, NewButtonModule, NewsCardComponent, NewsCardModule, NotificationComponent, NotificationsComponent, NotificationsModule, OptionComponent, PaginationComponent, PaginationModule, PaginationOldComponent, PaginationOldModule, PopUpComponent, PopUpDirective, PopUpModule, ProductTitleComponent, RadioButtonsComponent, RadioButtonsModule, ResponseComponent, ResponseModule, SearchComponent, SearchModule, SelectComponent, SelectModule, SidebarComponent, SidebarModule, SliderComponent, SliderModule, SpanSubtitleDirective, SpanTitleDirective, SpinnerComponent, SpinnerModule, StepperComponent, StepperModule, StepperStepComponent, TabDirective, TableComponent, TableModule, TabsComponent, TabsModule, TagTabComponent, TagTabModule, TextareaDirective, TooltipComponent, TooltipDirective, TooltipModule, VisaComponent, VisaItemComponent, VisaModule };
|
|
5218
5258
|
//# sourceMappingURL=aeb-ui-kit.mjs.map
|