aeb-ui-kit 2.3.0-preview.544 → 2.3.0-preview.546

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ViewEncapsulation, Input, ViewChild, NgModule, EventEmitter, forwardRef, Output, HostBinding, Directive, Optional, Self, HostListener, ContentChild, Injectable, Inject, Pipe, LOCALE_ID, ViewChildren, inject, ChangeDetectorRef, ContentChildren } from '@angular/core';
2
+ import { Component, ViewEncapsulation, Input, ViewChild, NgModule, EventEmitter, forwardRef, Output, HostBinding, ViewChildren, Directive, Optional, Self, HostListener, ContentChild, Injectable, Inject, Pipe, LOCALE_ID, inject, ChangeDetectorRef, ContentChildren } from '@angular/core';
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';
@@ -251,138 +251,316 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
251
251
 
252
252
  class CodeInputComponent {
253
253
  constructor() {
254
- this.codeSet = new EventEmitter();
254
+ this.codeLength = 6;
255
+ this.codeCompleted = new EventEmitter();
255
256
  this.timeOut = new EventEmitter();
256
257
  this.resendClick = new EventEmitter();
257
- this.sendAgain = false;
258
+ this._ = true;
258
259
  this.showTimer = false;
259
- }
260
- get classes() {
261
- const mode = this.wrongCode ? 'input-wrong' : '';
262
- return `code-input__${mode}`;
260
+ this._inputState = 'ENTERING';
261
+ this._showCodeText = false;
263
262
  }
264
263
  get inputs() {
265
264
  return this.form.get('inputs');
266
265
  }
266
+ get showCodeText() {
267
+ return this._showCodeText;
268
+ }
269
+ set showCodeText(value) {
270
+ if (value) {
271
+ this.startTimer();
272
+ }
273
+ else {
274
+ this.stopTimer();
275
+ }
276
+ this._showCodeText = value;
277
+ }
278
+ get inputState() {
279
+ return this._inputState;
280
+ }
281
+ set inputState(state) {
282
+ switch (state) {
283
+ case 'ENTERING':
284
+ this.clear();
285
+ for (let i = 1; i < this.inputs.length; i++) {
286
+ this.inputs.controls[i].disable();
287
+ }
288
+ this.inputs.controls[0].enable();
289
+ this.getNativeInputByIndex(0).focus();
290
+ break;
291
+ case 'COMPLETED':
292
+ if (!this.showCodeText) {
293
+ const lastInput = this.getNativeInputByIndex(this.inputs.length - 1);
294
+ lastInput.blur();
295
+ this.codeCompleted.emit();
296
+ this.showCodeText = true;
297
+ }
298
+ break;
299
+ }
300
+ this._inputState = state;
301
+ }
267
302
  ngOnInit() {
303
+ const inputsArray = [
304
+ new FormControl(),
305
+ new FormControl(),
306
+ new FormControl(),
307
+ new FormControl()
308
+ ];
309
+ if (this.codeLength === 6) {
310
+ inputsArray.push(new FormControl(), new FormControl());
311
+ }
268
312
  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
- ])
313
+ inputs: new FormArray(inputsArray)
277
314
  });
278
- for (let i = 0; i < this.inputs.length; i++) {
279
- if (i > 0) {
280
- this.inputs.get(`${i}`)?.disable();
281
- }
315
+ for (let i = 1; i < this.inputs.length; i++) {
316
+ this.inputs.controls[i].disable();
282
317
  }
283
318
  }
