foxit-component 1.0.4 → 1.0.5-alpha.10

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.
@@ -0,0 +1,270 @@
1
+ // 当前域名下assets/images/generateIcon
2
+ var AREA_FLAG_BASE_URL = function () {
3
+ if (typeof window !== 'undefined') {
4
+ return window.location.origin + '/assets/images/generateIcon';
5
+ }
6
+ return '';
7
+ };
8
+ // SSR 场景下 flagBaseUrl 为空时使用的 US 国旗 fallback(内联 SVG data URI)
9
+ var US_FLAG_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">' +
10
+ '<path d="M512.5 64.1h-2.6c-246.1 0-445.5 199.5-445.5 445.5v2.5h448.1v-448z" fill="#2F0F7D"/>' +
11
+ '<path d="M512.1 445.2v66.9h448.3c0-22.7-1.7-45.1-5-66.9H512.1z" fill="#DE001A"/>' +
12
+ '<path d="M940.1 378.3h-428v66.9h443.3c-3.4-22.9-8.6-45.3-15.3-66.9z" fill="#FFFFFF"/>' +
13
+ '<path d="M913 311.3H512.1v66.9h428c-7.3-23.1-16.4-45.5-27.1-66.9z" fill="#DE001A"/>' +
14
+ '<path d="M871.6 244.4H512.1v66.9H913c-11.9-23.6-25.7-45.9-41.4-66.9z" fill="#FFFFFF"/>' +
15
+ '<path d="M810.2 177.5H512.1v66.9h359.5c-18.1-24.3-38.7-46.8-61.4-66.9z" fill="#DE001A"/>' +
16
+ '<path d="M711.2 110.5H512.1v66.9h298.1c-29.7-26.4-63-49-99-66.9z" fill="#FFFFFF"/>' +
17
+ '<path d="M313.6 913.7h397.5c36-17.9 69.3-40.5 99.1-66.9H214.6c29.7 26.5 63 49.1 99 66.9z" fill="#DE001A"/>' +
18
+ '<path d="M214.6 846.8h595.6c22.6-20.2 43.2-42.6 61.4-66.9H153.2c18.1 24.3 38.7 46.7 61.4 66.9zM512.4 960.1c71.4 0 138.9-16.7 198.8-46.4H313.6c59.9 29.7 127.4 46.4 198.8 46.4z" fill="#FFFFFF"/>' +
19
+ '<path d="M153.2 779.9h718.5c15.7-21 29.5-43.4 41.4-66.9H111.8c11.9 23.5 25.7 45.9 41.4 66.9z" fill="#DE001A"/>' +
20
+ '<path d="M111.8 712.9H913c10.7-21.4 19.8-43.8 27.1-66.9H84.7c7.3 23.2 16.4 45.5 27.1 66.9z" fill="#FFFFFF"/>' +
21
+ '<path d="M84.7 646H940c6.8-21.7 11.9-44 15.4-66.9h-886C72.8 602 78 624.3 84.7 646z" fill="#DE001A"/>' +
22
+ '<path d="M955.4 579.1c3.3-21.8 5-44.2 5-66.9h-896c0 22.7 1.7 45.1 5 66.9h886z" fill="#FFFFFF"/>' +
23
+ '<path d="M711.2 110.5c-59.9-29.7-127.4-46.4-198.8-46.4h-0.3v46.4h199.1z" fill="#DE001A"/>' +
24
+ '<path d="M138.1 317.4l-8 16-17.9 2.6 13 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6 12.9-12.5-17.8-2.6zM146.1 461.2l-8-16-8 16-17.9 2.6 13 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6 12.9-12.5zM182.9 299.2l16-8.4 16 8.4-3-17.7 12.9-12.4-17.9-2.6-8-16-8 16-17.8 2.6 12.9 12.4zM224.8 399.9l-17.9-2.6-8-16-8 16-17.8 2.6 12.9 12.5-3.1 17.6 16-8.3 16 8.3-3-17.6zM360.2 186.6l-8 16-17.9 2.6 13 12.4-3.1 17.7 16-8.4 16 8.4-3.1-17.7 12.9-12.4-17.8-2.6zM344.2 116.6l16-8.3 16 8.3-3.1-17.6L386 86.5l-9.7-1.4c-10.7 3.4-21.3 7.2-31.7 11.4l2.5 2.5-2.9 17.6zM360.2 317.4l-8 16-17.9 2.6 13 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6L386 336l-17.8-2.6zM368.2 461.2l-8-16-8 16-17.9 2.6 13 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6 12.9-12.5zM405 299.2l16-8.4 16 8.4-3-17.7 12.9-12.4-17.9-2.6-8-16-8 16-17.8 2.6 12.9 12.4zM405 180.5l16-8.3 16 8.3-3-17.6 12.9-12.5-17.9-2.6-8-16-8 16-17.8 2.6 12.9 12.5zM446.9 399.9l-17.9-2.6-8-16-8 16-17.8 2.6 12.9 12.5L405 430l16-8.3 16 8.3-3-17.6zM96.3 430l-3.1-17.6 12.9-12.5-17.9-2.6-5.8-11.7c-3.8 13.1-7.1 26.4-9.8 40l7.6-4 16.1 8.4zM250.7 186.6l-8 16-17.9 2.6 12.9 12.4-3 17.7 16-8.4 15.9 8.4-3-17.7 12.9-12.4-17.9-2.6zM250.7 317.4l-8 16-17.9 2.6 12.9 12.5-3 17.6 16-8.3 15.9 8.3-3-17.6 12.9-12.5-17.9-2.6zM258.6 461.2l-7.9-16-8 16-17.9 2.6 12.9 12.5-3 17.6 16-8.3 15.9 8.3-3-17.6 12.9-12.5zM295.5 299.2l16-8.4 16 8.4-3.1-17.7 13-12.4-17.9-2.6-8-16-8 16-17.9 2.6 13 12.4zM295.5 180.5l16-8.3 16 8.3-3.1-17.6 13-12.5-17.9-2.6-8-16-8 16-17.9 2.6 13 12.5zM337.4 399.9l-17.9-2.6-8-16-8 16-17.9 2.6 13 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6zM469.7 186.6l-8 16-17.8 2.6 12.9 12.4-3.1 17.7 16-8.4 16 8.4-3.1-17.7 13-12.4-17.9-2.6zM469.7 67.9l-8 16.1-17.8 2.5L456.8 99l-3.1 17.6 16-8.3 16 8.3-3.1-17.6 13-12.5-17.9-2.5zM469.7 317.4l-8 16-17.8 2.6 12.9 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6 13-12.5-17.9-2.6zM477.7 461.2l-8-16-8 16-17.8 2.6 12.9 12.5-3.1 17.6 16-8.3 16 8.3-3.1-17.6 13-12.5z" fill="#FFFFFF"/>' +
25
+ '</svg>';
26
+ var US_FLAG_DATA_URI = 'data:image/svg+xml,' + encodeURIComponent(US_FLAG_SVG);
27
+ var areaCodeOptions = [
28
+ { value: 'AF', dialCode: '+93', name: 'Afghanistan' },
29
+ { value: 'AL', dialCode: '+355', name: 'Albania' },
30
+ { value: 'DZ', dialCode: '+213', name: 'Algeria' },
31
+ { value: 'AS', dialCode: '+1', name: 'American Samoa' },
32
+ { value: 'AD', dialCode: '+376', name: 'Andorra' },
33
+ { value: 'AO', dialCode: '+244', name: 'Angola' },
34
+ { value: 'AI', dialCode: '+1', name: 'Anguilla' },
35
+ { value: 'AQ', dialCode: '+672', name: 'Antarctica' },
36
+ { value: 'AG', dialCode: '+1', name: 'Antigua and Barbuda' },
37
+ { value: 'AR', dialCode: '+54', name: 'Argentina' },
38
+ { value: 'AM', dialCode: '+374', name: 'Armenia' },
39
+ { value: 'AW', dialCode: '+297', name: 'Aruba' },
40
+ { value: 'AU', dialCode: '+61', name: 'Australia' },
41
+ { value: 'AT', dialCode: '+43', name: 'Austria' },
42
+ { value: 'AZ', dialCode: '+994', name: 'Azerbaijan' },
43
+ { value: 'BS', dialCode: '+1', name: 'Bahamas' },
44
+ { value: 'BH', dialCode: '+973', name: 'Bahrain' },
45
+ { value: 'BD', dialCode: '+880', name: 'Bangladesh' },
46
+ { value: 'BB', dialCode: '+1', name: 'Barbados' },
47
+ { value: 'BY', dialCode: '+375', name: 'Belarus' },
48
+ { value: 'BE', dialCode: '+32', name: 'Belgium' },
49
+ { value: 'BZ', dialCode: '+501', name: 'Belize' },
50
+ { value: 'BJ', dialCode: '+229', name: 'Benin' },
51
+ { value: 'BM', dialCode: '+1', name: 'Bermuda' },
52
+ { value: 'BT', dialCode: '+975', name: 'Bhutan' },
53
+ { value: 'BO', dialCode: '+591', name: 'Bolivia' },
54
+ { value: 'BA', dialCode: '+387', name: 'Bosnia and Herzegovina' },
55
+ { value: 'BW', dialCode: '+267', name: 'Botswana' },
56
+ { value: 'BR', dialCode: '+55', name: 'Brazil' },
57
+ { value: 'IO', dialCode: '+246', name: 'British Indian Ocean Territory' },
58
+ { value: 'VG', dialCode: '+1', name: 'British Virgin Islands' },
59
+ { value: 'BN', dialCode: '+673', name: 'Brunei' },
60
+ { value: 'BG', dialCode: '+359', name: 'Bulgaria' },
61
+ { value: 'BF', dialCode: '+226', name: 'Burkina Faso' },
62
+ { value: 'BI', dialCode: '+257', name: 'Burundi' },
63
+ { value: 'KH', dialCode: '+855', name: 'Cambodia' },
64
+ { value: 'CM', dialCode: '+237', name: 'Cameroon' },
65
+ { value: 'CA', dialCode: '+1', name: 'Canada' },
66
+ { value: 'CV', dialCode: '+238', name: 'Cape Verde' },
67
+ { value: 'KY', dialCode: '+1', name: 'Cayman Islands' },
68
+ { value: 'CF', dialCode: '+236', name: 'Central African Republic' },
69
+ { value: 'TD', dialCode: '+235', name: 'Chad' },
70
+ { value: 'CL', dialCode: '+56', name: 'Chile' },
71
+ { value: 'CN', dialCode: '+86', name: 'China' },
72
+ { value: 'CX', dialCode: '+61', name: 'Christmas Island' },
73
+ { value: 'CC', dialCode: '+61', name: 'Cocos Islands' },
74
+ { value: 'CO', dialCode: '+57', name: 'Colombia' },
75
+ { value: 'KM', dialCode: '+269', name: 'Comoros' },
76
+ { value: 'CK', dialCode: '+682', name: 'Cook Islands' },
77
+ { value: 'CR', dialCode: '+506', name: 'Costa Rica' },
78
+ { value: 'HR', dialCode: '+385', name: 'Croatia' },
79
+ { value: 'CU', dialCode: '+53', name: 'Cuba' },
80
+ { value: 'CW', dialCode: '+599', name: 'Curacao' },
81
+ { value: 'CY', dialCode: '+357', name: 'Cyprus' },
82
+ { value: 'CZ', dialCode: '+420', name: 'Czech Republic' },
83
+ { value: 'CD', dialCode: '+243', name: 'Democratic Republic of the Congo' },
84
+ { value: 'DK', dialCode: '+45', name: 'Denmark' },
85
+ { value: 'DJ', dialCode: '+253', name: 'Djibouti' },
86
+ { value: 'DM', dialCode: '+1', name: 'Dominica' },
87
+ { value: 'DO', dialCode: '+1', name: 'Dominican Republic' },
88
+ { value: 'TL', dialCode: '+670', name: 'East Timor' },
89
+ { value: 'EC', dialCode: '+593', name: 'Ecuador' },
90
+ { value: 'EG', dialCode: '+20', name: 'Egypt' },
91
+ { value: 'SV', dialCode: '+503', name: 'El Salvador' },
92
+ { value: 'GQ', dialCode: '+240', name: 'Equatorial Guinea' },
93
+ { value: 'ER', dialCode: '+291', name: 'Eritrea' },
94
+ { value: 'EE', dialCode: '+372', name: 'Estonia' },
95
+ { value: 'ET', dialCode: '+251', name: 'Ethiopia' },
96
+ { value: 'FK', dialCode: '+500', name: 'Falkland Islands' },
97
+ { value: 'FO', dialCode: '+298', name: 'Faroe Islands' },
98
+ { value: 'FJ', dialCode: '+679', name: 'Fiji' },
99
+ { value: 'FI', dialCode: '+358', name: 'Finland' },
100
+ { value: 'FR', dialCode: '+33', name: 'France' },
101
+ { value: 'PF', dialCode: '+689', name: 'French Polynesia' },
102
+ { value: 'GA', dialCode: '+241', name: 'Gabon' },
103
+ { value: 'GM', dialCode: '+220', name: 'Gambia' },
104
+ { value: 'GE', dialCode: '+995', name: 'Georgia' },
105
+ { value: 'DE', dialCode: '+49', name: 'Germany' },
106
+ { value: 'GH', dialCode: '+233', name: 'Ghana' },
107
+ { value: 'GI', dialCode: '+350', name: 'Gibraltar' },
108
+ { value: 'GR', dialCode: '+30', name: 'Greece' },
109
+ { value: 'GL', dialCode: '+299', name: 'Greenland' },
110
+ { value: 'GD', dialCode: '+1', name: 'Grenada' },
111
+ { value: 'GU', dialCode: '+1', name: 'Guam' },
112
+ { value: 'GT', dialCode: '+502', name: 'Guatemala' },
113
+ { value: 'GG', dialCode: '+44', name: 'Guernsey' },
114
+ { value: 'GN', dialCode: '+224', name: 'Guinea' },
115
+ { value: 'GW', dialCode: '+245', name: 'Guinea-Bissau' },
116
+ { value: 'GY', dialCode: '+592', name: 'Guyana' },
117
+ { value: 'HT', dialCode: '+509', name: 'Haiti' },
118
+ { value: 'HN', dialCode: '+504', name: 'Honduras' },
119
+ { value: 'HK', dialCode: '+852', name: 'Hong Kong' },
120
+ { value: 'HU', dialCode: '+36', name: 'Hungary' },
121
+ { value: 'IS', dialCode: '+354', name: 'Iceland' },
122
+ { value: 'IN', dialCode: '+91', name: 'India' },
123
+ { value: 'ID', dialCode: '+62', name: 'Indonesia' },
124
+ { value: 'IR', dialCode: '+98', name: 'Iran' },
125
+ { value: 'IQ', dialCode: '+964', name: 'Iraq' },
126
+ { value: 'IE', dialCode: '+353', name: 'Ireland' },
127
+ { value: 'IM', dialCode: '+44', name: 'Isle of Man' },
128
+ { value: 'IL', dialCode: '+972', name: 'Israel' },
129
+ { value: 'IT', dialCode: '+39', name: 'Italy' },
130
+ { value: 'CI', dialCode: '+225', name: 'Ivory Coast' },
131
+ { value: 'JM', dialCode: '+1', name: 'Jamaica' },
132
+ { value: 'JP', dialCode: '+81', name: 'Japan' },
133
+ { value: 'JE', dialCode: '+44', name: 'Jersey' },
134
+ { value: 'JO', dialCode: '+962', name: 'Jordan' },
135
+ { value: 'KZ', dialCode: '+7', name: 'Kazakhstan' },
136
+ { value: 'KE', dialCode: '+254', name: 'Kenya' },
137
+ { value: 'KI', dialCode: '+686', name: 'Kiribati' },
138
+ { value: 'XK', dialCode: '+383', name: 'Kosovo' },
139
+ { value: 'KW', dialCode: '+965', name: 'Kuwait' },
140
+ { value: 'KG', dialCode: '+996', name: 'Kyrgyzstan' },
141
+ { value: 'LA', dialCode: '+856', name: 'Laos' },
142
+ { value: 'LV', dialCode: '+371', name: 'Latvia' },
143
+ { value: 'LB', dialCode: '+961', name: 'Lebanon' },
144
+ { value: 'LS', dialCode: '+266', name: 'Lesotho' },
145
+ { value: 'LR', dialCode: '+231', name: 'Liberia' },
146
+ { value: 'LY', dialCode: '+218', name: 'Libya' },
147
+ { value: 'LI', dialCode: '+423', name: 'Liechtenstein' },
148
+ { value: 'LT', dialCode: '+370', name: 'Lithuania' },
149
+ { value: 'LU', dialCode: '+352', name: 'Luxembourg' },
150
+ { value: 'MO', dialCode: '+853', name: 'Macau' },
151
+ { value: 'MK', dialCode: '+389', name: 'Macedonia' },
152
+ { value: 'MG', dialCode: '+261', name: 'Madagascar' },
153
+ { value: 'MW', dialCode: '+265', name: 'Malawi' },
154
+ { value: 'MY', dialCode: '+60', name: 'Malaysia' },
155
+ { value: 'MV', dialCode: '+960', name: 'Maldives' },
156
+ { value: 'ML', dialCode: '+223', name: 'Mali' },
157
+ { value: 'MT', dialCode: '+356', name: 'Malta' },
158
+ { value: 'MH', dialCode: '+692', name: 'Marshall Islands' },
159
+ { value: 'MR', dialCode: '+222', name: 'Mauritania' },
160
+ { value: 'MU', dialCode: '+230', name: 'Mauritius' },
161
+ { value: 'YT', dialCode: '+262', name: 'Mayotte' },
162
+ { value: 'MX', dialCode: '+52', name: 'Mexico' },
163
+ { value: 'FM', dialCode: '+691', name: 'Micronesia' },
164
+ { value: 'MD', dialCode: '+373', name: 'Moldova' },
165
+ { value: 'MC', dialCode: '+377', name: 'Monaco' },
166
+ { value: 'MN', dialCode: '+976', name: 'Mongolia' },
167
+ { value: 'ME', dialCode: '+382', name: 'Montenegro' },
168
+ { value: 'MS', dialCode: '+1', name: 'Montserrat' },
169
+ { value: 'MA', dialCode: '+212', name: 'Morocco' },
170
+ { value: 'MZ', dialCode: '+258', name: 'Mozambique' },
171
+ { value: 'MM', dialCode: '+95', name: 'Myanmar' },
172
+ { value: 'NA', dialCode: '+264', name: 'Namibia' },
173
+ { value: 'NR', dialCode: '+674', name: 'Nauru' },
174
+ { value: 'NP', dialCode: '+977', name: 'Nepal' },
175
+ { value: 'NL', dialCode: '+31', name: 'Netherlands' },
176
+ { value: 'AN', dialCode: '+599', name: 'Netherlands Antilles' },
177
+ { value: 'NC', dialCode: '+687', name: 'New Caledonia' },
178
+ { value: 'NZ', dialCode: '+64', name: 'New Zealand' },
179
+ { value: 'NI', dialCode: '+505', name: 'Nicaragua' },
180
+ { value: 'NE', dialCode: '+227', name: 'Niger' },
181
+ { value: 'NG', dialCode: '+234', name: 'Nigeria' },
182
+ { value: 'NU', dialCode: '+683', name: 'Niue' },
183
+ { value: 'KP', dialCode: '+850', name: 'North Korea' },
184
+ { value: 'MP', dialCode: '+1', name: 'Northern Mariana Islands' },
185
+ { value: 'NO', dialCode: '+47', name: 'Norway' },
186
+ { value: 'OM', dialCode: '+968', name: 'Oman' },
187
+ { value: 'PK', dialCode: '+92', name: 'Pakistan' },
188
+ { value: 'PW', dialCode: '+680', name: 'Palau' },
189
+ { value: 'PS', dialCode: '+970', name: 'Palestine' },
190
+ { value: 'PA', dialCode: '+507', name: 'Panama' },
191
+ { value: 'PG', dialCode: '+675', name: 'Papua New Guinea' },
192
+ { value: 'PY', dialCode: '+595', name: 'Paraguay' },
193
+ { value: 'PE', dialCode: '+51', name: 'Peru' },
194
+ { value: 'PH', dialCode: '+63', name: 'Philippines' },
195
+ { value: 'PN', dialCode: '+64', name: 'Pitcairn' },
196
+ { value: 'PL', dialCode: '+48', name: 'Poland' },
197
+ { value: 'PT', dialCode: '+351', name: 'Portugal' },
198
+ { value: 'PR', dialCode: '+1', name: 'Puerto Rico' },
199
+ { value: 'QA', dialCode: '+974', name: 'Qatar' },
200
+ { value: 'CG', dialCode: '+242', name: 'Republic of the Congo' },
201
+ { value: 'RE', dialCode: '+262', name: 'Reunion' },
202
+ { value: 'RO', dialCode: '+40', name: 'Romania' },
203
+ { value: 'RU', dialCode: '+7', name: 'Russia' },
204
+ { value: 'RW', dialCode: '+250', name: 'Rwanda' },
205
+ { value: 'BL', dialCode: '+590', name: 'Saint Barthelemy' },
206
+ { value: 'SH', dialCode: '+290', name: 'Saint Helena' },
207
+ { value: 'KN', dialCode: '+1', name: 'Saint Kitts and Nevis' },
208
+ { value: 'LC', dialCode: '+1', name: 'Saint Lucia' },
209
+ { value: 'MF', dialCode: '+590', name: 'Saint Martin' },
210
+ { value: 'PM', dialCode: '+508', name: 'Saint Pierre and Miquelon' },
211
+ { value: 'VC', dialCode: '+1', name: 'Saint Vincent and the Grenadines' },
212
+ { value: 'WS', dialCode: '+685', name: 'Samoa' },
213
+ { value: 'SM', dialCode: '+378', name: 'San Marino' },
214
+ { value: 'ST', dialCode: '+239', name: 'Sao Tome and Principe' },
215
+ { value: 'SA', dialCode: '+966', name: 'Saudi Arabia' },
216
+ { value: 'SN', dialCode: '+221', name: 'Senegal' },
217
+ { value: 'RS', dialCode: '+381', name: 'Serbia' },
218
+ { value: 'SC', dialCode: '+248', name: 'Seychelles' },
219
+ { value: 'SL', dialCode: '+232', name: 'Sierra Leone' },
220
+ { value: 'SG', dialCode: '+65', name: 'Singapore' },
221
+ { value: 'SX', dialCode: '+1', name: 'Sint Maarten' },
222
+ { value: 'SK', dialCode: '+421', name: 'Slovakia' },
223
+ { value: 'SI', dialCode: '+386', name: 'Slovenia' },
224
+ { value: 'SB', dialCode: '+677', name: 'Solomon Islands' },
225
+ { value: 'SO', dialCode: '+252', name: 'Somalia' },
226
+ { value: 'ZA', dialCode: '+27', name: 'South Africa' },
227
+ { value: 'KR', dialCode: '+82', name: 'South Korea' },
228
+ { value: 'SS', dialCode: '+211', name: 'South Sudan' },
229
+ { value: 'ES', dialCode: '+34', name: 'Spain' },
230
+ { value: 'LK', dialCode: '+94', name: 'Sri Lanka' },
231
+ { value: 'SD', dialCode: '+249', name: 'Sudan' },
232
+ { value: 'SR', dialCode: '+597', name: 'Suriname' },
233
+ { value: 'SJ', dialCode: '+47', name: 'Svalbard and Jan Mayen' },
234
+ { value: 'SZ', dialCode: '+268', name: 'Swaziland' },
235
+ { value: 'SE', dialCode: '+46', name: 'Sweden' },
236
+ { value: 'CH', dialCode: '+41', name: 'Switzerland' },
237
+ { value: 'SY', dialCode: '+963', name: 'Syria' },
238
+ { value: 'TW', dialCode: '+886', name: 'Taiwan' },
239
+ { value: 'TJ', dialCode: '+992', name: 'Tajikistan' },
240
+ { value: 'TZ', dialCode: '+255', name: 'Tanzania' },
241
+ { value: 'TH', dialCode: '+66', name: 'Thailand' },
242
+ { value: 'TG', dialCode: '+228', name: 'Togo' },
243
+ { value: 'TK', dialCode: '+690', name: 'Tokelau' },
244
+ { value: 'TO', dialCode: '+676', name: 'Tonga' },
245
+ { value: 'TT', dialCode: '+1', name: 'Trinidad and Tobago' },
246
+ { value: 'TN', dialCode: '+216', name: 'Tunisia' },
247
+ { value: 'TR', dialCode: '+90', name: 'Turkey' },
248
+ { value: 'TM', dialCode: '+993', name: 'Turkmenistan' },
249
+ { value: 'TC', dialCode: '+1', name: 'Turks and Caicos Islands' },
250
+ { value: 'TV', dialCode: '+688', name: 'Tuvalu' },
251
+ { value: 'VI', dialCode: '+1', name: 'U.S. Virgin Islands' },
252
+ { value: 'UG', dialCode: '+256', name: 'Uganda' },
253
+ { value: 'UA', dialCode: '+380', name: 'Ukraine' },
254
+ { value: 'AE', dialCode: '+971', name: 'United Arab Emirates' },
255
+ { value: 'GB', dialCode: '+44', name: 'United Kingdom' },
256
+ { value: 'US', dialCode: '+1', name: 'United States' },
257
+ { value: 'UY', dialCode: '+598', name: 'Uruguay' },
258
+ { value: 'UZ', dialCode: '+998', name: 'Uzbekistan' },
259
+ { value: 'VU', dialCode: '+678', name: 'Vanuatu' },
260
+ { value: 'VA', dialCode: '+379', name: 'Vatican' },
261
+ { value: 'VE', dialCode: '+58', name: 'Venezuela' },
262
+ { value: 'VN', dialCode: '+84', name: 'Vietnam' },
263
+ { value: 'WF', dialCode: '+681', name: 'Wallis and Futuna' },
264
+ { value: 'EH', dialCode: '+212', name: 'Western Sahara' },
265
+ { value: 'YE', dialCode: '+967', name: 'Yemen' },
266
+ { value: 'ZM', dialCode: '+260', name: 'Zambia' },
267
+ { value: 'ZW', dialCode: '+263', name: 'Zimbabwe' }
268
+ ];
269
+
270
+ export { AREA_FLAG_BASE_URL, US_FLAG_DATA_URI, areaCodeOptions };
package/es/Menu/Menu.js CHANGED
@@ -2,6 +2,8 @@ import { __assign, __spreadArray } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import { Icon } from '../Icon/index.js';
5
+ import { getDirection } from '../utils.js';
6
+ import classNames from 'classnames';
5
7
 
