ngx-techlify-core 18.86.0 → 18.87.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/esm2022/lib/phone-number-selector/country.service.mjs +31 -0
- package/esm2022/lib/phone-number-selector/phone-number-selector.component.mjs +172 -0
- package/esm2022/public-api.mjs +3 -4
- package/fesm2022/ngx-techlify-core.mjs +228 -46
- package/fesm2022/ngx-techlify-core.mjs.map +1 -1
- package/lib/phone-number-selector/country.service.d.ts +12 -0
- package/lib/phone-number-selector/phone-number-selector.component.d.ts +47 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TechlifyService } from '../base-model/techlify-service';
|
|
2
|
+
import { HttpService } from '../core/http.service';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class CountryService extends TechlifyService {
|
|
6
|
+
protected http: HttpService;
|
|
7
|
+
private countries?;
|
|
8
|
+
constructor(http: HttpService);
|
|
9
|
+
getCountriesObservable(reload?: boolean): Observable<any[]>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CountryService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CountryService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { CountryService } from './country.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class PhoneNumberSelectorComponent implements ControlValueAccessor, OnInit, OnDestroy {
|
|
6
|
+
private service;
|
|
7
|
+
label: import("@angular/core").InputSignal<string>;
|
|
8
|
+
placeholder: import("@angular/core").InputSignal<string>;
|
|
9
|
+
required: import("@angular/core").InputSignal<boolean>;
|
|
10
|
+
countries: import("@angular/core").WritableSignal<any[]>;
|
|
11
|
+
readonly phoneGroup: FormGroup<{
|
|
12
|
+
country_code: FormControl<string>;
|
|
13
|
+
number: FormControl<string>;
|
|
14
|
+
}>;
|
|
15
|
+
private onChange;
|
|
16
|
+
protected onTouched: () => void;
|
|
17
|
+
private destroy$;
|
|
18
|
+
/**
|
|
19
|
+
* Used to validate inline that the number entered is valid based on the
|
|
20
|
+
* selected country's phone length, with or without its calling code.
|
|
21
|
+
* Countries without a phone length are not validated yet
|
|
22
|
+
*/
|
|
23
|
+
private readonly phoneFormatValidator;
|
|
24
|
+
constructor(service: CountryService);
|
|
25
|
+
ngOnInit(): void;
|
|
26
|
+
ngOnDestroy(): void;
|
|
27
|
+
writeValue(value: string | null): void;
|
|
28
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
29
|
+
registerOnTouched(fn: () => void): void;
|
|
30
|
+
setDisabledState(isDisabled: boolean): void;
|
|
31
|
+
/**
|
|
32
|
+
* Adjust the number to be sent to the api in the correct format
|
|
33
|
+
*/
|
|
34
|
+
private normalizeForApi;
|
|
35
|
+
private getCountry;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the digits of the number without the country's calling code
|
|
38
|
+
*/
|
|
39
|
+
private toLocalDigits;
|
|
40
|
+
/**
|
|
41
|
+
* Finds the country from the calling code the number starts with.
|
|
42
|
+
* +1 is shared by several countries, so it defaults to US like before
|
|
43
|
+
*/
|
|
44
|
+
private detectCountry;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PhoneNumberSelectorComponent, never>;
|
|
46
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PhoneNumberSelectorComponent, "app-phone-number-selector", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
47
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -138,6 +138,8 @@ export * from './lib/file-dragdrop-uploader/file-dragdrop-uploader/file-dragdrop
|
|
|
138
138
|
export * from './lib/file-dragdrop-uploader/file-dragdrop-uploader.module';
|
|
139
139
|
export * from './lib/number-input-button';
|
|
140
140
|
export * from './lib/number-selector/number-selector.component';
|
|
141
|
+
export * from './lib/phone-number-selector/phone-number-selector.component';
|
|
142
|
+
export * from './lib/phone-number-selector/country.service';
|
|
141
143
|
export * from './lib/column-selector';
|
|
142
144
|
export * from './lib/reset-password';
|
|
143
145
|
export * from './lib/reset-password/reset-password.module';
|