@seniorsistemas/angular-components 16.10.5 → 16.10.6
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/seniorsistemas-angular-components.umd.js +45 -19
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/country-phone-picker/country-phone-picker.component.d.ts +9 -6
- package/esm2015/components/country-phone-picker/country-phone-picker.component.js +40 -21
- package/esm5/components/country-phone-picker/country-phone-picker.component.js +47 -21
- package/fesm2015/seniorsistemas-angular-components.js +39 -20
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +46 -20
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __spread, __assign, __values, __extends, __rest, __awaiter, __generator, __param, __read } from 'tslib';
|
|
2
|
-
import { EventEmitter, Input, Output, HostListener, Component, NgModule, HostBinding, ViewChild, Renderer2, Directive, Injectable, ElementRef,
|
|
2
|
+
import { EventEmitter, Input, Output, HostListener, Component, NgModule, HostBinding, ViewChild, Renderer2, Directive, Injectable, ElementRef, forwardRef, Pipe, ViewEncapsulation, ɵɵdefineInjectable, InjectionToken, Inject, ApplicationRef, ComponentFactoryResolver, Injector, TemplateRef, ViewContainerRef, ChangeDetectorRef, Optional, ContentChild, ContentChildren } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { RouterModule, NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router } from '@angular/router';
|
|
5
5
|
import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
|
|
@@ -1380,10 +1380,10 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1380
1380
|
this.tabindex = 0;
|
|
1381
1381
|
this._filterCountries = function (value) {
|
|
1382
1382
|
if (!value) {
|
|
1383
|
-
_this.filteredCountriesList = _this.
|
|
1383
|
+
_this.filteredCountriesList = _this._countriesList;
|
|
1384
1384
|
}
|
|
1385
1385
|
else {
|
|
1386
|
-
_this.filteredCountriesList = _this.
|
|
1386
|
+
_this.filteredCountriesList = _this._countriesList.filter(function (country) {
|
|
1387
1387
|
var countryName = _this.translate.instant("platform.angular_components.country_name_" + country.id);
|
|
1388
1388
|
return countryName.toLowerCase().includes(value.toLowerCase());
|
|
1389
1389
|
});
|
|
@@ -1391,8 +1391,31 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1391
1391
|
};
|
|
1392
1392
|
}
|
|
1393
1393
|
CountryPhonePickerComponent_1 = CountryPhonePickerComponent;
|
|
1394
|
+
Object.defineProperty(CountryPhonePickerComponent.prototype, "value", {
|
|
1395
|
+
get: function () {
|
|
1396
|
+
return this._value;
|
|
1397
|
+
},
|
|
1398
|
+
set: function (value) {
|
|
1399
|
+
this._value = value;
|
|
1400
|
+
this.mask = this.getMask();
|
|
1401
|
+
},
|
|
1402
|
+
enumerable: true,
|
|
1403
|
+
configurable: true
|
|
1404
|
+
});
|
|
1394
1405
|
CountryPhonePickerComponent.prototype.writeValue = function (value) {
|
|
1395
1406
|
this.value = value;
|
|
1407
|
+
if (value === null || value === void 0 ? void 0 : value.id) {
|
|
1408
|
+
var country = this._countriesList.filter(function (_a) {
|
|
1409
|
+
var id = _a.id;
|
|
1410
|
+
return id == value.id;
|
|
1411
|
+
});
|
|
1412
|
+
if (country.length) {
|
|
1413
|
+
this.onSelectItem(country[0]);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
if (value === null || value === void 0 ? void 0 : value.rawValue) {
|
|
1417
|
+
this.phone.setValue(value.rawValue);
|
|
1418
|
+
}
|
|
1396
1419
|
};
|
|
1397
1420
|
CountryPhonePickerComponent.prototype.registerOnChange = function (onChange) {
|
|
1398
1421
|
this._onChange = onChange;
|
|
@@ -1413,28 +1436,30 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1413
1436
|
var countries = this.countryPhonePickerService.getCountries(this.ordination);
|
|
1414
1437
|
this.filter.valueChanges.subscribe(this._filterCountries);
|
|
1415
1438
|
if ((_a = this.countries) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1416
|
-
this.
|
|
1439
|
+
this._countriesList = countries.filter(function (country) { return _this.countries.includes(country.id); });
|
|
1417
1440
|
}
|
|
1418
1441
|
else {
|
|
1419
|
-
this.
|
|
1442
|
+
this._countriesList = countries;
|
|
1420
1443
|
}
|
|
1421
|
-
this.filteredCountriesList = this.
|
|
1444
|
+
this.filteredCountriesList = this._countriesList;
|
|
1422
1445
|
this.selectedItem = this._getSelectedCountryDefault();
|
|
1446
|
+
this.mask = this.getMask();
|
|
1423
1447
|
this.phone.valueChanges.subscribe(function (value) {
|
|
1424
|
-
var _a;
|
|
1425
1448
|
_this.value = {
|
|
1426
1449
|
id: _this.selectedItem.id,
|
|
1427
1450
|
ddi: _this.selectedItem.ddi,
|
|
1428
1451
|
rawValue: value !== null && value !== void 0 ? value : "",
|
|
1429
1452
|
value: value ? "" + _this._applyMask(value) : "",
|
|
1430
1453
|
};
|
|
1431
|
-
(
|
|
1454
|
+
if (_this._onChange) {
|
|
1455
|
+
_this._onChange(_this.value);
|
|
1456
|
+
}
|
|
1432
1457
|
});
|
|
1433
1458
|
};
|
|
1434
1459
|
CountryPhonePickerComponent.prototype.onKeydown = function (event) {
|
|
1435
1460
|
if (event.key === "Enter" || event.key === " ") {
|
|
1436
1461
|
if (this.open) {
|
|
1437
|
-
this.selectedItem = this.
|
|
1462
|
+
this.selectedItem = this._countriesList[this.currentItemIndex];
|
|
1438
1463
|
this.selected.emit(this.selectedItem);
|
|
1439
1464
|
}
|
|
1440
1465
|
this.open = !this.open;
|
|
@@ -1464,13 +1489,13 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1464
1489
|
});
|
|
1465
1490
|
CountryPhonePickerComponent.prototype.onBlur = function () {
|
|
1466
1491
|
this.open = false;
|
|
1467
|
-
this.currentItemIndex = this.
|
|
1492
|
+
this.currentItemIndex = this._countriesList.indexOf(this.selectedItem);
|
|
1468
1493
|
};
|
|
1469
1494
|
CountryPhonePickerComponent.prototype.onSelectItem = function (country) {
|
|
1470
1495
|
this.open = false;
|
|
1471
1496
|
this.selectedItem = country;
|
|
1472
1497
|
this.phone.setValue("");
|
|
1473
|
-
this.currentItemIndex = this.
|
|
1498
|
+
this.currentItemIndex = this._countriesList.indexOf(this.selectedItem);
|
|
1474
1499
|
this.selected.emit(this.selectedItem);
|
|
1475
1500
|
};
|
|
1476
1501
|
CountryPhonePickerComponent.prototype.onCleanFilter = function () {
|
|
@@ -1480,9 +1505,10 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1480
1505
|
this.open = false;
|
|
1481
1506
|
};
|
|
1482
1507
|
CountryPhonePickerComponent.prototype.getMask = function () {
|
|
1508
|
+
var _a;
|
|
1483
1509
|
var mask = this.selectedItem.mask;
|
|
1484
1510
|
if (Array.isArray(mask)) {
|
|
1485
|
-
return !this.value || this.value.
|
|
1511
|
+
return !((_a = this.value) === null || _a === void 0 ? void 0 : _a.rawValue) || this.value.rawValue.length <= mask[0].replace(/[^0]/g, "").length
|
|
1486
1512
|
? mask[0] // fixo
|
|
1487
1513
|
: mask[1]; // celular
|
|
1488
1514
|
}
|
|
@@ -1491,14 +1517,14 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1491
1517
|
}
|
|
1492
1518
|
};
|
|
1493
1519
|
CountryPhonePickerComponent.prototype.getPlaceholder = function () {
|
|
1494
|
-
return this.
|
|
1520
|
+
return this.mask.replace(/9/g, "");
|
|
1495
1521
|
};
|
|
1496
1522
|
CountryPhonePickerComponent.prototype._getSelectedCountryDefault = function () {
|
|
1497
|
-
if (!this.
|
|
1523
|
+
if (!this._countriesList.length) {
|
|
1498
1524
|
throw new Error("No country loaded");
|
|
1499
1525
|
}
|
|
1500
|
-
var filteredByBr = this.
|
|
1501
|
-
return filteredByBr.length ? filteredByBr[0] : this.
|
|
1526
|
+
var filteredByBr = this._countriesList.filter(function (country) { return country.id === "br"; });
|
|
1527
|
+
return filteredByBr.length ? filteredByBr[0] : this._countriesList[0];
|
|
1502
1528
|
};
|
|
1503
1529
|
CountryPhonePickerComponent.prototype._moveToUp = function () {
|
|
1504
1530
|
if (this.currentItemIndex == 0) {
|
|
@@ -1513,7 +1539,7 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1513
1539
|
}
|
|
1514
1540
|
};
|
|
1515
1541
|
CountryPhonePickerComponent.prototype._moveToDown = function () {
|
|
1516
|
-
if (this.currentItemIndex >= this.
|
|
1542
|
+
if (this.currentItemIndex >= this._countriesList.length - 1) {
|
|
1517
1543
|
return;
|
|
1518
1544
|
}
|
|
1519
1545
|
this.currentItemIndex++;
|
|
@@ -1534,7 +1560,7 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1534
1560
|
: this.selectedItem.mask[1] + "\0";
|
|
1535
1561
|
}
|
|
1536
1562
|
else {
|
|
1537
|
-
mask = this.selectedItem.mask;
|
|
1563
|
+
mask = this.selectedItem.mask + "\0";
|
|
1538
1564
|
}
|
|
1539
1565
|
var tokens = "";
|
|
1540
1566
|
var replace = "";
|
|
@@ -1598,10 +1624,10 @@ var CountryPhonePickerComponent = /** @class */ (function () {
|
|
|
1598
1624
|
CountryPhonePickerComponent = CountryPhonePickerComponent_1 = __decorate([
|
|
1599
1625
|
Component({
|
|
1600
1626
|
selector: "s-country-phone-picker",
|
|
1601
|
-
template: "<div class=\"country-phone-picker\">\n <div class=\"phone-input\">\n <div class=\"drop\" (click)=\"open = !open\">\n <span class=\"drop-flag\" [ngClass]=\"'fi fi-' + selectedItem.id\">\n </span>\n <span class=\"drop-icon fas fa-caret-down\"></span>\n </div>\n <p class=\"phone-ddi\">{{ selectedItem.ddi }}</p>\n <input\n #phoneInput\n type=\"tel\"\n autofocus\n [mask]=\"
|
|
1627
|
+
template: "<div class=\"country-phone-picker\">\n <div class=\"phone-input\">\n <div class=\"drop\" (click)=\"open = !open\">\n <span class=\"drop-flag\" [ngClass]=\"'fi fi-' + selectedItem.id\">\n </span>\n <span class=\"drop-icon fas fa-caret-down\"></span>\n </div>\n <p class=\"phone-ddi\">{{ selectedItem.ddi }}</p>\n <input\n #phoneInput\n type=\"tel\"\n autofocus\n [mask]=\"mask\" \n [placeholder]=\"getPlaceholder()\"\n [formControl]=\"phone\"\n (focus)=\"onPhoneInputFocus()\" />\n </div>\n <div *ngIf=\"open\" class=\"dropdown\">\n <div class=\"search\">\n <input\n class=\"search-field\"\n type=\"text\"\n [formControl]=\"filter\">\n <span class=\"search-icon fas fa-search\"></span>\n <span\n class=\"search-clear fa fa-times\"\n (click)=\"onCleanFilter()\"></span>\n </div>\n <ul class=\"select-list\">\n <li\n *ngFor=\"let country of filteredCountriesList; let i = index;\"\n class=\"select-option\"\n [ngClass]=\"{ 'select-option--focused': i == currentItemIndex }\"\n (click)=\"onSelectItem(country)\">\n <span\n class=\"select-option__flag\"\n [ngClass]=\"'fi fi-' + country.id\">\n </span>\n <span class=\"select-option__name\">\n {{ \"platform.angular_components.country_name_\" + country.id | translate }}\n </span>\n <span class=\"select-option__ddi\">\n {{ country.ddi }}\n </span>\n </li>\n </ul>\n </div>\n</div>",
|
|
1602
1628
|
providers: [{
|
|
1603
1629
|
provide: NG_VALUE_ACCESSOR,
|
|
1604
|
-
useExisting: CountryPhonePickerComponent_1,
|
|
1630
|
+
useExisting: forwardRef(function () { return CountryPhonePickerComponent_1; }),
|
|
1605
1631
|
multi: true,
|
|
1606
1632
|
}],
|
|
1607
1633
|
styles: [".country-phone-picker .phone-input{background-color:#fff;border:1px solid #d8d8d8;border-radius:4px;display:-ms-flexbox;display:flex;line-height:normal}.country-phone-picker .phone-input .drop{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex}.country-phone-picker .phone-input .drop .drop-flag{margin-left:12px}.country-phone-picker .phone-input .drop .drop-icon{font-size:12px;margin:0 8px}.country-phone-picker .phone-input .phone-ddi{margin:8px 0}.country-phone-picker .phone-input input{border:none;-ms-flex-positive:1;flex-grow:1;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;line-height:150%;margin-left:8px}.country-phone-picker .phone-input input:focus{color:#697882;outline:0}.country-phone-picker .dropdown{background-color:#fff;border-radius:4px;box-shadow:0 4px 5px #00000033;padding:4px 0;position:absolute;margin:2px 0;z-index:999999}.country-phone-picker .dropdown .search{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;padding:8px 12px}.country-phone-picker .dropdown .search .search-field{border:1px solid #d8d8d8;border-radius:4px;-ms-flex-positive:1;flex-grow:1;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;height:36px;line-height:150%;padding:0 32px 0 8px}.country-phone-picker .dropdown .search .search-icon{color:#333;font-size:12px;position:relative;right:24px}.country-phone-picker .dropdown .search .search-clear{color:#333;cursor:pointer;font-size:1rem}.country-phone-picker .dropdown .select-list{list-style:none;max-height:234px;min-width:360px;max-width:100vw;overflow:scroll;padding:0}.country-phone-picker .dropdown .select-list .select-option{cursor:pointer;display:-ms-flexbox;display:flex;padding:12px;-webkit-user-select:none;-ms-user-select:none;user-select:none}.country-phone-picker .dropdown .select-list .select-option .select-option__flag{margin-right:12px}.country-phone-picker .dropdown .select-list .select-option .select-option__name{margin-right:.5rem;max-width:100%;overflow:hidden;text-overflow:ellipsis}.country-phone-picker .dropdown .select-list .select-option .select-option__ddi{color:#697882;font-size:14px;font-family:\"Open Sans\",sans-serif;font-weight:400;line-height:150%}.country-phone-picker .dropdown .select-list .select-option--focused,.country-phone-picker .dropdown .select-list .select-option:hover{background-color:#e5eaea}"]
|