6
8
  var getItem = function (label, key, icon, children, type) {
7
9
  return {
@@ -19,7 +21,7 @@ var Menu = function (_a) {
19
21
  var _f = useState(defaultSelectedKeys), uncontrolledSelectedKeys = _f[0], setUncontrolledSelectedKeys = _f[1];
20
22
  var selectedKeys = controlledSelectedKeys !== undefined ? controlledSelectedKeys : uncontrolledSelectedKeys;
21
23
  var _g = useState(null), hoveredKey = _g[0], setHoveredKey = _g[1];
22
- var _h = useState({ top: 0, left: 0 }), popupPosition = _h[0], setPopupPosition = _h[1];
24
+ var _h = useState({ top: 0, left: 0, right: 0 }), popupPosition = _h[0], setPopupPosition = _h[1];
23
25
  var menuItemRefs = useRef({});
24
26
  var popupRef = useRef(null);
25
27
  var handleMenuClick = function (e) {
@@ -34,7 +36,7 @@ var Menu = function (_a) {
34
36
  // 标准展开模式的菜单项渲染
35
37
  var renderMenuItem = function (item) {
36
38
  var isSelected = selectedKeys.includes(item.key.toString());
37
- return (jsx("div", __assign({ className: "foxit-menu-item ".concat(isSelected ? 'selected' : '') }, { children: jsxs("div", __assign({ className: "foxit-menu-item-content", onClick: function () { return handleMenuClick({ key: item.key.toString() }); } }, { children: [item.icon && jsx("span", __assign({ style: { marginRight: '8px' } }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })) }), item.key));
39
+ return (jsx("div", __assign({ className: "foxit-menu-item ".concat(isSelected ? 'selected' : '') }, { children: jsxs("div", __assign({ className: "foxit-menu-item-content", onClick: function () { return handleMenuClick({ key: item.key.toString() }); } }, { children: [item.icon && jsx("span", __assign({ className: "foxit-menu-item-icon-mr8" }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })) }), item.key));
38
40
  };
39
41
  // 标准展开模式的子菜单渲染
40
42
  var renderSubMenu = function (item) {
@@ -46,7 +48,7 @@ var Menu = function (_a) {
46
48
  else {
47
49
  setOpenKeys(__spreadArray(__spreadArray([], openKeys, true), [item.key.toString()], false));
48
50
  }
49
- } }, { children: [jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [item.icon && jsx("span", __assign({ style: { marginRight: '8px' } }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })), jsx("span", { children: jsx(Icon, { name: "DownOutlined", className: "foxit-menu-icon ".concat(isOpen ? '' : 'foxit-menu-rotated-icon') }) })] })), isOpen && item.children && (jsx("div", __assign({ className: "foxit-menu-submenu-items" }, { children: item.children.map(function (child) {
51
+ } }, { children: [jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [item.icon && jsx("span", __assign({ className: "foxit-menu-item-icon-mr8" }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })), jsx("span", { children: jsx(Icon, { name: "DownOutlined", className: "foxit-menu-icon ".concat(isOpen ? '' : 'foxit-menu-rotated-icon') }) })] })), isOpen && item.children && (jsx("div", __assign({ className: "foxit-menu-submenu-items" }, { children: item.children.map(function (child) {
50
52
  return child.children ? renderSubMenu(child) : renderMenuItem(child);
51
53
  }) })))] }, item.key));
52
54
  };
@@ -66,10 +68,21 @@ var Menu = function (_a) {
66
68
  var itemRef = menuItemRefs.current[key];
67
69
  if (itemRef) {
68
70
  var rect = itemRef.getBoundingClientRect();
69
- setPopupPosition({
70
- top: rect.top,
71
- left: rect.right + 5
72
- });
71
+ var dir = getDirection(itemRef);
72
+ if (dir === 'rtl' && window !== undefined) {
73
+ setPopupPosition({
74
+ top: rect.top,
75
+ left: 0,
76
+ right: (window === null || window === void 0 ? void 0 : window.innerWidth) - rect.left
77
+ });
78
+ }
79
+ else {
80
+ setPopupPosition({
81
+ top: rect.top,
82
+ left: rect.right + 5,
83
+ right: 0
84
+ });
85
+ }
73
86
  }
74
87
  };
75
88
  // 处理鼠标离开事件
@@ -94,16 +107,27 @@ var Menu = function (_a) {
94
107
  if (!hoveredKey)
95
108
  return null;
96
109
  var item = findItemByKey(items, hoveredKey);
97
- if (!(item === null || item === void 0 ? void 0 : item.children))
98
- return null;
99
- return (jsx("div", __assign({ ref: popupRef, className: "foxit-menu-popup", style: {
100
- position: 'fixed',
101
- top: "".concat(popupPosition.top, "px"),
102
- left: "".concat(popupPosition.left, "px"),
103
- zIndex: 1000
104
- }, onMouseEnter: function () { return setHoveredKey(hoveredKey); }, onMouseLeave: function () { return setHoveredKey(null); } }, { children: jsxs("div", __assign({ className: "foxit-menu foxit-menu-popup-content" }, { children: [jsxs("div", __assign({ className: "foxit-menu-popup-title" }, { children: [jsx("span", __assign({ className: "foxit-menu-item-icon" }, { children: item.icon })), jsx("span", { children: item.label })] })), item.children.map(function (child) {
110
+ // if (!item?.children) return null;
111
+ // 根据方向设置样式
112
+ var dir = getDirection();
113
+ var popupStyle = {
114
+ position: 'fixed',
115
+ top: "".concat(popupPosition.top, "px"),
116
+ zIndex: 1000
117
+ };
118
+ if (dir === 'rtl') {
119
+ // RTL在左侧显示
120
+ popupStyle.right = "".concat(popupPosition.right, "px");
121
+ popupStyle.left = 'auto';
122
+ }
123
+ else {
124
+ // LTR在右侧显示
125
+ popupStyle.left = "".concat(popupPosition.left, "px");
126
+ popupStyle.right = 'auto';
127
+ }
128
+ return (jsx("div", __assign({ ref: popupRef, className: "foxit-menu-popup", style: popupStyle, onMouseEnter: function () { return setHoveredKey(hoveredKey); }, onMouseLeave: function () { return setHoveredKey(null); } }, { children: jsxs("div", __assign({ className: "foxit-menu foxit-menu-popup-content" }, { children: [jsxs("div", __assign({ className: classNames("foxit-menu-popup-title", !(item === null || item === void 0 ? void 0 : item.children) && 'foxit-menu-popup-title-no-border') }, { children: [jsx("span", __assign({ className: "foxit-menu-item-icon" }, { children: item === null || item === void 0 ? void 0 : item.icon })), jsx("span", { children: item === null || item === void 0 ? void 0 : item.label })] })), (item === null || item === void 0 ? void 0 : item.children) && (item === null || item === void 0 ? void 0 : item.children.map(function (child) {
105
129
  return child.children ? renderPopupSubMenu(child) : renderPopupMenuItem(child);
106
- })] })) })));
130
+ }))] })) })));
107
131
  };
108
132
  // 弹出菜单中的普通菜单项渲染
109
133
  var renderPopupMenuItem = function (item) {
@@ -14,6 +14,8 @@ interface IModalProps {
14
14
  closable?: boolean;
15
15
  okButtonProps?: Record<string, unknown>;
16
16
  cancelButtonProps?: Record<string, unknown>;
17
+ footer?: React.ReactNode;
18
+ zIndex?: number;
17
19
  }
18
20
  interface ModalComponent extends FC<IModalProps> {
19
21
  confirm: (props: IModalProps & {
package/es/Modal/Modal.js CHANGED
@@ -8,7 +8,7 @@ import { Modal as Modal$1 } from './ModalTemp.js';
8
8
  import { Button } from '../Button/Button.js';
9
9
 
10
10
  var ModalContent = function (_a) {
11
- var title = _a.title, onCancel = _a.onCancel, _b = _a.onCancelText, onCancelText = _b === void 0 ? undefined : _b, onOk = _a.onOk, _c = _a.onOkText, onOkText = _c === void 0 ? undefined : _c, children = _a.children, _d = _a.width, width = _d === void 0 ? '400px' : _d, type = _a.type, _e = _a.closable, closable = _e === void 0 ? true : _e, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps;
11
+ var title = _a.title, onCancel = _a.onCancel, _b = _a.onCancelText, onCancelText = _b === void 0 ? undefined : _b, onOk = _a.onOk, _c = _a.onOkText, onOkText = _c === void 0 ? undefined : _c, children = _a.children, _d = _a.width, width = _d === void 0 ? '400px' : _d, type = _a.type, _e = _a.closable, closable = _e === void 0 ? true : _e, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps, footer = _a.footer;
12
12
  var _f = useState(false), loading = _f[0], setLoading = _f[1];
13
13
  var _g = useState(false), cancelLoading = _g[0], setCancelLoading = _g[1];
14
14
  var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -54,15 +54,15 @@ var ModalContent = function (_a) {
54
54
  return (jsxs("div", __assign({ className: classNames('foxit-modal-content-container', type === 'success' ? 'foxit-modal-success' : ''), style: {
55
55
  maxWidth: "min(".concat(width, ", calc(100vw - 32px))"),
56
56
  width: width
57
- } }, { children: [jsxs("div", __assign({ className: "foxit-modal-head" }, { children: [jsx("div", __assign({ className: "foxit-modal-title" }, { children: title })), closable && (jsx("div", __assign({ onClick: onCancel, className: type === 'success' ? 'foxit-modal-success-icon' : 'foxit-modal-close-button' }, { children: type === 'success' ? (jsx(Icon, { name: "FireWorkColoursOutlined" })) : (jsx(Icon, { name: "CloseOutlined" })) })))] })), jsx("div", __assign({ className: "foxit-modal-children" }, { children: children })), jsxs("div", __assign({ className: "foxit-modal-footer" }, { children: [onCancelText && (jsx(Button, __assign({ size: "medium", onClick: handleCancel, loading: cancelLoading }, cancelButtonProps, { children: onCancelText }))), onOkText && (jsx(Button, __assign({ primary: true, size: "medium", onClick: handleOk, loading: loading }, okButtonProps, { children: onOkText })))] }))] })));
57
+ } }, { children: [jsxs("div", __assign({ className: "foxit-modal-head" }, { children: [jsx("div", __assign({ className: "foxit-modal-title" }, { children: title })), closable && (jsx("div", __assign({ onClick: onCancel, className: type === 'success' ? 'foxit-modal-success-icon' : 'foxit-modal-close-button' }, { children: type === 'success' ? (jsx(Icon, { name: "FireWorkColoursOutlined" })) : (jsx(Icon, { name: "CloseOutlined" })) })))] })), jsx("div", __assign({ className: "foxit-modal-children" }, { children: children })), footer && jsx("div", __assign({ className: "foxit-modal-footer" }, { children: footer })), !footer && (jsxs("div", __assign({ className: "foxit-modal-footer" }, { children: [onCancelText && (jsx(Button, __assign({ size: "medium", onClick: handleCancel, loading: cancelLoading }, cancelButtonProps, { children: onCancelText }))), onOkText && (jsx(Button, __assign({ primary: true, size: "medium", onClick: handleOk, loading: loading }, okButtonProps, { children: onOkText })))] })))] })));
58
58
  };
59
59
  var Modal = function (_a) {
60
- var title = _a.title, opened = _a.opened, onOk = _a.onOk, onOkText = _a.onOkText, onCancel = _a.onCancel, onCancelText = _a.onCancelText, maskClosable = _a.maskClosable, children = _a.children, width = _a.width, type = _a.type, closable = _a.closable, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps;
61
- return (jsx(Modal$1, __assign({ opened: opened, onClose: onCancel || (function () { }), maskClosable: maskClosable, position: "top" }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel, onCancelText: onCancelText, onOk: onOk, onOkText: onOkText, type: type, closable: closable, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps }, { children: children })) })));
60
+ var title = _a.title, opened = _a.opened, onOk = _a.onOk, onOkText = _a.onOkText, onCancel = _a.onCancel, onCancelText = _a.onCancelText, maskClosable = _a.maskClosable, children = _a.children, width = _a.width, type = _a.type, closable = _a.closable, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps, footer = _a.footer, zIndex = _a.zIndex;
61
+ return (jsx(Modal$1, __assign({ opened: opened, onClose: onCancel || (function () { }), maskClosable: maskClosable, position: "top", zIndex: zIndex }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel, onCancelText: onCancelText, onOk: onOk, onOkText: onOkText, type: type, closable: closable, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, footer: footer }, { children: children })) })));
62
62
  };
