@pisell/private-materials 6.3.30 → 6.3.32

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.
Files changed (287) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +9 -1
  6. package/build/lowcode/preview.js +146 -146
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  12. package/es/components/appointmentBooking/components/Cart/Item/index.js +3 -2
  13. package/es/components/appointmentBooking/components/ConfirmInformation/index.js +267 -76
  14. package/es/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  15. package/es/components/appointmentBooking/hooks.d.ts +1 -0
  16. package/es/components/appointmentBooking/hooks.js +30 -30
  17. package/es/components/appointmentBooking/locales.d.ts +3 -0
  18. package/es/components/appointmentBooking/locales.js +9 -6
  19. package/es/components/booking/addons/model.d.ts +10 -1
  20. package/es/components/booking/components/footer/index.js +4 -1
  21. package/es/components/booking/components/footer/utils.js +62 -46
  22. package/es/components/booking/forms/model.d.ts +10 -1
  23. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +2 -2
  24. package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
  25. package/es/components/booking/info/main.js +3 -2
  26. package/es/components/booking/info/model.d.ts +10 -1
  27. package/es/components/booking/info/model.js +5 -0
  28. package/es/components/booking/info/service/addService/utils.d.ts +1 -1
  29. package/es/components/booking/info2/index.js +3 -2
  30. package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
  31. package/es/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  32. package/es/components/booking/info2/service/contactInfoMode/index.js +94 -0
  33. package/es/components/booking/locales.d.ts +3 -0
  34. package/es/components/booking/locales.js +9 -3
  35. package/es/components/booking/model.d.ts +13 -1
  36. package/es/components/booking/model.js +3 -0
  37. package/es/components/booking/notes/model.d.ts +10 -1
  38. package/es/components/booking/payments/model.d.ts +10 -1
  39. package/es/components/eftposPay/amount.d.ts +1 -1
  40. package/es/components/eftposPay/device.d.ts +1 -1
  41. package/es/components/eftposPay/store/index.d.ts +2 -2
  42. package/es/components/pay/toC/model.d.ts +9 -1
  43. package/es/components/schedules/model.d.ts +9 -1
  44. package/es/components/ticketBooking/components/ticketBooking/index.less +2 -1
  45. package/es/components/wallet/Detail/model.d.ts +13 -1
  46. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  47. package/es/components/wallet/PointCard/model.d.ts +13 -1
  48. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  49. package/es/components/wallet/Voucher/model.d.ts +13 -1
  50. package/es/components/wallet/model.d.ts +9 -1
  51. package/es/index.d.ts +3 -0
  52. package/es/index.js +4 -1
  53. package/es/plus/clientName/index.d.ts +4 -0
  54. package/es/plus/clientName/index.js +18 -0
  55. package/es/plus/clientName/index.less +10 -0
  56. package/es/plus/clientName/type.d.ts +13 -0
  57. package/es/plus/clientName/type.js +1 -0
  58. package/es/plus/clientName/utils.d.ts +2 -0
  59. package/es/plus/clientName/utils.js +18 -0
  60. package/es/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  61. package/es/plus/contactInfo/components/Avatar/index.js +30 -0
  62. package/es/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  63. package/es/plus/contactInfo/components/SwipeAction/index.js +360 -0
  64. package/es/plus/contactInfo/components/SwipeAction/index.less +74 -0
  65. package/es/plus/contactInfo/index.d.ts +6 -0
  66. package/es/plus/contactInfo/index.js +198 -0
  67. package/es/plus/contactInfo/index.less +621 -0
  68. package/es/plus/contactInfo/locales.d.ts +15 -0
  69. package/es/plus/contactInfo/locales.js +14 -0
  70. package/es/plus/contactInfo/types.d.ts +91 -0
  71. package/es/plus/contactInfo/types.js +1 -0
  72. package/es/plus/contactInfo/utils.d.ts +7 -0
  73. package/es/plus/contactInfo/utils.js +50 -0
  74. package/es/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  75. package/es/plus/contactInfoModal/ContactInfoContent.js +74 -0
  76. package/es/plus/contactInfoModal/index.d.ts +40 -0
  77. package/es/plus/contactInfoModal/index.js +154 -0
  78. package/es/plus/contactInfoModal/index.less +19 -0
  79. package/es/plus/contactInfoModal/locales.d.ts +66 -0
  80. package/es/plus/contactInfoModal/locales.js +65 -0
  81. package/es/pro/Login2.0/AuthModal.d.ts +143 -0
  82. package/es/pro/Login2.0/AuthModal.js +624 -0
  83. package/es/pro/Login2.0/Login2.d.ts +61 -0
  84. package/es/pro/Login2.0/Login2.js +2157 -0
  85. package/es/pro/Login2.0/Register2.d.ts +65 -0
  86. package/es/pro/Login2.0/Register2.js +1501 -0
  87. package/es/pro/Login2.0/components/ForgotPasswordFlow.d.ts +31 -0
  88. package/es/pro/Login2.0/components/ForgotPasswordFlow.js +330 -0
  89. package/es/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  90. package/es/pro/Login2.0/components/LegalTerms.js +51 -0
  91. package/es/pro/Login2.0/components/LegalTerms.less +74 -0
  92. package/es/pro/Login2.0/components/LoginCodeInput.d.ts +27 -0
  93. package/es/pro/Login2.0/components/LoginCodeInput.js +207 -0
  94. package/es/pro/Login2.0/components/OAuthButtonGroup.d.ts +22 -0
  95. package/es/pro/Login2.0/components/OAuthButtonGroup.js +55 -0
  96. package/es/pro/Login2.0/components/PhoneInput.d.ts +53 -0
  97. package/es/pro/Login2.0/components/PhoneInput.js +414 -0
  98. package/es/pro/Login2.0/components/PhoneInput.less +148 -0
  99. package/es/pro/Login2.0/components/phoneValidation.d.ts +17 -0
  100. package/es/pro/Login2.0/components/phoneValidation.js +228 -0
  101. package/es/pro/Login2.0/hooks/index.d.ts +2 -0
  102. package/es/pro/Login2.0/hooks/index.js +1 -0
  103. package/es/pro/Login2.0/hooks/usePasswordValidationRules.d.ts +24 -0
  104. package/es/pro/Login2.0/hooks/usePasswordValidationRules.js +87 -0
  105. package/es/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  106. package/es/pro/Login2.0/hooks/useRegisterFlow.js +158 -0
  107. package/es/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  108. package/es/pro/Login2.0/hooks/useRegistrationMethods.js +31 -0
  109. package/es/pro/Login2.0/index.js +8 -0
  110. package/es/pro/Login2.0/index.less +993 -0
  111. package/es/pro/Login2.0/locales.d.ts +543 -0
  112. package/es/pro/Login2.0/locales.js +622 -0
  113. package/es/pro/Login2.0/shared/Header.d.ts +11 -0
  114. package/es/pro/Login2.0/shared/Header.js +42 -0
  115. package/es/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  116. package/es/pro/Login2.0/shared/OAuthButtons.js +59 -0
  117. package/es/pro/Login2.0/shared/registerFlow.d.ts +116 -0
  118. package/es/pro/Login2.0/shared/registerFlow.js +171 -0
  119. package/es/pro/Login2.0/shared/types.d.ts +232 -0
  120. package/es/pro/Login2.0/shared/types.js +1 -0
  121. package/es/pro/Login2.0/steps/CodeInput.d.ts +24 -0
  122. package/es/pro/Login2.0/steps/CodeInput.js +209 -0
  123. package/es/pro/Login2.0/steps/EmailAlreadyRegistered.d.ts +12 -0
  124. package/es/pro/Login2.0/steps/EmailAlreadyRegistered.js +35 -0
  125. package/es/pro/Login2.0/steps/EmailLinkAlreadyUsed.d.ts +7 -0
  126. package/es/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +25 -0
  127. package/es/pro/Login2.0/steps/EmailLinkExpired.d.ts +9 -0
  128. package/es/pro/Login2.0/steps/EmailLinkExpired.js +33 -0
  129. package/es/pro/Login2.0/steps/SetPassword.d.ts +19 -0
  130. package/es/pro/Login2.0/steps/SetPassword.js +148 -0
  131. package/es/pro/Login2.0/steps/VerificationSuccess.d.ts +8 -0
  132. package/es/pro/Login2.0/steps/VerificationSuccess.js +35 -0
  133. package/es/pro/Login2.0/steps/VerifyingEmailLink.d.ts +7 -0
  134. package/es/pro/Login2.0/steps/VerifyingEmailLink.js +17 -0
  135. package/es/pro/Login2.0/steps/WaitEmailLink.d.ts +18 -0
  136. package/es/pro/Login2.0/steps/WaitEmailLink.js +54 -0
  137. package/es/pro/Login2.0/steps/index.d.ts +19 -0
  138. package/es/pro/Login2.0/steps/index.js +11 -0
  139. package/es/pro/Login2.0/steps/steps.less +423 -0
  140. package/es/pro/Login2.0/types.d.ts +167 -0
  141. package/es/pro/Login2.0/types.js +1 -0
  142. package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +1 -1
  143. package/lib/components/appointmentBooking/components/Cart/Item/index.js +5 -3
  144. package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +151 -13
  145. package/lib/components/appointmentBooking/components/ConfirmInformation/index.less +15 -0
  146. package/lib/components/appointmentBooking/hooks.d.ts +1 -0
  147. package/lib/components/appointmentBooking/hooks.js +73 -35
  148. package/lib/components/appointmentBooking/locales.d.ts +3 -0
  149. package/lib/components/appointmentBooking/locales.js +6 -3
  150. package/lib/components/booking/addons/model.d.ts +10 -1
  151. package/lib/components/booking/components/footer/index.js +4 -1
  152. package/lib/components/booking/components/footer/utils.js +70 -38
  153. package/lib/components/booking/forms/model.d.ts +10 -1
  154. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +1 -1
  155. package/lib/components/booking/info/clientVariant/vertical/index.js +34 -17
  156. package/lib/components/booking/info/main.js +5 -4
  157. package/lib/components/booking/info/model.d.ts +10 -1
  158. package/lib/components/booking/info/model.js +5 -0
  159. package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
  160. package/lib/components/booking/info2/index.js +5 -4
  161. package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
  162. package/lib/components/booking/info2/service/contactInfoMode/index.d.ts +2 -0
  163. package/lib/components/booking/info2/service/contactInfoMode/index.js +111 -0
  164. package/lib/components/booking/locales.d.ts +3 -0
  165. package/lib/components/booking/locales.js +9 -3
  166. package/lib/components/booking/model.d.ts +13 -1
  167. package/lib/components/booking/model.js +3 -0
  168. package/lib/components/booking/notes/model.d.ts +10 -1
  169. package/lib/components/booking/payments/model.d.ts +10 -1
  170. package/lib/components/eftposPay/amount.d.ts +1 -1
  171. package/lib/components/eftposPay/device.d.ts +1 -1
  172. package/lib/components/eftposPay/store/index.d.ts +2 -2
  173. package/lib/components/pay/toC/model.d.ts +9 -1
  174. package/lib/components/schedules/model.d.ts +9 -1
  175. package/lib/components/ticketBooking/components/ticketBooking/index.less +2 -1
  176. package/lib/components/wallet/Detail/model.d.ts +13 -1
  177. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  178. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  179. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  180. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  181. package/lib/components/wallet/model.d.ts +9 -1
  182. package/lib/index.d.ts +3 -0
  183. package/lib/index.js +13 -0
  184. package/lib/plus/clientName/index.d.ts +4 -0
  185. package/lib/plus/clientName/index.js +53 -0
  186. package/lib/plus/clientName/index.less +10 -0
  187. package/lib/plus/clientName/type.d.ts +13 -0
  188. package/lib/plus/clientName/type.js +17 -0
  189. package/lib/plus/clientName/utils.d.ts +2 -0
  190. package/lib/plus/clientName/utils.js +43 -0
  191. package/lib/plus/contactInfo/components/Avatar/index.d.ts +10 -0
  192. package/lib/plus/contactInfo/components/Avatar/index.js +56 -0
  193. package/lib/plus/contactInfo/components/SwipeAction/index.d.ts +46 -0
  194. package/lib/plus/contactInfo/components/SwipeAction/index.js +373 -0
  195. package/lib/plus/contactInfo/components/SwipeAction/index.less +74 -0
  196. package/lib/plus/contactInfo/index.d.ts +6 -0
  197. package/lib/plus/contactInfo/index.js +226 -0
  198. package/lib/plus/contactInfo/index.less +621 -0
  199. package/lib/plus/contactInfo/locales.d.ts +15 -0
  200. package/lib/plus/contactInfo/locales.js +38 -0
  201. package/lib/plus/contactInfo/types.d.ts +91 -0
  202. package/lib/plus/contactInfo/types.js +17 -0
  203. package/lib/plus/contactInfo/utils.d.ts +7 -0
  204. package/lib/plus/contactInfo/utils.js +64 -0
  205. package/lib/plus/contactInfoModal/ContactInfoContent.d.ts +3 -0
  206. package/lib/plus/contactInfoModal/ContactInfoContent.js +129 -0
  207. package/lib/plus/contactInfoModal/index.d.ts +40 -0
  208. package/lib/plus/contactInfoModal/index.js +138 -0
  209. package/lib/plus/contactInfoModal/index.less +19 -0
  210. package/lib/plus/contactInfoModal/locales.d.ts +66 -0
  211. package/lib/plus/contactInfoModal/locales.js +89 -0
  212. package/lib/pro/Login2.0/AuthModal.d.ts +143 -0
  213. package/lib/pro/Login2.0/AuthModal.js +498 -0
  214. package/lib/pro/Login2.0/Login2.d.ts +61 -0
  215. package/lib/pro/Login2.0/Login2.js +1468 -0
  216. package/lib/pro/Login2.0/Register2.d.ts +65 -0
  217. package/lib/pro/Login2.0/Register2.js +1062 -0
  218. package/lib/pro/Login2.0/components/ForgotPasswordFlow.d.ts +31 -0
  219. package/lib/pro/Login2.0/components/ForgotPasswordFlow.js +213 -0
  220. package/lib/pro/Login2.0/components/LegalTerms.d.ts +8 -0
  221. package/lib/pro/Login2.0/components/LegalTerms.js +76 -0
  222. package/lib/pro/Login2.0/components/LegalTerms.less +74 -0
  223. package/lib/pro/Login2.0/components/LoginCodeInput.d.ts +27 -0
  224. package/lib/pro/Login2.0/components/LoginCodeInput.js +161 -0
  225. package/lib/pro/Login2.0/components/OAuthButtonGroup.d.ts +22 -0
  226. package/lib/pro/Login2.0/components/OAuthButtonGroup.js +87 -0
  227. package/lib/pro/Login2.0/components/PhoneInput.d.ts +53 -0
  228. package/lib/pro/Login2.0/components/PhoneInput.js +263 -0
  229. package/lib/pro/Login2.0/components/PhoneInput.less +148 -0
  230. package/lib/pro/Login2.0/components/phoneValidation.d.ts +17 -0
  231. package/lib/pro/Login2.0/components/phoneValidation.js +153 -0
  232. package/lib/pro/Login2.0/hooks/index.d.ts +2 -0
  233. package/lib/pro/Login2.0/hooks/index.js +29 -0
  234. package/lib/pro/Login2.0/hooks/usePasswordValidationRules.d.ts +24 -0
  235. package/lib/pro/Login2.0/hooks/usePasswordValidationRules.js +140 -0
  236. package/lib/pro/Login2.0/hooks/useRegisterFlow.d.ts +39 -0
  237. package/lib/pro/Login2.0/hooks/useRegisterFlow.js +149 -0
  238. package/lib/pro/Login2.0/hooks/useRegistrationMethods.d.ts +9 -0
  239. package/lib/pro/Login2.0/hooks/useRegistrationMethods.js +51 -0
  240. package/lib/pro/Login2.0/index.js +45 -0
  241. package/lib/pro/Login2.0/index.less +993 -0
  242. package/lib/pro/Login2.0/locales.d.ts +543 -0
  243. package/lib/pro/Login2.0/locales.js +646 -0
  244. package/lib/pro/Login2.0/shared/Header.d.ts +11 -0
  245. package/lib/pro/Login2.0/shared/Header.js +81 -0
  246. package/lib/pro/Login2.0/shared/OAuthButtons.d.ts +11 -0
  247. package/lib/pro/Login2.0/shared/OAuthButtons.js +78 -0
  248. package/lib/pro/Login2.0/shared/registerFlow.d.ts +116 -0
  249. package/lib/pro/Login2.0/shared/registerFlow.js +235 -0
  250. package/lib/pro/Login2.0/shared/types.d.ts +232 -0
  251. package/lib/pro/Login2.0/shared/types.js +17 -0
  252. package/lib/pro/Login2.0/steps/CodeInput.d.ts +24 -0
  253. package/lib/pro/Login2.0/steps/CodeInput.js +160 -0
  254. package/lib/pro/Login2.0/steps/EmailAlreadyRegistered.d.ts +12 -0
  255. package/lib/pro/Login2.0/steps/EmailAlreadyRegistered.js +46 -0
  256. package/lib/pro/Login2.0/steps/EmailLinkAlreadyUsed.d.ts +7 -0
  257. package/lib/pro/Login2.0/steps/EmailLinkAlreadyUsed.js +51 -0
  258. package/lib/pro/Login2.0/steps/EmailLinkExpired.d.ts +9 -0
  259. package/lib/pro/Login2.0/steps/EmailLinkExpired.js +51 -0
  260. package/lib/pro/Login2.0/steps/SetPassword.d.ts +19 -0
  261. package/lib/pro/Login2.0/steps/SetPassword.js +131 -0
  262. package/lib/pro/Login2.0/steps/VerificationSuccess.d.ts +8 -0
  263. package/lib/pro/Login2.0/steps/VerificationSuccess.js +49 -0
  264. package/lib/pro/Login2.0/steps/VerifyingEmailLink.d.ts +7 -0
  265. package/lib/pro/Login2.0/steps/VerifyingEmailLink.js +41 -0
  266. package/lib/pro/Login2.0/steps/WaitEmailLink.d.ts +18 -0
  267. package/lib/pro/Login2.0/steps/WaitEmailLink.js +67 -0
  268. package/lib/pro/Login2.0/steps/index.d.ts +19 -0
  269. package/lib/pro/Login2.0/steps/index.js +60 -0
  270. package/lib/pro/Login2.0/steps/steps.less +423 -0
  271. package/lib/pro/Login2.0/types.d.ts +167 -0
  272. package/lib/pro/Login2.0/types.js +17 -0
  273. package/lowcode/authmodal/meta.ts +395 -0
  274. package/lowcode/contact-info/fragments/cardStyle.ts +68 -0
  275. package/lowcode/contact-info/fragments/nameStyle.ts +33 -0
  276. package/lowcode/contact-info/fragments/pisellAvatar.ts +103 -0
  277. package/lowcode/contact-info/fragments/textStyle.ts +33 -0
  278. package/lowcode/contact-info/meta.ts +199 -0
  279. package/lowcode/contact-info-modal/meta.ts +98 -0
  280. package/lowcode/login2/CONFIG.md +447 -0
  281. package/lowcode/login2/TEST_CONFIG.md +324 -0
  282. package/lowcode/login2/VERIFICATION_METHODS.md +364 -0
  283. package/lowcode/login2/meta.ts +560 -0
  284. package/lowcode/login2/snippets.ts +124 -0
  285. package/lowcode/register2/meta.ts +562 -0
  286. package/lowcode/register2/snippets.ts +257 -0
  287. package/package.json +7 -5
