@smart-webcomponents-angular/phoneinput 19.0.8 → 25.5.5
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/esm2020/phoneinput/smart.element.mjs +16 -3
- package/esm2020/phoneinput/smart.phoneinput.mjs +67 -32
- package/fesm2015/smart-webcomponents-angular-phoneinput.mjs +80 -33
- package/fesm2015/smart-webcomponents-angular-phoneinput.mjs.map +1 -1
- package/fesm2020/smart-webcomponents-angular-phoneinput.mjs +80 -33
- package/fesm2020/smart-webcomponents-angular-phoneinput.mjs.map +1 -1
- package/index.d.ts +6083 -5194
- package/package.json +20 -17
- package/phoneinput/smart.element.d.ts +6 -2
- package/phoneinput/smart.phoneinput.d.ts +36 -29
- package/source/modules/smart.input.js +2 -2
- package/source/modules/smart.phoneinput.js +2 -2
- package/source/smart.button.js +3 -3
- package/source/smart.countryinput.js +3 -3
- package/source/smart.element.js +3 -3
- package/source/smart.input.js +3 -3
- package/source/smart.phoneinput.js +3 -3
- package/source/smart.scrollbar.js +2 -2
- package/styles/font/smart-icons.eot +0 -0
- package/styles/font/smart-icons.svg +14 -0
- package/styles/font/smart-icons.ttf +0 -0
- package/styles/font/smart-icons.woff +0 -0
- package/styles/font/smart-icons.woff2 +0 -0
- package/styles/smart.base.css +2 -2
- package/styles/smart.common.css +1 -1
- package/styles/smart.phoneinput.css +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-webcomponents-angular/phoneinput",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.5.5",
|
|
4
4
|
"preferGlobal": true,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"angular 15 phoneinput",
|
|
11
11
|
"angular 16 phoneinput",
|
|
12
12
|
"angular 17 phoneinput",
|
|
13
|
+
"angular 18 phoneinput",
|
|
14
|
+
"angular 19 phoneinput",
|
|
15
|
+
"angular 20 phoneinput",
|
|
13
16
|
"phoneinput",
|
|
14
17
|
"angular phoneinput component",
|
|
15
18
|
"phoneinput for angular",
|
|
@@ -20,27 +23,27 @@
|
|
|
20
23
|
"angular material ui phoneinput component"
|
|
21
24
|
],
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"tslib": "^2.
|
|
26
|
+
"tslib": "^2.5.0"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"@angular/animations": "
|
|
27
|
-
"@angular/common": "
|
|
28
|
-
"@angular/compiler": "
|
|
29
|
-
"@angular/core": "
|
|
30
|
-
"@angular/forms": "
|
|
29
|
+
"@angular/animations": "16 - 19",
|
|
30
|
+
"@angular/common": "16 - 19",
|
|
31
|
+
"@angular/compiler": "16 - 19",
|
|
32
|
+
"@angular/core": "16 - 19",
|
|
33
|
+
"@angular/forms": "16 - 19",
|
|
31
34
|
"@angular/platform-browser": "12 - 16",
|
|
32
35
|
"core-js": "^2.6.9",
|
|
33
|
-
"rxjs": "^
|
|
36
|
+
"rxjs": "^7.8.1",
|
|
34
37
|
"systemjs": "0.19.43",
|
|
35
|
-
"zone.js": "~0.
|
|
36
|
-
"@angular-devkit/core": "
|
|
37
|
-
"@angular-devkit/schematics": "
|
|
38
|
-
"@angular/bazel": "
|
|
39
|
-
"@angular/compiler-cli": "
|
|
40
|
-
"@angular/platform-browser-dynamic": "
|
|
41
|
-
"@angular/platform-server": "
|
|
42
|
-
"@angular/router": "
|
|
43
|
-
"typescript": "~
|
|
38
|
+
"zone.js": "~0.15.0",
|
|
39
|
+
"@angular-devkit/core": "16 - 19",
|
|
40
|
+
"@angular-devkit/schematics": "16 - 19",
|
|
41
|
+
"@angular/bazel": "16 - 19",
|
|
42
|
+
"@angular/compiler-cli": "16 - 19",
|
|
43
|
+
"@angular/platform-browser-dynamic": "16 - 19",
|
|
44
|
+
"@angular/platform-server": "16 - 19",
|
|
45
|
+
"@angular/router": "16 - 19",
|
|
46
|
+
"typescript": "~5.5.0"
|
|
44
47
|
},
|
|
45
48
|
"author": "jQWidgets <support@jqwidgets.com> (https://www.htmlelements.com/)",
|
|
46
49
|
"license": "SEE LICENSE IN https://www.htmlelements.com/license/",
|
|
@@ -18,6 +18,9 @@ export declare class BaseElement {
|
|
|
18
18
|
blur(): void;
|
|
19
19
|
click(): void;
|
|
20
20
|
focus(options?: FocusOptions): void;
|
|
21
|
+
/** @description Sets or gets the license. */
|
|
22
|
+
get license(): string;
|
|
23
|
+
set license(value: string);
|
|
21
24
|
/** @description Sets or gets the language. Used in conjunction with the property messages. */
|
|
22
25
|
get locale(): string;
|
|
23
26
|
set locale(value: string);
|
|
@@ -34,6 +37,7 @@ export declare class BaseElement {
|
|
|
34
37
|
get theme(): string;
|
|
35
38
|
set theme(value: string);
|
|
36
39
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseElement, never>;
|
|
37
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseElement, never, never, { "locale": "locale"; "localizeFormatFunction": "localizeFormatFunction"; "messages": "messages"; "rightToLeft": "rightToLeft"; "theme": "theme"; }, { "onCreate": "onCreate"; "onReady": "onReady"; "onAttach": "onAttach"; "onDetach": "onDetach"; }, never>;
|
|
40
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseElement, never, never, { "license": "license"; "locale": "locale"; "localizeFormatFunction": "localizeFormatFunction"; "messages": "messages"; "rightToLeft": "rightToLeft"; "theme": "theme"; }, { "onCreate": "onCreate"; "onReady": "onReady"; "onAttach": "onAttach"; "onDetach": "onDetach"; }, never>;
|
|
38
41
|
}
|
|
39
|
-
|
|
42
|
+
declare let Smart: any;
|
|
43
|
+
export { Smart };
|
|
@@ -25,55 +25,58 @@ export declare class PhoneInputComponent extends BaseElement implements OnInit,
|
|
|
25
25
|
* The registered callback function called when a blur event occurs on the form elements.
|
|
26
26
|
*/
|
|
27
27
|
_onTouched: () => any;
|
|
28
|
-
/** @description
|
|
28
|
+
/** @description Determines whether the element is interactive or inactive. When enabled, the element can be interacted with by the user; when disabled, the element becomes unresponsive to user actions, often appearing visually distinct (e.g., grayed out). */
|
|
29
29
|
get disabled(): boolean;
|
|
30
30
|
set disabled(value: boolean);
|
|
31
|
-
/** @description
|
|
31
|
+
/** @description Specifies extra CSS class names to be applied to the Input dropdown element, allowing for customized styling and theming beyond the default classes. */
|
|
32
32
|
get dropDownClassList(): any;
|
|
33
33
|
set dropDownClassList(value: any);
|
|
34
|
-
/** @description
|
|
34
|
+
/** @description Specifies the placement of the dropdown button relative to its associated element, such as positioning it to the left, right, above, or below the target UI component. */
|
|
35
35
|
get dropDownButtonPosition(): DropDownButtonPosition | string;
|
|
36
36
|
set dropDownButtonPosition(value: DropDownButtonPosition | string);
|
|
37
|
-
/** @description
|
|
37
|
+
/** @description Specifies the height of the dropdown menu. By default, this property is set to an empty string, which means the dropdown's height will be determined by a corresponding CSS variable. If a specific value is provided, it will override the CSS variable and explicitly set the dropdown's height. */
|
|
38
38
|
get dropDownHeight(): string | number;
|
|
39
39
|
set dropDownHeight(value: string | number);
|
|
40
|
-
/** @description
|
|
40
|
+
/** @description Specifies the width of the dropdown menu. By default, this value is an empty string (""). When left empty, the dropdown's width is determined by a CSS variable, allowing the width to be managed through external stylesheets rather than being hardcoded. This provides flexibility for responsive design and consistent styling across your application. If a specific width is provided (e.g., "200px" or "50%"), it will override the CSS variable and explicitly set the dropdown's width. */
|
|
41
41
|
get dropDownWidth(): string | number;
|
|
42
42
|
set dropDownWidth(value: string | number);
|
|
43
|
-
/** @description
|
|
43
|
+
/** @description Defines or retrieves an object containing string values used throughout the widget’s user interface, allowing for easy localization of text. This property works together with the locale setting to display the widget’s content in different languages, based on the specified translations. Use this object to provide or customize all user-facing strings for multilingual support. */
|
|
44
44
|
get messages(): any;
|
|
45
45
|
set messages(value: any);
|
|
46
|
-
/** @description Sets or
|
|
46
|
+
/** @description Sets or retrieves the unlockKey property, which serves as a unique key required to unlock access to the product. When assigning a value, the unlockKey enables authorized usage; when retrieving, it provides the current key associated with the product’s access permissions. */
|
|
47
|
+
get unlockKey(): string;
|
|
48
|
+
set unlockKey(value: string);
|
|
49
|
+
/** @description Defines or retrieves the value of the name attribute for the element. The name attribute uniquely identifies the element within an HTML form, allowing its data to be included and referenced when the form is submitted to a server. This is essential for processing form data on the server side. */
|
|
47
50
|
get name(): string;
|
|
48
51
|
set name(value: string);
|
|
49
|
-
/** @description
|
|
52
|
+
/** @description Specifies whether the input should be in international or national format. In international mode, the input should begin with a '+' followed by the country code (e.g., +1 555-1234). In national mode, the input should omit the '+' and country code, using only the local number format. */
|
|
50
53
|
get nationalMode(): boolean;
|
|
51
54
|
set nationalMode(value: boolean);
|
|
52
|
-
/** @description
|
|
55
|
+
/** @description Specifies whether the dropdown menu is currently visible (open) or hidden (closed). */
|
|
53
56
|
get opened(): boolean;
|
|
54
57
|
set opened(value: boolean);
|
|
55
|
-
/** @description
|
|
58
|
+
/** @description Specifies or retrieves an array of country codes to customize the set of countries used, replacing the default list that includes all countries. Each country code must be a valid ISO 3166-1 alpha-2 code (see: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), which consists of two uppercase letters (e.g., 'US' for the United States, 'FR' for France). Use this property to limit available options to a specific set of countries as needed. */
|
|
56
59
|
get onlyCountries(): any;
|
|
57
60
|
set onlyCountries(value: any);
|
|
58
|
-
/** @description
|
|
61
|
+
/** @description Specifies the placeholder text that appears inside the input field before the user enters any value, providing a hint or example of the expected input format. */
|
|
59
62
|
get placeholder(): string;
|
|
60
63
|
set placeholder(value: string);
|
|
61
|
-
/** @description
|
|
64
|
+
/** @description Gets or sets the selected country for the element using a country code. The country code must conform to the ISO 3166-1 alpha-2 standard (see: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), which consists of a two-letter, uppercase code representing each country (e.g., "US" for United States, "FR" for France). */
|
|
62
65
|
get selectedCountry(): string;
|
|
63
66
|
set selectedCountry(value: string);
|
|
64
|
-
/** @description
|
|
67
|
+
/** @description Gets or sets a value that determines whether the element's alignment is configured for right-to-left (RTL) languages (such as Arabic or Hebrew), enabling proper display and layout of text and content for those locales. */
|
|
65
68
|
get rightToLeft(): boolean;
|
|
66
69
|
set rightToLeft(value: boolean);
|
|
67
|
-
/** @description
|
|
70
|
+
/** @description Specifies the visual theme to be applied to the element. The selected theme controls the element's overall appearance, including colors, fonts, spacing, and other stylistic properties, ensuring a consistent look and feel across the user interface. */
|
|
68
71
|
get theme(): string;
|
|
69
72
|
set theme(value: string);
|
|
70
|
-
/** @description
|
|
73
|
+
/** @description When set to true, this property prevents the element from receiving keyboard focus, making it inaccessible via tab navigation and standard focus events. */
|
|
71
74
|
get unfocusable(): boolean;
|
|
72
75
|
set unfocusable(value: boolean);
|
|
73
|
-
/** @description
|
|
76
|
+
/** @description Retrieves the current value of the element or assigns a new value to it. This property can be used to access the data contained within form elements (such as input, textarea, or select) or to update their content programmatically. */
|
|
74
77
|
get value(): string;
|
|
75
78
|
set value(value: string);
|
|
76
|
-
/** @description This event is triggered
|
|
79
|
+
/** @description This event is triggered whenever the user modifies the current selection, such as highlighting different text or choosing another item from a selectable list. It helps you detect and respond to any change in what is selected within the relevant user interface component.
|
|
77
80
|
* @param event. The custom event. Custom event was created with: event.detail( label, oldLabel, oldValue, value)
|
|
78
81
|
* label - The label of the new selected item.
|
|
79
82
|
* oldLabel - The label of the item that was previously selected before the event was triggered.
|
|
@@ -81,50 +84,54 @@ export declare class PhoneInputComponent extends BaseElement implements OnInit,
|
|
|
81
84
|
* value - The value of the new selected item.
|
|
82
85
|
*/
|
|
83
86
|
onChange: EventEmitter<CustomEvent>;
|
|
84
|
-
/** @description This event is triggered
|
|
87
|
+
/** @description This event is triggered each time a key is released (on key up) within the input field, but only if the input's value has changed as a result of the key press.
|
|
85
88
|
* @param event. The custom event. Custom event was created with: event.detail( oldValue, value)
|
|
86
89
|
* oldValue - The previous value before it was changed.
|
|
87
90
|
* value - The new value.
|
|
88
91
|
*/
|
|
89
92
|
onChanging: EventEmitter<CustomEvent>;
|
|
90
|
-
/** @description This event is triggered
|
|
93
|
+
/** @description This event is triggered whenever the user selects an item by clicking on it within the popup list. It allows you to respond to user interaction by executing specific actions or updating the interface based on the selected item.
|
|
91
94
|
* @param event. The custom event. Custom event was created with: event.detail( item, label, value)
|
|
92
95
|
* item - The item that was clicked.
|
|
93
96
|
* label - The label of the item that was clicked.
|
|
94
97
|
* value - The value of the item that was clicked.
|
|
95
98
|
*/
|
|
96
99
|
onItemClick: EventEmitter<CustomEvent>;
|
|
97
|
-
/** @description Closes the
|
|
100
|
+
/** @description Closes the dropdown menu, hiding its visible options from the user and collapsing the interface element.
|
|
98
101
|
*/
|
|
99
102
|
close(): void;
|
|
100
|
-
/** @description
|
|
103
|
+
/** @description Guarantees that the currently active (selected) item remains visible within the viewport by automatically scrolling the container as needed. This ensures users can always see and interact with their selection, even as the list or content changes.
|
|
101
104
|
*/
|
|
102
105
|
ensureVisible(): void;
|
|
103
|
-
/** @description Returns the
|
|
106
|
+
/** @description Returns the provided phone number as a formatted string, applying standard formatting conventions (such as adding parentheses, spaces, or dashes) based on the specified locale or default format. Ensures consistency and improves readability for display or storage purposes.
|
|
104
107
|
* @param {boolean} isInternational?. When you use 'false', the national phone number will be returned and the international phone number, when you use 'true' as parameter.
|
|
105
108
|
* @returns {string}
|
|
106
109
|
*/
|
|
107
110
|
getNumber(isInternational?: any): Promise<any>;
|
|
108
|
-
|
|
111
|
+
getNumberSync(isInternational?: any): string;
|
|
112
|
+
/** @description Retrieves an object representing a country based on its dial code. The returned object contains the following properties:- **label**: The local or English name of the country (e.g., "United States").- **value**: A unique identifier for the country (commonly the country name or abbreviation).- **iso2**: The two-letter ISO 3166-1 alpha-2 country code (e.g., "US").- **dialCode**: The international telephone dialing code associated with the country (e.g., "+1").
|
|
109
113
|
* @param {string} dialCode?. Returns the national or international phone number
|
|
110
114
|
* @returns {any}
|
|
111
115
|
*/
|
|
112
116
|
getItemByDialCode(dialCode?: any): Promise<any>;
|
|
113
|
-
|
|
117
|
+
getItemByDialCodeSync(dialCode?: any): any;
|
|
118
|
+
/** @description Returns the currently selected item as an object. This object contains the following properties: - `label`: A string representing the display name of the item (e.g., country name). - `value`: A string or identifier associated with the item (e.g., country code). - `iso2`: A two-letter ISO 3166-1 alpha-2 country code string (e.g., 'US' for United States). - `dialCode`: A string representing the country’s international dialing code (e.g., '+1').
|
|
114
119
|
* @returns {any}
|
|
115
120
|
*/
|
|
116
121
|
getSelectedItem(): Promise<any>;
|
|
117
|
-
|
|
122
|
+
getSelectedItemSync(): any;
|
|
123
|
+
/** @description Determines if the provided phone number meets the required format and validation rules, returning true for a valid phone number and false if the input is invalid.
|
|
118
124
|
* @returns {boolean}
|
|
119
125
|
*/
|
|
120
126
|
isValidNumber(): Promise<any>;
|
|
121
|
-
|
|
127
|
+
isValidNumberSync(): boolean;
|
|
128
|
+
/** @description Validates whether the entered phone number is in the correct format and meets specified criteria, such as required length, allowed characters, and country or area code compliance.
|
|
122
129
|
*/
|
|
123
130
|
validate(): void;
|
|
124
|
-
/** @description
|
|
131
|
+
/** @description Displays the drop-down menu, making its list of selectable options visible to the user.
|
|
125
132
|
*/
|
|
126
133
|
open(): void;
|
|
127
|
-
/** @description
|
|
134
|
+
/** @description Enhances the behavior of an input field by selecting its text content when it is editable. If the input field is marked as readonly, it will instead focus the element without selecting the text. This ensures that users can easily interact with editable inputs, while still providing focus to readonly fields for accessibility or further actions.
|
|
128
135
|
*/
|
|
129
136
|
select(): void;
|
|
130
137
|
get isRendered(): boolean;
|
|
@@ -143,5 +150,5 @@ export declare class PhoneInputComponent extends BaseElement implements OnInit,
|
|
|
143
150
|
/** @description Remove event listeners. */
|
|
144
151
|
private unlisten;
|
|
145
152
|
static ɵfac: i0.ɵɵFactoryDeclaration<PhoneInputComponent, never>;
|
|
146
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<PhoneInputComponent, "smart-phone-input, [smart-phone-input]", ["smart-phone-input"], { "disabled": "disabled"; "dropDownClassList": "dropDownClassList"; "dropDownButtonPosition": "dropDownButtonPosition"; "dropDownHeight": "dropDownHeight"; "dropDownWidth": "dropDownWidth"; "messages": "messages"; "name": "name"; "nationalMode": "nationalMode"; "opened": "opened"; "onlyCountries": "onlyCountries"; "placeholder": "placeholder"; "selectedCountry": "selectedCountry"; "rightToLeft": "rightToLeft"; "theme": "theme"; "unfocusable": "unfocusable"; "value": "value"; }, { "onChange": "onChange"; "onChanging": "onChanging"; "onItemClick": "onItemClick"; }, never>;
|
|
153
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PhoneInputComponent, "smart-phone-input, [smart-phone-input]", ["smart-phone-input"], { "disabled": "disabled"; "dropDownClassList": "dropDownClassList"; "dropDownButtonPosition": "dropDownButtonPosition"; "dropDownHeight": "dropDownHeight"; "dropDownWidth": "dropDownWidth"; "messages": "messages"; "unlockKey": "unlockKey"; "name": "name"; "nationalMode": "nationalMode"; "opened": "opened"; "onlyCountries": "onlyCountries"; "placeholder": "placeholder"; "selectedCountry": "selectedCountry"; "rightToLeft": "rightToLeft"; "theme": "theme"; "unfocusable": "unfocusable"; "value": "value"; }, { "onChange": "onChange"; "onChanging": "onChanging"; "onItemClick": "onItemClick"; }, never>;
|
|
147
154
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI
|
|
3
|
-
Copyright (c) 2011-
|
|
2
|
+
/* Smart UI v25.5.5 (2026-02-24)
|
|
3
|
+
Copyright (c) 2011-2026 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
6
|
import "../../common/i18n.phonenumbers.min.js"; //Addition library for repeating dates
|
package/source/smart.button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI
|
|
3
|
-
Copyright (c) 2011-
|
|
2
|
+
/* Smart UI v25.5.5 (2026-02-24)
|
|
3
|
+
Copyright (c) 2011-2024 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart("smart-button",class extends Smart.ContentElement{static get properties(){return{value:{type:"string"},name:{type:"string"},type:{value:"button",type:"string"},clickMode:{allowedValues:["hover","press","release","pressAndRelease"],type:"string",value:"release"}}}static get styleUrls(){return["smart.button.css"]}template(){return"<button class=\"smart-button smart-unselectable\" inner-h-t-m-l='[[innerHTML]]' id='button' type='[[type]]' name='[[name]]' value='[[value]]' disabled='[[disabled]]' role=\"presentation\"></button>"}refresh(){}static get listeners(){return{"button.down":"_downHandler","button.mouseenter":"_mouseEnterHandler","button.mouseleave":"_mouseLeaveHandler","button.touchend":"_touchEndHandler","button.click":"_clickHandler","button.up":"_upHandler",up:"_upHandler","button.focus":"_focusHandler","button.blur":"_blurHandler"}}focus(){const e=this;e.$.button?e.$.button.focus():HTMLElement.prototype.focus.call(e)}blur(){const e=this;e.$.button?e.$.button.blur():HTMLElement.prototype.blur.call(e)}_upHandler(e){const t=this;if(e.stopPropagation(),t.$.setAttributeValue("active",!1),t.dataset.target){const n=document.querySelector(t.dataset.target);let a=t.dataset.toggle;const r="smart-window".toLowerCase();if(n&&n.nodeName.toLowerCase()===r&&"modal"===a&&(a="openModal"),"tab"===a||"pill"===a||"list"===a){const e=this.closest(".nav, .list-group"),a='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',r=!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?e.children(".active"):e.querySelectorAll("li > .active");if(e){const n=e.querySelectorAll(a);for(let e=0;e<n.length;e++)n[e].classList.remove("primary");for(let e=0;e<r.length;e++)r[e].classList.remove("active");let i=t.parentNode;for(;i;){if("LI"===i.nodeName){i.classList.add("active");break}i=i.parentNode}t.classList.add("primary")}return n.parentNode.querySelectorAll(".active").forEach((e=>{e.classList.remove("active"),e.classList.add("smart-hidden")})),n.classList.add("active"),void n.classList.remove("smart-hidden")}a&&n&&!n[a]&&"collapse"===a&&(setTimeout((()=>{n.classList.contains("smart-hidden")?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden")})),e.originalEvent.preventDefault()),a&&n&&!n[a]&&"dropdown"===a?(setTimeout((()=>{n.opened=!n.opened})),e.originalEvent.preventDefault()):a&&n&&n[a]&&(setTimeout((()=>{n[a]()}),50),e.originalEvent.preventDefault())}}_focusHandler(){this.$.setAttributeValue("focus",!0),this.$.fireEvent("focus")}_blurHandler(){this.$.setAttributeValue("focus",!1),this.$.fireEvent("blur")}_clickHandler(e){const t=this;("release"!==t.clickMode&&"pressAndRelease"!==t.clickMode||t.readonly)&&(e.preventDefault(),e.stopPropagation())}_downHandler(e){const t=this;if(!(t.disabled||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),t.$.setAttributeValue("active",!0),"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||t.readonly))){if(t.hasAttribute("smart-blazor"))return void t.$.dispatchEvent(new Event("click"));const n="buttons"in e?e.buttons:e.which;t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY})}}_mouseEnterHandler(e){const t=this;if(!t.readonly&&(t.$button.setAttributeValue("hover",!0),t.$.setAttributeValue("hover",!0),"hover"===t.clickMode)){const n="buttons"in e?e.buttons:e.which;if(t.hasAttribute("smart-blazor"))return void t.$.dispatchEvent(new Event("click"));t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY})}}_touchEndHandler(){const e=this;setTimeout((function(){e.$button.setAttributeValue("hover",!1),e.$.setAttributeValue("hover",!1)}),300)}_mouseLeaveHandler(){this.$button.setAttributeValue("hover",!1),this.$.setAttributeValue("hover",!1)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const a=this;"disabled"===e?(a._setFocusable(),a.$button&&a.$button.setAttributeValue("hover",!1),a.$.setAttributeValue("hover",!1),a instanceof Smart.RepeatButton&&a._stopRepeat()):"unfocusable"===e&&a._setFocusable()}_setFocusable(){const e=this,t=e.$.button?e.$.button:e;if(e.disabled||e.unfocusable)return t.removeAttribute("tabindex"),void(t.tabIndex=-1);t.tabIndex=e.tabIndex>0?e.tabIndex:0}ready(){const e=this;super.ready(),e.setAttribute("role","button"),e._setFocusable(),e.enableShadowDOM&&e.$.hiddenInput&&e.appendChild(e.$.hiddenInput)}}),Smart("smart-repeat-button",class extends Smart.Button{static get properties(){return{delay:{value:50,type:"number"},initialDelay:{value:150,type:"number"}}}static get listeners(){return{"button.down":"_startRepeat","button.mouseenter":"_overriddenHandler","button.mouseleave":"_overriddenHandler","button.pointerenter":"_updateInBoundsFlag","button.pointerleave":"_updateInBoundsFlag","button.touchmove":"_touchmoveHandler","document.up":"_stopRepeat"}}_clickHandler(e){const t=this;("release"!==t.clickMode||t.preventDefaultClick||t.readonly||t.disabled)&&(e.preventDefault(),e.stopPropagation(),t.preventDefaultClick=!1)}_updateInBoundsFlag(e){const t=this;-1!==e.type.indexOf("leave")?(t._isPointerInBounds=!1,t.$button.setAttributeValue("hover",!1),t.$.setAttributeValue("hover",!1)):(t._isPointerInBounds=!0,t.$button.setAttributeValue("hover",!0),t.$.setAttributeValue("hover",!0)),1!==("buttons"in e?e.buttons:e.which)&&t._stopRepeat(e)}_startRepeat(e){const t=this;t.setAttribute("active",""),t._initialTimer||t.readonly||(t._initialTimer=setTimeout((function(){t._repeatTimer=setInterval((()=>{if(t._isPointerInBounds){if(t.hasAttribute("smart-blazor"))return t.$.dispatchEvent(new Event("click")),void(t.preventDefaultClick=!0);const n="buttons"in e?e.buttons:e.which;t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),t.preventDefaultClick=!0}}),t.delay)}),t.initialDelay))}_stopRepeat(e){const t=this;t.readonly||e&&("pointercancel"===e.type||e.originalEvent&&"pointercancel"===e.originalEvent.type)||(t.$.setAttributeValue("active",!1),t._repeatTimer&&(clearInterval(t._repeatTimer),t._repeatTimer=null),t._initialTimer&&(clearTimeout(t._initialTimer),t._initialTimer=null))}_touchmoveHandler(e){this.preventDefaultClick&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_overriddenHandler(){}}),Smart("smart-toggle-button",class extends Smart.Button{static get properties(){return{checked:{value:!1,type:"boolean?"},falseContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminateContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminate:{value:!1,type:"boolean"},trueContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminateTemplate:{value:null,type:"any"},trueTemplate:{value:null,type:"any"},falseTemplate:{value:null,type:"any"},type:{value:"toggle",type:"string",defaultReflectToAttribute:!0,readonly:!0}}}static get listeners(){return{keydown:"_keyHandler",keyup:"_keyHandler",dragstart:"_dragStartHandler","button.click":"_buttonClickHandler","button.mouseenter":"_buttonMouseEnterHandler","button.mouseleave":"_buttonMouseLeaveHandler","document.up":"_documentUpHandler"}}ready(){super.ready(),this._setAriaState(),this._updateGroupValue()}_setAriaState(){const e=this,t=e.checked;null!==t?e.setAttribute("aria-pressed",t):e.setAttribute("aria-pressed","mixed")}_buttonClickHandler(){}_buttonMouseLeaveHandler(){this.removeAttribute("hover")}_buttonMouseEnterHandler(){const e=this;e.setAttribute("hover",""),e.disabled||e.readonly||"hover"!==e.clickMode||(e._changeCheckState("pointer"),e.focus(),e._updateHidenInputNameAndValue())}_documentUpHandler(e){const t=this;t._pressed&&(t._pressed=!1,t.disabled||t.readonly||"press"===t.clickMode||"pointercancel"===e.originalEvent.type||(t._changeCheckState("pointer"),t.focus(),t._updateHidenInputNameAndValue()))}_downHandler(e){const t=this;t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),t._pressed=!0,"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||(t._changeCheckState("pointer"),t.hasAttribute("smart-blazor")?t.$.dispatchEvent(new Event("click")):t.$.fireEvent("click"),t._updateHidenInputNameAndValue()),"press"===t.clickMode&&(e.preventDefault(),e.stopPropagation()))}_dragStartHandler(e){e.preventDefault()}_keyHandler(e){const t=this;if(!0!==t.disabled&&!t.readonly&&32===e.keyCode){if("keydown"===e.type)return void e.preventDefault();if("none"===t.switchMode)return;t._changeCheckState("keyboard"),t._updateHidenInputNameAndValue()}}_updateGroupValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const n=document.querySelectorAll('[data-target="'+e.dataset.target+'"]'),a=[];if(e.checked){const n=e.dataset.property,a=e.dataset.value;if(n&&void 0!==t[n]){let e=a;"true"===e&&(e=!0),"false"===e&&(e=!1),t[n]=e}}for(let t=0;t<n.length;t++){const r=n[t];r.checked&&(r.name?(a.push(r.name),e.id&&r.setAttribute("data-id",e.id)):e.id&&a.push(e.id))}t.value=a.toString(),e._targetDispatchTimer&&clearTimeout(e._targetDispatchTimer),e._targetDispatchTimer=setTimeout((()=>{t.dispatchEvent(new Event("change"))}),100)}}}_changeCheckState(e){const t=this;let n=null;null===t.checked?t.checked=!0:(n=t.checked,t.checked=!t.checked),t._handleTextSelection(),t.$.fireEvent("change",{value:t.checked,oldValue:n,changeType:e}),t.checked?t.$.fireEvent("checkValue",{changeType:e}):t.$.fireEvent("uncheckValue",{changeType:e}),t._updateGroupValue(),t._setAriaState()}_handleTextSelection(){const e=this;e.$.addClass("smart-unselectable"),e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>e.$.removeClass("smart-unselectable")),500)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const a=this;if("checked"===e)return a.$.fireEvent("change",{value:n,oldValue:t,changeType:"api"}),void a._setAriaState();switch(e){case"trueTemplate":a._handleTemplate(!0);break;case"falseTemplate":a._handleTemplate(!1);break;case"indeterminateTemplate":a._handleTemplate()}}_htmlBindOnInitialization(){const e=this;e._bindContentProperty("trueContent","smart-true-content"),e._bindContentProperty("falseContent","smart-false-content"),e._bindContentProperty("indeterminateContent","smart-indeterminate-content")}_bindContentProperty(e,t){const n=this;if(!n.$[e+"Container"])return;let a=document.createElement("div");a.innerHTML=n.innerHTML;let r,i=a.getElementsByClassName(t);if(i.length>0)for(let e=0;e<i.length;e++)r=i[e];""===n[e]&&(n[e]=void 0===r?"":r.outerHTML),n.$[e+"Container"].innerHTML=n[e]}_updateContentProperties(){const e=this;function t(t){e.$[t+"Container"]&&(e[t]=e.$[t+"Container"].innerHTML)}t("trueContent"),t("falseContent"),t("indeterminateContent")}_updateHidenInputValue(){const e=this;if(!e.$.hiddenInput)return;let t;t=null===e.checked?"null":!1===e.checked?"off":e.value||"on",e.$.hiddenInput.setAttribute("value",t)}_updateHidenInputName(){const e=this;if(!e.$.hiddenInput)return;let t=!1===e.checked?"":e.name||"";e.$.hiddenInput.setAttribute("name",t)}_updateHidenInputNameAndValue(){this._updateHidenInputName(),this._updateHidenInputValue()}_handleTemplate(e,t){const n=this;let a,r,i;if(!0===e?(a=n.trueTemplate,r=n.$.trueContentContainer,i=n.trueContent):!1===e?(a=n.falseTemplate,r=n.$.falseContentContainer,i=n.falseContent):(a=n.indeterminateTemplate,r=n.$.indeterminateContentContainer,i=n.indeterminateContent),t&&(r.innerHTML=i||""),null===a||!a)return;if("function"==typeof a)return void a(r,{value:i});if(!("content"in document.createElement("template")))return void n.error(n.localize("htmlTemplateNotSuported",{elementType:n.nodeName.toLowerCase()}));if(a=document.getElementById(a),null===a||!("content"in a))return void n.error(n.localize("invalidTemplate",{elementType:n.nodeName.toLowerCase(),property:"template"}));const o=a.content,l=o.childNodes.length,s=/{{\w+}}/g;let u,d=[];for(let e=0;e<l;e++)for(u=s.exec(o.childNodes[e].innerHTML);u;)d.push({childNodeIndex:e,bindingString:u[0]}),u=s.exec(o.childNodes[e].innerHTML);const c=d.length;let p,h,m=document.importNode(a.content,!0);for(let e=0;e<c;e++){p=m.childNodes[d[e].childNodeIndex],h=d.length;for(let t=0;t<h;t++)p.innerHTML=p.innerHTML.replace(d[e].bindingString,i)}r.innerHTML="";for(let e=0;e<m.childNodes.length;e++)m.childNodes[e].outerHTML&&(r.innerHTML+=m.childNodes[e].outerHTML)}});
|
|
6
|
+
Smart("smart-button",class extends Smart.ContentElement{static get properties(){return{value:{type:"string"},name:{type:"string"},type:{value:"button",type:"string"},clickMode:{allowedValues:["hover","press","release","pressAndRelease"],type:"string",value:"release"}}}static get styleUrls(){return["smart.button.css"]}template(){return"<button aria-label=\"Button\" class=\"smart-button smart-unselectable\" inner-h-t-m-l='[[innerHTML]]' id='button' type='[[type]]' name='[[name]]' value='[[value]]' disabled='[[disabled]]' role=\"presentation\"></button>"}refresh(){}static get listeners(){return{"button.down":"_downHandler","button.mouseenter":"_mouseEnterHandler","button.mouseleave":"_mouseLeaveHandler","button.touchend":"_touchEndHandler","button.click":"_clickHandler","button.up":"_upHandler",up:"_upHandler","button.focus":"_focusHandler","button.blur":"_blurHandler"}}focus(){const e=this;e.$.button?e.$.button.focus():HTMLElement.prototype.focus.call(e)}blur(){const e=this;e.$.button?e.$.button.blur():HTMLElement.prototype.blur.call(e)}_upHandler(e){const t=this;if(e.stopPropagation(),t.$.setAttributeValue("active",!1),t.dataset.target){const n=document.querySelector(t.dataset.target);let a=t.dataset.toggle,r=t.dataset.arguments;const i="smart-window".toLowerCase();if(n&&n.nodeName.toLowerCase()===i&&"modal"===a&&(a="openModal"),"tab"===a||"pill"===a||"list"===a){const e=this.closest(".nav, .list-group"),a='[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',r=!e||"UL"!==e.nodeName&&"OL"!==e.nodeName?e.children(".active"):e.querySelectorAll("li > .active");if(e){const n=e.querySelectorAll(a);for(let e=0;e<n.length;e++)n[e].classList.remove("primary");for(let e=0;e<r.length;e++)r[e].classList.remove("active");let i=t.parentNode;for(;i;){if("LI"===i.nodeName){i.classList.add("active");break}i=i.parentNode}t.classList.add("primary")}return n.parentNode.querySelectorAll(".active").forEach((e=>{e.classList.remove("active"),e.classList.add("smart-hidden")})),n.classList.add("active"),void n.classList.remove("smart-hidden")}a&&n&&!n[a]&&"collapse"===a&&(setTimeout((()=>{n.classList.contains("smart-hidden")?n.classList.remove("smart-hidden"):n.classList.add("smart-hidden")})),e.originalEvent.preventDefault()),a&&n&&!n[a]&&"dropdown"===a?(setTimeout((()=>{n.opened=!n.opened})),e.originalEvent.preventDefault()):a&&n&&n[a]&&(setTimeout((()=>{r?n[a](r):n[a]()}),50),e.originalEvent.preventDefault())}}_focusHandler(){this.$.setAttributeValue("focus",!0),this.$.fireEvent("focus")}_blurHandler(){this.$.setAttributeValue("focus",!1),this.$.fireEvent("blur")}_clickHandler(e){const t=this;("release"!==t.clickMode&&"pressAndRelease"!==t.clickMode||t.readonly)&&(e.preventDefault(),e.stopPropagation())}_downHandler(e){const t=this;if(!(t.disabled||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),t.$.setAttributeValue("active",!0),"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||t.readonly))){if(t.hasAttribute("smart-blazor"))return void t.$.dispatchEvent(new Event("click"));const n="buttons"in e?e.buttons:e.which;t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY})}}_mouseEnterHandler(e){const t=this;if(!t.readonly&&(t.$button.setAttributeValue("hover",!0),t.$.setAttributeValue("hover",!0),"hover"===t.clickMode)){const n="buttons"in e?e.buttons:e.which;if(t.hasAttribute("smart-blazor"))return void t.$.dispatchEvent(new Event("click"));t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY})}}_touchEndHandler(){const e=this;setTimeout((function(){e.$button.setAttributeValue("hover",!1),e.$.setAttributeValue("hover",!1)}),300)}_mouseLeaveHandler(){this.$button.setAttributeValue("hover",!1),this.$.setAttributeValue("hover",!1)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const a=this;"disabled"===e?(a._setFocusable(),a.$button&&a.$button.setAttributeValue("hover",!1),a.$.setAttributeValue("hover",!1),a instanceof Smart.RepeatButton&&a._stopRepeat()):"unfocusable"===e&&a._setFocusable()}_setFocusable(){const e=this,t=e.$.button?e.$.button:e;if(e.disabled||e.unfocusable)return t.removeAttribute("tabindex"),void(t.tabIndex=-1);t.tabIndex=e.tabIndex>0?e.tabIndex:0}ready(){const e=this;super.ready(),e.setAttribute("role","presentation"),e._setFocusable(),e.enableShadowDOM&&e.$.hiddenInput&&e.appendChild(e.$.hiddenInput)}}),Smart("smart-repeat-button",class extends Smart.Button{static get properties(){return{delay:{value:50,type:"number"},initialDelay:{value:150,type:"number"}}}static get listeners(){return{"button.down":"_startRepeat","button.mouseenter":"_overriddenHandler","button.mouseleave":"_overriddenHandler","button.pointerenter":"_updateInBoundsFlag","button.pointerleave":"_updateInBoundsFlag","button.touchmove":"_touchmoveHandler","document.up":"_stopRepeat"}}_clickHandler(e){const t=this;("release"!==t.clickMode||t.preventDefaultClick||t.readonly||t.disabled)&&(e.preventDefault(),e.stopPropagation(),t.preventDefaultClick=!1)}_updateInBoundsFlag(e){const t=this;-1!==e.type.indexOf("leave")?(t._isPointerInBounds=!1,t.$button.setAttributeValue("hover",!1),t.$.setAttributeValue("hover",!1)):(t._isPointerInBounds=!0,t.$button.setAttributeValue("hover",!0),t.$.setAttributeValue("hover",!0)),1!==("buttons"in e?e.buttons:e.which)&&t._stopRepeat(e)}_startRepeat(e){const t=this;t.setAttribute("active",""),t._initialTimer||t.readonly||(t._initialTimer=setTimeout((function(){t._repeatTimer=setInterval((()=>{if(t._isPointerInBounds){if(t.hasAttribute("smart-blazor"))return t.$.dispatchEvent(new Event("click")),void(t.preventDefaultClick=!0);const n="buttons"in e?e.buttons:e.which;t.$.fireEvent("click",{buttons:n,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),t.preventDefaultClick=!0}}),t.delay)}),t.initialDelay))}_stopRepeat(e){const t=this;t.readonly||e&&("pointercancel"===e.type||e.originalEvent&&"pointercancel"===e.originalEvent.type)||(t.$.setAttributeValue("active",!1),t._repeatTimer&&(clearInterval(t._repeatTimer),t._repeatTimer=null),t._initialTimer&&(clearTimeout(t._initialTimer),t._initialTimer=null))}_touchmoveHandler(e){this.preventDefaultClick&&e.cancelable&&(e.preventDefault(),e.stopPropagation())}_overriddenHandler(){}}),Smart("smart-toggle-button",class extends Smart.Button{static get properties(){return{checked:{value:!1,type:"boolean?"},falseContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminateContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminate:{value:!1,type:"boolean"},trueContent:{value:"",reflectToAttribute:!1,type:"string"},indeterminateTemplate:{value:null,type:"any"},trueTemplate:{value:null,type:"any"},falseTemplate:{value:null,type:"any"},type:{value:"toggle",type:"string",defaultReflectToAttribute:!0,readonly:!0}}}static get listeners(){return{keydown:"_keyHandler",keyup:"_keyHandler",dragstart:"_dragStartHandler","button.click":"_buttonClickHandler","button.mouseenter":"_buttonMouseEnterHandler","button.mouseleave":"_buttonMouseLeaveHandler","document.up":"_documentUpHandler"}}ready(){super.ready(),this._setAriaState(),this._updateGroupValue()}_setAriaState(){const e=this,t=e.checked;null!==t?e.setAttribute("aria-pressed",t):e.setAttribute("aria-pressed","mixed")}_buttonClickHandler(){}_buttonMouseLeaveHandler(){this.removeAttribute("hover")}_buttonMouseEnterHandler(){const e=this;e.setAttribute("hover",""),e.disabled||e.readonly||"hover"!==e.clickMode||(e._changeCheckState("pointer"),e.focus(),e._updateHidenInputNameAndValue())}_documentUpHandler(e){const t=this;t._pressed&&(t._pressed=!1,t.disabled||t.readonly||"press"===t.clickMode||"pointercancel"===e.originalEvent.type||(t._changeCheckState("pointer"),t.focus(),t._updateHidenInputNameAndValue()))}_downHandler(e){const t=this;t.disabled||t.readonly||(t.hasRippleAnimation&&Smart.Utilities.Animation.Ripple.animate(t,e.pageX,e.pageY),t._pressed=!0,"press"!==t.clickMode&&"pressAndRelease"!==t.clickMode||(t._changeCheckState("pointer"),t.hasAttribute("smart-blazor")?t.$.dispatchEvent(new Event("click")):t.$.fireEvent("click"),t._updateHidenInputNameAndValue()),"press"===t.clickMode&&(e.preventDefault(),e.stopPropagation()))}_dragStartHandler(e){e.preventDefault()}_keyHandler(e){const t=this;if(!0!==t.disabled&&!t.readonly&&32===e.keyCode){if("keydown"===e.type)return void e.preventDefault();if("none"===t.switchMode)return;t._changeCheckState("keyboard"),t._updateHidenInputNameAndValue()}}_updateGroupValue(){const e=this;if(e.dataset.target){const t=document.querySelector(e.dataset.target);if(t){const n=document.querySelectorAll('[data-target="'+e.dataset.target+'"]'),a=[];if(e.checked){const n=e.dataset.property,a=e.dataset.value;if(n&&void 0!==t[n]){let e=a;"true"===e&&(e=!0),"false"===e&&(e=!1),t[n]=e}}for(let t=0;t<n.length;t++){const r=n[t];r.checked&&(r.name?(a.push(r.name),e.id&&r.setAttribute("data-id",e.id)):e.id&&a.push(e.id))}t.value=a.toString(),e._targetDispatchTimer&&clearTimeout(e._targetDispatchTimer),e._targetDispatchTimer=setTimeout((()=>{t.dispatchEvent(new Event("change"))}),100)}}}_changeCheckState(e){const t=this;let n=null;null===t.checked?t.checked=!0:(n=t.checked,t.checked=!t.checked),t._handleTextSelection(),t.$.fireEvent("change",{value:t.checked,oldValue:n,changeType:e}),t.checked?t.$.fireEvent("checkValue",{changeType:e}):t.$.fireEvent("uncheckValue",{changeType:e}),t._updateGroupValue(),t._setAriaState()}_handleTextSelection(){const e=this;e.$.addClass("smart-unselectable"),e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>e.$.removeClass("smart-unselectable")),500)}propertyChangedHandler(e,t,n){super.propertyChangedHandler(e,t,n);const a=this;if("checked"===e)return a.$.fireEvent("change",{value:n,oldValue:t,changeType:"api"}),void a._setAriaState();switch(e){case"trueTemplate":a._handleTemplate(!0);break;case"falseTemplate":a._handleTemplate(!1);break;case"indeterminateTemplate":a._handleTemplate()}}_htmlBindOnInitialization(){const e=this;e._bindContentProperty("trueContent","smart-true-content"),e._bindContentProperty("falseContent","smart-false-content"),e._bindContentProperty("indeterminateContent","smart-indeterminate-content")}_bindContentProperty(e,t){const n=this;if(!n.$[e+"Container"])return;let a=document.createElement("div");a.innerHTML=n.innerHTML;let r,i=a.getElementsByClassName(t);if(i.length>0)for(let e=0;e<i.length;e++)r=i[e];""===n[e]&&(n[e]=void 0===r?"":r.outerHTML),n.$[e+"Container"].innerHTML=n[e]}_updateContentProperties(){const e=this;function t(t){e.$[t+"Container"]&&(e[t]=e.$[t+"Container"].innerHTML)}t("trueContent"),t("falseContent"),t("indeterminateContent")}_updateHidenInputValue(){const e=this;if(!e.$.hiddenInput)return;let t;t=null===e.checked?"null":!1===e.checked?"off":e.value||"on",e.$.hiddenInput.setAttribute("value",t)}_updateHidenInputName(){const e=this;if(!e.$.hiddenInput)return;let t=!1===e.checked?"":e.name||"";e.$.hiddenInput.setAttribute("name",t)}_updateHidenInputNameAndValue(){this._updateHidenInputName(),this._updateHidenInputValue()}_handleTemplate(e,t){const n=this;let a,r,i;if(!0===e?(a=n.trueTemplate,r=n.$.trueContentContainer,i=n.trueContent):!1===e?(a=n.falseTemplate,r=n.$.falseContentContainer,i=n.falseContent):(a=n.indeterminateTemplate,r=n.$.indeterminateContentContainer,i=n.indeterminateContent),t&&(r.innerHTML=i||""),null===a||!a)return;if("function"==typeof a)return void a(r,{value:i});if(!("content"in document.createElement("template")))return void n.error(n.localize("htmlTemplateNotSuported",{elementType:n.nodeName.toLowerCase()}));if(a=document.getElementById(a),null===a||!("content"in a))return void n.error(n.localize("invalidTemplate",{elementType:n.nodeName.toLowerCase(),property:"template"}));const o=a.content,l=o.childNodes.length,s=/{{\w+}}/g;let u,d=[];for(let e=0;e<l;e++)for(u=s.exec(o.childNodes[e].innerHTML);u;)d.push({childNodeIndex:e,bindingString:u[0]}),u=s.exec(o.childNodes[e].innerHTML);const c=d.length;let p,h,m=document.importNode(a.content,!0);for(let e=0;e<c;e++){p=m.childNodes[d[e].childNodeIndex],h=d.length;for(let t=0;t<h;t++)p.innerHTML=p.innerHTML.replace(d[e].bindingString,i)}r.innerHTML="";for(let e=0;e<m.childNodes.length;e++)m.childNodes[e].outerHTML&&(r.innerHTML+=m.childNodes[e].outerHTML)}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
/* Smart UI
|
|
3
|
-
Copyright (c) 2011-
|
|
2
|
+
/* Smart UI v25.5.5 (2026-02-24)
|
|
3
|
+
Copyright (c) 2011-2024 jQWidgets.
|
|
4
4
|
License: https://htmlelements.com/license/ */ //
|
|
5
5
|
|
|
6
|
-
Smart("smart-country-input",class extends Smart.Input{static get properties(){return{onlyCountries:{value:[],type:"array"},selectedCountry:{value:"",type:"string"}}}getCountries(){const a=[["Afghanistan (افغانستان)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (الجزائر)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (البحرين)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (جزر القمر)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (مصر)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (ایران)","ir","98"],["Iraq (العراق)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (ישראל)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (الأردن)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (الكويت)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (لبنان)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (ليبيا)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (موريتانيا)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (المغرب)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (عُمان)","om","968"],["Pakistan (پاکستان)","pk","92"],["Palau","pw","680"],["Palestine (فلسطين)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (قطر)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (المملكة العربية السعودية)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (جنوب السودان)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්රී ලංකාව)","lk","94"],["Sudan (السودان)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (سوريا)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (تونس)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (الإمارات العربية المتحدة)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1,["5288","5289"]],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]];for(var e=0;e<a.length;e++){var n=a[e];a[e]={label:n[0],value:n[1],iso2:n[1],countryCode:n[1],dialCode:n[2],priority:n[3]||0,areaCodes:n[4]||null}}return a}render(){const a=this;super.render(),a.classList.add("smart-input");let e=a.getCountries();if(a.onlyCountries.length&&(e=e.filter((e=>a.onlyCountries.indexOf(e.iso2)>=0))),a.dataSource=e,a.readonly=!0,a.dropDownButtonPosition="right",!a.selectedCountry){let e=navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage;e.indexOf("-")>=0&&(e=e.split("-")[1].toLowerCase());const n=a.context;"Smart-PHONE-INPUT"===a.nodeName&&(a.context=a),a.selectedCountry=e||"us",a.context=n}}propertyChangedHandler(a,e,n){super.propertyChangedHandler(a,e,n);const i=this;switch(a){case"selectedCountry":i.selectItem(i.selectedCountry)}}_render(a){const e=this;let n=0;const i=a.map((function(a){let i=a,t=a;"object"==typeof a&&(i=a.label,t=void 0!==a.value?a.value:i),i=""+i;const r=document.createElement("li"),s=document.createElement("a");return s.href="#",r.id=e.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("data-label",i),r.index=n++,r.dataValue=t,"string"==typeof t?r.setAttribute("value",t):r.setAttribute("value",JSON.stringify(t)),r.setAttribute("role","option"),r.setAttribute("aria-label",i),i='<div class="smart-flag-box"><div class="flag '+a.iso2+'"></div></div><span class="country-name">'+a.label+'</span><span class="smart-hidden dial-code">'+a.dialCode+"</span>",s.innerHTML=i,s.setAttribute("aria-hidden",!0),r.classList.add("country"),r.setAttribute("data-dial-code",a.dialCode),r.setAttribute("data-country-code",a.iso2),r.appendChild(s),r}));function t(){const a=e.$.menu.getElementsByClassName("active");a[0]&&a[0].classList.remove("active"),this.classList.add("active"),e._setActiveDescendant(this)}i.length>0&&(i[0].classList.add("active"),e._setActiveDescendant(i[0])),e.$.menu.innerHTML="";for(let a=0;a<i.length;a++){const n=i[a];e.$.menu.appendChild(n),n.onmouseenter=t,n.onmouseleave=function(){this.classList.remove("active"),e._setActiveDescendant(null)},n.onclick=t}}});
|
|
6
|
+
Smart("smart-country-input",class extends Smart.Input{static get properties(){return{onlyCountries:{value:[],type:"array"},selectedCountry:{value:"",type:"string"}}}getCountries(){const a=[["Afghanistan (افغانستان)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (الجزائر)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (البحرين)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2,["89164"]],["Cocos (Keeling) Islands","cc","61",1,["89162"]],["Colombia","co","57"],["Comoros (جزر القمر)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (مصر)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (ایران)","ir","98"],["Iraq (العراق)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (ישראל)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1",4,["876","658"]],["Japan (日本)","jp","81"],["Jersey","je","44",3,["1534","7509","7700","7797","7829","7937"]],["Jordan (الأردن)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1,["33","7"]],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (الكويت)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (لبنان)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (ليبيا)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (موريتانيا)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (المغرب)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (عُمان)","om","968"],["Pakistan (پاکستان)","pk","92"],["Palau","pw","680"],["Palestine (فلسطين)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (قطر)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (المملكة العربية السعودية)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (جنوب السودان)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්රී ලංකාව)","lk","94"],["Sudan (السودان)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (سوريا)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (تونس)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (الإمارات العربية المتحدة)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1,["5288","5289"]],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]];for(var e=0;e<a.length;e++){var n=a[e];a[e]={label:n[0],value:n[1],iso2:n[1],countryCode:n[1],dialCode:n[2],priority:n[3]||0,areaCodes:n[4]||null}}return a}render(){const a=this;super.render(),a.classList.add("smart-input");let e=a.getCountries();if(a.onlyCountries.length&&(e=e.filter((e=>a.onlyCountries.indexOf(e.iso2)>=0))),a.dataSource=e,a.readonly=!0,a.dropDownButtonPosition="right",!a.selectedCountry){let e=navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage;e.indexOf("-")>=0&&(e=e.split("-")[1].toLowerCase());const n=a.context;"Smart-PHONE-INPUT"===a.nodeName&&(a.context=a),a.selectedCountry=e||"us",a.context=n}}propertyChangedHandler(a,e,n){super.propertyChangedHandler(a,e,n);const i=this;switch(a){case"selectedCountry":i.selectItem(i.selectedCountry);break;case"onlyCountries":{let a=i.getCountries();i.onlyCountries.length&&(a=a.filter((a=>i.onlyCountries.indexOf(a.iso2)>=0))),i.dataSource=a;break}}}_render(a){const e=this;let n=0;const i=a.map((function(a){let i=a,t=a;"object"==typeof a&&(i=a.label,t=void 0!==a.value?a.value:i),i=""+i;const r=document.createElement("li"),s=document.createElement("a");return s.href="#",r.id=e.id+"Item"+Math.floor(65536*(1+Math.random())).toString(16).substring(1),r.setAttribute("data-label",i),r.index=n++,r.dataValue=t,"string"==typeof t?r.setAttribute("value",t):r.setAttribute("value",JSON.stringify(t)),r.setAttribute("role","option"),r.setAttribute("aria-label",i),i='<div class="smart-flag-box"><div class="flag '+a.iso2+'"></div></div><span class="country-name">'+a.label+'</span><span class="smart-hidden dial-code">'+a.dialCode+"</span>",s.innerHTML=i,s.setAttribute("aria-hidden",!0),r.classList.add("country"),r.setAttribute("data-dial-code",a.dialCode),r.setAttribute("data-country-code",a.iso2),r.appendChild(s),r}));function t(){const a=e.$.menu.getElementsByClassName("active");a[0]&&a[0].classList.remove("active"),this.classList.add("active"),e._setActiveDescendant(this)}i.length>0&&(i[0].classList.add("active"),e._setActiveDescendant(i[0])),e.$.menu.innerHTML="";for(let a=0;a<i.length;a++){const n=i[a];e.$.menu.appendChild(n),n.onmouseenter=t,n.onmouseleave=function(){this.classList.remove("active"),e._setActiveDescendant(null)},n.onclick=t}}});
|