63
63
  // 语法糖的调用方式
64
64
  Modal.confirm = function (_a) {
65
- var title = _a.title, onOk = _a.onOk, onCancel = _a.onCancel, onOkText = _a.onOkText, onCancelText = _a.onCancelText, _b = _a.maskClosable, maskClosable = _b === void 0 ? true : _b, content = _a.content, width = _a.width, closable = _a.closable, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps;
65
+ var title = _a.title, onOk = _a.onOk, onCancel = _a.onCancel, onOkText = _a.onOkText, onCancelText = _a.onCancelText, _b = _a.maskClosable, maskClosable = _b === void 0 ? true : _b, content = _a.content, width = _a.width, closable = _a.closable, okButtonProps = _a.okButtonProps, cancelButtonProps = _a.cancelButtonProps, footer = _a.footer, zIndex = _a.zIndex;
66
66
  var modalRoot = document.createElement('div');
67
67
  document.body.appendChild(modalRoot);
68
68
  var root = createRoot(modalRoot);
@@ -72,7 +72,7 @@ Modal.confirm = function (_a) {
72
72
  document.body.removeChild(modalRoot);
73
73
  }
74
74
  };
75
- root.render(jsx(Modal$1, __assign({ opened: true, onClose: handleClose, maskClosable: maskClosable, position: "top" }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel instanceof Function && onCancel.constructor.name === 'AsyncFunction'
75
+ root.render(jsx(Modal$1, __assign({ opened: true, onClose: handleClose, maskClosable: maskClosable, position: "top", zIndex: zIndex }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel instanceof Function && onCancel.constructor.name === 'AsyncFunction'
76
76
  ? function () { return __awaiter(void 0, void 0, void 0, function () {
77
77
  return __generator(this, function (_a) {
78
78
  switch (_a.label) {
@@ -104,7 +104,7 @@ Modal.confirm = function (_a) {
104
104
  : function () {
105
105
  onOk === null || onOk === void 0 ? void 0 : onOk();
106
106
  handleClose();
107
- }, onOkText: onOkText, closable: closable, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps }, { children: content })) })));
107
+ }, onOkText: onOkText, closable: closable, okButtonProps: okButtonProps, cancelButtonProps: cancelButtonProps, footer: footer }, { children: content })) })));
108
108
  };
