primereact 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (667) hide show
  1. package/LICENSE.md +1 -1
  2. package/accordion/accordion.cjs.js +15 -15
  3. package/accordion/accordion.cjs.min.js +1 -1
  4. package/accordion/accordion.esm.js +15 -15
  5. package/accordion/accordion.esm.min.js +1 -1
  6. package/accordion/accordion.js +15 -15
  7. package/accordion/accordion.min.js +1 -1
  8. package/api/api.cjs.js +27 -6
  9. package/api/api.cjs.min.js +1 -1
  10. package/api/api.d.ts +1 -0
  11. package/api/api.esm.js +27 -6
  12. package/api/api.esm.min.js +1 -1
  13. package/api/api.js +27 -6
  14. package/api/api.min.js +1 -1
  15. package/autocomplete/autocomplete.cjs.js +18 -18
  16. package/autocomplete/autocomplete.cjs.min.js +1 -1
  17. package/autocomplete/autocomplete.esm.js +18 -18
  18. package/autocomplete/autocomplete.esm.min.js +1 -1
  19. package/autocomplete/autocomplete.js +18 -18
  20. package/autocomplete/autocomplete.min.js +1 -1
  21. package/avatar/avatar.cjs.js +11 -11
  22. package/avatar/avatar.cjs.min.js +1 -1
  23. package/avatar/avatar.esm.js +11 -11
  24. package/avatar/avatar.esm.min.js +1 -1
  25. package/avatar/avatar.js +11 -11
  26. package/avatar/avatar.min.js +1 -1
  27. package/avatargroup/avatargroup.cjs.js +11 -11
  28. package/avatargroup/avatargroup.cjs.min.js +1 -1
  29. package/avatargroup/avatargroup.esm.js +11 -11
  30. package/avatargroup/avatargroup.esm.min.js +1 -1
  31. package/avatargroup/avatargroup.js +11 -11
  32. package/avatargroup/avatargroup.min.js +1 -1
  33. package/badge/badge.cjs.js +11 -11
  34. package/badge/badge.cjs.min.js +1 -1
  35. package/badge/badge.esm.js +11 -11
  36. package/badge/badge.esm.min.js +1 -1
  37. package/badge/badge.js +11 -11
  38. package/badge/badge.min.js +1 -1
  39. package/blockui/blockui.cjs.js +11 -11
  40. package/blockui/blockui.cjs.min.js +1 -1
  41. package/blockui/blockui.esm.js +11 -11
  42. package/blockui/blockui.esm.min.js +1 -1
  43. package/blockui/blockui.js +11 -11
  44. package/blockui/blockui.min.js +1 -1
  45. package/breadcrumb/breadcrumb.cjs.js +11 -11
  46. package/breadcrumb/breadcrumb.cjs.min.js +1 -1
  47. package/breadcrumb/breadcrumb.esm.js +11 -11
  48. package/breadcrumb/breadcrumb.esm.min.js +1 -1
  49. package/breadcrumb/breadcrumb.js +11 -11
  50. package/breadcrumb/breadcrumb.min.js +1 -1
  51. package/button/button.cjs.js +13 -13
  52. package/button/button.cjs.min.js +1 -1
  53. package/button/button.esm.js +13 -13
  54. package/button/button.esm.min.js +1 -1
  55. package/button/button.js +13 -13
  56. package/button/button.min.js +1 -1
  57. package/calendar/calendar.cjs.js +17 -17
  58. package/calendar/calendar.cjs.min.js +1 -1
  59. package/calendar/calendar.esm.js +17 -17
  60. package/calendar/calendar.esm.min.js +1 -1
  61. package/calendar/calendar.js +17 -17
  62. package/calendar/calendar.min.js +1 -1
  63. package/captcha/captcha.cjs.js +11 -11
  64. package/captcha/captcha.cjs.min.js +1 -1
  65. package/captcha/captcha.esm.js +11 -11
  66. package/captcha/captcha.esm.min.js +1 -1
  67. package/captcha/captcha.js +11 -11
  68. package/captcha/captcha.min.js +1 -1
  69. package/card/card.cjs.js +11 -11
  70. package/card/card.cjs.min.js +1 -1
  71. package/card/card.esm.js +11 -11
  72. package/card/card.esm.min.js +1 -1
  73. package/card/card.js +11 -11
  74. package/card/card.min.js +1 -1
  75. package/carousel/carousel.cjs.js +16 -14
  76. package/carousel/carousel.cjs.min.js +1 -1
  77. package/carousel/carousel.esm.js +15 -14
  78. package/carousel/carousel.esm.min.js +1 -1
  79. package/carousel/carousel.js +17 -16
  80. package/carousel/carousel.min.js +1 -1
  81. package/cascadeselect/cascadeselect.cjs.js +14 -14
  82. package/cascadeselect/cascadeselect.cjs.min.js +1 -1
  83. package/cascadeselect/cascadeselect.esm.js +14 -14
  84. package/cascadeselect/cascadeselect.esm.min.js +1 -1
  85. package/cascadeselect/cascadeselect.js +14 -14
  86. package/cascadeselect/cascadeselect.min.js +1 -1
  87. package/chart/chart.cjs.js +13 -13
  88. package/chart/chart.cjs.min.js +1 -1
  89. package/chart/chart.esm.js +13 -13
  90. package/chart/chart.esm.min.js +1 -1
  91. package/chart/chart.js +13 -13
  92. package/chart/chart.min.js +1 -1
  93. package/checkbox/checkbox.cjs.js +13 -13
  94. package/checkbox/checkbox.cjs.min.js +1 -1
  95. package/checkbox/checkbox.esm.js +13 -13
  96. package/checkbox/checkbox.esm.min.js +1 -1
  97. package/checkbox/checkbox.js +13 -13
  98. package/checkbox/checkbox.min.js +1 -1
  99. package/chip/chip.cjs.js +11 -11
  100. package/chip/chip.cjs.min.js +1 -1
  101. package/chip/chip.esm.js +11 -11
  102. package/chip/chip.esm.min.js +1 -1
  103. package/chip/chip.js +11 -11
  104. package/chip/chip.min.js +1 -1
  105. package/chips/chips.cjs.js +13 -13
  106. package/chips/chips.cjs.min.js +1 -1
  107. package/chips/chips.esm.js +13 -13
  108. package/chips/chips.esm.min.js +1 -1
  109. package/chips/chips.js +13 -13
  110. package/chips/chips.min.js +1 -1
  111. package/colorpicker/colorpicker.cjs.js +15 -15
  112. package/colorpicker/colorpicker.cjs.min.js +1 -1
  113. package/colorpicker/colorpicker.esm.js +15 -15
  114. package/colorpicker/colorpicker.esm.min.js +1 -1
  115. package/colorpicker/colorpicker.js +15 -15
  116. package/colorpicker/colorpicker.min.js +1 -1
  117. package/column/column.cjs.js +31 -12
  118. package/column/column.cjs.min.js +1 -1
  119. package/column/column.d.ts +4 -0
  120. package/column/column.esm.js +31 -12
  121. package/column/column.esm.min.js +1 -1
  122. package/column/column.js +31 -12
  123. package/column/column.min.js +1 -1
  124. package/columngroup/columngroup.cjs.js +28 -12
  125. package/columngroup/columngroup.cjs.min.js +1 -1
  126. package/columngroup/columngroup.esm.js +28 -12
  127. package/columngroup/columngroup.esm.min.js +1 -1
  128. package/columngroup/columngroup.js +28 -12
  129. package/columngroup/columngroup.min.js +1 -1
  130. package/confirmdialog/confirmdialog.cjs.js +13 -13
  131. package/confirmdialog/confirmdialog.cjs.min.js +1 -1
  132. package/confirmdialog/confirmdialog.esm.js +13 -13
  133. package/confirmdialog/confirmdialog.esm.min.js +1 -1
  134. package/confirmdialog/confirmdialog.js +13 -13
  135. package/confirmdialog/confirmdialog.min.js +1 -1
  136. package/confirmpopup/confirmpopup.cjs.js +14 -14
  137. package/confirmpopup/confirmpopup.cjs.min.js +1 -1
  138. package/confirmpopup/confirmpopup.esm.js +14 -14
  139. package/confirmpopup/confirmpopup.esm.min.js +1 -1
  140. package/confirmpopup/confirmpopup.js +14 -14
  141. package/confirmpopup/confirmpopup.min.js +1 -1
  142. package/contextmenu/contextmenu.cjs.js +13 -13
  143. package/contextmenu/contextmenu.cjs.min.js +1 -1
  144. package/contextmenu/contextmenu.esm.js +13 -13
  145. package/contextmenu/contextmenu.esm.min.js +1 -1
  146. package/contextmenu/contextmenu.js +13 -13
  147. package/contextmenu/contextmenu.min.js +1 -1
  148. package/core/core.js +326 -276
  149. package/core/core.min.js +18 -18
  150. package/csstransition/csstransition.cjs.js +17 -17
  151. package/csstransition/csstransition.cjs.min.js +1 -1
  152. package/csstransition/csstransition.esm.js +17 -17
  153. package/csstransition/csstransition.esm.min.js +1 -1
  154. package/csstransition/csstransition.js +17 -17
  155. package/csstransition/csstransition.min.js +1 -1
  156. package/datascroller/datascroller.cjs.js +11 -11
  157. package/datascroller/datascroller.cjs.min.js +1 -1
  158. package/datascroller/datascroller.esm.js +11 -11
  159. package/datascroller/datascroller.esm.min.js +1 -1
  160. package/datascroller/datascroller.js +11 -11
  161. package/datascroller/datascroller.min.js +1 -1
  162. package/datatable/datatable.cjs.js +315 -200
  163. package/datatable/datatable.cjs.min.js +1 -1
  164. package/datatable/datatable.d.ts +8 -0
  165. package/datatable/datatable.esm.js +318 -203
  166. package/datatable/datatable.esm.min.js +1 -1
  167. package/datatable/datatable.js +315 -200
  168. package/datatable/datatable.min.css +1 -1
  169. package/datatable/datatable.min.js +1 -1
  170. package/dataview/dataview.cjs.js +11 -11
  171. package/dataview/dataview.cjs.min.js +1 -1
  172. package/dataview/dataview.esm.js +11 -11
  173. package/dataview/dataview.esm.min.js +1 -1
  174. package/dataview/dataview.js +11 -11
  175. package/dataview/dataview.min.js +1 -1
  176. package/deferredcontent/deferredcontent.cjs.js +11 -11
  177. package/deferredcontent/deferredcontent.cjs.min.js +1 -1
  178. package/deferredcontent/deferredcontent.esm.js +11 -11
  179. package/deferredcontent/deferredcontent.esm.min.js +1 -1
  180. package/deferredcontent/deferredcontent.js +11 -11
  181. package/deferredcontent/deferredcontent.min.js +1 -1
  182. package/dialog/dialog.cjs.js +19 -15
  183. package/dialog/dialog.cjs.min.js +1 -1
  184. package/dialog/dialog.esm.js +19 -15
  185. package/dialog/dialog.esm.min.js +1 -1
  186. package/dialog/dialog.js +19 -15
  187. package/dialog/dialog.min.js +1 -1
  188. package/divider/divider.cjs.js +11 -11
  189. package/divider/divider.cjs.min.js +1 -1
  190. package/divider/divider.esm.js +11 -11
  191. package/divider/divider.esm.min.js +1 -1
  192. package/divider/divider.js +11 -11
  193. package/divider/divider.min.js +1 -1
  194. package/dock/dock.cjs.js +11 -11
  195. package/dock/dock.cjs.min.js +1 -1
  196. package/dock/dock.esm.js +11 -11
  197. package/dock/dock.esm.min.js +1 -1
  198. package/dock/dock.js +11 -11
  199. package/dock/dock.min.js +1 -1
  200. package/dropdown/dropdown.cjs.js +21 -21
  201. package/dropdown/dropdown.cjs.min.js +1 -1
  202. package/dropdown/dropdown.esm.js +21 -21
  203. package/dropdown/dropdown.esm.min.js +1 -1
  204. package/dropdown/dropdown.js +21 -21
  205. package/dropdown/dropdown.min.js +1 -1
  206. package/editor/editor.cjs.js +15 -15
  207. package/editor/editor.cjs.min.js +1 -1
  208. package/editor/editor.esm.js +15 -15
  209. package/editor/editor.esm.min.js +1 -1
  210. package/editor/editor.js +15 -15
  211. package/editor/editor.min.js +1 -1
  212. package/fieldset/fieldset.cjs.js +14 -14
  213. package/fieldset/fieldset.cjs.min.js +1 -1
  214. package/fieldset/fieldset.esm.js +14 -14
  215. package/fieldset/fieldset.esm.min.js +1 -1
  216. package/fieldset/fieldset.js +14 -14
  217. package/fieldset/fieldset.min.js +1 -1
  218. package/fileupload/fileupload.cjs.js +16 -13
  219. package/fileupload/fileupload.cjs.min.js +1 -1
  220. package/fileupload/fileupload.d.ts +2 -0
  221. package/fileupload/fileupload.esm.js +16 -13
  222. package/fileupload/fileupload.esm.min.js +1 -1
  223. package/fileupload/fileupload.js +16 -13
  224. package/fileupload/fileupload.min.js +1 -1
  225. package/fullcalendar/fullcalendar.cjs.js +11 -11
  226. package/fullcalendar/fullcalendar.cjs.min.js +1 -1
  227. package/fullcalendar/fullcalendar.esm.js +11 -11
  228. package/fullcalendar/fullcalendar.esm.min.js +1 -1
  229. package/fullcalendar/fullcalendar.js +11 -11
  230. package/fullcalendar/fullcalendar.min.js +1 -1
  231. package/galleria/galleria.cjs.js +16 -16
  232. package/galleria/galleria.cjs.min.js +1 -1
  233. package/galleria/galleria.esm.js +16 -16
  234. package/galleria/galleria.esm.min.js +1 -1
  235. package/galleria/galleria.js +17 -17
  236. package/galleria/galleria.min.js +1 -1
  237. package/gmap/gmap.cjs.js +12 -12
  238. package/gmap/gmap.cjs.min.js +1 -1
  239. package/gmap/gmap.esm.js +12 -12
  240. package/gmap/gmap.esm.min.js +1 -1
  241. package/gmap/gmap.js +12 -12
  242. package/gmap/gmap.min.js +1 -1
  243. package/image/image.cjs.js +39 -18
  244. package/image/image.cjs.min.js +1 -1
  245. package/image/image.d.ts +1 -0
  246. package/image/image.esm.js +40 -19
  247. package/image/image.esm.min.js +1 -1
  248. package/image/image.js +39 -18
  249. package/image/image.min.js +1 -1
  250. package/inplace/inplace.cjs.js +11 -11
  251. package/inplace/inplace.cjs.min.js +1 -1
  252. package/inplace/inplace.esm.js +11 -11
  253. package/inplace/inplace.esm.min.js +1 -1
  254. package/inplace/inplace.js +11 -11
  255. package/inplace/inplace.min.js +1 -1
  256. package/inputmask/inputmask.cjs.js +13 -13
  257. package/inputmask/inputmask.cjs.min.js +1 -1
  258. package/inputmask/inputmask.esm.js +13 -13
  259. package/inputmask/inputmask.esm.min.js +1 -1
  260. package/inputmask/inputmask.js +13 -13
  261. package/inputmask/inputmask.min.js +1 -1
  262. package/inputnumber/inputnumber.cjs.js +32 -29
  263. package/inputnumber/inputnumber.cjs.min.js +1 -1
  264. package/inputnumber/inputnumber.esm.js +32 -29
  265. package/inputnumber/inputnumber.esm.min.js +1 -1
  266. package/inputnumber/inputnumber.js +32 -29
  267. package/inputnumber/inputnumber.min.js +1 -1
  268. package/inputswitch/inputswitch.cjs.js +13 -13
  269. package/inputswitch/inputswitch.cjs.min.js +1 -1
  270. package/inputswitch/inputswitch.esm.js +13 -13
  271. package/inputswitch/inputswitch.esm.min.js +1 -1
  272. package/inputswitch/inputswitch.js +13 -13
  273. package/inputswitch/inputswitch.min.js +1 -1
  274. package/inputtext/inputtext.cjs.js +13 -13
  275. package/inputtext/inputtext.cjs.min.js +1 -1
  276. package/inputtext/inputtext.esm.js +13 -13
  277. package/inputtext/inputtext.esm.min.js +1 -1
  278. package/inputtext/inputtext.js +13 -13
  279. package/inputtext/inputtext.min.js +1 -1
  280. package/inputtextarea/inputtextarea.cjs.js +13 -13
  281. package/inputtextarea/inputtextarea.cjs.min.js +1 -1
  282. package/inputtextarea/inputtextarea.esm.js +13 -13
  283. package/inputtextarea/inputtextarea.esm.min.js +1 -1
  284. package/inputtextarea/inputtextarea.js +13 -13
  285. package/inputtextarea/inputtextarea.min.js +1 -1
  286. package/keyfilter/keyfilter.cjs.js +4 -1
  287. package/keyfilter/keyfilter.cjs.min.js +1 -1
  288. package/keyfilter/keyfilter.esm.js +4 -1
  289. package/keyfilter/keyfilter.esm.min.js +1 -1
  290. package/keyfilter/keyfilter.js +4 -1
  291. package/keyfilter/keyfilter.min.js +1 -1
  292. package/knob/knob.cjs.js +11 -11
  293. package/knob/knob.cjs.min.js +1 -1
  294. package/knob/knob.esm.js +11 -11
  295. package/knob/knob.esm.min.js +1 -1
  296. package/knob/knob.js +11 -11
  297. package/knob/knob.min.js +1 -1
  298. package/listbox/listbox.cjs.js +14 -14
  299. package/listbox/listbox.cjs.min.js +1 -1
  300. package/listbox/listbox.esm.js +14 -14
  301. package/listbox/listbox.esm.min.js +1 -1
  302. package/listbox/listbox.js +14 -14
  303. package/listbox/listbox.min.js +1 -1
  304. package/megamenu/megamenu.cjs.js +11 -11
  305. package/megamenu/megamenu.cjs.min.js +1 -1
  306. package/megamenu/megamenu.esm.js +11 -11
  307. package/megamenu/megamenu.esm.min.js +1 -1
  308. package/megamenu/megamenu.js +11 -11
  309. package/megamenu/megamenu.min.js +1 -1
  310. package/mention/mention.cjs.js +16 -16
  311. package/mention/mention.cjs.min.js +1 -1
  312. package/mention/mention.esm.js +16 -16
  313. package/mention/mention.esm.min.js +1 -1
  314. package/mention/mention.js +16 -16
  315. package/mention/mention.min.js +1 -1
  316. package/menu/menu.cjs.js +12 -12
  317. package/menu/menu.cjs.min.js +1 -1
  318. package/menu/menu.esm.js +12 -12
  319. package/menu/menu.esm.min.js +1 -1
  320. package/menu/menu.js +12 -12
  321. package/menu/menu.min.js +1 -1
  322. package/menubar/menubar.cjs.js +11 -11
  323. package/menubar/menubar.cjs.min.js +1 -1
  324. package/menubar/menubar.esm.js +11 -11
  325. package/menubar/menubar.esm.min.js +1 -1
  326. package/menubar/menubar.js +11 -11
  327. package/menubar/menubar.min.js +1 -1
  328. package/message/message.cjs.js +11 -11
  329. package/message/message.cjs.min.js +1 -1
  330. package/message/message.esm.js +11 -11
  331. package/message/message.esm.min.js +1 -1
  332. package/message/message.js +11 -11
  333. package/message/message.min.js +1 -1
  334. package/messages/messages.cjs.js +11 -11
  335. package/messages/messages.cjs.min.js +1 -1
  336. package/messages/messages.esm.js +11 -11
  337. package/messages/messages.esm.min.js +1 -1
  338. package/messages/messages.js +11 -11
  339. package/messages/messages.min.js +1 -1
  340. package/multiselect/multiselect.cjs.js +20 -20
  341. package/multiselect/multiselect.cjs.min.js +1 -1
  342. package/multiselect/multiselect.esm.js +20 -20
  343. package/multiselect/multiselect.esm.min.js +1 -1
  344. package/multiselect/multiselect.js +20 -20
  345. package/multiselect/multiselect.min.js +1 -1
  346. package/multistatecheckbox/multistatecheckbox.cjs.js +13 -13
  347. package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
  348. package/multistatecheckbox/multistatecheckbox.esm.js +13 -13
  349. package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
  350. package/multistatecheckbox/multistatecheckbox.js +13 -13
  351. package/multistatecheckbox/multistatecheckbox.min.js +1 -1
  352. package/orderlist/orderlist.cjs.js +11 -11
  353. package/orderlist/orderlist.cjs.min.js +1 -1
  354. package/orderlist/orderlist.esm.js +11 -11
  355. package/orderlist/orderlist.esm.min.js +1 -1
  356. package/orderlist/orderlist.js +11 -11
  357. package/orderlist/orderlist.min.js +1 -1
  358. package/organizationchart/organizationchart.cjs.js +11 -11
  359. package/organizationchart/organizationchart.cjs.min.js +1 -1
  360. package/organizationchart/organizationchart.esm.js +11 -11
  361. package/organizationchart/organizationchart.esm.min.js +1 -1
  362. package/organizationchart/organizationchart.js +11 -11
  363. package/organizationchart/organizationchart.min.js +1 -1
  364. package/overlaypanel/overlaypanel.cjs.js +13 -13
  365. package/overlaypanel/overlaypanel.cjs.min.js +1 -1
  366. package/overlaypanel/overlaypanel.esm.js +13 -13
  367. package/overlaypanel/overlaypanel.esm.min.js +1 -1
  368. package/overlaypanel/overlaypanel.js +13 -13
  369. package/overlaypanel/overlaypanel.min.js +1 -1
  370. package/package.json +1 -1
  371. package/paginator/paginator.cjs.js +13 -13
  372. package/paginator/paginator.cjs.min.js +1 -1
  373. package/paginator/paginator.esm.js +13 -13
  374. package/paginator/paginator.esm.min.js +1 -1
  375. package/paginator/paginator.js +13 -13
  376. package/paginator/paginator.min.js +1 -1
  377. package/panel/panel.cjs.js +14 -14
  378. package/panel/panel.cjs.min.js +1 -1
  379. package/panel/panel.esm.js +14 -14
  380. package/panel/panel.esm.min.js +1 -1
  381. package/panel/panel.js +14 -14
  382. package/panel/panel.min.js +1 -1
  383. package/panelmenu/panelmenu.cjs.js +13 -13
  384. package/panelmenu/panelmenu.cjs.min.js +1 -1
  385. package/panelmenu/panelmenu.esm.js +13 -13
  386. package/panelmenu/panelmenu.esm.min.js +1 -1
  387. package/panelmenu/panelmenu.js +13 -13
  388. package/panelmenu/panelmenu.min.js +1 -1
  389. package/password/password.cjs.js +14 -14
  390. package/password/password.cjs.min.js +1 -1
  391. package/password/password.esm.js +14 -14
  392. package/password/password.esm.min.js +1 -1
  393. package/password/password.js +14 -14
  394. package/password/password.min.js +1 -1
  395. package/picklist/picklist.cjs.js +11 -11
  396. package/picklist/picklist.cjs.min.js +1 -1
  397. package/picklist/picklist.esm.js +11 -11
  398. package/picklist/picklist.esm.min.js +1 -1
  399. package/picklist/picklist.js +11 -11
  400. package/picklist/picklist.min.js +1 -1
  401. package/portal/portal.cjs.js +13 -12
  402. package/portal/portal.cjs.min.js +1 -1
  403. package/portal/portal.esm.js +13 -12
  404. package/portal/portal.esm.min.js +1 -1
  405. package/portal/portal.js +13 -12
  406. package/portal/portal.min.js +1 -1
  407. package/primereact.all.cjs.js +642 -424
  408. package/primereact.all.cjs.min.js +1 -1
  409. package/primereact.all.esm.js +642 -424
  410. package/primereact.all.esm.min.js +1 -1
  411. package/primereact.all.js +642 -424
  412. package/primereact.all.min.js +1 -1
  413. package/progressbar/progressbar.cjs.js +11 -11
  414. package/progressbar/progressbar.cjs.min.js +1 -1
  415. package/progressbar/progressbar.esm.js +11 -11
  416. package/progressbar/progressbar.esm.min.js +1 -1
  417. package/progressbar/progressbar.js +11 -11
  418. package/progressbar/progressbar.min.js +1 -1
  419. package/progressspinner/progressspinner.cjs.js +11 -11
  420. package/progressspinner/progressspinner.cjs.min.js +1 -1
  421. package/progressspinner/progressspinner.esm.js +11 -11
  422. package/progressspinner/progressspinner.esm.min.js +1 -1
  423. package/progressspinner/progressspinner.js +11 -11
  424. package/progressspinner/progressspinner.min.js +1 -1
  425. package/radiobutton/radiobutton.cjs.js +13 -13
  426. package/radiobutton/radiobutton.cjs.min.js +1 -1
  427. package/radiobutton/radiobutton.esm.js +13 -13
  428. package/radiobutton/radiobutton.esm.min.js +1 -1
  429. package/radiobutton/radiobutton.js +13 -13
  430. package/radiobutton/radiobutton.min.js +1 -1
  431. package/rating/rating.cjs.js +13 -13
  432. package/rating/rating.cjs.min.js +1 -1
  433. package/rating/rating.esm.js +13 -13
  434. package/rating/rating.esm.min.js +1 -1
  435. package/rating/rating.js +13 -13
  436. package/rating/rating.min.js +1 -1
  437. package/resources/primereact.css +328 -305
  438. package/resources/primereact.min.css +1 -1
  439. package/resources/themes/arya-blue/theme.css +56 -24
  440. package/resources/themes/arya-green/theme.css +56 -24
  441. package/resources/themes/arya-orange/theme.css +56 -24
  442. package/resources/themes/arya-purple/theme.css +56 -24
  443. package/resources/themes/bootstrap4-dark-blue/theme.css +33 -8
  444. package/resources/themes/bootstrap4-dark-purple/theme.css +33 -8
  445. package/resources/themes/bootstrap4-light-blue/theme.css +32 -7
  446. package/resources/themes/bootstrap4-light-purple/theme.css +32 -7
  447. package/resources/themes/fluent-light/theme.css +56 -24
  448. package/resources/themes/lara-dark-blue/theme.css +400 -368
  449. package/resources/themes/lara-dark-indigo/theme.css +400 -368
  450. package/resources/themes/lara-dark-purple/theme.css +400 -368
  451. package/resources/themes/lara-dark-teal/theme.css +400 -368
  452. package/resources/themes/lara-light-blue/theme.css +56 -24
  453. package/resources/themes/lara-light-indigo/theme.css +56 -24
  454. package/resources/themes/lara-light-purple/theme.css +56 -24
  455. package/resources/themes/lara-light-teal/theme.css +56 -24
  456. package/resources/themes/luna-amber/theme.css +49 -24
  457. package/resources/themes/luna-blue/theme.css +49 -24
  458. package/resources/themes/luna-green/theme.css +49 -24
  459. package/resources/themes/luna-pink/theme.css +49 -24
  460. package/resources/themes/md-dark-deeppurple/theme.css +38 -6
  461. package/resources/themes/md-dark-indigo/theme.css +38 -6
  462. package/resources/themes/md-light-deeppurple/theme.css +38 -6
  463. package/resources/themes/md-light-indigo/theme.css +38 -6
  464. package/resources/themes/mdc-dark-deeppurple/theme.css +38 -6
  465. package/resources/themes/mdc-dark-indigo/theme.css +38 -6
  466. package/resources/themes/mdc-light-deeppurple/theme.css +38 -6
  467. package/resources/themes/mdc-light-indigo/theme.css +38 -6
  468. package/resources/themes/nova/theme.css +49 -24
  469. package/resources/themes/nova-accent/theme.css +49 -24
  470. package/resources/themes/nova-alt/theme.css +49 -24
  471. package/resources/themes/rhea/theme.css +49 -24
  472. package/resources/themes/saga-blue/theme.css +39 -7
  473. package/resources/themes/saga-green/theme.css +39 -7
  474. package/resources/themes/saga-orange/theme.css +39 -7
  475. package/resources/themes/saga-purple/theme.css +39 -7
  476. package/resources/themes/tailwind-light/theme.css +59 -27
  477. package/resources/themes/vela-blue/theme.css +56 -24
  478. package/resources/themes/vela-green/theme.css +56 -24
  479. package/resources/themes/vela-orange/theme.css +56 -24
  480. package/resources/themes/vela-purple/theme.css +56 -24
  481. package/ripple/ripple.cjs.js +11 -11
  482. package/ripple/ripple.cjs.min.js +1 -1
  483. package/ripple/ripple.esm.js +11 -11
  484. package/ripple/ripple.esm.min.js +1 -1
  485. package/ripple/ripple.js +11 -11
  486. package/ripple/ripple.min.js +1 -1
  487. package/row/row.cjs.js +11 -11
  488. package/row/row.cjs.min.js +1 -1
  489. package/row/row.esm.js +11 -11
  490. package/row/row.esm.min.js +1 -1
  491. package/row/row.js +11 -11
  492. package/row/row.min.js +1 -1
  493. package/scrollpanel/scrollpanel.cjs.js +11 -11
  494. package/scrollpanel/scrollpanel.cjs.min.js +1 -1
  495. package/scrollpanel/scrollpanel.esm.js +11 -11
  496. package/scrollpanel/scrollpanel.esm.min.js +1 -1
  497. package/scrollpanel/scrollpanel.js +11 -11
  498. package/scrollpanel/scrollpanel.min.js +1 -1
  499. package/scrolltop/scrolltop.cjs.js +12 -12
  500. package/scrolltop/scrolltop.cjs.min.js +1 -1
  501. package/scrolltop/scrolltop.esm.js +12 -12
  502. package/scrolltop/scrolltop.esm.min.js +1 -1
  503. package/scrolltop/scrolltop.js +12 -12
  504. package/scrolltop/scrolltop.min.js +1 -1
  505. package/selectbutton/selectbutton.cjs.js +14 -14
  506. package/selectbutton/selectbutton.cjs.min.js +1 -1
  507. package/selectbutton/selectbutton.esm.js +14 -14
  508. package/selectbutton/selectbutton.esm.min.js +1 -1
  509. package/selectbutton/selectbutton.js +14 -14
  510. package/selectbutton/selectbutton.min.js +1 -1
  511. package/sidebar/sidebar.cjs.js +14 -13
  512. package/sidebar/sidebar.cjs.min.js +1 -1
  513. package/sidebar/sidebar.esm.js +14 -13
  514. package/sidebar/sidebar.esm.min.js +1 -1
  515. package/sidebar/sidebar.js +14 -13
  516. package/sidebar/sidebar.min.js +1 -1
  517. package/skeleton/skeleton.cjs.js +11 -11
  518. package/skeleton/skeleton.cjs.min.js +1 -1
  519. package/skeleton/skeleton.esm.js +11 -11
  520. package/skeleton/skeleton.esm.min.js +1 -1
  521. package/skeleton/skeleton.js +11 -11
  522. package/skeleton/skeleton.min.js +1 -1
  523. package/slidemenu/slidemenu.cjs.js +12 -12
  524. package/slidemenu/slidemenu.cjs.min.js +1 -1
  525. package/slidemenu/slidemenu.esm.js +12 -12
  526. package/slidemenu/slidemenu.esm.min.js +1 -1
  527. package/slidemenu/slidemenu.js +12 -12
  528. package/slidemenu/slidemenu.min.js +1 -1
  529. package/slider/slider.cjs.js +11 -11
  530. package/slider/slider.cjs.min.js +1 -1
  531. package/slider/slider.esm.js +11 -11
  532. package/slider/slider.esm.min.js +1 -1
  533. package/slider/slider.js +11 -11
  534. package/slider/slider.min.js +1 -1
  535. package/speeddial/speeddial.cjs.js +13 -13
  536. package/speeddial/speeddial.cjs.min.js +1 -1
  537. package/speeddial/speeddial.esm.js +13 -13
  538. package/speeddial/speeddial.esm.min.js +1 -1
  539. package/speeddial/speeddial.js +13 -13
  540. package/speeddial/speeddial.min.js +1 -1
  541. package/splitbutton/splitbutton.cjs.js +15 -15
  542. package/splitbutton/splitbutton.cjs.min.js +1 -1
  543. package/splitbutton/splitbutton.esm.js +15 -15
  544. package/splitbutton/splitbutton.esm.min.js +1 -1
  545. package/splitbutton/splitbutton.js +15 -15
  546. package/splitbutton/splitbutton.min.js +1 -1
  547. package/splitter/splitter.cjs.js +12 -12
  548. package/splitter/splitter.cjs.min.js +1 -1
  549. package/splitter/splitter.esm.js +12 -12
  550. package/splitter/splitter.esm.min.js +1 -1
  551. package/splitter/splitter.js +12 -12
  552. package/splitter/splitter.min.js +1 -1
  553. package/steps/steps.cjs.js +11 -11
  554. package/steps/steps.cjs.min.js +1 -1
  555. package/steps/steps.esm.js +11 -11
  556. package/steps/steps.esm.min.js +1 -1
  557. package/steps/steps.js +11 -11
  558. package/steps/steps.min.js +1 -1
  559. package/styleclass/styleclass.cjs.js +11 -11
  560. package/styleclass/styleclass.cjs.min.js +1 -1
  561. package/styleclass/styleclass.esm.js +11 -11
  562. package/styleclass/styleclass.esm.min.js +1 -1
  563. package/styleclass/styleclass.js +11 -11
  564. package/styleclass/styleclass.min.js +1 -1
  565. package/tabmenu/tabmenu.cjs.js +11 -11
  566. package/tabmenu/tabmenu.cjs.min.js +1 -1
  567. package/tabmenu/tabmenu.esm.js +11 -11
  568. package/tabmenu/tabmenu.esm.min.js +1 -1
  569. package/tabmenu/tabmenu.js +11 -11
  570. package/tabmenu/tabmenu.min.js +1 -1
  571. package/tabview/tabview.cjs.js +35 -28
  572. package/tabview/tabview.cjs.min.js +1 -1
  573. package/tabview/tabview.esm.js +35 -28
  574. package/tabview/tabview.esm.min.js +1 -1
  575. package/tabview/tabview.js +35 -28
  576. package/tabview/tabview.min.js +1 -1
  577. package/tag/tag.cjs.js +11 -11
  578. package/tag/tag.cjs.min.js +1 -1
  579. package/tag/tag.esm.js +11 -11
  580. package/tag/tag.esm.min.js +1 -1
  581. package/tag/tag.js +11 -11
  582. package/tag/tag.min.js +1 -1
  583. package/terminal/terminal.cjs.js +11 -11
  584. package/terminal/terminal.cjs.min.js +1 -1
  585. package/terminal/terminal.esm.js +11 -11
  586. package/terminal/terminal.esm.min.js +1 -1
  587. package/terminal/terminal.js +11 -11
  588. package/terminal/terminal.min.js +1 -1
  589. package/tieredmenu/tieredmenu.cjs.js +12 -12
  590. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  591. package/tieredmenu/tieredmenu.esm.js +12 -12
  592. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  593. package/tieredmenu/tieredmenu.js +12 -12
  594. package/tieredmenu/tieredmenu.min.js +1 -1
  595. package/timeline/timeline.cjs.js +11 -11
  596. package/timeline/timeline.cjs.min.js +1 -1
  597. package/timeline/timeline.esm.js +11 -11
  598. package/timeline/timeline.esm.min.js +1 -1
  599. package/timeline/timeline.js +11 -11
  600. package/timeline/timeline.min.js +1 -1
  601. package/toast/toast.cjs.js +26 -15
  602. package/toast/toast.cjs.min.js +1 -1
  603. package/toast/toast.d.ts +3 -0
  604. package/toast/toast.esm.js +26 -15
  605. package/toast/toast.esm.min.js +1 -1
  606. package/toast/toast.js +27 -17
  607. package/toast/toast.min.js +1 -1
  608. package/togglebutton/togglebutton.cjs.js +13 -13
  609. package/togglebutton/togglebutton.cjs.min.js +1 -1
  610. package/togglebutton/togglebutton.esm.js +13 -13
  611. package/togglebutton/togglebutton.esm.min.js +1 -1
  612. package/togglebutton/togglebutton.js +13 -13
  613. package/togglebutton/togglebutton.min.js +1 -1
  614. package/toolbar/toolbar.cjs.js +11 -11
  615. package/toolbar/toolbar.cjs.min.js +1 -1
  616. package/toolbar/toolbar.esm.js +11 -11
  617. package/toolbar/toolbar.esm.min.js +1 -1
  618. package/toolbar/toolbar.js +11 -11
  619. package/toolbar/toolbar.min.js +1 -1
  620. package/tooltip/tooltip.cjs.js +13 -13
  621. package/tooltip/tooltip.cjs.min.js +1 -1
  622. package/tooltip/tooltip.esm.js +13 -13
  623. package/tooltip/tooltip.esm.min.js +1 -1
  624. package/tooltip/tooltip.js +13 -13
  625. package/tooltip/tooltip.min.js +1 -1
  626. package/tree/tree.cjs.js +17 -17
  627. package/tree/tree.cjs.min.js +1 -1
  628. package/tree/tree.esm.js +17 -17
  629. package/tree/tree.esm.min.js +1 -1
  630. package/tree/tree.js +17 -17
  631. package/tree/tree.min.js +1 -1
  632. package/treenode/treenode.d.ts +1 -0
  633. package/treeselect/treeselect.cjs.js +16 -16
  634. package/treeselect/treeselect.cjs.min.js +1 -1
  635. package/treeselect/treeselect.esm.js +16 -16
  636. package/treeselect/treeselect.esm.min.js +1 -1
  637. package/treeselect/treeselect.js +16 -16
  638. package/treeselect/treeselect.min.js +1 -1
  639. package/treetable/treetable.cjs.js +60 -48
  640. package/treetable/treetable.cjs.min.js +1 -1
  641. package/treetable/treetable.d.ts +1 -0
  642. package/treetable/treetable.esm.js +60 -48
  643. package/treetable/treetable.esm.min.js +1 -1
  644. package/treetable/treetable.js +60 -48
  645. package/treetable/treetable.min.css +1 -1
  646. package/treetable/treetable.min.js +1 -1
  647. package/tristatecheckbox/tristatecheckbox.cjs.js +13 -13
  648. package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
  649. package/tristatecheckbox/tristatecheckbox.esm.js +13 -13
  650. package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
  651. package/tristatecheckbox/tristatecheckbox.js +13 -13
  652. package/tristatecheckbox/tristatecheckbox.min.js +1 -1
  653. package/utils/utils.cjs.js +43 -41
  654. package/utils/utils.cjs.min.js +1 -1
  655. package/utils/utils.d.ts +1 -0
  656. package/utils/utils.esm.js +43 -41
  657. package/utils/utils.esm.min.js +1 -1
  658. package/utils/utils.js +43 -41
  659. package/utils/utils.min.js +1 -1
  660. package/virtualscroller/virtualscroller.cjs.js +35 -19
  661. package/virtualscroller/virtualscroller.cjs.min.js +1 -1
  662. package/virtualscroller/virtualscroller.esm.js +35 -19
  663. package/virtualscroller/virtualscroller.esm.min.js +1 -1
  664. package/virtualscroller/virtualscroller.js +35 -19
  665. package/virtualscroller/virtualscroller.min.css +1 -1
  666. package/virtualscroller/virtualscroller.min.js +1 -1
  667. package/web-types.json +44 -7
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),i=require("primereact/inputtext"),n=require("primereact/tooltip");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=s(t);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function f(t,e){if(e&&("object"===p(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function v(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?v(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var g=function(s){h(k,t.Component);var l,p,d,v,g,m=(l=k,p=b(),function(){var t,e=c(l);if(p){var i=c(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return f(this,t)});function k(e){var i;return o(this,k),(i=m.call(this,e)).onFocus=i.onFocus.bind(a(i)),i.onBlur=i.onBlur.bind(a(i)),i.onKeyDown=i.onKeyDown.bind(a(i)),i.onKeyPress=i.onKeyPress.bind(a(i)),i.onInput=i.onInput.bind(a(i)),i.handleInputChange=i.handleInputChange.bind(a(i)),i.inputRef=t.createRef(i.props.inputRef),i}return d=k,(v=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var i,n,s,r=t.which||t.keyCode,o=/iphone/i.test(e.DomHandler.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(i=this.caret()).end)-(n=i.begin)==0&&(n=46!==r?this.seekPrev(n):s=this.seekNext(n-1),s=46===r?this.seekNext(s):s),this.clearBuffer(n,s),this.shiftL(n,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var i=this;if(!this.props.readOnly){var n,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(n=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[n].test(s))&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),r=this.seekNext(n),/android/i.test(e.DomHandler.getUserAgent())?setTimeout((function(){i.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?e.DomHandler.addClass(this.inputRef.current,"p-filled"):e.DomHandler.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=e.DomHandler.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var i=this.props.mask.split(""),n=0;n<i.length;n++){var s=i[n];"?"===s?(this.len--,this.partialPosition=n):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),n<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<i.length;r++){var o=i[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(y({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=n.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=e.classNames("p-inputmask",this.props.className);return r.default.createElement(i.InputText,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:t,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&u(d.prototype,v),g&&u(d,g),k}();d(g,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null}),exports.InputMask=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("primereact/utils"),i=require("primereact/inputtext"),n=require("primereact/tooltip");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=s(t);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function f(t,e){if(e&&("object"===p(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function d(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function v(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?v(Object(i),!0).forEach((function(e){d(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var g=function(s){h(k,t.Component);var l,p,d,v,g,m=(l=k,p=b(),function(){var t,e=c(l);if(p){var i=c(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return f(this,t)});function k(e){var i;return o(this,k),(i=m.call(this,e)).onFocus=i.onFocus.bind(a(i)),i.onBlur=i.onBlur.bind(a(i)),i.onKeyDown=i.onKeyDown.bind(a(i)),i.onKeyPress=i.onKeyPress.bind(a(i)),i.onInput=i.onInput.bind(a(i)),i.handleInputChange=i.handleInputChange.bind(a(i)),i.inputRef=t.createRef(i.props.inputRef),i}return d=k,(v=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var i,n,s,r=t.which||t.keyCode,o=/iphone/i.test(e.DomHandler.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(i=this.caret()).end)-(n=i.begin)==0&&(n=46!==r?this.seekPrev(n):s=this.seekNext(n-1),s=46===r?this.seekNext(s):s),this.clearBuffer(n,s),this.shiftL(n,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var i=this;if(!this.props.readOnly){var n,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(n=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[n].test(s))&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),r=this.seekNext(n),/android/i.test(e.DomHandler.getUserAgent())?setTimeout((function(){i.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?e.DomHandler.addClass(this.inputRef.current,"p-filled"):e.DomHandler.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=e.DomHandler.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var i=this.props.mask.split(""),n=0;n<i.length;n++){var s=i[n];"?"===s?(this.len--,this.partialPosition=n):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),n<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<i.length;r++){var o=i[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(y({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=n.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=e.classNames("p-inputmask",this.props.className);return r.default.createElement(i.InputText,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:t,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&u(d.prototype,v),g&&u(d,g),Object.defineProperty(d,"prototype",{writable:!1}),k}();d(g,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null}),exports.InputMask=g;
@@ -22,6 +22,9 @@ function _defineProperties(target, props) {
22
22
  function _createClass(Constructor, protoProps, staticProps) {
23
23
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
24
24
  if (staticProps) _defineProperties(Constructor, staticProps);
25
+ Object.defineProperty(Constructor, "prototype", {
26
+ writable: false
27
+ });
25
28
  return Constructor;
26
29
  }
27
30
 
@@ -54,23 +57,20 @@ function _inherits(subClass, superClass) {
54
57
  configurable: true
55
58
  }
56
59
  });
60
+ Object.defineProperty(subClass, "prototype", {
61
+ writable: false
62
+ });
57
63
  if (superClass) _setPrototypeOf(subClass, superClass);
58
64
  }
59
65
 
60
66
  function _typeof(obj) {
61
67
  "@babel/helpers - typeof";
62
68
 
63
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
64
- _typeof = function _typeof(obj) {
65
- return typeof obj;
66
- };
67
- } else {
68
- _typeof = function _typeof(obj) {
69
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
70
- };
71
- }
72
-
73
- return _typeof(obj);
69
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
70
+ return typeof obj;
71
+ } : function (obj) {
72
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
73
+ }, _typeof(obj);
74
74
  }
75
75
 
76
76
  function _possibleConstructorReturn(self, call) {
@@ -105,9 +105,9 @@ function _defineProperty(obj, key, value) {
105
105
  return obj;
106
106
  }
107
107
 
108
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
108
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
109
109
 
110
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
110
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
111
111
 
112
112
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
113
113
 
@@ -1 +1 @@
1
- import t,{createRef as e,Component as i}from"react";import{DomHandler as n,classNames as s}from"primereact/utils";import{InputText as r}from"primereact/inputtext";import{tip as o}from"primereact/tooltip";function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function c(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function v(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function b(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var m=function(h){p(P,i);var f,v,y,m,k,R=(f=P,v=g(),function(){var t,e=d(f);if(v){var i=d(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return c(this,t)});function P(t){var i;return u(this,P),(i=R.call(this,t)).onFocus=i.onFocus.bind(l(i)),i.onBlur=i.onBlur.bind(l(i)),i.onKeyDown=i.onKeyDown.bind(l(i)),i.onKeyPress=i.onKeyPress.bind(l(i)),i.onInput=i.onInput.bind(l(i)),i.handleInputChange=i.handleInputChange.bind(l(i)),i.inputRef=e(i.props.inputRef),i}return y=P,(m=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var e,i,s,r=t.which||t.keyCode,o=/iphone/i.test(n.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(e=this.caret()).end)-(i=e.begin)==0&&(i=46!==r?this.seekPrev(i):s=this.seekNext(i-1),s=46===r?this.seekNext(s):s),this.clearBuffer(i,s),this.shiftL(i,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var e=this;if(!this.props.readOnly){var i,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(i=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[i].test(s))&&(this.shiftR(i),this.buffer[i]=s,this.writeBuffer(),r=this.seekNext(i),/android/i.test(n.getUserAgent())?setTimeout((function(){e.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?n.addClass(this.inputRef.current,"p-filled"):n.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=n.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var e=this.props.mask.split(""),i=0;i<e.length;i++){var s=e[i];"?"===s?(this.len--,this.partialPosition=i):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),i<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<e.length;r++){var o=e[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var e=s("p-inputmask",this.props.className);return t.createElement(r,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:e,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&a(y.prototype,m),k&&a(y,k),P}();v(m,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null});export{m as InputMask};
1
+ import t,{createRef as e,Component as i}from"react";import{DomHandler as n,classNames as s}from"primereact/utils";import{InputText as r}from"primereact/inputtext";import{tip as o}from"primereact/tooltip";function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function c(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function v(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function b(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var m=function(h){p(P,i);var f,v,y,m,k,R=(f=P,v=g(),function(){var t,e=d(f);if(v){var i=d(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return c(this,t)});function P(t){var i;return u(this,P),(i=R.call(this,t)).onFocus=i.onFocus.bind(l(i)),i.onBlur=i.onBlur.bind(l(i)),i.onKeyDown=i.onKeyDown.bind(l(i)),i.onKeyPress=i.onKeyPress.bind(l(i)),i.onInput=i.onInput.bind(l(i)),i.handleInputChange=i.handleInputChange.bind(l(i)),i.inputRef=e(i.props.inputRef),i}return y=P,(m=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var e,i,s,r=t.which||t.keyCode,o=/iphone/i.test(n.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(e=this.caret()).end)-(i=e.begin)==0&&(i=46!==r?this.seekPrev(i):s=this.seekNext(i-1),s=46===r?this.seekNext(s):s),this.clearBuffer(i,s),this.shiftL(i,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var e=this;if(!this.props.readOnly){var i,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(i=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[i].test(s))&&(this.shiftR(i),this.buffer[i]=s,this.writeBuffer(),r=this.seekNext(i),/android/i.test(n.getUserAgent())?setTimeout((function(){e.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?n.addClass(this.inputRef.current,"p-filled"):n.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=n.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var e=this.props.mask.split(""),i=0;i<e.length;i++){var s=e[i];"?"===s?(this.len--,this.partialPosition=i):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),i<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<e.length;r++){var o=e[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=o({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var e=s("p-inputmask",this.props.className);return t.createElement(r,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:e,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&a(y.prototype,m),k&&a(y,k),Object.defineProperty(y,"prototype",{writable:!1}),P}();v(m,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null});export{m as InputMask};
@@ -25,6 +25,9 @@ this.primereact.inputmask = (function (exports, React, utils, inputtext, tooltip
25
25
  function _createClass(Constructor, protoProps, staticProps) {
26
26
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27
27
  if (staticProps) _defineProperties(Constructor, staticProps);
28
+ Object.defineProperty(Constructor, "prototype", {
29
+ writable: false
30
+ });
28
31
  return Constructor;
29
32
  }
30
33
 
@@ -57,23 +60,20 @@ this.primereact.inputmask = (function (exports, React, utils, inputtext, tooltip
57
60
  configurable: true
58
61
  }
59
62
  });
63
+ Object.defineProperty(subClass, "prototype", {
64
+ writable: false
65
+ });
60
66
  if (superClass) _setPrototypeOf(subClass, superClass);
61
67
  }
62
68
 
63
69
  function _typeof(obj) {
64
70
  "@babel/helpers - typeof";
65
71
 
66
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
67
- _typeof = function _typeof(obj) {
68
- return typeof obj;
69
- };
70
- } else {
71
- _typeof = function _typeof(obj) {
72
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
73
- };
74
- }
75
-
76
- return _typeof(obj);
72
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
73
+ return typeof obj;
74
+ } : function (obj) {
75
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
76
+ }, _typeof(obj);
77
77
  }
78
78
 
79
79
  function _possibleConstructorReturn(self, call) {
@@ -108,9 +108,9 @@ this.primereact.inputmask = (function (exports, React, utils, inputtext, tooltip
108
108
  return obj;
109
109
  }
110
110
 
111
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
111
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
112
112
 
113
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
113
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
114
114
 
115
115
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
116
116
 
@@ -1 +1 @@
1
- this.primereact=this.primereact||{},this.primereact.inputmask=function(t,e,i,n,s){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(e);function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function c(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function v(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function b(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var m=function(t){p(k,t);var r,h,f,v,y,m=(r=k,h=g(),function(){var t,e=d(r);if(h){var i=d(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return c(this,t)});function k(t){var i;return u(this,k),(i=m.call(this,t)).onFocus=i.onFocus.bind(l(i)),i.onBlur=i.onBlur.bind(l(i)),i.onKeyDown=i.onKeyDown.bind(l(i)),i.onKeyPress=i.onKeyPress.bind(l(i)),i.onInput=i.onInput.bind(l(i)),i.handleInputChange=i.handleInputChange.bind(l(i)),i.inputRef=e.createRef(i.props.inputRef),i}return f=k,(v=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var e,n,s,r=t.which||t.keyCode,o=/iphone/i.test(i.DomHandler.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(e=this.caret()).end)-(n=e.begin)==0&&(n=46!==r?this.seekPrev(n):s=this.seekNext(n-1),s=46===r?this.seekNext(s):s),this.clearBuffer(n,s),this.shiftL(n,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var e=this;if(!this.props.readOnly){var n,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(n=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[n].test(s))&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),r=this.seekNext(n),/android/i.test(i.DomHandler.getUserAgent())?setTimeout((function(){e.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?i.DomHandler.addClass(this.inputRef.current,"p-filled"):i.DomHandler.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=i.DomHandler.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var e=this.props.mask.split(""),n=0;n<e.length;n++){var s=e[n];"?"===s?(this.len--,this.partialPosition=n):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),n<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<e.length;r++){var o=e[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=s.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=i.classNames("p-inputmask",this.props.className);return o.default.createElement(n.InputText,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:t,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&a(f.prototype,v),y&&a(f,y),k}(e.Component);return v(m,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null}),t.InputMask=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.inputtext,primereact.tooltip);
1
+ this.primereact=this.primereact||{},this.primereact.inputmask=function(t,e,i,n,s){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(e);function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function c(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function v(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function b(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach((function(e){v(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}var m=function(t){p(k,t);var r,h,f,v,y,m=(r=k,h=g(),function(){var t,e=d(r);if(h){var i=d(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return c(this,t)});function k(t){var i;return u(this,k),(i=m.call(this,t)).onFocus=i.onFocus.bind(l(i)),i.onBlur=i.onBlur.bind(l(i)),i.onKeyDown=i.onKeyDown.bind(l(i)),i.onKeyPress=i.onKeyPress.bind(l(i)),i.onInput=i.onInput.bind(l(i)),i.handleInputChange=i.handleInputChange.bind(l(i)),i.inputRef=e.createRef(i.props.inputRef),i}return f=k,(v=[{key:"caret",value:function(t,e){var i,n,s,r=this.inputRef&&this.inputRef.current;if(r&&r.offsetParent&&r===document.activeElement)return"number"!=typeof t?(r.setSelectionRange?(n=r.selectionStart,s=r.selectionEnd):document.selection&&document.selection.createRange&&(s=(n=0-(i=document.selection.createRange()).duplicate().moveStart("character",-1e5))+i.text.length),{begin:n,end:s}):(n=t,s="number"==typeof e?e:n,void(r.setSelectionRange?r.setSelectionRange(n,s):r.createTextRange&&((i=r.createTextRange()).collapse(!0),i.moveEnd("character",s),i.moveStart("character",n),i.select())))}},{key:"isCompleted",value:function(){for(var t=this.firstNonMaskPos;t<=this.lastRequiredNonMaskPos;t++)if(this.tests[t]&&this.buffer[t]===this.getPlaceholder(t))return!1;return!0}},{key:"getPlaceholder",value:function(t){return this.props.slotChar.charAt(t<this.props.slotChar.length?t:0)}},{key:"getValue",value:function(){return this.props.unmask?this.getUnmaskedValue():this.inputRef&&this.inputRef.current&&this.inputRef.current.value}},{key:"seekNext",value:function(t){for(;++t<this.len&&!this.tests[t];);return t}},{key:"seekPrev",value:function(t){for(;--t>=0&&!this.tests[t];);return t}},{key:"shiftL",value:function(t,e){var i,n;if(!(t<0)){for(i=t,n=this.seekNext(e);i<this.len;i++)if(this.tests[i]){if(!(n<this.len&&this.tests[i].test(this.buffer[n])))break;this.buffer[i]=this.buffer[n],this.buffer[n]=this.getPlaceholder(n),n=this.seekNext(n)}this.writeBuffer(),this.caret(Math.max(this.firstNonMaskPos,t))}}},{key:"shiftR",value:function(t){var e,i,n,s;for(e=t,i=this.getPlaceholder(t);e<this.len;e++)if(this.tests[e]){if(n=this.seekNext(e),s=this.buffer[e],this.buffer[e]=i,!(n<this.len&&this.tests[n].test(s)))break;i=s}}},{key:"handleAndroidInput",value:function(t){var e=this.inputRef.current.value,i=this.caret();if(this.oldVal&&this.oldVal.length&&this.oldVal.length>e.length){for(this.checkVal(!0);i.begin>0&&!this.tests[i.begin-1];)i.begin--;if(0===i.begin)for(;i.begin<this.firstNonMaskPos&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}else{for(this.checkVal(!0);i.begin<this.len&&!this.tests[i.begin];)i.begin++;this.caret(i.begin,i.begin)}this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}},{key:"onBlur",value:function(t){if(this.focus=!1,this.checkVal(),this.updateModel(t),this.updateFilledState(),this.props.onBlur&&this.props.onBlur(t),this.inputRef.current.value!==this.focusText){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.inputRef.current.dispatchEvent(e)}}},{key:"onKeyDown",value:function(t){if(!this.props.readOnly){var e,n,s,r=t.which||t.keyCode,o=/iphone/i.test(i.DomHandler.getUserAgent());this.oldVal=this.inputRef.current.value,8===r||46===r||o&&127===r?((s=(e=this.caret()).end)-(n=e.begin)==0&&(n=46!==r?this.seekPrev(n):s=this.seekNext(n-1),s=46===r?this.seekNext(s):s),this.clearBuffer(n,s),this.shiftL(n,s-1),this.updateModel(t),t.preventDefault()):13===r?(this.onBlur(t),this.updateModel(t)):27===r&&(this.inputRef.current.value=this.focusText,this.caret(0,this.checkVal()),this.updateModel(t),t.preventDefault())}}},{key:"onKeyPress",value:function(t){var e=this;if(!this.props.readOnly){var n,s,r,o,u=t.which||t.keyCode,a=this.caret();t.ctrlKey||t.altKey||t.metaKey||u<32||(u&&13!==u&&(a.end-a.begin!=0&&(this.clearBuffer(a.begin,a.end),this.shiftL(a.begin,a.end-1)),(n=this.seekNext(a.begin-1))<this.len&&(s=String.fromCharCode(u),this.tests[n].test(s))&&(this.shiftR(n),this.buffer[n]=s,this.writeBuffer(),r=this.seekNext(n),/android/i.test(i.DomHandler.getUserAgent())?setTimeout((function(){e.caret(r)}),0):this.caret(r),a.begin<=this.lastRequiredNonMaskPos&&(o=this.isCompleted())),t.preventDefault()),this.updateModel(t),this.props.onComplete&&o&&this.props.onComplete({originalEvent:t,value:this.getValue()}))}}},{key:"clearBuffer",value:function(t,e){var i;for(i=t;i<e&&i<this.len;i++)this.tests[i]&&(this.buffer[i]=this.getPlaceholder(i))}},{key:"writeBuffer",value:function(){this.inputRef.current.value=this.buffer.join("")}},{key:"checkVal",value:function(t){this.isValueChecked=!0;var e,i,n,s=this.inputRef.current.value,r=-1;for(e=0,n=0;e<this.len;e++)if(this.tests[e]){for(this.buffer[e]=this.getPlaceholder(e);n++<s.length;)if(i=s.charAt(n-1),this.tests[e].test(i)){this.buffer[e]=i,r=e;break}if(n>s.length){this.clearBuffer(e+1,this.len);break}}else this.buffer[e]===s.charAt(n)&&n++,e<this.partialPosition&&(r=e);return t?this.writeBuffer():r+1<this.partialPosition?this.props.autoClear||this.buffer.join("")===this.defaultBuffer?(this.inputRef.current.value&&(this.inputRef.current.value=""),this.clearBuffer(0,this.len)):this.writeBuffer():(this.writeBuffer(),this.inputRef.current.value=this.inputRef.current.value.substring(0,r+1)),this.partialPosition?e:this.firstNonMaskPos}},{key:"onFocus",value:function(t){var e,i=this;this.props.readOnly||(this.focus=!0,clearTimeout(this.caretTimeoutId),this.focusText=this.inputRef.current.value,e=this.checkVal(),this.caretTimeoutId=setTimeout((function(){i.inputRef.current===document.activeElement&&(i.writeBuffer(),e===i.props.mask.replace("?","").length?i.caret(0,e):i.caret(e),i.updateFilledState())}),10),this.props.onFocus&&this.props.onFocus(t))}},{key:"onInput",value:function(t){this.androidChrome?this.handleAndroidInput(t):this.handleInputChange(t)}},{key:"handleInputChange",value:function(t){if(!this.props.readOnly){var e=this.checkVal(!0);this.caret(e),this.updateModel(t),this.props.onComplete&&this.isCompleted()&&this.props.onComplete({originalEvent:t,value:this.getValue()})}}},{key:"getUnmaskedValue",value:function(){for(var t=[],e=0;e<this.buffer.length;e++){var i=this.buffer[e];this.tests[e]&&i!==this.getPlaceholder(e)&&t.push(i)}return t.join("")}},{key:"updateModel",value:function(t){if(this.props.onChange){var e=this.props.unmask?this.getUnmaskedValue():t&&t.target.value;this.props.onChange({originalEvent:t,value:this.defaultBuffer!==e?e:"",stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:this.defaultBuffer!==e?e:""}})}}},{key:"updateFilledState",value:function(){this.inputRef&&this.inputRef.current&&this.inputRef.current.value&&this.inputRef.current.value.length>0?i.DomHandler.addClass(this.inputRef.current,"p-filled"):i.DomHandler.removeClass(this.inputRef.current,"p-filled")}},{key:"updateValue",value:function(t){var e,i=this;return this.inputRef&&this.inputRef.current&&(null==this.props.value?this.inputRef.current.value="":(this.inputRef.current.value=this.props.value,e=this.checkVal(t),setTimeout((function(){if(i.inputRef&&i.inputRef.current)return i.writeBuffer(),i.checkVal(t)}),10)),this.focusText=this.inputRef.current.value),this.updateFilledState(),e}},{key:"isValueUpdated",value:function(){return this.props.unmask?this.props.value!==this.getUnmaskedValue():this.defaultBuffer!==this.inputRef.current.value&&this.inputRef.current.value!==this.props.value}},{key:"init",value:function(){if(this.props.mask){this.tests=[],this.partialPosition=this.props.mask.length,this.len=this.props.mask.length,this.firstNonMaskPos=null,this.defs={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};var t=i.DomHandler.getUserAgent();this.androidChrome=/chrome/i.test(t)&&/android/i.test(t);for(var e=this.props.mask.split(""),n=0;n<e.length;n++){var s=e[n];"?"===s?(this.len--,this.partialPosition=n):this.defs[s]?(this.tests.push(new RegExp(this.defs[s])),null===this.firstNonMaskPos&&(this.firstNonMaskPos=this.tests.length-1),n<this.partialPosition&&(this.lastRequiredNonMaskPos=this.tests.length-1)):this.tests.push(null)}this.buffer=[];for(var r=0;r<e.length;r++){var o=e[r];"?"!==o&&this.buffer.push(this.defs[o]?this.getPlaceholder(r):o)}this.defaultBuffer=this.buffer.join("")}}},{key:"updateInputRef",value:function(){var t=this.props.inputRef;t&&("function"==typeof t?t(this.inputRef.current):t.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.init(),this.updateValue(),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(t){t.tooltip===this.props.tooltip&&t.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(b({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.isValueUpdated()&&this.updateValue(),t.mask!==this.props.mask&&(this.init(),this.caret(this.updateValue(!0)),this.updateModel())}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=s.tip({target:this.inputRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=i.classNames("p-inputmask",this.props.className);return o.default.createElement(n.InputText,{id:this.props.id,ref:this.inputRef,type:this.props.type,name:this.props.name,style:this.props.style,className:t,placeholder:this.props.placeholder,size:this.props.size,maxLength:this.props.maxLength,tabIndex:this.props.tabIndex,disabled:this.props.disabled,readOnly:this.props.readOnly,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onInput:this.onInput,onPaste:this.handleInputChange,required:this.props.required,"aria-labelledby":this.props.ariaLabelledBy})}}])&&a(f.prototype,v),y&&a(f,y),Object.defineProperty(f,"prototype",{writable:!1}),k}(e.Component);return v(m,"defaultProps",{id:null,inputRef:null,value:null,type:"text",mask:null,slotChar:"_",autoClear:!0,unmask:!1,style:null,className:null,placeholder:null,size:null,maxLength:null,tabIndex:null,disabled:!1,readOnly:!1,name:null,required:!1,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onComplete:null,onChange:null,onFocus:null,onBlur:null}),t.InputMask=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},React,primereact.utils,primereact.inputtext,primereact.tooltip);
@@ -66,6 +66,9 @@ function _defineProperties(target, props) {
66
66
  function _createClass(Constructor, protoProps, staticProps) {
67
67
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
68
68
  if (staticProps) _defineProperties(Constructor, staticProps);
69
+ Object.defineProperty(Constructor, "prototype", {
70
+ writable: false
71
+ });
69
72
  return Constructor;
70
73
  }
71
74
 
@@ -98,23 +101,20 @@ function _inherits(subClass, superClass) {
98
101
  configurable: true
99
102
  }
100
103
  });
104
+ Object.defineProperty(subClass, "prototype", {
105
+ writable: false
106
+ });
101
107
  if (superClass) _setPrototypeOf(subClass, superClass);
102
108
  }
103
109
 
104
110
  function _typeof(obj) {
105
111
  "@babel/helpers - typeof";
106
112
 
107
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
108
- _typeof = function _typeof(obj) {
109
- return typeof obj;
110
- };
111
- } else {
112
- _typeof = function _typeof(obj) {
113
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
114
- };
115
- }
116
-
117
- return _typeof(obj);
113
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
114
+ return typeof obj;
115
+ } : function (obj) {
116
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
117
+ }, _typeof(obj);
118
118
  }
119
119
 
120
120
  function _possibleConstructorReturn(self, call) {
@@ -149,9 +149,9 @@ function _defineProperty(obj, key, value) {
149
149
  return obj;
150
150
  }
151
151
 
152
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
152
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
153
153
 
154
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
154
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
155
155
 
156
156
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
157
157
 
@@ -627,12 +627,14 @@ var InputNumber = /*#__PURE__*/function (_Component) {
627
627
  }
628
628
 
629
629
  var code = event.which || event.keyCode;
630
- var char = String.fromCharCode(code);
631
- var isDecimalSign = this.isDecimalSign(char);
632
- var isMinusSign = this.isMinusSign(char);
630
+
631
+ var _char = String.fromCharCode(code);
632
+
633
+ var isDecimalSign = this.isDecimalSign(_char);
634
+ var isMinusSign = this.isMinusSign(_char);
633
635
 
634
636
  if (48 <= code && code <= 57 || isMinusSign || isDecimalSign) {
635
- this.insert(event, char, {
637
+ this.insert(event, _char, {
636
638
  isDecimalSign: isDecimalSign,
637
639
  isMinusSign: isMinusSign
638
640
  });
@@ -665,8 +667,8 @@ var InputNumber = /*#__PURE__*/function (_Component) {
665
667
  }
666
668
  }, {
667
669
  key: "isMinusSign",
668
- value: function isMinusSign(char) {
669
- if (this._minusSign.test(char) || char === '-') {
670
+ value: function isMinusSign(_char2) {
671
+ if (this._minusSign.test(_char2) || _char2 === '-') {
670
672
  this._minusSign.lastIndex = 0;
671
673
  return true;
672
674
  }
@@ -675,8 +677,8 @@ var InputNumber = /*#__PURE__*/function (_Component) {
675
677
  }
676
678
  }, {
677
679
  key: "isDecimalSign",
678
- value: function isDecimalSign(char) {
679
- if (this._decimal.test(char)) {
680
+ value: function isDecimalSign(_char3) {
681
+ if (this._decimal.test(_char3)) {
680
682
  this._decimal.lastIndex = 0;
681
683
  return true;
682
684
  }
@@ -818,9 +820,10 @@ var InputNumber = /*#__PURE__*/function (_Component) {
818
820
  var prefixLength = (this.prefixChar || '').length;
819
821
  inputValue = inputValue.replace(this._prefix, '');
820
822
  selectionStart = selectionStart - prefixLength;
821
- var char = inputValue.charAt(selectionStart);
822
823
 
823
- if (this.isNumeralChar(char)) {
824
+ var _char4 = inputValue.charAt(selectionStart);
825
+
826
+ if (this.isNumeralChar(_char4)) {
824
827
  return selectionStart + prefixLength;
825
828
  } //left
826
829
 
@@ -828,9 +831,9 @@ var InputNumber = /*#__PURE__*/function (_Component) {
828
831
  var i = selectionStart - 1;
829
832
 
830
833
  while (i >= 0) {
831
- char = inputValue.charAt(i);
834
+ _char4 = inputValue.charAt(i);
832
835
 
833
- if (this.isNumeralChar(char)) {
836
+ if (this.isNumeralChar(_char4)) {
834
837
  index = i + prefixLength;
835
838
  break;
836
839
  } else {
@@ -844,9 +847,9 @@ var InputNumber = /*#__PURE__*/function (_Component) {
844
847
  i = selectionStart;
845
848
 
846
849
  while (i < valueLength) {
847
- char = inputValue.charAt(i);
850
+ _char4 = inputValue.charAt(i);
848
851
 
849
- if (this.isNumeralChar(char)) {
852
+ if (this.isNumeralChar(_char4)) {
850
853
  index = i + prefixLength;
851
854
  break;
852
855
  } else {
@@ -868,8 +871,8 @@ var InputNumber = /*#__PURE__*/function (_Component) {
868
871
  }
869
872
  }, {
870
873
  key: "isNumeralChar",
871
- value: function isNumeralChar(char) {
872
- if (char.length === 1 && (this._numeral.test(char) || this._decimal.test(char) || this._group.test(char) || this._minusSign.test(char))) {
874
+ value: function isNumeralChar(_char5) {
875
+ if (_char5.length === 1 && (this._numeral.test(_char5) || this._decimal.test(_char5) || this._group.test(_char5) || this._minusSign.test(_char5))) {
873
876
  this.resetRegex();
874
877
  return true;
875
878
  } else {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/inputtext"),n=require("primereact/utils"),i=require("primereact/tooltip"),s=require("primereact/ripple");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function u(e){if(Array.isArray(e))return a(e)}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var k=function(r){y(C,e.Component);var a,m,v,x,D,k=(a=C,m=I(),function(){var e,t=b(a);if(m){var n=b(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return g(this,e)});function C(t){var n;return h(this,C),(n=k.call(this,t)).state={focused:!1},n.constructParser(),n.onInput=n.onInput.bind(d(n)),n.onInputKeyDown=n.onInputKeyDown.bind(d(n)),n.onInputKeyPress=n.onInputKeyPress.bind(d(n)),n.onInputClick=n.onInputClick.bind(d(n)),n.onInputBlur=n.onInputBlur.bind(d(n)),n.onInputFocus=n.onInputFocus.bind(d(n)),n.onPaste=n.onPaste.bind(d(n)),n.onUpButtonMouseLeave=n.onUpButtonMouseLeave.bind(d(n)),n.onUpButtonMouseDown=n.onUpButtonMouseDown.bind(d(n)),n.onUpButtonMouseUp=n.onUpButtonMouseUp.bind(d(n)),n.onUpButtonKeyDown=n.onUpButtonKeyDown.bind(d(n)),n.onUpButtonKeyUp=n.onUpButtonKeyUp.bind(d(n)),n.onDownButtonMouseLeave=n.onDownButtonMouseLeave.bind(d(n)),n.onDownButtonMouseDown=n.onDownButtonMouseDown.bind(d(n)),n.onDownButtonMouseUp=n.onDownButtonMouseUp.bind(d(n)),n.onDownButtonKeyDown=n.onDownButtonKeyDown.bind(d(n)),n.onDownButtonKeyUp=n.onDownButtonKeyUp.bind(d(n)),n.inputRef=e.createRef(n.props.inputRef),n}return v=C,x=[{key:"getOptions",value:function(){return{localeMatcher:this.props.localeMatcher,style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,useGrouping:this.props.useGrouping,minimumFractionDigits:this.props.minFractionDigits,maximumFractionDigits:this.props.maxFractionDigits}}},{key:"constructParser",value:function(){this.numberFormat=new Intl.NumberFormat(this.props.locale,this.getOptions());var e,t=(e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1}).format(9876543210),u(e)||l(e)||p(e)||c()).reverse(),n=new Map(t.map((function(e,t){return[e,t]})));this._numeral=new RegExp("[".concat(t.join(""),"]"),"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=function(e){return n.get(e)}}},{key:"escapeRegExp",value:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},{key:"getDecimalExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,w(w({},this.getOptions()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,""),"]"),"g")}},{key:"getGroupingExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp("[".concat(this.groupChar,"]"),"g")}},{key:"getMinusSignExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(this._numeral,""),"]"),"g")}},{key:"getCurrencyExpression",value:function(){if(this.props.currency){var e=new Intl.NumberFormat(this.props.locale,{style:"currency",currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,""),"]"),"g")}return new RegExp("[]","g")}},{key:"getPrefixExpression",value:function(){if(this.props.prefix)this.prefixChar=this.props.prefix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp("".concat(this.escapeRegExp(this.prefixChar||"")),"g")}},{key:"getSuffixExpression",value:function(){if(this.props.suffix)this.suffixChar=this.props.suffix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});this.suffixChar=e.format(1).split("1")[1]}return new RegExp("".concat(this.escapeRegExp(this.suffixChar||"")),"g")}},{key:"formatValue",value:function(e){if(null!=e){if("-"===e)return e;if(this.props.format){var t=new Intl.NumberFormat(this.props.locale,this.getOptions()).format(e);return this.props.prefix&&(t=this.props.prefix+t),this.props.suffix&&(t+=this.props.suffix),t}return e.toString()}return""}},{key:"parseValue",value:function(e){var t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;var n=+t;return isNaN(n)?null:n}return null}},{key:"repeat",value:function(e,t,n){var i=this,s=t||500;this.clearTimer(),this.timer=setTimeout((function(){i.repeat(e,40,n)}),s),this.spin(e,n)}},{key:"spin",value:function(e,t){if(this.inputRef&&this.inputRef.current){var n=this.props.step*t,i=this.parseValue(this.inputRef.current.value)||0,s=this.validateValue(i+n);this.updateInput(s,null,"spin"),this.updateModel(e,s),this.handleOnChange(e,i,s)}}},{key:"onUpButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,1),e.preventDefault())}},{key:"onUpButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,1)}},{key:"onDownButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,-1),e.preventDefault())}},{key:"onDownButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,-1)}},{key:"onInput",value:function(e){this.props.disabled||this.props.readOnly||(this.isSpecialChar&&(e.target.value=this.lastValue),this.isSpecialChar=!1)}},{key:"onInputKeyDown",value:function(e){if(!this.props.disabled&&!this.props.readOnly)if(this.lastValue=e.target.value,e.shiftKey||e.altKey)this.isSpecialChar=!0;else{var t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.altKey&&e.preventDefault(),e.which){case 38:this.spin(e,1),e.preventDefault();break;case 40:this.spin(e,-1),e.preventDefault();break;case 37:this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case 39:this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case 13:s=this.validateValue(this.parseValue(i)),this.inputRef.current.value=this.formatValue(s),this.inputRef.current.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case 8:if(e.preventDefault(),t===n){var r=i.charAt(t-1),o=this.getDecimalCharIndexes(i),a=o.decimalCharIndex,u=o.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(r)){var l=this.getDecimalLength(i);if(this._group.test(r))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(r))this._decimal.lastIndex=0,l?this.inputRef.current.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(a>0&&t>a){var p=this.isDecimalMode()&&(this.props.minFractionDigits||0)<l?"":"0";s=i.slice(0,t-1)+p+i.slice(t)}else 1===u?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case 46:if(e.preventDefault(),t===n){var c=i.charAt(t),h=this.getDecimalCharIndexes(i),f=h.decimalCharIndex,d=h.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(c)){var m=this.getDecimalLength(i);if(this._group.test(c))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(c))this._decimal.lastIndex=0,m?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(f>0&&t>f){var y=this.isDecimalMode()&&(this.props.minFractionDigits||0)<m?"":"0";s=i.slice(0,t)+y+i.slice(t+1)}else 1===d?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range")}this.props.onKeyDown&&this.props.onKeyDown(e)}}},{key:"onInputKeyPress",value:function(e){if(!this.props.disabled&&!this.props.readOnly){var t=e.which||e.keyCode,n=String.fromCharCode(t),i=this.isDecimalSign(n),s=this.isMinusSign(n);(48<=t&&t<=57||s||i)&&(this.insert(e,n,{isDecimalSign:i,isMinusSign:s}),e.preventDefault())}}},{key:"onPaste",value:function(e){if(e.preventDefault(),!this.props.disabled&&!this.props.readOnly){var t=(e.clipboardData||window.clipboardData).getData("Text");if(t){var n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}}}},{key:"allowMinusSign",value:function(){return null===this.props.min||this.props.min<0}},{key:"isMinusSign",value:function(e){return!(!this._minusSign.test(e)&&"-"!==e||(this._minusSign.lastIndex=0,0))}},{key:"isDecimalSign",value:function(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)}},{key:"isDecimalMode",value:function(){return"decimal"===this.props.mode}},{key:"getDecimalCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}}},{key:"getCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.search(this._minusSign);this._minusSign.lastIndex=0;var i=e.search(this._suffix);this._suffix.lastIndex=0;var s=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:s}}},{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,this.allowMinusSign()||-1===i){var s,r=this.inputRef.current.selectionStart,o=this.inputRef.current.selectionEnd,a=this.inputRef.current.value.trim(),u=this.getCharIndexes(a),l=u.decimalCharIndex,p=u.minusCharIndex,c=u.suffixCharIndex,h=u.currencyCharIndex;if(n.isMinusSign)0===r&&(s=a,-1!==p&&0===o||(s=this.insertText(a,t,0,o)),this.updateValue(e,s,t,"insert"));else if(n.isDecimalSign)l>0&&r===l?this.updateValue(e,a,t,"insert"):(l>r&&l<o||-1===l&&this.props.maxFractionDigits)&&(s=this.insertText(a,t,r,o),this.updateValue(e,s,t,"insert"));else{var f=this.numberFormat.resolvedOptions().maximumFractionDigits,d=r!==o?"range-insert":"insert";if(l>0&&r>l){if(r+t.length-(l+1)<=f){var m=h>=r?h-1:c>=r?c:a.length;s=a.slice(0,r)+t+a.slice(r+t.length,m)+a.slice(m),this.updateValue(e,s,t,d)}}else s=this.insertText(a,t,r,o),this.updateValue(e,s,t,d)}}}},{key:"insertText",value:function(e,t,n,i){if(2===("."===t?t:t.split(".")).length){var s=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,s>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):e||this.formatValue(t)}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)}},{key:"deleteRange",value:function(e,t,n){return n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n)}},{key:"initCursor",value:function(){var e=this.inputRef.current.selectionStart,t=this.inputRef.current.value,n=t.length,i=null,s=(this.prefixChar||"").length,r=(t=t.replace(this._prefix,"")).charAt(e-=s);if(this.isNumeralChar(r))return e+s;for(var o=e-1;o>=0;){if(r=t.charAt(o),this.isNumeralChar(r)){i=o+s;break}o--}if(null!==i)this.inputRef.current.setSelectionRange(i+1,i+1);else{for(o=e;o<n;){if(r=t.charAt(o),this.isNumeralChar(r)){i=o+s;break}o++}null!==i&&this.inputRef.current.setSelectionRange(i,i)}return i||0}},{key:"onInputClick",value:function(){this.initCursor()}},{key:"isNumeralChar",value:function(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e))||(this.resetRegex(),0))}},{key:"resetRegex",value:function(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0}},{key:"updateValue",value:function(e,t,n,i){var s=this.inputRef.current.value,r=null;null!=t&&(r=this.parseValue(t),r=this.evaluateEmpty(r),this.updateInput(r,n,i,t),this.handleOnChange(e,s,r))}},{key:"evaluateEmpty",value:function(e){return e||this.props.allowEmpty?e:this.props.min||0}},{key:"handleOnChange",value:function(e,t,n){this.props.onChange&&this.isValueChanged(t,n)&&this.props.onChange({originalEvent:e,value:n})}},{key:"isValueChanged",value:function(e,t){return null===t&&null!==e||null!=t&&t!==("string"==typeof e?this.parseValue(e):e)}},{key:"validateValue",value:function(e){return"-"===e||null==e?null:null!==this.props.min&&e<this.props.min?this.props.min:null!==this.props.max&&e>this.props.max?this.props.max:e}},{key:"updateInput",value:function(e,t,n,i){t=t||"";var s=this.inputRef.current,r=s.value,o=this.formatValue(e),a=r.length;if(o!==i&&(o=this.concatValues(o,i)),0===a){s.value=o,s.setSelectionRange(0,0);var u=this.initCursor()+t.length;s.setSelectionRange(u,u)}else{var l=s.selectionStart,p=s.selectionEnd;s.value=o;var c=o.length;if("range-insert"===n){var h=this.parseValue((r||"").slice(0,l)),f=(null!==h?h.toString():"").split("").join("(".concat(this.groupChar,")?")),d=new RegExp(f,"g");d.test(o);var m=t.split("").join("(".concat(this.groupChar,")?")),y=new RegExp(m,"g");y.test(o.slice(d.lastIndex)),s.setSelectionRange(p=d.lastIndex+y.lastIndex,p)}else if(c===a)"insert"===n||"delete-back-single"===n?s.setSelectionRange(p+1,p+1):"delete-single"===n?s.setSelectionRange(p-1,p-1):"delete-range"!==n&&"spin"!==n||s.setSelectionRange(p,p);else if("delete-back-single"===n){var v=r.charAt(p-1),g=r.charAt(p),b=a-c,x=this._group.test(g);x&&1===b?p+=1:!x&&this.isNumeralChar(v)&&(p+=-1*b+1),this._group.lastIndex=0,s.setSelectionRange(p,p)}else if("-"===r&&"insert"===n){s.setSelectionRange(0,0);var D=this.initCursor()+t.length+1;s.setSelectionRange(D,D)}else s.setSelectionRange(p+=c-a,p)}s.setAttribute("aria-valuenow",e)}},{key:"updateInputValue",value:function(e){e=this.evaluateEmpty(e);var t=this.inputRef.current,n=t.value,i=this.formattedValue(e);n!==i&&(t.value=i,t.setAttribute("aria-valuenow",e))}},{key:"formattedValue",value:function(e){var t=this.evaluateEmpty(e);return this.formatValue(t)}},{key:"concatValues",value:function(e,t){if(e&&t){var n=t.search(this._decimal);return this._decimal.lastIndex=0,-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e}},{key:"getDecimalLength",value:function(e){if(e){var t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0}},{key:"updateModel",value:function(e,t){this.props.onValueChange&&this.props.onValueChange({originalEvent:e,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:t}})}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){var n=t.inputRef.current.value;if(t.isValueChanged(n,t.props.value)){var i=t.validateValue(t.parseValue(n));t.updateInputValue(i),t.updateModel(e,i)}t.props.onBlur&&t.props.onBlur(e)}))}},{key:"clearTimer",value:function(){this.timer&&clearInterval(this.timer)}},{key:"isStacked",value:function(){return this.props.showButtons&&"stacked"===this.props.buttonLayout}},{key:"isHorizontal",value:function(){return this.props.showButtons&&"horizontal"===this.props.buttonLayout}},{key:"isVertical",value:function(){return this.props.showButtons&&"vertical"===this.props.buttonLayout}},{key:"getInputMode",value:function(){return this.props.inputMode||("decimal"!==this.props.mode||this.props.minFractionDigits?"decimal":"numeric")}},{key:"getFormatter",value:function(){return this.numberFormat}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&this.renderTooltip();var e=this.validateValue(this.props.value);null!==this.props.value&&this.props.value!==e&&this.updateModel(null,e)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(w({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip());var t=this.isOptionChanged(e);if(t&&this.constructParser(),e.value!==this.props.value||t){var n=this.validateValue(this.props.value);this.updateInputValue(n),null!==this.props.value&&this.props.value!==n&&this.updateModel(null,n)}}},{key:"isOptionChanged",value:function(e){var t=this;return["locale","localeMatcher","mode","currency","currencyDisplay","useGrouping","minFractionDigits","maxFractionDigits","suffix","prefix"].some((function(n){return e[n]!==t.props[n]}))}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=i.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderInputElement",value:function(){var e=n.classNames("p-inputnumber-input",this.props.inputClassName),i=this.formattedValue(this.props.value);return o.default.createElement(t.InputText,{ref:this.inputRef,id:this.props.inputId,style:this.props.inputStyle,role:"spinbutton",className:e,defaultValue:i,type:this.props.type,size:this.props.size,tabIndex:this.props.tabIndex,inputMode:this.getInputMode(),maxLength:this.props.maxLength,disabled:this.props.disabled,required:this.props.required,pattern:this.props.pattern,placeholder:this.props.placeholder,readOnly:this.props.readOnly,name:this.props.name,autoFocus:this.props.autoFocus,onKeyDown:this.onInputKeyDown,onKeyPress:this.onInputKeyPress,onInput:this.onInput,onClick:this.onInputClick,onBlur:this.onInputBlur,onFocus:this.onInputFocus,onPaste:this.onPaste,min:this.props.min,max:this.props.max,"aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.props.value,"aria-labelledby":this.props.ariaLabelledBy})}},{key:"renderUpButton",value:function(){var e=n.classNames("p-inputnumber-button p-inputnumber-button-up p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.incrementButtonClassName),t=n.classNames("p-button-icon",this.props.incrementButtonIcon);return o.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onUpButtonMouseLeave,onMouseDown:this.onUpButtonMouseDown,onMouseUp:this.onUpButtonMouseUp,onKeyDown:this.onUpButtonKeyDown,onKeyUp:this.onUpButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},o.default.createElement("span",{className:t}),o.default.createElement(s.Ripple,null))}},{key:"renderDownButton",value:function(){var e=n.classNames("p-inputnumber-button p-inputnumber-button-down p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.decrementButtonClassName),t=n.classNames("p-button-icon",this.props.decrementButtonIcon);return o.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onDownButtonMouseLeave,onMouseDown:this.onDownButtonMouseDown,onMouseUp:this.onDownButtonMouseUp,onKeyDown:this.onDownButtonKeyDown,onKeyUp:this.onDownButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},o.default.createElement("span",{className:t}),o.default.createElement(s.Ripple,null))}},{key:"renderButtonGroup",value:function(){var e=this.props.showButtons&&this.renderUpButton(),t=this.props.showButtons&&this.renderDownButton();return this.isStacked()?o.default.createElement("span",{className:"p-inputnumber-button-group"},e,t):o.default.createElement(o.default.Fragment,null,e,t)}},{key:"render",value:function(){var e=this,t=n.classNames("p-inputnumber p-component p-inputwrapper",this.props.className,{"p-inputwrapper-filled":null!=this.props.value&&this.props.value.toString().length>0,"p-inputwrapper-focus":this.state.focused,"p-inputnumber-buttons-stacked":this.isStacked(),"p-inputnumber-buttons-horizontal":this.isHorizontal(),"p-inputnumber-buttons-vertical":this.isVertical()}),i=this.renderInputElement(),s=this.renderButtonGroup();return o.default.createElement("span",{ref:function(t){return e.element=t},id:this.props.id,className:t,style:this.props.style},i,s)}}],x&&f(v.prototype,x),D&&f(v,D),C}();x(k,"defaultProps",{value:null,inputRef:null,format:!0,showButtons:!1,buttonLayout:"stacked",incrementButtonClassName:null,decrementButtonClassName:null,incrementButtonIcon:"pi pi-angle-up",decrementButtonIcon:"pi pi-angle-down",locale:void 0,localeMatcher:void 0,mode:"decimal",suffix:null,prefix:null,currency:void 0,currencyDisplay:void 0,useGrouping:!0,minFractionDigits:void 0,maxFractionDigits:void 0,id:null,name:null,type:"text",allowEmpty:!0,step:1,min:null,max:null,disabled:!1,required:!1,tabIndex:null,pattern:null,inputMode:null,placeholder:null,readOnly:!1,size:null,style:null,className:null,inputId:null,autoFocus:!1,inputStyle:null,inputClassName:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onValueChange:null,onChange:null,onBlur:null,onFocus:null,onKeyDown:null}),exports.InputNumber=k;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/inputtext"),n=require("primereact/utils"),i=require("primereact/tooltip"),r=require("primereact/ripple");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(e);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function u(e){if(Array.isArray(e))return a(e)}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function p(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function c(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){return m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},m(e,t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function g(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return d(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var k=function(s){y(C,e.Component);var a,m,v,x,w,k=(a=C,m=I(),function(){var e,t=b(a);if(m){var n=b(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return g(this,e)});function C(t){var n;return h(this,C),(n=k.call(this,t)).state={focused:!1},n.constructParser(),n.onInput=n.onInput.bind(d(n)),n.onInputKeyDown=n.onInputKeyDown.bind(d(n)),n.onInputKeyPress=n.onInputKeyPress.bind(d(n)),n.onInputClick=n.onInputClick.bind(d(n)),n.onInputBlur=n.onInputBlur.bind(d(n)),n.onInputFocus=n.onInputFocus.bind(d(n)),n.onPaste=n.onPaste.bind(d(n)),n.onUpButtonMouseLeave=n.onUpButtonMouseLeave.bind(d(n)),n.onUpButtonMouseDown=n.onUpButtonMouseDown.bind(d(n)),n.onUpButtonMouseUp=n.onUpButtonMouseUp.bind(d(n)),n.onUpButtonKeyDown=n.onUpButtonKeyDown.bind(d(n)),n.onUpButtonKeyUp=n.onUpButtonKeyUp.bind(d(n)),n.onDownButtonMouseLeave=n.onDownButtonMouseLeave.bind(d(n)),n.onDownButtonMouseDown=n.onDownButtonMouseDown.bind(d(n)),n.onDownButtonMouseUp=n.onDownButtonMouseUp.bind(d(n)),n.onDownButtonKeyDown=n.onDownButtonKeyDown.bind(d(n)),n.onDownButtonKeyUp=n.onDownButtonKeyUp.bind(d(n)),n.inputRef=e.createRef(n.props.inputRef),n}return v=C,x=[{key:"getOptions",value:function(){return{localeMatcher:this.props.localeMatcher,style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,useGrouping:this.props.useGrouping,minimumFractionDigits:this.props.minFractionDigits,maximumFractionDigits:this.props.maxFractionDigits}}},{key:"constructParser",value:function(){this.numberFormat=new Intl.NumberFormat(this.props.locale,this.getOptions());var e,t=(e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1}).format(9876543210),u(e)||l(e)||p(e)||c()).reverse(),n=new Map(t.map((function(e,t){return[e,t]})));this._numeral=new RegExp("[".concat(t.join(""),"]"),"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=function(e){return n.get(e)}}},{key:"escapeRegExp",value:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},{key:"getDecimalExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,D(D({},this.getOptions()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,""),"]"),"g")}},{key:"getGroupingExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp("[".concat(this.groupChar,"]"),"g")}},{key:"getMinusSignExpression",value:function(){var e=new Intl.NumberFormat(this.props.locale,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(this._numeral,""),"]"),"g")}},{key:"getCurrencyExpression",value:function(){if(this.props.currency){var e=new Intl.NumberFormat(this.props.locale,{style:"currency",currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,""),"]"),"g")}return new RegExp("[]","g")}},{key:"getPrefixExpression",value:function(){if(this.props.prefix)this.prefixChar=this.props.prefix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp("".concat(this.escapeRegExp(this.prefixChar||"")),"g")}},{key:"getSuffixExpression",value:function(){if(this.props.suffix)this.suffixChar=this.props.suffix;else{var e=new Intl.NumberFormat(this.props.locale,{style:this.props.mode,currency:this.props.currency,currencyDisplay:this.props.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0});this.suffixChar=e.format(1).split("1")[1]}return new RegExp("".concat(this.escapeRegExp(this.suffixChar||"")),"g")}},{key:"formatValue",value:function(e){if(null!=e){if("-"===e)return e;if(this.props.format){var t=new Intl.NumberFormat(this.props.locale,this.getOptions()).format(e);return this.props.prefix&&(t=this.props.prefix+t),this.props.suffix&&(t+=this.props.suffix),t}return e.toString()}return""}},{key:"parseValue",value:function(e){var t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;var n=+t;return isNaN(n)?null:n}return null}},{key:"repeat",value:function(e,t,n){var i=this,r=t||500;this.clearTimer(),this.timer=setTimeout((function(){i.repeat(e,40,n)}),r),this.spin(e,n)}},{key:"spin",value:function(e,t){if(this.inputRef&&this.inputRef.current){var n=this.props.step*t,i=this.parseValue(this.inputRef.current.value)||0,r=this.validateValue(i+n);this.updateInput(r,null,"spin"),this.updateModel(e,r),this.handleOnChange(e,i,r)}}},{key:"onUpButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,1),e.preventDefault())}},{key:"onUpButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onUpButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,1)}},{key:"onDownButtonMouseDown",value:function(e){this.props.disabled||this.props.readOnly||(this.inputRef.current.focus(),this.repeat(e,null,-1),e.preventDefault())}},{key:"onDownButtonMouseUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonMouseLeave",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyUp",value:function(){this.props.disabled||this.props.readOnly||this.clearTimer()}},{key:"onDownButtonKeyDown",value:function(e){this.props.disabled||this.props.readOnly||32!==e.keyCode&&13!==e.keyCode||this.repeat(e,null,-1)}},{key:"onInput",value:function(e){this.props.disabled||this.props.readOnly||(this.isSpecialChar&&(e.target.value=this.lastValue),this.isSpecialChar=!1)}},{key:"onInputKeyDown",value:function(e){if(!this.props.disabled&&!this.props.readOnly)if(this.lastValue=e.target.value,e.shiftKey||e.altKey)this.isSpecialChar=!0;else{var t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,r=null;switch(e.altKey&&e.preventDefault(),e.which){case 38:this.spin(e,1),e.preventDefault();break;case 40:this.spin(e,-1),e.preventDefault();break;case 37:this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case 39:this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case 13:r=this.validateValue(this.parseValue(i)),this.inputRef.current.value=this.formatValue(r),this.inputRef.current.setAttribute("aria-valuenow",r),this.updateModel(e,r);break;case 8:if(e.preventDefault(),t===n){var s=i.charAt(t-1),o=this.getDecimalCharIndexes(i),a=o.decimalCharIndex,u=o.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(s)){var l=this.getDecimalLength(i);if(this._group.test(s))this._group.lastIndex=0,r=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(s))this._decimal.lastIndex=0,l?this.inputRef.current.setSelectionRange(t-1,t-1):r=i.slice(0,t-1)+i.slice(t);else if(a>0&&t>a){var p=this.isDecimalMode()&&(this.props.minFractionDigits||0)<l?"":"0";r=i.slice(0,t-1)+p+i.slice(t)}else 1===u?(r=i.slice(0,t-1)+"0"+i.slice(t),r=this.parseValue(r)>0?r:""):r=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,r,null,"delete-single")}else r=this.deleteRange(i,t,n),this.updateValue(e,r,null,"delete-range");break;case 46:if(e.preventDefault(),t===n){var c=i.charAt(t),h=this.getDecimalCharIndexes(i),f=h.decimalCharIndex,d=h.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(c)){var m=this.getDecimalLength(i);if(this._group.test(c))this._group.lastIndex=0,r=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(c))this._decimal.lastIndex=0,m?this.$refs.input.$el.setSelectionRange(t+1,t+1):r=i.slice(0,t)+i.slice(t+1);else if(f>0&&t>f){var y=this.isDecimalMode()&&(this.props.minFractionDigits||0)<m?"":"0";r=i.slice(0,t)+y+i.slice(t+1)}else 1===d?(r=i.slice(0,t)+"0"+i.slice(t+1),r=this.parseValue(r)>0?r:""):r=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,r,null,"delete-back-single")}else r=this.deleteRange(i,t,n),this.updateValue(e,r,null,"delete-range")}this.props.onKeyDown&&this.props.onKeyDown(e)}}},{key:"onInputKeyPress",value:function(e){if(!this.props.disabled&&!this.props.readOnly){var t=e.which||e.keyCode,n=String.fromCharCode(t),i=this.isDecimalSign(n),r=this.isMinusSign(n);(48<=t&&t<=57||r||i)&&(this.insert(e,n,{isDecimalSign:i,isMinusSign:r}),e.preventDefault())}}},{key:"onPaste",value:function(e){if(e.preventDefault(),!this.props.disabled&&!this.props.readOnly){var t=(e.clipboardData||window.clipboardData).getData("Text");if(t){var n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}}}},{key:"allowMinusSign",value:function(){return null===this.props.min||this.props.min<0}},{key:"isMinusSign",value:function(e){return!(!this._minusSign.test(e)&&"-"!==e||(this._minusSign.lastIndex=0,0))}},{key:"isDecimalSign",value:function(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)}},{key:"isDecimalMode",value:function(){return"decimal"===this.props.mode}},{key:"getDecimalCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}}},{key:"getCharIndexes",value:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.search(this._minusSign);this._minusSign.lastIndex=0;var i=e.search(this._suffix);this._suffix.lastIndex=0;var r=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:r}}},{key:"insert",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,this.allowMinusSign()||-1===i){var r,s=this.inputRef.current.selectionStart,o=this.inputRef.current.selectionEnd,a=this.inputRef.current.value.trim(),u=this.getCharIndexes(a),l=u.decimalCharIndex,p=u.minusCharIndex,c=u.suffixCharIndex,h=u.currencyCharIndex;if(n.isMinusSign)0===s&&(r=a,-1!==p&&0===o||(r=this.insertText(a,t,0,o)),this.updateValue(e,r,t,"insert"));else if(n.isDecimalSign)l>0&&s===l?this.updateValue(e,a,t,"insert"):(l>s&&l<o||-1===l&&this.props.maxFractionDigits)&&(r=this.insertText(a,t,s,o),this.updateValue(e,r,t,"insert"));else{var f=this.numberFormat.resolvedOptions().maximumFractionDigits,d=s!==o?"range-insert":"insert";if(l>0&&s>l){if(s+t.length-(l+1)<=f){var m=h>=s?h-1:c>=s?c:a.length;r=a.slice(0,s)+t+a.slice(s+t.length,m)+a.slice(m),this.updateValue(e,r,t,d)}}else r=this.insertText(a,t,s,o),this.updateValue(e,r,t,d)}}}},{key:"insertText",value:function(e,t,n,i){if(2===("."===t?t:t.split(".")).length){var r=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,r>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):e||this.formatValue(t)}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)}},{key:"deleteRange",value:function(e,t,n){return n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n)}},{key:"initCursor",value:function(){var e=this.inputRef.current.selectionStart,t=this.inputRef.current.value,n=t.length,i=null,r=(this.prefixChar||"").length,s=(t=t.replace(this._prefix,"")).charAt(e-=r);if(this.isNumeralChar(s))return e+r;for(var o=e-1;o>=0;){if(s=t.charAt(o),this.isNumeralChar(s)){i=o+r;break}o--}if(null!==i)this.inputRef.current.setSelectionRange(i+1,i+1);else{for(o=e;o<n;){if(s=t.charAt(o),this.isNumeralChar(s)){i=o+r;break}o++}null!==i&&this.inputRef.current.setSelectionRange(i,i)}return i||0}},{key:"onInputClick",value:function(){this.initCursor()}},{key:"isNumeralChar",value:function(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e))||(this.resetRegex(),0))}},{key:"resetRegex",value:function(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0}},{key:"updateValue",value:function(e,t,n,i){var r=this.inputRef.current.value,s=null;null!=t&&(s=this.parseValue(t),s=this.evaluateEmpty(s),this.updateInput(s,n,i,t),this.handleOnChange(e,r,s))}},{key:"evaluateEmpty",value:function(e){return e||this.props.allowEmpty?e:this.props.min||0}},{key:"handleOnChange",value:function(e,t,n){this.props.onChange&&this.isValueChanged(t,n)&&this.props.onChange({originalEvent:e,value:n})}},{key:"isValueChanged",value:function(e,t){return null===t&&null!==e||null!=t&&t!==("string"==typeof e?this.parseValue(e):e)}},{key:"validateValue",value:function(e){return"-"===e||null==e?null:null!==this.props.min&&e<this.props.min?this.props.min:null!==this.props.max&&e>this.props.max?this.props.max:e}},{key:"updateInput",value:function(e,t,n,i){t=t||"";var r=this.inputRef.current,s=r.value,o=this.formatValue(e),a=s.length;if(o!==i&&(o=this.concatValues(o,i)),0===a){r.value=o,r.setSelectionRange(0,0);var u=this.initCursor()+t.length;r.setSelectionRange(u,u)}else{var l=r.selectionStart,p=r.selectionEnd;r.value=o;var c=o.length;if("range-insert"===n){var h=this.parseValue((s||"").slice(0,l)),f=(null!==h?h.toString():"").split("").join("(".concat(this.groupChar,")?")),d=new RegExp(f,"g");d.test(o);var m=t.split("").join("(".concat(this.groupChar,")?")),y=new RegExp(m,"g");y.test(o.slice(d.lastIndex)),r.setSelectionRange(p=d.lastIndex+y.lastIndex,p)}else if(c===a)"insert"===n||"delete-back-single"===n?r.setSelectionRange(p+1,p+1):"delete-single"===n?r.setSelectionRange(p-1,p-1):"delete-range"!==n&&"spin"!==n||r.setSelectionRange(p,p);else if("delete-back-single"===n){var v=s.charAt(p-1),g=s.charAt(p),b=a-c,x=this._group.test(g);x&&1===b?p+=1:!x&&this.isNumeralChar(v)&&(p+=-1*b+1),this._group.lastIndex=0,r.setSelectionRange(p,p)}else if("-"===s&&"insert"===n){r.setSelectionRange(0,0);var w=this.initCursor()+t.length+1;r.setSelectionRange(w,w)}else r.setSelectionRange(p+=c-a,p)}r.setAttribute("aria-valuenow",e)}},{key:"updateInputValue",value:function(e){e=this.evaluateEmpty(e);var t=this.inputRef.current,n=t.value,i=this.formattedValue(e);n!==i&&(t.value=i,t.setAttribute("aria-valuenow",e))}},{key:"formattedValue",value:function(e){var t=this.evaluateEmpty(e);return this.formatValue(t)}},{key:"concatValues",value:function(e,t){if(e&&t){var n=t.search(this._decimal);return this._decimal.lastIndex=0,-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e}},{key:"getDecimalLength",value:function(e){if(e){var t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0}},{key:"updateModel",value:function(e,t){this.props.onValueChange&&this.props.onValueChange({originalEvent:e,value:t,stopPropagation:function(){},preventDefault:function(){},target:{name:this.props.name,id:this.props.id,value:t}})}},{key:"onInputFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onInputBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){var n=t.inputRef.current.value;if(t.isValueChanged(n,t.props.value)){var i=t.validateValue(t.parseValue(n));t.updateInputValue(i),t.updateModel(e,i)}t.props.onBlur&&t.props.onBlur(e)}))}},{key:"clearTimer",value:function(){this.timer&&clearInterval(this.timer)}},{key:"isStacked",value:function(){return this.props.showButtons&&"stacked"===this.props.buttonLayout}},{key:"isHorizontal",value:function(){return this.props.showButtons&&"horizontal"===this.props.buttonLayout}},{key:"isVertical",value:function(){return this.props.showButtons&&"vertical"===this.props.buttonLayout}},{key:"getInputMode",value:function(){return this.props.inputMode||("decimal"!==this.props.mode||this.props.minFractionDigits?"decimal":"numeric")}},{key:"getFormatter",value:function(){return this.numberFormat}},{key:"updateInputRef",value:function(){var e=this.props.inputRef;e&&("function"==typeof e?e(this.inputRef.current):e.current=this.inputRef.current)}},{key:"componentDidMount",value:function(){this.updateInputRef(),this.props.tooltip&&this.renderTooltip();var e=this.validateValue(this.props.value);null!==this.props.value&&this.props.value!==e&&this.updateModel(null,e)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(D({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip());var t=this.isOptionChanged(e);if(t&&this.constructParser(),e.value!==this.props.value||t){var n=this.validateValue(this.props.value);this.updateInputValue(n),null!==this.props.value&&this.props.value!==n&&this.updateModel(null,n)}}},{key:"isOptionChanged",value:function(e){var t=this;return["locale","localeMatcher","mode","currency","currencyDisplay","useGrouping","minFractionDigits","maxFractionDigits","suffix","prefix"].some((function(n){return e[n]!==t.props[n]}))}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=i.tip({target:this.element,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderInputElement",value:function(){var e=n.classNames("p-inputnumber-input",this.props.inputClassName),i=this.formattedValue(this.props.value);return o.default.createElement(t.InputText,{ref:this.inputRef,id:this.props.inputId,style:this.props.inputStyle,role:"spinbutton",className:e,defaultValue:i,type:this.props.type,size:this.props.size,tabIndex:this.props.tabIndex,inputMode:this.getInputMode(),maxLength:this.props.maxLength,disabled:this.props.disabled,required:this.props.required,pattern:this.props.pattern,placeholder:this.props.placeholder,readOnly:this.props.readOnly,name:this.props.name,autoFocus:this.props.autoFocus,onKeyDown:this.onInputKeyDown,onKeyPress:this.onInputKeyPress,onInput:this.onInput,onClick:this.onInputClick,onBlur:this.onInputBlur,onFocus:this.onInputFocus,onPaste:this.onPaste,min:this.props.min,max:this.props.max,"aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.props.value,"aria-labelledby":this.props.ariaLabelledBy})}},{key:"renderUpButton",value:function(){var e=n.classNames("p-inputnumber-button p-inputnumber-button-up p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.incrementButtonClassName),t=n.classNames("p-button-icon",this.props.incrementButtonIcon);return o.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onUpButtonMouseLeave,onMouseDown:this.onUpButtonMouseDown,onMouseUp:this.onUpButtonMouseUp,onKeyDown:this.onUpButtonKeyDown,onKeyUp:this.onUpButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},o.default.createElement("span",{className:t}),o.default.createElement(r.Ripple,null))}},{key:"renderDownButton",value:function(){var e=n.classNames("p-inputnumber-button p-inputnumber-button-down p-button p-button-icon-only p-component",{"p-disabled":this.props.disabled},this.props.decrementButtonClassName),t=n.classNames("p-button-icon",this.props.decrementButtonIcon);return o.default.createElement("button",{type:"button",className:e,onMouseLeave:this.onDownButtonMouseLeave,onMouseDown:this.onDownButtonMouseDown,onMouseUp:this.onDownButtonMouseUp,onKeyDown:this.onDownButtonKeyDown,onKeyUp:this.onDownButtonKeyUp,disabled:this.props.disabled,tabIndex:-1},o.default.createElement("span",{className:t}),o.default.createElement(r.Ripple,null))}},{key:"renderButtonGroup",value:function(){var e=this.props.showButtons&&this.renderUpButton(),t=this.props.showButtons&&this.renderDownButton();return this.isStacked()?o.default.createElement("span",{className:"p-inputnumber-button-group"},e,t):o.default.createElement(o.default.Fragment,null,e,t)}},{key:"render",value:function(){var e=this,t=n.classNames("p-inputnumber p-component p-inputwrapper",this.props.className,{"p-inputwrapper-filled":null!=this.props.value&&this.props.value.toString().length>0,"p-inputwrapper-focus":this.state.focused,"p-inputnumber-buttons-stacked":this.isStacked(),"p-inputnumber-buttons-horizontal":this.isHorizontal(),"p-inputnumber-buttons-vertical":this.isVertical()}),i=this.renderInputElement(),r=this.renderButtonGroup();return o.default.createElement("span",{ref:function(t){return e.element=t},id:this.props.id,className:t,style:this.props.style},i,r)}}],x&&f(v.prototype,x),w&&f(v,w),Object.defineProperty(v,"prototype",{writable:!1}),C}();x(k,"defaultProps",{value:null,inputRef:null,format:!0,showButtons:!1,buttonLayout:"stacked",incrementButtonClassName:null,decrementButtonClassName:null,incrementButtonIcon:"pi pi-angle-up",decrementButtonIcon:"pi pi-angle-down",locale:void 0,localeMatcher:void 0,mode:"decimal",suffix:null,prefix:null,currency:void 0,currencyDisplay:void 0,useGrouping:!0,minFractionDigits:void 0,maxFractionDigits:void 0,id:null,name:null,type:"text",allowEmpty:!0,step:1,min:null,max:null,disabled:!1,required:!1,tabIndex:null,pattern:null,inputMode:null,placeholder:null,readOnly:!1,size:null,style:null,className:null,inputId:null,autoFocus:!1,inputStyle:null,inputClassName:null,tooltip:null,tooltipOptions:null,ariaLabelledBy:null,onValueChange:null,onChange:null,onBlur:null,onFocus:null,onKeyDown:null}),exports.InputNumber=k;