primereact 8.0.1 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/api.cjs.js +22 -1
- package/api/api.cjs.min.js +1 -1
- package/api/api.esm.js +22 -2
- package/api/api.esm.min.js +1 -1
- package/api/api.js +22 -1
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +42 -24
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +0 -1
- package/autocomplete/autocomplete.esm.js +43 -25
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +42 -24
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/avatar.cjs.js +7 -7
- package/avatar/avatar.cjs.min.js +1 -1
- package/avatar/avatar.d.ts +1 -3
- package/avatar/avatar.esm.js +7 -7
- package/avatar/avatar.esm.min.js +1 -1
- package/avatar/avatar.js +7 -7
- package/avatar/avatar.min.js +1 -1
- package/badge/badge.cjs.js +2 -2
- package/badge/badge.cjs.min.js +1 -1
- package/badge/badge.d.ts +2 -4
- package/badge/badge.esm.js +2 -2
- package/badge/badge.esm.min.js +1 -1
- package/badge/badge.js +2 -2
- package/badge/badge.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +22 -6
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +22 -6
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +22 -6
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/button.cjs.js +1 -1
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +1 -1
- package/button/button.esm.min.js +1 -1
- package/button/button.js +1 -1
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +80 -7
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +7 -5
- package/calendar/calendar.esm.js +80 -7
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +80 -7
- package/calendar/calendar.min.js +1 -1
- package/captcha/captcha.cjs.js +1 -0
- package/captcha/captcha.esm.js +1 -0
- package/captcha/captcha.js +1 -0
- package/card/card.d.ts +1 -4
- package/carousel/carousel.cjs.js +18 -17
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +19 -18
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +19 -18
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +5 -4
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +1 -1
- package/cascadeselect/cascadeselect.esm.js +5 -4
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +5 -4
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/chart.cjs.js +13 -7
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +13 -7
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +13 -7
- package/chart/chart.min.js +1 -1
- package/checkbox/checkbox.cjs.js +1 -2
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.esm.js +2 -3
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +1 -2
- package/checkbox/checkbox.min.js +1 -1
- package/chip/chip.d.ts +1 -3
- package/chips/chips.cjs.js +18 -2
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.d.ts +3 -0
- package/chips/chips.esm.js +19 -3
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +19 -4
- package/chips/chips.min.js +1 -1
- package/column/column.cjs.js +2 -1
- package/column/column.cjs.min.js +1 -1
- package/column/column.d.ts +2 -0
- package/column/column.esm.js +2 -1
- package/column/column.esm.min.js +1 -1
- package/column/column.js +2 -1
- package/column/column.min.js +1 -1
- package/confirmdialog/confirmdialog.d.ts +1 -6
- package/contextmenu/contextmenu.cjs.js +1 -0
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +1 -0
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +1 -0
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +390 -160
- package/core/core.min.js +14 -14
- package/datatable/datatable.cjs.js +68 -27
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +69 -28
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +68 -27
- package/datatable/datatable.min.css +1 -1
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +7 -3
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.d.ts +2 -0
- package/dialog/dialog.esm.js +7 -3
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +7 -3
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +32 -25
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +1 -1
- package/dropdown/dropdown.esm.js +32 -25
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +32 -25
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +11 -3
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +11 -3
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +11 -3
- package/editor/editor.min.js +1 -1
- package/fileupload/fileupload.cjs.js +46 -19
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.d.ts +1 -0
- package/fileupload/fileupload.esm.js +46 -19
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +46 -19
- package/fileupload/fileupload.min.js +1 -1
- package/fullcalendar/fullcalendar.cjs.js +1 -0
- package/fullcalendar/fullcalendar.esm.js +1 -0
- package/fullcalendar/fullcalendar.js +1 -0
- package/hooks/hooks.cjs.js +48 -2
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.d.ts +3 -1
- package/hooks/hooks.esm.js +47 -3
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +48 -2
- package/hooks/hooks.min.js +1 -1
- package/image/image.cjs.js +5 -5
- package/image/image.cjs.min.js +1 -1
- package/image/image.d.ts +1 -3
- package/image/image.esm.js +5 -5
- package/image/image.esm.min.js +1 -1
- package/image/image.js +5 -5
- package/image/image.min.css +1 -1
- package/image/image.min.js +1 -1
- package/inplace/inplace.cjs.js +1 -1
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +1 -1
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +1 -1
- package/inplace/inplace.min.js +1 -1
- package/inputmask/inputmask.cjs.js +7 -5
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.d.ts +0 -1
- package/inputmask/inputmask.esm.js +7 -5
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +7 -5
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +37 -4
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +38 -5
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +37 -4
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +1 -1
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.d.ts +1 -1
- package/inputswitch/inputswitch.esm.js +2 -2
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +1 -1
- package/inputswitch/inputswitch.min.css +1 -1
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/inputtext.min.css +1 -1
- package/listbox/listbox.cjs.js +84 -15
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.d.ts +2 -1
- package/listbox/listbox.esm.js +84 -15
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +85 -17
- package/listbox/listbox.min.js +1 -1
- package/megamenu/megamenu.cjs.js +32 -12
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.d.ts +7 -0
- package/megamenu/megamenu.esm.js +32 -12
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +32 -12
- package/megamenu/megamenu.min.css +1 -1
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +8 -4
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +8 -4
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +8 -4
- package/mention/mention.min.js +1 -1
- package/menubar/menubar.cjs.js +1 -0
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +1 -0
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +1 -0
- package/menubar/menubar.min.js +1 -1
- package/menuitem/menuitem.d.ts +2 -0
- package/message/message.d.ts +1 -1
- package/messages/messages.cjs.js +3 -2
- package/messages/messages.cjs.min.js +1 -1
- package/messages/messages.d.ts +1 -1
- package/messages/messages.esm.js +3 -2
- package/messages/messages.esm.min.js +1 -1
- package/messages/messages.js +3 -2
- package/messages/messages.min.js +1 -1
- package/multiselect/multiselect.cjs.js +22 -15
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +1 -1
- package/multiselect/multiselect.esm.js +22 -15
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +22 -15
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +30 -24
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.d.ts +2 -4
- package/multistatecheckbox/multistatecheckbox.esm.js +30 -24
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +31 -26
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +2 -2
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +2 -2
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +2 -2
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +4 -2
- package/paginator/paginator.cjs.js +26 -24
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +26 -24
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +26 -25
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +16 -0
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +17 -1
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +16 -0
- package/panelmenu/panelmenu.min.js +1 -1
- package/picklist/picklist.cjs.js +175 -16
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.d.ts +34 -1
- package/picklist/picklist.esm.js +175 -16
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +176 -18
- package/picklist/picklist.min.css +1 -1
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +1262 -495
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +1260 -496
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +1262 -495
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.cjs.js +1 -2
- package/progressbar/progressbar.cjs.min.js +1 -1
- package/progressbar/progressbar.esm.js +1 -2
- package/progressbar/progressbar.esm.min.js +1 -1
- package/progressbar/progressbar.js +1 -2
- package/progressbar/progressbar.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +6 -6
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.d.ts +0 -1
- package/radiobutton/radiobutton.esm.js +7 -7
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +6 -6
- package/radiobutton/radiobutton.min.js +1 -1
- package/resources/primereact.css +266 -208
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +20 -7
- package/resources/themes/arya-green/theme.css +20 -7
- package/resources/themes/arya-orange/theme.css +20 -7
- package/resources/themes/arya-purple/theme.css +20 -7
- package/resources/themes/bootstrap4-dark-blue/theme.css +20 -7
- package/resources/themes/bootstrap4-dark-purple/theme.css +20 -7
- package/resources/themes/bootstrap4-light-blue/theme.css +19 -6
- package/resources/themes/bootstrap4-light-purple/theme.css +19 -6
- package/resources/themes/fluent-light/theme.css +20 -7
- package/resources/themes/lara-dark-blue/theme.css +20 -7
- package/resources/themes/lara-dark-indigo/theme.css +20 -7
- package/resources/themes/lara-dark-purple/theme.css +20 -7
- package/resources/themes/lara-dark-teal/theme.css +20 -7
- package/resources/themes/lara-light-blue/theme.css +20 -7
- package/resources/themes/lara-light-indigo/theme.css +20 -7
- package/resources/themes/lara-light-purple/theme.css +20 -7
- package/resources/themes/lara-light-teal/theme.css +20 -7
- package/resources/themes/luna-amber/theme.css +20 -7
- package/resources/themes/luna-blue/theme.css +20 -7
- package/resources/themes/luna-green/theme.css +20 -7
- package/resources/themes/luna-pink/theme.css +20 -7
- package/resources/themes/md-dark-deeppurple/theme.css +20 -7
- package/resources/themes/md-dark-indigo/theme.css +20 -7
- package/resources/themes/md-light-deeppurple/theme.css +20 -7
- package/resources/themes/md-light-indigo/theme.css +20 -7
- package/resources/themes/mdc-dark-deeppurple/theme.css +20 -7
- package/resources/themes/mdc-dark-indigo/theme.css +20 -7
- package/resources/themes/mdc-light-deeppurple/theme.css +20 -7
- package/resources/themes/mdc-light-indigo/theme.css +20 -7
- package/resources/themes/nova/theme.css +20 -7
- package/resources/themes/nova-accent/theme.css +20 -7
- package/resources/themes/nova-alt/theme.css +20 -7
- package/resources/themes/rhea/theme.css +20 -7
- package/resources/themes/saga-blue/theme.css +20 -7
- package/resources/themes/saga-green/theme.css +20 -7
- package/resources/themes/saga-orange/theme.css +20 -7
- package/resources/themes/saga-purple/theme.css +20 -7
- package/resources/themes/tailwind-light/theme.css +20 -7
- package/resources/themes/vela-blue/theme.css +20 -7
- package/resources/themes/vela-green/theme.css +20 -7
- package/resources/themes/vela-orange/theme.css +20 -7
- package/resources/themes/vela-purple/theme.css +20 -7
- package/selectbutton/selectbutton.cjs.js +2 -6
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.d.ts +1 -1
- package/selectbutton/selectbutton.esm.js +2 -6
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +2 -6
- package/selectbutton/selectbutton.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +39 -7
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +39 -7
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +39 -7
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.cjs.js +6 -3
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.d.ts +1 -1
- package/slider/slider.esm.js +6 -3
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +6 -3
- package/slider/slider.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +16 -9
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.d.ts +4 -0
- package/splitbutton/splitbutton.esm.js +16 -9
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +16 -9
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.cjs.js +15 -7
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +16 -8
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +15 -7
- package/splitter/splitter.min.js +1 -1
- package/steps/steps.cjs.js +1 -0
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +1 -0
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +1 -0
- package/steps/steps.min.js +1 -1
- package/styleclass/styleclass.cjs.js +26 -21
- package/styleclass/styleclass.cjs.min.js +1 -1
- package/styleclass/styleclass.d.ts +1 -1
- package/styleclass/styleclass.esm.js +26 -21
- package/styleclass/styleclass.esm.min.js +1 -1
- package/styleclass/styleclass.js +26 -21
- package/styleclass/styleclass.min.js +1 -1
- package/tag/tag.d.ts +1 -1
- package/terminal/terminal.cjs.js +1 -1
- package/terminal/terminal.cjs.min.js +1 -1
- package/terminal/terminal.esm.js +2 -2
- package/terminal/terminal.esm.min.js +1 -1
- package/terminal/terminal.js +1 -1
- package/terminal/terminal.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +3 -1
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +3 -1
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +3 -1
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/toast/toast.cjs.js +30 -35
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.d.ts +2 -1
- package/toast/toast.esm.js +30 -35
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +30 -35
- package/toast/toast.min.css +1 -1
- package/toast/toast.min.js +1 -1
- package/tooltip/tooltip.cjs.js +28 -22
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +28 -22
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +28 -22
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +9 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +9 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +9 -1
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +2 -2
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +2 -2
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +2 -2
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +11 -1
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.d.ts +3 -3
- package/treetable/treetable.esm.js +11 -1
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +11 -1
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +25 -23
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.d.ts +2 -4
- package/tristatecheckbox/tristatecheckbox.esm.js +25 -23
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +26 -25
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/utils.cjs.js +21 -5
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.esm.js +21 -5
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +21 -5
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +154 -65
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +12 -0
- package/virtualscroller/virtualscroller.esm.js +156 -67
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +154 -65
- package/virtualscroller/virtualscroller.min.css +1 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +252 -66
package/picklist/picklist.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { FilterService } from 'primereact/api';
|
|
2
3
|
import { useUpdateEffect } from 'primereact/hooks';
|
|
3
4
|
import { classNames, ObjectUtils, DomHandler } from 'primereact/utils';
|
|
4
5
|
import { Button } from 'primereact/button';
|
|
@@ -357,6 +358,23 @@ var PickListSubList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(fun
|
|
|
357
358
|
return ObjectUtils.findIndexInList(item, props.selection, props.dataKey) !== -1;
|
|
358
359
|
};
|
|
359
360
|
|
|
361
|
+
var onFilter = function onFilter(event) {
|
|
362
|
+
if (props.onFilter) {
|
|
363
|
+
props.onFilter({
|
|
364
|
+
originalEvent: event,
|
|
365
|
+
value: event.target.value,
|
|
366
|
+
type: props.type
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
var onFilterInputKeyDown = function onFilterInputKeyDown(event) {
|
|
372
|
+
//enter
|
|
373
|
+
if (event.which === 13) {
|
|
374
|
+
event.preventDefault();
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
360
378
|
React.useImperativeHandle(ref, function () {
|
|
361
379
|
return {
|
|
362
380
|
listElementRef: listElementRef
|
|
@@ -393,6 +411,44 @@ var PickListSubList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(fun
|
|
|
393
411
|
return null;
|
|
394
412
|
};
|
|
395
413
|
|
|
414
|
+
var createFilter = function createFilter() {
|
|
415
|
+
if (props.showFilter) {
|
|
416
|
+
var content = /*#__PURE__*/React.createElement("div", {
|
|
417
|
+
className: "p-picklist-filter"
|
|
418
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
419
|
+
type: "text",
|
|
420
|
+
value: props.filterValue,
|
|
421
|
+
onChange: onFilter,
|
|
422
|
+
onKeyDown: onFilterInputKeyDown,
|
|
423
|
+
placeholder: props.placeholder,
|
|
424
|
+
className: "p-picklist-filter-input p-inputtext p-component"
|
|
425
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
426
|
+
className: "p-picklist-filter-icon pi pi-search"
|
|
427
|
+
}));
|
|
428
|
+
|
|
429
|
+
if (props.filterTemplate) {
|
|
430
|
+
var defaultContentOptions = {
|
|
431
|
+
className: 'p-picklist-filter',
|
|
432
|
+
inputProps: {
|
|
433
|
+
className: 'p-picklist-filter-input p-inputtext p-component',
|
|
434
|
+
onChange: onFilter,
|
|
435
|
+
onKeyDown: onFilterInputKeyDown
|
|
436
|
+
},
|
|
437
|
+
iconClassName: 'p-picklist-filter-icon pi pi-search',
|
|
438
|
+
element: content,
|
|
439
|
+
props: props
|
|
440
|
+
};
|
|
441
|
+
content = ObjectUtils.getJSXElement(props.filterTemplate, defaultContentOptions);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
445
|
+
className: "p-picklist-filter-container"
|
|
446
|
+
}, content);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return null;
|
|
450
|
+
};
|
|
451
|
+
|
|
396
452
|
var createList = function createList() {
|
|
397
453
|
var items = createItems();
|
|
398
454
|
var className = classNames('p-picklist-list', props.listClassName);
|
|
@@ -406,19 +462,20 @@ var PickListSubList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(fun
|
|
|
406
462
|
|
|
407
463
|
var className = classNames('p-picklist-list-wrapper', props.className);
|
|
408
464
|
var header = createHeader();
|
|
465
|
+
var filter = createFilter();
|
|
409
466
|
var list = createList();
|
|
410
467
|
return /*#__PURE__*/React.createElement("div", {
|
|
411
468
|
ref: listElementRef,
|
|
412
469
|
className: className
|
|
413
|
-
}, header, list);
|
|
470
|
+
}, header, filter, list);
|
|
414
471
|
}));
|
|
415
472
|
PickListSubList.displayName = 'PickListSubList';
|
|
416
473
|
|
|
417
474
|
var PickListTransferControls = /*#__PURE__*/React.memo(function (props) {
|
|
418
|
-
var moveRightDisabled = ObjectUtils.isEmpty(props.sourceSelection);
|
|
419
|
-
var moveLeftDisabled = ObjectUtils.isEmpty(props.targetSelection);
|
|
420
|
-
var moveAllRightDisabled = ObjectUtils.isEmpty(props.
|
|
421
|
-
var moveAllLeftDisabled = ObjectUtils.isEmpty(props.
|
|
475
|
+
var moveRightDisabled = ObjectUtils.isEmpty(props.sourceSelection) || ObjectUtils.isEmpty(props.visibleSourceList);
|
|
476
|
+
var moveLeftDisabled = ObjectUtils.isEmpty(props.targetSelection) || ObjectUtils.isEmpty(props.visibleTargetList);
|
|
477
|
+
var moveAllRightDisabled = ObjectUtils.isEmpty(props.visibleSourceList);
|
|
478
|
+
var moveAllLeftDisabled = ObjectUtils.isEmpty(props.visibleTargetList);
|
|
422
479
|
|
|
423
480
|
var moveRight = function moveRight(event) {
|
|
424
481
|
var selection = props.sourceSelection;
|
|
@@ -449,8 +506,12 @@ var PickListTransferControls = /*#__PURE__*/React.memo(function (props) {
|
|
|
449
506
|
|
|
450
507
|
var moveAllRight = function moveAllRight(event) {
|
|
451
508
|
if (props.source) {
|
|
452
|
-
var targetList = [].concat(_toConsumableArray(props.target), _toConsumableArray(props.
|
|
453
|
-
var sourceList =
|
|
509
|
+
var targetList = [].concat(_toConsumableArray(props.target), _toConsumableArray(props.visibleSourceList));
|
|
510
|
+
var sourceList = props.source.filter(function (s) {
|
|
511
|
+
return !props.visibleSourceList.some(function (vs) {
|
|
512
|
+
return vs === s;
|
|
513
|
+
});
|
|
514
|
+
});
|
|
454
515
|
|
|
455
516
|
if (props.onTransfer) {
|
|
456
517
|
props.onTransfer({
|
|
@@ -492,8 +553,12 @@ var PickListTransferControls = /*#__PURE__*/React.memo(function (props) {
|
|
|
492
553
|
|
|
493
554
|
var moveAllLeft = function moveAllLeft(event) {
|
|
494
555
|
if (props.source) {
|
|
495
|
-
var sourceList = [].concat(_toConsumableArray(props.source), _toConsumableArray(props.
|
|
496
|
-
var targetList =
|
|
556
|
+
var sourceList = [].concat(_toConsumableArray(props.source), _toConsumableArray(props.visibleTargetList));
|
|
557
|
+
var targetList = props.target.filter(function (t) {
|
|
558
|
+
return !props.visibleTargetList.some(function (vt) {
|
|
559
|
+
return vt === t;
|
|
560
|
+
});
|
|
561
|
+
});
|
|
497
562
|
|
|
498
563
|
if (props.onTransfer) {
|
|
499
564
|
props.onTransfer({
|
|
@@ -544,12 +609,27 @@ var PickList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (
|
|
|
544
609
|
targetSelectionState = _React$useState4[0],
|
|
545
610
|
setTargetSelectionState = _React$useState4[1];
|
|
546
611
|
|
|
612
|
+
var _React$useState5 = React.useState(''),
|
|
613
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
614
|
+
sourceFilterValueState = _React$useState6[0],
|
|
615
|
+
setSourceFilterValueState = _React$useState6[1];
|
|
616
|
+
|
|
617
|
+
var _React$useState7 = React.useState(''),
|
|
618
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
619
|
+
targetFilterValueState = _React$useState8[0],
|
|
620
|
+
setTargetFilterValueState = _React$useState8[1];
|
|
621
|
+
|
|
547
622
|
var sourceListElementRef = React.useRef(null);
|
|
548
623
|
var targetListElementRef = React.useRef(null);
|
|
549
624
|
var reorderedListElementRef = React.useRef(null);
|
|
550
625
|
var reorderDirection = React.useRef(null);
|
|
551
626
|
var sourceSelection = props.onSourceSelectionChange ? props.sourceSelection : sourceSelectionState;
|
|
552
627
|
var targetSelection = props.onTargetSelectionChange ? props.targetSelection : targetSelectionState;
|
|
628
|
+
var sourceFilteredValue = props.onSourceFilterChange ? props.sourceFilterValue : sourceFilterValueState;
|
|
629
|
+
var targetFilteredValue = props.onTargetFilterChange ? props.targetFilterValue : targetFilterValueState;
|
|
630
|
+
var hasFilterBy = ObjectUtils.isNotEmpty(props.filterBy);
|
|
631
|
+
var showSourceFilter = hasFilterBy && props.showSourceFilter;
|
|
632
|
+
var showTargetFilter = hasFilterBy && props.showTargetFilter;
|
|
553
633
|
|
|
554
634
|
var onSourceReorder = function onSourceReorder(event) {
|
|
555
635
|
handleChange(event, event.value, props.target);
|
|
@@ -684,6 +764,52 @@ var PickList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (
|
|
|
684
764
|
}
|
|
685
765
|
};
|
|
686
766
|
|
|
767
|
+
var onFilter = function onFilter(event) {
|
|
768
|
+
var originalEvent = event.originalEvent,
|
|
769
|
+
value = event.value,
|
|
770
|
+
type = event.type;
|
|
771
|
+
|
|
772
|
+
var _ref = type === 'source' ? [setSourceFilterValueState, props.onSourceFilterChange] : [setTargetFilterValueState, props.onTargetFilterChange],
|
|
773
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
774
|
+
setFilterState = _ref2[0],
|
|
775
|
+
onFilterChange = _ref2[1];
|
|
776
|
+
|
|
777
|
+
if (onFilterChange) {
|
|
778
|
+
onFilterChange({
|
|
779
|
+
originalEvent: originalEvent,
|
|
780
|
+
value: value
|
|
781
|
+
});
|
|
782
|
+
} else {
|
|
783
|
+
setFilterState(value);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
var getVisibleList = function getVisibleList(list, type) {
|
|
788
|
+
var _ref3 = type === 'source' ? [sourceFilteredValue, filterSource] : [targetFilteredValue, filterTarget],
|
|
789
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
790
|
+
filteredValue = _ref4[0],
|
|
791
|
+
filterCallback = _ref4[1];
|
|
792
|
+
|
|
793
|
+
return hasFilterBy && ObjectUtils.isNotEmpty(filteredValue) ? filterCallback(filteredValue) : list;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
var filterSource = function filterSource() {
|
|
797
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
798
|
+
var filteredValue = value.trim().toLocaleLowerCase(props.filterLocale);
|
|
799
|
+
return filter(props.source, filteredValue);
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
var filterTarget = function filterTarget() {
|
|
803
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
804
|
+
var filteredValue = value.trim().toLocaleLowerCase(props.filterLocale);
|
|
805
|
+
return filter(props.target, filteredValue);
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
var filter = function filter(list, filterValue) {
|
|
809
|
+
var searchFields = hasFilterBy ? props.filterBy.split(',') : [];
|
|
810
|
+
return FilterService.filter(list, searchFields, filterValue, props.filterMatchMode, props.filterLocale);
|
|
811
|
+
};
|
|
812
|
+
|
|
687
813
|
useUpdateEffect(function () {
|
|
688
814
|
if (reorderedListElementRef.current) {
|
|
689
815
|
handleScrollPosition(reorderedListElementRef.current, reorderDirection.current);
|
|
@@ -693,6 +819,10 @@ var PickList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (
|
|
|
693
819
|
});
|
|
694
820
|
var otherProps = ObjectUtils.findDiffKeys(props, PickList.defaultProps);
|
|
695
821
|
var className = classNames('p-picklist p-component', props.className);
|
|
822
|
+
var sourceItemTemplate = props.sourceItemTemplate ? props.sourceItemTemplate : props.itemTemplate;
|
|
823
|
+
var targetItemTemplate = props.targetItemTemplate ? props.targetItemTemplate : props.itemTemplate;
|
|
824
|
+
var sourceList = getVisibleList(props.source, 'source');
|
|
825
|
+
var targetList = getVisibleList(props.target, 'target');
|
|
696
826
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
697
827
|
id: props.id,
|
|
698
828
|
className: className,
|
|
@@ -705,41 +835,55 @@ var PickList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (
|
|
|
705
835
|
dataKey: props.dataKey
|
|
706
836
|
}), /*#__PURE__*/React.createElement(PickListSubList, {
|
|
707
837
|
ref: sourceListElementRef,
|
|
708
|
-
|
|
838
|
+
type: "source",
|
|
839
|
+
list: sourceList,
|
|
709
840
|
selection: sourceSelection,
|
|
710
841
|
onSelectionChange: function onSelectionChange(e) {
|
|
711
842
|
return _onSelectionChange(e, 'sourceSelection', props.onSourceSelectionChange);
|
|
712
843
|
},
|
|
713
|
-
itemTemplate:
|
|
844
|
+
itemTemplate: sourceItemTemplate,
|
|
714
845
|
header: props.sourceHeader,
|
|
715
846
|
style: props.sourceStyle,
|
|
716
847
|
className: "p-picklist-source-wrapper",
|
|
717
848
|
listClassName: "p-picklist-source",
|
|
718
849
|
metaKeySelection: props.metaKeySelection,
|
|
719
850
|
tabIndex: props.tabIndex,
|
|
720
|
-
dataKey: props.dataKey
|
|
851
|
+
dataKey: props.dataKey,
|
|
852
|
+
filterValue: sourceFilteredValue,
|
|
853
|
+
onFilter: onFilter,
|
|
854
|
+
showFilter: showSourceFilter,
|
|
855
|
+
placeholder: props.sourceFilterPlaceholder,
|
|
856
|
+
template: props.sourceFilterTemplate
|
|
721
857
|
}), /*#__PURE__*/React.createElement(PickListTransferControls, {
|
|
722
858
|
onTransfer: onTransfer,
|
|
723
859
|
source: props.source,
|
|
860
|
+
visibleSourceList: sourceList,
|
|
724
861
|
target: props.target,
|
|
862
|
+
visibleTargetList: targetList,
|
|
725
863
|
sourceSelection: sourceSelection,
|
|
726
864
|
targetSelection: targetSelection,
|
|
727
865
|
dataKey: props.dataKey
|
|
728
866
|
}), /*#__PURE__*/React.createElement(PickListSubList, {
|
|
729
867
|
ref: targetListElementRef,
|
|
730
|
-
|
|
868
|
+
type: "target",
|
|
869
|
+
list: targetList,
|
|
731
870
|
selection: targetSelection,
|
|
732
871
|
onSelectionChange: function onSelectionChange(e) {
|
|
733
872
|
return _onSelectionChange(e, 'targetSelection', props.onTargetSelectionChange);
|
|
734
873
|
},
|
|
735
|
-
itemTemplate:
|
|
874
|
+
itemTemplate: targetItemTemplate,
|
|
736
875
|
header: props.targetHeader,
|
|
737
876
|
style: props.targetStyle,
|
|
738
877
|
className: "p-picklist-target-wrapper",
|
|
739
878
|
listClassName: "p-picklist-target",
|
|
740
879
|
metaKeySelection: props.metaKeySelection,
|
|
741
880
|
tabIndex: props.tabIndex,
|
|
742
|
-
dataKey: props.dataKey
|
|
881
|
+
dataKey: props.dataKey,
|
|
882
|
+
filterValue: targetFilteredValue,
|
|
883
|
+
onFilter: onFilter,
|
|
884
|
+
showFilter: showTargetFilter,
|
|
885
|
+
placeholder: props.targetFilterPlaceholder,
|
|
886
|
+
template: props.targetFilterTemplate
|
|
743
887
|
}), props.showTargetControls && /*#__PURE__*/React.createElement(PickListControls, {
|
|
744
888
|
list: props.target,
|
|
745
889
|
selection: targetSelection,
|
|
@@ -765,16 +909,31 @@ PickList.defaultProps = {
|
|
|
765
909
|
showSourceControls: true,
|
|
766
910
|
showTargetControls: true,
|
|
767
911
|
metaKeySelection: true,
|
|
912
|
+
filterBy: null,
|
|
913
|
+
filterMatchMode: 'contains',
|
|
914
|
+
filterLocale: undefined,
|
|
915
|
+
sourceFilterValue: null,
|
|
916
|
+
targetFilterValue: null,
|
|
917
|
+
showSourceFilter: true,
|
|
918
|
+
showTargetFilter: true,
|
|
919
|
+
sourceFilterPlaceholder: null,
|
|
920
|
+
targetFilterPlaceholder: null,
|
|
921
|
+
sourceFilterTemplate: null,
|
|
922
|
+
targetFilterTemplate: null,
|
|
768
923
|
tabIndex: 0,
|
|
769
924
|
dataKey: null,
|
|
770
925
|
itemTemplate: null,
|
|
926
|
+
sourceItemTemplate: null,
|
|
927
|
+
targetItemTemplate: null,
|
|
771
928
|
onChange: null,
|
|
772
929
|
onMoveToSource: null,
|
|
773
930
|
onMoveAllToSource: null,
|
|
774
931
|
onMoveToTarget: null,
|
|
775
932
|
onMoveAllToTarget: null,
|
|
776
933
|
onSourceSelectionChange: null,
|
|
777
|
-
onTargetSelectionChange: null
|
|
934
|
+
onTargetSelectionChange: null,
|
|
935
|
+
onSourceFilterChange: null,
|
|
936
|
+
onTargetFilterChange: null
|
|
778
937
|
};
|
|
779
938
|
|
|
780
939
|
export { PickList };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useUpdateEffect as t}from"primereact/hooks";import{classNames as n,ObjectUtils as r,DomHandler as a}from"primereact/utils";import{Button as o}from"primereact/button";import{Ripple as l}from"primereact/ripple";function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function c(e){if(Array.isArray(e))return e}function s(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e,t){if(e){if("string"==typeof e)return u(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)?u(e,t):void 0}}function d(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){return c(e)||s(e,t)||p(e,t)||d()}function m(e){if(Array.isArray(e))return u(e)}function g(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(){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 y(e){return m(e)||g(e)||p(e)||v()}var h=e.memo((function(t){var a=!t.selection.length,l=n("p-picklist-buttons",t.className);return e.createElement("div",{className:l},e.createElement(o,{disabled:a,type:"button",icon:"pi pi-angle-up",onClick:function(e){var n=t.selection;if(n&&n.length){for(var a=y(t.list),o=0;o<n.length;o++){var l=r.findIndexInList(n[o],a,t.dataKey);if(0===l)break;var i=a[l-1];a[l-1]=a[l],a[l]=i}t.onReorder&&t.onReorder({originalEvent:e,value:a,direction:"up"})}}}),e.createElement(o,{disabled:a,type:"button",icon:"pi pi-angle-double-up",onClick:function(e){var n=t.selection;if(n&&n.length){for(var a=y(t.list),o=0;o<n.length;o++){var l=r.findIndexInList(n[o],a,t.dataKey);if(0===l)break;var i=a.splice(l,1)[0];a.unshift(i)}t.onReorder&&t.onReorder({originalEvent:e,value:a,direction:"top"})}}}),e.createElement(o,{disabled:a,type:"button",icon:"pi pi-angle-down",onClick:function(e){var n=t.selection;if(n&&n.length){for(var a=y(t.list),o=n.length-1;o>=0;o--){var l=r.findIndexInList(n[o],a,t.dataKey);if(l===a.length-1)break;var i=a[l+1];a[l+1]=a[l],a[l]=i}t.onReorder&&t.onReorder({originalEvent:e,value:a,direction:"down"})}}}),e.createElement(o,{disabled:a,type:"button",icon:"pi pi-angle-double-down",onClick:function(e){var n=t.selection;if(n&&n.length){for(var a=y(t.list),o=n.length-1;o>=0;o--){var l=r.findIndexInList(n[o],a,t.dataKey);if(l===a.length-1)break;var i=a.splice(l,1)[0];a.push(i)}t.onReorder&&t.onReorder({originalEvent:e,value:a,direction:"bottom"})}}}))}));h.displayName="PickListControls";var S=e.memo((function(t){var r=t.template?t.template(t.value):t.value,a=n("p-picklist-item",{"p-highlight":t.selected},t.className);return e.createElement("li",{className:a,onClick:function(e){t.onClick&&t.onClick({originalEvent:e,value:t.value})},onKeyDown:function(e){t.onKeyDown&&t.onKeyDown({originalEvent:e,value:t.value})},tabIndex:t.tabIndex,role:"option","aria-selected":t.selected},r,e.createElement(l,null))}));S.displayName="PickListItem";var b=e.memo(e.forwardRef((function(t,o){var l=e.useRef(null),i=function(e){var n=e.originalEvent,a=e.value,o=y(t.selection),l=r.findIndexInList(a,o,t.dataKey),i=-1!==l;if(t.metaKeySelection){var c=n.metaKey||n.ctrlKey;i&&c?o.splice(l,1):(c||(o.length=0),o.push(a))}else i?o.splice(l,1):o.push(a);t.onSelectionChange&&t.onSelectionChange({event:n,value:o})},c=function(e){var t=e.originalEvent,n=t.currentTarget;switch(t.which){case 40:var r=s(n);r&&r.focus(),t.preventDefault();break;case 38:var a=u(n);a&&a.focus(),t.preventDefault();break;case 13:i(e),t.preventDefault()}},s=function e(t){var n=t.nextElementSibling;return n?a.hasClass(n,"p-picklist-item")?n:e(n):null},u=function e(t){var n=t.previousElementSibling;return n?a.hasClass(n,"p-picklist-item")?n:e(n):null},p=function(e){return-1!==r.findIndexInList(e,t.selection,t.dataKey)};e.useImperativeHandle(o,(function(){return{listElementRef:l}}));var d=n("p-picklist-list-wrapper",t.className),f=t.header?e.createElement("div",{className:"p-picklist-header"},r.getJSXElement(t.header,t)):null,m=function(){var r=t.list?t.list.map((function(n){var r=JSON.stringify(n),a=p(n);return e.createElement(S,{key:r,value:n,template:t.itemTemplate,selected:a,onClick:i,onKeyDown:c,tabIndex:t.tabIndex})})):null,a=n("p-picklist-list",t.listClassName);return e.createElement("ul",{className:a,style:t.style,role:"listbox","aria-multiselectable":!0},r)}();return e.createElement("div",{ref:l,className:d},f,m)})));b.displayName="PickListSubList";var E=e.memo((function(t){var a=r.isEmpty(t.sourceSelection),l=r.isEmpty(t.targetSelection),i=r.isEmpty(t.source),c=r.isEmpty(t.target),s=n("p-picklist-buttons p-picklist-transfer-buttons",t.className);return e.createElement("div",{className:s},e.createElement(o,{disabled:a,type:"button",icon:"pi pi-angle-right",onClick:function(e){var n=t.sourceSelection;if(r.isNotEmpty(n)){for(var a=y(t.target),o=y(t.source),l=0;l<n.length;l++){var i=n[l];-1===r.findIndexInList(i,a,t.dataKey)&&a.push(o.splice(r.findIndexInList(i,o,t.dataKey),1)[0])}t.onTransfer&&t.onTransfer({originalEvent:e,source:o,target:a,direction:"toTarget"})}}}),e.createElement(o,{disabled:i,type:"button",icon:"pi pi-angle-double-right",onClick:function(e){if(t.source){var n=[].concat(y(t.target),y(t.source));t.onTransfer&&t.onTransfer({originalEvent:e,source:[],target:n,direction:"allToTarget"})}}}),e.createElement(o,{disabled:l,type:"button",icon:"pi pi-angle-left",onClick:function(e){var n=t.targetSelection;if(r.isNotEmpty(n)){for(var a=y(t.target),o=y(t.source),l=0;l<n.length;l++){var i=n[l];-1===r.findIndexInList(i,o,t.dataKey)&&o.push(a.splice(r.findIndexInList(i,a,t.dataKey),1)[0])}t.onTransfer&&t.onTransfer({originalEvent:e,source:o,target:a,direction:"toSource"})}}}),e.createElement(o,{disabled:c,type:"button",icon:"pi pi-angle-double-left",onClick:function(e){if(t.source){var n=[].concat(y(t.source),y(t.target));t.onTransfer&&t.onTransfer({originalEvent:e,source:n,target:[],direction:"allToSource"})}}}))}));E.displayName="PickListTransferControls";var T=e.memo(e.forwardRef((function(o,l){var c=f(e.useState([]),2),s=c[0],u=c[1],p=f(e.useState([]),2),d=p[0],m=p[1],g=e.useRef(null),v=e.useRef(null),y=e.useRef(null),S=e.useRef(null),k=o.onSourceSelectionChange?o.sourceSelection:s,C=o.onTargetSelectionChange?o.targetSelection:d,I=function(e,t){if(e){var n=a.findSingle(e,".p-picklist-list");switch(t){case"up":N(n,-1);break;case"top":n.scrollTop=0;break;case"down":N(n,1);break;case"bottom":setTimeout((function(){return n.scrollTop=n.scrollHeight}),100)}}},K=function(e,t,n){o.onChange&&o.onChange({originalEvent:e.originalEvent,source:t,target:n})},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.getElementsByClassName("p-highlight");r.isNotEmpty(n)&&a.scrollInView(e,-1===t?n[0]:n[n.length-1])},w=function(e,t,n){n?n(e):"sourceSelection"===t?u(e.value):m(e.value),r.isNotEmpty(k)&&"targetSelection"===t?u([]):r.isNotEmpty(C)&&"sourceSelection"===t&&m([])};t((function(){y.current&&(I(y.current,S.current),y.current=null,S.current=null)}));var x=r.findDiffKeys(o,T.defaultProps),R=n("p-picklist p-component",o.className);return e.createElement("div",i({id:o.id,className:R,style:o.style},x),o.showSourceControls&&e.createElement(h,{list:o.source,selection:k,onReorder:function(e){K(e,e.value,o.target),y.current=g.current.listElementRef.current,S.current=e.direction},className:"p-picklist-source-controls",dataKey:o.dataKey}),e.createElement(b,{ref:g,list:o.source,selection:k,onSelectionChange:function(e){return w(e,"sourceSelection",o.onSourceSelectionChange)},itemTemplate:o.itemTemplate,header:o.sourceHeader,style:o.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:o.metaKeySelection,tabIndex:o.tabIndex,dataKey:o.dataKey}),e.createElement(E,{onTransfer:function(e){var t=e.originalEvent,n=e.source,r=e.target;switch(e.direction){case"toTarget":o.onMoveToTarget&&o.onMoveToTarget({originalEvent:t,value:k});break;case"allToTarget":o.onMoveAllToTarget&&o.onMoveAllToTarget({originalEvent:t,value:o.source});break;case"toSource":o.onMoveToSource&&o.onMoveToSource({originalEvent:t,value:C});break;case"allToSource":o.onMoveAllToSource&&o.onMoveAllToSource({originalEvent:t,value:o.target})}w({originalEvent:t,value:[]},"sourceSelection",o.onSourceSelectionChange),w({originalEvent:t,value:[]},"targetSelection",o.onTargetSelectionChange),K(e,n,r)},source:o.source,target:o.target,sourceSelection:k,targetSelection:C,dataKey:o.dataKey}),e.createElement(b,{ref:v,list:o.target,selection:C,onSelectionChange:function(e){return w(e,"targetSelection",o.onTargetSelectionChange)},itemTemplate:o.itemTemplate,header:o.targetHeader,style:o.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:o.metaKeySelection,tabIndex:o.tabIndex,dataKey:o.dataKey}),o.showTargetControls&&e.createElement(h,{list:o.target,selection:C,onReorder:function(e){K(e,o.source,e.value),y.current=v.current.listElementRef.current,S.current=e.direction},className:"p-picklist-target-controls",dataKey:o.dataKey}))})));T.displayName="PickList",T.defaultProps={__TYPE:"PickList",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{T as PickList};
|
|
1
|
+
import*as e from"react";import{FilterService as t}from"primereact/api";import{useUpdateEffect as n}from"primereact/hooks";import{classNames as r,ObjectUtils as l,DomHandler as i}from"primereact/utils";import{Button as a}from"primereact/button";import{Ripple as o}from"primereact/ripple";function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function s(e){if(Array.isArray(e))return e}function u(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,l,i=[],a=!0,o=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){o=!0,l=e}finally{try{a||null==n.return||n.return()}finally{if(o)throw l}}return i}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}function f(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(e,t){return s(e)||u(e,t)||m(e,t)||f()}function d(e){if(Array.isArray(e))return p(e)}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function y(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e){return d(e)||v(e)||m(e)||y()}var S=e.memo((function(t){var n=!t.selection.length,i=r("p-picklist-buttons",t.className);return e.createElement("div",{className:i},e.createElement(a,{disabled:n,type:"button",icon:"pi pi-angle-up",onClick:function(e){var n=t.selection;if(n&&n.length){for(var r=h(t.list),i=0;i<n.length;i++){var a=l.findIndexInList(n[i],r,t.dataKey);if(0===a)break;var o=r[a-1];r[a-1]=r[a],r[a]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"up"})}}}),e.createElement(a,{disabled:n,type:"button",icon:"pi pi-angle-double-up",onClick:function(e){var n=t.selection;if(n&&n.length){for(var r=h(t.list),i=0;i<n.length;i++){var a=l.findIndexInList(n[i],r,t.dataKey);if(0===a)break;var o=r.splice(a,1)[0];r.unshift(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"top"})}}}),e.createElement(a,{disabled:n,type:"button",icon:"pi pi-angle-down",onClick:function(e){var n=t.selection;if(n&&n.length){for(var r=h(t.list),i=n.length-1;i>=0;i--){var a=l.findIndexInList(n[i],r,t.dataKey);if(a===r.length-1)break;var o=r[a+1];r[a+1]=r[a],r[a]=o}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"down"})}}}),e.createElement(a,{disabled:n,type:"button",icon:"pi pi-angle-double-down",onClick:function(e){var n=t.selection;if(n&&n.length){for(var r=h(t.list),i=n.length-1;i>=0;i--){var a=l.findIndexInList(n[i],r,t.dataKey);if(a===r.length-1)break;var o=r.splice(a,1)[0];r.push(o)}t.onReorder&&t.onReorder({originalEvent:e,value:r,direction:"bottom"})}}}))}));S.displayName="PickListControls";var b=e.memo((function(t){var n=t.template?t.template(t.value):t.value,l=r("p-picklist-item",{"p-highlight":t.selected},t.className);return e.createElement("li",{className:l,onClick:function(e){t.onClick&&t.onClick({originalEvent:e,value:t.value})},onKeyDown:function(e){t.onKeyDown&&t.onKeyDown({originalEvent:e,value:t.value})},tabIndex:t.tabIndex,role:"option","aria-selected":t.selected},n,e.createElement(o,null))}));b.displayName="PickListItem";var T=e.memo(e.forwardRef((function(t,n){var a=e.useRef(null),o=function(e){var n=e.originalEvent,r=e.value,i=h(t.selection),a=l.findIndexInList(r,i,t.dataKey),o=-1!==a;if(t.metaKeySelection){var c=n.metaKey||n.ctrlKey;o&&c?i.splice(a,1):(c||(i.length=0),i.push(r))}else o?i.splice(a,1):i.push(r);t.onSelectionChange&&t.onSelectionChange({event:n,value:i})},c=function(e){var t=e.originalEvent,n=t.currentTarget;switch(t.which){case 40:var r=s(n);r&&r.focus(),t.preventDefault();break;case 38:var l=u(n);l&&l.focus(),t.preventDefault();break;case 13:o(e),t.preventDefault()}},s=function e(t){var n=t.nextElementSibling;return n?i.hasClass(n,"p-picklist-item")?n:e(n):null},u=function e(t){var n=t.previousElementSibling;return n?i.hasClass(n,"p-picklist-item")?n:e(n):null},p=function(e){return-1!==l.findIndexInList(e,t.selection,t.dataKey)},m=function(e){t.onFilter&&t.onFilter({originalEvent:e,value:e.target.value,type:t.type})},f=function(e){13===e.which&&e.preventDefault()};e.useImperativeHandle(n,(function(){return{listElementRef:a}}));var g=r("p-picklist-list-wrapper",t.className),d=t.header?e.createElement("div",{className:"p-picklist-header"},l.getJSXElement(t.header,t)):null,v=function(){if(t.showFilter){var n=e.createElement("div",{className:"p-picklist-filter"},e.createElement("input",{type:"text",value:t.filterValue,onChange:m,onKeyDown:f,placeholder:t.placeholder,className:"p-picklist-filter-input p-inputtext p-component"}),e.createElement("span",{className:"p-picklist-filter-icon pi pi-search"}));if(t.filterTemplate)n=l.getJSXElement(t.filterTemplate,{className:"p-picklist-filter",inputProps:{className:"p-picklist-filter-input p-inputtext p-component",onChange:m,onKeyDown:f},iconClassName:"p-picklist-filter-icon pi pi-search",element:n,props:t});return e.createElement("div",{className:"p-picklist-filter-container"},n)}return null}(),y=function(){var n=t.list?t.list.map((function(n){var r=JSON.stringify(n),l=p(n);return e.createElement(b,{key:r,value:n,template:t.itemTemplate,selected:l,onClick:o,onKeyDown:c,tabIndex:t.tabIndex})})):null,l=r("p-picklist-list",t.listClassName);return e.createElement("ul",{className:l,style:t.style,role:"listbox","aria-multiselectable":!0},n)}();return e.createElement("div",{ref:a,className:g},d,v,y)})));T.displayName="PickListSubList";var E=e.memo((function(t){var n=l.isEmpty(t.sourceSelection)||l.isEmpty(t.visibleSourceList),i=l.isEmpty(t.targetSelection)||l.isEmpty(t.visibleTargetList),o=l.isEmpty(t.visibleSourceList),c=l.isEmpty(t.visibleTargetList),s=r("p-picklist-buttons p-picklist-transfer-buttons",t.className);return e.createElement("div",{className:s},e.createElement(a,{disabled:n,type:"button",icon:"pi pi-angle-right",onClick:function(e){var n=t.sourceSelection;if(l.isNotEmpty(n)){for(var r=h(t.target),i=h(t.source),a=0;a<n.length;a++){var o=n[a];-1===l.findIndexInList(o,r,t.dataKey)&&r.push(i.splice(l.findIndexInList(o,i,t.dataKey),1)[0])}t.onTransfer&&t.onTransfer({originalEvent:e,source:i,target:r,direction:"toTarget"})}}}),e.createElement(a,{disabled:o,type:"button",icon:"pi pi-angle-double-right",onClick:function(e){if(t.source){var n=[].concat(h(t.target),h(t.visibleSourceList)),r=t.source.filter((function(e){return!t.visibleSourceList.some((function(t){return t===e}))}));t.onTransfer&&t.onTransfer({originalEvent:e,source:r,target:n,direction:"allToTarget"})}}}),e.createElement(a,{disabled:i,type:"button",icon:"pi pi-angle-left",onClick:function(e){var n=t.targetSelection;if(l.isNotEmpty(n)){for(var r=h(t.target),i=h(t.source),a=0;a<n.length;a++){var o=n[a];-1===l.findIndexInList(o,i,t.dataKey)&&i.push(r.splice(l.findIndexInList(o,r,t.dataKey),1)[0])}t.onTransfer&&t.onTransfer({originalEvent:e,source:i,target:r,direction:"toSource"})}}}),e.createElement(a,{disabled:c,type:"button",icon:"pi pi-angle-double-left",onClick:function(e){if(t.source){var n=[].concat(h(t.source),h(t.visibleTargetList)),r=t.target.filter((function(e){return!t.visibleTargetList.some((function(t){return t===e}))}));t.onTransfer&&t.onTransfer({originalEvent:e,source:n,target:r,direction:"allToSource"})}}}))}));E.displayName="PickListTransferControls";var k=e.memo(e.forwardRef((function(a,o){var s=g(e.useState([]),2),u=s[0],p=s[1],m=g(e.useState([]),2),f=m[0],d=m[1],v=g(e.useState(""),2),y=v[0],h=v[1],b=g(e.useState(""),2),C=b[0],I=b[1],w=e.useRef(null),N=e.useRef(null),K=e.useRef(null),L=e.useRef(null),F=a.onSourceSelectionChange?a.sourceSelection:u,x=a.onTargetSelectionChange?a.targetSelection:f,R=a.onSourceFilterChange?a.sourceFilterValue:y,M=a.onTargetFilterChange?a.targetFilterValue:C,A=l.isNotEmpty(a.filterBy),P=A&&a.showSourceFilter,D=A&&a.showTargetFilter,V=function(e,t){if(e){var n=i.findSingle(e,".p-picklist-list");switch(t){case"up":H(n,-1);break;case"top":n.scrollTop=0;break;case"down":H(n,1);break;case"bottom":setTimeout((function(){return n.scrollTop=n.scrollHeight}),100)}}},j=function(e,t,n){a.onChange&&a.onChange({originalEvent:e.originalEvent,source:t,target:n})},H=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=e.getElementsByClassName("p-highlight");l.isNotEmpty(n)&&i.scrollInView(e,-1===t?n[0]:n[n.length-1])},O=function(e,t,n){n?n(e):"sourceSelection"===t?p(e.value):d(e.value),l.isNotEmpty(F)&&"targetSelection"===t?p([]):l.isNotEmpty(x)&&"sourceSelection"===t&&d([])},B=function(e){var t=e.originalEvent,n=e.value,r=g("source"===e.type?[h,a.onSourceFilterChange]:[I,a.onTargetFilterChange],2),l=r[0],i=r[1];i?i({originalEvent:t,value:n}):l(n)},J=function(e,t){var n=g("source"===t?[R,X]:[M,_],2),r=n[0],i=n[1];return A&&l.isNotEmpty(r)?i(r):e},X=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.trim().toLocaleLowerCase(a.filterLocale);return U(a.source,t)},_=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.trim().toLocaleLowerCase(a.filterLocale);return U(a.target,t)},U=function(e,n){var r=A?a.filterBy.split(","):[];return t.filter(e,r,n,a.filterMatchMode,a.filterLocale)};n((function(){K.current&&(V(K.current,L.current),K.current=null,L.current=null)}));var Y=l.findDiffKeys(a,k.defaultProps),$=r("p-picklist p-component",a.className),q=a.sourceItemTemplate?a.sourceItemTemplate:a.itemTemplate,z=a.targetItemTemplate?a.targetItemTemplate:a.itemTemplate,G=J(a.source,"source"),Q=J(a.target,"target");return e.createElement("div",c({id:a.id,className:$,style:a.style},Y),a.showSourceControls&&e.createElement(S,{list:a.source,selection:F,onReorder:function(e){j(e,e.value,a.target),K.current=w.current.listElementRef.current,L.current=e.direction},className:"p-picklist-source-controls",dataKey:a.dataKey}),e.createElement(T,{ref:w,type:"source",list:G,selection:F,onSelectionChange:function(e){return O(e,"sourceSelection",a.onSourceSelectionChange)},itemTemplate:q,header:a.sourceHeader,style:a.sourceStyle,className:"p-picklist-source-wrapper",listClassName:"p-picklist-source",metaKeySelection:a.metaKeySelection,tabIndex:a.tabIndex,dataKey:a.dataKey,filterValue:R,onFilter:B,showFilter:P,placeholder:a.sourceFilterPlaceholder,template:a.sourceFilterTemplate}),e.createElement(E,{onTransfer:function(e){var t=e.originalEvent,n=e.source,r=e.target;switch(e.direction){case"toTarget":a.onMoveToTarget&&a.onMoveToTarget({originalEvent:t,value:F});break;case"allToTarget":a.onMoveAllToTarget&&a.onMoveAllToTarget({originalEvent:t,value:a.source});break;case"toSource":a.onMoveToSource&&a.onMoveToSource({originalEvent:t,value:x});break;case"allToSource":a.onMoveAllToSource&&a.onMoveAllToSource({originalEvent:t,value:a.target})}O({originalEvent:t,value:[]},"sourceSelection",a.onSourceSelectionChange),O({originalEvent:t,value:[]},"targetSelection",a.onTargetSelectionChange),j(e,n,r)},source:a.source,visibleSourceList:G,target:a.target,visibleTargetList:Q,sourceSelection:F,targetSelection:x,dataKey:a.dataKey}),e.createElement(T,{ref:N,type:"target",list:Q,selection:x,onSelectionChange:function(e){return O(e,"targetSelection",a.onTargetSelectionChange)},itemTemplate:z,header:a.targetHeader,style:a.targetStyle,className:"p-picklist-target-wrapper",listClassName:"p-picklist-target",metaKeySelection:a.metaKeySelection,tabIndex:a.tabIndex,dataKey:a.dataKey,filterValue:M,onFilter:B,showFilter:D,placeholder:a.targetFilterPlaceholder,template:a.targetFilterTemplate}),a.showTargetControls&&e.createElement(S,{list:a.target,selection:x,onReorder:function(e){j(e,a.source,e.value),K.current=N.current.listElementRef.current,L.current=e.direction},className:"p-picklist-target-controls",dataKey:a.dataKey}))})));k.displayName="PickList",k.defaultProps={__TYPE:"PickList",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,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,sourceFilterValue:null,targetFilterValue:null,showSourceFilter:!0,showTargetFilter:!0,sourceFilterPlaceholder:null,targetFilterPlaceholder:null,sourceFilterTemplate:null,targetFilterTemplate:null,tabIndex:0,dataKey:null,itemTemplate:null,sourceItemTemplate:null,targetItemTemplate:null,onChange:null,onMoveToSource:null,onMoveAllToSource:null,onMoveToTarget:null,onMoveAllToTarget:null,onSourceSelectionChange:null,onTargetSelectionChange:null,onSourceFilterChange:null,onTargetFilterChange:null};export{k as PickList};
|