109
109
 
110
110
  export { Modal };
@@ -6,6 +6,7 @@ interface IModalProps {
6
6
  maskClosable?: boolean;
7
7
  position?: 'center' | 'top' | 'bottom';
8
8
  text?: string | React.ReactNode;
9
+ zIndex?: number;
9
10
  }
10
11
  export declare const Modal: React.FC<React.PropsWithChildren<IModalProps>>;
11
12
  export {};
@@ -31,7 +31,7 @@ var Portal = function (_a) {
31
31
  return createPortal(children, container);
32
32
  };
33
33
  var ModalLayout = function (_a) {
34
- var _b = _a.onClose, onClose = _b === void 0 ? function () { } : _b, children = _a.children, opened = _a.opened, _c = _a.maskClosable, maskClosable = _c === void 0 ? true : _c, _d = _a.position, position = _d === void 0 ? 'center' : _d;
34
+ var _b = _a.onClose, onClose = _b === void 0 ? function () { } : _b, children = _a.children, opened = _a.opened, _c = _a.maskClosable, maskClosable = _c === void 0 ? true : _c, _d = _a.position, position = _d === void 0 ? 'center' : _d, zIndex = _a.zIndex;
35
35
  var overlayRef = useRef(null);
36
36
  var contentRef = useRef(null);
37
37
  var _e = useState(false), animationIn = _e[0], setAnimationIn = _e[1];
@@ -45,10 +45,10 @@ var ModalLayout = function (_a) {
45
45
  else if (position === 'bottom') {
46
46
  justifyClass = 'foxit-modal-justify-bottom';
47
47
  }
48
- return (jsxs("div", __assign({ className: classNames('foxit-modal-fixed-layout', justifyClass) }, { children: [jsx(CSSTransition, __assign({ in: animationIn, nodeRef: overlayRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: overlayAnimation }, { children: jsx("div", __assign({ ref: overlayRef, className: "foxit-modal-overlay", onClick: maskClosable ? onClose : undefined }, { children: jsx("div", { className: "foxit-modal-overlay-bg" }) })) })), jsx(CSSTransition, __assign({ in: animationIn, nodeRef: contentRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: contentAnimation }, { children: jsx("div", __assign({ ref: contentRef, className: "foxit-modal-content" }, { children: children })) }))] })));
48
+ return (jsxs("div", __assign({ className: classNames('foxit-modal-fixed-layout', justifyClass), style: zIndex !== undefined ? { zIndex: zIndex } : undefined }, { children: [jsx(CSSTransition, __assign({ in: animationIn, nodeRef: overlayRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: overlayAnimation }, { children: jsx("div", __assign({ ref: overlayRef, className: "foxit-modal-overlay", onClick: maskClosable ? onClose : undefined }, { children: jsx("div", { className: "foxit-modal-overlay-bg" }) })) })), jsx(CSSTransition, __assign({ in: animationIn, nodeRef: contentRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: contentAnimation }, { children: jsx("div", __assign({ ref: contentRef, className: "foxit-modal-content" }, { children: children })) }))] })));
49
49
  };
50
50
  var Modal = function (_a) {
51
- var opened = _a.opened, onClose = _a.onClose, maskClosable = _a.maskClosable, children = _a.children, position = _a.position;
51
+ var opened = _a.opened, onClose = _a.onClose, maskClosable = _a.maskClosable, children = _a.children, position = _a.position, zIndex = _a.zIndex;
52
52
  var _b = useState(false), mounted = _b[0], setMounted = _b[1];
53
53
  useEffect(function () {
54
54
  if (opened && !mounted) {
@@ -69,7 +69,7 @@ var Modal = function (_a) {
69
69
  if (!mounted) {
70
70
  return null;
71
71
  }
72
- return (jsx(Portal, { children: jsx(ModalLayout, __assign({ onClose: onClose, opened: opened, maskClosable: maskClosable, position: position }, { children: children })) }));
72
+ return (jsx(Portal, { children: jsx(ModalLayout, __assign({ onClose: onClose, opened: opened, maskClosable: maskClosable, position: position, zIndex: zIndex }, { children: children })) }));
73
73
  };
74
74
 
75
75
  export { Modal };
@@ -26,6 +26,13 @@ var Quantity = function (_a) {
26
26
  setInternalValue(newValue);
27
27
  };
28
28
  var handleChange = function (e) {
29
+ var newValue = parseInt(e.target.value, 10) || 0;
30
+ if (onChange) {
31
+ onChange(newValue);
32
+ }
33
+ setInternalValue(newValue);
34
+ };
35
+ var handleBlur = function (e) {
29
36
  var newValue = parseInt(e.target.value, 10) || 0;
30
37
  if (min !== undefined && newValue < min) {
31
38
  newValue = min;
@@ -38,9 +45,14 @@ var Quantity = function (_a) {
38
45
  }
39
46
  setInternalValue(newValue);
40
47
  };
48
+ var handleKeyDown = function (e) {
49
+ if (e.key === 'Enter') {
50
+ handleBlur(e);
51
+ }
52
+ };
41
53
  return (jsxs("div", __assign({ className: classNames('foxit-quantity', className) }, { children: [jsx("button", __assign({ className: "foxit-quantity-button", onClick: handleDecrement, disabled: min !== undefined && currentValue <= min }, { children: jsx("div", { children: "-" }) })), jsx("input", __assign({
42
54
  // type="number"
43
- value: currentValue, onChange: handleChange, min: min, max: max, className: "foxit-quantity-number" }, props)), jsx("button", __assign({ className: "foxit-quantity-button", onClick: handleIncrement, disabled: max !== undefined && currentValue >= max }, { children: jsx("div", { children: "+" }) }))] })));
55
+ value: currentValue, onChange: handleChange, min: min, max: max, className: "foxit-quantity-number", onBlur: handleBlur, onKeyDown: handleKeyDown }, props)), jsx("button", __assign({ className: "foxit-quantity-button", onClick: handleIncrement, disabled: max !== undefined && currentValue >= max }, { children: jsx("div", { children: "+" }) }))] })));
44
56
  };
