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