@acorex/components 21.0.1-next.28 → 21.0.1-next.29
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.
|
@@ -46,6 +46,10 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
46
46
|
*/
|
|
47
47
|
this.excluded = input([], ...(ngDevMode ? [{ debugName: "excluded" }] : []));
|
|
48
48
|
this.selectBox = viewChild('s', ...(ngDevMode ? [{ debugName: "selectBox" }] : []));
|
|
49
|
+
/** @ignore */
|
|
50
|
+
this.countries = signal([], ...(ngDevMode ? [{ debugName: "countries" }] : []));
|
|
51
|
+
/** @ignore */
|
|
52
|
+
this.selectedCountry = signal(null, ...(ngDevMode ? [{ debugName: "selectedCountry" }] : []));
|
|
49
53
|
this.#countriesChanged = effect(() => {
|
|
50
54
|
this.included();
|
|
51
55
|
this.excluded();
|
|
@@ -53,18 +57,16 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
53
57
|
this.cdr.detectChanges();
|
|
54
58
|
this.selectBox().refresh();
|
|
55
59
|
}, ...(ngDevMode ? [{ debugName: "#countriesChanged" }] : []));
|
|
56
|
-
this.#eff =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/** @ignore */
|
|
67
|
-
this.selectedCountry = signal(null, ...(ngDevMode ? [{ debugName: "selectedCountry" }] : []));
|
|
60
|
+
this.#eff = afterNextRender(() => {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
if (this.country() && !this.value) {
|
|
63
|
+
this.selectedCountry.set(this.countries().find((c) => c.code === this.country()));
|
|
64
|
+
}
|
|
65
|
+
else if (!this.country() && !this.value) {
|
|
66
|
+
this.selectedCountry.set(this.countries()[0]);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
68
70
|
/** @ignore */
|
|
69
71
|
this.dataSource = new AXDataSource({
|
|
70
72
|
pageSize: 10,
|
|
@@ -112,21 +114,13 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
112
114
|
#countriesChanged;
|
|
113
115
|
#eff;
|
|
114
116
|
/** @ignore */
|
|
115
|
-
_handleModelChange(
|
|
117
|
+
_handleModelChange(e) {
|
|
116
118
|
// Prevent value change if component is disabled or readonly
|
|
117
119
|
if (this.disabled || this.readonly) {
|
|
118
120
|
return;
|
|
119
121
|
}
|
|
120
|
-
this.commitValue(value, true);
|
|
121
|
-
}
|
|
122
|
-
/** @ignore */
|
|
123
|
-
handleCountryOnClosed() {
|
|
124
|
-
setTimeout(() => {
|
|
125
|
-
this.textbox?.focus();
|
|
126
|
-
}, 300);
|
|
122
|
+
this.commitValue(e.value, true);
|
|
127
123
|
}
|
|
128
|
-
/** @ignore */
|
|
129
|
-
#init;
|
|
130
124
|
internalValueChanged(value) {
|
|
131
125
|
if (!value)
|
|
132
126
|
return;
|
|
@@ -136,6 +130,14 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
136
130
|
this.commitValue(result.nationalNumber);
|
|
137
131
|
}
|
|
138
132
|
}
|
|
133
|
+
/** @ignore */
|
|
134
|
+
handleCountryOnClosed() {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
this.textbox?.focus();
|
|
137
|
+
}, 300);
|
|
138
|
+
}
|
|
139
|
+
/** @ignore */
|
|
140
|
+
#init;
|
|
139
141
|
/**
|
|
140
142
|
* Updates the list of countries based on included or excluded codes.
|
|
141
143
|
*
|
|
@@ -190,7 +192,8 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
190
192
|
for (const country of sorted) {
|
|
191
193
|
if (normalized.startsWith(country.iso2code)) {
|
|
192
194
|
const countryCode = country.iso2code;
|
|
193
|
-
const
|
|
195
|
+
const rawNationalNumber = normalized.slice(countryCode.length);
|
|
196
|
+
const nationalNumber = this.formatNationalNumber(rawNationalNumber, country.format);
|
|
194
197
|
return {
|
|
195
198
|
country,
|
|
196
199
|
countryCode,
|
|
@@ -205,13 +208,54 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
205
208
|
nationalNumber: normalized,
|
|
206
209
|
};
|
|
207
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Formats a national phone number according to the country's format pattern.
|
|
213
|
+
* The format pattern uses '0' as digit placeholders and preserves other characters (like spaces).
|
|
214
|
+
*
|
|
215
|
+
* @param number - The raw national number (digits only)
|
|
216
|
+
* @param format - The country's phone number format pattern (e.g., '000 000 0000')
|
|
217
|
+
* @returns The formatted national number with spaces according to the format
|
|
218
|
+
*/
|
|
219
|
+
formatNationalNumber(number, format) {
|
|
220
|
+
if (!format || !number) {
|
|
221
|
+
return number;
|
|
222
|
+
}
|
|
223
|
+
let result = '';
|
|
224
|
+
let numberIndex = 0;
|
|
225
|
+
for (let i = 0; i < format.length && numberIndex < number.length; i++) {
|
|
226
|
+
if (format[i] === '0') {
|
|
227
|
+
result += number[numberIndex];
|
|
228
|
+
numberIndex++;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
result += format[i];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Append any remaining digits that exceed the format length
|
|
235
|
+
if (numberIndex < number.length) {
|
|
236
|
+
result += number.slice(numberIndex);
|
|
237
|
+
}
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
208
240
|
/** @ignore */
|
|
209
241
|
_handleCountryValueChanged(event) {
|
|
210
242
|
// Prevent value change if component is disabled or readonly
|
|
211
243
|
if (this.disabled || this.readonly) {
|
|
212
244
|
return;
|
|
213
245
|
}
|
|
214
|
-
|
|
246
|
+
//remove validation rule before add new one
|
|
247
|
+
if (event.isUserInteraction) {
|
|
248
|
+
this.textbox.removeValidationRule({
|
|
249
|
+
rule: 'regex',
|
|
250
|
+
disabled: false,
|
|
251
|
+
options: {
|
|
252
|
+
pattern: this.selectedCountry()?.regex,
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
this.textbox.reset();
|
|
256
|
+
this.textbox.resetErrors();
|
|
257
|
+
this.selectedCountry.set(event.component.selectedItems[0]);
|
|
258
|
+
}
|
|
215
259
|
}
|
|
216
260
|
get __hostName() {
|
|
217
261
|
return this.name;
|
|
@@ -227,7 +271,7 @@ class AXPhoneBoxComponent extends classes((MXInputBaseValueComponent), MXLookCom
|
|
|
227
271
|
useExisting: forwardRef(() => AXPhoneBoxComponent),
|
|
228
272
|
multi: true,
|
|
229
273
|
},
|
|
230
|
-
], viewQueries: [{ propertyName: "selectBox", first: true, predicate: ["s"], descendants: true, isSignal: true }, { propertyName: "textbox", first: true, predicate: AXTextBoxComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (
|
|
274
|
+
], viewQueries: [{ propertyName: "selectBox", first: true, predicate: ["s"], descendants: true, isSignal: true }, { propertyName: "textbox", first: true, predicate: AXTextBoxComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (onValueChanged)=\"_handleModelChange($event)\"\n (onBlur)=\"emitOnBlurEvent($event.nativeEvent)\"\n (onFocus)=\"emitOnFocusEvent($event.nativeEvent)\"\n (onKeyDown)=\"handleKeyDown($event.nativeEvent)\"\n (onKeyPress)=\"emitOnKeypressEvent($event.nativeEvent)\"\n (onKeyUp)=\"emitOnKeyupEvent($event.nativeEvent)\"\n>\n <ng-content select=\"ax-validation-rule\"> </ng-content>\n\n @if (selectedCountry()?.regex && messageError) {\n <ax-validation-rule\n rule=\"regex\"\n [options]=\"{\n message: messageError,\n pattern: selectedCountry()?.regex,\n }\"\n >\n </ax-validation-rule>\n }\n\n <ax-prefix>\n @if (precode()) {\n <ax-text>{{ precode() }}</ax-text>\n } @else {\n <ax-select-box\n #s\n look=\"blank\"\n [disabled]=\"disabled || readonly\"\n [readonly]=\"readonly\"\n [dropdownWidth]=\"'320px'\"\n [dataSource]=\"dataSource\"\n [ngModel]=\"selectedCountry()\"\n [textField]=\"'iso2code'\"\n [multiple]=\"false\"\n [valueField]=\"'code'\"\n [itemTemplate]=\"customItemTemplate\"\n [selectedTemplate]=\"selectedTemplate\"\n (onValueChanged)=\"_handleCountryValueChanged($event)\"\n (onClosed)=\"handleCountryOnClosed()\"\n [tabIndex]=\"included().length === 1 ? '-1' : '1'\"\n >\n <ax-search-box class=\"ax-sm\" look=\"fill\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n <ng-template #customItemTemplate let-item>\n <div class=\"ax-country-item\">\n <div\n class=\"ax-country-flag\"\n [ngStyle]=\"{\n 'background-position': item.data.bkPosition?.x + ' ' + item.data.bkPosition?.y,\n 'background-image': 'url(' + flags() + ')',\n }\"\n ></div>\n <div>\n <span class=\"ax-country-name\">{{ item.data.name }}</span>\n <span class=\"ax-iso2code\">{{ item.data.iso2code }}</span>\n </div>\n </div>\n </ng-template>\n <ng-template #selectedTemplate let-item>\n <div class=\"ax-selected-country\">\n <span>{{ item.data.iso2code }}</span>\n </div>\n </ng-template>\n <ng-template #loading></ng-template>\n </ax-select-box>\n }\n </ax-prefix>\n</ax-text-box>\n\n<ng-content select=\"ax-clear-button \"></ng-content>\n<div class=\"ax-error-container\"></div>\n", styles: ["@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial}}}@layer components{ax-phone-box ax-select-box ax-dropdown-box .ax-content{padding-top:calc(var(--spacing,.25rem)*0)!important}.ax-country-item{cursor:pointer;align-items:center;gap:calc(var(--spacing,.25rem)*2);padding-inline:calc(var(--spacing,.25rem)*2);padding-block:calc(var(--spacing,.25rem)*3);display:flex}.ax-country-item:hover{background-color:var(--color-surface,rgba(var(--ax-sys-color-surface)))}.ax-country-item .ax-country-name{--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);margin-inline-end:calc(var(--spacing,.25rem)*2)}.ax-country-item .ax-iso2code{opacity:.7}.ax-country-flag{background-repeat:no-repeat;height:calc(var(--spacing,.25rem)*5)!important;width:calc(var(--spacing,.25rem)*6)!important}.ax-selected-country{align-items:center;gap:calc(var(--spacing,.25rem)*2);padding-inline-end:calc(var(--spacing,.25rem)*2);display:flex}}@property --tw-font-weight{syntax:\"*\";inherits:false}\n/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n"], dependencies: [{ kind: "component", type: AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "mask-options", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "component", type: AXSelectBoxComponent, selector: "ax-select-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "minValue", "maxValue", "value", "state", "name", "id", "type", "look", "multiple", "valueField", "textField", "disabledField", "textTemplate", "selectedItems", "isItemTruncated", "showItemTooltip", "itemHeight", "maxVisibleItems", "dataSource", "minRecordsForSearch", "caption", "itemTemplate", "selectedTemplate", "emptyTemplate", "loadingTemplate", "dropdownWidth", "searchBoxAutoFocus"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onOpened", "onClosed", "onItemSelected", "onItemClick"] }, { kind: "component", type: AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type", "autoSearch"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "component", type: AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: AXFormModule }, { kind: "directive", type: i2.AXValidationRuleDirective, selector: "ax-validation-rule", inputs: ["rule", "options", "message", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
231
275
|
}
|
|
232
276
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPhoneBoxComponent, decorators: [{
|
|
233
277
|
type: Component,
|
|
@@ -277,7 +321,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
277
321
|
AXDecoratorClearButtonComponent,
|
|
278
322
|
NgStyle,
|
|
279
323
|
AXFormModule,
|
|
280
|
-
], template: "<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (
|
|
324
|
+
], template: "<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (onValueChanged)=\"_handleModelChange($event)\"\n (onBlur)=\"emitOnBlurEvent($event.nativeEvent)\"\n (onFocus)=\"emitOnFocusEvent($event.nativeEvent)\"\n (onKeyDown)=\"handleKeyDown($event.nativeEvent)\"\n (onKeyPress)=\"emitOnKeypressEvent($event.nativeEvent)\"\n (onKeyUp)=\"emitOnKeyupEvent($event.nativeEvent)\"\n>\n <ng-content select=\"ax-validation-rule\"> </ng-content>\n\n @if (selectedCountry()?.regex && messageError) {\n <ax-validation-rule\n rule=\"regex\"\n [options]=\"{\n message: messageError,\n pattern: selectedCountry()?.regex,\n }\"\n >\n </ax-validation-rule>\n }\n\n <ax-prefix>\n @if (precode()) {\n <ax-text>{{ precode() }}</ax-text>\n } @else {\n <ax-select-box\n #s\n look=\"blank\"\n [disabled]=\"disabled || readonly\"\n [readonly]=\"readonly\"\n [dropdownWidth]=\"'320px'\"\n [dataSource]=\"dataSource\"\n [ngModel]=\"selectedCountry()\"\n [textField]=\"'iso2code'\"\n [multiple]=\"false\"\n [valueField]=\"'code'\"\n [itemTemplate]=\"customItemTemplate\"\n [selectedTemplate]=\"selectedTemplate\"\n (onValueChanged)=\"_handleCountryValueChanged($event)\"\n (onClosed)=\"handleCountryOnClosed()\"\n [tabIndex]=\"included().length === 1 ? '-1' : '1'\"\n >\n <ax-search-box class=\"ax-sm\" look=\"fill\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n <ng-template #customItemTemplate let-item>\n <div class=\"ax-country-item\">\n <div\n class=\"ax-country-flag\"\n [ngStyle]=\"{\n 'background-position': item.data.bkPosition?.x + ' ' + item.data.bkPosition?.y,\n 'background-image': 'url(' + flags() + ')',\n }\"\n ></div>\n <div>\n <span class=\"ax-country-name\">{{ item.data.name }}</span>\n <span class=\"ax-iso2code\">{{ item.data.iso2code }}</span>\n </div>\n </div>\n </ng-template>\n <ng-template #selectedTemplate let-item>\n <div class=\"ax-selected-country\">\n <span>{{ item.data.iso2code }}</span>\n </div>\n </ng-template>\n <ng-template #loading></ng-template>\n </ax-select-box>\n }\n </ax-prefix>\n</ax-text-box>\n\n<ng-content select=\"ax-clear-button \"></ng-content>\n<div class=\"ax-error-container\"></div>\n", styles: ["@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial}}}@layer components{ax-phone-box ax-select-box ax-dropdown-box .ax-content{padding-top:calc(var(--spacing,.25rem)*0)!important}.ax-country-item{cursor:pointer;align-items:center;gap:calc(var(--spacing,.25rem)*2);padding-inline:calc(var(--spacing,.25rem)*2);padding-block:calc(var(--spacing,.25rem)*3);display:flex}.ax-country-item:hover{background-color:var(--color-surface,rgba(var(--ax-sys-color-surface)))}.ax-country-item .ax-country-name{--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);margin-inline-end:calc(var(--spacing,.25rem)*2)}.ax-country-item .ax-iso2code{opacity:.7}.ax-country-flag{background-repeat:no-repeat;height:calc(var(--spacing,.25rem)*5)!important;width:calc(var(--spacing,.25rem)*6)!important}.ax-selected-country{align-items:center;gap:calc(var(--spacing,.25rem)*2);padding-inline-end:calc(var(--spacing,.25rem)*2);display:flex}}@property --tw-font-weight{syntax:\"*\";inherits:false}\n/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */\n"] }]
|
|
281
325
|
}], propDecorators: { textbox: [{
|
|
282
326
|
type: ViewChild,
|
|
283
327
|
args: [AXTextBoxComponent, { static: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-phone-box.mjs","sources":["../../../../packages/components/phone-box/src/lib/phone-box.component.ts","../../../../packages/components/phone-box/src/lib/phone-box.component.html","../../../../packages/components/phone-box/src/lib/phone-box.module.ts","../../../../packages/components/phone-box/src/acorex-components-phone-box.ts"],"sourcesContent":["import {\n AXClearableComponent,\n AXComponent,\n AXDataSource,\n AXFocusableComponent,\n AXValuableComponent,\n AXValueChangedEvent,\n MXInputBaseValueComponent,\n MXLookComponent,\n} from '@acorex/cdk/common';\nimport { AXDecoratorClearButtonComponent, AXDecoratorGenericComponent } from '@acorex/components/decorators';\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXSearchBoxComponent } from '@acorex/components/search-box';\nimport { AXSelectBoxComponent } from '@acorex/components/select-box';\nimport { AXTextBoxComponent } from '@acorex/components/text-box';\nimport { COUNTRIES, COUNTRIES_FLAG_BASE64, CountryItem } from '@acorex/core/constants';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { NgStyle } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n Input,\n ViewChild,\n ViewEncapsulation,\n afterNextRender,\n effect,\n forwardRef,\n inject,\n input,\n model,\n signal,\n viewChild,\n} from '@angular/core';\nimport { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { filter } from 'lodash-es';\nimport { classes } from 'polytype';\n\n/**\n * @category\n * A component that handles phone number input with various configurations.\n */\n@Component({\n selector: 'ax-phone-box',\n templateUrl: './phone-box.component.html',\n styleUrls: ['./phone-box.component.compiled.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: [\n 'disabled',\n 'tabIndex',\n 'readonly',\n 'value',\n 'state',\n 'name',\n 'id',\n 'placeholder',\n 'maxLength',\n 'allowNull',\n 'type',\n 'autoComplete',\n 'look',\n ],\n outputs: [\n 'onBlur',\n 'onFocus',\n 'valueChange',\n 'stateChange',\n 'onValueChanged',\n 'readonlyChange',\n 'disabledChange',\n 'onKeyDown',\n 'onKeyUp',\n 'onKeyPress',\n ],\n providers: [\n { provide: AXComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXFocusableComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXClearableComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXValuableComponent, useExisting: AXPhoneBoxComponent },\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AXPhoneBoxComponent),\n multi: true,\n },\n ],\n host: {\n ngSkipHydration: 'true',\n },\n imports: [\n AXTextBoxComponent,\n FormsModule,\n AXDecoratorGenericComponent,\n AXSelectBoxComponent,\n AXSearchBoxComponent,\n AXDecoratorClearButtonComponent,\n NgStyle,\n AXFormModule,\n ],\n})\nexport class AXPhoneBoxComponent extends classes(MXInputBaseValueComponent<string>, MXLookComponent) {\n /** @ignore */\n protected _updateOn: 'change' | 'blur' | 'submit' = 'change';\n\n /** @ignore */\n @ViewChild(AXTextBoxComponent, { static: true })\n private textbox: AXTextBoxComponent;\n\n protected flags = signal(COUNTRIES_FLAG_BASE64);\n\n private translationService: AXTranslationService = inject(AXTranslationService);\n\n protected messageError = this.callTranslate();\n\n async callTranslate() {\n return await this.translationService.translateAsync('@acorex:validation.messages.phone');\n }\n\n /**\n * CSS classes to apply to the component.\n */\n @Input('class')\n classNames: string;\n\n /**\n * static precode.\n */\n precode = input();\n\n /**\n * The default country value for the component.\n */\n country = model<string>('');\n\n /**\n * List of included values for the component.\n */\n included = input<string[]>([]);\n\n /**\n * List of excluded values for the component.\n */\n excluded = input<string[]>([]);\n\n private selectBox = viewChild<AXSelectBoxComponent>('s');\n\n #countriesChanged = effect(() => {\n this.included();\n this.excluded();\n this.setCountries();\n this.cdr.detectChanges();\n this.selectBox().refresh();\n });\n\n #eff = effect(() => {\n if (this.country()) {\n this.selectedCountry.set(this.countries().find((c) => c.code === this.country()));\n } else {\n this.selectedCountry.set(this.countries()[0]);\n }\n });\n\n /** @ignore */\n protected countries = signal<CountryItem[]>([]);\n\n /** @ignore */\n protected selectedCountry = signal<CountryItem>(null);\n\n /** @ignore */\n protected _handleModelChange(value: string | null) {\n // Prevent value change if component is disabled or readonly\n if (this.disabled || this.readonly) {\n return;\n }\n\n this.commitValue(value, true);\n }\n\n /** @ignore */\n protected dataSource = new AXDataSource<CountryItem>({\n pageSize: 10,\n load: (e) => {\n return new Promise((resolve) => {\n const list = this.countries();\n const result = e.filter\n ? filter(\n list,\n (c) =>\n c.name.toUpperCase().includes((e.filter.value as string).toUpperCase()) ||\n c.iso2code.toUpperCase().includes((e.filter.value as string).toUpperCase()) ||\n c.code.toUpperCase().includes((e.filter.value as string).toUpperCase()),\n )\n : list;\n resolve({\n items: result.slice(e.skip, e.skip + e.take),\n total: result.length,\n });\n });\n },\n });\n\n /** @ignore */\n protected handleCountryOnClosed() {\n setTimeout(() => {\n this.textbox?.focus();\n }, 300);\n }\n\n /** @ignore */\n #init = afterNextRender(() => {\n this.setCountries();\n });\n\n protected override internalValueChanged(value: any): void {\n if (!value) return;\n const result = this.parsePhoneNumber(value);\n if (result.country) {\n this.selectedCountry.set(result.country);\n this.commitValue(result.nationalNumber);\n }\n }\n\n /**\n * Determines if the keyboard event is a valid action based on allowed keys and key codes.\n *\n * @param event - The keyboard event to validate\n * @returns boolean - True if the key action is valid, false otherwise\n */\n isValidKeyboardAction = (event: KeyboardEvent) => {\n const _code = parseInt(event.key);\n\n const ALLOWED_KEY = ['Backspace', 'ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', 'Tab'];\n\n const IS_CTRL_A = () => (event.ctrlKey && event.key === 'a') || (event.ctrlKey && event.key === 'A');\n // eslint-disable-next-line no-constant-condition\n if ((_code >= 0 && _code <= 9) || ALLOWED_KEY.includes(event.key) || IS_CTRL_A()) {\n return true;\n } else {\n return false;\n }\n };\n\n /**\n * Updates the list of countries based on included or excluded codes.\n *\n * @returns void - No return value. Updates the internal countries list.\n */\n setCountries() {\n if (this.included().length) {\n this.countries.set(COUNTRIES.filter((c) => this.included().includes(c.code)));\n } else if (this.excluded().length) {\n this.countries.set(COUNTRIES.filter((c) => !this.excluded().includes(c.code)));\n } else {\n this.countries.set(COUNTRIES);\n }\n this.flags.set(COUNTRIES_FLAG_BASE64);\n }\n\n protected handleKeyDown(e: KeyboardEvent) {\n // Prevent all keyboard actions if component is disabled\n if (this.disabled) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n\n // In readonly state, only allow copy operations (Ctrl+C, Ctrl+A)\n if (this.readonly) {\n const isCopyOperation =\n (e.ctrlKey && (e.key === 'c' || e.key === 'C')) || (e.ctrlKey && (e.key === 'a' || e.key === 'A'));\n\n if (!isCopyOperation) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n }\n\n if (this.isValidKeyboardAction(e)) {\n this.emitOnKeydownEvent(e);\n } else {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n }\n\n private parsePhoneNumber(fullNumber: string): {\n country: CountryItem | null;\n countryCode: string | null;\n nationalNumber: string;\n } {\n // 1) Normalize input\n let normalized = fullNumber.replace(/[^0-9+]/g, '');\n\n // convert 00... → +...\n if (normalized.startsWith('00')) {\n normalized = '+' + normalized.slice(2);\n }\n\n // 2) Sort countries by longest prefix first\n const sorted = [...COUNTRIES].sort((a, b) => b.iso2code.length - a.iso2code.length);\n\n // 3) Match the country code\n for (const country of sorted) {\n if (normalized.startsWith(country.iso2code)) {\n const countryCode = country.iso2code;\n const nationalNumber = normalized.slice(countryCode.length);\n\n return {\n country,\n countryCode,\n nationalNumber,\n };\n }\n }\n\n // 4) No match found\n return {\n country: null,\n countryCode: null,\n nationalNumber: normalized,\n };\n }\n\n /** @ignore */\n _handleCountryValueChanged(event: AXValueChangedEvent) {\n // Prevent value change if component is disabled or readonly\n if (this.disabled || this.readonly) {\n return;\n }\n this.selectedCountry.set(event.component.selectedItems[0]);\n }\n\n @HostBinding('attr.name')\n private get __hostName(): string {\n return this.name;\n }\n}","<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (ngModelChange)=\"_handleModelChange($event)\"\n (onBlur)=\"emitOnBlurEvent($event.nativeEvent)\"\n (onFocus)=\"emitOnFocusEvent($event.nativeEvent)\"\n (onKeyDown)=\"handleKeyDown($event.nativeEvent)\"\n (onKeyPress)=\"emitOnKeypressEvent($event.nativeEvent)\"\n (onKeyUp)=\"emitOnKeyupEvent($event.nativeEvent)\"\n>\n <ng-content select=\"ax-validation-rule\"> </ng-content>\n @for (regex of [selectedCountry()?.regex]; track regex) {\n @if (regex && messageError) {\n <ax-validation-rule\n rule=\"regex\"\n [options]=\"{\n message: messageError,\n pattern: regex,\n }\"\n >\n </ax-validation-rule>\n }\n }\n\n <ax-prefix>\n @if (precode()) {\n <ax-text>{{ precode() }}</ax-text>\n } @else {\n <ax-select-box\n #s\n look=\"blank\"\n [disabled]=\"disabled || readonly\"\n [readonly]=\"readonly\"\n [dropdownWidth]=\"'320px'\"\n [dataSource]=\"dataSource\"\n [ngModel]=\"selectedCountry()\"\n [textField]=\"'iso2code'\"\n [multiple]=\"false\"\n [valueField]=\"'code'\"\n [itemTemplate]=\"customItemTemplate\"\n [selectedTemplate]=\"selectedTemplate\"\n (onValueChanged)=\"_handleCountryValueChanged($event)\"\n (onClosed)=\"handleCountryOnClosed()\"\n [tabIndex]=\"included().length === 1 ? '-1' : '1'\"\n >\n <ax-search-box class=\"ax-sm\" look=\"fill\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n <ng-template #customItemTemplate let-item>\n <div class=\"ax-country-item\">\n <div\n class=\"ax-country-flag\"\n [ngStyle]=\"{\n 'background-position': item.data.bkPosition?.x + ' ' + item.data.bkPosition?.y,\n 'background-image': 'url(' + flags() + ')',\n }\"\n ></div>\n <div>\n <span class=\"ax-country-name\">{{ item.data.name }}</span>\n <span class=\"ax-iso2code\">{{ item.data.iso2code }}</span>\n </div>\n </div>\n </ng-template>\n <ng-template #selectedTemplate let-item>\n <div class=\"ax-selected-country\">\n <span>{{ item.data.iso2code }}</span>\n </div>\n </ng-template>\n <ng-template #loading></ng-template>\n </ax-select-box>\n }\n </ax-prefix>\n</ax-text-box>\n\n<ng-content select=\"ax-clear-button \"></ng-content>\n<div class=\"ax-error-container\"></div>\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXSearchBoxModule } from '@acorex/components/search-box';\nimport { AXSelectBoxModule } from '@acorex/components/select-box';\nimport { AXTextBoxModule } from '@acorex/components/text-box';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IMaskModule } from 'angular-imask';\nimport { AXPhoneBoxComponent } from './phone-box.component';\n\nconst COMPONENT = [AXPhoneBoxComponent];\nconst MODULES = [\n CommonModule,\n FormsModule,\n IMaskModule,\n AXSelectBoxModule,\n AXSearchBoxModule,\n AXDecoratorModule,\n AXButtonModule,\n AXTextBoxModule,\n];\n\n@NgModule({\n imports: [...MODULES, ...COMPONENT],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXPhoneBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA;;;AAGG;AA2DG,MAAO,mBAAoB,SAAQ,OAAO,EAAC,yBAAiC,GAAE,eAAe,CAAC,CAAA;AA1DpG,IAAA,WAAA,GAAA;;;QA4DY,IAAA,CAAA,SAAS,GAAiC,QAAQ;AAMlD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,qBAAqB,iDAAC;AAEvC,QAAA,IAAA,CAAA,kBAAkB,GAAyB,MAAM,CAAC,oBAAoB,CAAC;AAErE,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE;AAY7C;;AAEG;QACH,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EA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AC,OAAO;meAuBsC,GAAG,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,UAAA,EAAA,CAAA;sBA6LtD,WAAW;uBAAC,WAAW;;;AElU1B,MAAM,SAAS,GAAG,CAAC,mBAAmB,CAAC;AACvC,MAAM,OAAO,GAAG;IACd,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,eAAe;CAChB;MAOY,gBAAgB,CAAA;+GAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAf3B,YAAY;YACZ,WAAW;YACX,WAAW;YACX,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB;YACjB,cAAc;YACd,eAAe,EATE,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAAnB,mBAAmB,CAAA,EAAA,CAAA,CAAA;gHAiBzB,gBAAgB,EAAA,OAAA,EAAA,CAJd,OAAO,EAAK,SAAS,CAAA,EAAA,CAAA,CAAA;;4FAIvB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,SAAS,CAAC;AACnC,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;AC3BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-components-phone-box.mjs","sources":["../../../../packages/components/phone-box/src/lib/phone-box.component.ts","../../../../packages/components/phone-box/src/lib/phone-box.component.html","../../../../packages/components/phone-box/src/lib/phone-box.module.ts","../../../../packages/components/phone-box/src/acorex-components-phone-box.ts"],"sourcesContent":["import {\n AXClearableComponent,\n AXComponent,\n AXDataSource,\n AXFocusableComponent,\n AXValuableComponent,\n AXValueChangedEvent,\n MXInputBaseValueComponent,\n MXLookComponent,\n} from '@acorex/cdk/common';\nimport { AXDecoratorClearButtonComponent, AXDecoratorGenericComponent } from '@acorex/components/decorators';\nimport { AXFormModule } from '@acorex/components/form';\nimport { AXSearchBoxComponent } from '@acorex/components/search-box';\nimport { AXSelectBoxComponent } from '@acorex/components/select-box';\nimport { AXTextBoxComponent } from '@acorex/components/text-box';\nimport { COUNTRIES, COUNTRIES_FLAG_BASE64, CountryItem } from '@acorex/core/constants';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { NgStyle } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n Input,\n ViewChild,\n ViewEncapsulation,\n afterNextRender,\n effect,\n forwardRef,\n inject,\n input,\n model,\n signal,\n viewChild,\n} from '@angular/core';\nimport { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { filter } from 'lodash-es';\nimport { classes } from 'polytype';\n\n/**\n * @category\n * A component that handles phone number input with various configurations.\n */\n@Component({\n selector: 'ax-phone-box',\n templateUrl: './phone-box.component.html',\n styleUrls: ['./phone-box.component.compiled.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n inputs: [\n 'disabled',\n 'tabIndex',\n 'readonly',\n 'value',\n 'state',\n 'name',\n 'id',\n 'placeholder',\n 'maxLength',\n 'allowNull',\n 'type',\n 'autoComplete',\n 'look',\n ],\n outputs: [\n 'onBlur',\n 'onFocus',\n 'valueChange',\n 'stateChange',\n 'onValueChanged',\n 'readonlyChange',\n 'disabledChange',\n 'onKeyDown',\n 'onKeyUp',\n 'onKeyPress',\n ],\n providers: [\n { provide: AXComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXFocusableComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXClearableComponent, useExisting: AXPhoneBoxComponent },\n { provide: AXValuableComponent, useExisting: AXPhoneBoxComponent },\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AXPhoneBoxComponent),\n multi: true,\n },\n ],\n host: {\n ngSkipHydration: 'true',\n },\n imports: [\n AXTextBoxComponent,\n FormsModule,\n AXDecoratorGenericComponent,\n AXSelectBoxComponent,\n AXSearchBoxComponent,\n AXDecoratorClearButtonComponent,\n NgStyle,\n AXFormModule,\n ],\n})\nexport class AXPhoneBoxComponent extends classes(MXInputBaseValueComponent<string>, MXLookComponent) {\n /** @ignore */\n protected _updateOn: 'change' | 'blur' | 'submit' = 'change';\n\n /** @ignore */\n @ViewChild(AXTextBoxComponent, { static: true })\n private textbox: AXTextBoxComponent;\n\n protected flags = signal(COUNTRIES_FLAG_BASE64);\n\n private translationService: AXTranslationService = inject(AXTranslationService);\n\n protected messageError = this.callTranslate();\n\n async callTranslate() {\n return await this.translationService.translateAsync('@acorex:validation.messages.phone');\n }\n\n /**\n * CSS classes to apply to the component.\n */\n @Input('class')\n classNames: string;\n\n /**\n * static precode.\n */\n precode = input();\n\n /**\n * The default country value for the component.\n */\n country = model<string>('');\n\n /**\n * List of included values for the component.\n */\n included = input<string[]>([]);\n\n /**\n * List of excluded values for the component.\n */\n excluded = input<string[]>([]);\n\n private selectBox = viewChild<AXSelectBoxComponent>('s');\n\n /** @ignore */\n protected countries = signal<CountryItem[]>([]);\n\n /** @ignore */\n protected selectedCountry = signal<CountryItem>(null);\n\n #countriesChanged = effect(() => {\n this.included();\n this.excluded();\n this.setCountries();\n this.cdr.detectChanges();\n this.selectBox().refresh();\n });\n\n #eff = afterNextRender(() => {\n setTimeout(() => {\n if (this.country() && !this.value) {\n this.selectedCountry.set(this.countries().find((c) => c.code === this.country()));\n } else if (!this.country() && !this.value) {\n this.selectedCountry.set(this.countries()[0]);\n }\n });\n });\n\n /** @ignore */\n protected _handleModelChange(e: AXValueChangedEvent<any>) {\n // Prevent value change if component is disabled or readonly\n if (this.disabled || this.readonly) {\n return;\n }\n this.commitValue(e.value, true);\n }\n\n protected override internalValueChanged(value: any): void {\n if (!value) return;\n const result = this.parsePhoneNumber(value);\n if (result.country) {\n this.selectedCountry.set(result.country);\n this.commitValue(result.nationalNumber);\n }\n }\n\n /** @ignore */\n protected dataSource = new AXDataSource<CountryItem>({\n pageSize: 10,\n load: (e) => {\n return new Promise((resolve) => {\n const list = this.countries();\n const result = e.filter\n ? filter(\n list,\n (c) =>\n c.name.toUpperCase().includes((e.filter.value as string).toUpperCase()) ||\n c.iso2code.toUpperCase().includes((e.filter.value as string).toUpperCase()) ||\n c.code.toUpperCase().includes((e.filter.value as string).toUpperCase()),\n )\n : list;\n resolve({\n items: result.slice(e.skip, e.skip + e.take),\n total: result.length,\n });\n });\n },\n });\n\n /** @ignore */\n protected handleCountryOnClosed() {\n setTimeout(() => {\n this.textbox?.focus();\n }, 300);\n }\n\n /** @ignore */\n #init = afterNextRender(() => {\n this.setCountries();\n });\n\n /**\n * Determines if the keyboard event is a valid action based on allowed keys and key codes.\n *\n * @param event - The keyboard event to validate\n * @returns boolean - True if the key action is valid, false otherwise\n */\n isValidKeyboardAction = (event: KeyboardEvent) => {\n const _code = parseInt(event.key);\n\n const ALLOWED_KEY = ['Backspace', 'ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', 'Tab'];\n\n const IS_CTRL_A = () => (event.ctrlKey && event.key === 'a') || (event.ctrlKey && event.key === 'A');\n // eslint-disable-next-line no-constant-condition\n if ((_code >= 0 && _code <= 9) || ALLOWED_KEY.includes(event.key) || IS_CTRL_A()) {\n return true;\n } else {\n return false;\n }\n };\n\n /**\n * Updates the list of countries based on included or excluded codes.\n *\n * @returns void - No return value. Updates the internal countries list.\n */\n setCountries() {\n if (this.included().length) {\n this.countries.set(COUNTRIES.filter((c) => this.included().includes(c.code)));\n } else if (this.excluded().length) {\n this.countries.set(COUNTRIES.filter((c) => !this.excluded().includes(c.code)));\n } else {\n this.countries.set(COUNTRIES);\n }\n this.flags.set(COUNTRIES_FLAG_BASE64);\n }\n\n protected handleKeyDown(e: KeyboardEvent) {\n // Prevent all keyboard actions if component is disabled\n if (this.disabled) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n\n // In readonly state, only allow copy operations (Ctrl+C, Ctrl+A)\n if (this.readonly) {\n const isCopyOperation =\n (e.ctrlKey && (e.key === 'c' || e.key === 'C')) || (e.ctrlKey && (e.key === 'a' || e.key === 'A'));\n\n if (!isCopyOperation) {\n e.preventDefault();\n e.stopImmediatePropagation();\n return;\n }\n }\n\n if (this.isValidKeyboardAction(e)) {\n this.emitOnKeydownEvent(e);\n } else {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n }\n\n private parsePhoneNumber(fullNumber: string): {\n country: CountryItem | null;\n countryCode: string | null;\n nationalNumber: string;\n } {\n // 1) Normalize input\n let normalized = fullNumber.replace(/[^0-9+]/g, '');\n\n // convert 00... → +...\n if (normalized.startsWith('00')) {\n normalized = '+' + normalized.slice(2);\n }\n\n // 2) Sort countries by longest prefix first\n const sorted = [...COUNTRIES].sort((a, b) => b.iso2code.length - a.iso2code.length);\n\n // 3) Match the country code\n for (const country of sorted) {\n if (normalized.startsWith(country.iso2code)) {\n const countryCode = country.iso2code;\n const rawNationalNumber = normalized.slice(countryCode.length);\n const nationalNumber = this.formatNationalNumber(rawNationalNumber, country.format);\n\n return {\n country,\n countryCode,\n nationalNumber,\n };\n }\n }\n\n // 4) No match found\n return {\n country: null,\n countryCode: null,\n nationalNumber: normalized,\n };\n }\n\n /**\n * Formats a national phone number according to the country's format pattern.\n * The format pattern uses '0' as digit placeholders and preserves other characters (like spaces).\n *\n * @param number - The raw national number (digits only)\n * @param format - The country's phone number format pattern (e.g., '000 000 0000')\n * @returns The formatted national number with spaces according to the format\n */\n private formatNationalNumber(number: string, format: string): string {\n if (!format || !number) {\n return number;\n }\n\n let result = '';\n let numberIndex = 0;\n\n for (let i = 0; i < format.length && numberIndex < number.length; i++) {\n if (format[i] === '0') {\n result += number[numberIndex];\n numberIndex++;\n } else {\n result += format[i];\n }\n }\n\n // Append any remaining digits that exceed the format length\n if (numberIndex < number.length) {\n result += number.slice(numberIndex);\n }\n\n return result;\n }\n\n /** @ignore */\n _handleCountryValueChanged(event: AXValueChangedEvent) {\n // Prevent value change if component is disabled or readonly\n if (this.disabled || this.readonly) {\n return;\n }\n\n //remove validation rule before add new one\n if (event.isUserInteraction) {\n this.textbox.removeValidationRule({\n rule: 'regex',\n disabled: false,\n options: {\n pattern: this.selectedCountry()?.regex,\n },\n });\n this.textbox.reset();\n this.textbox.resetErrors();\n this.selectedCountry.set(event.component.selectedItems[0]);\n }\n }\n\n @HostBinding('attr.name')\n private get __hostName(): string {\n return this.name;\n }\n}\n","<ax-text-box\n dir=\"ltr\"\n [look]=\"look\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [mask-options]=\"{ mask: selectedCountry()?.format }\"\n [placeholder]=\"selectedCountry()?.format\"\n [ngModel]=\"value\"\n (onValueChanged)=\"_handleModelChange($event)\"\n (onBlur)=\"emitOnBlurEvent($event.nativeEvent)\"\n (onFocus)=\"emitOnFocusEvent($event.nativeEvent)\"\n (onKeyDown)=\"handleKeyDown($event.nativeEvent)\"\n (onKeyPress)=\"emitOnKeypressEvent($event.nativeEvent)\"\n (onKeyUp)=\"emitOnKeyupEvent($event.nativeEvent)\"\n>\n <ng-content select=\"ax-validation-rule\"> </ng-content>\n\n @if (selectedCountry()?.regex && messageError) {\n <ax-validation-rule\n rule=\"regex\"\n [options]=\"{\n message: messageError,\n pattern: selectedCountry()?.regex,\n }\"\n >\n </ax-validation-rule>\n }\n\n <ax-prefix>\n @if (precode()) {\n <ax-text>{{ precode() }}</ax-text>\n } @else {\n <ax-select-box\n #s\n look=\"blank\"\n [disabled]=\"disabled || readonly\"\n [readonly]=\"readonly\"\n [dropdownWidth]=\"'320px'\"\n [dataSource]=\"dataSource\"\n [ngModel]=\"selectedCountry()\"\n [textField]=\"'iso2code'\"\n [multiple]=\"false\"\n [valueField]=\"'code'\"\n [itemTemplate]=\"customItemTemplate\"\n [selectedTemplate]=\"selectedTemplate\"\n (onValueChanged)=\"_handleCountryValueChanged($event)\"\n (onClosed)=\"handleCountryOnClosed()\"\n [tabIndex]=\"included().length === 1 ? '-1' : '1'\"\n >\n <ax-search-box class=\"ax-sm\" look=\"fill\">\n <ax-clear-button></ax-clear-button>\n </ax-search-box>\n <ng-template #customItemTemplate let-item>\n <div class=\"ax-country-item\">\n <div\n class=\"ax-country-flag\"\n [ngStyle]=\"{\n 'background-position': item.data.bkPosition?.x + ' ' + item.data.bkPosition?.y,\n 'background-image': 'url(' + flags() + ')',\n }\"\n ></div>\n <div>\n <span class=\"ax-country-name\">{{ item.data.name }}</span>\n <span class=\"ax-iso2code\">{{ item.data.iso2code }}</span>\n </div>\n </div>\n </ng-template>\n <ng-template #selectedTemplate let-item>\n <div class=\"ax-selected-country\">\n <span>{{ item.data.iso2code }}</span>\n </div>\n </ng-template>\n <ng-template #loading></ng-template>\n </ax-select-box>\n }\n </ax-prefix>\n</ax-text-box>\n\n<ng-content select=\"ax-clear-button \"></ng-content>\n<div class=\"ax-error-container\"></div>\n","import { AXButtonModule } from '@acorex/components/button';\nimport { AXDecoratorModule } from '@acorex/components/decorators';\nimport { AXSearchBoxModule } from '@acorex/components/search-box';\nimport { AXSelectBoxModule } from '@acorex/components/select-box';\nimport { AXTextBoxModule } from '@acorex/components/text-box';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { IMaskModule } from 'angular-imask';\nimport { AXPhoneBoxComponent } from './phone-box.component';\n\nconst COMPONENT = [AXPhoneBoxComponent];\nconst MODULES = [\n CommonModule,\n FormsModule,\n IMaskModule,\n AXSelectBoxModule,\n AXSearchBoxModule,\n AXDecoratorModule,\n AXButtonModule,\n AXTextBoxModule,\n];\n\n@NgModule({\n imports: [...MODULES, ...COMPONENT],\n exports: [...COMPONENT],\n providers: [],\n})\nexport class AXPhoneBoxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA;;;AAGG;AA2DG,MAAO,mBAAoB,SAAQ,OAAO,EAAC,yBAAiC,GAAE,eAAe,CAAC,CAAA;AA1DpG,IAAA,WAAA,GAAA;;;QA4DY,IAAA,CAAA,SAAS,GAAiC,QAAQ;AAMlD,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,qBAAqB,iDAAC;AAEvC,QAAA,IAAA,CAAA,kBAAkB,GAAyB,MAAM,CAAC,oBAAoB,CAAC;AAErE,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE;AAY7C;;AAEG;QACH,IAAA,CAAA,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAE;AAEjB;;AAEG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,EAAE,mDAAC;AAE3B;;AAEG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAW,EAAE,oDAAC;AAE9B;;AAEG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAW,EAAE,oDAAC;AAEtB,QAAA,IAAA,CAAA,SAAS,GAAG,SAAS,CAAuB,GAAG,qDAAC;;AAG9C,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAgB,EAAE,qDAAC;;AAGrC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAc,IAAI,2DAAC;AAErD,QAAA,IAAA,CAAA,iBAAiB,GAAG,MAAM,CAAC,MAAK;YAC9B,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,EAAE;YACf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UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YAf3B,YAAY;YACZ,WAAW;YACX,WAAW;YACX,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB;YACjB,cAAc;YACd,eAAe,EATE,mBAAmB,CAAA,EAAA,OAAA,EAAA,CAAnB,mBAAmB,CAAA,EAAA,CAAA,CAAA;gHAiBzB,gBAAgB,EAAA,OAAA,EAAA,CAJd,OAAO,EAAK,SAAS,CAAA,EAAA,CAAA,CAAA;;4FAIvB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,SAAS,CAAC;AACnC,oBAAA,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;AACvB,oBAAA,SAAS,EAAE,EAAE;AACd,iBAAA;;;AC3BD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/components",
|
|
3
|
-
"version": "21.0.1-next.
|
|
3
|
+
"version": "21.0.1-next.29",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@acorex/core": "21.0.1-next.
|
|
6
|
-
"@acorex/cdk": "21.0.1-next.
|
|
5
|
+
"@acorex/core": "21.0.1-next.29",
|
|
6
|
+
"@acorex/cdk": "21.0.1-next.29",
|
|
7
7
|
"@angular/common": "^20.0.0",
|
|
8
8
|
"@angular/core": "^20.0.0",
|
|
9
9
|
"@angular/cdk": "^20.0.0",
|
package/phone-box/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as polytype from 'polytype';
|
|
2
2
|
import * as _angular_core from '@angular/core';
|
|
3
|
-
import { MXInputBaseValueComponent, MXLookComponent,
|
|
3
|
+
import { MXInputBaseValueComponent, MXLookComponent, AXValueChangedEvent, AXDataSource } from '@acorex/cdk/common';
|
|
4
4
|
import { CountryItem } from '@acorex/core/constants';
|
|
5
5
|
import * as i1 from '@angular/common';
|
|
6
6
|
import * as i2 from '@angular/forms';
|
|
@@ -56,12 +56,12 @@ declare class AXPhoneBoxComponent extends AXPhoneBoxComponent_base {
|
|
|
56
56
|
/** @ignore */
|
|
57
57
|
protected selectedCountry: _angular_core.WritableSignal<CountryItem>;
|
|
58
58
|
/** @ignore */
|
|
59
|
-
protected _handleModelChange(
|
|
59
|
+
protected _handleModelChange(e: AXValueChangedEvent<any>): void;
|
|
60
|
+
protected internalValueChanged(value: any): void;
|
|
60
61
|
/** @ignore */
|
|
61
62
|
protected dataSource: AXDataSource<CountryItem>;
|
|
62
63
|
/** @ignore */
|
|
63
64
|
protected handleCountryOnClosed(): void;
|
|
64
|
-
protected internalValueChanged(value: any): void;
|
|
65
65
|
/**
|
|
66
66
|
* Determines if the keyboard event is a valid action based on allowed keys and key codes.
|
|
67
67
|
*
|
|
@@ -77,6 +77,15 @@ declare class AXPhoneBoxComponent extends AXPhoneBoxComponent_base {
|
|
|
77
77
|
setCountries(): void;
|
|
78
78
|
protected handleKeyDown(e: KeyboardEvent): void;
|
|
79
79
|
private parsePhoneNumber;
|
|
80
|
+
/**
|
|
81
|
+
* Formats a national phone number according to the country's format pattern.
|
|
82
|
+
* The format pattern uses '0' as digit placeholders and preserves other characters (like spaces).
|
|
83
|
+
*
|
|
84
|
+
* @param number - The raw national number (digits only)
|
|
85
|
+
* @param format - The country's phone number format pattern (e.g., '000 000 0000')
|
|
86
|
+
* @returns The formatted national number with spaces according to the format
|
|
87
|
+
*/
|
|
88
|
+
private formatNationalNumber;
|
|
80
89
|
/** @ignore */
|
|
81
90
|
_handleCountryValueChanged(event: AXValueChangedEvent): void;
|
|
82
91
|
private get __hostName();
|