45
57
 
46
58
  export { Quantity };
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
+ import './select.css';
2
3
  export interface SelectProps {
3
4
  options: {
4
5
  value: string | number;
5
- label: string;
6
+ label: string | React.ReactNode;
6
7
  }[];
7
8
  className?: string;
8
9
  defaultValue?: string | number | string[] | number[];
@@ -14,10 +15,14 @@ export interface SelectProps {
14
15
  preIcon?: React.ReactNode;
15
16
  value?: string | number | CustomOption | null;
16
17
  onChange?: (v: unknown) => void;
18
+ showSelectedIcon?: boolean;
17
19
  styles?: {
18
20
  control?: React.CSSProperties;
19
21
  singleValue?: React.CSSProperties;
20
22
  input?: React.CSSProperties;
23
+ menu?: (base: Record<string, unknown>, state: {
24
+ placement: string;
25
+ }) => Record<string, unknown>;
21
26
  };
22
27
  [key: string]: unknown;
23
28
  }
@@ -5,9 +5,8 @@ import classNames from 'classnames';
5
5
  import { Icon } from '../Icon/index.js';
6
6
 
7
7
  var Select = function (_a) {
8
- var options = _a.options, className = _a.className, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, isClearable = _a.isClearable, isSearchable = _a.isSearchable, isMulti = _a.isMulti, _b = _a.placeholder, placeholder = _b === void 0 ? 'Select...' : _b, preIcon = _a.preIcon, value = _a.value, onChange = _a.onChange, passStyles = _a.styles, rest = __rest(_a, ["options", "className", "defaultValue", "isDisabled", "isClearable", "isSearchable", "isMulti", "placeholder", "preIcon", "value", "onChange", "styles"]);
9
- var customStyles = {
10
- control: function (styles, _a) {
8
+ var options = _a.options, className = _a.className, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, isClearable = _a.isClearable, isSearchable = _a.isSearchable, isMulti = _a.isMulti, _b = _a.placeholder, placeholder = _b === void 0 ? 'Select...' : _b, preIcon = _a.preIcon, value = _a.value, onChange = _a.onChange, _c = _a.showSelectedIcon, showSelectedIcon = _c === void 0 ? true : _c, passStyles = _a.styles, rest = __rest(_a, ["options", "className", "defaultValue", "isDisabled", "isClearable", "isSearchable", "isMulti", "placeholder", "preIcon", "value", "onChange", "showSelectedIcon", "styles"]);
9
+ var customStyles = __assign({ control: function (styles, _a) {
11
10
  var isDisabled = _a.isDisabled;
12
11
  return (__assign(__assign(__assign({}, styles), { backgroundColor: isDisabled ? '#f8f8f8' : 'white',
13
12
  // minWidth: 200,
@@ -16,39 +15,32 @@ var Select = function (_a) {
16
15
  }, ':focus-within': {
17
16
  border: '1px solid #FF5F00'
18
17
  } }), ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.control) || {})));
19
- },
20
- menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 99999 })); },
21
- option: function (styles, _a) {
18
+ }, menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 99999 })); }, option: function (styles, _a) {
22
19
  var isSelected = _a.isSelected, isFocused = _a.isFocused;
23
- return __assign(__assign({}, styles), { backgroundColor: isFocused ? '#FFF6F0' : 'white', color: isSelected ? '#FF5F00' : '#666', ':hover': {
20
+ return __assign(__assign({}, styles), { backgroundColor: isFocused || isSelected ? '#FFF6F0' : 'white', color: isSelected ? '#FF5F00' : '#666', ':hover': {
24
21
  backgroundColor: '#FFF6F0'
25
22
  }, fontSize: 16, display: 'flex', justifyContent: 'space-between', alignItems: 'center' });
26
- },
27
- indicatorSeparator: function (styles) { return (__assign(__assign({}, styles), { display: 'none' })); },
28
- placeholder: function (styles) { return (__assign(__assign({}, styles), { color: '#B3B3B3' })); },
29
- dropdownIndicator: function (styles) { return (__assign(__assign({}, styles), { paddingRight: 16 })); },
30
- singleValue: function (styles) { return (__assign(__assign({}, styles), ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.singleValue) || {}))); },
31
- input: function (styles) { return (__assign(__assign({}, styles), ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.input) || {}))); }
32
- };
33
- var CustomControl = function (props) { return (jsxs(components.Control, __assign({}, props, { children: [preIcon && (jsx("div", __assign({ style: {
34
- display: 'flex',
35
- paddingLeft: 8,
36
- marginRight: -4,
23
+ }, indicatorSeparator: function (styles) { return (__assign(__assign({}, styles), { display: 'none' })); }, placeholder: function (styles) { return (__assign(__assign({}, styles), { color: '#B3B3B3' })); }, dropdownIndicator: function (styles) { return (__assign(__assign({}, styles), { paddingRight: 16 })); }, singleValue: function (styles) { return (__assign(__assign({}, styles), ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.singleValue) || {}))); }, input: function (styles) { return (__assign(__assign({}, styles), ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.input) || {}))); } }, ((passStyles === null || passStyles === void 0 ? void 0 : passStyles.menu) && { menu: function (base, state) { return (__assign(__assign({}, base), passStyles.menu(base, state))); } }));
24
+ var CustomControl = function (props) { return (jsxs(components.Control, __assign({}, props, { children: [preIcon && (jsx("div", __assign({ className: "foxit-select-custom-control", style: {
37
25
  color: props.hasValue ? '#525252' : '#B3B3B3'
38
26
  } }, { children: preIcon }))), props.children] }))); };
39
- var CustomOptionComp = function (props) { return (jsxs(components.Option, __assign({}, props, { children: [props.children, props.isSelected && jsx(Icon, { name: "CheckCircleOutlined" })] }))); };
27
+ var CustomOptionComp = function (props) { return (jsxs(components.Option, __assign({}, props, { children: [props.children, showSelectedIcon && props.isSelected && jsx(Icon, { name: "CheckCircleOutlined" })] }))); };
40
28
  var userAgent = typeof navigator === 'undefined' ? '' : navigator.userAgent;
41
29
  var mobileRegex = /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i;
42
30
  var padRegex = /iPad|Tablet|PlayBook|Silk|Kindle|Nexus 7|Nexus 10|SM-T|GT-P|TouchPad|Pad|HONOR|HDN/i;
43
31
  var isMobile = mobileRegex.test(userAgent) || padRegex.test(userAgent);
44
- return (jsx(ReactSelect, __assign({ menuPortalTarget: document.body, options: options, className: classNames('foxit-select-wrapper', className), placeholder: placeholder, styles: customStyles, defaultValue: isMulti
32
+ // 解决nextjs 服务端渲染document is not defined问题
33
+ var menuPortalTarget = typeof document !== 'undefined' ? document.body : null;
34
+ // console.log(menuPortalTarget);
35
+ return (jsx(ReactSelect, __assign({ menuPortalTarget: menuPortalTarget, options: options, className: classNames('foxit-select-wrapper', className), placeholder: placeholder, styles: customStyles, defaultValue: isMulti
45
36
  ? options.filter(function (option) {
46
37
  return Array.isArray(defaultValue) &&
47
38
  defaultValue.includes(option.value);
48
39
  })
49
40
  : options.find(function (option) { return option.value === defaultValue; }), isDisabled: isDisabled, isClearable: isClearable, isSearchable: isMobile ? false : isSearchable, isMulti: isMulti, components: { Control: CustomControl, Option: CustomOptionComp }, onChange: onChange, menuPosition: "fixed" }, rest, { value: isMulti && Array.isArray(value)
50
41
  ? value.map(function (v) { return options.find(function (option) { return option.value === v; }); })
51
- : options.find(function (option) { return option.value === value; }) || value })));
42
+ : options.find(function (option) { return option.value === value; }) ||
43
+ value })));
52
44
  };
53
45
 
54
46
  export { Select as default };