@taiga-ui/kit 3.29.2 → 3.30.0
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/bundles/taiga-ui-kit-components-input-phone.umd.js +140 -94
- package/bundles/taiga-ui-kit-components-input-phone.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.js +25 -49
- package/bundles/taiga-ui-kit-components-input-tag.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-pdf-viewer.umd.js +8 -11
- package/bundles/taiga-ui-kit-components-pdf-viewer.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-push.umd.js +10 -15
- package/bundles/taiga-ui-kit-components-push.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-radio.umd.js +2 -3
- package/bundles/taiga-ui-kit-components-radio.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-tabs.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-tabs.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.js +1 -1
- package/bundles/taiga-ui-kit-internal-primitive-calendar-range.umd.js.map +1 -1
- package/components/input-phone/input-phone.component.d.ts +8 -9
- package/components/input-phone/input-phone.module.d.ts +3 -2
- package/components/input-phone/utils/complete-phone-insertion-preprocessor.d.ts +9 -0
- package/components/input-phone/utils/create-phone-mask-expression.d.ts +7 -0
- package/components/input-phone/utils/index.d.ts +2 -0
- package/components/input-tag/input-tag.component.d.ts +5 -10
- package/components/pdf-viewer/pdf-viewer.component.d.ts +2 -9
- package/components/push/push-alert.component.d.ts +2 -9
- package/components/radio/radio.component.d.ts +2 -9
- package/esm2015/components/input-phone/input-phone.component.js +65 -88
- package/esm2015/components/input-phone/input-phone.directive.js +2 -2
- package/esm2015/components/input-phone/input-phone.module.js +6 -5
- package/esm2015/components/input-phone/utils/complete-phone-insertion-preprocessor.js +43 -0
- package/esm2015/components/input-phone/utils/create-phone-mask-expression.js +17 -0
- package/esm2015/components/input-phone/utils/index.js +3 -0
- package/esm2015/components/input-tag/input-tag.component.js +20 -39
- package/esm2015/components/pdf-viewer/pdf-viewer.component.js +10 -13
- package/esm2015/components/progress/progress-circle/progress-circle.component.js +1 -1
- package/esm2015/components/push/push-alert.component.js +12 -17
- package/esm2015/components/radio/radio.component.js +3 -4
- package/esm2015/components/tabs/tab/tab.component.js +1 -1
- package/esm2015/components/tabs/tabs-with-more/tabs-with-more.component.js +1 -1
- package/esm2015/internal/primitive-calendar-range/primitive-calendar-range.component.js +2 -2
- package/fesm2015/taiga-ui-kit-components-input-phone.js +129 -92
- package/fesm2015/taiga-ui-kit-components-input-phone.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-tag.js +20 -39
- package/fesm2015/taiga-ui-kit-components-input-tag.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-pdf-viewer.js +9 -12
- package/fesm2015/taiga-ui-kit-components-pdf-viewer.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-progress.js +1 -1
- package/fesm2015/taiga-ui-kit-components-progress.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-push.js +11 -16
- package/fesm2015/taiga-ui-kit-components-push.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-radio.js +2 -3
- package/fesm2015/taiga-ui-kit-components-radio.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-tabs.js +2 -2
- package/fesm2015/taiga-ui-kit-components-tabs.js.map +1 -1
- package/fesm2015/taiga-ui-kit-internal-primitive-calendar-range.js +1 -1
- package/fesm2015/taiga-ui-kit-internal-primitive-calendar-range.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@taiga-ui/cdk'), require('@taiga-ui/core'), require('@taiga-ui/kit/providers'), require('rxjs/operators'), require('@taiga-ui/kit/directives'), require('rxjs')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@taiga-ui/kit/components/input-phone', ['exports', '@angular/core', '@angular/forms', '@taiga-ui/cdk', '@taiga-ui/core', '@taiga-ui/kit/providers', 'rxjs/operators', '@taiga-ui/kit/directives', 'rxjs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["taiga-ui"] = global["taiga-ui"] || {}, global["taiga-ui"].kit = global["taiga-ui"].kit || {}, global["taiga-ui"].kit.components = global["taiga-ui"].kit.components || {}, global["taiga-ui"].kit.components["input-phone"] = {}), global.ng.core, global.ng.forms, global.i2, global.i1, global["taiga-ui"].kit.providers, global.rxjs.operators, global["taiga-ui"].kit.directives, global.rxjs));
|
|
5
|
-
})(this, (function (exports, i0,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@maskito/core'), require('@maskito/kit'), require('@taiga-ui/cdk'), require('@taiga-ui/core'), require('@taiga-ui/kit/providers'), require('rxjs/operators'), require('@taiga-ui/kit/directives'), require('@maskito/angular'), require('rxjs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@taiga-ui/kit/components/input-phone', ['exports', '@angular/core', '@angular/forms', '@maskito/core', '@maskito/kit', '@taiga-ui/cdk', '@taiga-ui/core', '@taiga-ui/kit/providers', 'rxjs/operators', '@taiga-ui/kit/directives', '@maskito/angular', 'rxjs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["taiga-ui"] = global["taiga-ui"] || {}, global["taiga-ui"].kit = global["taiga-ui"].kit || {}, global["taiga-ui"].kit.components = global["taiga-ui"].kit.components || {}, global["taiga-ui"].kit.components["input-phone"] = {}), global.ng.core, global.ng.forms, global.core, global.kit, global.i2, global.i1, global["taiga-ui"].kit.providers, global.rxjs.operators, global["taiga-ui"].kit.directives, global.i4, global.rxjs));
|
|
5
|
+
})(this, (function (exports, i0, i5, core, kit, i2, i1, providers, operators, i3, i4, i6) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
-
var
|
|
26
|
+
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
|
27
27
|
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
29
|
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
30
|
-
var
|
|
30
|
+
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
31
|
+
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
31
32
|
|
|
32
33
|
/*! *****************************************************************************
|
|
33
34
|
Copyright (c) Microsoft Corporation.
|
|
@@ -363,6 +364,65 @@
|
|
|
363
364
|
useValue: Object.assign(Object.assign({}, TUI_INPUT_PHONE_DEFAULT_OPTIONS), options),
|
|
364
365
|
}); };
|
|
365
366
|
|
|
367
|
+
var countDigits = function (value) { return value.replace(/\D/g, "").length; };
|
|
368
|
+
/**
|
|
369
|
+
* `InputPhone` component sets country code as non-removable prefix.
|
|
370
|
+
* This prefix appears on focus and cannot be erased.
|
|
371
|
+
* But users sometimes can copy complete phone number (from any different source)
|
|
372
|
+
* and try to insert the whole string inside our `InputPhone` textfield.
|
|
373
|
+
* This preprocessor helps to avoid country prefix duplication on paste/drop/autofill events.
|
|
374
|
+
*/
|
|
375
|
+
function tuiCreateCompletePhoneInsertionPreprocessor(countryCode, phoneMaskAfterCountryCode) {
|
|
376
|
+
var completePhoneLength = (countryCode + phoneMaskAfterCountryCode).replace(/[^#\d]+/g, "").length;
|
|
377
|
+
var trimCountryPrefix = function (value) {
|
|
378
|
+
return countryCode === "+7"
|
|
379
|
+
? value.replace(/^(\+?7?\s?8?)\s?/, "")
|
|
380
|
+
: value.replace(new RegExp("^(\\+?" + countryCode.replace("+", "") + "?)\\s?"), "");
|
|
381
|
+
};
|
|
382
|
+
return function (_a) {
|
|
383
|
+
var elementState = _a.elementState, data = _a.data;
|
|
384
|
+
var value = elementState.value, selection = elementState.selection;
|
|
385
|
+
return {
|
|
386
|
+
elementState: {
|
|
387
|
+
selection: selection,
|
|
388
|
+
value:
|
|
389
|
+
/**
|
|
390
|
+
* The only possible case when `value` includes digits more
|
|
391
|
+
* than mask expression allows – browser autofill.
|
|
392
|
+
* It means that we are inside `input`-event
|
|
393
|
+
* and mask are ready to reject "extra" characters.
|
|
394
|
+
* We should cut leading country prefix to save trailing characters!
|
|
395
|
+
*/
|
|
396
|
+
countDigits(value) > completePhoneLength
|
|
397
|
+
? trimCountryPrefix(value)
|
|
398
|
+
: value,
|
|
399
|
+
},
|
|
400
|
+
data: countDigits(data) >= completePhoneLength
|
|
401
|
+
? /**
|
|
402
|
+
* User tries to insert/drop the complete phone number (with country prefix).
|
|
403
|
+
* We should drop already existing non-removable prefix.
|
|
404
|
+
*/
|
|
405
|
+
trimCountryPrefix(data)
|
|
406
|
+
: data,
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Create {@link https://tinkoff.github.io/maskito/core-concepts/mask-expression pattern mask expression} for phone number
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* tuiCreatePhoneMaskExpression('+1', '(###) ###-####');
|
|
416
|
+
*/
|
|
417
|
+
function tuiCreatePhoneMaskExpression(countryCode, phoneMaskAfterCountryCode) {
|
|
418
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(countryCode.split(""))), [
|
|
419
|
+
" "
|
|
420
|
+
]), __read(phoneMaskAfterCountryCode
|
|
421
|
+
.replace(/[^#\- ()]+/g, "")
|
|
422
|
+
.split("")
|
|
423
|
+
.map(function (item) { return (item === "#" ? /\d/ : item); })));
|
|
424
|
+
}
|
|
425
|
+
|
|
366
426
|
var TuiInputPhoneComponent = /** @class */ (function (_super) {
|
|
367
427
|
__extends(TuiInputPhoneComponent, _super);
|
|
368
428
|
function TuiInputPhoneComponent(control, destroy$, cdr, selection$, textfieldCleaner, options) {
|
|
@@ -373,25 +433,6 @@
|
|
|
373
433
|
_this.allowText = _this.options.allowText;
|
|
374
434
|
_this.search = '';
|
|
375
435
|
_this.searchChange = new i0.EventEmitter();
|
|
376
|
-
_this.textMaskOptions = {
|
|
377
|
-
mask: function (value) { return _this.allowText && !_this.value && isText(value) && value !== '+'
|
|
378
|
-
? false
|
|
379
|
-
: __spreadArray(__spreadArray(__spreadArray([], __read(_this.countryCode.split(''))), [
|
|
380
|
-
' '
|
|
381
|
-
]), __read(_this.phoneMaskAfterCountryCode
|
|
382
|
-
.replace(/[^#\- ()]+/g, '')
|
|
383
|
-
.split('')
|
|
384
|
-
.map(function (item) { return (item === '#' ? /\d/ : item); }))); },
|
|
385
|
-
pipe: function (value) {
|
|
386
|
-
if (_this.allowText) {
|
|
387
|
-
return value;
|
|
388
|
-
}
|
|
389
|
-
return value === '' && _this.focused && !_this.readOnly
|
|
390
|
-
? _this.countryCode + " "
|
|
391
|
-
: value.replace(/-$/, '');
|
|
392
|
-
},
|
|
393
|
-
guide: false,
|
|
394
|
-
};
|
|
395
436
|
_this.countryCode = _this.options.countryCode;
|
|
396
437
|
_this.open = false;
|
|
397
438
|
selection$.pipe(operators.takeUntil(destroy$)).subscribe(function () {
|
|
@@ -400,9 +441,10 @@
|
|
|
400
441
|
return _this;
|
|
401
442
|
}
|
|
402
443
|
Object.defineProperty(TuiInputPhoneComponent.prototype, "countryCodeSetter", {
|
|
403
|
-
set: function (
|
|
404
|
-
this.
|
|
405
|
-
this.countryCode =
|
|
444
|
+
set: function (newCountryCode) {
|
|
445
|
+
var prevCountryCode = this.countryCode;
|
|
446
|
+
this.countryCode = newCountryCode;
|
|
447
|
+
this.updateValueWithNewCountryCode(prevCountryCode, newCountryCode);
|
|
406
448
|
},
|
|
407
449
|
enumerable: false,
|
|
408
450
|
configurable: true
|
|
@@ -424,11 +466,16 @@
|
|
|
424
466
|
enumerable: false,
|
|
425
467
|
configurable: true
|
|
426
468
|
});
|
|
427
|
-
Object.defineProperty(TuiInputPhoneComponent.prototype, "
|
|
469
|
+
Object.defineProperty(TuiInputPhoneComponent.prototype, "nativeValue", {
|
|
428
470
|
get: function () {
|
|
429
|
-
return this.
|
|
430
|
-
?
|
|
431
|
-
: this.
|
|
471
|
+
return this.nativeFocusableElement
|
|
472
|
+
? this.nativeFocusableElement.value
|
|
473
|
+
: core.maskitoTransform(this.value, this.maskOptions);
|
|
474
|
+
},
|
|
475
|
+
set: function (value) {
|
|
476
|
+
if (this.nativeFocusableElement) {
|
|
477
|
+
this.nativeFocusableElement.value = value;
|
|
478
|
+
}
|
|
432
479
|
},
|
|
433
480
|
enumerable: false,
|
|
434
481
|
configurable: true
|
|
@@ -449,42 +496,34 @@
|
|
|
449
496
|
});
|
|
450
497
|
Object.defineProperty(TuiInputPhoneComponent.prototype, "canClean", {
|
|
451
498
|
get: function () {
|
|
452
|
-
return this.
|
|
499
|
+
return (this.nativeValue !== this.nonRemovablePrefix && this.textfieldCleaner.cleaner);
|
|
500
|
+
},
|
|
501
|
+
enumerable: false,
|
|
502
|
+
configurable: true
|
|
503
|
+
});
|
|
504
|
+
Object.defineProperty(TuiInputPhoneComponent.prototype, "maskOptions", {
|
|
505
|
+
get: function () {
|
|
506
|
+
return this.calculateMask(this.countryCode, this.phoneMaskAfterCountryCode, this.nonRemovablePrefix, this.allowText);
|
|
453
507
|
},
|
|
454
508
|
enumerable: false,
|
|
455
509
|
configurable: true
|
|
456
510
|
});
|
|
457
|
-
TuiInputPhoneComponent.prototype.onDrop = function (event) {
|
|
458
|
-
if (!event.dataTransfer) {
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
this.setValueWithoutPrefix(event.dataTransfer.getData('text'));
|
|
462
|
-
event.preventDefault();
|
|
463
|
-
};
|
|
464
|
-
TuiInputPhoneComponent.prototype.onPaste = function (event) {
|
|
465
|
-
this.setValueWithoutPrefix(i2.tuiGetClipboardDataText(event));
|
|
466
|
-
};
|
|
467
511
|
TuiInputPhoneComponent.prototype.onActiveZone = function (active) {
|
|
468
512
|
this.updateFocused(active);
|
|
469
|
-
if (active && !this.
|
|
470
|
-
this.updateSearch(this.
|
|
513
|
+
if (active && !this.nativeValue && !this.readOnly && !this.allowText) {
|
|
514
|
+
this.updateSearch(this.nonRemovablePrefix);
|
|
515
|
+
this.nativeValue = this.nonRemovablePrefix;
|
|
471
516
|
return;
|
|
472
517
|
}
|
|
473
|
-
if (this.
|
|
474
|
-
(this.search !== null &&
|
|
475
|
-
Number.isNaN(parseInt(this.search.replace(i1.TUI_MASK_SYMBOLS_REGEXP, ''), 10)))) {
|
|
518
|
+
if (this.nativeValue === this.nonRemovablePrefix || this.isTextValue) {
|
|
476
519
|
this.updateSearch('');
|
|
520
|
+
this.nativeValue = '';
|
|
477
521
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
var target = event.target;
|
|
481
|
-
if ((target.selectionStart || 0) <= this.nonRemovableLength &&
|
|
482
|
-
target.selectionStart === target.selectionEnd) {
|
|
483
|
-
event.preventDefault();
|
|
522
|
+
if (!active && !this.allowText && this.nativeFocusableElement) {
|
|
523
|
+
this.nativeValue = this.nativeValue.replace(/\D$/, '');
|
|
484
524
|
}
|
|
485
525
|
};
|
|
486
526
|
TuiInputPhoneComponent.prototype.onValueChange = function (value) {
|
|
487
|
-
value = value === '' ? this.countryCode : value;
|
|
488
527
|
var parsed = isText(value)
|
|
489
528
|
? value
|
|
490
529
|
: value.replace(i1.TUI_MASK_SYMBOLS_REGEXP, '').slice(0, this.maxPhoneLength);
|
|
@@ -495,6 +534,7 @@
|
|
|
495
534
|
TuiInputPhoneComponent.prototype.handleOption = function (item) {
|
|
496
535
|
this.focusInput();
|
|
497
536
|
this.value = item;
|
|
537
|
+
this.nativeValue = core.maskitoTransform(this.value, this.maskOptions);
|
|
498
538
|
this.updateSearch('');
|
|
499
539
|
this.open = false;
|
|
500
540
|
};
|
|
@@ -504,6 +544,7 @@
|
|
|
504
544
|
};
|
|
505
545
|
TuiInputPhoneComponent.prototype.writeValue = function (value) {
|
|
506
546
|
_super.prototype.writeValue.call(this, value);
|
|
547
|
+
this.nativeValue = core.maskitoTransform(value || '', this.maskOptions);
|
|
507
548
|
this.updateSearch('');
|
|
508
549
|
};
|
|
509
550
|
TuiInputPhoneComponent.prototype.getFallbackValue = function () {
|
|
@@ -524,9 +565,16 @@
|
|
|
524
565
|
enumerable: false,
|
|
525
566
|
configurable: true
|
|
526
567
|
});
|
|
568
|
+
Object.defineProperty(TuiInputPhoneComponent.prototype, "nonRemovablePrefix", {
|
|
569
|
+
get: function () {
|
|
570
|
+
return this.countryCode + " ";
|
|
571
|
+
},
|
|
572
|
+
enumerable: false,
|
|
573
|
+
configurable: true
|
|
574
|
+
});
|
|
527
575
|
Object.defineProperty(TuiInputPhoneComponent.prototype, "nonRemovableLength", {
|
|
528
576
|
get: function () {
|
|
529
|
-
return this.isTextValue ? 0 : this.
|
|
577
|
+
return this.isTextValue ? 0 : this.nonRemovablePrefix.length;
|
|
530
578
|
},
|
|
531
579
|
enumerable: false,
|
|
532
580
|
configurable: true
|
|
@@ -546,36 +594,30 @@
|
|
|
546
594
|
enumerable: false,
|
|
547
595
|
configurable: true
|
|
548
596
|
});
|
|
597
|
+
TuiInputPhoneComponent.prototype.calculateMask = function (countryCode, phoneMaskAfterCountryCode, nonRemovablePrefix, allowText) {
|
|
598
|
+
var mask = tuiCreatePhoneMaskExpression(countryCode, phoneMaskAfterCountryCode);
|
|
599
|
+
var preprocessor = tuiCreateCompletePhoneInsertionPreprocessor(countryCode, phoneMaskAfterCountryCode);
|
|
600
|
+
return allowText
|
|
601
|
+
? {
|
|
602
|
+
mask: function (_a) {
|
|
603
|
+
var value = _a.value;
|
|
604
|
+
return isText(value) && value !== '+'
|
|
605
|
+
? core.MASKITO_DEFAULT_OPTIONS.mask
|
|
606
|
+
: mask;
|
|
607
|
+
},
|
|
608
|
+
preprocessor: preprocessor,
|
|
609
|
+
}
|
|
610
|
+
: {
|
|
611
|
+
mask: mask,
|
|
612
|
+
preprocessor: preprocessor,
|
|
613
|
+
postprocessor: kit.maskitoPrefixPostprocessorGenerator(nonRemovablePrefix),
|
|
614
|
+
};
|
|
615
|
+
};
|
|
549
616
|
TuiInputPhoneComponent.prototype.setCaretPosition = function () {
|
|
550
617
|
if (this.caretIsInForbiddenArea && !!this.nativeFocusableElement) {
|
|
551
618
|
this.nativeFocusableElement.setSelectionRange(this.nonRemovableLength, this.nonRemovableLength);
|
|
552
619
|
}
|
|
553
620
|
};
|
|
554
|
-
TuiInputPhoneComponent.prototype.setValueWithoutPrefix = function (value) {
|
|
555
|
-
if (this.readOnly) {
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
this.open = true;
|
|
559
|
-
this.value = this.cleanValue(value);
|
|
560
|
-
this.updateSearch(this.allowText && isText(value)
|
|
561
|
-
? value
|
|
562
|
-
: value.replace(i1.TUI_MASK_SYMBOLS_REGEXP, ''));
|
|
563
|
-
};
|
|
564
|
-
TuiInputPhoneComponent.prototype.cleanValue = function (value) {
|
|
565
|
-
var reg = this.countryCode === '+7' ? /^7|^8/ : new RegExp(this.countryCode.slice(1));
|
|
566
|
-
var oldValueExist = this.value.length > this.countryCode.length &&
|
|
567
|
-
this.value.length < this.maxPhoneLength;
|
|
568
|
-
var newValueLength = value.replace(i1.TUI_MASK_SYMBOLS_REGEXP, '').length;
|
|
569
|
-
var cleanNewValue = value.replace(/[^0-9]+/g, '');
|
|
570
|
-
var selectionLength = String(getSelection()).length;
|
|
571
|
-
if (oldValueExist && selectionLength === 0) {
|
|
572
|
-
return ("" + this.value + cleanNewValue).slice(0, this.maxPhoneLength);
|
|
573
|
-
}
|
|
574
|
-
if (newValueLength < this.maxPhoneLength - 1) {
|
|
575
|
-
return ("" + this.countryCode + cleanNewValue).slice(0, this.maxPhoneLength);
|
|
576
|
-
}
|
|
577
|
-
return ("" + this.countryCode + cleanNewValue.replace(reg, '')).slice(0, this.maxPhoneLength);
|
|
578
|
-
};
|
|
579
621
|
TuiInputPhoneComponent.prototype.focusInput = function () {
|
|
580
622
|
if (this.nativeFocusableElement) {
|
|
581
623
|
this.nativeFocusableElement.focus({ preventScroll: true });
|
|
@@ -588,20 +630,21 @@
|
|
|
588
630
|
this.search = search;
|
|
589
631
|
this.searchChange.emit(search);
|
|
590
632
|
};
|
|
591
|
-
TuiInputPhoneComponent.prototype.updateValueWithNewCountryCode = function (newCountryCode) {
|
|
633
|
+
TuiInputPhoneComponent.prototype.updateValueWithNewCountryCode = function (prevCountryCode, newCountryCode) {
|
|
592
634
|
if (!this.isTextValue) {
|
|
593
|
-
this.value = this.value.replace(
|
|
635
|
+
this.value = this.value.replace(prevCountryCode, newCountryCode);
|
|
636
|
+
this.nativeValue = core.maskitoTransform(this.value, this.maskOptions);
|
|
594
637
|
}
|
|
595
638
|
};
|
|
596
639
|
return TuiInputPhoneComponent;
|
|
597
640
|
}(i2.AbstractTuiControl));
|
|
598
|
-
TuiInputPhoneComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneComponent, deps: [{ token:
|
|
641
|
+
TuiInputPhoneComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneComponent, deps: [{ token: i5.NgControl, optional: true, self: true }, { token: i2.TuiDestroyService, self: true }, { token: i0.ChangeDetectorRef }, { token: i1.TUI_SELECTION_STREAM }, { token: i1.TUI_TEXTFIELD_CLEANER }, { token: TUI_INPUT_PHONE_OPTIONS }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
599
642
|
TuiInputPhoneComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiInputPhoneComponent, selector: "tui-input-phone", inputs: { countryCodeSetter: ["countryCode", "countryCodeSetter"], phoneMaskAfterCountryCode: "phoneMaskAfterCountryCode", allowText: "allowText", search: "search" }, outputs: { searchChange: "searchChange" }, providers: [
|
|
600
643
|
i2.TuiDestroyService,
|
|
601
644
|
i2.tuiAsFocusableItemAccessor(TuiInputPhoneComponent),
|
|
602
645
|
i2.tuiAsControl(TuiInputPhoneComponent),
|
|
603
646
|
i1.tuiAsDataListHost(TuiInputPhoneComponent),
|
|
604
|
-
], queries: [{ propertyName: "datalist", first: true, predicate: i1.TuiDataListDirective, descendants: true, read: i0.TemplateRef }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: i1.TuiHostedDropdownComponent, descendants: true }, { propertyName: "textfield", first: true, predicate: i1.TuiPrimitiveTextfieldComponent, descendants: true }], usesInheritance: true, ngImport: i0__namespace, template: "<tui-hosted-dropdown\n class=\"t-hosted\"\n [canOpen]=\"canOpen\"\n [content]=\"datalist || ''\"\n [(open)]=\"open\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-primitive-textfield\n tuiValueAccessor\n class=\"t-textfield\"\n [pseudoHover]=\"pseudoHover\"\n [pseudoFocus]=\"computedFocused\"\n [invalid]=\"computedInvalid\"\n [nativeId]=\"nativeId\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [focusable]=\"focusable\"\n [
|
|
647
|
+
], queries: [{ propertyName: "datalist", first: true, predicate: i1.TuiDataListDirective, descendants: true, read: i0.TemplateRef }], viewQueries: [{ propertyName: "dropdown", first: true, predicate: i1.TuiHostedDropdownComponent, descendants: true }, { propertyName: "textfield", first: true, predicate: i1.TuiPrimitiveTextfieldComponent, descendants: true }], usesInheritance: true, ngImport: i0__namespace, template: "<tui-hosted-dropdown\n class=\"t-hosted\"\n [canOpen]=\"canOpen\"\n [content]=\"datalist || ''\"\n [(open)]=\"open\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-primitive-textfield\n tuiValueAccessor\n class=\"t-textfield\"\n [pseudoHover]=\"pseudoHover\"\n [pseudoFocus]=\"computedFocused\"\n [invalid]=\"computedInvalid\"\n [nativeId]=\"nativeId\"\n [readOnly]=\"readOnly\"\n [disabled]=\"computedDisabled\"\n [focusable]=\"focusable\"\n [maskito]=\"maskOptions\"\n [tuiTextfieldCleaner]=\"canClean\"\n [(value)]=\"nativeValue\"\n (valueChange)=\"onValueChange($event)\"\n >\n <ng-content></ng-content>\n <ng-content\n select=\"input\"\n ngProjectAs=\"input\"\n ></ng-content>\n </tui-primitive-textfield>\n</tui-hosted-dropdown>\n", styles: [":host{display:block;border-radius:var(--tui-radius-m);text-align:left}:host._disabled{pointer-events:none}.t-hosted{display:block;border-radius:inherit}.t-textfield{border-radius:inherit;text-align:inherit}\n"], components: [{ type: i1__namespace.TuiHostedDropdownComponent, selector: "tui-hosted-dropdown", inputs: ["content", "sided", "canOpen", "open"], outputs: ["openChange", "focusedChange"] }, { type: i1__namespace.TuiPrimitiveTextfieldComponent, selector: "tui-primitive-textfield", inputs: ["editable", "filler", "iconCleaner", "readOnly", "invalid", "disabled", "prefix", "postfix", "value"], outputs: ["valueChange"] }], directives: [{ type: i2__namespace.TuiActiveZoneDirective, selector: "[tuiActiveZone]:not(ng-container), [tuiActiveZoneChange]:not(ng-container), [tuiActiveZoneParent]:not(ng-container)", inputs: ["tuiActiveZoneParent"], outputs: ["tuiActiveZoneChange"], exportAs: ["tuiActiveZone"] }, { type: i1__namespace.TuiPrimitiveTextfieldDirective, selector: "tui-primitive-textfield" }, { type: i3__namespace.TuiValueAccessorDirective, selector: "[tuiValueAccessor]" }, { type: i4__namespace.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { type: i1__namespace.TuiTextfieldCleanerDirective, selector: "[tuiTextfieldCleaner]", inputs: ["tuiTextfieldCleaner"] }], viewProviders: [providers.FIXED_DROPDOWN_CONTROLLER_PROVIDER], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
605
648
|
__decorate([
|
|
606
649
|
i2.tuiRequiredSetter()
|
|
607
650
|
], TuiInputPhoneComponent.prototype, "countryCodeSetter", null);
|
|
@@ -614,6 +657,9 @@
|
|
|
614
657
|
__decorate([
|
|
615
658
|
i2.tuiDefaultProp()
|
|
616
659
|
], TuiInputPhoneComponent.prototype, "search", void 0);
|
|
660
|
+
__decorate([
|
|
661
|
+
i2.tuiPure
|
|
662
|
+
], TuiInputPhoneComponent.prototype, "calculateMask", null);
|
|
617
663
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneComponent, decorators: [{
|
|
618
664
|
type: i0.Component,
|
|
619
665
|
args: [{
|
|
@@ -630,14 +676,14 @@
|
|
|
630
676
|
viewProviders: [providers.FIXED_DROPDOWN_CONTROLLER_PROVIDER],
|
|
631
677
|
}]
|
|
632
678
|
}], ctorParameters: function () {
|
|
633
|
-
return [{ type:
|
|
679
|
+
return [{ type: i5__namespace.NgControl, decorators: [{
|
|
634
680
|
type: i0.Optional
|
|
635
681
|
}, {
|
|
636
682
|
type: i0.Self
|
|
637
683
|
}, {
|
|
638
684
|
type: i0.Inject,
|
|
639
|
-
args: [
|
|
640
|
-
}] }, { type:
|
|
685
|
+
args: [i5.NgControl]
|
|
686
|
+
}] }, { type: i6__namespace.Observable, decorators: [{
|
|
641
687
|
type: i0.Self
|
|
642
688
|
}, {
|
|
643
689
|
type: i0.Inject,
|
|
@@ -645,7 +691,7 @@
|
|
|
645
691
|
}] }, { type: i0__namespace.ChangeDetectorRef, decorators: [{
|
|
646
692
|
type: i0.Inject,
|
|
647
693
|
args: [i0.ChangeDetectorRef]
|
|
648
|
-
}] }, { type:
|
|
694
|
+
}] }, { type: i6__namespace.Observable, decorators: [{
|
|
649
695
|
type: i0.Inject,
|
|
650
696
|
args: [i1.TUI_SELECTION_STREAM]
|
|
651
697
|
}] }, { type: i1__namespace.TuiTextfieldCleanerDirective, decorators: [{
|
|
@@ -675,7 +721,7 @@
|
|
|
675
721
|
}], datalist: [{
|
|
676
722
|
type: i0.ContentChild,
|
|
677
723
|
args: [i1.TuiDataListDirective, { read: i0.TemplateRef }]
|
|
678
|
-
}] } });
|
|
724
|
+
}], calculateMask: [] } });
|
|
679
725
|
function isText(value) {
|
|
680
726
|
return Number.isNaN(parseInt(value.replace(i1.TUI_MASK_SYMBOLS_REGEXP, ''), 10));
|
|
681
727
|
}
|
|
@@ -687,7 +733,7 @@
|
|
|
687
733
|
}
|
|
688
734
|
Object.defineProperty(TuiInputPhoneDirective.prototype, "value", {
|
|
689
735
|
get: function () {
|
|
690
|
-
return this.host.
|
|
736
|
+
return this.host.nativeValue;
|
|
691
737
|
},
|
|
692
738
|
enumerable: false,
|
|
693
739
|
configurable: true
|
|
@@ -723,14 +769,14 @@
|
|
|
723
769
|
return TuiInputPhoneModule;
|
|
724
770
|
}());
|
|
725
771
|
TuiInputPhoneModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
726
|
-
TuiInputPhoneModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneModule, declarations: [TuiInputPhoneComponent, TuiInputPhoneDirective], imports: [
|
|
772
|
+
TuiInputPhoneModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneModule, declarations: [TuiInputPhoneComponent, TuiInputPhoneDirective], imports: [i4.MaskitoModule,
|
|
727
773
|
i1.TuiPrimitiveTextfieldModule,
|
|
728
774
|
i1.TuiHostedDropdownModule,
|
|
729
775
|
i1.TuiTextfieldControllerModule,
|
|
730
776
|
i2.TuiActiveZoneModule,
|
|
731
777
|
i3.TuiValueAccessorModule], exports: [TuiInputPhoneComponent, TuiInputPhoneDirective, i1.TuiTextfieldComponent] });
|
|
732
778
|
TuiInputPhoneModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiInputPhoneModule, imports: [[
|
|
733
|
-
|
|
779
|
+
i4.MaskitoModule,
|
|
734
780
|
i1.TuiPrimitiveTextfieldModule,
|
|
735
781
|
i1.TuiHostedDropdownModule,
|
|
736
782
|
i1.TuiTextfieldControllerModule,
|
|
@@ -741,7 +787,7 @@
|
|
|
741
787
|
type: i0.NgModule,
|
|
742
788
|
args: [{
|
|
743
789
|
imports: [
|
|
744
|
-
|
|
790
|
+
i4.MaskitoModule,
|
|
745
791
|
i1.TuiPrimitiveTextfieldModule,
|
|
746
792
|
i1.TuiHostedDropdownModule,
|
|
747
793
|
i1.TuiTextfieldControllerModule,
|