284
319
  writeValue(value) {
285
- if (value) {
286
- this.form.setValue(value, { emitEvent: false });
320
+ if (value === null) {
321
+ value = [];
322
+ }
323
+ if (!this.validateValueLength(value)) {
324
+ throw new Error(`Value's length too long, expected ${this.inputs.length}, got ${value.length}`);
325
+ }
326
+ this.castToCodeModel(value);
327
+ // вьюшка еще не прошла инициализацию
328
+ if (this.inputsContainer !== undefined) {
329
+ this.showCodeText = false;
330
+ this.inputState = 'ENTERING';
331
+ }
332
+ this.setInputsValues(value);
333
+ if (value.length === this.inputs.length &&
334
+ this.inputsContainer !== undefined) {
335
+ this.inputState = 'COMPLETED';
287
336
  }
288
337
  }
289
- registerOnChange(fn) {
290
- this.form.valueChanges.subscribe(fn);
291
- }
292
- registerOnTouched(fn) {
293
- this.onTouch = fn;
294
- }
295
- startTimer() {
296
- clearInterval(this.interval);
297
- this.time = this.secondsUntilRetry;
298
- this.interval = setInterval(() => {
299
- if (this.time > 0) {
300
- this.time--;
301
- }
302
- else {
303
- this.sendAgain = true;
304
- this.showTimer = false;
305
- this.timeOut.emit();
306
- clearInterval(this.interval);
338
+ setDisabledState(isDisabled) {
339
+ if (isDisabled) {
340
+ this.inputs.disable();
341
+ }
342
+ else {
343
+ let foundNonNullishFlag = false;
344
+ this.inputs.controls
345
+ .slice()
346
+ .reverse()
347
+ .reduce((prev, curr) => {
348
+ if ((curr.value === '' || curr.value === null) &&
349
+ !foundNonNullishFlag) {
350
+ curr.disable();
351
+ }
352
+ else {
353
+ foundNonNullishFlag = true;
354
+ curr.enable();
355
+ if (prev.disabled) {
356
+ prev.enable();
357
+ }
358
+ }
359
+ return curr;
360
+ });
361
+ if (!foundNonNullishFlag) {
362
+ this.inputs.controls[0].enable();
363
+ if (this.inputsContainer) {
364
+ this.getNativeInputByIndex(0).focus();
365
+ }
307
366
  }
308
- }, 1000);
367
+ }
309
368
  }
310
- onMove(e, i) {
311
- const value = this.inputs.controls[i].value;
312
- if (value.length > 0) {
313
- const nextIndex = i < 5 ? i + 1 : 5;
314
- const nextInput = document.getElementById(`${nextIndex}`);
315
- if (nextIndex <= 5) {
316
- nextInput.disabled = false;
317
- this.inputs.get(`${i}`)?.enable();
318
- nextInput.focus();
319
- }
369
+ onKeyDown(e, controlIndex) {
370
+ const value = this.inputs.controls[controlIndex].value;
371
+ if (!this.validateKeyboardInput(e) &&
372
+ !(e.key === 'v' && e.ctrlKey === true)) {
373
+ return false;
374
+ }
375
+ if (value && value.length > 0) {
376
+ this.inputs.controls[controlIndex].setValue('');
377
+ }
378
+ }
379
+ onKeyUp(e, controlIndex) {
380
+ if (!this.validateKeyboardInput(e)) {
381
+ return;
320
382
  }
321
383
  if (e.key === 'Backspace') {
322
- const prevIndex = i <= 5 ? i - 1 : 5;
323
- const prevInput = document.getElementById(`${prevIndex}`);
324
- if (prevIndex >= 0) {
325
- prevInput.focus();
326
- }
384
+ this.moveCursorBackward(controlIndex);
385
+ return;
327
386
  }
328
- if (i === 5 && value.length > 0) {
329
- this.onSubmit();
330
- this.clear();
331
- document.getElementById('0').focus();
387
+ const value = this.inputs.controls[controlIndex].value;
388
+ this.moveCursorForward(controlIndex);
389
+ if (controlIndex === this.inputs.length - 1 && value && value.length > 0) {
390
+ this.inputState = 'COMPLETED';
332
391
  }
333
392
  }
334
393
  onPaste(e) {
335
- for (let i = 0; i < this.inputs.length; i++) {
336
- this.inputs.get(`${i}`)?.enable();
394
+ const data = e.clipboardData.getData('text').trim();
395
+ if (!isFinite(data) ||
396
+ data.length > this.inputs.length) {
397
+ return false;
337
398
  }
338
- const data = e.clipboardData.getData('text');
339
- const slicedData = data.split('');
340
- for (let i = 0; i < slicedData.length; i++) {
341
- const input = this.inputs.controls[i];
342
- input.setValue(slicedData[i]);
399
+ this.clear();
400
+ for (let i = 0; i < data.length; i++) {
401
+ this.inputs.controls[i].enable();
402
+ this.inputs.controls[i].setValue(data[i]);
343
403
  }
344
- if (!isFinite(Number(data))) {
345
- this.clear();
346
- return false;
404
+ if (data.length < this.inputs.length) {
405
+ this.inputs.controls[data.length].enable();
347
406
  }
348
- if (data.length === 6) {
349
- this.onSubmit();
407
+ const currentValue = this.form.value.inputs.join('');
408
+ if (currentValue.length === this.inputs.length) {
409
+ this.inputState = 'COMPLETED';
350
410
  }
411
+ return false;
351
412
  }
352
- onSubmit() {
353
- this.showTimer = true;
354
- this.startTimer();
355
- this.codeSet.emit();
356
- }
357
- clear() {
358
- for (const control of this.inputs.controls) {
359
- control.setValue('');
413
+ /**
414
+ * Фокусируется на следующием поле ввода
415
+ *
416
+ * @param relativeIndex индекс текущего поля ввода
417
+ */
418
+ moveCursorForward(relativeIndex) {
419
+ if (relativeIndex >= this.inputs.length - 1) {
420
+ return;
360
421
  }
422
+ this.inputs.controls[relativeIndex + 1].enable();
423
+ const nextInput = this.getNativeInputByIndex(relativeIndex + 1);
424
+ nextInput.focus();
361
425
  }
362
- resend() {
363
- this.resendClick.emit();
426
+ moveCursorBackward(relativeIndex) {
427
+ const prevInput = this.getNativeInputByIndex(Math.max(0, relativeIndex - 1));
428
+ prevInput.focus();
429
+ // находим последний непустой инпут
430
+ let lastNonNullishInputIndex = this.inputs.controls
431
+ .slice()
432
+ .reverse()
433
+ .findIndex((input) => input.value !== '' && input.value !== null);
434
+ if (lastNonNullishInputIndex === this.inputs.length - 1) {
435
+ lastNonNullishInputIndex = 0;
436
+ }
437
+ else if (lastNonNullishInputIndex !== -1) {
438
+ lastNonNullishInputIndex =
439
+ this.inputs.length - lastNonNullishInputIndex - 1;
440
+ }
441
+ /**
442
+ * Устанавливаем состояние текущего поля ввода на disabled,
443
+ * при условии, что все последующие поля пусты
444
+ */
445
+ if (lastNonNullishInputIndex < relativeIndex) {
446
+ if (lastNonNullishInputIndex >= 0) {
447
+ this.inputs.controls
448
+ .slice(lastNonNullishInputIndex + 1)
449
+ .forEach((input, index) => {
450
+ if (index === 0) {
451
+ return;
452
+ }
453
+ input.disable();
454
+ });
455
+ if (lastNonNullishInputIndex !== this.inputs.length &&
456
+ relativeIndex - lastNonNullishInputIndex - 1 !== 0) {
457
+ lastNonNullishInputIndex = lastNonNullishInputIndex + 1;
458
+ }
459
+ }
460
+ else {
461
+ this.inputs.controls.slice(1).forEach((input) => {
462
+ input.disable();
463
+ });
464
+ lastNonNullishInputIndex = 0;
465
+ this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
466
+ }
467
+ this.getNativeInputByIndex(lastNonNullishInputIndex).focus();
468
+ }
364
469
  }
365
- numberOnly(e) {
366
- const key = Number(e.key);
367
- if (e.code === 'Space') {
470
+ /**
471
+ * Проверка того, что длина передаваемого значения не превышает количества полей ввода
472
+ */
473
+ validateValueLength(value) {
474
+ if ((isNaN(value) &&
475
+ value &&
476
+ value.length > this.inputs.length) ||
477
+ (!isNaN(value) && value.toString().length > this.inputs.length)) {
478
+ if (!isNaN(value)) {
479
+ value = value.toString();
480
+ }
368
481
  return false;
369
482
  }
370
- else if (isFinite(key)) {
483
+ return true;
484
+ }
485
+ /**
486
+ * Проверка валидности нажатой клавиши
487
+ */
488
+ validateKeyboardInput(e) {
489
+ const key = e.key;
490
+ if (/\d/.test(key) || key === 'Backspace') {
371
491
  return true;
372
492
  }
373
493
  else {
374
494
  return false;
375
495
  }
376
496
  }
497
+ /**
498
+ * Переводит валидную строку / число в массив элементов CodeModel
499
+ */
500
+ castToCodeModel(value) {
501
+ if (typeof value === 'string' || value instanceof String) {
502
+ value = value.split('');
503
+ }
504
+ else if (!isNaN(value)) {
505
+ value = value.toString().split('');
506
+ }
507
+ return value;
508
+ }
509
+ registerOnChange(fn) {
510
+ this.form.valueChanges.subscribe(fn);
511
+ }
512
+ registerOnTouched(fn) {
513
+ this.onTouch = fn;
514
+ }
515
+ setInputsValues(values) {
516
+ this.inputs.controls.map((input, index) => {
517
+ input.setValue(values[index] ?? '');
518
+ if (index < values.length) {
519
+ input.enable();
520
+ }
521
+ });
522
+ }
523
+ getNativeInputByIndex(index) {
524
+ const nativeInputsArray = this.inputsContainer.first
525
+ .nativeElement;
526
+ return nativeInputsArray[index];
527
+ }
528
+ startTimer() {
529
+ this.showTimer = true;
530
+ this.time = this.secondsUntilRetry;
531
+ this.interval = setInterval(() => {
532
+ if (this.time > 0) {
533
+ this.time--;
534
+ }
535
+ else {
536
+ this.stopTimer();
537
+ this.timeOut.emit();
538
+ }
539
+ }, 1000);
540
+ }
541
+ stopTimer() {
542
+ this.time = this.secondsUntilRetry;
543
+ this.showTimer = false;
544
+ clearInterval(this.interval);
545
+ }
546
+ clear() {
547
+ this.setInputsValues([]);
548
+ }
549
+ resend() {
550
+ this.clear();
551
+ this.showCodeText = false;
552
+ this.inputState = 'ENTERING';
553
+ this.resendClick.emit();
554
+ }
377
555
  }
378
556
  CodeInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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: [
557
+ 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", codeLength: "codeLength" }, outputs: { codeCompleted: "codeCompleted", timeOut: "timeOut", resendClick: "resendClick" }, host: { properties: { "class.code-input": "this._" } }, providers: [
380
558
  {
381
559
  provide: NG_VALUE_ACCESSOR,
382
560
  useExisting: forwardRef(() => CodeInputComponent),
383
561
  multi: true
384
562
  }
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"] }] });
563
+ ], viewQueries: [{ propertyName: "inputsContainer", predicate: ["inputsContainer"], descendants: true }], ngImport: i0, template: "<h1>{{ title }}</h1>\n<span class=\"code-input__tip\">{{ tip }}</span>\n<div class=\"code-input__inputs\">\n <form [formGroup]=\"form\" #inputsContainer>\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n (keydown)=\"onKeyDown($event, i)\"\n (keyup)=\"onKeyUp($event, i)\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"one-time-code\"\n type=\"tel\"\n maxlength=\"1\"\n pattern=\"[0-9]\"\n inputmode=\"numeric\"\n />\n </ng-container>\n </ng-container>\n </form>\n</div>\n<div class=\"code-input__text\">\n <span 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\n *ngIf=\"showCodeText && !showTimer\"\n class=\"code-input__text-again\"\n (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", 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.ng-invalid input{border:solid 2px var(--red)}.code-input.ng-invalid input:focus{border:solid 2px var(--red)}.code-input.ng-invalid .code-input__text{margin-bottom:8px;color:var(--red)}.code-input.ng-invalid .code-input__text-wrong{margin-bottom:8px;color:var(--red);display:block}.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{display:none}\n"], dependencies: [{ 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.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { 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"] }], encapsulation: i0.ViewEncapsulation.None });
386
564
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CodeInputComponent, decorators: [{
387
565
  type: Component,
388
566
  args: [{ selector: 'aeb-code-input', providers: [
@@ -391,21 +569,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
391
569
  useExisting: forwardRef(() => CodeInputComponent),
392
570
  multi: true
393
571
  }
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"] }]
572
+ ], encapsulation: ViewEncapsulation.None, template: "<h1>{{ title }}</h1>\n<span class=\"code-input__tip\">{{ tip }}</span>\n<div class=\"code-input__inputs\">\n <form [formGroup]=\"form\" #inputsContainer>\n <ng-container formArrayName=\"inputs\">\n <ng-container *ngFor=\"let input of inputs.controls; let i = index\">\n <input\n [formControlName]=\"i\"\n (keydown)=\"onKeyDown($event, i)\"\n (keyup)=\"onKeyUp($event, i)\"\n (paste)=\"onPaste($event)\"\n autocomplete=\"one-time-code\"\n type=\"tel\"\n maxlength=\"1\"\n pattern=\"[0-9]\"\n inputmode=\"numeric\"\n />\n </ng-container>\n </ng-container>\n </form>\n</div>\n<div class=\"code-input__text\">\n <span 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\n *ngIf=\"showCodeText && !showTimer\"\n class=\"code-input__text-again\"\n (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", 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.ng-invalid input{border:solid 2px var(--red)}.code-input.ng-invalid input:focus{border:solid 2px var(--red)}.code-input.ng-invalid .code-input__text{margin-bottom:8px;color:var(--red)}.code-input.ng-invalid .code-input__text-wrong{margin-bottom:8px;color:var(--red);display:block}.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{display:none}\n"] }]
395
573
  }], propDecorators: { title: [{
396
574
  type: Input
397
575
  }], secondsUntilRetry: [{
398
576
  type: Input
399
577
  }], tip: [{
400
578
  type: Input
401
- }], wrongCode: [{
579
+ }], codeLength: [{
402
580
  type: Input
403
- }], codeSet: [{
581
+ }], codeCompleted: [{
404
582
  type: Output
405
583
  }], timeOut: [{
406
584
  type: Output
407
585
  }], resendClick: [{
408
586
  type: Output
587
+ }], inputsContainer: [{
588
+ type: ViewChildren,
589
+ args: ['inputsContainer']
590
+ }], _: [{
591
+ type: HostBinding,
592
+ args: ['class.code-input']
409
593
  }] } });
410
594
 
411
595
  class CodeInputModule {