primereact 6.6.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -9
- package/accordion/accordion.cjs.js +32 -23
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.d.ts +3 -2
- package/accordion/accordion.esm.js +17 -8
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +32 -24
- package/accordion/accordion.min.js +1 -1
- package/api/api.cjs.js +374 -42
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +126 -32
- package/api/api.esm.js +371 -43
- package/api/api.esm.min.js +1 -1
- package/api/api.js +374 -44
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +79 -69
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +3 -1
- package/autocomplete/autocomplete.esm.js +15 -5
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +75 -70
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/avatar.cjs.js +12 -9
- package/avatar/avatar.cjs.min.js +1 -1
- package/avatar/avatar.d.ts +2 -1
- package/avatar/avatar.esm.js +7 -4
- package/avatar/avatar.esm.min.js +1 -1
- package/avatar/avatar.js +13 -10
- package/avatar/avatar.min.js +1 -1
- package/avatargroup/avatargroup.cjs.js +5 -3
- package/avatargroup/avatargroup.cjs.min.js +1 -1
- package/avatargroup/avatargroup.esm.js +3 -1
- package/avatargroup/avatargroup.esm.min.js +1 -1
- package/avatargroup/avatargroup.js +6 -4
- package/avatargroup/avatargroup.min.js +1 -1
- package/badge/badge.cjs.js +5 -3
- package/badge/badge.cjs.min.js +1 -1
- package/badge/badge.esm.js +3 -1
- package/badge/badge.esm.min.js +1 -1
- package/badge/badge.js +6 -4
- package/badge/badge.min.js +1 -1
- package/blockui/blockui.cjs.js +19 -13
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +7 -2
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +18 -14
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +18 -16
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +3 -1
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +19 -17
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/button.cjs.js +44 -53
- package/button/button.cjs.min.js +1 -1
- package/button/button.d.ts +4 -11
- package/button/button.esm.js +33 -42
- package/button/button.esm.min.js +1 -1
- package/button/button.js +43 -54
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +183 -153
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +5 -1
- package/calendar/calendar.esm.js +57 -27
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +179 -154
- package/calendar/calendar.min.css +1 -1
- package/calendar/calendar.min.js +1 -1
- package/captcha/captcha.cjs.js +3 -1
- package/captcha/captcha.cjs.min.js +1 -1
- package/captcha/captcha.esm.js +2 -0
- package/captcha/captcha.esm.min.js +1 -1
- package/captcha/captcha.js +4 -2
- package/captcha/captcha.min.js +1 -1
- package/card/card.cjs.js +15 -13
- package/card/card.cjs.min.js +1 -1
- package/card/card.esm.js +3 -1
- package/card/card.esm.min.js +1 -1
- package/card/card.js +16 -14
- package/card/card.min.js +1 -1
- package/carousel/carousel.cjs.js +39 -36
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +4 -1
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +39 -37
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +53 -47
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +8 -2
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +50 -48
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/chart.cjs.js +8 -8
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +3 -1
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +7 -5
- package/chart/chart.min.js +1 -1
- package/checkbox/checkbox.cjs.js +22 -15
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.d.ts +2 -1
- package/checkbox/checkbox.esm.js +15 -8
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +22 -16
- package/checkbox/checkbox.min.js +1 -1
- package/chip/chip.cjs.js +18 -14
- package/chip/chip.cjs.min.js +1 -1
- package/chip/chip.d.ts +3 -4
- package/chip/chip.esm.js +13 -9
- package/chip/chip.esm.min.js +1 -1
- package/chip/chip.js +19 -15
- package/chip/chip.min.js +1 -1
- package/chips/chips.cjs.js +48 -20
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.d.ts +10 -0
- package/chips/chips.esm.js +39 -11
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +48 -21
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +37 -31
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.d.ts +1 -1
- package/colorpicker/colorpicker.esm.js +8 -2
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +34 -32
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/column.cjs.js +34 -9
- package/column/column.cjs.min.js +1 -1
- package/column/column.d.ts +168 -13
- package/column/column.esm.js +34 -9
- package/column/column.esm.min.js +1 -1
- package/column/column.js +35 -10
- package/column/column.min.js +1 -1
- package/columngroup/columngroup.cjs.js +2 -0
- package/columngroup/columngroup.cjs.min.js +1 -1
- package/columngroup/columngroup.esm.js +2 -0
- package/columngroup/columngroup.esm.min.js +1 -1
- package/columngroup/columngroup.js +3 -1
- package/columngroup/columngroup.min.js +1 -1
- package/common/common.min.css +1 -1
- package/confirmdialog/confirmdialog.cjs.js +24 -20
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.d.ts +4 -3
- package/confirmdialog/confirmdialog.esm.js +8 -4
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +24 -21
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/confirmpopup/confirmpopup.cjs.js +47 -40
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.d.ts +4 -3
- package/confirmpopup/confirmpopup.esm.js +12 -6
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +44 -40
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +70 -63
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +37 -31
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +67 -64
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +11745 -1573
- package/core/core.min.js +40 -1
- package/csstransition/csstransition.cjs.js +3 -1
- package/csstransition/csstransition.cjs.min.js +1 -1
- package/csstransition/csstransition.esm.js +2 -0
- package/csstransition/csstransition.esm.min.js +1 -1
- package/csstransition/csstransition.js +4 -2
- package/csstransition/csstransition.min.js +1 -1
- package/datascroller/datascroller.cjs.js +14 -11
- package/datascroller/datascroller.cjs.min.js +1 -1
- package/datascroller/datascroller.esm.js +6 -3
- package/datascroller/datascroller.esm.min.js +1 -1
- package/datascroller/datascroller.js +14 -12
- package/datascroller/datascroller.min.js +1 -1
- package/datatable/datatable.cjs.js +4784 -3277
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +100 -29
- package/datatable/datatable.esm.js +4859 -3353
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +4777 -3278
- package/datatable/datatable.min.css +1 -1
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +34 -29
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +8 -3
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +33 -30
- package/dataview/dataview.min.js +1 -1
- package/deferredcontent/deferredcontent.cjs.js +3 -1
- package/deferredcontent/deferredcontent.cjs.min.js +1 -1
- package/deferredcontent/deferredcontent.esm.js +2 -0
- package/deferredcontent/deferredcontent.esm.min.js +1 -1
- package/deferredcontent/deferredcontent.js +4 -2
- package/deferredcontent/deferredcontent.min.js +1 -1
- package/dialog/dialog.cjs.js +68 -51
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.d.ts +1 -0
- package/dialog/dialog.esm.js +22 -6
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +65 -52
- package/dialog/dialog.min.js +1 -1
- package/divider/divider.cjs.js +6 -4
- package/divider/divider.cjs.min.js +1 -1
- package/divider/divider.esm.js +3 -1
- package/divider/divider.esm.min.js +1 -1
- package/divider/divider.js +7 -5
- package/divider/divider.min.js +1 -1
- package/dock/dock.cjs.js +53 -17
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.d.ts +13 -0
- package/dock/dock.esm.js +41 -5
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +53 -18
- package/dock/dock.min.css +1 -1
- package/dock/dock.min.js +1 -1
- package/dropdown/dropdown.cjs.js +90 -76
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +28 -14
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +86 -77
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +40 -40
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +4 -2
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +39 -37
- package/editor/editor.min.js +1 -1
- package/fieldset/fieldset.cjs.js +19 -15
- package/fieldset/fieldset.cjs.min.js +1 -1
- package/fieldset/fieldset.esm.js +5 -1
- package/fieldset/fieldset.esm.min.js +1 -1
- package/fieldset/fieldset.js +18 -16
- package/fieldset/fieldset.min.js +1 -1
- package/fileupload/fileupload.cjs.js +65 -56
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.d.ts +2 -1
- package/fileupload/fileupload.esm.js +26 -17
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +65 -57
- package/fileupload/fileupload.min.js +1 -1
- package/fullcalendar/fullcalendar.cjs.js +8 -8
- package/fullcalendar/fullcalendar.cjs.min.js +1 -1
- package/fullcalendar/fullcalendar.esm.js +3 -1
- package/fullcalendar/fullcalendar.esm.min.js +1 -1
- package/fullcalendar/fullcalendar.js +7 -5
- package/fullcalendar/fullcalendar.min.js +1 -1
- package/galleria/galleria.cjs.js +72 -65
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +8 -2
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +69 -66
- package/galleria/galleria.min.js +1 -1
- package/gmap/gmap.cjs.js +3 -1
- package/gmap/gmap.cjs.min.js +1 -1
- package/gmap/gmap.esm.js +2 -0
- package/gmap/gmap.esm.min.js +1 -1
- package/gmap/gmap.js +4 -2
- package/gmap/gmap.min.js +1 -1
- package/image/image.cjs.js +33 -27
- package/image/image.cjs.min.js +1 -1
- package/image/image.d.ts +5 -5
- package/image/image.esm.js +7 -2
- package/image/image.esm.min.js +1 -1
- package/image/image.js +31 -28
- package/image/image.min.js +1 -1
- package/inplace/inplace.cjs.js +10 -8
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +3 -1
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +11 -9
- package/inplace/inplace.min.js +1 -1
- package/inputmask/inputmask.cjs.js +11 -8
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +4 -1
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +11 -9
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +50 -29
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +33 -12
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +49 -30
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +17 -12
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +10 -5
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +17 -13
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/inputtext.cjs.js +14 -10
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.d.ts +1 -1
- package/inputtext/inputtext.esm.js +5 -1
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +13 -11
- package/inputtext/inputtext.min.css +1 -1
- package/inputtext/inputtext.min.js +1 -1
- package/inputtextarea/inputtextarea.cjs.js +12 -9
- package/inputtextarea/inputtextarea.cjs.min.js +1 -1
- package/inputtextarea/inputtextarea.d.ts +1 -1
- package/inputtextarea/inputtextarea.esm.js +4 -1
- package/inputtextarea/inputtextarea.esm.min.js +1 -1
- package/inputtextarea/inputtextarea.js +12 -10
- package/inputtextarea/inputtextarea.min.js +1 -1
- package/keyfilter/keyfilter.cjs.js +5 -5
- package/keyfilter/keyfilter.cjs.min.js +1 -1
- package/keyfilter/keyfilter.esm.js +1 -1
- package/keyfilter/keyfilter.esm.min.js +1 -1
- package/keyfilter/keyfilter.js +6 -6
- package/keyfilter/keyfilter.min.js +1 -1
- package/knob/knob.cjs.js +9 -7
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +3 -1
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +10 -8
- package/knob/knob.min.js +1 -1
- package/listbox/listbox.cjs.js +44 -39
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +9 -4
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +42 -40
- package/listbox/listbox.min.js +1 -1
- package/megamenu/megamenu.cjs.js +38 -35
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +4 -1
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +38 -36
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +55 -46
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +10 -2
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +50 -47
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +35 -28
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.d.ts +2 -0
- package/menu/menu.esm.js +8 -2
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +32 -29
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +40 -35
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +6 -2
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +39 -36
- package/menubar/menubar.min.js +1 -1
- package/message/message.cjs.js +11 -8
- package/message/message.cjs.min.js +1 -1
- package/message/message.d.ts +3 -1
- package/message/message.esm.js +5 -2
- package/message/message.esm.min.js +1 -1
- package/message/message.js +12 -9
- package/message/message.min.js +1 -1
- package/messages/messages.cjs.js +21 -17
- package/messages/messages.cjs.min.js +1 -1
- package/messages/messages.esm.js +5 -1
- package/messages/messages.esm.min.js +1 -1
- package/messages/messages.js +20 -18
- package/messages/messages.min.js +1 -1
- package/multiselect/multiselect.cjs.js +132 -118
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +6 -2
- package/multiselect/multiselect.esm.js +47 -33
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +128 -119
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +16 -13
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.d.ts +2 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +4 -1
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +16 -14
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/orderlist/orderlist.cjs.js +37 -34
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +4 -1
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +37 -35
- package/orderlist/orderlist.min.js +1 -1
- package/organizationchart/organizationchart.cjs.js +28 -26
- package/organizationchart/organizationchart.cjs.min.js +1 -1
- package/organizationchart/organizationchart.esm.js +3 -1
- package/organizationchart/organizationchart.esm.min.js +1 -1
- package/organizationchart/organizationchart.js +29 -27
- package/organizationchart/organizationchart.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +33 -24
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.d.ts +1 -1
- package/overlaypanel/overlaypanel.esm.js +10 -2
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +29 -25
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/overlayservice/overlayservice.cjs.js +2 -2
- package/overlayservice/overlayservice.cjs.min.js +1 -1
- package/overlayservice/overlayservice.esm.js +1 -1
- package/overlayservice/overlayservice.esm.min.js +1 -1
- package/overlayservice/overlayservice.js +3 -3
- package/overlayservice/overlayservice.min.js +1 -1
- package/package.json +10 -4
- package/paginator/paginator.cjs.js +51 -48
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +5 -2
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +51 -49
- package/paginator/paginator.min.js +1 -1
- package/panel/panel.cjs.js +21 -17
- package/panel/panel.cjs.min.js +1 -1
- package/panel/panel.esm.js +5 -1
- package/panel/panel.esm.min.js +1 -1
- package/panel/panel.js +20 -18
- package/panel/panel.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +42 -39
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +4 -1
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +42 -40
- package/panelmenu/panelmenu.min.js +1 -1
- package/password/password.cjs.js +35 -29
- package/password/password.cjs.min.js +1 -1
- package/password/password.d.ts +1 -1
- package/password/password.esm.js +8 -2
- package/password/password.esm.min.js +1 -1
- package/password/password.js +32 -30
- package/password/password.min.js +1 -1
- package/picklist/picklist.cjs.js +60 -54
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +16 -10
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +60 -55
- package/picklist/picklist.min.js +1 -1
- package/portal/portal.cjs.js +7 -3
- package/portal/portal.cjs.min.js +1 -1
- package/portal/portal.esm.js +6 -2
- package/portal/portal.esm.min.js +1 -1
- package/portal/portal.js +8 -4
- package/portal/portal.min.js +1 -1
- package/primereact.all.cjs.js +8041 -5835
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +6905 -4701
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +8040 -5832
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.cjs.js +11 -9
- package/progressbar/progressbar.cjs.min.js +1 -1
- package/progressbar/progressbar.esm.js +3 -1
- package/progressbar/progressbar.esm.min.js +1 -1
- package/progressbar/progressbar.js +12 -10
- package/progressbar/progressbar.min.js +1 -1
- package/progressspinner/progressspinner.cjs.js +7 -5
- package/progressspinner/progressspinner.cjs.min.js +1 -1
- package/progressspinner/progressspinner.esm.js +3 -1
- package/progressspinner/progressspinner.esm.min.js +1 -1
- package/progressspinner/progressspinner.js +8 -6
- package/progressspinner/progressspinner.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +12 -9
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +4 -1
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +12 -10
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/rating.cjs.js +12 -9
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +6 -3
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +12 -10
- package/rating/rating.min.js +1 -1
- package/resources/primereact.css +430 -238
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +158 -27
- package/resources/themes/arya-green/theme.css +158 -27
- package/resources/themes/arya-orange/theme.css +158 -27
- package/resources/themes/arya-purple/theme.css +158 -27
- package/resources/themes/bootstrap4-dark-blue/theme.css +162 -31
- package/resources/themes/bootstrap4-dark-purple/theme.css +162 -31
- package/resources/themes/bootstrap4-light-blue/theme.css +162 -31
- package/resources/themes/bootstrap4-light-purple/theme.css +162 -31
- package/resources/themes/fluent-light/theme.css +158 -27
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-blue/theme.css +5671 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/theme.css +5671 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-purple/theme.css +5671 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-dark-teal/theme.css +5671 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-blue/theme.css +5671 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-indigo/theme.css +5671 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-purple/theme.css +5671 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/lara-light-teal/theme.css +5671 -0
- package/resources/themes/luna-amber/theme.css +162 -31
- package/resources/themes/luna-blue/theme.css +162 -31
- package/resources/themes/luna-green/theme.css +162 -31
- package/resources/themes/luna-pink/theme.css +162 -31
- package/resources/themes/md-dark-deeppurple/theme.css +347 -56
- package/resources/themes/md-dark-indigo/theme.css +347 -56
- package/resources/themes/md-light-deeppurple/theme.css +347 -56
- package/resources/themes/md-light-indigo/theme.css +347 -56
- package/resources/themes/mdc-dark-deeppurple/theme.css +347 -56
- package/resources/themes/mdc-dark-indigo/theme.css +347 -56
- package/resources/themes/mdc-light-deeppurple/theme.css +347 -56
- package/resources/themes/mdc-light-indigo/theme.css +347 -56
- package/resources/themes/nova/theme.css +162 -31
- package/resources/themes/nova-accent/theme.css +162 -31
- package/resources/themes/nova-alt/theme.css +162 -31
- package/resources/themes/rhea/theme.css +162 -31
- package/resources/themes/saga-blue/theme.css +158 -27
- package/resources/themes/saga-green/theme.css +158 -27
- package/resources/themes/saga-orange/theme.css +158 -27
- package/resources/themes/saga-purple/theme.css +158 -27
- package/resources/themes/tailwind-light/theme.css +162 -31
- package/resources/themes/vela-blue/theme.css +158 -27
- package/resources/themes/vela-green/theme.css +158 -27
- package/resources/themes/vela-orange/theme.css +158 -27
- package/resources/themes/vela-purple/theme.css +158 -27
- package/ripple/ripple.cjs.js +13 -11
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +5 -3
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +14 -12
- package/ripple/ripple.min.js +1 -1
- package/row/row.cjs.js +3 -1
- package/row/row.cjs.min.js +1 -1
- package/row/row.esm.js +2 -0
- package/row/row.esm.min.js +1 -1
- package/row/row.js +4 -2
- package/row/row.min.js +1 -1
- package/scrollpanel/scrollpanel.cjs.js +21 -19
- package/scrollpanel/scrollpanel.cjs.min.js +1 -1
- package/scrollpanel/scrollpanel.esm.js +3 -1
- package/scrollpanel/scrollpanel.esm.min.js +1 -1
- package/scrollpanel/scrollpanel.js +22 -20
- package/scrollpanel/scrollpanel.min.js +1 -1
- package/scrolltop/scrolltop.cjs.js +20 -13
- package/scrolltop/scrolltop.cjs.min.js +1 -1
- package/scrolltop/scrolltop.d.ts +2 -1
- package/scrolltop/scrolltop.esm.js +11 -5
- package/scrolltop/scrolltop.esm.min.js +1 -1
- package/scrolltop/scrolltop.js +18 -14
- package/scrolltop/scrolltop.min.js +1 -1
- package/selectbutton/selectbutton.cjs.js +19 -15
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +5 -1
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +18 -16
- package/selectbutton/selectbutton.min.js +1 -1
- package/selectitem/selectitem.d.ts +3 -1
- package/sidebar/sidebar.cjs.js +144 -116
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.d.ts +2 -0
- package/sidebar/sidebar.esm.js +135 -108
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +141 -117
- package/sidebar/sidebar.min.css +1 -1
- package/sidebar/sidebar.min.js +1 -1
- package/skeleton/skeleton.cjs.js +5 -3
- package/skeleton/skeleton.cjs.min.js +1 -1
- package/skeleton/skeleton.esm.js +3 -1
- package/skeleton/skeleton.esm.min.js +1 -1
- package/skeleton/skeleton.js +6 -4
- package/skeleton/skeleton.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +39 -32
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +8 -2
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +36 -33
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.cjs.js +40 -23
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +32 -15
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +41 -24
- package/slider/slider.min.js +1 -1
- package/speeddial/speeddial.cjs.js +22 -19
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.d.ts +3 -2
- package/speeddial/speeddial.esm.js +4 -1
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +22 -20
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +39 -33
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.d.ts +4 -5
- package/splitbutton/splitbutton.esm.js +8 -2
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +36 -34
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.cjs.js +21 -19
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +4 -2
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +22 -20
- package/splitter/splitter.min.js +1 -1
- package/steps/steps.cjs.js +12 -10
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +3 -1
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +13 -11
- package/steps/steps.min.js +1 -1
- package/styleclass/styleclass.cjs.js +35 -39
- package/styleclass/styleclass.cjs.min.js +1 -1
- package/styleclass/styleclass.esm.js +20 -24
- package/styleclass/styleclass.esm.min.js +1 -1
- package/styleclass/styleclass.js +36 -40
- package/styleclass/styleclass.min.js +1 -1
- package/tabmenu/tabmenu.cjs.js +18 -15
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +4 -1
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +18 -16
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.cjs.js +177 -54
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +4 -1
- package/tabview/tabview.esm.js +146 -23
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +177 -55
- package/tabview/tabview.min.css +1 -1
- package/tabview/tabview.min.js +1 -1
- package/tag/tag.cjs.js +11 -8
- package/tag/tag.cjs.min.js +1 -1
- package/tag/tag.d.ts +2 -1
- package/tag/tag.esm.js +7 -4
- package/tag/tag.esm.min.js +1 -1
- package/tag/tag.js +12 -9
- package/tag/tag.min.js +1 -1
- package/terminal/terminal.cjs.js +14 -12
- package/terminal/terminal.cjs.min.js +1 -1
- package/terminal/terminal.esm.js +3 -1
- package/terminal/terminal.esm.min.js +1 -1
- package/terminal/terminal.js +15 -13
- package/terminal/terminal.min.js +1 -1
- package/terminalservice/terminalservice.cjs.js +2 -2
- package/terminalservice/terminalservice.cjs.min.js +1 -1
- package/terminalservice/terminalservice.esm.js +1 -1
- package/terminalservice/terminalservice.esm.min.js +1 -1
- package/terminalservice/terminalservice.js +3 -3
- package/terminalservice/terminalservice.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +44 -36
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +9 -2
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +40 -37
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/timeline.cjs.js +14 -12
- package/timeline/timeline.cjs.min.js +1 -1
- package/timeline/timeline.esm.js +3 -1
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +15 -13
- package/timeline/timeline.min.js +1 -1
- package/toast/toast.cjs.js +48 -40
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.esm.js +22 -15
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +46 -41
- package/toast/toast.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +16 -9
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.d.ts +3 -2
- package/togglebutton/togglebutton.esm.js +10 -3
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +15 -10
- package/togglebutton/togglebutton.min.js +1 -1
- package/toolbar/toolbar.cjs.js +9 -7
- package/toolbar/toolbar.cjs.min.js +1 -1
- package/toolbar/toolbar.esm.js +3 -1
- package/toolbar/toolbar.esm.min.js +1 -1
- package/toolbar/toolbar.js +10 -8
- package/toolbar/toolbar.min.js +1 -1
- package/tooltip/tooltip.cjs.js +36 -31
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +6 -2
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +35 -32
- package/tooltip/tooltip.min.css +1 -1
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +54 -51
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.d.ts +9 -2
- package/tree/tree.esm.js +4 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +54 -52
- package/tree/tree.min.js +1 -1
- package/treenode/treenode.d.ts +3 -1
- package/treeselect/treeselect.cjs.js +52 -46
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +9 -2
- package/treeselect/treeselect.esm.js +11 -5
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +49 -47
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +1290 -272
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.d.ts +9 -2
- package/treetable/treetable.esm.js +1213 -195
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +1288 -273
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +13 -10
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +4 -1
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +13 -11
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/utils.cjs.js +502 -525
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +29 -20
- package/utils/utils.esm.js +501 -524
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +503 -526
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +285 -168
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +21 -9
- package/virtualscroller/virtualscroller.esm.js +278 -161
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +286 -169
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +17 -27
- package/core/core.cjs.js +0 -3080
- package/core/core.cjs.min.js +0 -1
- package/core/core.esm.js +0 -3055
- package/core/core.esm.min.js +0 -1
- package/core/package.json +0 -5
package/mention/mention.cjs.js
CHANGED
|
@@ -3,11 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var utils = require('primereact/utils');
|
|
7
|
+
var ripple = require('primereact/ripple');
|
|
8
|
+
var overlayservice = require('primereact/overlayservice');
|
|
9
|
+
var csstransition = require('primereact/csstransition');
|
|
10
|
+
var portal = require('primereact/portal');
|
|
11
|
+
var tooltip = require('primereact/tooltip');
|
|
12
|
+
var PrimeReact = require('primereact/api');
|
|
7
13
|
|
|
8
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
15
|
|
|
10
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
+
var PrimeReact__default = /*#__PURE__*/_interopDefaultLegacy(PrimeReact);
|
|
11
18
|
|
|
12
19
|
function _extends() {
|
|
13
20
|
_extends = Object.assign || function (target) {
|
|
@@ -100,6 +107,8 @@ function _typeof(obj) {
|
|
|
100
107
|
function _possibleConstructorReturn(self, call) {
|
|
101
108
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
102
109
|
return call;
|
|
110
|
+
} else if (call !== void 0) {
|
|
111
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
return _assertThisInitialized(self);
|
|
@@ -194,7 +203,7 @@ var InputTextareaComponent = /*#__PURE__*/function (_Component) {
|
|
|
194
203
|
this.resize();
|
|
195
204
|
}
|
|
196
205
|
|
|
197
|
-
if (e.target.value.length > 0)
|
|
206
|
+
if (e.target.value.length > 0) utils.DomHandler.addClass(e.target, 'p-filled');else utils.DomHandler.removeClass(e.target, 'p-filled');
|
|
198
207
|
|
|
199
208
|
if (this.props.onInput) {
|
|
200
209
|
this.props.onInput(e);
|
|
@@ -205,7 +214,7 @@ var InputTextareaComponent = /*#__PURE__*/function (_Component) {
|
|
|
205
214
|
value: function resize(initial) {
|
|
206
215
|
var inputEl = this.elementRef && this.elementRef.current;
|
|
207
216
|
|
|
208
|
-
if (inputEl &&
|
|
217
|
+
if (inputEl && utils.DomHandler.isVisible(inputEl)) {
|
|
209
218
|
if (!this.cachedScrollHeight) {
|
|
210
219
|
this.cachedScrollHeight = inputEl.scrollHeight;
|
|
211
220
|
inputEl.style.overflow = "hidden";
|
|
@@ -281,7 +290,7 @@ var InputTextareaComponent = /*#__PURE__*/function (_Component) {
|
|
|
281
290
|
}, {
|
|
282
291
|
key: "renderTooltip",
|
|
283
292
|
value: function renderTooltip() {
|
|
284
|
-
this.tooltip =
|
|
293
|
+
this.tooltip = tooltip.tip({
|
|
285
294
|
target: this.elementRef.current,
|
|
286
295
|
content: this.props.tooltip,
|
|
287
296
|
options: this.props.tooltipOptions
|
|
@@ -290,13 +299,13 @@ var InputTextareaComponent = /*#__PURE__*/function (_Component) {
|
|
|
290
299
|
}, {
|
|
291
300
|
key: "render",
|
|
292
301
|
value: function render() {
|
|
293
|
-
var className =
|
|
302
|
+
var className = utils.classNames('p-inputtextarea p-inputtext p-component', {
|
|
294
303
|
'p-disabled': this.props.disabled,
|
|
295
304
|
'p-filled': this.isFilled(),
|
|
296
305
|
'p-inputtextarea-resizable': this.props.autoResize
|
|
297
306
|
}, this.props.className);
|
|
298
|
-
var textareaProps =
|
|
299
|
-
return /*#__PURE__*/React__default[
|
|
307
|
+
var textareaProps = utils.ObjectUtils.findDiffKeys(this.props, InputTextareaComponent.defaultProps);
|
|
308
|
+
return /*#__PURE__*/React__default["default"].createElement("textarea", _extends({
|
|
300
309
|
ref: this.elementRef
|
|
301
310
|
}, textareaProps, {
|
|
302
311
|
className: className,
|
|
@@ -319,8 +328,8 @@ _defineProperty(InputTextareaComponent, "defaultProps", {
|
|
|
319
328
|
forwardRef: null
|
|
320
329
|
});
|
|
321
330
|
|
|
322
|
-
var InputTextarea = /*#__PURE__*/React__default[
|
|
323
|
-
return /*#__PURE__*/React__default[
|
|
331
|
+
var InputTextarea = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
332
|
+
return /*#__PURE__*/React__default["default"].createElement(InputTextareaComponent, _extends({
|
|
324
333
|
forwardRef: ref
|
|
325
334
|
}, props));
|
|
326
335
|
});
|
|
@@ -385,14 +394,14 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
385
394
|
}, {
|
|
386
395
|
key: "onOverlayEnter",
|
|
387
396
|
value: function onOverlayEnter() {
|
|
388
|
-
|
|
397
|
+
utils.ZIndexUtils.set('overlay', this.overlayRef.current, PrimeReact__default["default"].autoZIndex, PrimeReact__default["default"].zIndex['overlay']);
|
|
389
398
|
this.alignOverlay();
|
|
390
399
|
}
|
|
391
400
|
}, {
|
|
392
401
|
key: "onOverlayEntering",
|
|
393
402
|
value: function onOverlayEntering() {
|
|
394
403
|
if (this.props.autoHighlight && this.props.suggestions && this.props.suggestions.length) {
|
|
395
|
-
|
|
404
|
+
utils.DomHandler.addClass(this.list.firstChild, 'p-highlight');
|
|
396
405
|
}
|
|
397
406
|
}
|
|
398
407
|
}, {
|
|
@@ -413,7 +422,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
413
422
|
}, {
|
|
414
423
|
key: "onOverlayExited",
|
|
415
424
|
value: function onOverlayExited() {
|
|
416
|
-
|
|
425
|
+
utils.ZIndexUtils.clear(this.overlayRef.current);
|
|
417
426
|
this.props.onHide && this.props.onHide();
|
|
418
427
|
}
|
|
419
428
|
}, {
|
|
@@ -423,7 +432,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
423
432
|
key = _this$state$trigger.key,
|
|
424
433
|
index = _this$state$trigger.index;
|
|
425
434
|
var value = this.inputRef.current.value;
|
|
426
|
-
var position =
|
|
435
|
+
var position = utils.DomHandler.getCursorOffset(this.inputRef.current, value.substring(0, index - 1), value.substring(index), key);
|
|
427
436
|
this.overlayRef.current.style.transformOrigin = 'top';
|
|
428
437
|
this.overlayRef.current.style.left = "calc(".concat(position.left, "px + 1rem)");
|
|
429
438
|
this.overlayRef.current.style.top = "calc(".concat(position.top, "px + 1.2rem)");
|
|
@@ -431,7 +440,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
431
440
|
}, {
|
|
432
441
|
key: "onPanelClick",
|
|
433
442
|
value: function onPanelClick(event) {
|
|
434
|
-
|
|
443
|
+
overlayservice.OverlayService.emit('overlay-click', {
|
|
435
444
|
originalEvent: event,
|
|
436
445
|
target: this.container
|
|
437
446
|
});
|
|
@@ -570,7 +579,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
570
579
|
var field = Array.isArray(this.props.field) ? this.props.field[this.props.trigger.findIndex(function (f) {
|
|
571
580
|
return f === _this3.state.trigger.key;
|
|
572
581
|
})] : this.props.field;
|
|
573
|
-
return field ?
|
|
582
|
+
return field ? utils.ObjectUtils.resolveFieldData(value, field) : value;
|
|
574
583
|
}
|
|
575
584
|
|
|
576
585
|
return '';
|
|
@@ -609,7 +618,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
609
618
|
key: "onInput",
|
|
610
619
|
value: function onInput(event) {
|
|
611
620
|
this.props.onInput && this.props.onInput(event);
|
|
612
|
-
if (event.target.value.length > 0)
|
|
621
|
+
if (event.target.value.length > 0) utils.DomHandler.addClass(this.container, 'p-inputwrapper-filled');else utils.DomHandler.removeClass(this.container, 'p-inputwrapper-filled');
|
|
613
622
|
}
|
|
614
623
|
}, {
|
|
615
624
|
key: "onKeyUp",
|
|
@@ -628,7 +637,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
628
637
|
key: "onKeyDown",
|
|
629
638
|
value: function onKeyDown(event) {
|
|
630
639
|
if (this.state.overlayVisible) {
|
|
631
|
-
var highlightItem =
|
|
640
|
+
var highlightItem = utils.DomHandler.findSingle(this.overlayRef.current, 'li.p-highlight');
|
|
632
641
|
|
|
633
642
|
switch (event.which) {
|
|
634
643
|
//down
|
|
@@ -637,15 +646,15 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
637
646
|
var nextElement = highlightItem.nextElementSibling;
|
|
638
647
|
|
|
639
648
|
if (nextElement) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
649
|
+
utils.DomHandler.addClass(nextElement, 'p-highlight');
|
|
650
|
+
utils.DomHandler.removeClass(highlightItem, 'p-highlight');
|
|
651
|
+
utils.DomHandler.scrollInView(this.overlayRef.current, nextElement);
|
|
643
652
|
}
|
|
644
653
|
} else {
|
|
645
|
-
highlightItem =
|
|
654
|
+
highlightItem = utils.DomHandler.findSingle(this.overlayRef.current, 'li');
|
|
646
655
|
|
|
647
656
|
if (highlightItem) {
|
|
648
|
-
|
|
657
|
+
utils.DomHandler.addClass(highlightItem, 'p-highlight');
|
|
649
658
|
}
|
|
650
659
|
}
|
|
651
660
|
|
|
@@ -658,9 +667,9 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
658
667
|
var previousElement = highlightItem.previousElementSibling;
|
|
659
668
|
|
|
660
669
|
if (previousElement) {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
670
|
+
utils.DomHandler.addClass(previousElement, 'p-highlight');
|
|
671
|
+
utils.DomHandler.removeClass(highlightItem, 'p-highlight');
|
|
672
|
+
utils.DomHandler.scrollInView(this.overlayRef.current, previousElement);
|
|
664
673
|
}
|
|
665
674
|
}
|
|
666
675
|
|
|
@@ -683,7 +692,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
683
692
|
|
|
684
693
|
case 13:
|
|
685
694
|
if (highlightItem) {
|
|
686
|
-
this.selectItem(event, this.props.suggestions[
|
|
695
|
+
this.selectItem(event, this.props.suggestions[utils.DomHandler.index(highlightItem)]);
|
|
687
696
|
}
|
|
688
697
|
|
|
689
698
|
event.preventDefault();
|
|
@@ -731,7 +740,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
731
740
|
var _this7 = this;
|
|
732
741
|
|
|
733
742
|
if (!this.scrollHandler) {
|
|
734
|
-
this.scrollHandler = new
|
|
743
|
+
this.scrollHandler = new utils.ConnectedOverlayScrollHandler(this.container, function () {
|
|
735
744
|
if (_this7.state.overlayVisible) {
|
|
736
745
|
_this7.hideOverlay();
|
|
737
746
|
}
|
|
@@ -754,7 +763,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
754
763
|
|
|
755
764
|
if (!this.resizeListener) {
|
|
756
765
|
this.resizeListener = function () {
|
|
757
|
-
if (_this8.state.overlayVisible && !
|
|
766
|
+
if (_this8.state.overlayVisible && !utils.DomHandler.isAndroid()) {
|
|
758
767
|
_this8.hideOverlay();
|
|
759
768
|
}
|
|
760
769
|
};
|
|
@@ -813,8 +822,8 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
813
822
|
});
|
|
814
823
|
}
|
|
815
824
|
|
|
816
|
-
if (!this.isFilled() &&
|
|
817
|
-
|
|
825
|
+
if (!this.isFilled() && utils.DomHandler.hasClass(this.container, 'p-inputwrapper-filled')) {
|
|
826
|
+
utils.DomHandler.removeClass(this.container, 'p-inputwrapper-filled');
|
|
818
827
|
}
|
|
819
828
|
}
|
|
820
829
|
}, {
|
|
@@ -828,24 +837,24 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
828
837
|
this.scrollHandler = null;
|
|
829
838
|
}
|
|
830
839
|
|
|
831
|
-
|
|
840
|
+
utils.ZIndexUtils.clear(this.overlayRef.current);
|
|
832
841
|
}
|
|
833
842
|
}, {
|
|
834
843
|
key: "renderItem",
|
|
835
844
|
value: function renderItem(suggestion, index) {
|
|
836
845
|
var _this9 = this;
|
|
837
846
|
|
|
838
|
-
var content = this.props.itemTemplate ?
|
|
847
|
+
var content = this.props.itemTemplate ? utils.ObjectUtils.getJSXElement(this.props.itemTemplate, suggestion, {
|
|
839
848
|
trigger: this.state.trigger ? this.state.trigger.key : '',
|
|
840
849
|
index: index
|
|
841
850
|
}) : this.formatValue(suggestion);
|
|
842
|
-
return /*#__PURE__*/React__default[
|
|
851
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
843
852
|
key: index + '_item',
|
|
844
853
|
className: "p-mention-item",
|
|
845
854
|
onClick: function onClick(e) {
|
|
846
855
|
return _this9.onItemClick(e, suggestion);
|
|
847
856
|
}
|
|
848
|
-
}, content, /*#__PURE__*/React__default[
|
|
857
|
+
}, content, /*#__PURE__*/React__default["default"].createElement(ripple.Ripple, null));
|
|
849
858
|
}
|
|
850
859
|
}, {
|
|
851
860
|
key: "renderList",
|
|
@@ -856,7 +865,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
856
865
|
var items = this.props.suggestions.map(function (suggestion, index) {
|
|
857
866
|
return _this10.renderItem(suggestion, index);
|
|
858
867
|
});
|
|
859
|
-
return /*#__PURE__*/React__default[
|
|
868
|
+
return /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
860
869
|
ref: function ref(el) {
|
|
861
870
|
return _this10.list = el;
|
|
862
871
|
},
|
|
@@ -869,16 +878,16 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
869
878
|
}, {
|
|
870
879
|
key: "renderPanel",
|
|
871
880
|
value: function renderPanel() {
|
|
872
|
-
var panelClassName =
|
|
881
|
+
var panelClassName = utils.classNames('p-mention-panel p-component', this.props.panelClassName);
|
|
873
882
|
|
|
874
883
|
var panelStyle = _objectSpread({
|
|
875
884
|
maxHeight: this.props.scrollHeight
|
|
876
885
|
}, this.props.panelStyle);
|
|
877
886
|
|
|
878
|
-
var header =
|
|
879
|
-
var footer =
|
|
887
|
+
var header = utils.ObjectUtils.getJSXElement(this.props.headerTemplate, this.props);
|
|
888
|
+
var footer = utils.ObjectUtils.getJSXElement(this.props.footerTemplate, this.props);
|
|
880
889
|
var list = this.renderList();
|
|
881
|
-
var panel = /*#__PURE__*/React__default[
|
|
890
|
+
var panel = /*#__PURE__*/React__default["default"].createElement(csstransition.CSSTransition, {
|
|
882
891
|
nodeRef: this.overlayRef,
|
|
883
892
|
classNames: "p-connected-overlay",
|
|
884
893
|
in: this.state.overlayVisible,
|
|
@@ -893,13 +902,13 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
893
902
|
onEntered: this.onOverlayEntered,
|
|
894
903
|
onExit: this.onOverlayExit,
|
|
895
904
|
onExited: this.onOverlayExited
|
|
896
|
-
}, /*#__PURE__*/React__default[
|
|
905
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
897
906
|
ref: this.overlayRef,
|
|
898
907
|
className: panelClassName,
|
|
899
908
|
style: panelStyle,
|
|
900
909
|
onClick: this.onPanelClick
|
|
901
910
|
}, header, list, footer));
|
|
902
|
-
return /*#__PURE__*/React__default[
|
|
911
|
+
return /*#__PURE__*/React__default["default"].createElement(portal.Portal, {
|
|
903
912
|
element: panel,
|
|
904
913
|
appendTo: "self"
|
|
905
914
|
});
|
|
@@ -909,21 +918,21 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
909
918
|
value: function render() {
|
|
910
919
|
var _this11 = this;
|
|
911
920
|
|
|
912
|
-
var containerClassName =
|
|
921
|
+
var containerClassName = utils.classNames('p-mention p-component p-inputwrapper', {
|
|
913
922
|
'p-inputwrapper-filled': this.isFilled(),
|
|
914
923
|
'p-inputwrapper-focus': this.state.focused
|
|
915
924
|
}, this.props.className);
|
|
916
|
-
var inputClassName =
|
|
917
|
-
var inputProps =
|
|
925
|
+
var inputClassName = utils.classNames('p-mention-input', this.props.inputClassName);
|
|
926
|
+
var inputProps = utils.ObjectUtils.findDiffKeys(this.props, Mention.defaultProps);
|
|
918
927
|
var panel = this.renderPanel();
|
|
919
|
-
return /*#__PURE__*/React__default[
|
|
928
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
920
929
|
ref: function ref(el) {
|
|
921
930
|
return _this11.container = el;
|
|
922
931
|
},
|
|
923
932
|
id: this.props.id,
|
|
924
933
|
className: containerClassName,
|
|
925
934
|
style: this.props.style
|
|
926
|
-
}, /*#__PURE__*/React__default[
|
|
935
|
+
}, /*#__PURE__*/React__default["default"].createElement(InputTextarea, _extends({
|
|
927
936
|
ref: this.inputRef,
|
|
928
937
|
id: this.props.inputId
|
|
929
938
|
}, inputProps, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e);function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(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 l(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(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&&u(e,t)}function c(e){return(c="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})(e)}function h(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?a(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(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 v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}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(e){return!1}}var m=function(n){p(d,e.Component);var o,u,c=(o=d,u=g(),function(){var e,t=f(o);if(u){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function d(t){var n;return s(this,d),(n=c.call(this,t)).onFocus=n.onFocus.bind(a(n)),n.onBlur=n.onBlur.bind(a(n)),n.onKeyUp=n.onKeyUp.bind(a(n)),n.onInput=n.onInput.bind(a(n)),n.elementRef=e.createRef(n.props.forwardRef),n}return l(d,[{key:"onFocus",value:function(e){this.props.autoResize&&this.resize(),this.props.onFocus&&this.props.onFocus(e)}},{key:"onBlur",value:function(e){this.props.autoResize&&this.resize(),this.props.onBlur&&this.props.onBlur(e)}},{key:"onKeyUp",value:function(e){this.props.autoResize&&this.resize(),this.props.onKeyUp&&this.props.onKeyUp(e)}},{key:"onInput",value:function(e){this.props.autoResize&&this.resize(),e.target.value.length>0?t.DomHandler.addClass(e.target,"p-filled"):t.DomHandler.removeClass(e.target,"p-filled"),this.props.onInput&&this.props.onInput(e)}},{key:"resize",value:function(e){var n=this.elementRef&&this.elementRef.current;n&&t.DomHandler.isVisible(n)&&(this.cachedScrollHeight||(this.cachedScrollHeight=n.scrollHeight,n.style.overflow="hidden"),(this.cachedScrollHeight!==n.scrollHeight||e)&&(n.style.height="",n.style.height=n.scrollHeight+"px",parseFloat(n.style.height)>=parseFloat(n.style.maxHeight)?(n.style.overflowY="scroll",n.style.height=n.style.maxHeight):n.style.overflow="hidden",this.cachedScrollHeight=n.scrollHeight))}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&this.elementRef.current.value.toString().length>0}},{key:"updateForwardRef",value:function(){var e=this.props.forwardRef;e&&("function"==typeof e?e(this.elementRef.current):e.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip(),this.props.autoResize&&this.resize(!0)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(v({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=t.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var e=t.classNames("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),n=t.ObjectUtils.findDiffKeys(this.props,d.defaultProps);return i.default.createElement("textarea",r({ref:this.elementRef},n,{className:e,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}]),d}();d(m,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null});var b=i.default.forwardRef((function(e,t){return i.default.createElement(m,r({forwardRef:t},e))}));function O(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 k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function R(){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 S=function(n){p(d,e.Component);var o,u,c=(o=d,u=R(),function(){var e,t=f(o);if(u){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function d(t){var n;return s(this,d),(n=c.call(this,t)).state={overlayVisible:!1,focused:!1,searching:!1,trigger:null},n.onOverlayEnter=n.onOverlayEnter.bind(a(n)),n.onOverlayEntering=n.onOverlayEntering.bind(a(n)),n.onOverlayEntered=n.onOverlayEntered.bind(a(n)),n.onOverlayExit=n.onOverlayExit.bind(a(n)),n.onOverlayExited=n.onOverlayExited.bind(a(n)),n.onFocus=n.onFocus.bind(a(n)),n.onBlur=n.onBlur.bind(a(n)),n.onKeyDown=n.onKeyDown.bind(a(n)),n.onChange=n.onChange.bind(a(n)),n.onInput=n.onInput.bind(a(n)),n.onKeyUp=n.onKeyUp.bind(a(n)),n.onPanelClick=n.onPanelClick.bind(a(n)),n.overlayRef=e.createRef(),n.inputRef=e.createRef(n.props.inputRef),n}return l(d,[{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1,searching:!1,trigger:null})}},{key:"onOverlayEnter",value:function(){t.ZIndexUtils.set("overlay",this.overlayRef.current),this.alignOverlay()}},{key:"onOverlayEntering",value:function(){this.props.autoHighlight&&this.props.suggestions&&this.props.suggestions.length&&t.DomHandler.addClass(this.list.firstChild,"p-highlight")}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){t.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){var e=this.state.trigger,n=e.key,i=e.index,r=this.inputRef.current.value,s=t.DomHandler.getCursorOffset(this.inputRef.current,r.substring(0,i-1),r.substring(i),n);this.overlayRef.current.style.transformOrigin="top",this.overlayRef.current.style.left="calc(".concat(s.left,"px + 1rem)"),this.overlayRef.current.style.top="calc(".concat(s.top,"px + 1.2rem)")}},{key:"onPanelClick",value:function(e){t.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"getTrigger",value:function(e,t,n){if(!this.state.trigger){var i=Array.isArray(this.props.trigger)?this.props.trigger.find((function(e){return e===t})):this.props.trigger===t?this.props.trigger:null;if(i)return{key:i,index:n};var r=e.substring(0,n).lastIndexOf(" "),s=this.getLatestTrigger(e,n);if(s.index>r)return s}return this.state.trigger}},{key:"getLatestTrigger",value:function(e,t){if(Array.isArray(this.props.trigger)){var n={};return this.props.trigger.forEach((function(i){var r=e.substring(0,t).lastIndexOf(i);-1!==r&&(r>n.index||!n.index)&&(n={key:i,index:-1!==r?r+1:-1})})),n}var i=e.substring(0,t).lastIndexOf(this.props.trigger);return{key:this.props.trigger,index:-1!==i?i+1:-1}}},{key:"onSearch",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var n=e.target,i=n.value,r=n.selectionStart,s=i.substring(r-1,r);if(" "!==s){var o=this.getTrigger(i,s,r);if(o&&o.index>-1){var l=i.substring(o.index,r);this.timeout=setTimeout((function(){t.search(e,l,o)}),this.props.delay)}}else this.hideOverlay()}},{key:"search",value:function(e,t,n){this.props.onSearch&&(this.setState({searching:!0,trigger:n}),this.props.onSearch({originalEvent:e,trigger:n.key,query:t}))}},{key:"selectItem",value:function(e,t){var n=this.inputRef.current.value,i=e.target.selectionStart,r=this.state.trigger,s=n.indexOf(" ",r.index),o=n.substring(r.index,s>-1?s:i),l=this.formatValue(t).replace(/\s+/g,"");if(o.trim()!==l){for(var a=0;a<l.length;){var u=l.charAt(a),p=o.charAt(a);if(u!==p&&" "!==p)break;a++}var c=n.substring(0,r.index),h=n.substring(r.index+a);this.inputRef.current.value="".concat(c).concat(l," ").concat(h),this.props.onChange&&this.props.onChange(e)}var f=r.index+l.length+1;this.inputRef.current.setSelectionRange(f,f),this.hideOverlay(),this.props.onSelect&&this.props.onSelect({originalEvent:e,suggestion:t})}},{key:"formatValue",value:function(e){var n=this;if(e){var i=Array.isArray(this.props.field)?this.props.field[this.props.trigger.findIndex((function(e){return e===n.state.trigger.key}))]:this.props.field;return i?t.ObjectUtils.resolveFieldData(e,i):e}return""}},{key:"onItemClick",value:function(e,t){this.inputRef.current.focus(),this.selectItem(e,t)}},{key:"onFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onInput",value:function(e){this.props.onInput&&this.props.onInput(e),e.target.value.length>0?t.DomHandler.addClass(this.container,"p-inputwrapper-filled"):t.DomHandler.removeClass(this.container,"p-inputwrapper-filled")}},{key:"onKeyUp",value:function(e){37!==e.which&&39!==e.which||this.onSearch(e)}},{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e),this.onSearch(e)}},{key:"onKeyDown",value:function(e){if(this.state.overlayVisible){var n=t.DomHandler.findSingle(this.overlayRef.current,"li.p-highlight");switch(e.which){case 40:if(n){var i=n.nextElementSibling;i&&(t.DomHandler.addClass(i,"p-highlight"),t.DomHandler.removeClass(n,"p-highlight"),t.DomHandler.scrollInView(this.overlayRef.current,i))}else(n=t.DomHandler.findSingle(this.overlayRef.current,"li"))&&t.DomHandler.addClass(n,"p-highlight");e.preventDefault();break;case 38:if(n){var r=n.previousElementSibling;r&&(t.DomHandler.addClass(r,"p-highlight"),t.DomHandler.removeClass(n,"p-highlight"),t.DomHandler.scrollInView(this.overlayRef.current,r))}e.preventDefault();break;case 8:var s=e.target,o=s.selectionStart;s.value.substring(o-1,o)===this.state.trigger.key&&this.hideOverlay();break;case 13:n&&this.selectItem(e,this.props.suggestions[t.DomHandler.index(n)]),e.preventDefault();break;case 27:this.hideOverlay(),e.preventDefault()}}}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){3!==t.which&&e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new t.ConnectedOverlayScrollHandler(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!t.DomHandler.isAndroid()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.inputRef&&this.inputRef.current&&this.inputRef.current.value.toString().length>0}},{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()}},{key:"componentDidUpdate",value:function(e){e.suggestions!==this.props.suggestions&&this.state.searching&&(this.props.suggestions&&this.props.suggestions.length?this.showOverlay():this.hideOverlay(),this.state.overlayVisible&&this.alignOverlay(),this.setState({searching:!1})),!this.isFilled()&&t.DomHandler.hasClass(this.container,"p-inputwrapper-filled")&&t.DomHandler.removeClass(this.container,"p-inputwrapper-filled")}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),t.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderItem",value:function(e,n){var r=this,s=this.props.itemTemplate?t.ObjectUtils.getJSXElement(this.props.itemTemplate,e,{trigger:this.state.trigger?this.state.trigger.key:"",index:n}):this.formatValue(e);return i.default.createElement("li",{key:n+"_item",className:"p-mention-item",onClick:function(t){return r.onItemClick(t,e)}},s,i.default.createElement(t.Ripple,null))}},{key:"renderList",value:function(){var e=this;if(this.props.suggestions){var t=this.props.suggestions.map((function(t,n){return e.renderItem(t,n)}));return i.default.createElement("ul",{ref:function(t){return e.list=t},className:"p-mention-items"},t)}return null}},{key:"renderPanel",value:function(){var e=t.classNames("p-mention-panel p-component",this.props.panelClassName),n=k({maxHeight:this.props.scrollHeight},this.props.panelStyle),r=t.ObjectUtils.getJSXElement(this.props.headerTemplate,this.props),s=t.ObjectUtils.getJSXElement(this.props.footerTemplate,this.props),o=this.renderList();return i.default.createElement(t.Portal,{element:i.default.createElement(t.CSSTransition,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.overlayVisible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onOverlayEnter,onEntering:this.onOverlayEntering,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited},i.default.createElement("div",{ref:this.overlayRef,className:e,style:n,onClick:this.onPanelClick},r,o,s)),appendTo:"self"})}},{key:"render",value:function(){var e=this,n=t.classNames("p-mention p-component p-inputwrapper",{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused},this.props.className),s=t.classNames("p-mention-input",this.props.inputClassName),o=t.ObjectUtils.findDiffKeys(this.props,d.defaultProps),l=this.renderPanel();return i.default.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:n,style:this.props.style},i.default.createElement(b,r({ref:this.inputRef,id:this.props.inputId},o,{className:s,style:this.props.inputStyle,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onKeyUp:this.onKeyUp,onChange:this.onChange})),l)}}]),d}();d(S,"defaultProps",{id:null,inputId:null,inputRef:null,style:null,className:null,trigger:"@",suggestions:null,field:null,inputStyle:null,inputClassName:null,panelClassName:null,panelStyle:null,scrollHeight:"200px",autoHighlight:!0,delay:0,headerTemplate:null,footerTemplate:null,itemTemplate:null,transitionOptions:null,onChange:null,onInput:null,onSearch:null,onSelect:null,onFocus:null,onBlur:null,onShow:null,onHide:null}),exports.Mention=S;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/ripple"),r=require("primereact/overlayservice"),i=require("primereact/csstransition"),o=require("primereact/portal"),s=require("primereact/tooltip"),l=require("primereact/api");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),p=a(l);function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}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 r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function g(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&&v(e,t)}function m(e){return m="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},m(e)}function b(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function S(){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 E=function(n){g(l,e.Component);var r,i,o=(r=l,i=S(),function(){var e,t=O(r);if(i){var n=O(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return b(this,e)});function l(t){var n;return h(this,l),(n=o.call(this,t)).onFocus=n.onFocus.bind(y(n)),n.onBlur=n.onBlur.bind(y(n)),n.onKeyUp=n.onKeyUp.bind(y(n)),n.onInput=n.onInput.bind(y(n)),n.elementRef=e.createRef(n.props.forwardRef),n}return d(l,[{key:"onFocus",value:function(e){this.props.autoResize&&this.resize(),this.props.onFocus&&this.props.onFocus(e)}},{key:"onBlur",value:function(e){this.props.autoResize&&this.resize(),this.props.onBlur&&this.props.onBlur(e)}},{key:"onKeyUp",value:function(e){this.props.autoResize&&this.resize(),this.props.onKeyUp&&this.props.onKeyUp(e)}},{key:"onInput",value:function(e){this.props.autoResize&&this.resize(),e.target.value.length>0?t.DomHandler.addClass(e.target,"p-filled"):t.DomHandler.removeClass(e.target,"p-filled"),this.props.onInput&&this.props.onInput(e)}},{key:"resize",value:function(e){var n=this.elementRef&&this.elementRef.current;n&&t.DomHandler.isVisible(n)&&(this.cachedScrollHeight||(this.cachedScrollHeight=n.scrollHeight,n.style.overflow="hidden"),(this.cachedScrollHeight!==n.scrollHeight||e)&&(n.style.height="",n.style.height=n.scrollHeight+"px",parseFloat(n.style.height)>=parseFloat(n.style.maxHeight)?(n.style.overflowY="scroll",n.style.height=n.style.maxHeight):n.style.overflow="hidden",this.cachedScrollHeight=n.scrollHeight))}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&this.elementRef.current.value.toString().length>0}},{key:"updateForwardRef",value:function(){var e=this.props.forwardRef;e&&("function"==typeof e?e(this.elementRef.current):e.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip(),this.props.autoResize&&this.resize(!0)}},{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()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=s.tip({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var e=t.classNames("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),n=t.ObjectUtils.findDiffKeys(this.props,l.defaultProps);return u.default.createElement("textarea",c({ref:this.elementRef},n,{className:e,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}]),l}();k(E,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null});var x=u.default.forwardRef((function(e,t){return u.default.createElement(E,c({forwardRef:t},e))}));function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function H(){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 j=function(s){g(v,e.Component);var l,a,f=(l=v,a=H(),function(){var e,t=O(l);if(a){var n=O(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return b(this,e)});function v(t){var n;return h(this,v),(n=f.call(this,t)).state={overlayVisible:!1,focused:!1,searching:!1,trigger:null},n.onOverlayEnter=n.onOverlayEnter.bind(y(n)),n.onOverlayEntering=n.onOverlayEntering.bind(y(n)),n.onOverlayEntered=n.onOverlayEntered.bind(y(n)),n.onOverlayExit=n.onOverlayExit.bind(y(n)),n.onOverlayExited=n.onOverlayExited.bind(y(n)),n.onFocus=n.onFocus.bind(y(n)),n.onBlur=n.onBlur.bind(y(n)),n.onKeyDown=n.onKeyDown.bind(y(n)),n.onChange=n.onChange.bind(y(n)),n.onInput=n.onInput.bind(y(n)),n.onKeyUp=n.onKeyUp.bind(y(n)),n.onPanelClick=n.onPanelClick.bind(y(n)),n.overlayRef=e.createRef(),n.inputRef=e.createRef(n.props.inputRef),n}return d(v,[{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1,searching:!1,trigger:null})}},{key:"onOverlayEnter",value:function(){t.ZIndexUtils.set("overlay",this.overlayRef.current,p.default.autoZIndex,p.default.zIndex.overlay),this.alignOverlay()}},{key:"onOverlayEntering",value:function(){this.props.autoHighlight&&this.props.suggestions&&this.props.suggestions.length&&t.DomHandler.addClass(this.list.firstChild,"p-highlight")}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){t.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){var e=this.state.trigger,n=e.key,r=e.index,i=this.inputRef.current.value,o=t.DomHandler.getCursorOffset(this.inputRef.current,i.substring(0,r-1),i.substring(r),n);this.overlayRef.current.style.transformOrigin="top",this.overlayRef.current.style.left="calc(".concat(o.left,"px + 1rem)"),this.overlayRef.current.style.top="calc(".concat(o.top,"px + 1.2rem)")}},{key:"onPanelClick",value:function(e){r.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"getTrigger",value:function(e,t,n){if(!this.state.trigger){var r=Array.isArray(this.props.trigger)?this.props.trigger.find((function(e){return e===t})):this.props.trigger===t?this.props.trigger:null;if(r)return{key:r,index:n};var i=e.substring(0,n).lastIndexOf(" "),o=this.getLatestTrigger(e,n);if(o.index>i)return o}return this.state.trigger}},{key:"getLatestTrigger",value:function(e,t){if(Array.isArray(this.props.trigger)){var n={};return this.props.trigger.forEach((function(r){var i=e.substring(0,t).lastIndexOf(r);-1!==i&&(i>n.index||!n.index)&&(n={key:r,index:-1!==i?i+1:-1})})),n}var r=e.substring(0,t).lastIndexOf(this.props.trigger);return{key:this.props.trigger,index:-1!==r?r+1:-1}}},{key:"onSearch",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var n=e.target,r=n.value,i=n.selectionStart,o=r.substring(i-1,i);if(" "!==o){var s=this.getTrigger(r,o,i);if(s&&s.index>-1){var l=r.substring(s.index,i);this.timeout=setTimeout((function(){t.search(e,l,s)}),this.props.delay)}}else this.hideOverlay()}},{key:"search",value:function(e,t,n){this.props.onSearch&&(this.setState({searching:!0,trigger:n}),this.props.onSearch({originalEvent:e,trigger:n.key,query:t}))}},{key:"selectItem",value:function(e,t){var n=this.inputRef.current.value,r=e.target.selectionStart,i=this.state.trigger,o=n.indexOf(" ",i.index),s=n.substring(i.index,o>-1?o:r),l=this.formatValue(t).replace(/\s+/g,"");if(s.trim()!==l){for(var a=0;a<l.length;){var u=l.charAt(a),p=s.charAt(a);if(u!==p&&" "!==p)break;a++}var c=n.substring(0,i.index),h=n.substring(i.index+a);this.inputRef.current.value="".concat(c).concat(l," ").concat(h),this.props.onChange&&this.props.onChange(e)}var f=i.index+l.length+1;this.inputRef.current.setSelectionRange(f,f),this.hideOverlay(),this.props.onSelect&&this.props.onSelect({originalEvent:e,suggestion:t})}},{key:"formatValue",value:function(e){var n=this;if(e){var r=Array.isArray(this.props.field)?this.props.field[this.props.trigger.findIndex((function(e){return e===n.state.trigger.key}))]:this.props.field;return r?t.ObjectUtils.resolveFieldData(e,r):e}return""}},{key:"onItemClick",value:function(e,t){this.inputRef.current.focus(),this.selectItem(e,t)}},{key:"onFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onInput",value:function(e){this.props.onInput&&this.props.onInput(e),e.target.value.length>0?t.DomHandler.addClass(this.container,"p-inputwrapper-filled"):t.DomHandler.removeClass(this.container,"p-inputwrapper-filled")}},{key:"onKeyUp",value:function(e){37!==e.which&&39!==e.which||this.onSearch(e)}},{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e),this.onSearch(e)}},{key:"onKeyDown",value:function(e){if(this.state.overlayVisible){var n=t.DomHandler.findSingle(this.overlayRef.current,"li.p-highlight");switch(e.which){case 40:if(n){var r=n.nextElementSibling;r&&(t.DomHandler.addClass(r,"p-highlight"),t.DomHandler.removeClass(n,"p-highlight"),t.DomHandler.scrollInView(this.overlayRef.current,r))}else(n=t.DomHandler.findSingle(this.overlayRef.current,"li"))&&t.DomHandler.addClass(n,"p-highlight");e.preventDefault();break;case 38:if(n){var i=n.previousElementSibling;i&&(t.DomHandler.addClass(i,"p-highlight"),t.DomHandler.removeClass(n,"p-highlight"),t.DomHandler.scrollInView(this.overlayRef.current,i))}e.preventDefault();break;case 8:var o=e.target,s=o.selectionStart;o.value.substring(s-1,s)===this.state.trigger.key&&this.hideOverlay();break;case 13:n&&this.selectItem(e,this.props.suggestions[t.DomHandler.index(n)]),e.preventDefault();break;case 27:this.hideOverlay(),e.preventDefault()}}}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){3!==t.which&&e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new t.ConnectedOverlayScrollHandler(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!t.DomHandler.isAndroid()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.inputRef&&this.inputRef.current&&this.inputRef.current.value.toString().length>0}},{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()}},{key:"componentDidUpdate",value:function(e){e.suggestions!==this.props.suggestions&&this.state.searching&&(this.props.suggestions&&this.props.suggestions.length?this.showOverlay():this.hideOverlay(),this.state.overlayVisible&&this.alignOverlay(),this.setState({searching:!1})),!this.isFilled()&&t.DomHandler.hasClass(this.container,"p-inputwrapper-filled")&&t.DomHandler.removeClass(this.container,"p-inputwrapper-filled")}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),t.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderItem",value:function(e,r){var i=this,o=this.props.itemTemplate?t.ObjectUtils.getJSXElement(this.props.itemTemplate,e,{trigger:this.state.trigger?this.state.trigger.key:"",index:r}):this.formatValue(e);return u.default.createElement("li",{key:r+"_item",className:"p-mention-item",onClick:function(t){return i.onItemClick(t,e)}},o,u.default.createElement(n.Ripple,null))}},{key:"renderList",value:function(){var e=this;if(this.props.suggestions){var t=this.props.suggestions.map((function(t,n){return e.renderItem(t,n)}));return u.default.createElement("ul",{ref:function(t){return e.list=t},className:"p-mention-items"},t)}return null}},{key:"renderPanel",value:function(){var e=t.classNames("p-mention-panel p-component",this.props.panelClassName),n=D({maxHeight:this.props.scrollHeight},this.props.panelStyle),r=t.ObjectUtils.getJSXElement(this.props.headerTemplate,this.props),s=t.ObjectUtils.getJSXElement(this.props.footerTemplate,this.props),l=this.renderList();return u.default.createElement(o.Portal,{element:u.default.createElement(i.CSSTransition,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.overlayVisible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onOverlayEnter,onEntering:this.onOverlayEntering,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited},u.default.createElement("div",{ref:this.overlayRef,className:e,style:n,onClick:this.onPanelClick},r,l,s)),appendTo:"self"})}},{key:"render",value:function(){var e=this,n=t.classNames("p-mention p-component p-inputwrapper",{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused},this.props.className),r=t.classNames("p-mention-input",this.props.inputClassName),i=t.ObjectUtils.findDiffKeys(this.props,v.defaultProps),o=this.renderPanel();return u.default.createElement("div",{ref:function(t){return e.container=t},id:this.props.id,className:n,style:this.props.style},u.default.createElement(x,c({ref:this.inputRef,id:this.props.inputId},i,{className:r,style:this.props.inputStyle,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onKeyUp:this.onKeyUp,onChange:this.onChange})),o)}}]),v}();k(j,"defaultProps",{id:null,inputId:null,inputRef:null,style:null,className:null,trigger:"@",suggestions:null,field:null,inputStyle:null,inputClassName:null,panelClassName:null,panelStyle:null,scrollHeight:"200px",autoHighlight:!0,delay:0,headerTemplate:null,footerTemplate:null,itemTemplate:null,transitionOptions:null,onChange:null,onInput:null,onSearch:null,onSelect:null,onFocus:null,onBlur:null,onShow:null,onHide:null}),exports.Mention=j;
|
package/mention/mention.esm.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React, { createRef, Component } from 'react';
|
|
2
|
-
import { DomHandler,
|
|
2
|
+
import { DomHandler, classNames, ObjectUtils, ZIndexUtils, ConnectedOverlayScrollHandler } from 'primereact/utils';
|
|
3
|
+
import { Ripple } from 'primereact/ripple';
|
|
4
|
+
import { OverlayService } from 'primereact/overlayservice';
|
|
5
|
+
import { CSSTransition } from 'primereact/csstransition';
|
|
6
|
+
import { Portal } from 'primereact/portal';
|
|
7
|
+
import { tip } from 'primereact/tooltip';
|
|
8
|
+
import PrimeReact from 'primereact/api';
|
|
3
9
|
|
|
4
10
|
function _extends() {
|
|
5
11
|
_extends = Object.assign || function (target) {
|
|
@@ -92,6 +98,8 @@ function _typeof(obj) {
|
|
|
92
98
|
function _possibleConstructorReturn(self, call) {
|
|
93
99
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
94
100
|
return call;
|
|
101
|
+
} else if (call !== void 0) {
|
|
102
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
return _assertThisInitialized(self);
|
|
@@ -377,7 +385,7 @@ var Mention = /*#__PURE__*/function (_Component) {
|
|
|
377
385
|
}, {
|
|
378
386
|
key: "onOverlayEnter",
|
|
379
387
|
value: function onOverlayEnter() {
|
|
380
|
-
ZIndexUtils.set('overlay', this.overlayRef.current);
|
|
388
|
+
ZIndexUtils.set('overlay', this.overlayRef.current, PrimeReact.autoZIndex, PrimeReact.zIndex['overlay']);
|
|
381
389
|
this.alignOverlay();
|
|
382
390
|
}
|
|
383
391
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{createRef as t,Component as n}from"react";import{DomHandler as i,tip as r,classNames as s,ObjectUtils as o,ZIndexUtils as l,OverlayService as u,ConnectedOverlayScrollHandler as a,Ripple as p,CSSTransition as c,Portal as h}from"primereact/core";function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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 v(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),e}function g(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})(e,t)}function b(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 O(e){return(O="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})(e)}function k(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?g(e):t}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(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 E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function C(){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 x=function(l){b(c,n);var u,a,p=(u=c,a=C(),function(){var e,t=R(u);if(a){var n=R(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return k(this,e)});function c(e){var n;return y(this,c),(n=p.call(this,e)).onFocus=n.onFocus.bind(g(n)),n.onBlur=n.onBlur.bind(g(n)),n.onKeyUp=n.onKeyUp.bind(g(n)),n.onInput=n.onInput.bind(g(n)),n.elementRef=t(n.props.forwardRef),n}return v(c,[{key:"onFocus",value:function(e){this.props.autoResize&&this.resize(),this.props.onFocus&&this.props.onFocus(e)}},{key:"onBlur",value:function(e){this.props.autoResize&&this.resize(),this.props.onBlur&&this.props.onBlur(e)}},{key:"onKeyUp",value:function(e){this.props.autoResize&&this.resize(),this.props.onKeyUp&&this.props.onKeyUp(e)}},{key:"onInput",value:function(e){this.props.autoResize&&this.resize(),e.target.value.length>0?i.addClass(e.target,"p-filled"):i.removeClass(e.target,"p-filled"),this.props.onInput&&this.props.onInput(e)}},{key:"resize",value:function(e){var t=this.elementRef&&this.elementRef.current;t&&i.isVisible(t)&&(this.cachedScrollHeight||(this.cachedScrollHeight=t.scrollHeight,t.style.overflow="hidden"),(this.cachedScrollHeight!==t.scrollHeight||e)&&(t.style.height="",t.style.height=t.scrollHeight+"px",parseFloat(t.style.height)>=parseFloat(t.style.maxHeight)?(t.style.overflowY="scroll",t.style.height=t.style.maxHeight):t.style.overflow="hidden",this.cachedScrollHeight=t.scrollHeight))}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&this.elementRef.current.value.toString().length>0}},{key:"updateForwardRef",value:function(){var e=this.props.forwardRef;e&&("function"==typeof e?e(this.elementRef.current):e.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip(),this.props.autoResize&&this.resize(!0)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(E({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=r({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=s("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),n=o.findDiffKeys(this.props,c.defaultProps);return e.createElement("textarea",f({ref:this.elementRef},n,{className:t,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}]),c}();w(x,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null});var L=e.forwardRef((function(t,n){return e.createElement(x,f({forwardRef:n},t))}));function P(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 I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(){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 z=function(r){b(w,n);var d,m,O=(d=w,m=j(),function(){var e,t=R(d);if(m){var n=R(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return k(this,e)});function w(e){var n;return y(this,w),(n=O.call(this,e)).state={overlayVisible:!1,focused:!1,searching:!1,trigger:null},n.onOverlayEnter=n.onOverlayEnter.bind(g(n)),n.onOverlayEntering=n.onOverlayEntering.bind(g(n)),n.onOverlayEntered=n.onOverlayEntered.bind(g(n)),n.onOverlayExit=n.onOverlayExit.bind(g(n)),n.onOverlayExited=n.onOverlayExited.bind(g(n)),n.onFocus=n.onFocus.bind(g(n)),n.onBlur=n.onBlur.bind(g(n)),n.onKeyDown=n.onKeyDown.bind(g(n)),n.onChange=n.onChange.bind(g(n)),n.onInput=n.onInput.bind(g(n)),n.onKeyUp=n.onKeyUp.bind(g(n)),n.onPanelClick=n.onPanelClick.bind(g(n)),n.overlayRef=t(),n.inputRef=t(n.props.inputRef),n}return v(w,[{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1,searching:!1,trigger:null})}},{key:"onOverlayEnter",value:function(){l.set("overlay",this.overlayRef.current),this.alignOverlay()}},{key:"onOverlayEntering",value:function(){this.props.autoHighlight&&this.props.suggestions&&this.props.suggestions.length&&i.addClass(this.list.firstChild,"p-highlight")}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){l.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){var e=this.state.trigger,t=e.key,n=e.index,r=this.inputRef.current.value,s=i.getCursorOffset(this.inputRef.current,r.substring(0,n-1),r.substring(n),t);this.overlayRef.current.style.transformOrigin="top",this.overlayRef.current.style.left="calc(".concat(s.left,"px + 1rem)"),this.overlayRef.current.style.top="calc(".concat(s.top,"px + 1.2rem)")}},{key:"onPanelClick",value:function(e){u.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"getTrigger",value:function(e,t,n){if(!this.state.trigger){var i=Array.isArray(this.props.trigger)?this.props.trigger.find((function(e){return e===t})):this.props.trigger===t?this.props.trigger:null;if(i)return{key:i,index:n};var r=e.substring(0,n).lastIndexOf(" "),s=this.getLatestTrigger(e,n);if(s.index>r)return s}return this.state.trigger}},{key:"getLatestTrigger",value:function(e,t){if(Array.isArray(this.props.trigger)){var n={};return this.props.trigger.forEach((function(i){var r=e.substring(0,t).lastIndexOf(i);-1!==r&&(r>n.index||!n.index)&&(n={key:i,index:-1!==r?r+1:-1})})),n}var i=e.substring(0,t).lastIndexOf(this.props.trigger);return{key:this.props.trigger,index:-1!==i?i+1:-1}}},{key:"onSearch",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var n=e.target,i=n.value,r=n.selectionStart,s=i.substring(r-1,r);if(" "!==s){var o=this.getTrigger(i,s,r);if(o&&o.index>-1){var l=i.substring(o.index,r);this.timeout=setTimeout((function(){t.search(e,l,o)}),this.props.delay)}}else this.hideOverlay()}},{key:"search",value:function(e,t,n){this.props.onSearch&&(this.setState({searching:!0,trigger:n}),this.props.onSearch({originalEvent:e,trigger:n.key,query:t}))}},{key:"selectItem",value:function(e,t){var n=this.inputRef.current.value,i=e.target.selectionStart,r=this.state.trigger,s=n.indexOf(" ",r.index),o=n.substring(r.index,s>-1?s:i),l=this.formatValue(t).replace(/\s+/g,"");if(o.trim()!==l){for(var u=0;u<l.length;){var a=l.charAt(u),p=o.charAt(u);if(a!==p&&" "!==p)break;u++}var c=n.substring(0,r.index),h=n.substring(r.index+u);this.inputRef.current.value="".concat(c).concat(l," ").concat(h),this.props.onChange&&this.props.onChange(e)}var f=r.index+l.length+1;this.inputRef.current.setSelectionRange(f,f),this.hideOverlay(),this.props.onSelect&&this.props.onSelect({originalEvent:e,suggestion:t})}},{key:"formatValue",value:function(e){var t=this;if(e){var n=Array.isArray(this.props.field)?this.props.field[this.props.trigger.findIndex((function(e){return e===t.state.trigger.key}))]:this.props.field;return n?o.resolveFieldData(e,n):e}return""}},{key:"onItemClick",value:function(e,t){this.inputRef.current.focus(),this.selectItem(e,t)}},{key:"onFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onInput",value:function(e){this.props.onInput&&this.props.onInput(e),e.target.value.length>0?i.addClass(this.container,"p-inputwrapper-filled"):i.removeClass(this.container,"p-inputwrapper-filled")}},{key:"onKeyUp",value:function(e){37!==e.which&&39!==e.which||this.onSearch(e)}},{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e),this.onSearch(e)}},{key:"onKeyDown",value:function(e){if(this.state.overlayVisible){var t=i.findSingle(this.overlayRef.current,"li.p-highlight");switch(e.which){case 40:if(t){var n=t.nextElementSibling;n&&(i.addClass(n,"p-highlight"),i.removeClass(t,"p-highlight"),i.scrollInView(this.overlayRef.current,n))}else(t=i.findSingle(this.overlayRef.current,"li"))&&i.addClass(t,"p-highlight");e.preventDefault();break;case 38:if(t){var r=t.previousElementSibling;r&&(i.addClass(r,"p-highlight"),i.removeClass(t,"p-highlight"),i.scrollInView(this.overlayRef.current,r))}e.preventDefault();break;case 8:var s=e.target,o=s.selectionStart;s.value.substring(o-1,o)===this.state.trigger.key&&this.hideOverlay();break;case 13:t&&this.selectItem(e,this.props.suggestions[i.index(t)]),e.preventDefault();break;case 27:this.hideOverlay(),e.preventDefault()}}}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){3!==t.which&&e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new a(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!i.isAndroid()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.inputRef&&this.inputRef.current&&this.inputRef.current.value.toString().length>0}},{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()}},{key:"componentDidUpdate",value:function(e){e.suggestions!==this.props.suggestions&&this.state.searching&&(this.props.suggestions&&this.props.suggestions.length?this.showOverlay():this.hideOverlay(),this.state.overlayVisible&&this.alignOverlay(),this.setState({searching:!1})),!this.isFilled()&&i.hasClass(this.container,"p-inputwrapper-filled")&&i.removeClass(this.container,"p-inputwrapper-filled")}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),l.clear(this.overlayRef.current)}},{key:"renderItem",value:function(t,n){var i=this,r=this.props.itemTemplate?o.getJSXElement(this.props.itemTemplate,t,{trigger:this.state.trigger?this.state.trigger.key:"",index:n}):this.formatValue(t);return e.createElement("li",{key:n+"_item",className:"p-mention-item",onClick:function(e){return i.onItemClick(e,t)}},r,e.createElement(p,null))}},{key:"renderList",value:function(){var t=this;if(this.props.suggestions){var n=this.props.suggestions.map((function(e,n){return t.renderItem(e,n)}));return e.createElement("ul",{ref:function(e){return t.list=e},className:"p-mention-items"},n)}return null}},{key:"renderPanel",value:function(){var t=s("p-mention-panel p-component",this.props.panelClassName),n=I({maxHeight:this.props.scrollHeight},this.props.panelStyle),i=o.getJSXElement(this.props.headerTemplate,this.props),r=o.getJSXElement(this.props.footerTemplate,this.props),l=this.renderList();return e.createElement(h,{element:e.createElement(c,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.overlayVisible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onOverlayEnter,onEntering:this.onOverlayEntering,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited},e.createElement("div",{ref:this.overlayRef,className:t,style:n,onClick:this.onPanelClick},i,l,r)),appendTo:"self"})}},{key:"render",value:function(){var t=this,n=s("p-mention p-component p-inputwrapper",{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused},this.props.className),i=s("p-mention-input",this.props.inputClassName),r=o.findDiffKeys(this.props,w.defaultProps),l=this.renderPanel();return e.createElement("div",{ref:function(e){return t.container=e},id:this.props.id,className:n,style:this.props.style},e.createElement(L,f({ref:this.inputRef,id:this.props.inputId},r,{className:i,style:this.props.inputStyle,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onKeyUp:this.onKeyUp,onChange:this.onChange})),l)}}]),w}();w(z,"defaultProps",{id:null,inputId:null,inputRef:null,style:null,className:null,trigger:"@",suggestions:null,field:null,inputStyle:null,inputClassName:null,panelClassName:null,panelStyle:null,scrollHeight:"200px",autoHighlight:!0,delay:0,headerTemplate:null,footerTemplate:null,itemTemplate:null,transitionOptions:null,onChange:null,onInput:null,onSearch:null,onSelect:null,onFocus:null,onBlur:null,onShow:null,onHide:null});export{z as Mention};
|
|
1
|
+
import e,{createRef as t,Component as n}from"react";import{DomHandler as i,classNames as r,ObjectUtils as o,ZIndexUtils as s,ConnectedOverlayScrollHandler as l}from"primereact/utils";import{Ripple as a}from"primereact/ripple";import{OverlayService as u}from"primereact/overlayservice";import{CSSTransition as p}from"primereact/csstransition";import{Portal as c}from"primereact/portal";import{tip as h}from"primereact/tooltip";import f from"primereact/api";function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(this,arguments)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(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 g(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},b(e,t)}function O(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&&b(e,t)}function k(e){return k="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},k(e)}function R(e,t){if(t&&("object"===k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(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 x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function C(){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 L=function(s){O(p,n);var l,a,u=(l=p,a=C(),function(){var e,t=w(l);if(a){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return R(this,e)});function p(e){var n;return d(this,p),(n=u.call(this,e)).onFocus=n.onFocus.bind(m(n)),n.onBlur=n.onBlur.bind(m(n)),n.onKeyUp=n.onKeyUp.bind(m(n)),n.onInput=n.onInput.bind(m(n)),n.elementRef=t(n.props.forwardRef),n}return g(p,[{key:"onFocus",value:function(e){this.props.autoResize&&this.resize(),this.props.onFocus&&this.props.onFocus(e)}},{key:"onBlur",value:function(e){this.props.autoResize&&this.resize(),this.props.onBlur&&this.props.onBlur(e)}},{key:"onKeyUp",value:function(e){this.props.autoResize&&this.resize(),this.props.onKeyUp&&this.props.onKeyUp(e)}},{key:"onInput",value:function(e){this.props.autoResize&&this.resize(),e.target.value.length>0?i.addClass(e.target,"p-filled"):i.removeClass(e.target,"p-filled"),this.props.onInput&&this.props.onInput(e)}},{key:"resize",value:function(e){var t=this.elementRef&&this.elementRef.current;t&&i.isVisible(t)&&(this.cachedScrollHeight||(this.cachedScrollHeight=t.scrollHeight,t.style.overflow="hidden"),(this.cachedScrollHeight!==t.scrollHeight||e)&&(t.style.height="",t.style.height=t.scrollHeight+"px",parseFloat(t.style.height)>=parseFloat(t.style.maxHeight)?(t.style.overflowY="scroll",t.style.height=t.style.maxHeight):t.style.overflow="hidden",this.cachedScrollHeight=t.scrollHeight))}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.elementRef&&this.elementRef.current&&this.elementRef.current.value.toString().length>0}},{key:"updateForwardRef",value:function(){var e=this.props.forwardRef;e&&("function"==typeof e?e(this.elementRef.current):e.current=this.elementRef.current)}},{key:"componentDidMount",value:function(){this.updateForwardRef(),this.props.tooltip&&this.renderTooltip(),this.props.autoResize&&this.resize(!0)}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(x({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip()),this.props.autoResize&&this.resize(!0)}},{key:"componentWillUnmount",value:function(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null)}},{key:"renderTooltip",value:function(){this.tooltip=h({target:this.elementRef.current,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"render",value:function(){var t=r("p-inputtextarea p-inputtext p-component",{"p-disabled":this.props.disabled,"p-filled":this.isFilled(),"p-inputtextarea-resizable":this.props.autoResize},this.props.className),n=o.findDiffKeys(this.props,p.defaultProps);return e.createElement("textarea",y({ref:this.elementRef},n,{className:t,onFocus:this.onFocus,onBlur:this.onBlur,onKeyUp:this.onKeyUp,onInput:this.onInput}))}}]),p}();S(L,"defaultProps",{autoResize:!1,tooltip:null,tooltipOptions:null,onInput:null,forwardRef:null});var I=e.forwardRef((function(t,n){return e.createElement(L,y({forwardRef:n},t))}));function P(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 j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function z(){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 D=function(h){O(S,n);var v,b,k=(v=S,b=z(),function(){var e,t=w(v);if(b){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return R(this,e)});function S(e){var n;return d(this,S),(n=k.call(this,e)).state={overlayVisible:!1,focused:!1,searching:!1,trigger:null},n.onOverlayEnter=n.onOverlayEnter.bind(m(n)),n.onOverlayEntering=n.onOverlayEntering.bind(m(n)),n.onOverlayEntered=n.onOverlayEntered.bind(m(n)),n.onOverlayExit=n.onOverlayExit.bind(m(n)),n.onOverlayExited=n.onOverlayExited.bind(m(n)),n.onFocus=n.onFocus.bind(m(n)),n.onBlur=n.onBlur.bind(m(n)),n.onKeyDown=n.onKeyDown.bind(m(n)),n.onChange=n.onChange.bind(m(n)),n.onInput=n.onInput.bind(m(n)),n.onKeyUp=n.onKeyUp.bind(m(n)),n.onPanelClick=n.onPanelClick.bind(m(n)),n.overlayRef=t(),n.inputRef=t(n.props.inputRef),n}return g(S,[{key:"showOverlay",value:function(){this.setState({overlayVisible:!0})}},{key:"hideOverlay",value:function(){this.setState({overlayVisible:!1,searching:!1,trigger:null})}},{key:"onOverlayEnter",value:function(){s.set("overlay",this.overlayRef.current,f.autoZIndex,f.zIndex.overlay),this.alignOverlay()}},{key:"onOverlayEntering",value:function(){this.props.autoHighlight&&this.props.suggestions&&this.props.suggestions.length&&i.addClass(this.list.firstChild,"p-highlight")}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){s.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){var e=this.state.trigger,t=e.key,n=e.index,r=this.inputRef.current.value,o=i.getCursorOffset(this.inputRef.current,r.substring(0,n-1),r.substring(n),t);this.overlayRef.current.style.transformOrigin="top",this.overlayRef.current.style.left="calc(".concat(o.left,"px + 1rem)"),this.overlayRef.current.style.top="calc(".concat(o.top,"px + 1.2rem)")}},{key:"onPanelClick",value:function(e){u.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"getTrigger",value:function(e,t,n){if(!this.state.trigger){var i=Array.isArray(this.props.trigger)?this.props.trigger.find((function(e){return e===t})):this.props.trigger===t?this.props.trigger:null;if(i)return{key:i,index:n};var r=e.substring(0,n).lastIndexOf(" "),o=this.getLatestTrigger(e,n);if(o.index>r)return o}return this.state.trigger}},{key:"getLatestTrigger",value:function(e,t){if(Array.isArray(this.props.trigger)){var n={};return this.props.trigger.forEach((function(i){var r=e.substring(0,t).lastIndexOf(i);-1!==r&&(r>n.index||!n.index)&&(n={key:i,index:-1!==r?r+1:-1})})),n}var i=e.substring(0,t).lastIndexOf(this.props.trigger);return{key:this.props.trigger,index:-1!==i?i+1:-1}}},{key:"onSearch",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var n=e.target,i=n.value,r=n.selectionStart,o=i.substring(r-1,r);if(" "!==o){var s=this.getTrigger(i,o,r);if(s&&s.index>-1){var l=i.substring(s.index,r);this.timeout=setTimeout((function(){t.search(e,l,s)}),this.props.delay)}}else this.hideOverlay()}},{key:"search",value:function(e,t,n){this.props.onSearch&&(this.setState({searching:!0,trigger:n}),this.props.onSearch({originalEvent:e,trigger:n.key,query:t}))}},{key:"selectItem",value:function(e,t){var n=this.inputRef.current.value,i=e.target.selectionStart,r=this.state.trigger,o=n.indexOf(" ",r.index),s=n.substring(r.index,o>-1?o:i),l=this.formatValue(t).replace(/\s+/g,"");if(s.trim()!==l){for(var a=0;a<l.length;){var u=l.charAt(a),p=s.charAt(a);if(u!==p&&" "!==p)break;a++}var c=n.substring(0,r.index),h=n.substring(r.index+a);this.inputRef.current.value="".concat(c).concat(l," ").concat(h),this.props.onChange&&this.props.onChange(e)}var f=r.index+l.length+1;this.inputRef.current.setSelectionRange(f,f),this.hideOverlay(),this.props.onSelect&&this.props.onSelect({originalEvent:e,suggestion:t})}},{key:"formatValue",value:function(e){var t=this;if(e){var n=Array.isArray(this.props.field)?this.props.field[this.props.trigger.findIndex((function(e){return e===t.state.trigger.key}))]:this.props.field;return n?o.resolveFieldData(e,n):e}return""}},{key:"onItemClick",value:function(e,t){this.inputRef.current.focus(),this.selectItem(e,t)}},{key:"onFocus",value:function(e){var t=this;e.persist(),this.setState({focused:!0},(function(){t.props.onFocus&&t.props.onFocus(e)}))}},{key:"onBlur",value:function(e){var t=this;e.persist(),this.setState({focused:!1},(function(){t.props.onBlur&&t.props.onBlur(e)}))}},{key:"onInput",value:function(e){this.props.onInput&&this.props.onInput(e),e.target.value.length>0?i.addClass(this.container,"p-inputwrapper-filled"):i.removeClass(this.container,"p-inputwrapper-filled")}},{key:"onKeyUp",value:function(e){37!==e.which&&39!==e.which||this.onSearch(e)}},{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e),this.onSearch(e)}},{key:"onKeyDown",value:function(e){if(this.state.overlayVisible){var t=i.findSingle(this.overlayRef.current,"li.p-highlight");switch(e.which){case 40:if(t){var n=t.nextElementSibling;n&&(i.addClass(n,"p-highlight"),i.removeClass(t,"p-highlight"),i.scrollInView(this.overlayRef.current,n))}else(t=i.findSingle(this.overlayRef.current,"li"))&&i.addClass(t,"p-highlight");e.preventDefault();break;case 38:if(t){var r=t.previousElementSibling;r&&(i.addClass(r,"p-highlight"),i.removeClass(t,"p-highlight"),i.scrollInView(this.overlayRef.current,r))}e.preventDefault();break;case 8:var o=e.target,s=o.selectionStart;o.value.substring(s-1,s)===this.state.trigger.key&&this.hideOverlay();break;case 13:t&&this.selectItem(e,this.props.suggestions[i.index(t)]),e.preventDefault();break;case 27:this.hideOverlay(),e.preventDefault()}}}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){3!==t.which&&e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hideOverlay()},document.addEventListener("click",this.documentClickListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new l(this.container,(function(){e.state.overlayVisible&&e.hideOverlay()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!i.isAndroid()&&e.hideOverlay()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)}},{key:"isFilled",value:function(){return null!=this.props.value&&this.props.value.toString().length>0||null!=this.props.defaultValue&&this.props.defaultValue.toString().length>0||this.inputRef&&this.inputRef.current&&this.inputRef.current.value.toString().length>0}},{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()}},{key:"componentDidUpdate",value:function(e){e.suggestions!==this.props.suggestions&&this.state.searching&&(this.props.suggestions&&this.props.suggestions.length?this.showOverlay():this.hideOverlay(),this.state.overlayVisible&&this.alignOverlay(),this.setState({searching:!1})),!this.isFilled()&&i.hasClass(this.container,"p-inputwrapper-filled")&&i.removeClass(this.container,"p-inputwrapper-filled")}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),s.clear(this.overlayRef.current)}},{key:"renderItem",value:function(t,n){var i=this,r=this.props.itemTemplate?o.getJSXElement(this.props.itemTemplate,t,{trigger:this.state.trigger?this.state.trigger.key:"",index:n}):this.formatValue(t);return e.createElement("li",{key:n+"_item",className:"p-mention-item",onClick:function(e){return i.onItemClick(e,t)}},r,e.createElement(a,null))}},{key:"renderList",value:function(){var t=this;if(this.props.suggestions){var n=this.props.suggestions.map((function(e,n){return t.renderItem(e,n)}));return e.createElement("ul",{ref:function(e){return t.list=e},className:"p-mention-items"},n)}return null}},{key:"renderPanel",value:function(){var t=r("p-mention-panel p-component",this.props.panelClassName),n=j({maxHeight:this.props.scrollHeight},this.props.panelStyle),i=o.getJSXElement(this.props.headerTemplate,this.props),s=o.getJSXElement(this.props.footerTemplate,this.props),l=this.renderList();return e.createElement(c,{element:e.createElement(p,{nodeRef:this.overlayRef,classNames:"p-connected-overlay",in:this.state.overlayVisible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onOverlayEnter,onEntering:this.onOverlayEntering,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited},e.createElement("div",{ref:this.overlayRef,className:t,style:n,onClick:this.onPanelClick},i,l,s)),appendTo:"self"})}},{key:"render",value:function(){var t=this,n=r("p-mention p-component p-inputwrapper",{"p-inputwrapper-filled":this.isFilled(),"p-inputwrapper-focus":this.state.focused},this.props.className),i=r("p-mention-input",this.props.inputClassName),s=o.findDiffKeys(this.props,S.defaultProps),l=this.renderPanel();return e.createElement("div",{ref:function(e){return t.container=e},id:this.props.id,className:n,style:this.props.style},e.createElement(I,y({ref:this.inputRef,id:this.props.inputId},s,{className:i,style:this.props.inputStyle,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onInput:this.onInput,onKeyUp:this.onKeyUp,onChange:this.onChange})),l)}}]),S}();S(D,"defaultProps",{id:null,inputId:null,inputRef:null,style:null,className:null,trigger:"@",suggestions:null,field:null,inputStyle:null,inputClassName:null,panelClassName:null,panelStyle:null,scrollHeight:"200px",autoHighlight:!0,delay:0,headerTemplate:null,footerTemplate:null,itemTemplate:null,transitionOptions:null,onChange:null,onInput:null,onSearch:null,onSelect:null,onFocus:null,onBlur:null,onShow:null,onHide:null});export{D as Mention};
|