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/picklist/picklist.cjs.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
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');
|
|
7
8
|
var button = require('primereact/button');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -83,6 +84,8 @@ function _typeof(obj) {
|
|
|
83
84
|
function _possibleConstructorReturn(self, call) {
|
|
84
85
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
85
86
|
return call;
|
|
87
|
+
} else if (call !== void 0) {
|
|
88
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
return _assertThisInitialized(self);
|
|
@@ -206,17 +209,17 @@ var PickListItem = /*#__PURE__*/function (_Component) {
|
|
|
206
209
|
key: "render",
|
|
207
210
|
value: function render() {
|
|
208
211
|
var content = this.props.template ? this.props.template(this.props.value) : this.props.value;
|
|
209
|
-
var className =
|
|
212
|
+
var className = utils.classNames('p-picklist-item', {
|
|
210
213
|
'p-highlight': this.props.selected
|
|
211
214
|
}, this.props.className);
|
|
212
|
-
return /*#__PURE__*/React__default[
|
|
215
|
+
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
213
216
|
className: className,
|
|
214
217
|
onClick: this.onClick,
|
|
215
218
|
onKeyDown: this.onKeyDown,
|
|
216
219
|
tabIndex: this.props.tabIndex,
|
|
217
220
|
role: "option",
|
|
218
221
|
"aria-selected": this.props.selected
|
|
219
|
-
}, content, /*#__PURE__*/React__default[
|
|
222
|
+
}, content, /*#__PURE__*/React__default["default"].createElement(ripple.Ripple, null));
|
|
220
223
|
}
|
|
221
224
|
}]);
|
|
222
225
|
|
|
@@ -261,7 +264,7 @@ var PickListSubListComponent = /*#__PURE__*/function (_Component) {
|
|
|
261
264
|
|
|
262
265
|
var selection = _toConsumableArray(this.props.selection);
|
|
263
266
|
|
|
264
|
-
var index =
|
|
267
|
+
var index = utils.ObjectUtils.findIndexInList(item, selection, this.props.dataKey);
|
|
265
268
|
var selected = index !== -1;
|
|
266
269
|
var metaSelection = this.props.metaKeySelection;
|
|
267
270
|
|
|
@@ -327,18 +330,18 @@ var PickListSubListComponent = /*#__PURE__*/function (_Component) {
|
|
|
327
330
|
key: "findNextItem",
|
|
328
331
|
value: function findNextItem(item) {
|
|
329
332
|
var nextItem = item.nextElementSibling;
|
|
330
|
-
if (nextItem) return !
|
|
333
|
+
if (nextItem) return !utils.DomHandler.hasClass(nextItem, 'p-picklist-item') ? this.findNextItem(nextItem) : nextItem;else return null;
|
|
331
334
|
}
|
|
332
335
|
}, {
|
|
333
336
|
key: "findPrevItem",
|
|
334
337
|
value: function findPrevItem(item) {
|
|
335
338
|
var prevItem = item.previousElementSibling;
|
|
336
|
-
if (prevItem) return !
|
|
339
|
+
if (prevItem) return !utils.DomHandler.hasClass(prevItem, 'p-picklist-item') ? this.findPrevItem(prevItem) : prevItem;else return null;
|
|
337
340
|
}
|
|
338
341
|
}, {
|
|
339
342
|
key: "isSelected",
|
|
340
343
|
value: function isSelected(item) {
|
|
341
|
-
return
|
|
344
|
+
return utils.ObjectUtils.findIndexInList(item, this.props.selection, this.props.dataKey) !== -1;
|
|
342
345
|
}
|
|
343
346
|
}, {
|
|
344
347
|
key: "render",
|
|
@@ -347,18 +350,18 @@ var PickListSubListComponent = /*#__PURE__*/function (_Component) {
|
|
|
347
350
|
|
|
348
351
|
var header = null;
|
|
349
352
|
var items = null;
|
|
350
|
-
var wrapperClassName =
|
|
351
|
-
var listClassName =
|
|
353
|
+
var wrapperClassName = utils.classNames('p-picklist-list-wrapper', this.props.className);
|
|
354
|
+
var listClassName = utils.classNames('p-picklist-list', this.props.listClassName);
|
|
352
355
|
|
|
353
356
|
if (this.props.header) {
|
|
354
|
-
header = /*#__PURE__*/React__default[
|
|
357
|
+
header = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
355
358
|
className: "p-picklist-header"
|
|
356
|
-
},
|
|
359
|
+
}, utils.ObjectUtils.getJSXElement(this.props.header, this.props));
|
|
357
360
|
}
|
|
358
361
|
|
|
359
362
|
if (this.props.list) {
|
|
360
363
|
items = this.props.list.map(function (item, i) {
|
|
361
|
-
return /*#__PURE__*/React__default[
|
|
364
|
+
return /*#__PURE__*/React__default["default"].createElement(PickListItem, {
|
|
362
365
|
key: JSON.stringify(item),
|
|
363
366
|
value: item,
|
|
364
367
|
template: _this2.props.itemTemplate,
|
|
@@ -370,10 +373,10 @@ var PickListSubListComponent = /*#__PURE__*/function (_Component) {
|
|
|
370
373
|
});
|
|
371
374
|
}
|
|
372
375
|
|
|
373
|
-
return /*#__PURE__*/React__default[
|
|
376
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
374
377
|
ref: this.props.forwardRef,
|
|
375
378
|
className: wrapperClassName
|
|
376
|
-
}, header, /*#__PURE__*/React__default[
|
|
379
|
+
}, header, /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
377
380
|
className: listClassName,
|
|
378
381
|
style: this.props.style,
|
|
379
382
|
role: "listbox",
|
|
@@ -385,8 +388,8 @@ var PickListSubListComponent = /*#__PURE__*/function (_Component) {
|
|
|
385
388
|
return PickListSubListComponent;
|
|
386
389
|
}(React.Component);
|
|
387
390
|
|
|
388
|
-
var PickListSubList = /*#__PURE__*/React__default[
|
|
389
|
-
return /*#__PURE__*/React__default[
|
|
391
|
+
var PickListSubList = /*#__PURE__*/React__default["default"].forwardRef(function (props, ref) {
|
|
392
|
+
return /*#__PURE__*/React__default["default"].createElement(PickListSubListComponent, _extends({
|
|
390
393
|
forwardRef: ref
|
|
391
394
|
}, props));
|
|
392
395
|
});
|
|
@@ -422,7 +425,7 @@ var PickListControls = /*#__PURE__*/function (_Component) {
|
|
|
422
425
|
|
|
423
426
|
for (var i = 0; i < selectedItems.length; i++) {
|
|
424
427
|
var selectedItem = selectedItems[i];
|
|
425
|
-
var selectedItemIndex =
|
|
428
|
+
var selectedItemIndex = utils.ObjectUtils.findIndexInList(selectedItem, list, this.props.dataKey);
|
|
426
429
|
|
|
427
430
|
if (selectedItemIndex !== 0) {
|
|
428
431
|
var movedItem = list[selectedItemIndex];
|
|
@@ -453,7 +456,7 @@ var PickListControls = /*#__PURE__*/function (_Component) {
|
|
|
453
456
|
|
|
454
457
|
for (var i = 0; i < selectedItems.length; i++) {
|
|
455
458
|
var selectedItem = selectedItems[i];
|
|
456
|
-
var selectedItemIndex =
|
|
459
|
+
var selectedItemIndex = utils.ObjectUtils.findIndexInList(selectedItem, list, this.props.dataKey);
|
|
457
460
|
|
|
458
461
|
if (selectedItemIndex !== 0) {
|
|
459
462
|
var movedItem = list.splice(selectedItemIndex, 1)[0];
|
|
@@ -482,7 +485,7 @@ var PickListControls = /*#__PURE__*/function (_Component) {
|
|
|
482
485
|
|
|
483
486
|
for (var i = selectedItems.length - 1; i >= 0; i--) {
|
|
484
487
|
var selectedItem = selectedItems[i];
|
|
485
|
-
var selectedItemIndex =
|
|
488
|
+
var selectedItemIndex = utils.ObjectUtils.findIndexInList(selectedItem, list, this.props.dataKey);
|
|
486
489
|
|
|
487
490
|
if (selectedItemIndex !== list.length - 1) {
|
|
488
491
|
var movedItem = list[selectedItemIndex];
|
|
@@ -515,7 +518,7 @@ var PickListControls = /*#__PURE__*/function (_Component) {
|
|
|
515
518
|
|
|
516
519
|
for (var i = selectedItems.length - 1; i >= 0; i--) {
|
|
517
520
|
var selectedItem = selectedItems[i];
|
|
518
|
-
var selectedItemIndex =
|
|
521
|
+
var selectedItemIndex = utils.ObjectUtils.findIndexInList(selectedItem, list, this.props.dataKey);
|
|
519
522
|
|
|
520
523
|
if (selectedItemIndex !== list.length - 1) {
|
|
521
524
|
var movedItem = list.splice(selectedItemIndex, 1)[0];
|
|
@@ -538,25 +541,25 @@ var PickListControls = /*#__PURE__*/function (_Component) {
|
|
|
538
541
|
key: "render",
|
|
539
542
|
value: function render() {
|
|
540
543
|
var moveDisabled = !this.props.selection.length;
|
|
541
|
-
var className =
|
|
542
|
-
return /*#__PURE__*/React__default[
|
|
544
|
+
var className = utils.classNames('p-picklist-buttons', this.props.className);
|
|
545
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
543
546
|
className: className
|
|
544
|
-
}, /*#__PURE__*/React__default[
|
|
547
|
+
}, /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
545
548
|
disabled: moveDisabled,
|
|
546
549
|
type: "button",
|
|
547
550
|
icon: "pi pi-angle-up",
|
|
548
551
|
onClick: this.moveUp
|
|
549
|
-
}), /*#__PURE__*/React__default[
|
|
552
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
550
553
|
disabled: moveDisabled,
|
|
551
554
|
type: "button",
|
|
552
555
|
icon: "pi pi-angle-double-up",
|
|
553
556
|
onClick: this.moveTop
|
|
554
|
-
}), /*#__PURE__*/React__default[
|
|
557
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
555
558
|
disabled: moveDisabled,
|
|
556
559
|
type: "button",
|
|
557
560
|
icon: "pi pi-angle-down",
|
|
558
561
|
onClick: this.moveDown
|
|
559
|
-
}), /*#__PURE__*/React__default[
|
|
562
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
560
563
|
disabled: moveDisabled,
|
|
561
564
|
type: "button",
|
|
562
565
|
icon: "pi pi-angle-double-down",
|
|
@@ -594,7 +597,7 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
594
597
|
value: function moveRight(event) {
|
|
595
598
|
var selection = this.props.sourceSelection;
|
|
596
599
|
|
|
597
|
-
if (selection
|
|
600
|
+
if (utils.ObjectUtils.isNotEmpty(selection)) {
|
|
598
601
|
var targetList = _toConsumableArray(this.props.target);
|
|
599
602
|
|
|
600
603
|
var sourceList = _toConsumableArray(this.props.source);
|
|
@@ -602,8 +605,8 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
602
605
|
for (var i = 0; i < selection.length; i++) {
|
|
603
606
|
var selectedItem = selection[i];
|
|
604
607
|
|
|
605
|
-
if (
|
|
606
|
-
targetList.push(sourceList.splice(
|
|
608
|
+
if (utils.ObjectUtils.findIndexInList(selectedItem, targetList, this.props.dataKey) === -1) {
|
|
609
|
+
targetList.push(sourceList.splice(utils.ObjectUtils.findIndexInList(selectedItem, sourceList, this.props.dataKey), 1)[0]);
|
|
607
610
|
}
|
|
608
611
|
}
|
|
609
612
|
|
|
@@ -639,7 +642,7 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
639
642
|
value: function moveLeft(event) {
|
|
640
643
|
var selection = this.props.targetSelection;
|
|
641
644
|
|
|
642
|
-
if (selection
|
|
645
|
+
if (utils.ObjectUtils.isNotEmpty(selection)) {
|
|
643
646
|
var targetList = _toConsumableArray(this.props.target);
|
|
644
647
|
|
|
645
648
|
var sourceList = _toConsumableArray(this.props.source);
|
|
@@ -647,8 +650,8 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
647
650
|
for (var i = 0; i < selection.length; i++) {
|
|
648
651
|
var selectedItem = selection[i];
|
|
649
652
|
|
|
650
|
-
if (
|
|
651
|
-
sourceList.push(targetList.splice(
|
|
653
|
+
if (utils.ObjectUtils.findIndexInList(selectedItem, sourceList, this.props.dataKey) === -1) {
|
|
654
|
+
sourceList.push(targetList.splice(utils.ObjectUtils.findIndexInList(selectedItem, targetList, this.props.dataKey), 1)[0]);
|
|
652
655
|
}
|
|
653
656
|
}
|
|
654
657
|
|
|
@@ -682,29 +685,29 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
682
685
|
}, {
|
|
683
686
|
key: "render",
|
|
684
687
|
value: function render() {
|
|
685
|
-
var moveRightDisabled =
|
|
686
|
-
var moveLeftDisabled =
|
|
687
|
-
var moveAllRightDisabled =
|
|
688
|
-
var moveAllLeftDisabled =
|
|
689
|
-
var className =
|
|
690
|
-
return /*#__PURE__*/React__default[
|
|
688
|
+
var moveRightDisabled = utils.ObjectUtils.isEmpty(this.props.sourceSelection);
|
|
689
|
+
var moveLeftDisabled = utils.ObjectUtils.isEmpty(this.props.targetSelection);
|
|
690
|
+
var moveAllRightDisabled = utils.ObjectUtils.isEmpty(this.props.source);
|
|
691
|
+
var moveAllLeftDisabled = utils.ObjectUtils.isEmpty(this.props.target);
|
|
692
|
+
var className = utils.classNames('p-picklist-buttons p-picklist-transfer-buttons', this.props.className);
|
|
693
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
691
694
|
className: className
|
|
692
|
-
}, /*#__PURE__*/React__default[
|
|
695
|
+
}, /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
693
696
|
disabled: moveRightDisabled,
|
|
694
697
|
type: "button",
|
|
695
698
|
icon: "pi pi-angle-right",
|
|
696
699
|
onClick: this.moveRight
|
|
697
|
-
}), /*#__PURE__*/React__default[
|
|
700
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
698
701
|
disabled: moveAllRightDisabled,
|
|
699
702
|
type: "button",
|
|
700
703
|
icon: "pi pi-angle-double-right",
|
|
701
704
|
onClick: this.moveAllRight
|
|
702
|
-
}), /*#__PURE__*/React__default[
|
|
705
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
703
706
|
disabled: moveLeftDisabled,
|
|
704
707
|
type: "button",
|
|
705
708
|
icon: "pi pi-angle-left",
|
|
706
709
|
onClick: this.moveLeft
|
|
707
|
-
}), /*#__PURE__*/React__default[
|
|
710
|
+
}), /*#__PURE__*/React__default["default"].createElement(button.Button, {
|
|
708
711
|
disabled: moveAllLeftDisabled,
|
|
709
712
|
type: "button",
|
|
710
713
|
icon: "pi pi-angle-double-left",
|
|
@@ -774,7 +777,7 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
774
777
|
key: "handleScrollPosition",
|
|
775
778
|
value: function handleScrollPosition(listElement, direction) {
|
|
776
779
|
if (listElement) {
|
|
777
|
-
var listContainer =
|
|
780
|
+
var listContainer = utils.DomHandler.findSingle(listElement, '.p-picklist-list');
|
|
778
781
|
|
|
779
782
|
switch (direction) {
|
|
780
783
|
case 'up':
|
|
@@ -871,7 +874,10 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
871
874
|
value: function scrollInView(listContainer) {
|
|
872
875
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
873
876
|
var selectedItems = listContainer.getElementsByClassName('p-highlight');
|
|
874
|
-
|
|
877
|
+
|
|
878
|
+
if (utils.ObjectUtils.isNotEmpty(selectedItems)) {
|
|
879
|
+
utils.DomHandler.scrollInView(listContainer, direction === -1 ? selectedItems[0] : selectedItems[selectedItems.length - 1]);
|
|
880
|
+
}
|
|
875
881
|
}
|
|
876
882
|
}, {
|
|
877
883
|
key: "onSelectionChange",
|
|
@@ -882,11 +888,11 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
882
888
|
this.setState(_defineProperty({}, stateKey, e.value));
|
|
883
889
|
}
|
|
884
890
|
|
|
885
|
-
if (
|
|
891
|
+
if (utils.ObjectUtils.isNotEmpty(this.state.sourceSelection) && stateKey === 'targetSelection') {
|
|
886
892
|
this.setState({
|
|
887
893
|
sourceSelection: []
|
|
888
894
|
});
|
|
889
|
-
} else if (
|
|
895
|
+
} else if (utils.ObjectUtils.isNotEmpty(this.state.targetSelection) && stateKey === 'sourceSelection') {
|
|
890
896
|
this.setState({
|
|
891
897
|
targetSelection: []
|
|
892
898
|
});
|
|
@@ -906,20 +912,20 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
906
912
|
value: function render() {
|
|
907
913
|
var _this2 = this;
|
|
908
914
|
|
|
909
|
-
var className =
|
|
915
|
+
var className = utils.classNames('p-picklist p-component', this.props.className);
|
|
910
916
|
var sourceSelection = this.getSourceSelection();
|
|
911
917
|
var targetSelection = this.getTargetSelection();
|
|
912
|
-
return /*#__PURE__*/React__default[
|
|
918
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
913
919
|
id: this.props.id,
|
|
914
920
|
className: className,
|
|
915
921
|
style: this.props.style
|
|
916
|
-
}, this.props.showSourceControls && /*#__PURE__*/React__default[
|
|
922
|
+
}, this.props.showSourceControls && /*#__PURE__*/React__default["default"].createElement(PickListControls, {
|
|
917
923
|
list: this.props.source,
|
|
918
924
|
selection: sourceSelection,
|
|
919
925
|
onReorder: this.onSourceReorder,
|
|
920
926
|
className: "p-picklist-source-controls",
|
|
921
927
|
dataKey: this.props.dataKey
|
|
922
|
-
}), /*#__PURE__*/React__default[
|
|
928
|
+
}), /*#__PURE__*/React__default["default"].createElement(PickListSubList, {
|
|
923
929
|
ref: function ref(el) {
|
|
924
930
|
return _this2.sourceListElement = el;
|
|
925
931
|
},
|
|
@@ -936,14 +942,14 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
936
942
|
metaKeySelection: this.props.metaKeySelection,
|
|
937
943
|
tabIndex: this.props.tabIndex,
|
|
938
944
|
dataKey: this.props.dataKey
|
|
939
|
-
}), /*#__PURE__*/React__default[
|
|
945
|
+
}), /*#__PURE__*/React__default["default"].createElement(PickListTransferControls, {
|
|
940
946
|
onTransfer: this.onTransfer,
|
|
941
947
|
source: this.props.source,
|
|
942
948
|
target: this.props.target,
|
|
943
949
|
sourceSelection: sourceSelection,
|
|
944
950
|
targetSelection: targetSelection,
|
|
945
951
|
dataKey: this.props.dataKey
|
|
946
|
-
}), /*#__PURE__*/React__default[
|
|
952
|
+
}), /*#__PURE__*/React__default["default"].createElement(PickListSubList, {
|
|
947
953
|
ref: function ref(el) {
|
|
948
954
|
return _this2.targetListElement = el;
|
|
949
955
|
},
|
|
@@ -960,7 +966,7 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
960
966
|
metaKeySelection: this.props.metaKeySelection,
|
|
961
967
|
tabIndex: this.props.tabIndex,
|
|
962
968
|
dataKey: this.props.dataKey
|
|
963
|
-
}), this.props.showTargetControls && /*#__PURE__*/React__default[
|
|
969
|
+
}), this.props.showTargetControls && /*#__PURE__*/React__default["default"].createElement(PickListControls, {
|
|
964
970
|
list: this.props.target,
|
|
965
971
|
selection: targetSelection,
|
|
966
972
|
onReorder: this.onTargetReorder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core"),n=require("primereact/button");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function l(e,t,n){return t&&s(e.prototype,t),n&&s(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 c(e,t){return(c=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&&c(e,t)}function u(e){return(u="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"!==u(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 v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function m(e){if(Array.isArray(e))return g(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e){return m(e)||y(e)||b(e)||S()}function T(){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 C=function(n){p(u,e.Component);var o,s,c=(o=u,s=T(),function(){var e,t=f(o);if(s){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function u(e){var t;return i(this,u),(t=c.call(this,e)).onClick=t.onClick.bind(a(t)),t.onKeyDown=t.onKeyDown.bind(a(t)),t}return l(u,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,value:this.props.value})}},{key:"onKeyDown",value:function(e){this.props.onKeyDown&&this.props.onKeyDown({originalEvent:e,value:this.props.value})}},{key:"render",value:function(){var e=this.props.template?this.props.template(this.props.value):this.props.value,n=t.classNames("p-picklist-item",{"p-highlight":this.props.selected},this.props.className);return r.default.createElement("li",{className:n,onClick:this.onClick,onKeyDown:this.onKeyDown,tabIndex:this.props.tabIndex,role:"option","aria-selected":this.props.selected},e,r.default.createElement(t.Ripple,null))}}]),u}();function E(){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}}d(C,"defaultProps",{value:null,className:null,template:null,selected:!1,tabIndex:null,onClick:null,onKeyDown:null});var R=function(n){p(u,e.Component);var o,s,c=(o=u,s=E(),function(){var e,t=f(o);if(s){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function u(e){var t;return i(this,u),(t=c.call(this,e)).onItemClick=t.onItemClick.bind(a(t)),t.onItemKeyDown=t.onItemKeyDown.bind(a(t)),t}return l(u,[{key:"onItemClick",value:function(e){var n=e.originalEvent,o=e.value,r=k(this.props.selection),i=t.ObjectUtils.findIndexInList(o,r,this.props.dataKey),s=-1!==i;if(this.props.metaKeySelection){var l=n.metaKey||n.ctrlKey;s&&l?r.splice(i,1):(l||(r.length=0),r.push(o))}else s?r.splice(i,1):r.push(o);this.props.onSelectionChange&&this.props.onSelectionChange({event:n,value:r})}},{key:"onItemKeyDown",value:function(e){var t=e.originalEvent.currentTarget;switch(e.originalEvent.which){case 40:var n=this.findNextItem(t);n&&n.focus(),e.originalEvent.preventDefault();break;case 38:var o=this.findPrevItem(t);o&&o.focus(),e.originalEvent.preventDefault();break;case 13:this.onItemClick(e),e.originalEvent.preventDefault()}}},{key:"findNextItem",value:function(e){var n=e.nextElementSibling;return n?t.DomHandler.hasClass(n,"p-picklist-item")?n:this.findNextItem(n):null}},{key:"findPrevItem",value:function(e){var n=e.previousElementSibling;return n?t.DomHandler.hasClass(n,"p-picklist-item")?n:this.findPrevItem(n):null}},{key:"isSelected",value:function(e){return-1!==t.ObjectUtils.findIndexInList(e,this.props.selection,this.props.dataKey)}},{key:"render",value:function(){var e=this,n=null,o=null,i=t.classNames("p-picklist-list-wrapper",this.props.className),s=t.classNames("p-picklist-list",this.props.listClassName);return this.props.header&&(n=r.default.createElement("div",{className:"p-picklist-header"},t.ObjectUtils.getJSXElement(this.props.header,this.props))),this.props.list&&(o=this.props.list.map((function(t,n){return r.default.createElement(C,{key:JSON.stringify(t),value:t,template:e.props.itemTemplate,selected:e.isSelected(t),onClick:e.onItemClick,onKeyDown:e.onItemKeyDown,tabIndex:e.props.tabIndex})}))),r.default.createElement("div",{ref:this.props.forwardRef,className:i},n,r.default.createElement("ul",{className:s,style:this.props.style,role:"listbox","aria-multiselectable":!0},o))}}]),u}(),w=r.default.forwardRef((function(e,t){return r.default.createElement(R,v({forwardRef:t},e))}));function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var K=function(o){p(d,e.Component);var s,c,u=(s=d,c=I(),function(){var e,t=f(s);if(c){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function d(e){var t;return i(this,d),(t=u.call(this,e)).moveUp=t.moveUp.bind(a(t)),t.moveTop=t.moveTop.bind(a(t)),t.moveDown=t.moveDown.bind(a(t)),t.moveBottom=t.moveBottom.bind(a(t)),t}return l(d,[{key:"moveUp",value:function(e){var n=this.props.selection;if(n&&n.length){for(var o=k(this.props.list),r=0;r<n.length;r++){var i=t.ObjectUtils.findIndexInList(n[r],o,this.props.dataKey);if(0===i)break;var s=o[i-1];o[i-1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"up"})}}},{key:"moveTop",value:function(e){var n=this.props.selection;if(n&&n.length){for(var o=k(this.props.list),r=0;r<n.length;r++){var i=t.ObjectUtils.findIndexInList(n[r],o,this.props.dataKey);if(0===i)break;var s=o.splice(i,1)[0];o.unshift(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"top"})}}},{key:"moveDown",value:function(e){var n=this.props.selection;if(n&&n.length){for(var o=k(this.props.list),r=n.length-1;r>=0;r--){var i=t.ObjectUtils.findIndexInList(n[r],o,this.props.dataKey);if(i===o.length-1)break;var s=o[i+1];o[i+1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"down"}),this.movedDown=!0}}},{key:"moveBottom",value:function(e){var n=this.props.selection;if(n&&n.length){for(var o=k(this.props.list),r=n.length-1;r>=0;r--){var i=t.ObjectUtils.findIndexInList(n[r],o,this.props.dataKey);if(i===o.length-1)break;var s=o.splice(i,1)[0];o.push(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"bottom"})}}},{key:"render",value:function(){var e=!this.props.selection.length,o=t.classNames("p-picklist-buttons",this.props.className);return r.default.createElement("div",{className:o},r.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-up",onClick:this.moveUp}),r.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-double-up",onClick:this.moveTop}),r.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-down",onClick:this.moveDown}),r.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-double-down",onClick:this.moveBottom}))}}]),d}();function O(){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(o){p(d,e.Component);var s,c,u=(s=d,c=O(),function(){var e,t=f(s);if(c){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function d(e){var t;return i(this,d),(t=u.call(this,e)).moveRight=t.moveRight.bind(a(t)),t.moveAllRight=t.moveAllRight.bind(a(t)),t.moveLeft=t.moveLeft.bind(a(t)),t.moveAllLeft=t.moveAllLeft.bind(a(t)),t}return l(d,[{key:"moveRight",value:function(e){var n=this.props.sourceSelection;if(n&&n.length){for(var o=k(this.props.target),r=k(this.props.source),i=0;i<n.length;i++){var s=n[i];-1===t.ObjectUtils.findIndexInList(s,o,this.props.dataKey)&&o.push(r.splice(t.ObjectUtils.findIndexInList(s,r,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:r,target:o,direction:"toTarget"})}}},{key:"moveAllRight",value:function(e){if(this.props.source){var t=[].concat(k(this.props.target),k(this.props.source));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:[],target:t,direction:"allToTarget"})}}},{key:"moveLeft",value:function(e){var n=this.props.targetSelection;if(n&&n.length){for(var o=k(this.props.target),r=k(this.props.source),i=0;i<n.length;i++){var s=n[i];-1===t.ObjectUtils.findIndexInList(s,r,this.props.dataKey)&&r.push(o.splice(t.ObjectUtils.findIndexInList(s,o,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:r,target:o,direction:"toSource"})}}},{key:"moveAllLeft",value:function(e){if(this.props.source){var t=[].concat(k(this.props.source),k(this.props.target));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:t,target:[],direction:"allToSource"})}}},{key:"render",value:function(){var e=!this.props.sourceSelection.length,o=!this.props.targetSelection.length,i=!this.props.source.length,s=!this.props.target.length,l=t.classNames("p-picklist-buttons p-picklist-transfer-buttons",this.props.className);return r.default.createElement("div",{className:l},r.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-right",onClick:this.moveRight}),r.default.createElement(n.Button,{disabled:i,type:"button",icon:"pi pi-angle-double-right",onClick:this.moveAllRight}),r.default.createElement(n.Button,{disabled:o,type:"button",icon:"pi pi-angle-left",onClick:this.moveLeft}),r.default.createElement(n.Button,{disabled:s,type:"button",icon:"pi pi-angle-double-left",onClick:this.moveAllLeft}))}}]),d}();function N(){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(n){p(u,e.Component);var o,s,c=(o=u,s=N(),function(){var e,t=f(o);if(s){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return h(this,e)});function u(e){var t;return i(this,u),(t=c.call(this,e)).state={},t.props.onSourceSelectionChange||(t.state.sourceSelection=[]),t.props.onTargetSelectionChange||(t.state.targetSelection=[]),t.onSourceReorder=t.onSourceReorder.bind(a(t)),t.onTargetReorder=t.onTargetReorder.bind(a(t)),t.onTransfer=t.onTransfer.bind(a(t)),t}return l(u,[{key:"getSourceSelection",value:function(){return this.props.onSourceSelectionChange?this.props.sourceSelection:this.state.sourceSelection}},{key:"getTargetSelection",value:function(){return this.props.onTargetSelectionChange?this.props.targetSelection:this.state.targetSelection}},{key:"onSourceReorder",value:function(e){this.handleChange(e,e.value,this.props.target),this.reorderedListElement=this.sourceListElement,this.reorderDirection=e.direction}},{key:"onTargetReorder",value:function(e){this.handleChange(e,this.props.source,e.value),this.reorderedListElement=this.targetListElement,this.reorderDirection=e.direction}},{key:"handleScrollPosition",value:function(e,n){if(e){var o=t.DomHandler.findSingle(e,".p-picklist-list");switch(n){case"up":this.scrollInView(o,-1);break;case"top":o.scrollTop=0;break;case"down":this.scrollInView(o,1);break;case"bottom":o.scrollTop=o.scrollHeight}}}},{key:"handleChange",value:function(e,t,n){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,source:t,target:n})}},{key:"onTransfer",value:function(e){var t=e.originalEvent,n=e.source,o=e.target;switch(e.direction){case"toTarget":this.props.onMoveToTarget&&this.props.onMoveToTarget({originalEvent:t,value:this.getSourceSelection()});break;case"allToTarget":this.props.onMoveAllToTarget&&this.props.onMoveAllToTarget({originalEvent:t,value:this.props.source});break;case"toSource":this.props.onMoveToSource&&this.props.onMoveToSource({originalEvent:t,value:this.getTargetSelection()});break;case"allToSource":this.props.onMoveAllToSource&&this.props.onMoveAllToSource({originalEvent:t,value:this.props.target})}this.onSelectionChange({originalEvent:t,value:[]},"sourceSelection",this.props.onSourceSelectionChange),this.onSelectionChange({originalEvent:t,value:[]},"targetSelection",this.props.onTargetSelectionChange),this.handleChange(e,n,o)}},{key:"scrollInView",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=e.getElementsByClassName("p-highlight");t.DomHandler.scrollInView(e,-1===n?o[0]:o[o.length-1])}},{key:"onSelectionChange",value:function(e,t,n){n?n(e):this.setState(d({},t,e.value)),this.state.sourceSelection&&this.state.sourceSelection.length&&"targetSelection"===t?this.setState({sourceSelection:[]}):this.state.targetSelection&&this.state.targetSelection.length&&"sourceSelection"===t&&this.setState({targetSelection:[]})}},{key:"componentDidUpdate",value:function(){this.reorderedListElement&&(this.handleScrollPosition(this.reorderedListElement,this.reorderDirection),this.reorderedListElement=null,this.reorderDirection=null)}},{key:"render",value:function(){var e=this,n=t.classNames("p-picklist p-component",this.props.className),o=this.getSourceSelection(),i=this.getTargetSelection();return r.default.createElement("div",{id:this.props.id,className:n,style:this.props.style},this.props.showSourceControls&&r.default.createElement(K,{list:this.props.source,selection:o,onReorder:this.onSourceReorder,className:"p-picklist-source-controls",dataKey:this.props.dataKey}),r.default.createElement(w,{ref:function(t){return e.sourceListElement=t},list:this.props.source,selection:o,onSelectionChange:function(t){return e.onSelectionChange(t,"sourceSelection",e.props.onSourceSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.sourceHeader,style:this.props.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),r.default.createElement(x,{onTransfer:this.onTransfer,source:this.props.source,target:this.props.target,sourceSelection:o,targetSelection:i,dataKey:this.props.dataKey}),r.default.createElement(w,{ref:function(t){return e.targetListElement=t},list:this.props.target,selection:i,onSelectionChange:function(t){return e.onSelectionChange(t,"targetSelection",e.props.onTargetSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.targetHeader,style:this.props.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),this.props.showTargetControls&&r.default.createElement(K,{list:this.props.target,selection:i,onReorder:this.onTargetReorder,className:"p-picklist-target-controls",dataKey:this.props.dataKey}))}}]),u}();d(D,"defaultProps",{id:null,source:null,target:null,sourceHeader:null,targetHeader:null,style:null,className:null,sourceStyle:null,targetStyle:null,sourceSelection:null,targetSelection:null,showSourceControls:!0,showTargetControls:!0,metaKeySelection:!0,tabIndex:0,dataKey:null,itemTemplate:null,onChange:null,onMoveToSource:null,onMoveAllToSource:null,onMoveToTarget:null,onMoveAllToTarget:null,onSourceSelectionChange:null,onTargetSelectionChange:null}),exports.PickList=D;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),o=require("primereact/ripple"),n=require("primereact/button");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,o){return t&&l(e.prototype,t),o&&l(e,o),e}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function u(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&&p(e,t)}function h(e){return h="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},h(e)}function f(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function v(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function m(){return m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},m.apply(this,arguments)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function g(e){if(Array.isArray(e))return y(e)}function b(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function S(e,t){if(e){if("string"==typeof e)return y(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?y(e,t):void 0}}function k(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e){return g(e)||b(e)||S(e)||k()}function T(){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 C=function(n){u(h,e.Component);var r,l,p=(r=h,l=T(),function(){var e,t=d(r);if(l){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return f(this,e)});function h(e){var t;return s(this,h),(t=p.call(this,e)).onClick=t.onClick.bind(c(t)),t.onKeyDown=t.onKeyDown.bind(c(t)),t}return a(h,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,value:this.props.value})}},{key:"onKeyDown",value:function(e){this.props.onKeyDown&&this.props.onKeyDown({originalEvent:e,value:this.props.value})}},{key:"render",value:function(){var e=this.props.template?this.props.template(this.props.value):this.props.value,n=t.classNames("p-picklist-item",{"p-highlight":this.props.selected},this.props.className);return i.default.createElement("li",{className:n,onClick:this.onClick,onKeyDown:this.onKeyDown,tabIndex:this.props.tabIndex,role:"option","aria-selected":this.props.selected},e,i.default.createElement(o.Ripple,null))}}]),h}();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}}v(C,"defaultProps",{value:null,className:null,template:null,selected:!1,tabIndex:null,onClick:null,onKeyDown:null});var w=function(o){u(p,e.Component);var n,r,l=(n=p,r=R(),function(){var e,t=d(n);if(r){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return f(this,e)});function p(e){var t;return s(this,p),(t=l.call(this,e)).onItemClick=t.onItemClick.bind(c(t)),t.onItemKeyDown=t.onItemKeyDown.bind(c(t)),t}return a(p,[{key:"onItemClick",value:function(e){var o=e.originalEvent,n=e.value,r=E(this.props.selection),i=t.ObjectUtils.findIndexInList(n,r,this.props.dataKey),s=-1!==i;if(this.props.metaKeySelection){var l=o.metaKey||o.ctrlKey;s&&l?r.splice(i,1):(l||(r.length=0),r.push(n))}else s?r.splice(i,1):r.push(n);this.props.onSelectionChange&&this.props.onSelectionChange({event:o,value:r})}},{key:"onItemKeyDown",value:function(e){var t=e.originalEvent.currentTarget;switch(e.originalEvent.which){case 40:var o=this.findNextItem(t);o&&o.focus(),e.originalEvent.preventDefault();break;case 38:var n=this.findPrevItem(t);n&&n.focus(),e.originalEvent.preventDefault();break;case 13:this.onItemClick(e),e.originalEvent.preventDefault()}}},{key:"findNextItem",value:function(e){var o=e.nextElementSibling;return o?t.DomHandler.hasClass(o,"p-picklist-item")?o:this.findNextItem(o):null}},{key:"findPrevItem",value:function(e){var o=e.previousElementSibling;return o?t.DomHandler.hasClass(o,"p-picklist-item")?o:this.findPrevItem(o):null}},{key:"isSelected",value:function(e){return-1!==t.ObjectUtils.findIndexInList(e,this.props.selection,this.props.dataKey)}},{key:"render",value:function(){var e=this,o=null,n=null,r=t.classNames("p-picklist-list-wrapper",this.props.className),s=t.classNames("p-picklist-list",this.props.listClassName);return this.props.header&&(o=i.default.createElement("div",{className:"p-picklist-header"},t.ObjectUtils.getJSXElement(this.props.header,this.props))),this.props.list&&(n=this.props.list.map((function(t,o){return i.default.createElement(C,{key:JSON.stringify(t),value:t,template:e.props.itemTemplate,selected:e.isSelected(t),onClick:e.onItemClick,onKeyDown:e.onItemKeyDown,tabIndex:e.props.tabIndex})}))),i.default.createElement("div",{ref:this.props.forwardRef,className:r},o,i.default.createElement("ul",{className:s,style:this.props.style,role:"listbox","aria-multiselectable":!0},n))}}]),p}(),I=i.default.forwardRef((function(e,t){return i.default.createElement(w,m({forwardRef:t},e))}));function O(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var K=function(o){u(h,e.Component);var r,l,p=(r=h,l=O(),function(){var e,t=d(r);if(l){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return f(this,e)});function h(e){var t;return s(this,h),(t=p.call(this,e)).moveUp=t.moveUp.bind(c(t)),t.moveTop=t.moveTop.bind(c(t)),t.moveDown=t.moveDown.bind(c(t)),t.moveBottom=t.moveBottom.bind(c(t)),t}return a(h,[{key:"moveUp",value:function(e){var o=this.props.selection;if(o&&o.length){for(var n=E(this.props.list),r=0;r<o.length;r++){var i=t.ObjectUtils.findIndexInList(o[r],n,this.props.dataKey);if(0===i)break;var s=n[i-1];n[i-1]=n[i],n[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:n,direction:"up"})}}},{key:"moveTop",value:function(e){var o=this.props.selection;if(o&&o.length){for(var n=E(this.props.list),r=0;r<o.length;r++){var i=t.ObjectUtils.findIndexInList(o[r],n,this.props.dataKey);if(0===i)break;var s=n.splice(i,1)[0];n.unshift(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:n,direction:"top"})}}},{key:"moveDown",value:function(e){var o=this.props.selection;if(o&&o.length){for(var n=E(this.props.list),r=o.length-1;r>=0;r--){var i=t.ObjectUtils.findIndexInList(o[r],n,this.props.dataKey);if(i===n.length-1)break;var s=n[i+1];n[i+1]=n[i],n[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:n,direction:"down"}),this.movedDown=!0}}},{key:"moveBottom",value:function(e){var o=this.props.selection;if(o&&o.length){for(var n=E(this.props.list),r=o.length-1;r>=0;r--){var i=t.ObjectUtils.findIndexInList(o[r],n,this.props.dataKey);if(i===n.length-1)break;var s=n.splice(i,1)[0];n.push(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:n,direction:"bottom"})}}},{key:"render",value:function(){var e=!this.props.selection.length,o=t.classNames("p-picklist-buttons",this.props.className);return i.default.createElement("div",{className:o},i.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-up",onClick:this.moveUp}),i.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-double-up",onClick:this.moveTop}),i.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-down",onClick:this.moveDown}),i.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-double-down",onClick:this.moveBottom}))}}]),h}();function N(){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(o){u(h,e.Component);var r,l,p=(r=h,l=N(),function(){var e,t=d(r);if(l){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return f(this,e)});function h(e){var t;return s(this,h),(t=p.call(this,e)).moveRight=t.moveRight.bind(c(t)),t.moveAllRight=t.moveAllRight.bind(c(t)),t.moveLeft=t.moveLeft.bind(c(t)),t.moveAllLeft=t.moveAllLeft.bind(c(t)),t}return a(h,[{key:"moveRight",value:function(e){var o=this.props.sourceSelection;if(t.ObjectUtils.isNotEmpty(o)){for(var n=E(this.props.target),r=E(this.props.source),i=0;i<o.length;i++){var s=o[i];-1===t.ObjectUtils.findIndexInList(s,n,this.props.dataKey)&&n.push(r.splice(t.ObjectUtils.findIndexInList(s,r,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:r,target:n,direction:"toTarget"})}}},{key:"moveAllRight",value:function(e){if(this.props.source){var t=[].concat(E(this.props.target),E(this.props.source));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:[],target:t,direction:"allToTarget"})}}},{key:"moveLeft",value:function(e){var o=this.props.targetSelection;if(t.ObjectUtils.isNotEmpty(o)){for(var n=E(this.props.target),r=E(this.props.source),i=0;i<o.length;i++){var s=o[i];-1===t.ObjectUtils.findIndexInList(s,r,this.props.dataKey)&&r.push(n.splice(t.ObjectUtils.findIndexInList(s,n,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:r,target:n,direction:"toSource"})}}},{key:"moveAllLeft",value:function(e){if(this.props.source){var t=[].concat(E(this.props.source),E(this.props.target));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:t,target:[],direction:"allToSource"})}}},{key:"render",value:function(){var e=t.ObjectUtils.isEmpty(this.props.sourceSelection),o=t.ObjectUtils.isEmpty(this.props.targetSelection),r=t.ObjectUtils.isEmpty(this.props.source),s=t.ObjectUtils.isEmpty(this.props.target),l=t.classNames("p-picklist-buttons p-picklist-transfer-buttons",this.props.className);return i.default.createElement("div",{className:l},i.default.createElement(n.Button,{disabled:e,type:"button",icon:"pi pi-angle-right",onClick:this.moveRight}),i.default.createElement(n.Button,{disabled:r,type:"button",icon:"pi pi-angle-double-right",onClick:this.moveAllRight}),i.default.createElement(n.Button,{disabled:o,type:"button",icon:"pi pi-angle-left",onClick:this.moveLeft}),i.default.createElement(n.Button,{disabled:s,type:"button",icon:"pi pi-angle-double-left",onClick:this.moveAllLeft}))}}]),h}();function x(){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(o){u(p,e.Component);var n,r,l=(n=p,r=x(),function(){var e,t=d(n);if(r){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return f(this,e)});function p(e){var t;return s(this,p),(t=l.call(this,e)).state={},t.props.onSourceSelectionChange||(t.state.sourceSelection=[]),t.props.onTargetSelectionChange||(t.state.targetSelection=[]),t.onSourceReorder=t.onSourceReorder.bind(c(t)),t.onTargetReorder=t.onTargetReorder.bind(c(t)),t.onTransfer=t.onTransfer.bind(c(t)),t}return a(p,[{key:"getSourceSelection",value:function(){return this.props.onSourceSelectionChange?this.props.sourceSelection:this.state.sourceSelection}},{key:"getTargetSelection",value:function(){return this.props.onTargetSelectionChange?this.props.targetSelection:this.state.targetSelection}},{key:"onSourceReorder",value:function(e){this.handleChange(e,e.value,this.props.target),this.reorderedListElement=this.sourceListElement,this.reorderDirection=e.direction}},{key:"onTargetReorder",value:function(e){this.handleChange(e,this.props.source,e.value),this.reorderedListElement=this.targetListElement,this.reorderDirection=e.direction}},{key:"handleScrollPosition",value:function(e,o){if(e){var n=t.DomHandler.findSingle(e,".p-picklist-list");switch(o){case"up":this.scrollInView(n,-1);break;case"top":n.scrollTop=0;break;case"down":this.scrollInView(n,1);break;case"bottom":n.scrollTop=n.scrollHeight}}}},{key:"handleChange",value:function(e,t,o){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,source:t,target:o})}},{key:"onTransfer",value:function(e){var t=e.originalEvent,o=e.source,n=e.target;switch(e.direction){case"toTarget":this.props.onMoveToTarget&&this.props.onMoveToTarget({originalEvent:t,value:this.getSourceSelection()});break;case"allToTarget":this.props.onMoveAllToTarget&&this.props.onMoveAllToTarget({originalEvent:t,value:this.props.source});break;case"toSource":this.props.onMoveToSource&&this.props.onMoveToSource({originalEvent:t,value:this.getTargetSelection()});break;case"allToSource":this.props.onMoveAllToSource&&this.props.onMoveAllToSource({originalEvent:t,value:this.props.target})}this.onSelectionChange({originalEvent:t,value:[]},"sourceSelection",this.props.onSourceSelectionChange),this.onSelectionChange({originalEvent:t,value:[]},"targetSelection",this.props.onTargetSelectionChange),this.handleChange(e,o,n)}},{key:"scrollInView",value:function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.getElementsByClassName("p-highlight");t.ObjectUtils.isNotEmpty(n)&&t.DomHandler.scrollInView(e,-1===o?n[0]:n[n.length-1])}},{key:"onSelectionChange",value:function(e,o,n){n?n(e):this.setState(v({},o,e.value)),t.ObjectUtils.isNotEmpty(this.state.sourceSelection)&&"targetSelection"===o?this.setState({sourceSelection:[]}):t.ObjectUtils.isNotEmpty(this.state.targetSelection)&&"sourceSelection"===o&&this.setState({targetSelection:[]})}},{key:"componentDidUpdate",value:function(){this.reorderedListElement&&(this.handleScrollPosition(this.reorderedListElement,this.reorderDirection),this.reorderedListElement=null,this.reorderDirection=null)}},{key:"render",value:function(){var e=this,o=t.classNames("p-picklist p-component",this.props.className),n=this.getSourceSelection(),r=this.getTargetSelection();return i.default.createElement("div",{id:this.props.id,className:o,style:this.props.style},this.props.showSourceControls&&i.default.createElement(K,{list:this.props.source,selection:n,onReorder:this.onSourceReorder,className:"p-picklist-source-controls",dataKey:this.props.dataKey}),i.default.createElement(I,{ref:function(t){return e.sourceListElement=t},list:this.props.source,selection:n,onSelectionChange:function(t){return e.onSelectionChange(t,"sourceSelection",e.props.onSourceSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.sourceHeader,style:this.props.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),i.default.createElement(j,{onTransfer:this.onTransfer,source:this.props.source,target:this.props.target,sourceSelection:n,targetSelection:r,dataKey:this.props.dataKey}),i.default.createElement(I,{ref:function(t){return e.targetListElement=t},list:this.props.target,selection:r,onSelectionChange:function(t){return e.onSelectionChange(t,"targetSelection",e.props.onTargetSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.targetHeader,style:this.props.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),this.props.showTargetControls&&i.default.createElement(K,{list:this.props.target,selection:r,onReorder:this.onTargetReorder,className:"p-picklist-target-controls",dataKey:this.props.dataKey}))}}]),p}();v(D,"defaultProps",{id:null,source:null,target:null,sourceHeader:null,targetHeader:null,style:null,className:null,sourceStyle:null,targetStyle:null,sourceSelection:null,targetSelection:null,showSourceControls:!0,showTargetControls:!0,metaKeySelection:!0,tabIndex:0,dataKey:null,itemTemplate:null,onChange:null,onMoveToSource:null,onMoveAllToSource:null,onMoveToTarget:null,onMoveAllToTarget:null,onSourceSelectionChange:null,onTargetSelectionChange:null}),exports.PickList=D;
|
package/picklist/picklist.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { classNames,
|
|
2
|
+
import { classNames, ObjectUtils, DomHandler } from 'primereact/utils';
|
|
3
|
+
import { Ripple } from 'primereact/ripple';
|
|
3
4
|
import { Button } from 'primereact/button';
|
|
4
5
|
|
|
5
6
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -75,6 +76,8 @@ function _typeof(obj) {
|
|
|
75
76
|
function _possibleConstructorReturn(self, call) {
|
|
76
77
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
77
78
|
return call;
|
|
79
|
+
} else if (call !== void 0) {
|
|
80
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
return _assertThisInitialized(self);
|
|
@@ -586,7 +589,7 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
586
589
|
value: function moveRight(event) {
|
|
587
590
|
var selection = this.props.sourceSelection;
|
|
588
591
|
|
|
589
|
-
if (selection
|
|
592
|
+
if (ObjectUtils.isNotEmpty(selection)) {
|
|
590
593
|
var targetList = _toConsumableArray(this.props.target);
|
|
591
594
|
|
|
592
595
|
var sourceList = _toConsumableArray(this.props.source);
|
|
@@ -631,7 +634,7 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
631
634
|
value: function moveLeft(event) {
|
|
632
635
|
var selection = this.props.targetSelection;
|
|
633
636
|
|
|
634
|
-
if (selection
|
|
637
|
+
if (ObjectUtils.isNotEmpty(selection)) {
|
|
635
638
|
var targetList = _toConsumableArray(this.props.target);
|
|
636
639
|
|
|
637
640
|
var sourceList = _toConsumableArray(this.props.source);
|
|
@@ -674,10 +677,10 @@ var PickListTransferControls = /*#__PURE__*/function (_Component) {
|
|
|
674
677
|
}, {
|
|
675
678
|
key: "render",
|
|
676
679
|
value: function render() {
|
|
677
|
-
var moveRightDisabled =
|
|
678
|
-
var moveLeftDisabled =
|
|
679
|
-
var moveAllRightDisabled =
|
|
680
|
-
var moveAllLeftDisabled =
|
|
680
|
+
var moveRightDisabled = ObjectUtils.isEmpty(this.props.sourceSelection);
|
|
681
|
+
var moveLeftDisabled = ObjectUtils.isEmpty(this.props.targetSelection);
|
|
682
|
+
var moveAllRightDisabled = ObjectUtils.isEmpty(this.props.source);
|
|
683
|
+
var moveAllLeftDisabled = ObjectUtils.isEmpty(this.props.target);
|
|
681
684
|
var className = classNames('p-picklist-buttons p-picklist-transfer-buttons', this.props.className);
|
|
682
685
|
return /*#__PURE__*/React.createElement("div", {
|
|
683
686
|
className: className
|
|
@@ -863,7 +866,10 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
863
866
|
value: function scrollInView(listContainer) {
|
|
864
867
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
865
868
|
var selectedItems = listContainer.getElementsByClassName('p-highlight');
|
|
866
|
-
|
|
869
|
+
|
|
870
|
+
if (ObjectUtils.isNotEmpty(selectedItems)) {
|
|
871
|
+
DomHandler.scrollInView(listContainer, direction === -1 ? selectedItems[0] : selectedItems[selectedItems.length - 1]);
|
|
872
|
+
}
|
|
867
873
|
}
|
|
868
874
|
}, {
|
|
869
875
|
key: "onSelectionChange",
|
|
@@ -874,11 +880,11 @@ var PickList = /*#__PURE__*/function (_Component) {
|
|
|
874
880
|
this.setState(_defineProperty({}, stateKey, e.value));
|
|
875
881
|
}
|
|
876
882
|
|
|
877
|
-
if (
|
|
883
|
+
if (ObjectUtils.isNotEmpty(this.state.sourceSelection) && stateKey === 'targetSelection') {
|
|
878
884
|
this.setState({
|
|
879
885
|
sourceSelection: []
|
|
880
886
|
});
|
|
881
|
-
} else if (
|
|
887
|
+
} else if (ObjectUtils.isNotEmpty(this.state.targetSelection) && stateKey === 'sourceSelection') {
|
|
882
888
|
this.setState({
|
|
883
889
|
targetSelection: []
|
|
884
890
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{Component as t}from"react";import{classNames as o,Ripple as n,ObjectUtils as r,DomHandler as i}from"primereact/core";import{Button as s}from"primereact/button";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),e}function p(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 h(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 f(e){return(f="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 v(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?p(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function S(e){if(Array.isArray(e))return y(e)}function b(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function k(e,t){if(e){if("string"==typeof e)return y(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?y(e,t):void 0}}function T(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e){return S(e)||b(e)||k(e)||T()}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 R=function(r){h(u,t);var i,s,a=(i=u,s=C(),function(){var e,t=d(i);if(s){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function u(e){var t;return l(this,u),(t=a.call(this,e)).onClick=t.onClick.bind(p(t)),t.onKeyDown=t.onKeyDown.bind(p(t)),t}return c(u,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,value:this.props.value})}},{key:"onKeyDown",value:function(e){this.props.onKeyDown&&this.props.onKeyDown({originalEvent:e,value:this.props.value})}},{key:"render",value:function(){var t=this.props.template?this.props.template(this.props.value):this.props.value,r=o("p-picklist-item",{"p-highlight":this.props.selected},this.props.className);return e.createElement("li",{className:r,onClick:this.onClick,onKeyDown:this.onKeyDown,tabIndex:this.props.tabIndex,role:"option","aria-selected":this.props.selected},t,e.createElement(n,null))}}]),u}();function w(){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}}g(R,"defaultProps",{value:null,className:null,template:null,selected:!1,tabIndex:null,onClick:null,onKeyDown:null});var I=function(n){h(f,t);var s,a,u=(s=f,a=w(),function(){var e,t=d(s);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).onItemClick=t.onItemClick.bind(p(t)),t.onItemKeyDown=t.onItemKeyDown.bind(p(t)),t}return c(f,[{key:"onItemClick",value:function(e){var t=e.originalEvent,o=e.value,n=E(this.props.selection),i=r.findIndexInList(o,n,this.props.dataKey),s=-1!==i;if(this.props.metaKeySelection){var l=t.metaKey||t.ctrlKey;s&&l?n.splice(i,1):(l||(n.length=0),n.push(o))}else s?n.splice(i,1):n.push(o);this.props.onSelectionChange&&this.props.onSelectionChange({event:t,value:n})}},{key:"onItemKeyDown",value:function(e){var t=e.originalEvent.currentTarget;switch(e.originalEvent.which){case 40:var o=this.findNextItem(t);o&&o.focus(),e.originalEvent.preventDefault();break;case 38:var n=this.findPrevItem(t);n&&n.focus(),e.originalEvent.preventDefault();break;case 13:this.onItemClick(e),e.originalEvent.preventDefault()}}},{key:"findNextItem",value:function(e){var t=e.nextElementSibling;return t?i.hasClass(t,"p-picklist-item")?t:this.findNextItem(t):null}},{key:"findPrevItem",value:function(e){var t=e.previousElementSibling;return t?i.hasClass(t,"p-picklist-item")?t:this.findPrevItem(t):null}},{key:"isSelected",value:function(e){return-1!==r.findIndexInList(e,this.props.selection,this.props.dataKey)}},{key:"render",value:function(){var t=this,n=null,i=null,s=o("p-picklist-list-wrapper",this.props.className),l=o("p-picklist-list",this.props.listClassName);return this.props.header&&(n=e.createElement("div",{className:"p-picklist-header"},r.getJSXElement(this.props.header,this.props))),this.props.list&&(i=this.props.list.map((function(o,n){return e.createElement(R,{key:JSON.stringify(o),value:o,template:t.props.itemTemplate,selected:t.isSelected(o),onClick:t.onItemClick,onKeyDown:t.onItemKeyDown,tabIndex:t.props.tabIndex})}))),e.createElement("div",{ref:this.props.forwardRef,className:s},n,e.createElement("ul",{className:l,style:this.props.style,role:"listbox","aria-multiselectable":!0},i))}}]),f}(),K=e.forwardRef((function(t,o){return e.createElement(I,m({forwardRef:o},t))}));function x(){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(n){h(f,t);var i,a,u=(i=f,a=x(),function(){var e,t=d(i);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).moveUp=t.moveUp.bind(p(t)),t.moveTop=t.moveTop.bind(p(t)),t.moveDown=t.moveDown.bind(p(t)),t.moveBottom=t.moveBottom.bind(p(t)),t}return c(f,[{key:"moveUp",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=E(this.props.list),n=0;n<t.length;n++){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(0===i)break;var s=o[i-1];o[i-1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"up"})}}},{key:"moveTop",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=E(this.props.list),n=0;n<t.length;n++){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(0===i)break;var s=o.splice(i,1)[0];o.unshift(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"top"})}}},{key:"moveDown",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=E(this.props.list),n=t.length-1;n>=0;n--){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(i===o.length-1)break;var s=o[i+1];o[i+1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"down"}),this.movedDown=!0}}},{key:"moveBottom",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=E(this.props.list),n=t.length-1;n>=0;n--){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(i===o.length-1)break;var s=o.splice(i,1)[0];o.push(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"bottom"})}}},{key:"render",value:function(){var t=!this.props.selection.length,n=o("p-picklist-buttons",this.props.className);return e.createElement("div",{className:n},e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-up",onClick:this.moveUp}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-double-up",onClick:this.moveTop}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-down",onClick:this.moveDown}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-double-down",onClick:this.moveBottom}))}}]),f}();function D(){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 N=function(n){h(f,t);var i,a,u=(i=f,a=D(),function(){var e,t=d(i);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).moveRight=t.moveRight.bind(p(t)),t.moveAllRight=t.moveAllRight.bind(p(t)),t.moveLeft=t.moveLeft.bind(p(t)),t.moveAllLeft=t.moveAllLeft.bind(p(t)),t}return c(f,[{key:"moveRight",value:function(e){var t=this.props.sourceSelection;if(t&&t.length){for(var o=E(this.props.target),n=E(this.props.source),i=0;i<t.length;i++){var s=t[i];-1===r.findIndexInList(s,o,this.props.dataKey)&&o.push(n.splice(r.findIndexInList(s,n,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:n,target:o,direction:"toTarget"})}}},{key:"moveAllRight",value:function(e){if(this.props.source){var t=[].concat(E(this.props.target),E(this.props.source));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:[],target:t,direction:"allToTarget"})}}},{key:"moveLeft",value:function(e){var t=this.props.targetSelection;if(t&&t.length){for(var o=E(this.props.target),n=E(this.props.source),i=0;i<t.length;i++){var s=t[i];-1===r.findIndexInList(s,n,this.props.dataKey)&&n.push(o.splice(r.findIndexInList(s,o,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:n,target:o,direction:"toSource"})}}},{key:"moveAllLeft",value:function(e){if(this.props.source){var t=[].concat(E(this.props.source),E(this.props.target));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:t,target:[],direction:"allToSource"})}}},{key:"render",value:function(){var t=!this.props.sourceSelection.length,n=!this.props.targetSelection.length,r=!this.props.source.length,i=!this.props.target.length,l=o("p-picklist-buttons p-picklist-transfer-buttons",this.props.className);return e.createElement("div",{className:l},e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-right",onClick:this.moveRight}),e.createElement(s,{disabled:r,type:"button",icon:"pi pi-angle-double-right",onClick:this.moveAllRight}),e.createElement(s,{disabled:n,type:"button",icon:"pi pi-angle-left",onClick:this.moveLeft}),e.createElement(s,{disabled:i,type:"button",icon:"pi pi-angle-double-left",onClick:this.moveAllLeft}))}}]),f}();function O(){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 A=function(n){h(u,t);var r,s,a=(r=u,s=O(),function(){var e,t=d(r);if(s){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function u(e){var t;return l(this,u),(t=a.call(this,e)).state={},t.props.onSourceSelectionChange||(t.state.sourceSelection=[]),t.props.onTargetSelectionChange||(t.state.targetSelection=[]),t.onSourceReorder=t.onSourceReorder.bind(p(t)),t.onTargetReorder=t.onTargetReorder.bind(p(t)),t.onTransfer=t.onTransfer.bind(p(t)),t}return c(u,[{key:"getSourceSelection",value:function(){return this.props.onSourceSelectionChange?this.props.sourceSelection:this.state.sourceSelection}},{key:"getTargetSelection",value:function(){return this.props.onTargetSelectionChange?this.props.targetSelection:this.state.targetSelection}},{key:"onSourceReorder",value:function(e){this.handleChange(e,e.value,this.props.target),this.reorderedListElement=this.sourceListElement,this.reorderDirection=e.direction}},{key:"onTargetReorder",value:function(e){this.handleChange(e,this.props.source,e.value),this.reorderedListElement=this.targetListElement,this.reorderDirection=e.direction}},{key:"handleScrollPosition",value:function(e,t){if(e){var o=i.findSingle(e,".p-picklist-list");switch(t){case"up":this.scrollInView(o,-1);break;case"top":o.scrollTop=0;break;case"down":this.scrollInView(o,1);break;case"bottom":o.scrollTop=o.scrollHeight}}}},{key:"handleChange",value:function(e,t,o){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,source:t,target:o})}},{key:"onTransfer",value:function(e){var t=e.originalEvent,o=e.source,n=e.target;switch(e.direction){case"toTarget":this.props.onMoveToTarget&&this.props.onMoveToTarget({originalEvent:t,value:this.getSourceSelection()});break;case"allToTarget":this.props.onMoveAllToTarget&&this.props.onMoveAllToTarget({originalEvent:t,value:this.props.source});break;case"toSource":this.props.onMoveToSource&&this.props.onMoveToSource({originalEvent:t,value:this.getTargetSelection()});break;case"allToSource":this.props.onMoveAllToSource&&this.props.onMoveAllToSource({originalEvent:t,value:this.props.target})}this.onSelectionChange({originalEvent:t,value:[]},"sourceSelection",this.props.onSourceSelectionChange),this.onSelectionChange({originalEvent:t,value:[]},"targetSelection",this.props.onTargetSelectionChange),this.handleChange(e,o,n)}},{key:"scrollInView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=e.getElementsByClassName("p-highlight");i.scrollInView(e,-1===t?o[0]:o[o.length-1])}},{key:"onSelectionChange",value:function(e,t,o){o?o(e):this.setState(g({},t,e.value)),this.state.sourceSelection&&this.state.sourceSelection.length&&"targetSelection"===t?this.setState({sourceSelection:[]}):this.state.targetSelection&&this.state.targetSelection.length&&"sourceSelection"===t&&this.setState({targetSelection:[]})}},{key:"componentDidUpdate",value:function(){this.reorderedListElement&&(this.handleScrollPosition(this.reorderedListElement,this.reorderDirection),this.reorderedListElement=null,this.reorderDirection=null)}},{key:"render",value:function(){var t=this,n=o("p-picklist p-component",this.props.className),r=this.getSourceSelection(),i=this.getTargetSelection();return e.createElement("div",{id:this.props.id,className:n,style:this.props.style},this.props.showSourceControls&&e.createElement(L,{list:this.props.source,selection:r,onReorder:this.onSourceReorder,className:"p-picklist-source-controls",dataKey:this.props.dataKey}),e.createElement(K,{ref:function(e){return t.sourceListElement=e},list:this.props.source,selection:r,onSelectionChange:function(e){return t.onSelectionChange(e,"sourceSelection",t.props.onSourceSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.sourceHeader,style:this.props.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),e.createElement(N,{onTransfer:this.onTransfer,source:this.props.source,target:this.props.target,sourceSelection:r,targetSelection:i,dataKey:this.props.dataKey}),e.createElement(K,{ref:function(e){return t.targetListElement=e},list:this.props.target,selection:i,onSelectionChange:function(e){return t.onSelectionChange(e,"targetSelection",t.props.onTargetSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.targetHeader,style:this.props.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),this.props.showTargetControls&&e.createElement(L,{list:this.props.target,selection:i,onReorder:this.onTargetReorder,className:"p-picklist-target-controls",dataKey:this.props.dataKey}))}}]),u}();g(A,"defaultProps",{id:null,source:null,target:null,sourceHeader:null,targetHeader:null,style:null,className:null,sourceStyle:null,targetStyle:null,sourceSelection:null,targetSelection:null,showSourceControls:!0,showTargetControls:!0,metaKeySelection:!0,tabIndex:0,dataKey:null,itemTemplate:null,onChange:null,onMoveToSource:null,onMoveAllToSource:null,onMoveToTarget:null,onMoveAllToTarget:null,onSourceSelectionChange:null,onTargetSelectionChange:null});export{A as PickList};
|
|
1
|
+
import e,{Component as t}from"react";import{classNames as o,ObjectUtils as r,DomHandler as n}from"primereact/utils";import{Ripple as i}from"primereact/ripple";import{Button as s}from"primereact/button";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,o){return t&&a(e.prototype,t),o&&a(e,o),e}function p(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},u(e,t)}function h(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 f(e){return f="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},f(e)}function v(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function m(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},y.apply(this,arguments)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function b(e){if(Array.isArray(e))return g(e)}function S(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function k(e,t){if(e){if("string"==typeof e)return g(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?g(e,t):void 0}}function E(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e){return b(e)||S(e)||k(e)||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 w=function(r){h(u,t);var n,s,a=(n=u,s=C(),function(){var e,t=d(n);if(s){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function u(e){var t;return l(this,u),(t=a.call(this,e)).onClick=t.onClick.bind(p(t)),t.onKeyDown=t.onKeyDown.bind(p(t)),t}return c(u,[{key:"onClick",value:function(e){this.props.onClick&&this.props.onClick({originalEvent:e,value:this.props.value})}},{key:"onKeyDown",value:function(e){this.props.onKeyDown&&this.props.onKeyDown({originalEvent:e,value:this.props.value})}},{key:"render",value:function(){var t=this.props.template?this.props.template(this.props.value):this.props.value,r=o("p-picklist-item",{"p-highlight":this.props.selected},this.props.className);return e.createElement("li",{className:r,onClick:this.onClick,onKeyDown:this.onKeyDown,tabIndex:this.props.tabIndex,role:"option","aria-selected":this.props.selected},t,e.createElement(i,null))}}]),u}();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}}m(w,"defaultProps",{value:null,className:null,template:null,selected:!1,tabIndex:null,onClick:null,onKeyDown:null});var I=function(i){h(f,t);var s,a,u=(s=f,a=R(),function(){var e,t=d(s);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).onItemClick=t.onItemClick.bind(p(t)),t.onItemKeyDown=t.onItemKeyDown.bind(p(t)),t}return c(f,[{key:"onItemClick",value:function(e){var t=e.originalEvent,o=e.value,n=T(this.props.selection),i=r.findIndexInList(o,n,this.props.dataKey),s=-1!==i;if(this.props.metaKeySelection){var l=t.metaKey||t.ctrlKey;s&&l?n.splice(i,1):(l||(n.length=0),n.push(o))}else s?n.splice(i,1):n.push(o);this.props.onSelectionChange&&this.props.onSelectionChange({event:t,value:n})}},{key:"onItemKeyDown",value:function(e){var t=e.originalEvent.currentTarget;switch(e.originalEvent.which){case 40:var o=this.findNextItem(t);o&&o.focus(),e.originalEvent.preventDefault();break;case 38:var r=this.findPrevItem(t);r&&r.focus(),e.originalEvent.preventDefault();break;case 13:this.onItemClick(e),e.originalEvent.preventDefault()}}},{key:"findNextItem",value:function(e){var t=e.nextElementSibling;return t?n.hasClass(t,"p-picklist-item")?t:this.findNextItem(t):null}},{key:"findPrevItem",value:function(e){var t=e.previousElementSibling;return t?n.hasClass(t,"p-picklist-item")?t:this.findPrevItem(t):null}},{key:"isSelected",value:function(e){return-1!==r.findIndexInList(e,this.props.selection,this.props.dataKey)}},{key:"render",value:function(){var t=this,n=null,i=null,s=o("p-picklist-list-wrapper",this.props.className),l=o("p-picklist-list",this.props.listClassName);return this.props.header&&(n=e.createElement("div",{className:"p-picklist-header"},r.getJSXElement(this.props.header,this.props))),this.props.list&&(i=this.props.list.map((function(o,r){return e.createElement(w,{key:JSON.stringify(o),value:o,template:t.props.itemTemplate,selected:t.isSelected(o),onClick:t.onItemClick,onKeyDown:t.onItemKeyDown,tabIndex:t.props.tabIndex})}))),e.createElement("div",{ref:this.props.forwardRef,className:s},n,e.createElement("ul",{className:l,style:this.props.style,role:"listbox","aria-multiselectable":!0},i))}}]),f}(),K=e.forwardRef((function(t,o){return e.createElement(I,y({forwardRef:o},t))}));function x(){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 N=function(n){h(f,t);var i,a,u=(i=f,a=x(),function(){var e,t=d(i);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).moveUp=t.moveUp.bind(p(t)),t.moveTop=t.moveTop.bind(p(t)),t.moveDown=t.moveDown.bind(p(t)),t.moveBottom=t.moveBottom.bind(p(t)),t}return c(f,[{key:"moveUp",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=T(this.props.list),n=0;n<t.length;n++){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(0===i)break;var s=o[i-1];o[i-1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"up"})}}},{key:"moveTop",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=T(this.props.list),n=0;n<t.length;n++){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(0===i)break;var s=o.splice(i,1)[0];o.unshift(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"top"})}}},{key:"moveDown",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=T(this.props.list),n=t.length-1;n>=0;n--){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(i===o.length-1)break;var s=o[i+1];o[i+1]=o[i],o[i]=s}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"down"}),this.movedDown=!0}}},{key:"moveBottom",value:function(e){var t=this.props.selection;if(t&&t.length){for(var o=T(this.props.list),n=t.length-1;n>=0;n--){var i=r.findIndexInList(t[n],o,this.props.dataKey);if(i===o.length-1)break;var s=o.splice(i,1)[0];o.push(s)}this.props.onReorder&&this.props.onReorder({originalEvent:e,value:o,direction:"bottom"})}}},{key:"render",value:function(){var t=!this.props.selection.length,r=o("p-picklist-buttons",this.props.className);return e.createElement("div",{className:r},e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-up",onClick:this.moveUp}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-double-up",onClick:this.moveTop}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-down",onClick:this.moveDown}),e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-double-down",onClick:this.moveBottom}))}}]),f}();function D(){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(n){h(f,t);var i,a,u=(i=f,a=D(),function(){var e,t=d(i);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).moveRight=t.moveRight.bind(p(t)),t.moveAllRight=t.moveAllRight.bind(p(t)),t.moveLeft=t.moveLeft.bind(p(t)),t.moveAllLeft=t.moveAllLeft.bind(p(t)),t}return c(f,[{key:"moveRight",value:function(e){var t=this.props.sourceSelection;if(r.isNotEmpty(t)){for(var o=T(this.props.target),n=T(this.props.source),i=0;i<t.length;i++){var s=t[i];-1===r.findIndexInList(s,o,this.props.dataKey)&&o.push(n.splice(r.findIndexInList(s,n,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:n,target:o,direction:"toTarget"})}}},{key:"moveAllRight",value:function(e){if(this.props.source){var t=[].concat(T(this.props.target),T(this.props.source));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:[],target:t,direction:"allToTarget"})}}},{key:"moveLeft",value:function(e){var t=this.props.targetSelection;if(r.isNotEmpty(t)){for(var o=T(this.props.target),n=T(this.props.source),i=0;i<t.length;i++){var s=t[i];-1===r.findIndexInList(s,n,this.props.dataKey)&&n.push(o.splice(r.findIndexInList(s,o,this.props.dataKey),1)[0])}this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:n,target:o,direction:"toSource"})}}},{key:"moveAllLeft",value:function(e){if(this.props.source){var t=[].concat(T(this.props.source),T(this.props.target));this.props.onTransfer&&this.props.onTransfer({originalEvent:e,source:t,target:[],direction:"allToSource"})}}},{key:"render",value:function(){var t=r.isEmpty(this.props.sourceSelection),n=r.isEmpty(this.props.targetSelection),i=r.isEmpty(this.props.source),l=r.isEmpty(this.props.target),a=o("p-picklist-buttons p-picklist-transfer-buttons",this.props.className);return e.createElement("div",{className:a},e.createElement(s,{disabled:t,type:"button",icon:"pi pi-angle-right",onClick:this.moveRight}),e.createElement(s,{disabled:i,type:"button",icon:"pi pi-angle-double-right",onClick:this.moveAllRight}),e.createElement(s,{disabled:n,type:"button",icon:"pi pi-angle-left",onClick:this.moveLeft}),e.createElement(s,{disabled:l,type:"button",icon:"pi pi-angle-double-left",onClick:this.moveAllLeft}))}}]),f}();function O(){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 A=function(i){h(f,t);var s,a,u=(s=f,a=O(),function(){var e,t=d(s);if(a){var o=d(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return v(this,e)});function f(e){var t;return l(this,f),(t=u.call(this,e)).state={},t.props.onSourceSelectionChange||(t.state.sourceSelection=[]),t.props.onTargetSelectionChange||(t.state.targetSelection=[]),t.onSourceReorder=t.onSourceReorder.bind(p(t)),t.onTargetReorder=t.onTargetReorder.bind(p(t)),t.onTransfer=t.onTransfer.bind(p(t)),t}return c(f,[{key:"getSourceSelection",value:function(){return this.props.onSourceSelectionChange?this.props.sourceSelection:this.state.sourceSelection}},{key:"getTargetSelection",value:function(){return this.props.onTargetSelectionChange?this.props.targetSelection:this.state.targetSelection}},{key:"onSourceReorder",value:function(e){this.handleChange(e,e.value,this.props.target),this.reorderedListElement=this.sourceListElement,this.reorderDirection=e.direction}},{key:"onTargetReorder",value:function(e){this.handleChange(e,this.props.source,e.value),this.reorderedListElement=this.targetListElement,this.reorderDirection=e.direction}},{key:"handleScrollPosition",value:function(e,t){if(e){var o=n.findSingle(e,".p-picklist-list");switch(t){case"up":this.scrollInView(o,-1);break;case"top":o.scrollTop=0;break;case"down":this.scrollInView(o,1);break;case"bottom":o.scrollTop=o.scrollHeight}}}},{key:"handleChange",value:function(e,t,o){this.props.onChange&&this.props.onChange({originalEvent:e.originalEvent,source:t,target:o})}},{key:"onTransfer",value:function(e){var t=e.originalEvent,o=e.source,r=e.target;switch(e.direction){case"toTarget":this.props.onMoveToTarget&&this.props.onMoveToTarget({originalEvent:t,value:this.getSourceSelection()});break;case"allToTarget":this.props.onMoveAllToTarget&&this.props.onMoveAllToTarget({originalEvent:t,value:this.props.source});break;case"toSource":this.props.onMoveToSource&&this.props.onMoveToSource({originalEvent:t,value:this.getTargetSelection()});break;case"allToSource":this.props.onMoveAllToSource&&this.props.onMoveAllToSource({originalEvent:t,value:this.props.target})}this.onSelectionChange({originalEvent:t,value:[]},"sourceSelection",this.props.onSourceSelectionChange),this.onSelectionChange({originalEvent:t,value:[]},"targetSelection",this.props.onTargetSelectionChange),this.handleChange(e,o,r)}},{key:"scrollInView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=e.getElementsByClassName("p-highlight");r.isNotEmpty(o)&&n.scrollInView(e,-1===t?o[0]:o[o.length-1])}},{key:"onSelectionChange",value:function(e,t,o){o?o(e):this.setState(m({},t,e.value)),r.isNotEmpty(this.state.sourceSelection)&&"targetSelection"===t?this.setState({sourceSelection:[]}):r.isNotEmpty(this.state.targetSelection)&&"sourceSelection"===t&&this.setState({targetSelection:[]})}},{key:"componentDidUpdate",value:function(){this.reorderedListElement&&(this.handleScrollPosition(this.reorderedListElement,this.reorderDirection),this.reorderedListElement=null,this.reorderDirection=null)}},{key:"render",value:function(){var t=this,r=o("p-picklist p-component",this.props.className),n=this.getSourceSelection(),i=this.getTargetSelection();return e.createElement("div",{id:this.props.id,className:r,style:this.props.style},this.props.showSourceControls&&e.createElement(N,{list:this.props.source,selection:n,onReorder:this.onSourceReorder,className:"p-picklist-source-controls",dataKey:this.props.dataKey}),e.createElement(K,{ref:function(e){return t.sourceListElement=e},list:this.props.source,selection:n,onSelectionChange:function(e){return t.onSelectionChange(e,"sourceSelection",t.props.onSourceSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.sourceHeader,style:this.props.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),e.createElement(L,{onTransfer:this.onTransfer,source:this.props.source,target:this.props.target,sourceSelection:n,targetSelection:i,dataKey:this.props.dataKey}),e.createElement(K,{ref:function(e){return t.targetListElement=e},list:this.props.target,selection:i,onSelectionChange:function(e){return t.onSelectionChange(e,"targetSelection",t.props.onTargetSelectionChange)},itemTemplate:this.props.itemTemplate,header:this.props.targetHeader,style:this.props.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:this.props.metaKeySelection,tabIndex:this.props.tabIndex,dataKey:this.props.dataKey}),this.props.showTargetControls&&e.createElement(N,{list:this.props.target,selection:i,onReorder:this.onTargetReorder,className:"p-picklist-target-controls",dataKey:this.props.dataKey}))}}]),f}();m(A,"defaultProps",{id:null,source:null,target:null,sourceHeader:null,targetHeader:null,style:null,className:null,sourceStyle:null,targetStyle:null,sourceSelection:null,targetSelection:null,showSourceControls:!0,showTargetControls:!0,metaKeySelection:!0,tabIndex:0,dataKey:null,itemTemplate:null,onChange:null,onMoveToSource:null,onMoveAllToSource:null,onMoveToTarget:null,onMoveAllToTarget:null,onSourceSelectionChange:null,onTargetSelectionChange:null});export{A as PickList};
|