@elderbyte/ngx-starter 20.4.0 → 20.4.2
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.
|
@@ -2033,18 +2033,24 @@ class CurrencyFormatUtil {
|
|
|
2033
2033
|
class PhoneFormatService {
|
|
2034
2034
|
/***************************************************************************
|
|
2035
2035
|
* *
|
|
2036
|
-
* Public
|
|
2036
|
+
* Public API *
|
|
2037
2037
|
* *
|
|
2038
2038
|
**************************************************************************/
|
|
2039
|
-
formatPhoneNumber(
|
|
2039
|
+
formatPhoneNumber(number, countryCode, config) {
|
|
2040
2040
|
if (!config || !config.dialingCode) {
|
|
2041
|
-
return
|
|
2041
|
+
return this.handleWithoutConfig(number, countryCode);
|
|
2042
|
+
}
|
|
2043
|
+
else {
|
|
2044
|
+
return this.applyFormattingPerConfig(number, config);
|
|
2042
2045
|
}
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2046
|
+
}
|
|
2047
|
+
/***************************************************************************
|
|
2048
|
+
* *
|
|
2049
|
+
* Private Methods *
|
|
2050
|
+
* *
|
|
2051
|
+
**************************************************************************/
|
|
2052
|
+
applyFormattingPerConfig(number, config) {
|
|
2053
|
+
let phoneNrBody = this.preparePhoneNumberBody(number, config);
|
|
2048
2054
|
if (config.bodyFormat) {
|
|
2049
2055
|
const [regex, format] = config.bodyFormat;
|
|
2050
2056
|
phoneNrBody = phoneNrBody.replace(regex, format);
|
|
@@ -2052,11 +2058,23 @@ class PhoneFormatService {
|
|
|
2052
2058
|
const prefix = config.customPrefix ?? `${config.dialingCode} `;
|
|
2053
2059
|
return `${prefix}${phoneNrBody}`;
|
|
2054
2060
|
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2061
|
+
preparePhoneNumberBody(number, config) {
|
|
2062
|
+
const clean = this.cleanNumberString(number);
|
|
2063
|
+
const withoutDialingCode = this.removeDialingCode(clean, config.dialingCode);
|
|
2064
|
+
return withoutDialingCode.replace(/^0+/, ''); // remove leading zeros
|
|
2065
|
+
}
|
|
2066
|
+
cleanNumberString(number) {
|
|
2067
|
+
const regex = /[^0-9+]/g; //
|
|
2068
|
+
return number.replace(regex, '');
|
|
2069
|
+
}
|
|
2070
|
+
handleWithoutConfig(number, countryCode) {
|
|
2071
|
+
if (!countryCode) {
|
|
2072
|
+
return number;
|
|
2073
|
+
}
|
|
2074
|
+
else {
|
|
2075
|
+
return countryCode + ' ' + number;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2060
2078
|
removeDialingCode(phoneNr, dialingCode) {
|
|
2061
2079
|
const dialingCodeWithDoubleZero = dialingCode.replace('+', '00');
|
|
2062
2080
|
for (const prefix of [dialingCode, dialingCodeWithDoubleZero]) {
|
|
@@ -2085,6 +2103,12 @@ class CountryPhoneFormatService {
|
|
|
2085
2103
|
bodyFormat: [/^(\d{2})(\d{3})(\d{2})(\d{2})$/, '$1 $2 $3 $4'],
|
|
2086
2104
|
customPrefix: '0',
|
|
2087
2105
|
},
|
|
2106
|
+
'0041': {
|
|
2107
|
+
country: 'CH',
|
|
2108
|
+
dialingCode: '+41',
|
|
2109
|
+
bodyFormat: [/^(\d{2})(\d{3})(\d{2})(\d{2})$/, '$1 $2 $3 $4'],
|
|
2110
|
+
customPrefix: '0',
|
|
2111
|
+
},
|
|
2088
2112
|
'+423': {
|
|
2089
2113
|
country: 'LI',
|
|
2090
2114
|
dialingCode: '+423',
|
|
@@ -2135,7 +2159,7 @@ class PhonePipe {
|
|
|
2135
2159
|
}
|
|
2136
2160
|
transform(phoneNumber) {
|
|
2137
2161
|
const countryPhoneFormat = this.countryPhoneFormats.getCountryPhoneFormat(phoneNumber.countryCode);
|
|
2138
|
-
return this.phoneFormat.formatPhoneNumber(phoneNumber.number, countryPhoneFormat);
|
|
2162
|
+
return this.phoneFormat.formatPhoneNumber(phoneNumber.number, phoneNumber.countryCode, countryPhoneFormat);
|
|
2139
2163
|
}
|
|
2140
2164
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: PhonePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
2141
2165
|
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.1.0", ngImport: i0, type: PhonePipe, isStandalone: true, name: "phone" }); }
|
|
@@ -25596,6 +25620,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
25596
25620
|
*/
|
|
25597
25621
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
25598
25622
|
class ElderMultiSelectBase extends ElderSelectBase {
|
|
25623
|
+
// @Output()
|
|
25624
|
+
// public readonly entityIdsUpdated: Observable<TId[]> = this.entitiesChangeEvent.pipe(
|
|
25625
|
+
// filter((event) => event.userInitiated),
|
|
25626
|
+
// map((event) => event.idsAfter)
|
|
25627
|
+
// )
|
|
25599
25628
|
/***************************************************************************
|
|
25600
25629
|
* *
|
|
25601
25630
|
* Constructor *
|
|
@@ -25941,7 +25970,7 @@ class ElderMultiSelectBase extends ElderSelectBase {
|
|
|
25941
25970
|
return entities;
|
|
25942
25971
|
}
|
|
25943
25972
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ElderMultiSelectBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive }); }
|
|
25944
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.0", type: ElderMultiSelectBase, isStandalone: true, inputs: { entitiesSorts: "entitiesSorts", confirmRemoval: "confirmRemoval", entities: "entities", entityIds: "entityIds" }, outputs: { entitiesChangeEvent: "entitiesChangeEvent" }, host: { properties: { "class": "this.hostClass", "class.mat-select-disabled": "this.disabledClass", "class.mat-select-invalid": "this.errorStateClass", "class.mat-select-required": "this.requiredClass", "class.mat-select-empty": "this.emptyClass" } }, usesInheritance: true, ngImport: i0 }); }
|
|
25973
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.0", type: ElderMultiSelectBase, isStandalone: true, inputs: { entitiesSorts: "entitiesSorts", confirmRemoval: "confirmRemoval", entities: "entities", entityIds: "entityIds" }, outputs: { entitiesChangeEvent: "entitiesChangeEvent", entitiesChange: "entitiesChange", entitiesUpdated: "entitiesUpdated", entityIdsChange: "entityIdsChange", entityIdsUpdated: "entityIdsUpdated" }, host: { properties: { "class": "this.hostClass", "class.mat-select-disabled": "this.disabledClass", "class.mat-select-invalid": "this.errorStateClass", "class.mat-select-required": "this.requiredClass", "class.mat-select-empty": "this.emptyClass" } }, usesInheritance: true, ngImport: i0 }); }
|
|
25945
25974
|
}
|
|
25946
25975
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImport: i0, type: ElderMultiSelectBase, decorators: [{
|
|
25947
25976
|
type: Directive
|
|
@@ -25951,6 +25980,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
25951
25980
|
type: Input
|
|
25952
25981
|
}], entitiesChangeEvent: [{
|
|
25953
25982
|
type: Output
|
|
25983
|
+
}], entitiesChange: [{
|
|
25984
|
+
type: Output
|
|
25985
|
+
}], entitiesUpdated: [{
|
|
25986
|
+
type: Output
|
|
25987
|
+
}], entityIdsChange: [{
|
|
25988
|
+
type: Output
|
|
25989
|
+
}], entityIdsUpdated: [{
|
|
25990
|
+
type: Output
|
|
25954
25991
|
}], hostClass: [{
|
|
25955
25992
|
type: HostBinding,
|
|
25956
25993
|
args: ['class']
|