@@ -0,0 +1,414 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
+ import React, { useMemo } from 'react';
6
+ import { locales } from '@pisell/utils';
7
+ import "./PhoneInput.less";
8
+
9
+ /** 国家/地区配置(后端返回格式) */
10
+
11
+ /** 手机号对象格式 */
12
+
13
+ /** 值格式类型 */
14
+
15
+ /** 手机号输入组件属性 */
16
+
17
+ /** 默认国家/地区列表 */
18
+ var DEFAULT_COUNTRIES = [{
19
+ name: 'United States',
20
+ code: 'US',
21
+ calling_code: '1',
22
+ currency_code: 'USD'
23
+ }, {
24
+ name: 'China',
25
+ code: 'CN',
26
+ calling_code: '86',
27
+ currency_code: 'CNY'
28
+ }, {
29
+ name: 'United Kingdom',
30
+ code: 'GB',
31
+ calling_code: '44',
32
+ currency_code: 'GBP'
33
+ }, {
34
+ name: 'Australia',
35
+ code: 'AU',
36
+ calling_code: '61',
37
+ currency_code: 'AUD'
38
+ }, {
39
+ name: 'Canada',
40
+ code: 'CA',
41
+ calling_code: '1',
42
+ currency_code: 'CAD'
43
+ }, {
44
+ name: 'Japan',
45
+ code: 'JP',
46
+ calling_code: '81',
47
+ currency_code: 'JPY'
48
+ }, {
49
+ name: 'South Korea',
50
+ code: 'KR',
51
+ calling_code: '82',
52
+ currency_code: 'KRW'
53
+ }, {
54
+ name: 'Singapore',
55
+ code: 'SG',
56
+ calling_code: '65',
57
+ currency_code: 'SGD'
58
+ }, {
59
+ name: 'Hong Kong',
60
+ code: 'HK',
61
+ calling_code: '852',
62
+ currency_code: 'HKD'
63
+ }, {
64
+ name: 'Taiwan',
65
+ code: 'TW',
66
+ calling_code: '886',
67
+ currency_code: 'TWD'
68
+ }, {
69
+ name: 'Malaysia',
70
+ code: 'MY',
71
+ calling_code: '60',
72
+ currency_code: 'MYR'
73
+ }, {
74
+ name: 'Thailand',
75
+ code: 'TH',
76
+ calling_code: '66',
77
+ currency_code: 'THB'
78
+ }, {
79
+ name: 'Vietnam',
80
+ code: 'VN',
81
+ calling_code: '84',
82
+ currency_code: 'VND'
83
+ }, {
84
+ name: 'Philippines',
85
+ code: 'PH',
86
+ calling_code: '63',
87
+ currency_code: 'PHP'
88
+ }, {
89
+ name: 'Indonesia',
90
+ code: 'ID',
91
+ calling_code: '62',
92
+ currency_code: 'IDR'
93
+ }, {
94
+ name: 'India',
95
+ code: 'IN',
96
+ calling_code: '91',
97
+ currency_code: 'INR'
98
+ }, {
99
+ name: 'Germany',
100
+ code: 'DE',
101
+ calling_code: '49',
102
+ currency_code: 'EUR'
103
+ }, {
104
+ name: 'France',
105
+ code: 'FR',
106
+ calling_code: '33',
107
+ currency_code: 'EUR'
108
+ }, {
109
+ name: 'Italy',
110
+ code: 'IT',
111
+ calling_code: '39',
112
+ currency_code: 'EUR'
113
+ }, {
114
+ name: 'Spain',
115
+ code: 'ES',
116
+ calling_code: '34',
117
+ currency_code: 'EUR'
118
+ }];
119
+
120
+ /**
121
+ * 从浏览器检测用户的国家/地区
122
+ * 优先级:
123
+ * 1. Intl.DateTimeFormat 的 resolvedOptions
124
+ * 2. navigator.language 的地区后缀
125
+ * 3. 返回 null(使用默认值)
126
+ */
127
+ function detectUserCountry() {
128
+ try {
129
+ // 方法 1: 使用 Intl API 获取时区对应的地区
130
+ if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
131
+ var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
132
+
133
+ // 常见时区到国家代码的映射
134
+ var timeZoneMap = {
135
+ 'America/New_York': 'US',
136
+ 'America/Los_Angeles': 'US',
137
+ 'America/Chicago': 'US',
138
+ 'America/Denver': 'US',
139
+ 'America/Toronto': 'CA',
140
+ 'America/Vancouver': 'CA',
141
+ 'Europe/London': 'GB',
142
+ 'Europe/Paris': 'FR',
143
+ 'Europe/Berlin': 'DE',
144
+ 'Europe/Rome': 'IT',
145
+ 'Europe/Madrid': 'ES',
146
+ 'Asia/Shanghai': 'CN',
147
+ 'Asia/Hong_Kong': 'HK',
148
+ 'Asia/Taipei': 'TW',
149
+ 'Asia/Tokyo': 'JP',
150
+ 'Asia/Seoul': 'KR',
151
+ 'Asia/Singapore': 'SG',
152
+ 'Asia/Bangkok': 'TH',
153
+ 'Asia/Kuala_Lumpur': 'MY',
154
+ 'Asia/Jakarta': 'ID',
155
+ 'Asia/Manila': 'PH',
156
+ 'Asia/Ho_Chi_Minh': 'VN',
157
+ 'Asia/Kolkata': 'IN',
158
+ 'Australia/Sydney': 'AU',
159
+ 'Australia/Melbourne': 'AU'
160
+ };
161
+ if (timeZone && timeZoneMap[timeZone]) {
162
+ return timeZoneMap[timeZone];
163
+ }
164
+ }
165
+
166
+ // 方法 2: 从 navigator.language 提取国家代码
167
+ if (typeof navigator !== 'undefined' && navigator.language) {
168
+ var lang = navigator.language;
169
+ // 格式可能是 "zh-CN", "en-US", "ja-JP" 等
170
+ var parts = lang.split('-');
171
+ if (parts.length > 1) {
172
+ var countryCode = parts[1].toUpperCase();
173
+ return countryCode;
174
+ }
175
+
176
+ // 语言到国家的映射(当只有语言代码时)
177
+ var langMap = {
178
+ 'zh': 'CN',
179
+ 'en': 'US',
180
+ 'ja': 'JP',
181
+ 'ko': 'KR',
182
+ 'de': 'DE',
183
+ 'fr': 'FR',
184
+ 'es': 'ES',
185
+ 'it': 'IT',
186
+ 'th': 'TH',
187
+ 'vi': 'VN',
188
+ 'id': 'ID',
189
+ 'ms': 'MY'
190
+ };
191
+ if (langMap[parts[0]]) {
192
+ return langMap[parts[0]];
193
+ }
194
+ }
195
+ } catch (error) {
196
+ console.warn('Failed to detect user country:', error);
197
+ }
198
+ return null;
199
+ }
200
+
201
+ /**
202
+ * 手机号输入组件
203
+ *
204
+ * 支持国际区号选择和手机号输入
205
+ * 值格式:+区号+手机号,例如:+8613800138000 或 +15551234567
206
+ */
207
+ function PhoneInput(_ref) {
208
+ var value = _ref.value,
209
+ onChange = _ref.onChange,
210
+ placeholder = _ref.placeholder,
211
+ onKeyDown = _ref.onKeyDown,
212
+ _ref$size = _ref.size,
213
+ size = _ref$size === void 0 ? 'large' : _ref$size,
214
+ _ref$disabled = _ref.disabled,
215
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
216
+ _ref$className = _ref.className,
217
+ className = _ref$className === void 0 ? '' : _ref$className,
218
+ _ref$countries = _ref.countries,
219
+ countries = _ref$countries === void 0 ? DEFAULT_COUNTRIES : _ref$countries,
220
+ defaultCountry = _ref.defaultCountry,
221
+ _ref$valueFormat = _ref.valueFormat,
222
+ valueFormat = _ref$valueFormat === void 0 ? 'string' : _ref$valueFormat;
223
+ // 使用国际化的 placeholder
224
+ var effectivePlaceholder = placeholder || locales.getText('pisell-phone-input-placeholder');
225
+ // 将输入值标准化为字符串格式(内部统一使用字符串)
226
+ var normalizedValue = useMemo(function () {
227
+ if (!value) return '';
228
+
229
+ // 如果是对象格式,转换为字符串
230
+ if (_typeof(value) === 'object' && 'phone' in value) {
231
+ var phone = value.phone,
232
+ country_calling_code = value.country_calling_code;
233
+ return "+".concat(country_calling_code).concat(phone);
234
+ }
235
+
236
+ // 已经是字符串格式
237
+ return value;
238
+ }, [value]);
239
+
240
+ // 智能确定默认国家:检测到的国家 > 传入的 defaultCountry > 美国
241
+ var effectiveDefaultCountry = useMemo(function () {
242
+ var _countries$;
243
+ var detectedCountry = detectUserCountry();
244
+
245
+ // 1. 优先使用检测到的国家(如果在列表中存在)
246
+ if (detectedCountry && countries.some(function (c) {
247
+ return c.code === detectedCountry;
248
+ })) {
249
+ console.log('PhoneInput: Auto-detected country:', detectedCountry);
250
+ return detectedCountry;
251
+ }
252
+
253
+ // 2. 使用传入的 defaultCountry(如果在列表中存在)
254
+ if (defaultCountry && countries.some(function (c) {
255
+ return c.code === defaultCountry;
256
+ })) {
257
+ return defaultCountry;
258
+ }
259
+
260
+ // 3. 默认第一个,如果没有使用 AU 澳洲
261
+ return (countries === null || countries === void 0 || (_countries$ = countries[0]) === null || _countries$ === void 0 ? void 0 : _countries$.code) || 'AU';
262
+ }, [countries, defaultCountry]);
263
+
264
+ // 解析当前值,提取区号和手机号
265
+ var _useMemo = useMemo(function () {
266
+ if (!(countries !== null && countries !== void 0 && countries.length)) {
267
+ return {
268
+ dialCode: '',
269
+ phoneNumber: ''
270
+ };
271
+ }
272
+ if (!normalizedValue || !normalizedValue.startsWith('+')) {
273
+ // 如果没有值或格式不正确,使用默认国家的区号
274
+ var _defaultCountryOption = countries.find(function (c) {
275
+ return c.code === effectiveDefaultCountry;
276
+ }) || countries[0];
277
+ return {
278
+ dialCode: "+".concat(_defaultCountryOption.calling_code),
279
+ phoneNumber: ''
280
+ };
281
+ }
282
+
283
+ // 尝试匹配区号
284
+ var _iterator = _createForOfIteratorHelper(countries),
285
+ _step;
286
+ try {
287
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
288
+ var country = _step.value;
289
+ var countryDialCode = "+".concat(country.calling_code);
290
+ if (normalizedValue.startsWith(countryDialCode)) {
291
+ return {
292
+ dialCode: countryDialCode,
293
+ phoneNumber: normalizedValue.slice(countryDialCode.length)
294
+ };
295
+ }
296
+ }
297
+
298
+ // 如果没有匹配到,使用默认国家
299
+ } catch (err) {
300
+ _iterator.e(err);
301
+ } finally {
302
+ _iterator.f();
303
+ }
304
+ var defaultCountryOption = countries.find(function (c) {
305
+ return c.code === effectiveDefaultCountry;
306
+ }) || countries[0];
307
+ return {
308
+ dialCode: "+".concat(defaultCountryOption.calling_code),
309
+ phoneNumber: normalizedValue.startsWith('+') ? normalizedValue.slice(1) : normalizedValue
310
+ };
311
+ }, [normalizedValue, countries, effectiveDefaultCountry]),
312
+ currentDialCode = _useMemo.dialCode,
313
+ currentPhoneNumber = _useMemo.phoneNumber;
314
+
315
+ // 当前选中的国家/地区
316
+ var currentCountry = useMemo(function () {
317
+ return countries.find(function (c) {
318
+ return "+".concat(c.calling_code) === currentDialCode;
319
+ }) || countries[0];
320
+ }, [currentDialCode, countries]);
321
+
322
+ // 格式化输出值(根据 valueFormat 返回字符串或对象)
323
+ var formatOutputValue = function formatOutputValue(dialCode, phoneNumber) {
324
+ var fullString = "".concat(dialCode).concat(phoneNumber);
325
+ if (valueFormat === 'object') {
326
+ // 对象格式:{ phone: "13800138000", country_calling_code: "86" }
327
+ // 确保返回的数据都是字符串格式
328
+ return {
329
+ phone: String(phoneNumber || ''),
330
+ country_calling_code: String(dialCode.replace('+', '') || '') // 去掉 + 号并确保是字符串
331
+ };
332
+ }
333
+
334
+ // 字符串格式:"+8613800138000"
335
+ return fullString;
336
+ };
337
+
338
+ // 处理区号变化
339
+ var handleDialCodeChange = function handleDialCodeChange(e) {
340
+ var newDialCode = e.target.value;
341
+ var newValue = formatOutputValue(newDialCode, currentPhoneNumber);
342
+ onChange === null || onChange === void 0 || onChange(newValue);
343
+ };
344
+
345
+ // 处理手机号输入变化
346
+ var handlePhoneNumberChange = function handlePhoneNumberChange(e) {
347
+ var inputValue = e.target.value;
348
+
349
+ // 检测输入值是否包含当前区号前缀(处理浏览器自动填充的情况)
350
+ // 情况1: 输入值以 +86 开头,当前区号也是 +86
351
+ // 情况2: 输入值以 86 开头(无+号),当前区号是 +86
352
+ var dialCodeWithoutPlus = currentDialCode.replace('+', ''); // 去掉 + 号,用于匹配
353
+
354
+ // 如果输入值以 + 号开头,检查是否以当前区号开头
355
+ if (inputValue.startsWith('+')) {
356
+ if (inputValue.startsWith(currentDialCode)) {
357
+ // 输入值以当前区号开头,去除区号部分
358
+ inputValue = inputValue.slice(currentDialCode.length);
359
+ }
360
+ } else if (inputValue.startsWith(dialCodeWithoutPlus)) {
361
+ // 输入值以区号数字开头(无+号),去除区号部分
362
+ inputValue = inputValue.slice(dialCodeWithoutPlus.length);
363
+ }
364
+
365
+ // 只保留数字
366
+ var newPhoneNumber = inputValue.replace(/[^\d]/g, '');
367
+ var newValue = formatOutputValue(currentDialCode, newPhoneNumber);
368
+ onChange === null || onChange === void 0 || onChange(newValue);
369
+ };
370
+ return /*#__PURE__*/React.createElement("div", {
371
+ className: "phone-input-wrapper ".concat(className)
372
+ }, /*#__PURE__*/React.createElement("div", {
373
+ className: "phone-input-container"
374
+ }, /*#__PURE__*/React.createElement("div", {
375
+ className: "phone-input-prefix"
376
+ }, /*#__PURE__*/React.createElement("span", {
377
+ className: "phone-input-country-display"
378
+ }, currentCountry === null || currentCountry === void 0 ? void 0 : currentCountry.code, "(", currentDialCode, ")"), /*#__PURE__*/React.createElement("select", {
379
+ className: "phone-input-select",
380
+ value: currentDialCode,
381
+ onChange: handleDialCodeChange,
382
+ disabled: disabled
383
+ }, countries.map(function (country) {
384
+ return /*#__PURE__*/React.createElement("option", {
385
+ key: country.code,
386
+ value: "+".concat(country.calling_code)
387
+ }, country.code, " +", country.calling_code);
388
+ })), /*#__PURE__*/React.createElement("svg", {
389
+ className: "phone-input-arrow",
390
+ width: "12",
391
+ height: "12",
392
+ viewBox: "0 0 12 12",
393
+ fill: "none",
394
+ xmlns: "http://www.w3.org/2000/svg"
395
+ }, /*#__PURE__*/React.createElement("path", {
396
+ d: "M3 4.5L6 7.5L9 4.5",
397
+ stroke: "currentColor",
398
+ strokeWidth: "1.5",
399
+ strokeLinecap: "round",
400
+ strokeLinejoin: "round"
401
+ }))), /*#__PURE__*/React.createElement("div", {
402
+ className: "phone-input-divider"
403
+ }), /*#__PURE__*/React.createElement("input", {
404
+ type: "tel",
405
+ className: "phone-input-field phone-input-field-".concat(size),
406
+ value: currentPhoneNumber,
407
+ onChange: handlePhoneNumberChange,
408
+ onKeyDown: onKeyDown,
409
+ placeholder: effectivePlaceholder,
410
+ disabled: disabled,
411
+ autoComplete: "tel"
412
+ })));
413
+ }
414
+ export default PhoneInput;
@@ -0,0 +1,148 @@
1
+ .phone-input-wrapper {
2
+ width: 100%;
3
+
4
+ .phone-input-container {
5
+ display: flex;
6
+ align-items: center;
7
+ width: 100%;
8
+ height: 44px;
9
+ padding: 0 16px;
10
+ background: #FFFFFF;
11
+ border: 1px solid #D0D5DD;
12
+ border-radius: 8px;
13
+ transition: all 0.2s ease;
14
+
15
+ &:hover {
16
+ border-color: #98A2B3;
17
+ }
18
+
19
+ &:focus-within {
20
+ border-color: var(--theme-color, #7F56D9);
21
+ box-shadow: 0px 0px 0px 4px rgba(127, 86, 217, 0.12);
22
+ }
23
+ }
24
+
25
+ .phone-input-prefix {
26
+ position: relative;
27
+ display: flex;
28
+ align-items: center;
29
+ flex-shrink: 0;
30
+ gap: 6px;
31
+ cursor: pointer;
32
+ }
33
+
34
+ .phone-input-country-display {
35
+ font-size: 14px;
36
+ font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
37
+ font-weight: 400;
38
+ line-height: 20px;
39
+ color: #344054;
40
+ pointer-events: none;
41
+ white-space: nowrap;
42
+ }
43
+
44
+ .phone-input-select {
45
+ position: absolute;
46
+ left: 0;
47
+ top: 0;
48
+ width: 100%;
49
+ height: 100%;
50
+ opacity: 0;
51
+ cursor: pointer;
52
+ font-size: 14px;
53
+ font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
54
+
55
+ &:disabled {
56
+ cursor: not-allowed;
57
+ }
58
+ }
59
+
60
+ .phone-input-arrow {
61
+ flex-shrink: 0;
62
+ color: #667085;
63
+ pointer-events: none;
64
+ }
65
+
66
+ .phone-input-divider {
67
+ width: 1px;
68
+ height: 24px;
69
+ background: #D0D5DD;
70
+ margin: 0 12px;
71
+ flex-shrink: 0;
72
+ }
73
+
74
+ .phone-input-field {
75
+ flex: 1;
76
+ border: none;
77
+ outline: none;
78
+ background: transparent;
79
+ font-size: 16px;
80
+ font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
81
+ font-weight: 400;
82
+ line-height: 24px;
83
+ color: #101828;
84
+ min-width: 0;
85
+
86
+ &::placeholder {
87
+ color: #98A2B3;
88
+ }
89
+
90
+ &:disabled {
91
+ cursor: not-allowed;
92
+ color: #98A2B3;
93
+ }
94
+
95
+ // 移除 number 类型输入框的上下箭头
96
+ &::-webkit-outer-spin-button,
97
+ &::-webkit-inner-spin-button {
98
+ -webkit-appearance: none;
99
+ margin: 0;
100
+ }
101
+
102
+ &[type='number'] {
103
+ -moz-appearance: textfield;
104
+ }
105
+ }
106
+
107
+ // 大小变体
108
+ .phone-input-field-large {
109
+ font-size: 16px;
110
+ line-height: 24px;
111
+ }
112
+
113
+ .phone-input-field-middle {
114
+ font-size: 14px;
115
+ line-height: 22px;
116
+ }
117
+
118
+ .phone-input-field-small {
119
+ font-size: 14px;
120
+ line-height: 20px;
121
+ }
122
+
123
+ // 禁用状态
124
+ &.phone-input-disabled {
125
+ .phone-input-container {
126
+ background: #F9FAFB;
127
+ border-color: #D0D5DD;
128
+ cursor: not-allowed;
129
+
130
+ &:hover {
131
+ border-color: #D0D5DD;
132
+ }
133
+ }
134
+ }
135
+
136
+ // 错误状态
137
+ &.phone-input-error {
138
+ .phone-input-container {
139
+ border-color: #F04438;
140
+
141
+ &:focus-within {
142
+ border-color: #F04438;
143
+ box-shadow: 0px 0px 0px 4px rgba(240, 68, 56, 0.12);
144
+ }
145
+ }
146
+ }
147
+ }
148
+
@@ -0,0 +1,17 @@
1
+ import { PhoneValueObject } from './PhoneInput';
2
+ declare type GetTextFunction = (key: string) => string;
3
+ /**
4
+ * 手机号校验函数,用于 Ant Design Form 的 rules
5
+ * @param value 手机号值,可以是字符串或对象格式
6
+ * @param getText 国际化文本获取函数
7
+ * @returns Promise<void> 校验通过时 resolve,失败时 reject 并返回错误信息
8
+ */
9
+ export declare const validatePhoneNumber: (value: string | PhoneValueObject, getText: GetTextFunction) => Promise<void>;
10
+ /**
11
+ * 创建手机号校验规则,用于 Form.Item 的 rules 属性
12
+ * @param getText 国际化文本获取函数
13
+ * @param required 是否必填
14
+ * @returns Form 校验规则数组
15
+ */
16
+ export declare const createPhoneValidationRules: (getText: GetTextFunction, required?: boolean) => any[];
17
+ export {};