primereact 10.5.0 → 10.5.2
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 +94 -92
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +231 -13
- package/api/api.esm.js +94 -92
- package/api/api.esm.min.js +1 -1
- package/api/api.js +94 -92
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +91 -48
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +6 -1
- package/autocomplete/autocomplete.esm.js +91 -48
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +91 -48
- package/autocomplete/autocomplete.min.js +1 -1
- package/blockui/blockui.cjs.js +13 -13
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +13 -13
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +13 -13
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +4 -3
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +4 -3
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +4 -3
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/button.cjs.js +2 -3
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +2 -3
- package/button/button.esm.min.js +1 -1
- package/button/button.js +2 -3
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +30 -11
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +9 -0
- package/calendar/calendar.esm.js +30 -11
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +30 -11
- package/calendar/calendar.min.js +1 -1
- package/carousel/carousel.cjs.js +17 -15
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +4 -2
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +17 -15
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +28 -14
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +5 -0
- package/cascadeselect/cascadeselect.esm.js +28 -14
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +28 -14
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/checkbox/checkbox.cjs.js +72 -156
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.d.ts +10 -34
- package/checkbox/checkbox.esm.js +72 -156
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +72 -156
- package/checkbox/checkbox.min.js +1 -1
- package/chips/chips.cjs.js +25 -12
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.d.ts +6 -1
- package/chips/chips.esm.js +25 -12
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +25 -12
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +5 -5
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +4 -4
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +5 -5
- package/colorpicker/colorpicker.min.js +1 -1
- package/componentbase/componentbase.cjs.js +4 -6
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.js +5 -7
- package/componentbase/componentbase.esm.min.js +1 -1
- package/componentbase/componentbase.js +4 -6
- package/componentbase/componentbase.min.js +1 -1
- package/confirmdialog/confirmdialog.cjs.js +7 -2
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +7 -2
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +8 -3
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/confirmpopup/confirmpopup.cjs.js +5 -5
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +5 -5
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +5 -5
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +4 -3
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +4 -3
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +4 -3
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +2773 -20019
- package/core/core.min.js +41 -41
- package/datatable/datatable.cjs.js +134 -115
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +11 -3
- package/datatable/datatable.esm.js +134 -115
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +134 -115
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +16 -13
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +4 -1
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +17 -15
- package/dataview/dataview.min.js +1 -1
- package/dialog/dialog.cjs.js +6 -6
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +6 -6
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +6 -6
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +123 -53
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.d.ts +41 -0
- package/dropdown/dropdown.esm.js +123 -53
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +123 -55
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +125 -54
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +125 -54
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +125 -54
- package/editor/editor.min.js +1 -1
- package/galleria/galleria.cjs.js +22 -19
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +4 -1
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +23 -20
- package/galleria/galleria.min.js +1 -1
- package/hooks/hooks.cjs.js +115 -72
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.esm.js +116 -73
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +115 -72
- package/hooks/hooks.min.js +1 -1
- package/icons/arrowdown/index.cjs.js +2 -642
- package/icons/arrowdown/index.cjs.min.js +1 -1
- package/icons/arrowdown/index.esm.js +2 -642
- package/icons/arrowdown/index.esm.min.js +1 -1
- package/icons/arrowdown/index.js +2 -642
- package/icons/arrowdown/index.min.js +1 -1
- package/icons/arrowup/index.cjs.js +2 -642
- package/icons/arrowup/index.cjs.min.js +1 -1
- package/icons/arrowup/index.esm.js +2 -642
- package/icons/arrowup/index.esm.min.js +1 -1
- package/icons/arrowup/index.js +2 -642
- package/icons/arrowup/index.min.js +1 -1
- package/icons/ban/index.cjs.js +2 -642
- package/icons/ban/index.cjs.min.js +1 -1
- package/icons/ban/index.esm.js +2 -642
- package/icons/ban/index.esm.min.js +1 -1
- package/icons/ban/index.js +2 -642
- package/icons/ban/index.min.js +1 -1
- package/icons/blank/index.cjs.js +62 -0
- package/icons/blank/index.cjs.min.js +1 -0
- package/icons/blank/index.d.ts +19 -0
- package/icons/blank/index.esm.js +38 -0
- package/icons/blank/index.esm.min.js +1 -0
- package/icons/blank/index.js +65 -0
- package/icons/blank/index.min.js +1 -0
- package/icons/blank/package.json +7 -0
- package/icons/download/index.cjs.js +2 -642
- package/icons/download/index.cjs.min.js +1 -1
- package/icons/download/index.esm.js +2 -642
- package/icons/download/index.esm.min.js +1 -1
- package/icons/download/index.js +2 -642
- package/icons/download/index.min.js +1 -1
- package/icons/exclamationtriangle/index.cjs.js +2 -642
- package/icons/exclamationtriangle/index.cjs.min.js +1 -1
- package/icons/exclamationtriangle/index.esm.js +2 -642
- package/icons/exclamationtriangle/index.esm.min.js +1 -1
- package/icons/exclamationtriangle/index.js +2 -642
- package/icons/exclamationtriangle/index.min.js +1 -1
- package/icons/eyeslash/index.cjs.js +2 -642
- package/icons/eyeslash/index.cjs.min.js +1 -1
- package/icons/eyeslash/index.esm.js +2 -642
- package/icons/eyeslash/index.esm.min.js +1 -1
- package/icons/eyeslash/index.js +2 -642
- package/icons/eyeslash/index.min.js +1 -1
- package/icons/filter/index.cjs.js +2 -642
- package/icons/filter/index.cjs.min.js +1 -1
- package/icons/filter/index.esm.js +2 -642
- package/icons/filter/index.esm.min.js +1 -1
- package/icons/filter/index.js +2 -642
- package/icons/filter/index.min.js +1 -1
- package/icons/filterslash/index.cjs.js +2 -642
- package/icons/filterslash/index.cjs.min.js +1 -1
- package/icons/filterslash/index.esm.js +2 -642
- package/icons/filterslash/index.esm.min.js +1 -1
- package/icons/filterslash/index.js +2 -642
- package/icons/filterslash/index.min.js +1 -1
- package/icons/infocircle/index.cjs.js +2 -642
- package/icons/infocircle/index.cjs.min.js +1 -1
- package/icons/infocircle/index.esm.js +2 -642
- package/icons/infocircle/index.esm.min.js +1 -1
- package/icons/infocircle/index.js +2 -642
- package/icons/infocircle/index.min.js +1 -1
- package/icons/pencil/index.cjs.js +2 -642
- package/icons/pencil/index.cjs.min.js +1 -1
- package/icons/pencil/index.esm.js +2 -642
- package/icons/pencil/index.esm.min.js +1 -1
- package/icons/pencil/index.js +2 -642
- package/icons/pencil/index.min.js +1 -1
- package/icons/plus/index.cjs.js +2 -642
- package/icons/plus/index.cjs.min.js +1 -1
- package/icons/plus/index.esm.js +2 -642
- package/icons/plus/index.esm.min.js +1 -1
- package/icons/plus/index.js +2 -642
- package/icons/plus/index.min.js +1 -1
- package/icons/refresh/index.cjs.js +2 -642
- package/icons/refresh/index.cjs.min.js +1 -1
- package/icons/refresh/index.esm.js +2 -642
- package/icons/refresh/index.esm.min.js +1 -1
- package/icons/refresh/index.js +2 -642
- package/icons/refresh/index.min.js +1 -1
- package/icons/search/index.cjs.js +2 -642
- package/icons/search/index.cjs.min.js +1 -1
- package/icons/search/index.esm.js +2 -642
- package/icons/search/index.esm.min.js +1 -1
- package/icons/search/index.js +2 -642
- package/icons/search/index.min.js +1 -1
- package/icons/searchminus/index.cjs.js +2 -642
- package/icons/searchminus/index.cjs.min.js +1 -1
- package/icons/searchminus/index.esm.js +2 -642
- package/icons/searchminus/index.esm.min.js +1 -1
- package/icons/searchminus/index.js +2 -642
- package/icons/searchminus/index.min.js +1 -1
- package/icons/searchplus/index.cjs.js +2 -642
- package/icons/searchplus/index.cjs.min.js +1 -1
- package/icons/searchplus/index.esm.js +2 -642
- package/icons/searchplus/index.esm.min.js +1 -1
- package/icons/searchplus/index.js +2 -642
- package/icons/searchplus/index.min.js +1 -1
- package/icons/sortalt/index.cjs.js +2 -642
- package/icons/sortalt/index.cjs.min.js +1 -1
- package/icons/sortalt/index.esm.js +2 -642
- package/icons/sortalt/index.esm.min.js +1 -1
- package/icons/sortalt/index.js +2 -642
- package/icons/sortalt/index.min.js +1 -1
- package/icons/sortamountdown/index.cjs.js +2 -642
- package/icons/sortamountdown/index.cjs.min.js +1 -1
- package/icons/sortamountdown/index.esm.js +2 -642
- package/icons/sortamountdown/index.esm.min.js +1 -1
- package/icons/sortamountdown/index.js +2 -642
- package/icons/sortamountdown/index.min.js +1 -1
- package/icons/sortamountupalt/index.cjs.js +2 -642
- package/icons/sortamountupalt/index.cjs.min.js +1 -1
- package/icons/sortamountupalt/index.esm.js +2 -642
- package/icons/sortamountupalt/index.esm.min.js +1 -1
- package/icons/sortamountupalt/index.js +2 -642
- package/icons/sortamountupalt/index.min.js +1 -1
- package/icons/spinner/index.cjs.js +2 -642
- package/icons/spinner/index.cjs.min.js +1 -1
- package/icons/spinner/index.esm.js +2 -642
- package/icons/spinner/index.esm.min.js +1 -1
- package/icons/spinner/index.js +2 -642
- package/icons/spinner/index.min.js +1 -1
- package/icons/star/index.cjs.js +2 -642
- package/icons/star/index.cjs.min.js +1 -1
- package/icons/star/index.esm.js +2 -642
- package/icons/star/index.esm.min.js +1 -1
- package/icons/star/index.js +2 -642
- package/icons/star/index.min.js +1 -1
- package/icons/starfill/index.cjs.js +2 -642
- package/icons/starfill/index.cjs.min.js +1 -1
- package/icons/starfill/index.esm.js +2 -642
- package/icons/starfill/index.esm.min.js +1 -1
- package/icons/starfill/index.js +2 -642
- package/icons/starfill/index.min.js +1 -1
- package/icons/thlarge/index.cjs.js +2 -642
- package/icons/thlarge/index.cjs.min.js +1 -1
- package/icons/thlarge/index.esm.js +2 -642
- package/icons/thlarge/index.esm.min.js +1 -1
- package/icons/thlarge/index.js +2 -642
- package/icons/thlarge/index.min.js +1 -1
- package/icons/timescircle/index.cjs.js +2 -642
- package/icons/timescircle/index.cjs.min.js +1 -1
- package/icons/timescircle/index.esm.js +2 -642
- package/icons/timescircle/index.esm.min.js +1 -1
- package/icons/timescircle/index.js +2 -642
- package/icons/timescircle/index.min.js +1 -1
- package/icons/trash/index.cjs.js +2 -642
- package/icons/trash/index.cjs.min.js +1 -1
- package/icons/trash/index.esm.js +2 -642
- package/icons/trash/index.esm.min.js +1 -1
- package/icons/trash/index.js +2 -642
- package/icons/trash/index.min.js +1 -1
- package/icons/undo/index.cjs.js +2 -642
- package/icons/undo/index.cjs.min.js +1 -1
- package/icons/undo/index.esm.js +2 -642
- package/icons/undo/index.esm.min.js +1 -1
- package/icons/undo/index.js +2 -642
- package/icons/undo/index.min.js +1 -1
- package/icons/upload/index.cjs.js +2 -642
- package/icons/upload/index.cjs.min.js +1 -1
- package/icons/upload/index.esm.js +2 -642
- package/icons/upload/index.esm.min.js +1 -1
- package/icons/upload/index.js +2 -642
- package/icons/upload/index.min.js +1 -1
- package/icons/windowmaximize/index.cjs.js +2 -642
- package/icons/windowmaximize/index.cjs.min.js +1 -1
- package/icons/windowmaximize/index.esm.js +2 -642
- package/icons/windowmaximize/index.esm.min.js +1 -1
- package/icons/windowmaximize/index.js +2 -642
- package/icons/windowmaximize/index.min.js +1 -1
- package/icons/windowminimize/index.cjs.js +2 -642
- package/icons/windowminimize/index.cjs.min.js +1 -1
- package/icons/windowminimize/index.esm.js +2 -642
- package/icons/windowminimize/index.esm.min.js +1 -1
- package/icons/windowminimize/index.js +2 -642
- package/icons/windowminimize/index.min.js +1 -1
- package/image/image.cjs.js +18 -575
- package/image/image.cjs.min.js +1 -1
- package/image/image.esm.js +20 -577
- package/image/image.esm.min.js +1 -1
- package/image/image.js +18 -575
- package/image/image.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +22 -39
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.d.ts +5 -5
- package/inputnumber/inputnumber.esm.js +22 -39
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +22 -39
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +20 -96
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.d.ts +9 -20
- package/inputswitch/inputswitch.esm.js +20 -96
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +20 -96
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/inputtext.cjs.js +7 -6
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.d.ts +5 -0
- package/inputtext/inputtext.esm.js +7 -6
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +7 -6
- package/inputtext/inputtext.min.js +1 -1
- package/inputtextarea/inputtextarea.cjs.js +5 -4
- package/inputtextarea/inputtextarea.cjs.min.js +1 -1
- package/inputtextarea/inputtextarea.d.ts +5 -0
- package/inputtextarea/inputtextarea.esm.js +5 -4
- package/inputtextarea/inputtextarea.esm.min.js +1 -1
- package/inputtextarea/inputtextarea.js +5 -4
- package/inputtextarea/inputtextarea.min.js +1 -1
- package/listbox/listbox.cjs.js +17 -14
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.d.ts +15 -0
- package/listbox/listbox.esm.js +18 -15
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +17 -14
- package/listbox/listbox.min.js +1 -1
- package/megamenu/megamenu.cjs.js +3 -3
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +3 -3
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +3 -3
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +5 -4
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +5 -4
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +5 -4
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +3 -2
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +3 -2
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +3 -2
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +18 -14
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +18 -14
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +18 -14
- package/menubar/menubar.min.js +1 -1
- package/message/message.cjs.js +2 -8
- package/message/message.cjs.min.js +1 -1
- package/message/message.d.ts +1 -1
- package/message/message.esm.js +2 -8
- package/message/message.esm.min.js +1 -1
- package/message/message.js +2 -8
- package/message/message.min.js +1 -1
- package/messages/messages.cjs.js +1 -1
- package/messages/messages.cjs.min.js +1 -1
- package/messages/messages.d.ts +1 -1
- package/messages/messages.esm.js +1 -1
- package/messages/messages.esm.min.js +1 -1
- package/messages/messages.js +1 -1
- package/messages/messages.min.js +1 -1
- package/metergroup/metergroup.cjs.js +237 -0
- package/metergroup/metergroup.cjs.min.js +1 -0
- package/metergroup/metergroup.d.ts +183 -0
- package/metergroup/metergroup.esm.js +233 -0
- package/metergroup/metergroup.esm.min.js +1 -0
- package/metergroup/metergroup.js +236 -0
- package/metergroup/metergroup.min.js +1 -0
- package/multiselect/multiselect.cjs.js +157 -160
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +25 -1
- package/multiselect/multiselect.esm.js +157 -160
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +157 -160
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +3 -4
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +3 -4
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +3 -4
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/orderlist/orderlist.cjs.js +35 -11
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.d.ts +5 -0
- package/orderlist/orderlist.esm.js +35 -11
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +35 -11
- package/orderlist/orderlist.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +3 -2
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +3 -2
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +3 -2
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +125 -108
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.d.ts +88 -0
- package/paginator/paginator.esm.js +125 -108
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +125 -108
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +19 -14
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.d.ts +18 -0
- package/panelmenu/panelmenu.esm.js +19 -14
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +19 -14
- package/panelmenu/panelmenu.min.js +1 -1
- package/passthrough/index.d.ts +12 -0
- package/passthrough/tailwind/index.cjs.js +279 -173
- package/passthrough/tailwind/index.cjs.min.js +1 -1
- package/passthrough/tailwind/index.esm.js +279 -173
- package/passthrough/tailwind/index.esm.min.js +1 -1
- package/passthrough/tailwind/index.js +279 -173
- package/passthrough/tailwind/index.min.js +1 -1
- package/password/password.cjs.js +98 -57
- package/password/password.cjs.min.js +1 -1
- package/password/password.d.ts +5 -0
- package/password/password.esm.js +100 -59
- package/password/password.esm.min.js +1 -1
- package/password/password.js +98 -57
- package/password/password.min.js +1 -1
- package/picklist/picklist.cjs.js +127 -102
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.d.ts +5 -0
- package/picklist/picklist.esm.js +127 -102
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +127 -102
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +2075 -2180
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +2076 -2180
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +2075 -2180
- package/primereact.all.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +69 -146
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.d.ts +17 -35
- package/radiobutton/radiobutton.esm.js +70 -147
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +69 -146
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/rating.cjs.js +2 -3
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +2 -3
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +2 -3
- package/rating/rating.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +344 -67
- package/resources/themes/arya-green/theme.css +344 -67
- package/resources/themes/arya-orange/theme.css +344 -67
- package/resources/themes/bootstrap4-dark-blue/theme.css +389 -64
- package/resources/themes/bootstrap4-light-blue/theme.css +389 -64
- package/resources/themes/fluent-light/theme.css +341 -64
- package/resources/themes/lara-dark-amber/theme.css +470 -67
- package/resources/themes/lara-dark-blue/theme.css +470 -67
- package/resources/themes/lara-dark-cyan/theme.css +470 -67
- package/resources/themes/lara-dark-green/theme.css +470 -67
- package/resources/themes/lara-dark-indigo/theme.css +470 -67
- package/resources/themes/lara-dark-pink/theme.css +470 -67
- package/resources/themes/lara-dark-teal/theme.css +470 -67
- package/resources/themes/lara-light-amber/theme.css +470 -67
- package/resources/themes/lara-light-blue/theme.css +470 -67
- package/resources/themes/lara-light-cyan/theme.css +470 -67
- package/resources/themes/lara-light-green/theme.css +470 -67
- package/resources/themes/lara-light-indigo/theme.css +470 -67
- package/resources/themes/lara-light-pink/theme.css +470 -67
- package/resources/themes/lara-light-teal/theme.css +470 -67
- package/resources/themes/luna-amber/theme.css +344 -67
- package/resources/themes/luna-blue/theme.css +344 -67
- package/resources/themes/luna-green/theme.css +344 -67
- package/resources/themes/luna-pink/theme.css +344 -67
- package/resources/themes/md-dark-deeppurple/theme.css +995 -289
- package/resources/themes/md-dark-indigo/theme.css +684 -232
- package/resources/themes/md-light-deeppurple/theme.css +868 -162
- package/resources/themes/md-light-indigo/theme.css +566 -101
- package/resources/themes/mdc-dark-deeppurple/theme.css +995 -289
- package/resources/themes/mdc-dark-indigo/theme.css +697 -232
- package/resources/themes/mdc-light-deeppurple/theme.css +868 -162
- package/resources/themes/mdc-light-indigo/theme.css +566 -101
- package/resources/themes/mira/theme.css +344 -67
- package/resources/themes/nano/theme.css +344 -67
- package/resources/themes/nova/theme.css +344 -67
- package/resources/themes/nova-accent/theme.css +344 -67
- package/resources/themes/nova-alt/theme.css +344 -67
- package/resources/themes/rhea/theme.css +343 -66
- package/resources/themes/saga-blue/theme.css +344 -67
- package/resources/themes/saga-green/theme.css +344 -67
- package/resources/themes/saga-orange/theme.css +344 -67
- package/resources/themes/soho-dark/theme.css +413 -88
- package/resources/themes/soho-light/theme.css +392 -67
- package/resources/themes/tailwind-light/theme.css +344 -67
- package/resources/themes/vela-blue/theme.css +344 -67
- package/resources/themes/vela-green/theme.css +344 -67
- package/resources/themes/vela-orange/theme.css +344 -67
- package/resources/themes/viva-dark/theme.css +392 -67
- package/resources/themes/viva-light/theme.css +392 -67
- package/selectbutton/selectbutton.cjs.js +15 -8
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.d.ts +5 -0
- package/selectbutton/selectbutton.esm.js +15 -8
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +16 -9
- package/selectbutton/selectbutton.min.js +1 -1
- package/sidebar/sidebar.cjs.js +4 -3
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.d.ts +4 -4
- package/sidebar/sidebar.esm.js +4 -3
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +4 -3
- package/sidebar/sidebar.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +7 -5
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +7 -5
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +7 -5
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.cjs.js +18 -2
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +18 -2
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +18 -2
- package/slider/slider.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +9 -12
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.d.ts +2 -2
- package/splitbutton/splitbutton.esm.js +9 -12
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +9 -12
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.cjs.js +16 -21
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.d.ts +5 -5
- package/splitter/splitter.esm.js +16 -21
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +16 -21
- package/splitter/splitter.min.js +1 -1
- package/steps/steps.cjs.js +4 -3
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +4 -3
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +4 -3
- package/steps/steps.min.js +1 -1
- package/styleclass/styleclass.cjs.js +21 -1
- package/styleclass/styleclass.cjs.min.js +1 -1
- package/styleclass/styleclass.d.ts +10 -0
- package/styleclass/styleclass.esm.js +21 -1
- package/styleclass/styleclass.esm.min.js +1 -1
- package/styleclass/styleclass.js +22 -2
- package/styleclass/styleclass.min.js +1 -1
- package/tabmenu/tabmenu.cjs.js +5 -4
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +5 -4
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +5 -4
- package/tabmenu/tabmenu.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +6 -8
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +6 -8
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +6 -8
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/toast/toast.cjs.js +93 -92
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.d.ts +1 -1
- package/toast/toast.esm.js +93 -92
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +93 -92
- package/toast/toast.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +56 -95
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.d.ts +24 -0
- package/togglebutton/togglebutton.esm.js +55 -94
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +56 -95
- package/togglebutton/togglebutton.min.js +1 -1
- package/tooltip/tooltip.d.ts +3 -3
- package/tooltip/tooltipoptions.d.ts +5 -0
- package/tree/tree.cjs.js +52 -39
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.d.ts +5 -0
- package/tree/tree.esm.js +52 -39
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +52 -39
- package/tree/tree.min.js +1 -1
- package/treeselect/treeselect.cjs.js +5 -4
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.d.ts +5 -0
- package/treeselect/treeselect.esm.js +5 -4
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +5 -4
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +18 -15
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +18 -15
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +18 -15
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +36 -94
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.d.ts +12 -13
- package/tristatecheckbox/tristatecheckbox.esm.js +37 -95
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +36 -94
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/utils.cjs.js +64 -72
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +11 -2
- package/utils/utils.esm.js +65 -72
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +64 -72
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +17 -15
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +14 -12
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +17 -15
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +519 -39
|
@@ -124,6 +124,7 @@ var OrderListBase = ComponentBase.extend({
|
|
|
124
124
|
moveDownIcon: null,
|
|
125
125
|
moveBottomIcon: null,
|
|
126
126
|
dataKey: null,
|
|
127
|
+
autoOptionFocus: true,
|
|
127
128
|
breakpoint: '960px',
|
|
128
129
|
onChange: null,
|
|
129
130
|
itemTemplate: null,
|
|
@@ -696,17 +697,34 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
696
697
|
return selectedItem !== item;
|
|
697
698
|
}));else setSelectionState([].concat(_toConsumableArray(selectionState), [item]));
|
|
698
699
|
};
|
|
700
|
+
var findCurrentFocusedIndex = function findCurrentFocusedIndex(listElement) {
|
|
701
|
+
if (focusedOptionIndex === -1) {
|
|
702
|
+
var itemList = listElement && listElement.children ? _toConsumableArray(listElement.children) : [];
|
|
703
|
+
var selectedOptionIndex = findFirstSelectedOptionIndex(listElement, itemList);
|
|
704
|
+
if (props.autoOptionFocus && selectedOptionIndex === -1) {
|
|
705
|
+
selectedOptionIndex = findFirstFocusedOptionIndex(listElement, itemList);
|
|
706
|
+
}
|
|
707
|
+
return selectedOptionIndex;
|
|
708
|
+
}
|
|
709
|
+
return -1;
|
|
710
|
+
};
|
|
711
|
+
var findFirstSelectedOptionIndex = function findFirstSelectedOptionIndex(listElement, itemList) {
|
|
712
|
+
if (selectionState.length) {
|
|
713
|
+
var selectedFirstItem = DomHandler.findSingle(listElement, '[data-p-highlight="true"]');
|
|
714
|
+
return ObjectUtils.findIndexInList(selectedFirstItem, itemList);
|
|
715
|
+
}
|
|
716
|
+
return -1;
|
|
717
|
+
};
|
|
718
|
+
var findFirstFocusedOptionIndex = function findFirstFocusedOptionIndex(listElement, itemList) {
|
|
719
|
+
var firstFocusableItem = DomHandler.findSingle(listElement, '[data-pc-section="item"]');
|
|
720
|
+
return ObjectUtils.findIndexInList(firstFocusableItem, itemList);
|
|
721
|
+
};
|
|
699
722
|
var onListFocus = function onListFocus(event) {
|
|
723
|
+
setFocused(true);
|
|
700
724
|
var listElement = getListElement();
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
var findIndex = ObjectUtils.findIndexInList(selectedFirstItem, itemList);
|
|
705
|
-
setFocused(true);
|
|
706
|
-
var index = focusedOptionIndex !== -1 ? focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
|
707
|
-
changeFocusedOptionIndex(index);
|
|
708
|
-
props.onFocus && props.onFocus(event);
|
|
709
|
-
}
|
|
725
|
+
var currentFocusedIndex = findCurrentFocusedIndex(listElement);
|
|
726
|
+
changeFocusedOptionIndex(currentFocusedIndex);
|
|
727
|
+
props.onFocus && props.onFocus(event);
|
|
710
728
|
};
|
|
711
729
|
var onListBlur = function onListBlur(event) {
|
|
712
730
|
setFocused(false);
|
|
@@ -742,7 +760,6 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
742
760
|
}
|
|
743
761
|
};
|
|
744
762
|
var onOptionMouseDown = function onOptionMouseDown(index) {
|
|
745
|
-
setFocused(true);
|
|
746
763
|
setFocusedOptionIndex(index);
|
|
747
764
|
};
|
|
748
765
|
var onArrowDownKey = function onArrowDownKey(event) {
|
|
@@ -837,7 +854,14 @@ var OrderList = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function
|
|
|
837
854
|
var changeFocusedOptionIndex = function changeFocusedOptionIndex(index) {
|
|
838
855
|
var listElement = getListElement();
|
|
839
856
|
var items = DomHandler.find(listElement, '[data-pc-section="item"]');
|
|
840
|
-
var order
|
|
857
|
+
var order;
|
|
858
|
+
if (index >= items.length) {
|
|
859
|
+
order = items.length - 1;
|
|
860
|
+
} else if (index < 0) {
|
|
861
|
+
return;
|
|
862
|
+
} else {
|
|
863
|
+
order = index;
|
|
864
|
+
}
|
|
841
865
|
var _focusedOptionIndex = items[order] ? items[order].getAttribute('id') : -1;
|
|
842
866
|
setFocusedOptionIndex(_focusedOptionIndex);
|
|
843
867
|
scrollInView(_focusedOptionIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import t,{ariaLabel as n,PrimeReactContext as r,FilterService as o}from"primereact/api";import{ComponentBase as i,useHandleStyle as l}from"primereact/componentbase";import{useMergeProps as a,useMountEffect as c,useUpdateEffect as u}from"primereact/hooks";import{classNames as s,ObjectUtils as d,IconUtils as p,DomHandler as f,UniqueComponentId as m}from"primereact/utils";import{Button as v}from"primereact/button";import{AngleDoubleDownIcon as g}from"primereact/icons/angledoubledown";import{AngleDoubleUpIcon as y}from"primereact/icons/angledoubleup";import{AngleDownIcon as h}from"primereact/icons/angledown";import{AngleUpIcon as b}from"primereact/icons/angleup";import{SearchIcon as I}from"primereact/icons/search";import{Ripple as w}from"primereact/ripple";function E(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 x(e){if(Array.isArray(e))return E(e)}function D(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 E(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)?E(e,t):void 0}}function O(){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 L(e){return x(e)||D(e)||S(e)||O()}function C(e){if(Array.isArray(e))return e}function N(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}function k(){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 B(e,t){return C(e)||N(e,t)||S(e,t)||k()}var K=i.extend({defaultProps:{__TYPE:"OrderList",id:null,ariaLabel:null,ariaLabelledBy:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,filterIcon:null,moveUpIcon:null,moveTopIcon:null,moveDownIcon:null,moveBottomIcon:null,dataKey:null,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},css:{classes:{root:"p-orderlist p-component",controls:"p-orderlist-controls",droppoint:"p-orderlist-droppoint",header:"p-orderlist-header",list:"p-orderlist-list",icon:"p-orderlist-filter",filter:"p-orderlist-filter",filterInput:"p-orderlist-filter-input p-inputtext p-component",filterIcon:"p-orderlist-filter-icon",filterContainer:"p-orderlist-filter-container",container:"p-orderlist-list-container",item:function(e){return s("p-orderlist-item",{"p-highlight":e.selected,"p-focus":e.focused})}},styles:"\n@layer primereact {\n .p-orderlist {\n display: flex;\n }\n\n .p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n .p-orderlist-list-container {\n flex: 1 1 auto;\n }\n\n .p-orderlist-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: auto;\n min-height: 12rem;\n max-height: 24rem;\n }\n\n .p-orderlist-item {\n cursor: pointer;\n overflow: hidden;\n position: relative;\n }\n\n .p-orderlist-filter {\n position: relative;\n }\n\n .p-orderlist-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n\n .p-orderlist-filter-input {\n width: 100%;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-item,\n .p-orderlist.p-state-disabled .p-button {\n cursor: default;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-list {\n overflow: hidden;\n }\n\n .p-orderlist .p-orderlist-droppoint {\n height: 0.5rem;\n }\n\n .p-orderlist .p-orderlist-droppoint.p-orderlist-droppoint-highlight {\n background: var(--primary-color);\n }\n}\n"}});function T(){return T=Object.assign?Object.assign.bind():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},T.apply(this,arguments)}var j=e.memo((function(t){var r=a(),o=t.moveUpIcon||e.createElement(b,null),i=t.moveTopIcon||e.createElement(y,null),l=t.moveDownIcon||e.createElement(h,null),c=t.moveBottomIcon||e.createElement(g,null),u=t.ptm,s=t.cx,p=t.unstyled,f=d.isEmpty(t.value)||d.isEmpty(t.selection),m=r({className:s("controls")},u("controls",{hostName:t.hostName})),I=r({type:"button",unstyled:p,icon:o,onClick:function(e){if(t.selection){for(var n=L(t.value),r=0;r<t.selection.length;r++){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(0===o)break;var i=n[o-1];n[o-1]=n[o],n[o]=i}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"up"})}},disabled:f,"aria-label":n("moveUp"),__parentMetadata:{parent:t.metaData}},u("moveUpButton")),w=r({type:"button",unstyled:p,icon:i,onClick:function(e){if(t.selection){for(var n=L(t.value),r=t.selection.length-1;r>=0;r--){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(0===o)break;var i=n.splice(o,1)[0];n.unshift(i)}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"top"})}},disabled:f,"aria-label":n("moveTop"),__parentMetadata:{parent:t.metaData}},u("moveTopButton")),E=r({type:"button",unstyled:p,icon:l,onClick:function(e){if(t.selection){for(var n=L(t.value),r=t.selection.length-1;r>=0;r--){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(o===n.length-1)break;var i=n[o+1];n[o+1]=n[o],n[o]=i}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"down"})}},disabled:f,"aria-label":n("moveDown"),__parentMetadata:{parent:t.metaData}},u("moveDownButton")),x=r({type:"button",unstyled:p,icon:c,onClick:function(e){if(t.selection){for(var n=L(t.value),r=0;r<t.selection.length;r++){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(o===n.length-1)break;var i=n.splice(o,1)[0];n.push(i)}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"bottom"})}},disabled:f,"aria-label":n("moveBottom"),__parentMetadata:{parent:t.metaData}},u("moveBottomButton"));return e.createElement("div",m,e.createElement(v,T({pt:u("moveUpButton")},I)),e.createElement(v,T({pt:u("moveTopButton")},w)),e.createElement(v,T({pt:u("moveDownButton")},E)),e.createElement(v,T({pt:u("moveBottomButton")},x)))}));function R(e){return R="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},R(e)}function A(e,t){if("object"!==R(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function F(e){var t=A(e,"string");return"symbol"===R(t)?t:String(t)}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){var r,o,i;r=e,i=n[t],(o=F(o=t))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}j.displayName="OrderListControls";var U=e.memo(e.forwardRef((function(t,n){var r=a(),o=t.ptm,i=t.cx,l=function(e,n){return o(e,P({hostName:t.hostName},n))},c=function(e,t){return l(t,{context:{selected:h(e)}})},u=e.useRef(null),m=e.useRef(null),v=e.useRef(null),g=e.useRef(null),y={filter:function(e){return t.onFilterInputChange(e)},reset:function(){return t.resetFilter()}},h=function(e){return-1!==d.findIndexInList(e,t.selection,t.dataKey)},b=function(e,n){m.current!==n&&m.current+1!==n&&(v.current=n,!t.isUnstyled()&&f.addClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!0),e.preventDefault())},E=function(e){v.current=null,!t.isUnstyled()&&f.removeClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!1)},x=function(e){var n=m.current>v.current?v.current:0===v.current?0:v.current-1,r=L(t.value);d.reorderArray(r,m.current,n),v.current=null,!t.isUnstyled()&&f.removeClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!1),t.onChange&&t.onChange({originalEvent:e,value:r})},D=function(e){u.current=!1},S=function(e){if(u.current){var t=g.current.getBoundingClientRect().top+f.getWindowScrollTop(),n=t+g.current.clientHeight-e.pageY,r=e.pageY-t;n<25&&n>0?g.current.scrollTop+=15:r<25&&r>0&&(g.current.scrollTop-=15)}},O=function(e){13===e.which&&e.preventDefault()},C=function(t,n){var o=r({className:i("droppoint"),onDragOver:function(e){return b(e,t+1)},onDragLeave:E,onDrop:x},l("droppoint"));return e.createElement("li",T({key:n},o))};e.useImperativeHandle(n,(function(){return{getElement:function(){return g.current}}}));var N,k,B,K=(N=r({className:i("header")},l("header")),t.header?e.createElement("div",N,t.header):null),j=function(){var n=r({className:i("icon")},l("icon")),o=p.getJSXIcon(t.filterIcon||e.createElement(I,n),P({},n),{props:t});if(t.filter){var a=r({className:i("filter")},l("filter")),c=r({type:"text",value:t.filterValue,onChange:t.onFilter,onKeyDown:O,placeholder:t.placeholder,className:i("filterInput")},l("filterInput")),u=r({className:i("filterIcon")},l("filterIcon")),s=e.createElement("div",a,e.createElement("input",c),e.createElement("span",u,o));if(t.filterTemplate)s=d.getJSXElement(t.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:t.onFilter,onKeyDown:O},filterOptions:y,iconClassName:"p-orderlist-filter-icon",element:s,props:t});var f=r({className:i("filterContainer")},l("filterContainer"));return e.createElement("div",f,s)}return null}(),R=(k=t.value?t.value.map((function(n,o){var l=t.itemTemplate?t.itemTemplate(n):n,a=t.parentId+"_"+o,d=t.focused&&t.focusedOptionId===a,p=h(n);if(t.dragdrop){var f=r({id:a,role:"option",draggable:"true",onClick:function(e){return t.onItemClick({originalEvent:e,value:n,index:o})},onMouseDown:t.onOptionMouseDown,onDragStart:function(e){return t=o,e.dataTransfer.setData("text","orderlist"),u.current=!0,void(m.current=t);var t},onDragEnd:D,className:s(t.className,i("item",{selected:p,focused:d})),"aria-selected":p,"data-p-highlight":p,"data-p-focused":d},c(n,"item")),v=[];return 0===o&&v.push(C(n,o)),v.push(e.createElement("li",T({key:a},f),l)),v.push(C(o,a+"_droppoint")),v}var g=r({id:a,role:"option",onClick:function(e){return t.onItemClick({originalEvent:e,value:n,index:o})},onMouseDown:t.onOptionMouseDown,className:s(t.className,i("item",{selected:p,focused:d})),"aria-selected":p,"data-p-highlight":p,"data-p-focused":d},c(n,"item"));return e.createElement("li",T({key:a},g),l,e.createElement(w,null))})):null,B=r({ref:g,className:i("list"),style:t.listStyle,onDragOver:S,role:"listbox",onFocus:t.onListFocus,onBlur:t.onListBlur,onKeyDown:t.onListKeyDown,tabIndex:t.tabIndex,"aria-activedescendant":t.focused?t.focusedOptionId:null,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-multiselectable":!0},l("list")),e.createElement("ul",B,k)),A=r({className:i("container")},l("container"));return e.createElement("div",A,K,j,R)})));U.displayName="OrderListSubList";var _=e.memo(e.forwardRef((function(n,i){var p=a(),v=e.useContext(r),g=K.getProps(n,v),y=B(e.useState([]),2),h=y[0],b=y[1],I=B(e.useState(""),2),w=I[0],E=I[1],x=B(e.useState(null),2),D=x[0],S=x[1],O=B(e.useState(!1),2),C=O[0],N=O[1],k=B(e.useState(null),2),T=k[0],R=k[1],A=B(e.useState(-1),2),F=A[0],M=A[1],P=d.isNotEmpty(w),_=e.useRef(null),H=e.useRef(null),V=e.useRef(null),Y=e.useRef(null),J={props:g,state:{selection:h,filterValue:w,attributeSelector:D}},X=K.setMetaData(J),W=X.ptm,$=X.cx,q=X.isUnstyled;l(K.css.styles,q,{name:"orderlist"});var z=function(){if(P){var e=w.trim().toLocaleLowerCase(g.filterLocale),t=g.filterBy?g.filterBy.split(","):[];return o.filter(g.value,t,e,g.filterMatchMode,g.filterLocale)}return g.value}(),G=function(){return Y.current&&Y.current.getElement()},Q=function(e){var t=e.originalEvent,n=e.value,r=e.index,o=d.findIndexInList(n,h),i=G(),l=f.find(i,'[data-pc-section="item"]')[r].getAttribute("id");M(l);var a,c=t.metaKey||t.ctrlKey;a=-1!==o?c?h.filter((function(e,t){return t!==o})):[n]:c?[].concat(L(h),[n]):[n],b(a)},Z=function(e){var t=z[e],n=-1!==d.findIndexInList(t,h);b(n?h.filter((function(e){return e!==t})):[].concat(L(h),[t]))},ee=function(e){var t=le(F);ce(t),e.shiftKey&&Z(t),e.preventDefault()},te=function(e){var t=ae(F);ce(t),e.shiftKey&&Z(t),e.preventDefault()},ne=function(e){if(e.ctrlKey&&e.shiftKey){var t=G(),n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(F,"]")),o=L(n).findIndex((function(e){return e===r}));b(L(z).slice(0,o+1))}else ce(0);e.preventDefault()},re=function(e){var t=G();if(e.ctrlKey&&e.shiftKey){var n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(F,"]")),o=L(n).findIndex((function(e){return e===r}));b(L(z).slice(o,n.length))}else ce(f.find(t,'[data-pc-section="item"]').length-1);e.preventDefault()},oe=function(e){var t=G(),n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(F,"]")),o=L(n).findIndex((function(e){return e===r}));Q({originalEvent:e,value:z[o],index:o}),e.preventDefault()},ie=function(e){e.preventDefault();var t=G();if(e.shiftKey&&h&&h.length>0){var n=f.find(t,'[data-pc-section="item"]'),r=d.findIndexInList(h[0],L(z)),o=f.findSingle(t,'[data-pc-section="item"][id='.concat(F,"]")),i=L(n).findIndex((function(e){return e===o}));b(L(z).slice(Math.min(r,i),Math.max(r,i)+1))}else oe(e)},le=function(e){var t=G(),n=L(f.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n+1:0},ae=function(e){var t=G(),n=L(f.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n-1:0},ce=function(e){var t=G(),n=f.find(t,'[data-pc-section="item"]'),r=e>=n.length?n.length-1:e<0?0:e,o=n[r]?n[r].getAttribute("id"):-1;M(o),ue(o)},ue=function(e){var t=G(),n=f.findSingle(t,'[data-pc-section="item"][id="'.concat(e,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},se=function(){if(!H.current){H.current=f.createInlineStyle(v&&v.nonce||t.nonce,v&&v.styleContainer);var e="\n@media screen and (max-width: ".concat(g.breakpoint,") {\n .p-orderlist[").concat(D,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");H.current.innerHTML=e}};e.useImperativeHandle(i,(function(){return{props:g,getElement:function(){return _.current}}})),c((function(){!D&&S(m())})),u((function(){return D&&(_.current.setAttribute(D,""),se()),function(){H.current=f.removeInlineStyle(H.current)}}),[D,g.breakpoint]),u((function(){R(-1!==F?F:null)}),[F]),u((function(){V.current&&(V.current=null)}));var de=p({ref:_,id:g.id,className:s(g.className,$("root")),style:g.style},K.getOtherProps(g),W("root"));return e.createElement("div",de,e.createElement(j,{hostName:"OrderList",value:z,selection:h,onReorder:function(e){g.onChange&&g.onChange({event:e.originalEvent,value:e.value}),V.current=e.direction},dataKey:g.dataKey,moveUpIcon:g.moveUpIcon,moveTopIcon:g.moveTopIcon,moveDownIcon:g.moveDownIcon,moveBottomIcon:g.moveBottomIcon,ptm:W,cx:$,unstyled:g.unstyled,metaData:J}),e.createElement(U,{ref:Y,hostName:"OrderList",focused:C,ariaLabel:g.ariaLabel,ariaLabelledBy:g.ariaLabelledBy,value:z,selection:h,onItemClick:Q,onOptionMouseDown:function(e){N(!0),M(e)},focusedOptionId:T,onListKeyDown:function(e){switch(e.code){case"ArrowDown":ee(e);break;case"ArrowUp":te(e);break;case"Home":ne(e);break;case"End":re(e);break;case"Enter":case"NumpadEnter":oe(e);break;case"Space":ie(e);break;case"KeyA":e.ctrlKey&&(b(z),e.preventDefault())}},onListFocus:function(e){var t=G(),n=f.findSingle(t,'[data-p-highlight="true"]')||f.findSingle(t,'[data-pc-section="item"]'),r=t&&t.children?L(t.children):[];if(n&&r.length>0){var o=d.findIndexInList(n,r);N(!0),ce(-1!==F?F:n?o:-1),g.onFocus&&g.onFocus(e)}},onListBlur:function(e){N(!1),M(-1),g.onBlur&&g.onBlur(e)},onFilterInputChange:function(e){var t=e.target.value;E(t),g.onFilter&&g.onFilter({originalEvent:e,filter:t})},itemTemplate:g.itemTemplate,filter:g.filter,onFilter:function(e){var t=e.target.value;E(t),g.onFilter&&g.onFilter({originalEvent:e,value:t})},resetFilter:function(){E(""),g.onFilter&&g.onFilter({filter:""})},filterTemplate:g.filterTemplate,header:g.header,parentId:D,listStyle:g.listStyle,dataKey:g.dataKey,dragdrop:g.dragdrop,onChange:g.onChange,tabIndex:g.tabIndex,filterIcon:g.filterIcon,isUnstyled:q,ptm:W,cx:$}))})));_.displayName="OrderList";export{_ as OrderList};
|
|
1
|
+
import*as e from"react";import t,{ariaLabel as n,PrimeReactContext as r,FilterService as o}from"primereact/api";import{ComponentBase as i,useHandleStyle as a}from"primereact/componentbase";import{useMergeProps as l,useMountEffect as c,useUpdateEffect as u}from"primereact/hooks";import{classNames as s,ObjectUtils as d,IconUtils as p,DomHandler as f,UniqueComponentId as m}from"primereact/utils";import{Button as v}from"primereact/button";import{AngleDoubleDownIcon as g}from"primereact/icons/angledoubledown";import{AngleDoubleUpIcon as y}from"primereact/icons/angledoubleup";import{AngleDownIcon as h}from"primereact/icons/angledown";import{AngleUpIcon as b}from"primereact/icons/angleup";import{SearchIcon as I}from"primereact/icons/search";import{Ripple as w}from"primereact/ripple";function E(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 x(e){if(Array.isArray(e))return E(e)}function D(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function O(e,t){if(e){if("string"==typeof e)return E(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)?E(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 L(e){return x(e)||D(e)||O(e)||S()}function C(e){if(Array.isArray(e))return e}function N(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function k(){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 B(e,t){return C(e)||N(e,t)||O(e,t)||k()}var K=i.extend({defaultProps:{__TYPE:"OrderList",id:null,ariaLabel:null,ariaLabelledBy:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,filterIcon:null,moveUpIcon:null,moveTopIcon:null,moveDownIcon:null,moveBottomIcon:null,dataKey:null,autoOptionFocus:!0,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},css:{classes:{root:"p-orderlist p-component",controls:"p-orderlist-controls",droppoint:"p-orderlist-droppoint",header:"p-orderlist-header",list:"p-orderlist-list",icon:"p-orderlist-filter",filter:"p-orderlist-filter",filterInput:"p-orderlist-filter-input p-inputtext p-component",filterIcon:"p-orderlist-filter-icon",filterContainer:"p-orderlist-filter-container",container:"p-orderlist-list-container",item:function(e){return s("p-orderlist-item",{"p-highlight":e.selected,"p-focus":e.focused})}},styles:"\n@layer primereact {\n .p-orderlist {\n display: flex;\n }\n\n .p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n .p-orderlist-list-container {\n flex: 1 1 auto;\n }\n\n .p-orderlist-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: auto;\n min-height: 12rem;\n max-height: 24rem;\n }\n\n .p-orderlist-item {\n cursor: pointer;\n overflow: hidden;\n position: relative;\n }\n\n .p-orderlist-filter {\n position: relative;\n }\n\n .p-orderlist-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n\n .p-orderlist-filter-input {\n width: 100%;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-item,\n .p-orderlist.p-state-disabled .p-button {\n cursor: default;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-list {\n overflow: hidden;\n }\n\n .p-orderlist .p-orderlist-droppoint {\n height: 0.5rem;\n }\n\n .p-orderlist .p-orderlist-droppoint.p-orderlist-droppoint-highlight {\n background: var(--primary-color);\n }\n}\n"}});function T(){return T=Object.assign?Object.assign.bind():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},T.apply(this,arguments)}var j=e.memo((function(t){var r=l(),o=t.moveUpIcon||e.createElement(b,null),i=t.moveTopIcon||e.createElement(y,null),a=t.moveDownIcon||e.createElement(h,null),c=t.moveBottomIcon||e.createElement(g,null),u=t.ptm,s=t.cx,p=t.unstyled,f=d.isEmpty(t.value)||d.isEmpty(t.selection),m=r({className:s("controls")},u("controls",{hostName:t.hostName})),I=r({type:"button",unstyled:p,icon:o,onClick:function(e){if(t.selection){for(var n=L(t.value),r=0;r<t.selection.length;r++){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(0===o)break;var i=n[o-1];n[o-1]=n[o],n[o]=i}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"up"})}},disabled:f,"aria-label":n("moveUp"),__parentMetadata:{parent:t.metaData}},u("moveUpButton")),w=r({type:"button",unstyled:p,icon:i,onClick:function(e){if(t.selection){for(var n=L(t.value),r=t.selection.length-1;r>=0;r--){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(0===o)break;var i=n.splice(o,1)[0];n.unshift(i)}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"top"})}},disabled:f,"aria-label":n("moveTop"),__parentMetadata:{parent:t.metaData}},u("moveTopButton")),E=r({type:"button",unstyled:p,icon:a,onClick:function(e){if(t.selection){for(var n=L(t.value),r=t.selection.length-1;r>=0;r--){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(o===n.length-1)break;var i=n[o+1];n[o+1]=n[o],n[o]=i}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"down"})}},disabled:f,"aria-label":n("moveDown"),__parentMetadata:{parent:t.metaData}},u("moveDownButton")),x=r({type:"button",unstyled:p,icon:c,onClick:function(e){if(t.selection){for(var n=L(t.value),r=0;r<t.selection.length;r++){var o=d.findIndexInList(t.selection[r],n,t.dataKey);if(o===n.length-1)break;var i=n.splice(o,1)[0];n.push(i)}t.onReorder&&t.onReorder({originalEvent:e,value:n,direction:"bottom"})}},disabled:f,"aria-label":n("moveBottom"),__parentMetadata:{parent:t.metaData}},u("moveBottomButton"));return e.createElement("div",m,e.createElement(v,T({pt:u("moveUpButton")},I)),e.createElement(v,T({pt:u("moveTopButton")},w)),e.createElement(v,T({pt:u("moveDownButton")},E)),e.createElement(v,T({pt:u("moveBottomButton")},x)))}));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 R(e,t){if("object"!==F(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function A(e){var t=R(e,"string");return"symbol"===F(t)?t:String(t)}function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach((function(t){var r,o,i;r=e,i=n[t],(o=A(o=t))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}j.displayName="OrderListControls";var U=e.memo(e.forwardRef((function(t,n){var r=l(),o=t.ptm,i=t.cx,a=function(e,n){return o(e,P({hostName:t.hostName},n))},c=function(e,t){return a(t,{context:{selected:h(e)}})},u=e.useRef(null),m=e.useRef(null),v=e.useRef(null),g=e.useRef(null),y={filter:function(e){return t.onFilterInputChange(e)},reset:function(){return t.resetFilter()}},h=function(e){return-1!==d.findIndexInList(e,t.selection,t.dataKey)},b=function(e,n){m.current!==n&&m.current+1!==n&&(v.current=n,!t.isUnstyled()&&f.addClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!0),e.preventDefault())},E=function(e){v.current=null,!t.isUnstyled()&&f.removeClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!1)},x=function(e){var n=m.current>v.current?v.current:0===v.current?0:v.current-1,r=L(t.value);d.reorderArray(r,m.current,n),v.current=null,!t.isUnstyled()&&f.removeClass(e.target,"p-orderlist-droppoint-highlight"),e.target.setAttribute("data-p-orderlist-droppoint-highlight",!1),t.onChange&&t.onChange({originalEvent:e,value:r})},D=function(e){u.current=!1},O=function(e){if(u.current){var t=g.current.getBoundingClientRect().top+f.getWindowScrollTop(),n=t+g.current.clientHeight-e.pageY,r=e.pageY-t;n<25&&n>0?g.current.scrollTop+=15:r<25&&r>0&&(g.current.scrollTop-=15)}},S=function(e){13===e.which&&e.preventDefault()},C=function(t,n){var o=r({className:i("droppoint"),onDragOver:function(e){return b(e,t+1)},onDragLeave:E,onDrop:x},a("droppoint"));return e.createElement("li",T({key:n},o))};e.useImperativeHandle(n,(function(){return{getElement:function(){return g.current}}}));var N,k,B,K=(N=r({className:i("header")},a("header")),t.header?e.createElement("div",N,t.header):null),j=function(){var n=r({className:i("icon")},a("icon")),o=p.getJSXIcon(t.filterIcon||e.createElement(I,n),P({},n),{props:t});if(t.filter){var l=r({className:i("filter")},a("filter")),c=r({type:"text",value:t.filterValue,onChange:t.onFilter,onKeyDown:S,placeholder:t.placeholder,className:i("filterInput")},a("filterInput")),u=r({className:i("filterIcon")},a("filterIcon")),s=e.createElement("div",l,e.createElement("input",c),e.createElement("span",u,o));if(t.filterTemplate)s=d.getJSXElement(t.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:t.onFilter,onKeyDown:S},filterOptions:y,iconClassName:"p-orderlist-filter-icon",element:s,props:t});var f=r({className:i("filterContainer")},a("filterContainer"));return e.createElement("div",f,s)}return null}(),F=(k=t.value?t.value.map((function(n,o){var a=t.itemTemplate?t.itemTemplate(n):n,l=t.parentId+"_"+o,d=t.focused&&t.focusedOptionId===l,p=h(n);if(t.dragdrop){var f=r({id:l,role:"option",draggable:"true",onClick:function(e){return t.onItemClick({originalEvent:e,value:n,index:o})},onMouseDown:t.onOptionMouseDown,onDragStart:function(e){return t=o,e.dataTransfer.setData("text","orderlist"),u.current=!0,void(m.current=t);var t},onDragEnd:D,className:s(t.className,i("item",{selected:p,focused:d})),"aria-selected":p,"data-p-highlight":p,"data-p-focused":d},c(n,"item")),v=[];return 0===o&&v.push(C(n,o)),v.push(e.createElement("li",T({key:l},f),a)),v.push(C(o,l+"_droppoint")),v}var g=r({id:l,role:"option",onClick:function(e){return t.onItemClick({originalEvent:e,value:n,index:o})},onMouseDown:t.onOptionMouseDown,className:s(t.className,i("item",{selected:p,focused:d})),"aria-selected":p,"data-p-highlight":p,"data-p-focused":d},c(n,"item"));return e.createElement("li",T({key:l},g),a,e.createElement(w,null))})):null,B=r({ref:g,className:i("list"),style:t.listStyle,onDragOver:O,role:"listbox",onFocus:t.onListFocus,onBlur:t.onListBlur,onKeyDown:t.onListKeyDown,tabIndex:t.tabIndex,"aria-activedescendant":t.focused?t.focusedOptionId:null,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-multiselectable":!0},a("list")),e.createElement("ul",B,k)),R=r({className:i("container")},a("container"));return e.createElement("div",R,K,j,F)})));U.displayName="OrderListSubList";var _=e.memo(e.forwardRef((function(n,i){var p=l(),v=e.useContext(r),g=K.getProps(n,v),y=B(e.useState([]),2),h=y[0],b=y[1],I=B(e.useState(""),2),w=I[0],E=I[1],x=B(e.useState(null),2),D=x[0],O=x[1],S=B(e.useState(!1),2),C=S[0],N=S[1],k=B(e.useState(null),2),T=k[0],F=k[1],R=B(e.useState(-1),2),A=R[0],M=R[1],P=d.isNotEmpty(w),_=e.useRef(null),H=e.useRef(null),V=e.useRef(null),Y=e.useRef(null),J={props:g,state:{selection:h,filterValue:w,attributeSelector:D}},X=K.setMetaData(J),W=X.ptm,$=X.cx,q=X.isUnstyled;a(K.css.styles,q,{name:"orderlist"});var z=function(){if(P){var e=w.trim().toLocaleLowerCase(g.filterLocale),t=g.filterBy?g.filterBy.split(","):[];return o.filter(g.value,t,e,g.filterMatchMode,g.filterLocale)}return g.value}(),G=function(){return Y.current&&Y.current.getElement()},Q=function(e){var t=e.originalEvent,n=e.value,r=e.index,o=d.findIndexInList(n,h),i=G(),a=f.find(i,'[data-pc-section="item"]')[r].getAttribute("id");M(a);var l,c=t.metaKey||t.ctrlKey;l=-1!==o?c?h.filter((function(e,t){return t!==o})):[n]:c?[].concat(L(h),[n]):[n],b(l)},Z=function(e){var t=z[e],n=-1!==d.findIndexInList(t,h);b(n?h.filter((function(e){return e!==t})):[].concat(L(h),[t]))},ee=function(e){if(-1===A){var t=e&&e.children?L(e.children):[],n=te(e,t);return g.autoOptionFocus&&-1===n&&(n=ne(e,t)),n}return-1},te=function(e,t){if(h.length){var n=f.findSingle(e,'[data-p-highlight="true"]');return d.findIndexInList(n,t)}return-1},ne=function(e,t){var n=f.findSingle(e,'[data-pc-section="item"]');return d.findIndexInList(n,t)},re=function(e){var t=ue(A);de(t),e.shiftKey&&Z(t),e.preventDefault()},oe=function(e){var t=se(A);de(t),e.shiftKey&&Z(t),e.preventDefault()},ie=function(e){if(e.ctrlKey&&e.shiftKey){var t=G(),n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(A,"]")),o=L(n).findIndex((function(e){return e===r}));b(L(z).slice(0,o+1))}else de(0);e.preventDefault()},ae=function(e){var t=G();if(e.ctrlKey&&e.shiftKey){var n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(A,"]")),o=L(n).findIndex((function(e){return e===r}));b(L(z).slice(o,n.length))}else de(f.find(t,'[data-pc-section="item"]').length-1);e.preventDefault()},le=function(e){var t=G(),n=f.find(t,'[data-pc-section="item"]'),r=f.findSingle(t,'[data-pc-section="item"][id='.concat(A,"]")),o=L(n).findIndex((function(e){return e===r}));Q({originalEvent:e,value:z[o],index:o}),e.preventDefault()},ce=function(e){e.preventDefault();var t=G();if(e.shiftKey&&h&&h.length>0){var n=f.find(t,'[data-pc-section="item"]'),r=d.findIndexInList(h[0],L(z)),o=f.findSingle(t,'[data-pc-section="item"][id='.concat(A,"]")),i=L(n).findIndex((function(e){return e===o}));b(L(z).slice(Math.min(r,i),Math.max(r,i)+1))}else le(e)},ue=function(e){var t=G(),n=L(f.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n+1:0},se=function(e){var t=G(),n=L(f.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n-1:0},de=function(e){var t,n=G(),r=f.find(n,'[data-pc-section="item"]');if(e>=r.length)t=r.length-1;else{if(e<0)return;t=e}var o=r[t]?r[t].getAttribute("id"):-1;M(o),pe(o)},pe=function(e){var t=G(),n=f.findSingle(t,'[data-pc-section="item"][id="'.concat(e,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},fe=function(){if(!H.current){H.current=f.createInlineStyle(v&&v.nonce||t.nonce,v&&v.styleContainer);var e="\n@media screen and (max-width: ".concat(g.breakpoint,") {\n .p-orderlist[").concat(D,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(D,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");H.current.innerHTML=e}};e.useImperativeHandle(i,(function(){return{props:g,getElement:function(){return _.current}}})),c((function(){!D&&O(m())})),u((function(){return D&&(_.current.setAttribute(D,""),fe()),function(){H.current=f.removeInlineStyle(H.current)}}),[D,g.breakpoint]),u((function(){F(-1!==A?A:null)}),[A]),u((function(){V.current&&(V.current=null)}));var me=p({ref:_,id:g.id,className:s(g.className,$("root")),style:g.style},K.getOtherProps(g),W("root"));return e.createElement("div",me,e.createElement(j,{hostName:"OrderList",value:z,selection:h,onReorder:function(e){g.onChange&&g.onChange({event:e.originalEvent,value:e.value}),V.current=e.direction},dataKey:g.dataKey,moveUpIcon:g.moveUpIcon,moveTopIcon:g.moveTopIcon,moveDownIcon:g.moveDownIcon,moveBottomIcon:g.moveBottomIcon,ptm:W,cx:$,unstyled:g.unstyled,metaData:J}),e.createElement(U,{ref:Y,hostName:"OrderList",focused:C,ariaLabel:g.ariaLabel,ariaLabelledBy:g.ariaLabelledBy,value:z,selection:h,onItemClick:Q,onOptionMouseDown:function(e){M(e)},focusedOptionId:T,onListKeyDown:function(e){switch(e.code){case"ArrowDown":re(e);break;case"ArrowUp":oe(e);break;case"Home":ie(e);break;case"End":ae(e);break;case"Enter":case"NumpadEnter":le(e);break;case"Space":ce(e);break;case"KeyA":e.ctrlKey&&(b(z),e.preventDefault())}},onListFocus:function(e){N(!0);var t=G(),n=ee(t);de(n),g.onFocus&&g.onFocus(e)},onListBlur:function(e){N(!1),M(-1),g.onBlur&&g.onBlur(e)},onFilterInputChange:function(e){var t=e.target.value;E(t),g.onFilter&&g.onFilter({originalEvent:e,filter:t})},itemTemplate:g.itemTemplate,filter:g.filter,onFilter:function(e){var t=e.target.value;E(t),g.onFilter&&g.onFilter({originalEvent:e,value:t})},resetFilter:function(){E(""),g.onFilter&&g.onFilter({filter:""})},filterTemplate:g.filterTemplate,header:g.header,parentId:D,listStyle:g.listStyle,dataKey:g.dataKey,dragdrop:g.dragdrop,onChange:g.onChange,tabIndex:g.tabIndex,filterIcon:g.filterIcon,isUnstyled:q,ptm:W,cx:$}))})));_.displayName="OrderList";export{_ as OrderList};
|
package/orderlist/orderlist.js
CHANGED
|
@@ -137,6 +137,7 @@ this.primereact.orderlist = (function (exports, React, PrimeReact, componentbase
|
|
|
137
137
|
moveDownIcon: null,
|
|
138
138
|
moveBottomIcon: null,
|
|
139
139
|
dataKey: null,
|
|
140
|
+
autoOptionFocus: true,
|
|
140
141
|
breakpoint: '960px',
|
|
141
142
|
onChange: null,
|
|
142
143
|
itemTemplate: null,
|
|
@@ -709,17 +710,34 @@ this.primereact.orderlist = (function (exports, React, PrimeReact, componentbase
|
|
|
709
710
|
return selectedItem !== item;
|
|
710
711
|
}));else setSelectionState([].concat(_toConsumableArray(selectionState), [item]));
|
|
711
712
|
};
|
|
713
|
+
var findCurrentFocusedIndex = function findCurrentFocusedIndex(listElement) {
|
|
714
|
+
if (focusedOptionIndex === -1) {
|
|
715
|
+
var itemList = listElement && listElement.children ? _toConsumableArray(listElement.children) : [];
|
|
716
|
+
var selectedOptionIndex = findFirstSelectedOptionIndex(listElement, itemList);
|
|
717
|
+
if (props.autoOptionFocus && selectedOptionIndex === -1) {
|
|
718
|
+
selectedOptionIndex = findFirstFocusedOptionIndex(listElement, itemList);
|
|
719
|
+
}
|
|
720
|
+
return selectedOptionIndex;
|
|
721
|
+
}
|
|
722
|
+
return -1;
|
|
723
|
+
};
|
|
724
|
+
var findFirstSelectedOptionIndex = function findFirstSelectedOptionIndex(listElement, itemList) {
|
|
725
|
+
if (selectionState.length) {
|
|
726
|
+
var selectedFirstItem = utils.DomHandler.findSingle(listElement, '[data-p-highlight="true"]');
|
|
727
|
+
return utils.ObjectUtils.findIndexInList(selectedFirstItem, itemList);
|
|
728
|
+
}
|
|
729
|
+
return -1;
|
|
730
|
+
};
|
|
731
|
+
var findFirstFocusedOptionIndex = function findFirstFocusedOptionIndex(listElement, itemList) {
|
|
732
|
+
var firstFocusableItem = utils.DomHandler.findSingle(listElement, '[data-pc-section="item"]');
|
|
733
|
+
return utils.ObjectUtils.findIndexInList(firstFocusableItem, itemList);
|
|
734
|
+
};
|
|
712
735
|
var onListFocus = function onListFocus(event) {
|
|
736
|
+
setFocused(true);
|
|
713
737
|
var listElement = getListElement();
|
|
714
|
-
var
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
var findIndex = utils.ObjectUtils.findIndexInList(selectedFirstItem, itemList);
|
|
718
|
-
setFocused(true);
|
|
719
|
-
var index = focusedOptionIndex !== -1 ? focusedOptionIndex : selectedFirstItem ? findIndex : -1;
|
|
720
|
-
changeFocusedOptionIndex(index);
|
|
721
|
-
props.onFocus && props.onFocus(event);
|
|
722
|
-
}
|
|
738
|
+
var currentFocusedIndex = findCurrentFocusedIndex(listElement);
|
|
739
|
+
changeFocusedOptionIndex(currentFocusedIndex);
|
|
740
|
+
props.onFocus && props.onFocus(event);
|
|
723
741
|
};
|
|
724
742
|
var onListBlur = function onListBlur(event) {
|
|
725
743
|
setFocused(false);
|
|
@@ -755,7 +773,6 @@ this.primereact.orderlist = (function (exports, React, PrimeReact, componentbase
|
|
|
755
773
|
}
|
|
756
774
|
};
|
|
757
775
|
var onOptionMouseDown = function onOptionMouseDown(index) {
|
|
758
|
-
setFocused(true);
|
|
759
776
|
setFocusedOptionIndex(index);
|
|
760
777
|
};
|
|
761
778
|
var onArrowDownKey = function onArrowDownKey(event) {
|
|
@@ -850,7 +867,14 @@ this.primereact.orderlist = (function (exports, React, PrimeReact, componentbase
|
|
|
850
867
|
var changeFocusedOptionIndex = function changeFocusedOptionIndex(index) {
|
|
851
868
|
var listElement = getListElement();
|
|
852
869
|
var items = utils.DomHandler.find(listElement, '[data-pc-section="item"]');
|
|
853
|
-
var order
|
|
870
|
+
var order;
|
|
871
|
+
if (index >= items.length) {
|
|
872
|
+
order = items.length - 1;
|
|
873
|
+
} else if (index < 0) {
|
|
874
|
+
return;
|
|
875
|
+
} else {
|
|
876
|
+
order = index;
|
|
877
|
+
}
|
|
854
878
|
var _focusedOptionIndex = items[order] ? items[order].getAttribute('id') : -1;
|
|
855
879
|
setFocusedOptionIndex(_focusedOptionIndex);
|
|
856
880
|
scrollInView(_focusedOptionIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.orderlist=function(e,t,n,r,o,i,l,a,c,u,s,d,p){"use strict";function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var v=m(t),g=f(n);function b(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 y(e){if(Array.isArray(e))return b(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return b(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)?b(e,t):void 0}}function D(){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 O(e){return y(e)||h(e)||I(e)||D()}function E(e){if(Array.isArray(e))return e}function w(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}function x(){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 S(e,t){return E(e)||w(e,t)||I(e,t)||x()}var j=r.ComponentBase.extend({defaultProps:{__TYPE:"OrderList",id:null,ariaLabel:null,ariaLabelledBy:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,filterIcon:null,moveUpIcon:null,moveTopIcon:null,moveDownIcon:null,moveBottomIcon:null,dataKey:null,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},css:{classes:{root:"p-orderlist p-component",controls:"p-orderlist-controls",droppoint:"p-orderlist-droppoint",header:"p-orderlist-header",list:"p-orderlist-list",icon:"p-orderlist-filter",filter:"p-orderlist-filter",filterInput:"p-orderlist-filter-input p-inputtext p-component",filterIcon:"p-orderlist-filter-icon",filterContainer:"p-orderlist-filter-container",container:"p-orderlist-list-container",item:function(e){return i.classNames("p-orderlist-item",{"p-highlight":e.selected,"p-focus":e.focused})}},styles:"\n@layer primereact {\n .p-orderlist {\n display: flex;\n }\n\n .p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n .p-orderlist-list-container {\n flex: 1 1 auto;\n }\n\n .p-orderlist-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: auto;\n min-height: 12rem;\n max-height: 24rem;\n }\n\n .p-orderlist-item {\n cursor: pointer;\n overflow: hidden;\n position: relative;\n }\n\n .p-orderlist-filter {\n position: relative;\n }\n\n .p-orderlist-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n\n .p-orderlist-filter-input {\n width: 100%;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-item,\n .p-orderlist.p-state-disabled .p-button {\n cursor: default;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-list {\n overflow: hidden;\n }\n\n .p-orderlist .p-orderlist-droppoint {\n height: 0.5rem;\n }\n\n .p-orderlist .p-orderlist-droppoint.p-orderlist-droppoint-highlight {\n background: var(--primary-color);\n }\n}\n"}});function L(){return L=Object.assign?Object.assign.bind():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},L.apply(this,arguments)}var C=v.memo((function(e){var t=o.useMergeProps(),r=e.moveUpIcon||v.createElement(s.AngleUpIcon,null),d=e.moveTopIcon||v.createElement(c.AngleDoubleUpIcon,null),p=e.moveDownIcon||v.createElement(u.AngleDownIcon,null),f=e.moveBottomIcon||v.createElement(a.AngleDoubleDownIcon,null),m=e.ptm,g=e.cx,b=e.unstyled,y=i.ObjectUtils.isEmpty(e.value)||i.ObjectUtils.isEmpty(e.selection),h=t({className:g("controls")},m("controls",{hostName:e.hostName})),I=t({type:"button",unstyled:b,icon:r,onClick:function(t){if(e.selection){for(var n=O(e.value),r=0;r<e.selection.length;r++){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(0===o)break;var l=n[o-1];n[o-1]=n[o],n[o]=l}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"up"})}},disabled:y,"aria-label":n.ariaLabel("moveUp"),__parentMetadata:{parent:e.metaData}},m("moveUpButton")),D=t({type:"button",unstyled:b,icon:d,onClick:function(t){if(e.selection){for(var n=O(e.value),r=e.selection.length-1;r>=0;r--){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(0===o)break;var l=n.splice(o,1)[0];n.unshift(l)}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"top"})}},disabled:y,"aria-label":n.ariaLabel("moveTop"),__parentMetadata:{parent:e.metaData}},m("moveTopButton")),E=t({type:"button",unstyled:b,icon:p,onClick:function(t){if(e.selection){for(var n=O(e.value),r=e.selection.length-1;r>=0;r--){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(o===n.length-1)break;var l=n[o+1];n[o+1]=n[o],n[o]=l}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"down"})}},disabled:y,"aria-label":n.ariaLabel("moveDown"),__parentMetadata:{parent:e.metaData}},m("moveDownButton")),w=t({type:"button",unstyled:b,icon:f,onClick:function(t){if(e.selection){for(var n=O(e.value),r=0;r<e.selection.length;r++){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(o===n.length-1)break;var l=n.splice(o,1)[0];n.push(l)}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"bottom"})}},disabled:y,"aria-label":n.ariaLabel("moveBottom"),__parentMetadata:{parent:e.metaData}},m("moveBottomButton"));return v.createElement("div",h,v.createElement(l.Button,L({pt:m("moveUpButton")},I)),v.createElement(l.Button,L({pt:m("moveTopButton")},D)),v.createElement(l.Button,L({pt:m("moveDownButton")},E)),v.createElement(l.Button,L({pt:m("moveBottomButton")},w)))}));function N(e){return N="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},N(e)}function U(e,t){if("object"!==N(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function B(e){var t=U(e,"string");return"symbol"===N(t)?t:String(t)}function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach((function(t){var r,o,i;r=e,i=n[t],(o=B(o=t))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}C.displayName="OrderListControls";var K=v.memo(v.forwardRef((function(e,t){var n=o.useMergeProps(),r=e.ptm,l=e.cx,a=function(t,n){return r(t,H({hostName:e.hostName},n))},c=function(e,t){return a(t,{context:{selected:b(e)}})},u=v.useRef(null),s=v.useRef(null),f=v.useRef(null),m=v.useRef(null),g={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},b=function(t){return-1!==i.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},y=function(t,n){s.current!==n&&s.current+1!==n&&(f.current=n,!e.isUnstyled()&&i.DomHandler.addClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!0),t.preventDefault())},h=function(t){f.current=null,!e.isUnstyled()&&i.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!1)},I=function(t){var n=s.current>f.current?f.current:0===f.current?0:f.current-1,r=O(e.value);i.ObjectUtils.reorderArray(r,s.current,n),f.current=null,!e.isUnstyled()&&i.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!1),e.onChange&&e.onChange({originalEvent:t,value:r})},D=function(e){u.current=!1},E=function(e){if(u.current){var t=m.current.getBoundingClientRect().top+i.DomHandler.getWindowScrollTop(),n=t+m.current.clientHeight-e.pageY,r=e.pageY-t;n<25&&n>0?m.current.scrollTop+=15:r<25&&r>0&&(m.current.scrollTop-=15)}},w=function(e){13===e.which&&e.preventDefault()},x=function(e,t){var r=n({className:l("droppoint"),onDragOver:function(t){return y(t,e+1)},onDragLeave:h,onDrop:I},a("droppoint"));return v.createElement("li",L({key:t},r))};v.useImperativeHandle(t,(function(){return{getElement:function(){return m.current}}}));var S,j,C,N=(S=n({className:l("header")},a("header")),e.header?v.createElement("div",S,e.header):null),U=function(){var t=n({className:l("icon")},a("icon")),r=i.IconUtils.getJSXIcon(e.filterIcon||v.createElement(d.SearchIcon,t),H({},t),{props:e});if(e.filter){var o=n({className:l("filter")},a("filter")),c=n({type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:w,placeholder:e.placeholder,className:l("filterInput")},a("filterInput")),u=n({className:l("filterIcon")},a("filterIcon")),s=v.createElement("div",o,v.createElement("input",c),v.createElement("span",u,r));if(e.filterTemplate)s=i.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:w},filterOptions:g,iconClassName:"p-orderlist-filter-icon",element:s,props:e});var p=n({className:l("filterContainer")},a("filterContainer"));return v.createElement("div",p,s)}return null}(),B=(j=e.value?e.value.map((function(t,r){var o=e.itemTemplate?e.itemTemplate(t):t,a=e.parentId+"_"+r,d=e.focused&&e.focusedOptionId===a,f=b(t);if(e.dragdrop){var m=n({id:a,role:"option",draggable:"true",onClick:function(n){return e.onItemClick({originalEvent:n,value:t,index:r})},onMouseDown:e.onOptionMouseDown,onDragStart:function(e){return t=r,e.dataTransfer.setData("text","orderlist"),u.current=!0,void(s.current=t);var t},onDragEnd:D,className:i.classNames(e.className,l("item",{selected:f,focused:d})),"aria-selected":f,"data-p-highlight":f,"data-p-focused":d},c(t,"item")),g=[];return 0===r&&g.push(x(t,r)),g.push(v.createElement("li",L({key:a},m),o)),g.push(x(r,a+"_droppoint")),g}var y=n({id:a,role:"option",onClick:function(n){return e.onItemClick({originalEvent:n,value:t,index:r})},onMouseDown:e.onOptionMouseDown,className:i.classNames(e.className,l("item",{selected:f,focused:d})),"aria-selected":f,"data-p-highlight":f,"data-p-focused":d},c(t,"item"));return v.createElement("li",L({key:a},y),o,v.createElement(p.Ripple,null))})):null,C=n({ref:m,className:l("list"),style:e.listStyle,onDragOver:E,role:"listbox",onFocus:e.onListFocus,onBlur:e.onListBlur,onKeyDown:e.onListKeyDown,tabIndex:e.tabIndex,"aria-activedescendant":e.focused?e.focusedOptionId:null,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-multiselectable":!0},a("list")),v.createElement("ul",C,j)),k=n({className:l("container")},a("container"));return v.createElement("div",k,N,U,B)})));K.displayName="OrderListSubList";var T=v.memo(v.forwardRef((function(e,t){var l=o.useMergeProps(),a=v.useContext(n.PrimeReactContext),c=j.getProps(e,a),u=S(v.useState([]),2),s=u[0],d=u[1],p=S(v.useState(""),2),f=p[0],m=p[1],b=S(v.useState(null),2),y=b[0],h=b[1],I=S(v.useState(!1),2),D=I[0],E=I[1],w=S(v.useState(null),2),x=w[0],L=w[1],N=S(v.useState(-1),2),U=N[0],B=N[1],k=i.ObjectUtils.isNotEmpty(f),H=v.useRef(null),T=v.useRef(null),P=v.useRef(null),M=v.useRef(null),A={props:c,state:{selection:s,filterValue:f,attributeSelector:y}},R=j.setMetaData(A),F=R.ptm,_=R.cx,V=R.isUnstyled;r.useHandleStyle(j.css.styles,V,{name:"orderlist"});var Y=function(){if(k){var e=f.trim().toLocaleLowerCase(c.filterLocale),t=c.filterBy?c.filterBy.split(","):[];return n.FilterService.filter(c.value,t,e,c.filterMatchMode,c.filterLocale)}return c.value}(),J=function(){return M.current&&M.current.getElement()},X=function(e){var t=e.originalEvent,n=e.value,r=e.index,o=i.ObjectUtils.findIndexInList(n,s),l=J(),a=i.DomHandler.find(l,'[data-pc-section="item"]')[r].getAttribute("id");B(a);var c,u=t.metaKey||t.ctrlKey;c=-1!==o?u?s.filter((function(e,t){return t!==o})):[n]:u?[].concat(O(s),[n]):[n],d(c)},q=function(e){var t=Y[e],n=-1!==i.ObjectUtils.findIndexInList(t,s);d(n?s.filter((function(e){return e!==t})):[].concat(O(s),[t]))},z=function(e){var t=ee(U);ne(t),e.shiftKey&&q(t),e.preventDefault()},W=function(e){var t=te(U);ne(t),e.shiftKey&&q(t),e.preventDefault()},$=function(e){if(e.ctrlKey&&e.shiftKey){var t=J(),n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));d(O(Y).slice(0,o+1))}else ne(0);e.preventDefault()},G=function(e){var t=J();if(e.ctrlKey&&e.shiftKey){var n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));d(O(Y).slice(o,n.length))}else ne(i.DomHandler.find(t,'[data-pc-section="item"]').length-1);e.preventDefault()},Q=function(e){var t=J(),n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));X({originalEvent:e,value:Y[o],index:o}),e.preventDefault()},Z=function(e){e.preventDefault();var t=J();if(e.shiftKey&&s&&s.length>0){var n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.ObjectUtils.findIndexInList(s[0],O(Y)),o=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),l=O(n).findIndex((function(e){return e===o}));d(O(Y).slice(Math.min(r,l),Math.max(r,l)+1))}else Q(e)},ee=function(e){var t=J(),n=O(i.DomHandler.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n+1:0},te=function(e){var t=J(),n=O(i.DomHandler.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n-1:0},ne=function(e){var t=J(),n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=e>=n.length?n.length-1:e<0?0:e,o=n[r]?n[r].getAttribute("id"):-1;B(o),re(o)},re=function(e){var t=J(),n=i.DomHandler.findSingle(t,'[data-pc-section="item"][id="'.concat(e,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},oe=function(){if(!T.current){T.current=i.DomHandler.createInlineStyle(a&&a.nonce||g.default.nonce,a&&a.styleContainer);var e="\n@media screen and (max-width: ".concat(c.breakpoint,") {\n .p-orderlist[").concat(y,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");T.current.innerHTML=e}};v.useImperativeHandle(t,(function(){return{props:c,getElement:function(){return H.current}}})),o.useMountEffect((function(){!y&&h(i.UniqueComponentId())})),o.useUpdateEffect((function(){return y&&(H.current.setAttribute(y,""),oe()),function(){T.current=i.DomHandler.removeInlineStyle(T.current)}}),[y,c.breakpoint]),o.useUpdateEffect((function(){L(-1!==U?U:null)}),[U]),o.useUpdateEffect((function(){P.current&&(P.current=null)}));var ie=l({ref:H,id:c.id,className:i.classNames(c.className,_("root")),style:c.style},j.getOtherProps(c),F("root"));return v.createElement("div",ie,v.createElement(C,{hostName:"OrderList",value:Y,selection:s,onReorder:function(e){c.onChange&&c.onChange({event:e.originalEvent,value:e.value}),P.current=e.direction},dataKey:c.dataKey,moveUpIcon:c.moveUpIcon,moveTopIcon:c.moveTopIcon,moveDownIcon:c.moveDownIcon,moveBottomIcon:c.moveBottomIcon,ptm:F,cx:_,unstyled:c.unstyled,metaData:A}),v.createElement(K,{ref:M,hostName:"OrderList",focused:D,ariaLabel:c.ariaLabel,ariaLabelledBy:c.ariaLabelledBy,value:Y,selection:s,onItemClick:X,onOptionMouseDown:function(e){E(!0),B(e)},focusedOptionId:x,onListKeyDown:function(e){switch(e.code){case"ArrowDown":z(e);break;case"ArrowUp":W(e);break;case"Home":$(e);break;case"End":G(e);break;case"Enter":case"NumpadEnter":Q(e);break;case"Space":Z(e);break;case"KeyA":e.ctrlKey&&(d(Y),e.preventDefault())}},onListFocus:function(e){var t=J(),n=i.DomHandler.findSingle(t,'[data-p-highlight="true"]')||i.DomHandler.findSingle(t,'[data-pc-section="item"]'),r=t&&t.children?O(t.children):[];if(n&&r.length>0){var o=i.ObjectUtils.findIndexInList(n,r);E(!0),ne(-1!==U?U:n?o:-1),c.onFocus&&c.onFocus(e)}},onListBlur:function(e){E(!1),B(-1),c.onBlur&&c.onBlur(e)},onFilterInputChange:function(e){var t=e.target.value;m(t),c.onFilter&&c.onFilter({originalEvent:e,filter:t})},itemTemplate:c.itemTemplate,filter:c.filter,onFilter:function(e){var t=e.target.value;m(t),c.onFilter&&c.onFilter({originalEvent:e,value:t})},resetFilter:function(){m(""),c.onFilter&&c.onFilter({filter:""})},filterTemplate:c.filterTemplate,header:c.header,parentId:y,listStyle:c.listStyle,dataKey:c.dataKey,dragdrop:c.dragdrop,onChange:c.onChange,tabIndex:c.tabIndex,filterIcon:c.filterIcon,isUnstyled:V,ptm:F,cx:_}))})));return T.displayName="OrderList",e.OrderList=T,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.utils,primereact.button,primereact.icons.angledoubledown,primereact.icons.angledoubleup,primereact.icons.angledown,primereact.icons.angleup,primereact.icons.search,primereact.ripple);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.orderlist=function(e,t,n,r,o,i,l,a,c,u,s,d,p){"use strict";function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var v=m(t),b=f(n);function g(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 y(e){if(Array.isArray(e))return g(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(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 D(){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 O(e){return y(e)||h(e)||I(e)||D()}function E(e){if(Array.isArray(e))return e}function w(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return a}}function x(){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 S(e,t){return E(e)||w(e,t)||I(e,t)||x()}var j=r.ComponentBase.extend({defaultProps:{__TYPE:"OrderList",id:null,ariaLabel:null,ariaLabelledBy:null,value:null,header:null,style:null,className:null,listStyle:null,dragdrop:!1,tabIndex:0,filterIcon:null,moveUpIcon:null,moveTopIcon:null,moveDownIcon:null,moveBottomIcon:null,dataKey:null,autoOptionFocus:!0,breakpoint:"960px",onChange:null,itemTemplate:null,filter:!1,filterBy:null,filterMatchMode:"contains",filterLocale:void 0,filterPlaceholder:null,filterTemplate:null,onFilter:null,children:void 0},css:{classes:{root:"p-orderlist p-component",controls:"p-orderlist-controls",droppoint:"p-orderlist-droppoint",header:"p-orderlist-header",list:"p-orderlist-list",icon:"p-orderlist-filter",filter:"p-orderlist-filter",filterInput:"p-orderlist-filter-input p-inputtext p-component",filterIcon:"p-orderlist-filter-icon",filterContainer:"p-orderlist-filter-container",container:"p-orderlist-list-container",item:function(e){return i.classNames("p-orderlist-item",{"p-highlight":e.selected,"p-focus":e.focused})}},styles:"\n@layer primereact {\n .p-orderlist {\n display: flex;\n }\n\n .p-orderlist-controls {\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n .p-orderlist-list-container {\n flex: 1 1 auto;\n }\n\n .p-orderlist-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n overflow: auto;\n min-height: 12rem;\n max-height: 24rem;\n }\n\n .p-orderlist-item {\n cursor: pointer;\n overflow: hidden;\n position: relative;\n }\n\n .p-orderlist-filter {\n position: relative;\n }\n\n .p-orderlist-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n\n .p-orderlist-filter-input {\n width: 100%;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-item,\n .p-orderlist.p-state-disabled .p-button {\n cursor: default;\n }\n\n .p-orderlist.p-state-disabled .p-orderlist-list {\n overflow: hidden;\n }\n\n .p-orderlist .p-orderlist-droppoint {\n height: 0.5rem;\n }\n\n .p-orderlist .p-orderlist-droppoint.p-orderlist-droppoint-highlight {\n background: var(--primary-color);\n }\n}\n"}});function L(){return L=Object.assign?Object.assign.bind():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},L.apply(this,arguments)}var C=v.memo((function(e){var t=o.useMergeProps(),r=e.moveUpIcon||v.createElement(s.AngleUpIcon,null),d=e.moveTopIcon||v.createElement(c.AngleDoubleUpIcon,null),p=e.moveDownIcon||v.createElement(u.AngleDownIcon,null),f=e.moveBottomIcon||v.createElement(a.AngleDoubleDownIcon,null),m=e.ptm,b=e.cx,g=e.unstyled,y=i.ObjectUtils.isEmpty(e.value)||i.ObjectUtils.isEmpty(e.selection),h=t({className:b("controls")},m("controls",{hostName:e.hostName})),I=t({type:"button",unstyled:g,icon:r,onClick:function(t){if(e.selection){for(var n=O(e.value),r=0;r<e.selection.length;r++){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(0===o)break;var l=n[o-1];n[o-1]=n[o],n[o]=l}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"up"})}},disabled:y,"aria-label":n.ariaLabel("moveUp"),__parentMetadata:{parent:e.metaData}},m("moveUpButton")),D=t({type:"button",unstyled:g,icon:d,onClick:function(t){if(e.selection){for(var n=O(e.value),r=e.selection.length-1;r>=0;r--){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(0===o)break;var l=n.splice(o,1)[0];n.unshift(l)}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"top"})}},disabled:y,"aria-label":n.ariaLabel("moveTop"),__parentMetadata:{parent:e.metaData}},m("moveTopButton")),E=t({type:"button",unstyled:g,icon:p,onClick:function(t){if(e.selection){for(var n=O(e.value),r=e.selection.length-1;r>=0;r--){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(o===n.length-1)break;var l=n[o+1];n[o+1]=n[o],n[o]=l}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"down"})}},disabled:y,"aria-label":n.ariaLabel("moveDown"),__parentMetadata:{parent:e.metaData}},m("moveDownButton")),w=t({type:"button",unstyled:g,icon:f,onClick:function(t){if(e.selection){for(var n=O(e.value),r=0;r<e.selection.length;r++){var o=i.ObjectUtils.findIndexInList(e.selection[r],n,e.dataKey);if(o===n.length-1)break;var l=n.splice(o,1)[0];n.push(l)}e.onReorder&&e.onReorder({originalEvent:t,value:n,direction:"bottom"})}},disabled:y,"aria-label":n.ariaLabel("moveBottom"),__parentMetadata:{parent:e.metaData}},m("moveBottomButton"));return v.createElement("div",h,v.createElement(l.Button,L({pt:m("moveUpButton")},I)),v.createElement(l.Button,L({pt:m("moveTopButton")},D)),v.createElement(l.Button,L({pt:m("moveDownButton")},E)),v.createElement(l.Button,L({pt:m("moveBottomButton")},w)))}));function N(e){return N="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},N(e)}function U(e,t){if("object"!==N(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function B(e){var t=U(e,"string");return"symbol"===N(t)?t:String(t)}function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach((function(t){var r,o,i;r=e,i=n[t],(o=B(o=t))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}C.displayName="OrderListControls";var K=v.memo(v.forwardRef((function(e,t){var n=o.useMergeProps(),r=e.ptm,l=e.cx,a=function(t,n){return r(t,H({hostName:e.hostName},n))},c=function(e,t){return a(t,{context:{selected:g(e)}})},u=v.useRef(null),s=v.useRef(null),f=v.useRef(null),m=v.useRef(null),b={filter:function(t){return e.onFilterInputChange(t)},reset:function(){return e.resetFilter()}},g=function(t){return-1!==i.ObjectUtils.findIndexInList(t,e.selection,e.dataKey)},y=function(t,n){s.current!==n&&s.current+1!==n&&(f.current=n,!e.isUnstyled()&&i.DomHandler.addClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!0),t.preventDefault())},h=function(t){f.current=null,!e.isUnstyled()&&i.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!1)},I=function(t){var n=s.current>f.current?f.current:0===f.current?0:f.current-1,r=O(e.value);i.ObjectUtils.reorderArray(r,s.current,n),f.current=null,!e.isUnstyled()&&i.DomHandler.removeClass(t.target,"p-orderlist-droppoint-highlight"),t.target.setAttribute("data-p-orderlist-droppoint-highlight",!1),e.onChange&&e.onChange({originalEvent:t,value:r})},D=function(e){u.current=!1},E=function(e){if(u.current){var t=m.current.getBoundingClientRect().top+i.DomHandler.getWindowScrollTop(),n=t+m.current.clientHeight-e.pageY,r=e.pageY-t;n<25&&n>0?m.current.scrollTop+=15:r<25&&r>0&&(m.current.scrollTop-=15)}},w=function(e){13===e.which&&e.preventDefault()},x=function(e,t){var r=n({className:l("droppoint"),onDragOver:function(t){return y(t,e+1)},onDragLeave:h,onDrop:I},a("droppoint"));return v.createElement("li",L({key:t},r))};v.useImperativeHandle(t,(function(){return{getElement:function(){return m.current}}}));var S,j,C,N=(S=n({className:l("header")},a("header")),e.header?v.createElement("div",S,e.header):null),U=function(){var t=n({className:l("icon")},a("icon")),r=i.IconUtils.getJSXIcon(e.filterIcon||v.createElement(d.SearchIcon,t),H({},t),{props:e});if(e.filter){var o=n({className:l("filter")},a("filter")),c=n({type:"text",value:e.filterValue,onChange:e.onFilter,onKeyDown:w,placeholder:e.placeholder,className:l("filterInput")},a("filterInput")),u=n({className:l("filterIcon")},a("filterIcon")),s=v.createElement("div",o,v.createElement("input",c),v.createElement("span",u,r));if(e.filterTemplate)s=i.ObjectUtils.getJSXElement(e.filterTemplate,{className:"p-orderlist-filter",inputProps:{inputClassName:"p-orderlist-filter-input p-inputtext p-component",onChange:e.onFilter,onKeyDown:w},filterOptions:b,iconClassName:"p-orderlist-filter-icon",element:s,props:e});var p=n({className:l("filterContainer")},a("filterContainer"));return v.createElement("div",p,s)}return null}(),B=(j=e.value?e.value.map((function(t,r){var o=e.itemTemplate?e.itemTemplate(t):t,a=e.parentId+"_"+r,d=e.focused&&e.focusedOptionId===a,f=g(t);if(e.dragdrop){var m=n({id:a,role:"option",draggable:"true",onClick:function(n){return e.onItemClick({originalEvent:n,value:t,index:r})},onMouseDown:e.onOptionMouseDown,onDragStart:function(e){return t=r,e.dataTransfer.setData("text","orderlist"),u.current=!0,void(s.current=t);var t},onDragEnd:D,className:i.classNames(e.className,l("item",{selected:f,focused:d})),"aria-selected":f,"data-p-highlight":f,"data-p-focused":d},c(t,"item")),b=[];return 0===r&&b.push(x(t,r)),b.push(v.createElement("li",L({key:a},m),o)),b.push(x(r,a+"_droppoint")),b}var y=n({id:a,role:"option",onClick:function(n){return e.onItemClick({originalEvent:n,value:t,index:r})},onMouseDown:e.onOptionMouseDown,className:i.classNames(e.className,l("item",{selected:f,focused:d})),"aria-selected":f,"data-p-highlight":f,"data-p-focused":d},c(t,"item"));return v.createElement("li",L({key:a},y),o,v.createElement(p.Ripple,null))})):null,C=n({ref:m,className:l("list"),style:e.listStyle,onDragOver:E,role:"listbox",onFocus:e.onListFocus,onBlur:e.onListBlur,onKeyDown:e.onListKeyDown,tabIndex:e.tabIndex,"aria-activedescendant":e.focused?e.focusedOptionId:null,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-multiselectable":!0},a("list")),v.createElement("ul",C,j)),k=n({className:l("container")},a("container"));return v.createElement("div",k,N,U,B)})));K.displayName="OrderListSubList";var T=v.memo(v.forwardRef((function(e,t){var l=o.useMergeProps(),a=v.useContext(n.PrimeReactContext),c=j.getProps(e,a),u=S(v.useState([]),2),s=u[0],d=u[1],p=S(v.useState(""),2),f=p[0],m=p[1],g=S(v.useState(null),2),y=g[0],h=g[1],I=S(v.useState(!1),2),D=I[0],E=I[1],w=S(v.useState(null),2),x=w[0],L=w[1],N=S(v.useState(-1),2),U=N[0],B=N[1],k=i.ObjectUtils.isNotEmpty(f),H=v.useRef(null),T=v.useRef(null),P=v.useRef(null),M=v.useRef(null),A={props:c,state:{selection:s,filterValue:f,attributeSelector:y}},R=j.setMetaData(A),F=R.ptm,_=R.cx,V=R.isUnstyled;r.useHandleStyle(j.css.styles,V,{name:"orderlist"});var Y=function(){if(k){var e=f.trim().toLocaleLowerCase(c.filterLocale),t=c.filterBy?c.filterBy.split(","):[];return n.FilterService.filter(c.value,t,e,c.filterMatchMode,c.filterLocale)}return c.value}(),J=function(){return M.current&&M.current.getElement()},X=function(e){var t=e.originalEvent,n=e.value,r=e.index,o=i.ObjectUtils.findIndexInList(n,s),l=J(),a=i.DomHandler.find(l,'[data-pc-section="item"]')[r].getAttribute("id");B(a);var c,u=t.metaKey||t.ctrlKey;c=-1!==o?u?s.filter((function(e,t){return t!==o})):[n]:u?[].concat(O(s),[n]):[n],d(c)},q=function(e){var t=Y[e],n=-1!==i.ObjectUtils.findIndexInList(t,s);d(n?s.filter((function(e){return e!==t})):[].concat(O(s),[t]))},z=function(e){if(-1===U){var t=e&&e.children?O(e.children):[],n=W(e,t);return c.autoOptionFocus&&-1===n&&(n=$(e,t)),n}return-1},W=function(e,t){if(s.length){var n=i.DomHandler.findSingle(e,'[data-p-highlight="true"]');return i.ObjectUtils.findIndexInList(n,t)}return-1},$=function(e,t){var n=i.DomHandler.findSingle(e,'[data-pc-section="item"]');return i.ObjectUtils.findIndexInList(n,t)},G=function(e){var t=re(U);ie(t),e.shiftKey&&q(t),e.preventDefault()},Q=function(e){var t=oe(U);ie(t),e.shiftKey&&q(t),e.preventDefault()},Z=function(e){if(e.ctrlKey&&e.shiftKey){var t=J(),n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));d(O(Y).slice(0,o+1))}else ie(0);e.preventDefault()},ee=function(e){var t=J();if(e.ctrlKey&&e.shiftKey){var n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));d(O(Y).slice(o,n.length))}else ie(i.DomHandler.find(t,'[data-pc-section="item"]').length-1);e.preventDefault()},te=function(e){var t=J(),n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),o=O(n).findIndex((function(e){return e===r}));X({originalEvent:e,value:Y[o],index:o}),e.preventDefault()},ne=function(e){e.preventDefault();var t=J();if(e.shiftKey&&s&&s.length>0){var n=i.DomHandler.find(t,'[data-pc-section="item"]'),r=i.ObjectUtils.findIndexInList(s[0],O(Y)),o=i.DomHandler.findSingle(t,'[data-pc-section="item"][id='.concat(U,"]")),l=O(n).findIndex((function(e){return e===o}));d(O(Y).slice(Math.min(r,l),Math.max(r,l)+1))}else te(e)},re=function(e){var t=J(),n=O(i.DomHandler.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n+1:0},oe=function(e){var t=J(),n=O(i.DomHandler.find(t,'[data-pc-section="item"]')).findIndex((function(t){return t.id===e}));return n>-1?n-1:0},ie=function(e){var t,n=J(),r=i.DomHandler.find(n,'[data-pc-section="item"]');if(e>=r.length)t=r.length-1;else{if(e<0)return;t=e}var o=r[t]?r[t].getAttribute("id"):-1;B(o),le(o)},le=function(e){var t=J(),n=i.DomHandler.findSingle(t,'[data-pc-section="item"][id="'.concat(e,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},ae=function(){if(!T.current){T.current=i.DomHandler.createInlineStyle(a&&a.nonce||b.default.nonce,a&&a.styleContainer);var e="\n@media screen and (max-width: ".concat(c.breakpoint,") {\n .p-orderlist[").concat(y,"] {\n flex-direction: column;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls {\n padding: var(--content-padding);\n flex-direction: row;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls .p-button {\n margin-right: var(--inline-spacing);\n margin-bottom: 0;\n }\n\n .p-orderlist[").concat(y,"] .p-orderlist-controls .p-button:last-child {\n margin-right: 0;\n }\n}\n");T.current.innerHTML=e}};v.useImperativeHandle(t,(function(){return{props:c,getElement:function(){return H.current}}})),o.useMountEffect((function(){!y&&h(i.UniqueComponentId())})),o.useUpdateEffect((function(){return y&&(H.current.setAttribute(y,""),ae()),function(){T.current=i.DomHandler.removeInlineStyle(T.current)}}),[y,c.breakpoint]),o.useUpdateEffect((function(){L(-1!==U?U:null)}),[U]),o.useUpdateEffect((function(){P.current&&(P.current=null)}));var ce=l({ref:H,id:c.id,className:i.classNames(c.className,_("root")),style:c.style},j.getOtherProps(c),F("root"));return v.createElement("div",ce,v.createElement(C,{hostName:"OrderList",value:Y,selection:s,onReorder:function(e){c.onChange&&c.onChange({event:e.originalEvent,value:e.value}),P.current=e.direction},dataKey:c.dataKey,moveUpIcon:c.moveUpIcon,moveTopIcon:c.moveTopIcon,moveDownIcon:c.moveDownIcon,moveBottomIcon:c.moveBottomIcon,ptm:F,cx:_,unstyled:c.unstyled,metaData:A}),v.createElement(K,{ref:M,hostName:"OrderList",focused:D,ariaLabel:c.ariaLabel,ariaLabelledBy:c.ariaLabelledBy,value:Y,selection:s,onItemClick:X,onOptionMouseDown:function(e){B(e)},focusedOptionId:x,onListKeyDown:function(e){switch(e.code){case"ArrowDown":G(e);break;case"ArrowUp":Q(e);break;case"Home":Z(e);break;case"End":ee(e);break;case"Enter":case"NumpadEnter":te(e);break;case"Space":ne(e);break;case"KeyA":e.ctrlKey&&(d(Y),e.preventDefault())}},onListFocus:function(e){E(!0);var t=J(),n=z(t);ie(n),c.onFocus&&c.onFocus(e)},onListBlur:function(e){E(!1),B(-1),c.onBlur&&c.onBlur(e)},onFilterInputChange:function(e){var t=e.target.value;m(t),c.onFilter&&c.onFilter({originalEvent:e,filter:t})},itemTemplate:c.itemTemplate,filter:c.filter,onFilter:function(e){var t=e.target.value;m(t),c.onFilter&&c.onFilter({originalEvent:e,value:t})},resetFilter:function(){m(""),c.onFilter&&c.onFilter({filter:""})},filterTemplate:c.filterTemplate,header:c.header,parentId:y,listStyle:c.listStyle,dataKey:c.dataKey,dragdrop:c.dragdrop,onChange:c.onChange,tabIndex:c.tabIndex,filterIcon:c.filterIcon,isUnstyled:V,ptm:F,cx:_}))})));return T.displayName="OrderList",e.OrderList=T,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.utils,primereact.button,primereact.icons.angledoubledown,primereact.icons.angledoubleup,primereact.icons.angledown,primereact.icons.angleup,primereact.icons.search,primereact.ripple);
|
|
@@ -241,12 +241,13 @@ var OverlayPanel = /*#__PURE__*/React__namespace.forwardRef(function (inProps, r
|
|
|
241
241
|
_useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
|
|
242
242
|
bindOverlayListener = _useOverlayListener2[0],
|
|
243
243
|
unbindOverlayListener = _useOverlayListener2[1];
|
|
244
|
-
var
|
|
244
|
+
var isCloseOnEscape = visibleState && props.closeOnEscape;
|
|
245
|
+
var overlayPanelDisplayOrder = hooks.useDisplayOrder('overlay-panel', isCloseOnEscape);
|
|
245
246
|
hooks.useGlobalOnEscapeKey({
|
|
246
247
|
callback: function callback() {
|
|
247
248
|
hide();
|
|
248
249
|
},
|
|
249
|
-
when:
|
|
250
|
+
when: isCloseOnEscape && overlayPanelDisplayOrder,
|
|
250
251
|
priority: [hooks.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL, overlayPanelDisplayOrder]
|
|
251
252
|
});
|
|
252
253
|
var isOutsideClicked = function isOutsideClicked(target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("primereact/api"),t=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),a=require("primereact/icons/times"),l=require("primereact/overlayservice"),i=require("primereact/portal"),c=require("primereact/ripple"),u=require("primereact/utils");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var f=s(e),y=p(n);function v(){return v=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},v.apply(this,arguments)}function d(e){return d="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},d(e)}function m(e,n){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function b(e){var n=m(e,"string");return"symbol"===d(n)?n:String(n)}function O(e){if(Array.isArray(e))return e}function g(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,u=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}function h(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function S(e,n){if(e){if("string"==typeof e)return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,n):void 0}}function w(){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 x(e,n){return O(e)||g(e,n)||S(e,n)||w()}var P=t.ComponentBase.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var n=e.context;return u.classNames("p-overlaypanel p-component",e.props.className,{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===y.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===y.default.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function E(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=b(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=f.forwardRef((function(e,p){var s=o.useMergeProps(),d=f.useContext(n.PrimeReactContext),m=P.getProps(e,d),b=x(f.useState(!1),2),O=b[0],g=b[1],h=P.setMetaData({props:m,state:{visible:O}}),S=h.ptm,w=h.cx,j=h.isUnstyled;t.useHandleStyle(P.css.styles,j,{name:"overlaypanel"});var I=f.useRef(""),k=f.useRef(null),D=f.useRef(null),C=f.useRef(!1),A=f.useRef(null),H=f.useRef(null),N=x(o.useOverlayListener({target:D,overlay:k,listener:function(e,n){if(n.valid)switch(n.type){case"outside":m.dismissable&&!C.current&&Y();break;case"resize":case"scroll":case"orientationchange":J()}C.current=!1},when:O}),2),T=N[0],R=N[1],q=o.useDisplayOrder("overlay-panel",O);o.useGlobalOnEscapeKey({callback:function(){Y()},when:O&&m.closeOnEscape&&q,priority:[o.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL,q]});var _=function(e){return k&&k.current&&!(k.current.isSameNode(e)||k.current.contains(e))},L=function(e,n){return null!=D.current&&D.current!==(n||e.currentTarget||e.target)},M=function(){C.current=!0},U=function(e,n){O?(Y(),L(e,n)&&(D.current=n||e.currentTarget||e.target,setTimeout((function(){z(e,D.current)}),200))):z(e,n)},z=function(e,n){D.current=n||e.currentTarget||e.target,O?J():(g(!0),H.current=function(e){!_(e.target)&&(C.current=!0)},l.OverlayService.on("overlay-click",H.current))},Y=function(){g(!1),l.OverlayService.off("overlay-click",H.current),H.current=null},Z=function(){k.current.setAttribute(I.current,""),u.ZIndexUtils.set("overlay",k.current,d&&d.autoZIndex||y.default.autoZIndex,d&&d.zIndex.overlay||y.default.zIndex.overlay),u.DomHandler.addStyles(k.current,{position:"absolute",top:"0",left:"0"}),J()},B=function(){T(),m.onShow&&m.onShow()},G=function(){R()},K=function(){u.ZIndexUtils.clear(k.current),m.onHide&&m.onHide()},J=function(){if(D.current&&k.current){u.DomHandler.absolutePosition(k.current,D.current);var e=u.DomHandler.getOffset(k.current),n=u.DomHandler.getOffset(D.current),t=0;e.left<n.left&&(t=n.left-e.left),k.current.style.setProperty("--overlayArrowLeft","".concat(t,"px")),e.top<n.top?(k.current.setAttribute("data-p-overlaypanel-flipped","true"),j&&u.DomHandler.addClass(k.current,"p-overlaypanel-flipped")):(k.current.setAttribute("data-p-overlaypanel-flipped","false"),j&&u.DomHandler.removeClass(k.current,"p-overlaypanel-flipped"))}},V=function(){if(!A.current){A.current=u.DomHandler.createInlineStyle(d&&d.nonce||y.default.nonce,d&&d.styleContainer);var e="";for(var n in m.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-overlaypanel[").concat(I.current,"] {\n width: ").concat(m.breakpoints[n],";\n }\n }\n ");A.current.innerHTML=e}};o.useMountEffect((function(){I.current=u.UniqueComponentId(),m.breakpoints&&V()})),o.useUnmountEffect((function(){A.current=u.DomHandler.removeInlineStyle(A.current),H.current&&(l.OverlayService.off("overlay-click",H.current),H.current=null),u.ZIndexUtils.clear(k.current)})),f.useImperativeHandle(p,(function(){return{props:m,toggle:U,show:z,hide:Y,align:J,getElement:function(){return k.current}}}));var X,$,F,Q,W=function(){var e=s({className:w("closeIcon"),"aria-hidden":!0},S("closeIcon")),t=u.IconUtils.getJSXIcon(m.closeIcon||f.createElement(a.TimesIcon,e),E({},e),{props:m}),r=m.ariaCloseLabel||n.localeOption("close"),o=s({type:"button",className:w("closeButton"),onClick:function(e){return n=e,Y(),void n.preventDefault();var n},"aria-label":r},S("closeButton"));return m.showCloseIcon?f.createElement("button",o,t,f.createElement(c.Ripple,null)):null},ee=(X=W(),$=s({id:m.id,className:w("root",{context:d}),style:m.style,onClick:function(e){return n=e,C.current=!0,void l.OverlayService.emit("overlay-click",{originalEvent:n,target:D.current});var n}},P.getOtherProps(m),S("root")),F=s({className:w("content"),onClick:function(e){return M()},onMouseDown:M},P.getOtherProps(m),S("content")),Q=s({classNames:w("transition"),in:O,timeout:{enter:120,exit:100},options:m.transitionOptions,unmountOnExit:!0,onEnter:Z,onEntered:B,onExit:G,onExited:K},S("transition")),f.createElement(r.CSSTransition,v({nodeRef:k},Q),f.createElement("div",v({ref:k},$),f.createElement("div",F,m.children),X)));return f.createElement(i.Portal,{element:ee,appendTo:m.appendTo})}));I.displayName="OverlayPanel",exports.OverlayPanel=I;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("primereact/api"),t=require("primereact/componentbase"),r=require("primereact/csstransition"),o=require("primereact/hooks"),a=require("primereact/icons/times"),l=require("primereact/overlayservice"),i=require("primereact/portal"),c=require("primereact/ripple"),u=require("primereact/utils");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var f=s(e),y=p(n);function v(){return v=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},v.apply(this,arguments)}function d(e){return d="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},d(e)}function m(e,n){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function b(e){var n=m(e,"string");return"symbol"===d(n)?n:String(n)}function O(e){if(Array.isArray(e))return e}function g(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,u=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}function h(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function S(e,n){if(e){if("string"==typeof e)return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,n):void 0}}function w(){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 x(e,n){return O(e)||g(e,n)||S(e,n)||w()}var P=t.ComponentBase.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var n=e.context;return u.classNames("p-overlaypanel p-component",e.props.className,{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===y.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===y.default.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function E(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=b(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=f.forwardRef((function(e,p){var s=o.useMergeProps(),d=f.useContext(n.PrimeReactContext),m=P.getProps(e,d),b=x(f.useState(!1),2),O=b[0],g=b[1],h=P.setMetaData({props:m,state:{visible:O}}),S=h.ptm,w=h.cx,j=h.isUnstyled;t.useHandleStyle(P.css.styles,j,{name:"overlaypanel"});var I=f.useRef(""),k=f.useRef(null),D=f.useRef(null),C=f.useRef(!1),A=f.useRef(null),H=f.useRef(null),N=x(o.useOverlayListener({target:D,overlay:k,listener:function(e,n){if(n.valid)switch(n.type){case"outside":m.dismissable&&!C.current&&Z();break;case"resize":case"scroll":case"orientationchange":V()}C.current=!1},when:O}),2),T=N[0],R=N[1],q=O&&m.closeOnEscape,_=o.useDisplayOrder("overlay-panel",q);o.useGlobalOnEscapeKey({callback:function(){Z()},when:q&&_,priority:[o.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL,_]});var L=function(e){return k&&k.current&&!(k.current.isSameNode(e)||k.current.contains(e))},M=function(e,n){return null!=D.current&&D.current!==(n||e.currentTarget||e.target)},U=function(){C.current=!0},z=function(e,n){O?(Z(),M(e,n)&&(D.current=n||e.currentTarget||e.target,setTimeout((function(){Y(e,D.current)}),200))):Y(e,n)},Y=function(e,n){D.current=n||e.currentTarget||e.target,O?V():(g(!0),H.current=function(e){!L(e.target)&&(C.current=!0)},l.OverlayService.on("overlay-click",H.current))},Z=function(){g(!1),l.OverlayService.off("overlay-click",H.current),H.current=null},B=function(){k.current.setAttribute(I.current,""),u.ZIndexUtils.set("overlay",k.current,d&&d.autoZIndex||y.default.autoZIndex,d&&d.zIndex.overlay||y.default.zIndex.overlay),u.DomHandler.addStyles(k.current,{position:"absolute",top:"0",left:"0"}),V()},G=function(){T(),m.onShow&&m.onShow()},K=function(){R()},J=function(){u.ZIndexUtils.clear(k.current),m.onHide&&m.onHide()},V=function(){if(D.current&&k.current){u.DomHandler.absolutePosition(k.current,D.current);var e=u.DomHandler.getOffset(k.current),n=u.DomHandler.getOffset(D.current),t=0;e.left<n.left&&(t=n.left-e.left),k.current.style.setProperty("--overlayArrowLeft","".concat(t,"px")),e.top<n.top?(k.current.setAttribute("data-p-overlaypanel-flipped","true"),j&&u.DomHandler.addClass(k.current,"p-overlaypanel-flipped")):(k.current.setAttribute("data-p-overlaypanel-flipped","false"),j&&u.DomHandler.removeClass(k.current,"p-overlaypanel-flipped"))}},X=function(){if(!A.current){A.current=u.DomHandler.createInlineStyle(d&&d.nonce||y.default.nonce,d&&d.styleContainer);var e="";for(var n in m.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-overlaypanel[").concat(I.current,"] {\n width: ").concat(m.breakpoints[n],";\n }\n }\n ");A.current.innerHTML=e}};o.useMountEffect((function(){I.current=u.UniqueComponentId(),m.breakpoints&&X()})),o.useUnmountEffect((function(){A.current=u.DomHandler.removeInlineStyle(A.current),H.current&&(l.OverlayService.off("overlay-click",H.current),H.current=null),u.ZIndexUtils.clear(k.current)})),f.useImperativeHandle(p,(function(){return{props:m,toggle:z,show:Y,hide:Z,align:V,getElement:function(){return k.current}}}));var $,F,Q,W,ee=function(){var e=s({className:w("closeIcon"),"aria-hidden":!0},S("closeIcon")),t=u.IconUtils.getJSXIcon(m.closeIcon||f.createElement(a.TimesIcon,e),E({},e),{props:m}),r=m.ariaCloseLabel||n.localeOption("close"),o=s({type:"button",className:w("closeButton"),onClick:function(e){return n=e,Z(),void n.preventDefault();var n},"aria-label":r},S("closeButton"));return m.showCloseIcon?f.createElement("button",o,t,f.createElement(c.Ripple,null)):null},ne=($=ee(),F=s({id:m.id,className:w("root",{context:d}),style:m.style,onClick:function(e){return n=e,C.current=!0,void l.OverlayService.emit("overlay-click",{originalEvent:n,target:D.current});var n}},P.getOtherProps(m),S("root")),Q=s({className:w("content"),onClick:function(e){return U()},onMouseDown:U},P.getOtherProps(m),S("content")),W=s({classNames:w("transition"),in:O,timeout:{enter:120,exit:100},options:m.transitionOptions,unmountOnExit:!0,onEnter:B,onEntered:G,onExit:K,onExited:J},S("transition")),f.createElement(r.CSSTransition,v({nodeRef:k},W),f.createElement("div",v({ref:k},F),f.createElement("div",Q,m.children),$)));return f.createElement(i.Portal,{element:ne,appendTo:m.appendTo})}));I.displayName="OverlayPanel",exports.OverlayPanel=I;
|
|
@@ -214,12 +214,13 @@ var OverlayPanel = /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
|
214
214
|
_useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
|
|
215
215
|
bindOverlayListener = _useOverlayListener2[0],
|
|
216
216
|
unbindOverlayListener = _useOverlayListener2[1];
|
|
217
|
-
var
|
|
217
|
+
var isCloseOnEscape = visibleState && props.closeOnEscape;
|
|
218
|
+
var overlayPanelDisplayOrder = useDisplayOrder('overlay-panel', isCloseOnEscape);
|
|
218
219
|
useGlobalOnEscapeKey({
|
|
219
220
|
callback: function callback() {
|
|
220
221
|
hide();
|
|
221
222
|
},
|
|
222
|
-
when:
|
|
223
|
+
when: isCloseOnEscape && overlayPanelDisplayOrder,
|
|
223
224
|
priority: [ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL, overlayPanelDisplayOrder]
|
|
224
225
|
});
|
|
225
226
|
var isOutsideClicked = function isOutsideClicked(target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import n,{PrimeReactContext as t,localeOption as r}from"primereact/api";import{ComponentBase as o,useHandleStyle as a}from"primereact/componentbase";import{CSSTransition as l}from"primereact/csstransition";import{useMergeProps as i,useOverlayListener as c,useDisplayOrder as p,useGlobalOnEscapeKey as u,ESC_KEY_HANDLING_PRIORITIES as s,useMountEffect as f,useUnmountEffect as y}from"primereact/hooks";import{TimesIcon as m}from"primereact/icons/times";import{OverlayService as v}from"primereact/overlayservice";import{Portal as d}from"primereact/portal";import{Ripple as b}from"primereact/ripple";import{classNames as g,DomHandler as h,UniqueComponentId as O,ZIndexUtils as w,IconUtils as x}from"primereact/utils";function S(){return S=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},S.apply(this,arguments)}function j(e){return j="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},j(e)}function E(e,n){if("object"!==j(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function P(e){var n=E(e,"string");return"symbol"===j(n)?n:String(n)}function I(e){if(Array.isArray(e))return e}function k(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,p=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){p=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(p)throw o}}return i}}function A(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function C(e,n){if(e){if("string"==typeof e)return A(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(e,n):void 0}}function N(){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 T(e,n){return I(e)||k(e,n)||C(e,n)||N()}var R=o.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var t=e.context;return g("p-overlaypanel p-component",e.props.className,{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===n.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===n.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function D(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function L(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?D(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=P(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):D(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var z=e.forwardRef((function(o,g){var j=i(),E=e.useContext(t),P=R.getProps(o,E),I=T(e.useState(!1),2),k=I[0],A=I[1],C=R.setMetaData({props:P,state:{visible:k}}),N=C.ptm,D=C.cx,z=C.isUnstyled;a(R.css.styles,z,{name:"overlaypanel"});var H=e.useRef(""),M=e.useRef(null),Y=e.useRef(null),B=e.useRef(!1),_=e.useRef(null),U=e.useRef(null),Z=T(c({target:Y,overlay:M,listener:function(e,n){if(n.valid)switch(n.type){case"outside":P.dismissable&&!B.current&&
|
|
1
|
+
import*as e from"react";import n,{PrimeReactContext as t,localeOption as r}from"primereact/api";import{ComponentBase as o,useHandleStyle as a}from"primereact/componentbase";import{CSSTransition as l}from"primereact/csstransition";import{useMergeProps as i,useOverlayListener as c,useDisplayOrder as p,useGlobalOnEscapeKey as u,ESC_KEY_HANDLING_PRIORITIES as s,useMountEffect as f,useUnmountEffect as y}from"primereact/hooks";import{TimesIcon as m}from"primereact/icons/times";import{OverlayService as v}from"primereact/overlayservice";import{Portal as d}from"primereact/portal";import{Ripple as b}from"primereact/ripple";import{classNames as g,DomHandler as h,UniqueComponentId as O,ZIndexUtils as w,IconUtils as x}from"primereact/utils";function S(){return S=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},S.apply(this,arguments)}function j(e){return j="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},j(e)}function E(e,n){if("object"!==j(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function P(e){var n=E(e,"string");return"symbol"===j(n)?n:String(n)}function I(e){if(Array.isArray(e))return e}function k(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,p=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){p=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(p)throw o}}return i}}function A(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function C(e,n){if(e){if("string"==typeof e)return A(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(e,n):void 0}}function N(){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 T(e,n){return I(e)||k(e,n)||C(e,n)||N()}var R=o.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var t=e.context;return g("p-overlaypanel p-component",e.props.className,{"p-input-filled":t&&"filled"===t.inputStyle||"filled"===n.inputStyle,"p-ripple-disabled":t&&!1===t.ripple||!1===n.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function D(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function L(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?D(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=P(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):D(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var z=e.forwardRef((function(o,g){var j=i(),E=e.useContext(t),P=R.getProps(o,E),I=T(e.useState(!1),2),k=I[0],A=I[1],C=R.setMetaData({props:P,state:{visible:k}}),N=C.ptm,D=C.cx,z=C.isUnstyled;a(R.css.styles,z,{name:"overlaypanel"});var H=e.useRef(""),M=e.useRef(null),Y=e.useRef(null),B=e.useRef(!1),_=e.useRef(null),U=e.useRef(null),Z=T(c({target:Y,overlay:M,listener:function(e,n){if(n.valid)switch(n.type){case"outside":P.dismissable&&!B.current&&W();break;case"resize":case"scroll":case"orientationchange":oe()}B.current=!1},when:k}),2),G=Z[0],J=Z[1],V=k&&P.closeOnEscape,X=p("overlay-panel",V);u({callback:function(){W()},when:V&&X,priority:[s.OVERLAY_PANEL,X]});var $=function(e){return M&&M.current&&!(M.current.isSameNode(e)||M.current.contains(e))},q=function(e,n){return null!=Y.current&&Y.current!==(n||e.currentTarget||e.target)},F=function(){B.current=!0},K=function(e,n){k?(W(),q(e,n)&&(Y.current=n||e.currentTarget||e.target,setTimeout((function(){Q(e,Y.current)}),200))):Q(e,n)},Q=function(e,n){Y.current=n||e.currentTarget||e.target,k?oe():(A(!0),U.current=function(e){!$(e.target)&&(B.current=!0)},v.on("overlay-click",U.current))},W=function(){A(!1),v.off("overlay-click",U.current),U.current=null},ee=function(){M.current.setAttribute(H.current,""),w.set("overlay",M.current,E&&E.autoZIndex||n.autoZIndex,E&&E.zIndex.overlay||n.zIndex.overlay),h.addStyles(M.current,{position:"absolute",top:"0",left:"0"}),oe()},ne=function(){G(),P.onShow&&P.onShow()},te=function(){J()},re=function(){w.clear(M.current),P.onHide&&P.onHide()},oe=function(){if(Y.current&&M.current){h.absolutePosition(M.current,Y.current);var e=h.getOffset(M.current),n=h.getOffset(Y.current),t=0;e.left<n.left&&(t=n.left-e.left),M.current.style.setProperty("--overlayArrowLeft","".concat(t,"px")),e.top<n.top?(M.current.setAttribute("data-p-overlaypanel-flipped","true"),z&&h.addClass(M.current,"p-overlaypanel-flipped")):(M.current.setAttribute("data-p-overlaypanel-flipped","false"),z&&h.removeClass(M.current,"p-overlaypanel-flipped"))}},ae=function(){if(!_.current){_.current=h.createInlineStyle(E&&E.nonce||n.nonce,E&&E.styleContainer);var e="";for(var t in P.breakpoints)e+="\n @media screen and (max-width: ".concat(t,") {\n .p-overlaypanel[").concat(H.current,"] {\n width: ").concat(P.breakpoints[t],";\n }\n }\n ");_.current.innerHTML=e}};f((function(){H.current=O(),P.breakpoints&&ae()})),y((function(){_.current=h.removeInlineStyle(_.current),U.current&&(v.off("overlay-click",U.current),U.current=null),w.clear(M.current)})),e.useImperativeHandle(g,(function(){return{props:P,toggle:K,show:Q,hide:W,align:oe,getElement:function(){return M.current}}}));var le,ie,ce,pe,ue=function(){var n=j({className:D("closeIcon"),"aria-hidden":!0},N("closeIcon")),t=x.getJSXIcon(P.closeIcon||e.createElement(m,n),L({},n),{props:P}),o=P.ariaCloseLabel||r("close"),a=j({type:"button",className:D("closeButton"),onClick:function(e){return n=e,W(),void n.preventDefault();var n},"aria-label":o},N("closeButton"));return P.showCloseIcon?e.createElement("button",a,t,e.createElement(b,null)):null},se=(le=ue(),ie=j({id:P.id,className:D("root",{context:E}),style:P.style,onClick:function(e){return n=e,B.current=!0,void v.emit("overlay-click",{originalEvent:n,target:Y.current});var n}},R.getOtherProps(P),N("root")),ce=j({className:D("content"),onClick:function(e){return F()},onMouseDown:F},R.getOtherProps(P),N("content")),pe=j({classNames:D("transition"),in:k,timeout:{enter:120,exit:100},options:P.transitionOptions,unmountOnExit:!0,onEnter:ee,onEntered:ne,onExit:te,onExited:re},N("transition")),e.createElement(l,S({nodeRef:M},pe),e.createElement("div",S({ref:M},ie),e.createElement("div",ce,P.children),le)));return e.createElement(d,{element:se,appendTo:P.appendTo})}));z.displayName="OverlayPanel";export{z as OverlayPanel};
|
|
@@ -229,12 +229,13 @@ this.primereact.overlaypanel = (function (exports, React, PrimeReact, componentb
|
|
|
229
229
|
_useOverlayListener2 = _slicedToArray(_useOverlayListener, 2),
|
|
230
230
|
bindOverlayListener = _useOverlayListener2[0],
|
|
231
231
|
unbindOverlayListener = _useOverlayListener2[1];
|
|
232
|
-
var
|
|
232
|
+
var isCloseOnEscape = visibleState && props.closeOnEscape;
|
|
233
|
+
var overlayPanelDisplayOrder = hooks.useDisplayOrder('overlay-panel', isCloseOnEscape);
|
|
233
234
|
hooks.useGlobalOnEscapeKey({
|
|
234
235
|
callback: function callback() {
|
|
235
236
|
hide();
|
|
236
237
|
},
|
|
237
|
-
when:
|
|
238
|
+
when: isCloseOnEscape && overlayPanelDisplayOrder,
|
|
238
239
|
priority: [hooks.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL, overlayPanelDisplayOrder]
|
|
239
240
|
});
|
|
240
241
|
var isOutsideClicked = function isOutsideClicked(target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.overlaypanel=function(e,n,t,r,o,a,l,i,c,u,p){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var y=f(n),v=s(t);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},d.apply(this,arguments)}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(e,n){if("object"!==m(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function O(e){var n=b(e,"string");return"symbol"===m(n)?n:String(n)}function g(e){if(Array.isArray(e))return e}function h(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,u=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}function S(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function w(e,n){if(e){if("string"==typeof e)return S(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(e,n):void 0}}function x(){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 P(e,n){return g(e)||h(e,n)||w(e,n)||x()}var j=r.ComponentBase.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var n=e.context;return p.classNames("p-overlaypanel p-component",e.props.className,{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===v.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===v.default.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function E(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function I(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=O(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var k=y.forwardRef((function(e,n){var s=a.useMergeProps(),f=y.useContext(t.PrimeReactContext),m=j.getProps(e,f),b=P(y.useState(!1),2),O=b[0],g=b[1],h=j.setMetaData({props:m,state:{visible:O}}),S=h.ptm,w=h.cx,x=h.isUnstyled;r.useHandleStyle(j.css.styles,x,{name:"overlaypanel"});var E=y.useRef(""),k=y.useRef(null),D=y.useRef(null),C=y.useRef(!1),A=y.useRef(null),H=y.useRef(null),N=P(a.useOverlayListener({target:D,overlay:k,listener:function(e,n){if(n.valid)switch(n.type){case"outside":m.dismissable&&!C.current&&Z();break;case"resize":case"scroll":case"orientationchange":J()}C.current=!1},when:O}),2),R=N[0],T=N[1],_=a.useDisplayOrder("overlay-panel",O);a.useGlobalOnEscapeKey({callback:function(){Z()},when:O&&m.closeOnEscape&&_,priority:[a.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL,_]});var L=function(e){return k&&k.current&&!(k.current.isSameNode(e)||k.current.contains(e))},M=function(e,n){return null!=D.current&&D.current!==(n||e.currentTarget||e.target)},U=function(){C.current=!0},z=function(e,n){O?(Z(),M(e,n)&&(D.current=n||e.currentTarget||e.target,setTimeout((function(){Y(e,D.current)}),200))):Y(e,n)},Y=function(e,n){D.current=n||e.currentTarget||e.target,O?J():(g(!0),H.current=function(e){!L(e.target)&&(C.current=!0)},i.OverlayService.on("overlay-click",H.current))},Z=function(){g(!1),i.OverlayService.off("overlay-click",H.current),H.current=null},B=function(){k.current.setAttribute(E.current,""),p.ZIndexUtils.set("overlay",k.current,f&&f.autoZIndex||v.default.autoZIndex,f&&f.zIndex.overlay||v.default.zIndex.overlay),p.DomHandler.addStyles(k.current,{position:"absolute",top:"0",left:"0"}),J()},G=function(){R(),m.onShow&&m.onShow()},K=function(){T()},q=function(){p.ZIndexUtils.clear(k.current),m.onHide&&m.onHide()},J=function(){if(D.current&&k.current){p.DomHandler.absolutePosition(k.current,D.current);var e=p.DomHandler.getOffset(k.current),n=p.DomHandler.getOffset(D.current),t=0;e.left<n.left&&(t=n.left-e.left),k.current.style.setProperty("--overlayArrowLeft","".concat(t,"px")),e.top<n.top?(k.current.setAttribute("data-p-overlaypanel-flipped","true"),x&&p.DomHandler.addClass(k.current,"p-overlaypanel-flipped")):(k.current.setAttribute("data-p-overlaypanel-flipped","false"),x&&p.DomHandler.removeClass(k.current,"p-overlaypanel-flipped"))}},V=function(){if(!A.current){A.current=p.DomHandler.createInlineStyle(f&&f.nonce||v.default.nonce,f&&f.styleContainer);var e="";for(var n in m.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-overlaypanel[").concat(E.current,"] {\n width: ").concat(m.breakpoints[n],";\n }\n }\n ");A.current.innerHTML=e}};a.useMountEffect((function(){E.current=p.UniqueComponentId(),m.breakpoints&&V()})),a.useUnmountEffect((function(){A.current=p.DomHandler.removeInlineStyle(A.current),H.current&&(i.OverlayService.off("overlay-click",H.current),H.current=null),p.ZIndexUtils.clear(k.current)})),y.useImperativeHandle(n,(function(){return{props:m,toggle:z,show:Y,hide:Z,align:J,getElement:function(){return k.current}}}));var X,$,F,Q,W=function(){var e=s({className:w("closeIcon"),"aria-hidden":!0},S("closeIcon")),n=p.IconUtils.getJSXIcon(m.closeIcon||y.createElement(l.TimesIcon,e),I({},e),{props:m}),r=m.ariaCloseLabel||t.localeOption("close"),o=s({type:"button",className:w("closeButton"),onClick:function(e){return n=e,Z(),void n.preventDefault();var n},"aria-label":r},S("closeButton"));return m.showCloseIcon?y.createElement("button",o,n,y.createElement(u.Ripple,null)):null},ee=(X=W(),$=s({id:m.id,className:w("root",{context:f}),style:m.style,onClick:function(e){return n=e,C.current=!0,void i.OverlayService.emit("overlay-click",{originalEvent:n,target:D.current});var n}},j.getOtherProps(m),S("root")),F=s({className:w("content"),onClick:function(e){return U()},onMouseDown:U},j.getOtherProps(m),S("content")),Q=s({classNames:w("transition"),in:O,timeout:{enter:120,exit:100},options:m.transitionOptions,unmountOnExit:!0,onEnter:B,onEntered:G,onExit:K,onExited:q},S("transition")),y.createElement(o.CSSTransition,d({nodeRef:k},Q),y.createElement("div",d({ref:k},$),y.createElement("div",F,m.children),X)));return y.createElement(c.Portal,{element:ee,appendTo:m.appendTo})}));return k.displayName="OverlayPanel",e.OverlayPanel=k,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.csstransition,primereact.hooks,primereact.icons.times,primereact.overlayservice,primereact.portal,primereact.ripple,primereact.utils);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.overlaypanel=function(e,n,t,r,o,a,l,i,c,u,p){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function f(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var y=f(n),v=s(t);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},d.apply(this,arguments)}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function b(e,n){if("object"!==m(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function O(e){var n=b(e,"string");return"symbol"===m(n)?n:String(n)}function g(e){if(Array.isArray(e))return e}function h(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a,l,i=[],c=!0,u=!1;try{if(a=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=a.call(t)).done)&&(i.push(r.value),i.length!==n);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=t.return&&(l=t.return(),Object(l)!==l))return}finally{if(u)throw o}}return i}}function S(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function w(e,n){if(e){if("string"==typeof e)return S(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(e,n):void 0}}function x(){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 P(e,n){return g(e)||h(e,n)||w(e,n)||x()}var j=r.ComponentBase.extend({defaultProps:{__TYPE:"OverlayPanel",id:null,dismissable:!0,showCloseIcon:!1,closeIcon:null,style:null,className:null,appendTo:null,breakpoints:null,ariaCloseLabel:null,transitionOptions:null,onShow:null,onHide:null,children:void 0,closeOnEscape:!0},css:{classes:{root:function(e){var n=e.context;return p.classNames("p-overlaypanel p-component",e.props.className,{"p-input-filled":n&&"filled"===n.inputStyle||"filled"===v.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===v.default.ripple})},closeIcon:"p-overlaypanel-close-icon",closeButton:"p-overlaypanel-close p-link",content:"p-overlaypanel-content",transition:"p-overlaypanel"},styles:'\n@layer primereact {\n .p-overlaypanel {\n position: absolute;\n margin-top: 10px;\n /* Github #3122: Prevent animation flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-overlaypanel-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n }\n \n .p-overlaypanel-close {\n display: flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n }\n \n /* Animation */\n .p-overlaypanel-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n \n .p-overlaypanel-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n \n .p-overlaypanel-enter-done {\n transform: none;\n }\n \n .p-overlaypanel-exit {\n opacity: 1;\n }\n \n .p-overlaypanel-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n \n .p-overlaypanel:after, .p-overlaypanel:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n }\n \n .p-overlaypanel:after {\n border-width: 8px;\n margin-left: -8px;\n }\n \n .p-overlaypanel:before {\n border-width: 10px;\n margin-left: -10px;\n }\n \n .p-overlaypanel-flipped:after, .p-overlaypanel-flipped:before {\n bottom: auto;\n top: 100%;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:after {\n border-bottom-color: transparent;\n }\n \n .p-overlaypanel.p-overlaypanel-flipped:before {\n border-bottom-color: transparent\n }\n}\n'}});function E(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function I(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?E(Object(t),!0).forEach((function(n){var r,o,a;r=e,a=t[n],(o=O(o=n))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):E(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var k=y.forwardRef((function(e,n){var s=a.useMergeProps(),f=y.useContext(t.PrimeReactContext),m=j.getProps(e,f),b=P(y.useState(!1),2),O=b[0],g=b[1],h=j.setMetaData({props:m,state:{visible:O}}),S=h.ptm,w=h.cx,x=h.isUnstyled;r.useHandleStyle(j.css.styles,x,{name:"overlaypanel"});var E=y.useRef(""),k=y.useRef(null),D=y.useRef(null),C=y.useRef(!1),A=y.useRef(null),H=y.useRef(null),N=P(a.useOverlayListener({target:D,overlay:k,listener:function(e,n){if(n.valid)switch(n.type){case"outside":m.dismissable&&!C.current&&B();break;case"resize":case"scroll":case"orientationchange":V()}C.current=!1},when:O}),2),R=N[0],T=N[1],_=O&&m.closeOnEscape,L=a.useDisplayOrder("overlay-panel",_);a.useGlobalOnEscapeKey({callback:function(){B()},when:_&&L,priority:[a.ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL,L]});var M=function(e){return k&&k.current&&!(k.current.isSameNode(e)||k.current.contains(e))},U=function(e,n){return null!=D.current&&D.current!==(n||e.currentTarget||e.target)},z=function(){C.current=!0},Y=function(e,n){O?(B(),U(e,n)&&(D.current=n||e.currentTarget||e.target,setTimeout((function(){Z(e,D.current)}),200))):Z(e,n)},Z=function(e,n){D.current=n||e.currentTarget||e.target,O?V():(g(!0),H.current=function(e){!M(e.target)&&(C.current=!0)},i.OverlayService.on("overlay-click",H.current))},B=function(){g(!1),i.OverlayService.off("overlay-click",H.current),H.current=null},G=function(){k.current.setAttribute(E.current,""),p.ZIndexUtils.set("overlay",k.current,f&&f.autoZIndex||v.default.autoZIndex,f&&f.zIndex.overlay||v.default.zIndex.overlay),p.DomHandler.addStyles(k.current,{position:"absolute",top:"0",left:"0"}),V()},K=function(){R(),m.onShow&&m.onShow()},q=function(){T()},J=function(){p.ZIndexUtils.clear(k.current),m.onHide&&m.onHide()},V=function(){if(D.current&&k.current){p.DomHandler.absolutePosition(k.current,D.current);var e=p.DomHandler.getOffset(k.current),n=p.DomHandler.getOffset(D.current),t=0;e.left<n.left&&(t=n.left-e.left),k.current.style.setProperty("--overlayArrowLeft","".concat(t,"px")),e.top<n.top?(k.current.setAttribute("data-p-overlaypanel-flipped","true"),x&&p.DomHandler.addClass(k.current,"p-overlaypanel-flipped")):(k.current.setAttribute("data-p-overlaypanel-flipped","false"),x&&p.DomHandler.removeClass(k.current,"p-overlaypanel-flipped"))}},X=function(){if(!A.current){A.current=p.DomHandler.createInlineStyle(f&&f.nonce||v.default.nonce,f&&f.styleContainer);var e="";for(var n in m.breakpoints)e+="\n @media screen and (max-width: ".concat(n,") {\n .p-overlaypanel[").concat(E.current,"] {\n width: ").concat(m.breakpoints[n],";\n }\n }\n ");A.current.innerHTML=e}};a.useMountEffect((function(){E.current=p.UniqueComponentId(),m.breakpoints&&X()})),a.useUnmountEffect((function(){A.current=p.DomHandler.removeInlineStyle(A.current),H.current&&(i.OverlayService.off("overlay-click",H.current),H.current=null),p.ZIndexUtils.clear(k.current)})),y.useImperativeHandle(n,(function(){return{props:m,toggle:Y,show:Z,hide:B,align:V,getElement:function(){return k.current}}}));var $,F,Q,W,ee=function(){var e=s({className:w("closeIcon"),"aria-hidden":!0},S("closeIcon")),n=p.IconUtils.getJSXIcon(m.closeIcon||y.createElement(l.TimesIcon,e),I({},e),{props:m}),r=m.ariaCloseLabel||t.localeOption("close"),o=s({type:"button",className:w("closeButton"),onClick:function(e){return n=e,B(),void n.preventDefault();var n},"aria-label":r},S("closeButton"));return m.showCloseIcon?y.createElement("button",o,n,y.createElement(u.Ripple,null)):null},ne=($=ee(),F=s({id:m.id,className:w("root",{context:f}),style:m.style,onClick:function(e){return n=e,C.current=!0,void i.OverlayService.emit("overlay-click",{originalEvent:n,target:D.current});var n}},j.getOtherProps(m),S("root")),Q=s({className:w("content"),onClick:function(e){return z()},onMouseDown:z},j.getOtherProps(m),S("content")),W=s({classNames:w("transition"),in:O,timeout:{enter:120,exit:100},options:m.transitionOptions,unmountOnExit:!0,onEnter:G,onEntered:K,onExit:q,onExited:J},S("transition")),y.createElement(o.CSSTransition,d({nodeRef:k},W),y.createElement("div",d({ref:k},F),y.createElement("div",Q,m.children),$)));return y.createElement(c.Portal,{element:ne,appendTo:m.appendTo})}));return k.displayName="OverlayPanel",e.OverlayPanel=k,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.csstransition,primereact.hooks,primereact.icons.times,primereact.overlayservice,primereact.portal,primereact.ripple,primereact.utils);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primereact",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "PrimeTek Informatics",
|
|
6
6
|
"description": "PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, which has 370+ ready to use UI blocks to build spectacular applications in no time.",
|