primereact 6.5.0 → 7.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/accordion.cjs.js +2 -0
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.esm.js +2 -0
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +2 -0
- package/accordion/accordion.min.js +1 -1
- package/api/api.cjs.js +308 -10
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +61 -1
- package/api/api.esm.js +305 -11
- package/api/api.esm.min.js +1 -1
- package/api/api.js +308 -12
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +3 -1
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +3 -1
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +3 -1
- package/autocomplete/autocomplete.min.js +1 -1
- package/avatar/avatar.cjs.js +2 -0
- package/avatar/avatar.cjs.min.js +1 -1
- package/avatar/avatar.esm.js +2 -0
- package/avatar/avatar.esm.min.js +1 -1
- package/avatar/avatar.js +2 -0
- package/avatar/avatar.min.js +1 -1
- package/avatargroup/avatargroup.cjs.js +2 -0
- package/avatargroup/avatargroup.cjs.min.js +1 -1
- package/avatargroup/avatargroup.esm.js +2 -0
- package/avatargroup/avatargroup.esm.min.js +1 -1
- package/avatargroup/avatargroup.js +2 -0
- package/avatargroup/avatargroup.min.js +1 -1
- package/badge/badge.cjs.js +2 -0
- package/badge/badge.cjs.min.js +1 -1
- package/badge/badge.esm.js +2 -0
- package/badge/badge.esm.min.js +1 -1
- package/badge/badge.js +2 -0
- package/badge/badge.min.js +1 -1
- package/blockui/blockui.cjs.js +9 -15
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +9 -15
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +9 -15
- package/blockui/blockui.min.css +1 -1
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/breadcrumb.cjs.js +2 -0
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +2 -0
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +2 -0
- package/breadcrumb/breadcrumb.min.css +1 -1
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/button/button.cjs.js +2 -0
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +2 -0
- package/button/button.esm.min.js +1 -1
- package/button/button.js +2 -0
- package/button/button.min.js +1 -1
- package/calendar/calendar.cjs.js +85 -67
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +85 -67
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +85 -67
- package/calendar/calendar.min.js +1 -1
- package/captcha/captcha.cjs.js +2 -0
- package/captcha/captcha.cjs.min.js +1 -1
- package/captcha/captcha.esm.js +2 -0
- package/captcha/captcha.esm.min.js +1 -1
- package/captcha/captcha.js +2 -0
- package/captcha/captcha.min.js +1 -1
- package/card/card.cjs.js +2 -0
- package/card/card.cjs.min.js +1 -1
- package/card/card.esm.js +2 -0
- package/card/card.esm.min.js +1 -1
- package/card/card.js +2 -0
- package/card/card.min.js +1 -1
- package/carousel/carousel.cjs.js +2 -0
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +3 -1
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +2 -0
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/cascadeselect.cjs.js +2 -0
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +2 -0
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +2 -0
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/chart/chart.cjs.js +2 -0
- package/chart/chart.cjs.min.js +1 -1
- package/chart/chart.esm.js +2 -0
- package/chart/chart.esm.min.js +1 -1
- package/chart/chart.js +2 -0
- package/chart/chart.min.js +1 -1
- package/checkbox/checkbox.cjs.js +19 -9
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.d.ts +3 -1
- package/checkbox/checkbox.esm.js +19 -9
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +19 -9
- package/checkbox/checkbox.min.css +1 -1
- package/checkbox/checkbox.min.js +1 -1
- package/chip/chip.cjs.js +2 -0
- package/chip/chip.cjs.min.js +1 -1
- package/chip/chip.esm.js +2 -0
- package/chip/chip.esm.min.js +1 -1
- package/chip/chip.js +2 -0
- package/chip/chip.min.js +1 -1
- package/chips/chips.cjs.js +2 -0
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +2 -0
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +2 -0
- package/chips/chips.min.js +1 -1
- package/colorpicker/colorpicker.cjs.js +2 -0
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +2 -0
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +2 -0
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/column.cjs.js +34 -9
- package/column/column.cjs.min.js +1 -1
- package/column/column.d.ts +146 -13
- package/column/column.esm.js +34 -9
- package/column/column.esm.min.js +1 -1
- package/column/column.js +34 -9
- package/column/column.min.js +1 -1
- package/columngroup/columngroup.cjs.js +2 -0
- package/columngroup/columngroup.cjs.min.js +1 -1
- package/columngroup/columngroup.esm.js +2 -0
- package/columngroup/columngroup.esm.min.js +1 -1
- package/columngroup/columngroup.js +2 -0
- package/columngroup/columngroup.min.js +1 -1
- package/common/common.min.css +1 -1
- package/confirmdialog/confirmdialog.cjs.js +2 -0
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +2 -0
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +2 -0
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/confirmpopup/confirmpopup.cjs.js +2 -0
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +2 -0
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +2 -0
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/contextmenu.cjs.js +2 -0
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +3 -1
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +2 -0
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.cjs.js +351 -669
- package/core/core.cjs.min.js +1 -1
- package/core/core.esm.js +347 -665
- package/core/core.esm.min.js +1 -1
- package/core/core.js +352 -671
- package/core/core.min.js +1 -1
- package/csstransition/csstransition.cjs.js +2 -0
- package/csstransition/csstransition.cjs.min.js +1 -1
- package/csstransition/csstransition.esm.js +2 -0
- package/csstransition/csstransition.esm.min.js +1 -1
- package/csstransition/csstransition.js +2 -0
- package/csstransition/csstransition.min.js +1 -1
- package/datascroller/datascroller.cjs.js +8 -1
- package/datascroller/datascroller.cjs.min.js +1 -1
- package/datascroller/datascroller.esm.js +8 -1
- package/datascroller/datascroller.esm.min.js +1 -1
- package/datascroller/datascroller.js +8 -1
- package/datascroller/datascroller.min.js +1 -1
- package/datatable/datatable.cjs.js +4803 -3320
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +97 -28
- package/datatable/datatable.esm.js +4803 -3321
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +4801 -3322
- package/datatable/datatable.min.css +1 -1
- package/datatable/datatable.min.js +1 -1
- package/dataview/dataview.cjs.js +4 -2
- package/dataview/dataview.cjs.min.js +1 -1
- package/dataview/dataview.esm.js +4 -2
- package/dataview/dataview.esm.min.js +1 -1
- package/dataview/dataview.js +4 -2
- package/dataview/dataview.min.js +1 -1
- package/deferredcontent/deferredcontent.cjs.js +2 -0
- package/deferredcontent/deferredcontent.cjs.min.js +1 -1
- package/deferredcontent/deferredcontent.esm.js +2 -0
- package/deferredcontent/deferredcontent.esm.min.js +1 -1
- package/deferredcontent/deferredcontent.js +2 -0
- package/deferredcontent/deferredcontent.min.js +1 -1
- package/dialog/dialog.cjs.js +12 -1
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +12 -1
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +12 -1
- package/dialog/dialog.min.js +1 -1
- package/divider/divider.cjs.js +2 -0
- package/divider/divider.cjs.min.js +1 -1
- package/divider/divider.esm.js +2 -0
- package/divider/divider.esm.min.js +1 -1
- package/divider/divider.js +2 -0
- package/divider/divider.min.js +1 -1
- package/dock/dock.cjs.js +5 -1
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +5 -1
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +5 -1
- package/dock/dock.min.css +1 -1
- package/dock/dock.min.js +1 -1
- package/dropdown/dropdown.cjs.js +15 -11
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +17 -13
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +15 -11
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +2 -0
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +2 -0
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +2 -0
- package/editor/editor.min.js +1 -1
- package/fieldset/fieldset.cjs.js +2 -0
- package/fieldset/fieldset.cjs.min.js +1 -1
- package/fieldset/fieldset.esm.js +2 -0
- package/fieldset/fieldset.esm.min.js +1 -1
- package/fieldset/fieldset.js +2 -0
- package/fieldset/fieldset.min.js +1 -1
- package/fileupload/fileupload.cjs.js +2 -0
- package/fileupload/fileupload.cjs.min.js +1 -1
- package/fileupload/fileupload.esm.js +2 -0
- package/fileupload/fileupload.esm.min.js +1 -1
- package/fileupload/fileupload.js +2 -0
- package/fileupload/fileupload.min.js +1 -1
- package/fullcalendar/fullcalendar.cjs.js +2 -0
- package/fullcalendar/fullcalendar.cjs.min.js +1 -1
- package/fullcalendar/fullcalendar.esm.js +2 -0
- package/fullcalendar/fullcalendar.esm.min.js +1 -1
- package/fullcalendar/fullcalendar.js +2 -0
- package/fullcalendar/fullcalendar.min.js +1 -1
- package/galleria/galleria.cjs.js +25 -5
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +25 -5
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +25 -5
- package/galleria/galleria.min.css +1 -1
- package/galleria/galleria.min.js +1 -1
- package/gmap/gmap.cjs.js +2 -0
- package/gmap/gmap.cjs.min.js +1 -1
- package/gmap/gmap.esm.js +2 -0
- package/gmap/gmap.esm.min.js +1 -1
- package/gmap/gmap.js +2 -0
- package/gmap/gmap.min.js +1 -1
- package/image/image.cjs.js +397 -0
- package/image/image.cjs.min.js +1 -0
- package/image/image.d.ts +18 -0
- package/image/image.esm.js +389 -0
- package/image/image.esm.min.js +1 -0
- package/image/image.js +400 -0
- package/image/image.min.css +1 -0
- package/image/image.min.js +1 -0
- package/image/package.json +6 -0
- package/inplace/inplace.cjs.js +2 -0
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +2 -0
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +2 -0
- package/inplace/inplace.min.js +1 -1
- package/inputmask/inputmask.cjs.js +2 -0
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +2 -0
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +2 -0
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/inputnumber.cjs.js +177 -62
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.d.ts +1 -0
- package/inputnumber/inputnumber.esm.js +177 -62
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +177 -62
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/inputswitch.cjs.js +16 -6
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.d.ts +3 -1
- package/inputswitch/inputswitch.esm.js +16 -6
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +16 -6
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/inputtext.cjs.js +2 -0
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.esm.js +2 -0
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +2 -0
- package/inputtext/inputtext.min.js +1 -1
- package/inputtextarea/inputtextarea.cjs.js +2 -0
- package/inputtextarea/inputtextarea.cjs.min.js +1 -1
- package/inputtextarea/inputtextarea.esm.js +2 -0
- package/inputtextarea/inputtextarea.esm.min.js +1 -1
- package/inputtextarea/inputtextarea.js +2 -0
- package/inputtextarea/inputtextarea.min.js +1 -1
- package/knob/knob.cjs.js +2 -0
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +2 -0
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +2 -0
- package/knob/knob.min.js +1 -1
- package/listbox/listbox.cjs.js +6 -3
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +7 -4
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +7 -5
- package/listbox/listbox.min.js +1 -1
- package/megamenu/megamenu.cjs.js +2 -0
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +2 -0
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +2 -0
- package/megamenu/megamenu.min.js +1 -1
- package/mention/mention.cjs.js +2 -0
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +2 -0
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +2 -0
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +2 -0
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.d.ts +1 -1
- package/menu/menu.esm.js +2 -0
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +2 -0
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +2 -0
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +2 -0
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +2 -0
- package/menubar/menubar.min.js +1 -1
- package/message/message.cjs.js +2 -0
- package/message/message.cjs.min.js +1 -1
- package/message/message.esm.js +2 -0
- package/message/message.esm.min.js +1 -1
- package/message/message.js +2 -0
- package/message/message.min.js +1 -1
- package/messages/messages.cjs.js +2 -0
- package/messages/messages.cjs.min.js +1 -1
- package/messages/messages.esm.js +2 -0
- package/messages/messages.esm.min.js +1 -1
- package/messages/messages.js +2 -0
- package/messages/messages.min.js +1 -1
- package/multiselect/multiselect.cjs.js +22 -12
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +3 -1
- package/multiselect/multiselect.esm.js +24 -14
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +22 -12
- package/multiselect/multiselect.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.cjs.js +2 -0
- package/multistatecheckbox/multistatecheckbox.cjs.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +2 -0
- package/multistatecheckbox/multistatecheckbox.esm.min.js +1 -1
- package/multistatecheckbox/multistatecheckbox.js +2 -0
- package/multistatecheckbox/multistatecheckbox.min.js +1 -1
- package/orderlist/orderlist.cjs.js +2 -0
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +2 -0
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +2 -0
- package/orderlist/orderlist.min.js +1 -1
- package/organizationchart/organizationchart.cjs.js +2 -0
- package/organizationchart/organizationchart.cjs.min.js +1 -1
- package/organizationchart/organizationchart.esm.js +2 -0
- package/organizationchart/organizationchart.esm.min.js +1 -1
- package/organizationchart/organizationchart.js +2 -0
- package/organizationchart/organizationchart.min.js +1 -1
- package/overlaypanel/overlaypanel.cjs.js +10 -1
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +10 -1
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +10 -1
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +120 -30
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.d.ts +13 -0
- package/paginator/paginator.esm.js +120 -30
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +121 -32
- package/paginator/paginator.min.js +1 -1
- package/panel/panel.cjs.js +2 -0
- package/panel/panel.cjs.min.js +1 -1
- package/panel/panel.esm.js +2 -0
- package/panel/panel.esm.min.js +1 -1
- package/panel/panel.js +2 -0
- package/panel/panel.min.js +1 -1
- package/panelmenu/panelmenu.cjs.js +2 -0
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +3 -1
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +2 -0
- package/panelmenu/panelmenu.min.js +1 -1
- package/password/password.cjs.js +2 -0
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +2 -0
- package/password/password.esm.min.js +1 -1
- package/password/password.js +2 -0
- package/password/password.min.js +1 -1
- package/picklist/picklist.cjs.js +2 -0
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +2 -0
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +2 -0
- package/picklist/picklist.min.js +1 -1
- package/portal/portal.cjs.js +6 -2
- package/portal/portal.cjs.min.js +1 -1
- package/portal/portal.esm.js +6 -2
- package/portal/portal.esm.min.js +1 -1
- package/portal/portal.js +6 -2
- package/portal/portal.min.js +1 -1
- package/primereact.all.cjs.js +12344 -9903
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +12340 -9903
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +12344 -9903
- package/primereact.all.min.js +1 -1
- package/progressbar/progressbar.cjs.js +2 -0
- package/progressbar/progressbar.cjs.min.js +1 -1
- package/progressbar/progressbar.esm.js +2 -0
- package/progressbar/progressbar.esm.min.js +1 -1
- package/progressbar/progressbar.js +2 -0
- package/progressbar/progressbar.min.js +1 -1
- package/progressspinner/progressspinner.cjs.js +2 -0
- package/progressspinner/progressspinner.cjs.min.js +1 -1
- package/progressspinner/progressspinner.esm.js +2 -0
- package/progressspinner/progressspinner.esm.min.js +1 -1
- package/progressspinner/progressspinner.js +2 -0
- package/progressspinner/progressspinner.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +2 -0
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +2 -0
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +2 -0
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/rating.cjs.js +2 -0
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +2 -0
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +2 -0
- package/rating/rating.min.js +1 -1
- package/resources/primereact.css +340 -84
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +4600 -3838
- package/resources/themes/arya-green/theme.css +4600 -3838
- package/resources/themes/arya-orange/theme.css +4600 -3838
- package/resources/themes/arya-purple/theme.css +4600 -3838
- package/resources/themes/bootstrap4-dark-blue/theme.css +4601 -3837
- package/resources/themes/bootstrap4-dark-purple/theme.css +4601 -3837
- package/resources/themes/bootstrap4-light-blue/theme.css +4579 -3815
- package/resources/themes/bootstrap4-light-purple/theme.css +4579 -3815
- package/resources/themes/fluent-light/theme.css +4690 -3897
- package/resources/themes/luna-amber/theme.css +4555 -3807
- package/resources/themes/luna-blue/theme.css +4551 -3803
- package/resources/themes/luna-green/theme.css +4551 -3803
- package/resources/themes/luna-pink/theme.css +4555 -3807
- package/resources/themes/md-dark-deeppurple/theme.css +5580 -4689
- package/resources/themes/md-dark-indigo/theme.css +5578 -4687
- package/resources/themes/md-light-deeppurple/theme.css +5569 -4678
- package/resources/themes/md-light-indigo/theme.css +5569 -4678
- package/resources/themes/mdc-dark-deeppurple/theme.css +5575 -4684
- package/resources/themes/mdc-dark-indigo/theme.css +5583 -4692
- package/resources/themes/mdc-light-deeppurple/theme.css +5579 -4688
- package/resources/themes/mdc-light-indigo/theme.css +5579 -4688
- package/resources/themes/nova/theme.css +4554 -3802
- package/resources/themes/nova-accent/theme.css +4571 -3818
- package/resources/themes/nova-alt/theme.css +4560 -3806
- package/resources/themes/rhea/theme.css +4562 -3813
- package/resources/themes/saga-blue/theme.css +4608 -3847
- package/resources/themes/saga-green/theme.css +4608 -3847
- package/resources/themes/saga-orange/theme.css +4608 -3847
- package/resources/themes/saga-purple/theme.css +4607 -3846
- package/resources/themes/tailwind-light/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Light.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/tailwind-light/theme.css +5722 -0
- package/resources/themes/vela-blue/theme.css +4602 -3840
- package/resources/themes/vela-green/theme.css +4602 -3840
- package/resources/themes/vela-orange/theme.css +4602 -3840
- package/resources/themes/vela-purple/theme.css +4602 -3840
- package/ripple/ripple.cjs.js +2 -0
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +2 -0
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +2 -0
- package/ripple/ripple.min.js +1 -1
- package/row/row.cjs.js +2 -0
- package/row/row.cjs.min.js +1 -1
- package/row/row.esm.js +2 -0
- package/row/row.esm.min.js +1 -1
- package/row/row.js +2 -0
- package/row/row.min.js +1 -1
- package/scrollpanel/scrollpanel.cjs.js +2 -0
- package/scrollpanel/scrollpanel.cjs.min.js +1 -1
- package/scrollpanel/scrollpanel.esm.js +2 -0
- package/scrollpanel/scrollpanel.esm.min.js +1 -1
- package/scrollpanel/scrollpanel.js +2 -0
- package/scrollpanel/scrollpanel.min.js +1 -1
- package/scrolltop/scrolltop.cjs.js +2 -0
- package/scrolltop/scrolltop.cjs.min.js +1 -1
- package/scrolltop/scrolltop.esm.js +2 -0
- package/scrolltop/scrolltop.esm.min.js +1 -1
- package/scrolltop/scrolltop.js +2 -0
- package/scrolltop/scrolltop.min.js +1 -1
- package/selectbutton/selectbutton.cjs.js +2 -0
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +2 -0
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +2 -0
- package/selectbutton/selectbutton.min.js +1 -1
- package/sidebar/sidebar.cjs.js +23 -27
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +23 -27
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +23 -27
- package/sidebar/sidebar.min.css +1 -1
- package/sidebar/sidebar.min.js +1 -1
- package/skeleton/skeleton.cjs.js +2 -0
- package/skeleton/skeleton.cjs.min.js +1 -1
- package/skeleton/skeleton.esm.js +2 -0
- package/skeleton/skeleton.esm.min.js +1 -1
- package/skeleton/skeleton.js +2 -0
- package/skeleton/skeleton.min.js +1 -1
- package/slidemenu/slidemenu.cjs.js +2 -0
- package/slidemenu/slidemenu.cjs.min.js +1 -1
- package/slidemenu/slidemenu.esm.js +2 -0
- package/slidemenu/slidemenu.esm.min.js +1 -1
- package/slidemenu/slidemenu.js +2 -0
- package/slidemenu/slidemenu.min.js +1 -1
- package/slider/slider.cjs.js +14 -7
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +14 -7
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +14 -7
- package/slider/slider.min.js +1 -1
- package/speeddial/speeddial.cjs.js +2 -0
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +2 -0
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +2 -0
- package/speeddial/speeddial.min.css +1 -1
- package/speeddial/speeddial.min.js +1 -1
- package/splitbutton/splitbutton.cjs.js +2 -0
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +2 -0
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +2 -0
- package/splitbutton/splitbutton.min.js +1 -1
- package/splitter/splitter.cjs.js +2 -0
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +2 -0
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +2 -0
- package/splitter/splitter.min.js +1 -1
- package/steps/steps.cjs.js +2 -0
- package/steps/steps.cjs.min.js +1 -1
- package/steps/steps.esm.js +2 -0
- package/steps/steps.esm.min.js +1 -1
- package/steps/steps.js +2 -0
- package/steps/steps.min.js +1 -1
- package/styleclass/package.json +6 -0
- package/styleclass/styleclass.cjs.js +355 -0
- package/styleclass/styleclass.cjs.min.js +1 -0
- package/styleclass/styleclass.d.ts +18 -0
- package/styleclass/styleclass.esm.js +351 -0
- package/styleclass/styleclass.esm.min.js +1 -0
- package/styleclass/styleclass.js +358 -0
- package/styleclass/styleclass.min.js +1 -0
- package/tabmenu/tabmenu.cjs.js +2 -0
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +2 -0
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +2 -0
- package/tabmenu/tabmenu.min.css +1 -1
- package/tabmenu/tabmenu.min.js +1 -1
- package/tabview/tabview.cjs.js +135 -18
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.d.ts +1 -0
- package/tabview/tabview.esm.js +135 -18
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +135 -18
- package/tabview/tabview.min.css +1 -1
- package/tabview/tabview.min.js +1 -1
- package/tag/tag.cjs.js +2 -0
- package/tag/tag.cjs.min.js +1 -1
- package/tag/tag.esm.js +2 -0
- package/tag/tag.esm.min.js +1 -1
- package/tag/tag.js +2 -0
- package/tag/tag.min.js +1 -1
- package/terminal/terminal.cjs.js +2 -0
- package/terminal/terminal.cjs.min.js +1 -1
- package/terminal/terminal.esm.js +2 -0
- package/terminal/terminal.esm.min.js +1 -1
- package/terminal/terminal.js +2 -0
- package/terminal/terminal.min.js +1 -1
- package/tieredmenu/tieredmenu.cjs.js +2 -0
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.d.ts +1 -1
- package/tieredmenu/tieredmenu.esm.js +2 -0
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +2 -0
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/timeline.cjs.js +2 -0
- package/timeline/timeline.cjs.min.js +1 -1
- package/timeline/timeline.esm.js +2 -0
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +2 -0
- package/timeline/timeline.min.js +1 -1
- package/toast/toast.cjs.js +9 -2
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.d.ts +4 -0
- package/toast/toast.esm.js +9 -2
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +9 -2
- package/toast/toast.min.js +1 -1
- package/togglebutton/togglebutton.cjs.js +2 -0
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +2 -0
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +2 -0
- package/togglebutton/togglebutton.min.js +1 -1
- package/toolbar/toolbar.cjs.js +2 -0
- package/toolbar/toolbar.cjs.min.js +1 -1
- package/toolbar/toolbar.esm.js +2 -0
- package/toolbar/toolbar.esm.min.js +1 -1
- package/toolbar/toolbar.js +2 -0
- package/toolbar/toolbar.min.js +1 -1
- package/tooltip/tooltip.cjs.js +2 -0
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +2 -0
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +2 -0
- package/tooltip/tooltip.min.css +1 -1
- package/tooltip/tooltip.min.js +1 -1
- package/tree/tree.cjs.js +2 -0
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +2 -0
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +2 -0
- package/tree/tree.min.js +1 -1
- package/treenode/treenode.d.ts +1 -1
- package/treeselect/treeselect.cjs.js +2 -0
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +2 -0
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +2 -0
- package/treeselect/treeselect.min.js +1 -1
- package/treetable/treetable.cjs.js +22 -8
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +23 -9
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +23 -10
- package/treetable/treetable.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.cjs.js +2 -0
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +2 -0
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +2 -0
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/utils.cjs.js +404 -496
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +20 -26
- package/utils/utils.esm.js +405 -496
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +404 -496
- package/utils/utils.min.js +1 -1
- package/virtualscroller/virtualscroller.cjs.js +277 -160
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.d.ts +21 -9
- package/virtualscroller/virtualscroller.esm.js +277 -160
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +277 -160
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +168 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{Component as t}from"react";import{Button as n}from"primereact/button";import{Messages as o}from"primereact/messages";import{ProgressBar as s}from"primereact/progressbar";import{DomHandler as l,classNames as i,Ripple as r,ObjectUtils as a}from"primereact/core";import{localeOption as p}from"primereact/api";function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e){if(Array.isArray(e))return u(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){return!t||"object"!==E(t)&&"function"!=typeof t?v(e):t}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=B(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,s=function(){};return{s:s,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,i=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){r=!0,l=e},f:function(){try{i||null==n.return||n.return()}finally{if(r)throw l}}}}function B(e,t){if(e){if("string"==typeof e)return w(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)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function I(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var D,O,C,N=function(u){g(C,t);var b,E,B,w,D,O=(b=C,E=I(),function(){var e,t=k(b);if(E){var n=k(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function C(e){var t;return m(this,C),(t=O.call(this,e)).state={files:[],msgs:[],focused:!1},t.choose=t.choose.bind(v(t)),t.upload=t.upload.bind(v(t)),t.clear=t.clear.bind(v(t)),t.onFileSelect=t.onFileSelect.bind(v(t)),t.onDragEnter=t.onDragEnter.bind(v(t)),t.onDragOver=t.onDragOver.bind(v(t)),t.onDragLeave=t.onDragLeave.bind(v(t)),t.onDrop=t.onDrop.bind(v(t)),t.onKeyDown=t.onKeyDown.bind(v(t)),t.onFocus=t.onFocus.bind(v(t)),t.onBlur=t.onBlur.bind(v(t)),t.onSimpleUploaderClick=t.onSimpleUploaderClick.bind(v(t)),t.duplicateIEEvent=!1,t}return B=C,(w=[{key:"hasFiles",value:function(){return this.state.files&&this.state.files.length>0}},{key:"isImage",value:function(e){return/^image\//.test(e.type)}},{key:"chooseDisabled",value:function(){return this.props.disabled||this.props.fileLimit&&this.props.fileLimit<=this.state.files.length+this.uploadedFileCount}},{key:"uploadDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"cancelDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"chooseButtonLabel",value:function(){return this.props.chooseLabel||this.props.chooseOptions.label||p("choose")}},{key:"uploadButtonLabel",value:function(){return this.props.uploadLabel||this.props.uploadOptions.label||p("upload")}},{key:"cancelButtonLabel",value:function(){return this.props.cancelLabel||this.props.cancelOptions.label||p("cancel")}},{key:"remove",value:function(e,t){this.clearInputElement();var n,o=c(n=this.state.files)||h(n)||f(n)||d(),s=this.state.files[t];o.splice(t,1),this.setState({files:o}),this.props.onRemove&&this.props.onRemove({originalEvent:e,file:s})}},{key:"clearInputElement",value:function(){this.fileInput&&(this.fileInput.value="")}},{key:"clearIEInput",value:function(){this.fileInput&&(this.duplicateIEEvent=!0,this.fileInput.value="")}},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,t)).toFixed(3))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}},{key:"onFileSelect",value:function(e){var t=this;if("drop"!==e.type&&this.isIE11()&&this.duplicateIEEvent)this.duplicateIEEvent=!1;else{this.setState({msgs:[]}),this.files=this.state.files||[];for(var n=e.dataTransfer?e.dataTransfer.files:e.target.files,o=0;o<n.length;o++){var s=n[o];this.isFileSelected(s)||this.validate(s)&&(this.isImage(s)&&(s.objectURL=window.URL.createObjectURL(s)),this.files.push(s))}this.setState({files:this.files},(function(){t.hasFiles()&&t.props.auto&&t.upload()})),this.props.onSelect&&this.props.onSelect({originalEvent:e,files:n}),"drop"!==e.type&&this.isIE11()?this.clearIEInput():this.clearInputElement(),"basic"===this.props.mode&&this.files.length>0&&(this.fileInput.style.display="none")}}},{key:"isFileSelected",value:function(e){var t,n=F(this.state.files);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(o.name+o.type+o.size===e.name+e.type+e.size)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"isIE11",value:function(){return!!window.MSInputMethodContext&&!!document.documentMode}},{key:"validate",value:function(e){if(this.props.maxFileSize&&e.size>this.props.maxFileSize){var t={severity:"error",summary:this.props.invalidFileSizeMessageSummary.replace("{0}",e.name),detail:this.props.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.props.maxFileSize))};return"advanced"===this.props.mode&&this.messagesUI.show(t),this.props.onValidationFail&&this.props.onValidationFail(e),!1}return!0}},{key:"upload",value:function(){var e=this;if(this.props.customUpload)this.props.fileLimit&&(this.uploadedFileCount+=this.state.files.length),this.props.uploadHandler&&this.props.uploadHandler({files:this.state.files,options:{clear:this.clear,props:this.props}});else{this.setState({msgs:[]});var t=new XMLHttpRequest,n=new FormData;this.props.onBeforeUpload&&this.props.onBeforeUpload({xhr:t,formData:n});var o,s=F(this.state.files);try{for(s.s();!(o=s.n()).done;){var l=o.value;n.append(this.props.name,l,l.name)}}catch(e){s.e(e)}finally{s.f()}t.upload.addEventListener("progress",(function(t){t.lengthComputable&&e.setState({progress:Math.round(100*t.loaded/t.total)},(function(){e.props.onProgress&&e.props.onProgress({originalEvent:t,progress:e.state.progress})}))})),t.onreadystatechange=function(){4===t.readyState&&(e.setState({progress:0}),t.status>=200&&t.status<300?(e.props.fileLimit&&(e.uploadedFileCount+=e.state.files.length),e.props.onUpload&&e.props.onUpload({xhr:t,files:e.state.files})):e.props.onError&&e.props.onError({xhr:t,files:e.state.files}),e.clear())},t.open("POST",this.props.url,!0),this.props.onBeforeSend&&this.props.onBeforeSend({xhr:t,formData:n}),t.withCredentials=this.props.withCredentials,t.send(n)}}},{key:"clear",value:function(){this.setState({files:[]}),this.props.onClear&&this.props.onClear(),this.clearInputElement()}},{key:"choose",value:function(){this.fileInput.click()}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(e){13===e.which&&this.choose()}},{key:"onDragEnter",value:function(e){this.props.disabled||(e.stopPropagation(),e.preventDefault())}},{key:"onDragOver",value:function(e){this.props.disabled||(l.addClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault())}},{key:"onDragLeave",value:function(e){this.props.disabled||l.removeClass(this.content,"p-fileupload-highlight")}},{key:"onDrop",value:function(e){if(!this.props.disabled){l.removeClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault();var t=e.dataTransfer?e.dataTransfer.files:e.target.files;(this.props.multiple||t&&1===t.length)&&this.onFileSelect(e)}}},{key:"onSimpleUploaderClick",value:function(){this.hasFiles()?this.upload():this.fileInput.click()}},{key:"renderChooseButton",value:function(){var t=this,n=this.props.chooseOptions,o=n.style,s=n.icon,l=n.iconOnly,a=i("p-button p-fileupload-choose p-component",{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-button-icon-only":l},n.className),p=i("p-button-icon p-button-icon-left p-clickable",{"pi pi-fw pi-plus":!s},s),u="p-button-label p-clickable",c=l?e.createElement("span",{className:u,dangerouslySetInnerHTML:{__html:" "}}):e.createElement("span",{className:u},this.chooseButtonLabel());return e.createElement("span",{className:a,style:o,onClick:this.choose,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},e.createElement("input",{ref:function(e){return t.fileInput=e},type:"file",onChange:this.onFileSelect,multiple:this.props.multiple,accept:this.props.accept,disabled:this.chooseDisabled()}),e.createElement("span",{className:p}),c,e.createElement(r,null))}},{key:"renderFile",value:function(t,o){var s=this,l=this.isImage(t)?e.createElement("div",null,e.createElement("img",{alt:t.name,role:"presentation",src:t.objectURL,width:this.props.previewWidth})):null,i=e.createElement("div",{className:"p-fileupload-filename"},t.name),r=e.createElement("div",null,this.formatSize(t.size)),p=e.createElement("div",null,e.createElement(n,{type:"button",icon:"pi pi-times",onClick:function(e){return s.remove(e,o)}})),u=e.createElement(e.Fragment,null,l,i,r,p);if(this.props.itemTemplate){var c={onRemove:function(e){return s.remove(e,o)},previewElement:l,fileNameElement:i,sizeElement:r,removeElement:p,formatSize:this.formatSize(t.size),element:u,props:this.props};u=a.getJSXElement(this.props.itemTemplate,t,c)}return e.createElement("div",{className:"p-fileupload-row",key:t.name+t.type+t.size},u)}},{key:"renderFiles",value:function(){var t=this;return e.createElement("div",{className:"p-fileupload-files"},this.state.files.map((function(e,n){return t.renderFile(e,n)})))}},{key:"renderEmptyContent",value:function(){return this.props.emptyTemplate&&!this.hasFiles()?a.getJSXElement(this.props.emptyTemplate,this.props):null}},{key:"renderProgressBarContent",value:function(){return this.props.progressBarTemplate?a.getJSXElement(this.props.progressBarTemplate,this.props):e.createElement(s,{value:this.state.progress,showValue:!1})}},{key:"renderAdvanced",value:function(){var t,s,l,r,p=this,u=i("p-fileupload p-fileupload-advanced p-component",this.props.className),c=i("p-fileupload-buttonbar",this.props.headerClassName),h=i("p-fileupload-content",this.props.contentClassName),f=this.renderChooseButton(),d=this.renderEmptyContent();if(!this.props.auto){var m=this.props.uploadOptions,y=this.props.cancelOptions,v=m.iconOnly?"":this.uploadButtonLabel(),b=y.iconOnly?"":this.cancelButtonLabel();t=e.createElement(n,{type:"button",label:v,icon:m.icon||"pi pi-upload",onClick:this.upload,disabled:this.uploadDisabled(),style:m.style,className:m.className}),s=e.createElement(n,{type:"button",label:b,icon:y.icon||"pi pi-times",onClick:this.clear,disabled:this.cancelDisabled(),style:y.style,className:y.className})}this.hasFiles()&&(l=this.renderFiles(),r=this.renderProgressBarContent());var g=e.createElement("div",{className:c,style:this.props.headerStyle},f,t,s);return this.props.headerTemplate&&(g=a.getJSXElement(this.props.headerTemplate,{className:c,chooseButton:f,uploadButton:t,cancelButton:s,element:g,props:this.props})),e.createElement("div",{id:this.props.id,className:u,style:this.props.style},g,e.createElement("div",{ref:function(e){p.content=e},className:h,style:this.props.contentStyle,onDragEnter:this.onDragEnter,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},r,e.createElement(o,{ref:function(e){return p.messagesUI=e}}),l,d))}},{key:"renderBasic",value:function(){var t=this,n=this.props.chooseOptions,s=i("p-fileupload p-fileupload-basic p-component",this.props.className),l=i("p-button p-component p-fileupload-choose",{"p-fileupload-choose-selected":this.hasFiles(),"p-disabled":this.props.disabled,"p-focus":this.state.focused},n.className),a=i("p-button-icon p-button-icon-left pi",{"pi-plus":!n.icon&&(!this.hasFiles()||this.props.auto),"pi-upload":!n.icon&&this.hasFiles()&&!this.props.auto},n.icon),p="p-button-label p-clickable",u=n.iconOnly?e.createElement("span",{className:p,dangerouslySetInnerHTML:{__html:" "}}):e.createElement("span",{className:p},this.chooseButtonLabel()),c=this.props.auto?u:e.createElement("span",{className:p},this.hasFiles()?this.state.files[0].name:u),h=e.createElement("span",{className:a});return e.createElement("div",{className:s,style:this.props.style},e.createElement(o,{ref:function(e){return t.messagesUI=e}}),e.createElement("span",{className:l,style:n.style,onMouseUp:this.onSimpleUploaderClick,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},h,c,!this.hasFiles()&&e.createElement("input",{ref:function(e){return t.fileInput=e},type:"file",accept:this.props.accept,multiple:this.props.multiple,disabled:this.props.disabled,onChange:this.onFileSelect}),e.createElement(r,null)))}},{key:"render",value:function(){return"advanced"===this.props.mode?this.renderAdvanced():"basic"===this.props.mode?this.renderBasic():void 0}}])&&y(B.prototype,w),D&&y(B,D),C}();C={id:null,name:null,url:null,mode:"advanced",multiple:!1,accept:null,disabled:!1,auto:!1,maxFileSize:null,invalidFileSizeMessageSummary:"{0}: Invalid file size, ",invalidFileSizeMessageDetail:"maximum upload size is {0}.",style:null,className:null,widthCredentials:!1,previewWidth:50,chooseLabel:null,uploadLabel:null,cancelLabel:null,chooseOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},uploadOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},cancelOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},customUpload:!1,headerClassName:null,headerStyle:null,contentClassName:null,contentStyle:null,headerTemplate:null,itemTemplate:null,emptyTemplate:null,progressBarTemplate:null,onBeforeUpload:null,onBeforeSend:null,onUpload:null,onError:null,onClear:null,onSelect:null,onProgress:null,onValidationFail:null,uploadHandler:null,onRemove:null},(O="defaultProps")in(D=N)?Object.defineProperty(D,O,{value:C,enumerable:!0,configurable:!0,writable:!0}):D[O]=C;export{N as FileUpload};
|
|
1
|
+
import e,{Component as t}from"react";import{Button as n}from"primereact/button";import{Messages as o}from"primereact/messages";import{ProgressBar as s}from"primereact/progressbar";import{DomHandler as i,classNames as l,Ripple as r,ObjectUtils as a}from"primereact/core";import{localeOption as p}from"primereact/api";function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e){if(Array.isArray(e))return u(e)}function h(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(t&&("object"===E(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=w(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,s=function(){};return{s:s,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){r=!0,i=e},f:function(){try{l||null==n.return||n.return()}finally{if(r)throw i}}}}function w(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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function D(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var I,O,C,N=function(u){g(C,t);var b,E,w,B,I,O=(b=C,E=D(),function(){var e,t=k(b);if(E){var n=k(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return S(this,e)});function C(e){var t;return m(this,C),(t=O.call(this,e)).state={files:[],msgs:[],focused:!1},t.choose=t.choose.bind(v(t)),t.upload=t.upload.bind(v(t)),t.clear=t.clear.bind(v(t)),t.onFileSelect=t.onFileSelect.bind(v(t)),t.onDragEnter=t.onDragEnter.bind(v(t)),t.onDragOver=t.onDragOver.bind(v(t)),t.onDragLeave=t.onDragLeave.bind(v(t)),t.onDrop=t.onDrop.bind(v(t)),t.onKeyDown=t.onKeyDown.bind(v(t)),t.onFocus=t.onFocus.bind(v(t)),t.onBlur=t.onBlur.bind(v(t)),t.onSimpleUploaderClick=t.onSimpleUploaderClick.bind(v(t)),t.duplicateIEEvent=!1,t}return w=C,(B=[{key:"hasFiles",value:function(){return this.state.files&&this.state.files.length>0}},{key:"isImage",value:function(e){return/^image\//.test(e.type)}},{key:"chooseDisabled",value:function(){return this.props.disabled||this.props.fileLimit&&this.props.fileLimit<=this.state.files.length+this.uploadedFileCount}},{key:"uploadDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"cancelDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"chooseButtonLabel",value:function(){return this.props.chooseLabel||this.props.chooseOptions.label||p("choose")}},{key:"uploadButtonLabel",value:function(){return this.props.uploadLabel||this.props.uploadOptions.label||p("upload")}},{key:"cancelButtonLabel",value:function(){return this.props.cancelLabel||this.props.cancelOptions.label||p("cancel")}},{key:"remove",value:function(e,t){this.clearInputElement();var n,o=c(n=this.state.files)||h(n)||f(n)||d(),s=this.state.files[t];o.splice(t,1),this.setState({files:o}),this.props.onRemove&&this.props.onRemove({originalEvent:e,file:s})}},{key:"clearInputElement",value:function(){this.fileInput&&(this.fileInput.value="")}},{key:"clearIEInput",value:function(){this.fileInput&&(this.duplicateIEEvent=!0,this.fileInput.value="")}},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,t)).toFixed(3))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}},{key:"onFileSelect",value:function(e){var t=this;if("drop"!==e.type&&this.isIE11()&&this.duplicateIEEvent)this.duplicateIEEvent=!1;else{this.setState({msgs:[]}),this.files=this.state.files||[];for(var n=e.dataTransfer?e.dataTransfer.files:e.target.files,o=0;o<n.length;o++){var s=n[o];this.isFileSelected(s)||this.validate(s)&&(this.isImage(s)&&(s.objectURL=window.URL.createObjectURL(s)),this.files.push(s))}this.setState({files:this.files},(function(){t.hasFiles()&&t.props.auto&&t.upload()})),this.props.onSelect&&this.props.onSelect({originalEvent:e,files:n}),"drop"!==e.type&&this.isIE11()?this.clearIEInput():this.clearInputElement(),"basic"===this.props.mode&&this.files.length>0&&(this.fileInput.style.display="none")}}},{key:"isFileSelected",value:function(e){var t,n=F(this.state.files);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(o.name+o.type+o.size===e.name+e.type+e.size)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"isIE11",value:function(){return!!window.MSInputMethodContext&&!!document.documentMode}},{key:"validate",value:function(e){if(this.props.maxFileSize&&e.size>this.props.maxFileSize){var t={severity:"error",summary:this.props.invalidFileSizeMessageSummary.replace("{0}",e.name),detail:this.props.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.props.maxFileSize))};return"advanced"===this.props.mode&&this.messagesUI.show(t),this.props.onValidationFail&&this.props.onValidationFail(e),!1}return!0}},{key:"upload",value:function(){var e=this;if(this.props.customUpload)this.props.fileLimit&&(this.uploadedFileCount+=this.state.files.length),this.props.uploadHandler&&this.props.uploadHandler({files:this.state.files,options:{clear:this.clear,props:this.props}});else{this.setState({msgs:[]});var t=new XMLHttpRequest,n=new FormData;this.props.onBeforeUpload&&this.props.onBeforeUpload({xhr:t,formData:n});var o,s=F(this.state.files);try{for(s.s();!(o=s.n()).done;){var i=o.value;n.append(this.props.name,i,i.name)}}catch(e){s.e(e)}finally{s.f()}t.upload.addEventListener("progress",(function(t){t.lengthComputable&&e.setState({progress:Math.round(100*t.loaded/t.total)},(function(){e.props.onProgress&&e.props.onProgress({originalEvent:t,progress:e.state.progress})}))})),t.onreadystatechange=function(){4===t.readyState&&(e.setState({progress:0}),t.status>=200&&t.status<300?(e.props.fileLimit&&(e.uploadedFileCount+=e.state.files.length),e.props.onUpload&&e.props.onUpload({xhr:t,files:e.state.files})):e.props.onError&&e.props.onError({xhr:t,files:e.state.files}),e.clear())},t.open("POST",this.props.url,!0),this.props.onBeforeSend&&this.props.onBeforeSend({xhr:t,formData:n}),t.withCredentials=this.props.withCredentials,t.send(n)}}},{key:"clear",value:function(){this.setState({files:[]}),this.props.onClear&&this.props.onClear(),this.clearInputElement()}},{key:"choose",value:function(){this.fileInput.click()}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(e){13===e.which&&this.choose()}},{key:"onDragEnter",value:function(e){this.props.disabled||(e.stopPropagation(),e.preventDefault())}},{key:"onDragOver",value:function(e){this.props.disabled||(i.addClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault())}},{key:"onDragLeave",value:function(e){this.props.disabled||i.removeClass(this.content,"p-fileupload-highlight")}},{key:"onDrop",value:function(e){if(!this.props.disabled){i.removeClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault();var t=e.dataTransfer?e.dataTransfer.files:e.target.files;(this.props.multiple||t&&1===t.length)&&this.onFileSelect(e)}}},{key:"onSimpleUploaderClick",value:function(){this.hasFiles()?this.upload():this.fileInput.click()}},{key:"renderChooseButton",value:function(){var t=this,n=this.props.chooseOptions,o=n.style,s=n.icon,i=n.iconOnly,a=l("p-button p-fileupload-choose p-component",{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-button-icon-only":i},n.className),p=l("p-button-icon p-button-icon-left p-clickable",{"pi pi-fw pi-plus":!s},s),u="p-button-label p-clickable",c=i?e.createElement("span",{className:u,dangerouslySetInnerHTML:{__html:" "}}):e.createElement("span",{className:u},this.chooseButtonLabel());return e.createElement("span",{className:a,style:o,onClick:this.choose,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},e.createElement("input",{ref:function(e){return t.fileInput=e},type:"file",onChange:this.onFileSelect,multiple:this.props.multiple,accept:this.props.accept,disabled:this.chooseDisabled()}),e.createElement("span",{className:p}),c,e.createElement(r,null))}},{key:"renderFile",value:function(t,o){var s=this,i=this.isImage(t)?e.createElement("div",null,e.createElement("img",{alt:t.name,role:"presentation",src:t.objectURL,width:this.props.previewWidth})):null,l=e.createElement("div",{className:"p-fileupload-filename"},t.name),r=e.createElement("div",null,this.formatSize(t.size)),p=e.createElement("div",null,e.createElement(n,{type:"button",icon:"pi pi-times",onClick:function(e){return s.remove(e,o)}})),u=e.createElement(e.Fragment,null,i,l,r,p);if(this.props.itemTemplate){var c={onRemove:function(e){return s.remove(e,o)},previewElement:i,fileNameElement:l,sizeElement:r,removeElement:p,formatSize:this.formatSize(t.size),element:u,props:this.props};u=a.getJSXElement(this.props.itemTemplate,t,c)}return e.createElement("div",{className:"p-fileupload-row",key:t.name+t.type+t.size},u)}},{key:"renderFiles",value:function(){var t=this;return e.createElement("div",{className:"p-fileupload-files"},this.state.files.map((function(e,n){return t.renderFile(e,n)})))}},{key:"renderEmptyContent",value:function(){return this.props.emptyTemplate&&!this.hasFiles()?a.getJSXElement(this.props.emptyTemplate,this.props):null}},{key:"renderProgressBarContent",value:function(){return this.props.progressBarTemplate?a.getJSXElement(this.props.progressBarTemplate,this.props):e.createElement(s,{value:this.state.progress,showValue:!1})}},{key:"renderAdvanced",value:function(){var t,s,i,r,p=this,u=l("p-fileupload p-fileupload-advanced p-component",this.props.className),c=l("p-fileupload-buttonbar",this.props.headerClassName),h=l("p-fileupload-content",this.props.contentClassName),f=this.renderChooseButton(),d=this.renderEmptyContent();if(!this.props.auto){var m=this.props.uploadOptions,y=this.props.cancelOptions,v=m.iconOnly?"":this.uploadButtonLabel(),b=y.iconOnly?"":this.cancelButtonLabel();t=e.createElement(n,{type:"button",label:v,icon:m.icon||"pi pi-upload",onClick:this.upload,disabled:this.uploadDisabled(),style:m.style,className:m.className}),s=e.createElement(n,{type:"button",label:b,icon:y.icon||"pi pi-times",onClick:this.clear,disabled:this.cancelDisabled(),style:y.style,className:y.className})}this.hasFiles()&&(i=this.renderFiles(),r=this.renderProgressBarContent());var g=e.createElement("div",{className:c,style:this.props.headerStyle},f,t,s);return this.props.headerTemplate&&(g=a.getJSXElement(this.props.headerTemplate,{className:c,chooseButton:f,uploadButton:t,cancelButton:s,element:g,props:this.props})),e.createElement("div",{id:this.props.id,className:u,style:this.props.style},g,e.createElement("div",{ref:function(e){p.content=e},className:h,style:this.props.contentStyle,onDragEnter:this.onDragEnter,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},r,e.createElement(o,{ref:function(e){return p.messagesUI=e}}),i,d))}},{key:"renderBasic",value:function(){var t=this,n=this.props.chooseOptions,s=l("p-fileupload p-fileupload-basic p-component",this.props.className),i=l("p-button p-component p-fileupload-choose",{"p-fileupload-choose-selected":this.hasFiles(),"p-disabled":this.props.disabled,"p-focus":this.state.focused},n.className),a=l("p-button-icon p-button-icon-left pi",{"pi-plus":!n.icon&&(!this.hasFiles()||this.props.auto),"pi-upload":!n.icon&&this.hasFiles()&&!this.props.auto},n.icon),p="p-button-label p-clickable",u=n.iconOnly?e.createElement("span",{className:p,dangerouslySetInnerHTML:{__html:" "}}):e.createElement("span",{className:p},this.chooseButtonLabel()),c=this.props.auto?u:e.createElement("span",{className:p},this.hasFiles()?this.state.files[0].name:u),h=e.createElement("span",{className:a});return e.createElement("div",{className:s,style:this.props.style},e.createElement(o,{ref:function(e){return t.messagesUI=e}}),e.createElement("span",{className:i,style:n.style,onMouseUp:this.onSimpleUploaderClick,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},h,c,!this.hasFiles()&&e.createElement("input",{ref:function(e){return t.fileInput=e},type:"file",accept:this.props.accept,multiple:this.props.multiple,disabled:this.props.disabled,onChange:this.onFileSelect}),e.createElement(r,null)))}},{key:"render",value:function(){return"advanced"===this.props.mode?this.renderAdvanced():"basic"===this.props.mode?this.renderBasic():void 0}}])&&y(w.prototype,B),I&&y(w,I),C}();C={id:null,name:null,url:null,mode:"advanced",multiple:!1,accept:null,disabled:!1,auto:!1,maxFileSize:null,invalidFileSizeMessageSummary:"{0}: Invalid file size, ",invalidFileSizeMessageDetail:"maximum upload size is {0}.",style:null,className:null,widthCredentials:!1,previewWidth:50,chooseLabel:null,uploadLabel:null,cancelLabel:null,chooseOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},uploadOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},cancelOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},customUpload:!1,headerClassName:null,headerStyle:null,contentClassName:null,contentStyle:null,headerTemplate:null,itemTemplate:null,emptyTemplate:null,progressBarTemplate:null,onBeforeUpload:null,onBeforeSend:null,onUpload:null,onError:null,onClear:null,onSelect:null,onProgress:null,onValidationFail:null,uploadHandler:null,onRemove:null},(O="defaultProps")in(I=N)?Object.defineProperty(I,O,{value:C,enumerable:!0,configurable:!0,writable:!0}):I[O]=C;export{N as FileUpload};
|
package/fileupload/fileupload.js
CHANGED
|
@@ -114,6 +114,8 @@ this.primereact.fileupload = (function (exports, React, button, messages, progre
|
|
|
114
114
|
function _possibleConstructorReturn(self, call) {
|
|
115
115
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
116
116
|
return call;
|
|
117
|
+
} else if (call !== void 0) {
|
|
118
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
return _assertThisInitialized(self);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.fileupload=function(e,t,n,l,s,o,a){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(t);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function u(e){if(Array.isArray(e))return p(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?y(e):t}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=F(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var l=0,s=function(){};return{s:s,n:function(){return l>=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(i)throw o}}}}function F(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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function O(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var D,w,I,N=function(e){b(B,e);var t,i,p,v,g,F=(t=B,i=O(),function(){var e,n=S(t);if(i){var l=S(this).constructor;e=Reflect.construct(n,arguments,l)}else e=n.apply(this,arguments);return E(this,e)});function B(e){var t;return d(this,B),(t=F.call(this,e)).state={files:[],msgs:[],focused:!1},t.choose=t.choose.bind(y(t)),t.upload=t.upload.bind(y(t)),t.clear=t.clear.bind(y(t)),t.onFileSelect=t.onFileSelect.bind(y(t)),t.onDragEnter=t.onDragEnter.bind(y(t)),t.onDragOver=t.onDragOver.bind(y(t)),t.onDragLeave=t.onDragLeave.bind(y(t)),t.onDrop=t.onDrop.bind(y(t)),t.onKeyDown=t.onKeyDown.bind(y(t)),t.onFocus=t.onFocus.bind(y(t)),t.onBlur=t.onBlur.bind(y(t)),t.onSimpleUploaderClick=t.onSimpleUploaderClick.bind(y(t)),t.duplicateIEEvent=!1,t}return p=B,(v=[{key:"hasFiles",value:function(){return this.state.files&&this.state.files.length>0}},{key:"isImage",value:function(e){return/^image\//.test(e.type)}},{key:"chooseDisabled",value:function(){return this.props.disabled||this.props.fileLimit&&this.props.fileLimit<=this.state.files.length+this.uploadedFileCount}},{key:"uploadDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"cancelDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"chooseButtonLabel",value:function(){return this.props.chooseLabel||this.props.chooseOptions.label||a.localeOption("choose")}},{key:"uploadButtonLabel",value:function(){return this.props.uploadLabel||this.props.uploadOptions.label||a.localeOption("upload")}},{key:"cancelButtonLabel",value:function(){return this.props.cancelLabel||this.props.cancelOptions.label||a.localeOption("cancel")}},{key:"remove",value:function(e,t){this.clearInputElement();var n,l=u(n=this.state.files)||c(n)||h(n)||f(),s=this.state.files[t];l.splice(t,1),this.setState({files:l}),this.props.onRemove&&this.props.onRemove({originalEvent:e,file:s})}},{key:"clearInputElement",value:function(){this.fileInput&&(this.fileInput.value="")}},{key:"clearIEInput",value:function(){this.fileInput&&(this.duplicateIEEvent=!0,this.fileInput.value="")}},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,t)).toFixed(3))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}},{key:"onFileSelect",value:function(e){var t=this;if("drop"!==e.type&&this.isIE11()&&this.duplicateIEEvent)this.duplicateIEEvent=!1;else{this.setState({msgs:[]}),this.files=this.state.files||[];for(var n=e.dataTransfer?e.dataTransfer.files:e.target.files,l=0;l<n.length;l++){var s=n[l];this.isFileSelected(s)||this.validate(s)&&(this.isImage(s)&&(s.objectURL=window.URL.createObjectURL(s)),this.files.push(s))}this.setState({files:this.files},(function(){t.hasFiles()&&t.props.auto&&t.upload()})),this.props.onSelect&&this.props.onSelect({originalEvent:e,files:n}),"drop"!==e.type&&this.isIE11()?this.clearIEInput():this.clearInputElement(),"basic"===this.props.mode&&this.files.length>0&&(this.fileInput.style.display="none")}}},{key:"isFileSelected",value:function(e){var t,n=k(this.state.files);try{for(n.s();!(t=n.n()).done;){var l=t.value;if(l.name+l.type+l.size===e.name+e.type+e.size)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"isIE11",value:function(){return!!window.MSInputMethodContext&&!!document.documentMode}},{key:"validate",value:function(e){if(this.props.maxFileSize&&e.size>this.props.maxFileSize){var t={severity:"error",summary:this.props.invalidFileSizeMessageSummary.replace("{0}",e.name),detail:this.props.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.props.maxFileSize))};return"advanced"===this.props.mode&&this.messagesUI.show(t),this.props.onValidationFail&&this.props.onValidationFail(e),!1}return!0}},{key:"upload",value:function(){var e=this;if(this.props.customUpload)this.props.fileLimit&&(this.uploadedFileCount+=this.state.files.length),this.props.uploadHandler&&this.props.uploadHandler({files:this.state.files,options:{clear:this.clear,props:this.props}});else{this.setState({msgs:[]});var t=new XMLHttpRequest,n=new FormData;this.props.onBeforeUpload&&this.props.onBeforeUpload({xhr:t,formData:n});var l,s=k(this.state.files);try{for(s.s();!(l=s.n()).done;){var o=l.value;n.append(this.props.name,o,o.name)}}catch(e){s.e(e)}finally{s.f()}t.upload.addEventListener("progress",(function(t){t.lengthComputable&&e.setState({progress:Math.round(100*t.loaded/t.total)},(function(){e.props.onProgress&&e.props.onProgress({originalEvent:t,progress:e.state.progress})}))})),t.onreadystatechange=function(){4===t.readyState&&(e.setState({progress:0}),t.status>=200&&t.status<300?(e.props.fileLimit&&(e.uploadedFileCount+=e.state.files.length),e.props.onUpload&&e.props.onUpload({xhr:t,files:e.state.files})):e.props.onError&&e.props.onError({xhr:t,files:e.state.files}),e.clear())},t.open("POST",this.props.url,!0),this.props.onBeforeSend&&this.props.onBeforeSend({xhr:t,formData:n}),t.withCredentials=this.props.withCredentials,t.send(n)}}},{key:"clear",value:function(){this.setState({files:[]}),this.props.onClear&&this.props.onClear(),this.clearInputElement()}},{key:"choose",value:function(){this.fileInput.click()}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(e){13===e.which&&this.choose()}},{key:"onDragEnter",value:function(e){this.props.disabled||(e.stopPropagation(),e.preventDefault())}},{key:"onDragOver",value:function(e){this.props.disabled||(o.DomHandler.addClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault())}},{key:"onDragLeave",value:function(e){this.props.disabled||o.DomHandler.removeClass(this.content,"p-fileupload-highlight")}},{key:"onDrop",value:function(e){if(!this.props.disabled){o.DomHandler.removeClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault();var t=e.dataTransfer?e.dataTransfer.files:e.target.files;(this.props.multiple||t&&1===t.length)&&this.onFileSelect(e)}}},{key:"onSimpleUploaderClick",value:function(){this.hasFiles()?this.upload():this.fileInput.click()}},{key:"renderChooseButton",value:function(){var e=this,t=this.props.chooseOptions,n=t.style,l=t.icon,s=t.iconOnly,a=o.classNames("p-button p-fileupload-choose p-component",{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-button-icon-only":s},t.className),i=o.classNames("p-button-icon p-button-icon-left p-clickable",{"pi pi-fw pi-plus":!l},l),p="p-button-label p-clickable",u=s?r.default.createElement("span",{className:p,dangerouslySetInnerHTML:{__html:" "}}):r.default.createElement("span",{className:p},this.chooseButtonLabel());return r.default.createElement("span",{className:a,style:n,onClick:this.choose,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},r.default.createElement("input",{ref:function(t){return e.fileInput=t},type:"file",onChange:this.onFileSelect,multiple:this.props.multiple,accept:this.props.accept,disabled:this.chooseDisabled()}),r.default.createElement("span",{className:i}),u,r.default.createElement(o.Ripple,null))}},{key:"renderFile",value:function(e,t){var l=this,s=this.isImage(e)?r.default.createElement("div",null,r.default.createElement("img",{alt:e.name,role:"presentation",src:e.objectURL,width:this.props.previewWidth})):null,a=r.default.createElement("div",{className:"p-fileupload-filename"},e.name),i=r.default.createElement("div",null,this.formatSize(e.size)),p=r.default.createElement("div",null,r.default.createElement(n.Button,{type:"button",icon:"pi pi-times",onClick:function(e){return l.remove(e,t)}})),u=r.default.createElement(r.default.Fragment,null,s,a,i,p);if(this.props.itemTemplate){var c={onRemove:function(e){return l.remove(e,t)},previewElement:s,fileNameElement:a,sizeElement:i,removeElement:p,formatSize:this.formatSize(e.size),element:u,props:this.props};u=o.ObjectUtils.getJSXElement(this.props.itemTemplate,e,c)}return r.default.createElement("div",{className:"p-fileupload-row",key:e.name+e.type+e.size},u)}},{key:"renderFiles",value:function(){var e=this;return r.default.createElement("div",{className:"p-fileupload-files"},this.state.files.map((function(t,n){return e.renderFile(t,n)})))}},{key:"renderEmptyContent",value:function(){return this.props.emptyTemplate&&!this.hasFiles()?o.ObjectUtils.getJSXElement(this.props.emptyTemplate,this.props):null}},{key:"renderProgressBarContent",value:function(){return this.props.progressBarTemplate?o.ObjectUtils.getJSXElement(this.props.progressBarTemplate,this.props):r.default.createElement(s.ProgressBar,{value:this.state.progress,showValue:!1})}},{key:"renderAdvanced",value:function(){var e,t,s,a,i=this,p=o.classNames("p-fileupload p-fileupload-advanced p-component",this.props.className),u=o.classNames("p-fileupload-buttonbar",this.props.headerClassName),c=o.classNames("p-fileupload-content",this.props.contentClassName),h=this.renderChooseButton(),f=this.renderEmptyContent();if(!this.props.auto){var d=this.props.uploadOptions,m=this.props.cancelOptions,y=d.iconOnly?"":this.uploadButtonLabel(),v=m.iconOnly?"":this.cancelButtonLabel();e=r.default.createElement(n.Button,{type:"button",label:y,icon:d.icon||"pi pi-upload",onClick:this.upload,disabled:this.uploadDisabled(),style:d.style,className:d.className}),t=r.default.createElement(n.Button,{type:"button",label:v,icon:m.icon||"pi pi-times",onClick:this.clear,disabled:this.cancelDisabled(),style:m.style,className:m.className})}this.hasFiles()&&(s=this.renderFiles(),a=this.renderProgressBarContent());var b=r.default.createElement("div",{className:u,style:this.props.headerStyle},h,e,t);return this.props.headerTemplate&&(b=o.ObjectUtils.getJSXElement(this.props.headerTemplate,{className:u,chooseButton:h,uploadButton:e,cancelButton:t,element:b,props:this.props})),r.default.createElement("div",{id:this.props.id,className:p,style:this.props.style},b,r.default.createElement("div",{ref:function(e){i.content=e},className:c,style:this.props.contentStyle,onDragEnter:this.onDragEnter,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},a,r.default.createElement(l.Messages,{ref:function(e){return i.messagesUI=e}}),s,f))}},{key:"renderBasic",value:function(){var e=this,t=this.props.chooseOptions,n=o.classNames("p-fileupload p-fileupload-basic p-component",this.props.className),s=o.classNames("p-button p-component p-fileupload-choose",{"p-fileupload-choose-selected":this.hasFiles(),"p-disabled":this.props.disabled,"p-focus":this.state.focused},t.className),a=o.classNames("p-button-icon p-button-icon-left pi",{"pi-plus":!t.icon&&(!this.hasFiles()||this.props.auto),"pi-upload":!t.icon&&this.hasFiles()&&!this.props.auto},t.icon),i="p-button-label p-clickable",p=t.iconOnly?r.default.createElement("span",{className:i,dangerouslySetInnerHTML:{__html:" "}}):r.default.createElement("span",{className:i},this.chooseButtonLabel()),u=this.props.auto?p:r.default.createElement("span",{className:i},this.hasFiles()?this.state.files[0].name:p),c=r.default.createElement("span",{className:a});return r.default.createElement("div",{className:n,style:this.props.style},r.default.createElement(l.Messages,{ref:function(t){return e.messagesUI=t}}),r.default.createElement("span",{className:s,style:t.style,onMouseUp:this.onSimpleUploaderClick,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},c,u,!this.hasFiles()&&r.default.createElement("input",{ref:function(t){return e.fileInput=t},type:"file",accept:this.props.accept,multiple:this.props.multiple,disabled:this.props.disabled,onChange:this.onFileSelect}),r.default.createElement(o.Ripple,null)))}},{key:"render",value:function(){return"advanced"===this.props.mode?this.renderAdvanced():"basic"===this.props.mode?this.renderBasic():void 0}}])&&m(p.prototype,v),g&&m(p,g),B}(t.Component);return I={id:null,name:null,url:null,mode:"advanced",multiple:!1,accept:null,disabled:!1,auto:!1,maxFileSize:null,invalidFileSizeMessageSummary:"{0}: Invalid file size, ",invalidFileSizeMessageDetail:"maximum upload size is {0}.",style:null,className:null,widthCredentials:!1,previewWidth:50,chooseLabel:null,uploadLabel:null,cancelLabel:null,chooseOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},uploadOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},cancelOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},customUpload:!1,headerClassName:null,headerStyle:null,contentClassName:null,contentStyle:null,headerTemplate:null,itemTemplate:null,emptyTemplate:null,progressBarTemplate:null,onBeforeUpload:null,onBeforeSend:null,onUpload:null,onError:null,onClear:null,onSelect:null,onProgress:null,onValidationFail:null,uploadHandler:null,onRemove:null},(w="defaultProps")in(D=N)?Object.defineProperty(D,w,{value:I,enumerable:!0,configurable:!0,writable:!0}):D[w]=I,e.FileUpload=N,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.button,primereact.messages,primereact.progressbar,primereact.core,primereact.api);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.fileupload=function(e,t,n,l,s,o,i){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(t);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function u(e){if(Array.isArray(e))return p(e)}function c(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function f(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(e,t){if(t&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=F(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var l=0,s=function(){};return{s:s,n:function(){return l>=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function F(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 B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,l=new Array(t);n<t;n++)l[n]=e[n];return l}function O(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var w,D,I,N=function(e){b(B,e);var t,a,p,v,g,F=(t=B,a=O(),function(){var e,n=S(t);if(a){var l=S(this).constructor;e=Reflect.construct(n,arguments,l)}else e=n.apply(this,arguments);return E(this,e)});function B(e){var t;return d(this,B),(t=F.call(this,e)).state={files:[],msgs:[],focused:!1},t.choose=t.choose.bind(y(t)),t.upload=t.upload.bind(y(t)),t.clear=t.clear.bind(y(t)),t.onFileSelect=t.onFileSelect.bind(y(t)),t.onDragEnter=t.onDragEnter.bind(y(t)),t.onDragOver=t.onDragOver.bind(y(t)),t.onDragLeave=t.onDragLeave.bind(y(t)),t.onDrop=t.onDrop.bind(y(t)),t.onKeyDown=t.onKeyDown.bind(y(t)),t.onFocus=t.onFocus.bind(y(t)),t.onBlur=t.onBlur.bind(y(t)),t.onSimpleUploaderClick=t.onSimpleUploaderClick.bind(y(t)),t.duplicateIEEvent=!1,t}return p=B,(v=[{key:"hasFiles",value:function(){return this.state.files&&this.state.files.length>0}},{key:"isImage",value:function(e){return/^image\//.test(e.type)}},{key:"chooseDisabled",value:function(){return this.props.disabled||this.props.fileLimit&&this.props.fileLimit<=this.state.files.length+this.uploadedFileCount}},{key:"uploadDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"cancelDisabled",value:function(){return this.props.disabled||!this.hasFiles()}},{key:"chooseButtonLabel",value:function(){return this.props.chooseLabel||this.props.chooseOptions.label||i.localeOption("choose")}},{key:"uploadButtonLabel",value:function(){return this.props.uploadLabel||this.props.uploadOptions.label||i.localeOption("upload")}},{key:"cancelButtonLabel",value:function(){return this.props.cancelLabel||this.props.cancelOptions.label||i.localeOption("cancel")}},{key:"remove",value:function(e,t){this.clearInputElement();var n,l=u(n=this.state.files)||c(n)||h(n)||f(),s=this.state.files[t];l.splice(t,1),this.setState({files:l}),this.props.onRemove&&this.props.onRemove({originalEvent:e,file:s})}},{key:"clearInputElement",value:function(){this.fileInput&&(this.fileInput.value="")}},{key:"clearIEInput",value:function(){this.fileInput&&(this.duplicateIEEvent=!0,this.fileInput.value="")}},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1e3));return parseFloat((e/Math.pow(1e3,t)).toFixed(3))+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}},{key:"onFileSelect",value:function(e){var t=this;if("drop"!==e.type&&this.isIE11()&&this.duplicateIEEvent)this.duplicateIEEvent=!1;else{this.setState({msgs:[]}),this.files=this.state.files||[];for(var n=e.dataTransfer?e.dataTransfer.files:e.target.files,l=0;l<n.length;l++){var s=n[l];this.isFileSelected(s)||this.validate(s)&&(this.isImage(s)&&(s.objectURL=window.URL.createObjectURL(s)),this.files.push(s))}this.setState({files:this.files},(function(){t.hasFiles()&&t.props.auto&&t.upload()})),this.props.onSelect&&this.props.onSelect({originalEvent:e,files:n}),"drop"!==e.type&&this.isIE11()?this.clearIEInput():this.clearInputElement(),"basic"===this.props.mode&&this.files.length>0&&(this.fileInput.style.display="none")}}},{key:"isFileSelected",value:function(e){var t,n=k(this.state.files);try{for(n.s();!(t=n.n()).done;){var l=t.value;if(l.name+l.type+l.size===e.name+e.type+e.size)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"isIE11",value:function(){return!!window.MSInputMethodContext&&!!document.documentMode}},{key:"validate",value:function(e){if(this.props.maxFileSize&&e.size>this.props.maxFileSize){var t={severity:"error",summary:this.props.invalidFileSizeMessageSummary.replace("{0}",e.name),detail:this.props.invalidFileSizeMessageDetail.replace("{0}",this.formatSize(this.props.maxFileSize))};return"advanced"===this.props.mode&&this.messagesUI.show(t),this.props.onValidationFail&&this.props.onValidationFail(e),!1}return!0}},{key:"upload",value:function(){var e=this;if(this.props.customUpload)this.props.fileLimit&&(this.uploadedFileCount+=this.state.files.length),this.props.uploadHandler&&this.props.uploadHandler({files:this.state.files,options:{clear:this.clear,props:this.props}});else{this.setState({msgs:[]});var t=new XMLHttpRequest,n=new FormData;this.props.onBeforeUpload&&this.props.onBeforeUpload({xhr:t,formData:n});var l,s=k(this.state.files);try{for(s.s();!(l=s.n()).done;){var o=l.value;n.append(this.props.name,o,o.name)}}catch(e){s.e(e)}finally{s.f()}t.upload.addEventListener("progress",(function(t){t.lengthComputable&&e.setState({progress:Math.round(100*t.loaded/t.total)},(function(){e.props.onProgress&&e.props.onProgress({originalEvent:t,progress:e.state.progress})}))})),t.onreadystatechange=function(){4===t.readyState&&(e.setState({progress:0}),t.status>=200&&t.status<300?(e.props.fileLimit&&(e.uploadedFileCount+=e.state.files.length),e.props.onUpload&&e.props.onUpload({xhr:t,files:e.state.files})):e.props.onError&&e.props.onError({xhr:t,files:e.state.files}),e.clear())},t.open("POST",this.props.url,!0),this.props.onBeforeSend&&this.props.onBeforeSend({xhr:t,formData:n}),t.withCredentials=this.props.withCredentials,t.send(n)}}},{key:"clear",value:function(){this.setState({files:[]}),this.props.onClear&&this.props.onClear(),this.clearInputElement()}},{key:"choose",value:function(){this.fileInput.click()}},{key:"onFocus",value:function(){this.setState({focused:!0})}},{key:"onBlur",value:function(){this.setState({focused:!1})}},{key:"onKeyDown",value:function(e){13===e.which&&this.choose()}},{key:"onDragEnter",value:function(e){this.props.disabled||(e.stopPropagation(),e.preventDefault())}},{key:"onDragOver",value:function(e){this.props.disabled||(o.DomHandler.addClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault())}},{key:"onDragLeave",value:function(e){this.props.disabled||o.DomHandler.removeClass(this.content,"p-fileupload-highlight")}},{key:"onDrop",value:function(e){if(!this.props.disabled){o.DomHandler.removeClass(this.content,"p-fileupload-highlight"),e.stopPropagation(),e.preventDefault();var t=e.dataTransfer?e.dataTransfer.files:e.target.files;(this.props.multiple||t&&1===t.length)&&this.onFileSelect(e)}}},{key:"onSimpleUploaderClick",value:function(){this.hasFiles()?this.upload():this.fileInput.click()}},{key:"renderChooseButton",value:function(){var e=this,t=this.props.chooseOptions,n=t.style,l=t.icon,s=t.iconOnly,i=o.classNames("p-button p-fileupload-choose p-component",{"p-disabled":this.props.disabled,"p-focus":this.state.focused,"p-button-icon-only":s},t.className),a=o.classNames("p-button-icon p-button-icon-left p-clickable",{"pi pi-fw pi-plus":!l},l),p="p-button-label p-clickable",u=s?r.default.createElement("span",{className:p,dangerouslySetInnerHTML:{__html:" "}}):r.default.createElement("span",{className:p},this.chooseButtonLabel());return r.default.createElement("span",{className:i,style:n,onClick:this.choose,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},r.default.createElement("input",{ref:function(t){return e.fileInput=t},type:"file",onChange:this.onFileSelect,multiple:this.props.multiple,accept:this.props.accept,disabled:this.chooseDisabled()}),r.default.createElement("span",{className:a}),u,r.default.createElement(o.Ripple,null))}},{key:"renderFile",value:function(e,t){var l=this,s=this.isImage(e)?r.default.createElement("div",null,r.default.createElement("img",{alt:e.name,role:"presentation",src:e.objectURL,width:this.props.previewWidth})):null,i=r.default.createElement("div",{className:"p-fileupload-filename"},e.name),a=r.default.createElement("div",null,this.formatSize(e.size)),p=r.default.createElement("div",null,r.default.createElement(n.Button,{type:"button",icon:"pi pi-times",onClick:function(e){return l.remove(e,t)}})),u=r.default.createElement(r.default.Fragment,null,s,i,a,p);if(this.props.itemTemplate){var c={onRemove:function(e){return l.remove(e,t)},previewElement:s,fileNameElement:i,sizeElement:a,removeElement:p,formatSize:this.formatSize(e.size),element:u,props:this.props};u=o.ObjectUtils.getJSXElement(this.props.itemTemplate,e,c)}return r.default.createElement("div",{className:"p-fileupload-row",key:e.name+e.type+e.size},u)}},{key:"renderFiles",value:function(){var e=this;return r.default.createElement("div",{className:"p-fileupload-files"},this.state.files.map((function(t,n){return e.renderFile(t,n)})))}},{key:"renderEmptyContent",value:function(){return this.props.emptyTemplate&&!this.hasFiles()?o.ObjectUtils.getJSXElement(this.props.emptyTemplate,this.props):null}},{key:"renderProgressBarContent",value:function(){return this.props.progressBarTemplate?o.ObjectUtils.getJSXElement(this.props.progressBarTemplate,this.props):r.default.createElement(s.ProgressBar,{value:this.state.progress,showValue:!1})}},{key:"renderAdvanced",value:function(){var e,t,s,i,a=this,p=o.classNames("p-fileupload p-fileupload-advanced p-component",this.props.className),u=o.classNames("p-fileupload-buttonbar",this.props.headerClassName),c=o.classNames("p-fileupload-content",this.props.contentClassName),h=this.renderChooseButton(),f=this.renderEmptyContent();if(!this.props.auto){var d=this.props.uploadOptions,m=this.props.cancelOptions,y=d.iconOnly?"":this.uploadButtonLabel(),v=m.iconOnly?"":this.cancelButtonLabel();e=r.default.createElement(n.Button,{type:"button",label:y,icon:d.icon||"pi pi-upload",onClick:this.upload,disabled:this.uploadDisabled(),style:d.style,className:d.className}),t=r.default.createElement(n.Button,{type:"button",label:v,icon:m.icon||"pi pi-times",onClick:this.clear,disabled:this.cancelDisabled(),style:m.style,className:m.className})}this.hasFiles()&&(s=this.renderFiles(),i=this.renderProgressBarContent());var b=r.default.createElement("div",{className:u,style:this.props.headerStyle},h,e,t);return this.props.headerTemplate&&(b=o.ObjectUtils.getJSXElement(this.props.headerTemplate,{className:u,chooseButton:h,uploadButton:e,cancelButton:t,element:b,props:this.props})),r.default.createElement("div",{id:this.props.id,className:p,style:this.props.style},b,r.default.createElement("div",{ref:function(e){a.content=e},className:c,style:this.props.contentStyle,onDragEnter:this.onDragEnter,onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},i,r.default.createElement(l.Messages,{ref:function(e){return a.messagesUI=e}}),s,f))}},{key:"renderBasic",value:function(){var e=this,t=this.props.chooseOptions,n=o.classNames("p-fileupload p-fileupload-basic p-component",this.props.className),s=o.classNames("p-button p-component p-fileupload-choose",{"p-fileupload-choose-selected":this.hasFiles(),"p-disabled":this.props.disabled,"p-focus":this.state.focused},t.className),i=o.classNames("p-button-icon p-button-icon-left pi",{"pi-plus":!t.icon&&(!this.hasFiles()||this.props.auto),"pi-upload":!t.icon&&this.hasFiles()&&!this.props.auto},t.icon),a="p-button-label p-clickable",p=t.iconOnly?r.default.createElement("span",{className:a,dangerouslySetInnerHTML:{__html:" "}}):r.default.createElement("span",{className:a},this.chooseButtonLabel()),u=this.props.auto?p:r.default.createElement("span",{className:a},this.hasFiles()?this.state.files[0].name:p),c=r.default.createElement("span",{className:i});return r.default.createElement("div",{className:n,style:this.props.style},r.default.createElement(l.Messages,{ref:function(t){return e.messagesUI=t}}),r.default.createElement("span",{className:s,style:t.style,onMouseUp:this.onSimpleUploaderClick,onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,tabIndex:0},c,u,!this.hasFiles()&&r.default.createElement("input",{ref:function(t){return e.fileInput=t},type:"file",accept:this.props.accept,multiple:this.props.multiple,disabled:this.props.disabled,onChange:this.onFileSelect}),r.default.createElement(o.Ripple,null)))}},{key:"render",value:function(){return"advanced"===this.props.mode?this.renderAdvanced():"basic"===this.props.mode?this.renderBasic():void 0}}])&&m(p.prototype,v),g&&m(p,g),B}(t.Component);return I={id:null,name:null,url:null,mode:"advanced",multiple:!1,accept:null,disabled:!1,auto:!1,maxFileSize:null,invalidFileSizeMessageSummary:"{0}: Invalid file size, ",invalidFileSizeMessageDetail:"maximum upload size is {0}.",style:null,className:null,widthCredentials:!1,previewWidth:50,chooseLabel:null,uploadLabel:null,cancelLabel:null,chooseOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},uploadOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},cancelOptions:{label:null,icon:null,iconOnly:!1,className:null,style:null},customUpload:!1,headerClassName:null,headerStyle:null,contentClassName:null,contentStyle:null,headerTemplate:null,itemTemplate:null,emptyTemplate:null,progressBarTemplate:null,onBeforeUpload:null,onBeforeSend:null,onUpload:null,onError:null,onClear:null,onSelect:null,onProgress:null,onValidationFail:null,uploadHandler:null,onRemove:null},(D="defaultProps")in(w=N)?Object.defineProperty(w,D,{value:I,enumerable:!0,configurable:!0,writable:!0}):w[D]=I,e.FileUpload=N,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.button,primereact.messages,primereact.progressbar,primereact.core,primereact.api);
|
|
@@ -102,6 +102,8 @@ function _assertThisInitialized(self) {
|
|
|
102
102
|
function _possibleConstructorReturn(self, call) {
|
|
103
103
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
104
104
|
return call;
|
|
105
|
+
} else if (call !== void 0) {
|
|
106
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
return _assertThisInitialized(self);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function r(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 o=n(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function r(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 o=n(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return s(e)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var y,h,v,b=function(n){a(b,e.Component);var u,l,s,y,h,v=(u=b,l=d(),function(){var e,t=p(u);if(l){var n=p(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return f(this,e)});function b(){return i(this,b),v.apply(this,arguments)}return s=b,(y=[{key:"componentDidMount",value:function(){if(console.warn("FullCalendar component is deprecated. Use FullCalendar component of '@fullcalendar/react' package."),this.config={theme:!0},this.props.options)for(var e in this.props.options)this.config[e]=this.props.options[e];this.initialize()}},{key:"componentDidUpdate",value:function(e){if(this.calendar){if(t.ObjectUtils.equals(e.events,this.props.events)||(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this.props.events)),!t.ObjectUtils.equals(e.options,this.props.options))for(var n in this.props.options){var r=this.props.options[n];this.config[n]=r,this.calendar.setOption(n,r)}}else this.initialize()}},{key:"initialize",value:function(){var e=this;Promise.resolve().then((function(){return r(require("@fullcalendar/core"))})).then((function(t){t&&t.Calendar&&(e.calendar=new t.Calendar(e.element,e.config),e.calendar.render(),e.props.events&&(e.calendar.removeAllEventSources(),e.calendar.addEventSource(e.props.events)))}))}},{key:"componentWillUnmount",value:function(){this.calendar&&this.calendar.destroy()}},{key:"render",value:function(){var e=this;return o.default.createElement("div",{id:this.props.id,ref:function(t){return e.element=t},style:this.props.style,className:this.props.className})}}])&&c(s.prototype,y),h&&c(s,h),b}();v={id:null,events:[],style:null,className:null,options:null},(h="defaultProps")in(y=b)?Object.defineProperty(y,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):y[h]=v,exports.FullCalendar=b;
|
|
@@ -74,6 +74,8 @@ function _assertThisInitialized(self) {
|
|
|
74
74
|
function _possibleConstructorReturn(self, call) {
|
|
75
75
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
76
76
|
return call;
|
|
77
|
+
} else if (call !== void 0) {
|
|
78
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
return _assertThisInitialized(self);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{Component as t}from"react";import{ObjectUtils as n}from"primereact/core";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){
|
|
1
|
+
import e,{Component as t}from"react";import{ObjectUtils as n}from"primereact/core";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return l(e)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var f,y,d,h=function(i){c(v,t);var a,l,f,y,d,h=(a=v,l=p(),function(){var e,t=u(a);if(l){var n=u(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return s(this,e)});function v(){return o(this,v),h.apply(this,arguments)}return f=v,(y=[{key:"componentDidMount",value:function(){if(console.warn("FullCalendar component is deprecated. Use FullCalendar component of '@fullcalendar/react' package."),this.config={theme:!0},this.props.options)for(var e in this.props.options)this.config[e]=this.props.options[e];this.initialize()}},{key:"componentDidUpdate",value:function(e){if(this.calendar){if(n.equals(e.events,this.props.events)||(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this.props.events)),!n.equals(e.options,this.props.options))for(var t in this.props.options){var o=this.props.options[t];this.config[t]=o,this.calendar.setOption(t,o)}}else this.initialize()}},{key:"initialize",value:function(){var e=this;import("@fullcalendar/core").then((function(t){t&&t.Calendar&&(e.calendar=new t.Calendar(e.element,e.config),e.calendar.render(),e.props.events&&(e.calendar.removeAllEventSources(),e.calendar.addEventSource(e.props.events)))}))}},{key:"componentWillUnmount",value:function(){this.calendar&&this.calendar.destroy()}},{key:"render",value:function(){var t=this;return e.createElement("div",{id:this.props.id,ref:function(e){return t.element=e},style:this.props.style,className:this.props.className})}}])&&r(f.prototype,y),d&&r(f,d),v}();d={id:null,events:[],style:null,className:null,options:null},(y="defaultProps")in(f=h)?Object.defineProperty(f,y,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[y]=d;export{h as FullCalendar};
|
|
@@ -79,6 +79,8 @@ this.primereact.fullcalendar = (function (exports, React, core) {
|
|
|
79
79
|
function _possibleConstructorReturn(self, call) {
|
|
80
80
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
81
81
|
return call;
|
|
82
|
+
} else if (call !== void 0) {
|
|
83
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
return _assertThisInitialized(self);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.fullcalendar=function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.fullcalendar=function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(t);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if(t&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var y,h,v,m=function(e){l(h,e);var t,r,a,s,u,y=(t=h,r=d(),function(){var e,n=p(t);if(r){var o=p(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return f(this,e)});function h(){return i(this,h),y.apply(this,arguments)}return a=h,(s=[{key:"componentDidMount",value:function(){if(console.warn("FullCalendar component is deprecated. Use FullCalendar component of '@fullcalendar/react' package."),this.config={theme:!0},this.props.options)for(var e in this.props.options)this.config[e]=this.props.options[e];this.initialize()}},{key:"componentDidUpdate",value:function(e){if(this.calendar){if(n.ObjectUtils.equals(e.events,this.props.events)||(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this.props.events)),!n.ObjectUtils.equals(e.options,this.props.options))for(var t in this.props.options){var r=this.props.options[t];this.config[t]=r,this.calendar.setOption(t,r)}}else this.initialize()}},{key:"initialize",value:function(){var e=this;import("@fullcalendar/core").then((function(t){t&&t.Calendar&&(e.calendar=new t.Calendar(e.element,e.config),e.calendar.render(),e.props.events&&(e.calendar.removeAllEventSources(),e.calendar.addEventSource(e.props.events)))}))}},{key:"componentWillUnmount",value:function(){this.calendar&&this.calendar.destroy()}},{key:"render",value:function(){var e=this;return o.default.createElement("div",{id:this.props.id,ref:function(t){return e.element=t},style:this.props.style,className:this.props.className})}}])&&c(a.prototype,s),u&&c(a,u),h}(t.Component);return v={id:null,events:[],style:null,className:null,options:null},(h="defaultProps")in(y=m)?Object.defineProperty(y,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):y[h]=v,e.FullCalendar=m,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.core);
|
package/galleria/galleria.cjs.js
CHANGED
|
@@ -82,6 +82,8 @@ function _typeof(obj) {
|
|
|
82
82
|
function _possibleConstructorReturn(self, call) {
|
|
83
83
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
84
84
|
return call;
|
|
85
|
+
} else if (call !== void 0) {
|
|
86
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
return _assertThisInitialized(self);
|
|
@@ -617,8 +619,8 @@ var GalleriaThumbnails = /*#__PURE__*/function (_Component2) {
|
|
|
617
619
|
}
|
|
618
620
|
}, {
|
|
619
621
|
key: "onTransitionEnd",
|
|
620
|
-
value: function onTransitionEnd() {
|
|
621
|
-
if (this.itemsContainer) {
|
|
622
|
+
value: function onTransitionEnd(e) {
|
|
623
|
+
if (this.itemsContainer && e.propertyName === 'transform') {
|
|
622
624
|
core.DomHandler.addClass(this.itemsContainer, 'p-items-hidden');
|
|
623
625
|
this.itemsContainer.style.transition = '';
|
|
624
626
|
}
|
|
@@ -923,6 +925,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
923
925
|
_this = _super.call(this, props);
|
|
924
926
|
_this.state = {
|
|
925
927
|
visible: false,
|
|
928
|
+
numVisible: props.numVisible,
|
|
926
929
|
slideShowActive: false
|
|
927
930
|
};
|
|
928
931
|
|
|
@@ -985,7 +988,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
985
988
|
key: "onEntering",
|
|
986
989
|
value: function onEntering() {
|
|
987
990
|
core.ZIndexUtils.set('modal', this.mask, this.props.baseZIndex);
|
|
988
|
-
core.DomHandler.
|
|
991
|
+
core.DomHandler.addMultipleClasses(this.mask, 'p-component-overlay p-component-overlay-enter');
|
|
989
992
|
}
|
|
990
993
|
}, {
|
|
991
994
|
key: "onEntered",
|
|
@@ -996,7 +999,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
996
999
|
key: "onExit",
|
|
997
1000
|
value: function onExit() {
|
|
998
1001
|
core.DomHandler.removeClass(document.body, 'p-overflow-hidden');
|
|
999
|
-
core.DomHandler.addClass(this.mask, 'p-
|
|
1002
|
+
core.DomHandler.addClass(this.mask, 'p-component-overlay-leave');
|
|
1000
1003
|
}
|
|
1001
1004
|
}, {
|
|
1002
1005
|
key: "onExited",
|
|
@@ -1050,6 +1053,23 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
1050
1053
|
value: function isVertical() {
|
|
1051
1054
|
return this.props.thumbnailsPosition === 'left' || this.props.thumbnailsPosition === 'right';
|
|
1052
1055
|
}
|
|
1056
|
+
}, {
|
|
1057
|
+
key: "componentDidUpdate",
|
|
1058
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1059
|
+
if (prevProps.value !== this.props.value) {
|
|
1060
|
+
if (this.props.value && this.props.value.length < this.state.numVisible) {
|
|
1061
|
+
this.setState({
|
|
1062
|
+
numVisible: this.props.value.length
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
if (prevProps.numVisible !== this.props.numVisible) {
|
|
1068
|
+
this.setState({
|
|
1069
|
+
numVisible: this.props.numVisible
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1053
1073
|
}, {
|
|
1054
1074
|
key: "componentWillUnmount",
|
|
1055
1075
|
value: function componentWillUnmount() {
|
|
@@ -1133,7 +1153,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
1133
1153
|
activeItemIndex: this.activeItemIndex,
|
|
1134
1154
|
onActiveItemChange: this.onActiveItemChange,
|
|
1135
1155
|
itemTemplate: this.props.thumbnail,
|
|
1136
|
-
numVisible: this.
|
|
1156
|
+
numVisible: this.state.numVisible,
|
|
1137
1157
|
responsiveOptions: this.props.responsiveOptions,
|
|
1138
1158
|
circular: this.props.circular,
|
|
1139
1159
|
isVertical: isVertical,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),e}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?o(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var f=function(i){c(d,e.Component);var a,l,p=(a=d,l=v(),function(){var e,t=h(a);if(l){var i=h(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return u(this,e)});function d(e){var t;return s(this,d),(t=p.call(this,e)).navForward=t.navForward.bind(o(t)),t.navBackward=t.navBackward.bind(o(t)),t.next=t.next.bind(o(t)),t.prev=t.prev.bind(o(t)),t}return r(d,[{key:"step",value:function(e){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*e,"%, 0)"):"translate3d(".concat(100*e,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()}},{key:"onIndicatorClick",value:function(e){this.stopSlideShow(),this.props.onActiveItemChange({index:e})}},{key:"onIndicatorMouseEnter",value:function(e){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"onIndicatorKeyDown",value:function(e,t){13===e.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex,i=t.classNames("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":e});return n.default.createElement("button",{type:"button",className:i,onClick:this.navBackward,disabled:e},n.default.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,i=t.classNames("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":e});return n.default.createElement("button",{type:"button",className:i,onClick:this.navForward,disabled:e},n.default.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var e=this.props.caption(this.props.value[this.props.activeItemIndex]);return n.default.createElement("div",{className:"p-galleria-caption"},e)}return null}},{key:"renderIndicator",value:function(e){var i=this,s=this.props.indicator&&this.props.indicator(e),a=t.classNames("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===e});return s||(s=n.default.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},n.default.createElement(t.Ripple,null))),n.default.createElement("li",{className:a,key:"p-galleria-indicator-"+e,tabIndex:0,onClick:function(){return i.onIndicatorClick(e)},onMouseEnter:function(){return i.onIndicatorMouseEnter(e)},onKeyDown:function(t){return i.onIndicatorKeyDown(t,e)}},s)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var e=t.classNames("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),i=[],s=0;s<this.props.value.length;s++)i.push(this.renderIndicator(s));return n.default.createElement("ul",{className:e},i)}return null}},{key:"render",value:function(){var e=this,t=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),i=this.renderBackwardNavigator(),s=this.renderForwardNavigator(),a=this.renderCaption(),r=this.renderIndicators();return n.default.createElement("div",{ref:function(t){return e.props.forwardRef(t)},className:"p-galleria-item-wrapper"},n.default.createElement("div",{className:"p-galleria-item-container"},i,n.default.createElement("div",{className:"p-galleria-item"},t),s,a),r)}}]),d}(),b=n.default.forwardRef((function(e,t){return n.default.createElement(f,m({forwardRef:t},e))}));function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function g(e){if(Array.isArray(e))return I(e)}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function w(e,t){if(e){if("string"==typeof e)return I(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?I(e,t):void 0}}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e){var t=x();return function(){var i,n=h(e);if(t){var s=h(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return u(this,i)}}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var E=function(i){c(l,e.Component);var a=k(l);function l(e){var t;return s(this,l),(t=a.call(this,e)).onItemClick=t.onItemClick.bind(o(t)),t.onItemKeyDown=t.onItemKeyDown.bind(o(t)),t}return r(l,[{key:"onItemClick",value:function(e){this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"onItemKeyDown",value:function(e){13===e.which&&this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"render",value:function(){var e=this.props.template&&this.props.template(this.props.item),i=t.classNames(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return n.default.createElement("div",{className:i},n.default.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},e))}}]),l}();d(E,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var C=function(i){c(l,e.Component);var a=k(l);function l(e){var i;return s(this,l),(i=a.call(this,e)).state={numVisible:e.numVisible,totalShiftedItems:0,page:0},i.navForward=i.navForward.bind(o(i)),i.navBackward=i.navBackward.bind(o(i)),i.onTransitionEnd=i.onTransitionEnd.bind(o(i)),i.onTouchStart=i.onTouchStart.bind(o(i)),i.onTouchMove=i.onTouchMove.bind(o(i)),i.onTouchEnd=i.onTouchEnd.bind(o(i)),i.onItemClick=i.onItemClick.bind(o(i)),i.attributeSelector=t.UniqueComponentId(),i}return r(l,[{key:"step",value:function(e){var i=this.state.totalShiftedItems+e;e<0&&-1*i+this.state.numVisible>this.props.value.length-1?i=this.state.numVisible-this.props.value.length:e>0&&i>0&&(i=0),this.props.circular&&(e<0&&this.props.value.length-1===this.props.activeItemIndex?i=0:e>0&&0===this.props.activeItemIndex&&(i=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:i})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var e=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?e:e-1}},{key:"navBackward",value:function(e){this.stopSlideShow();var t=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(t+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:t}),e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow();var t=this.props.activeItemIndex+1;t+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:t}),e.cancelable&&e.preventDefault()}},{key:"onItemClick",value:function(e){this.stopSlideShow();var t=e.index;if(t!==this.props.activeItemIndex){var i=t+this.state.totalShiftedItems,n=0;t<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:t})}}},{key:"onTransitionEnd",value:function(){this.itemsContainer&&(t.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(e){var t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}}},{key:"onTouchMove",value:function(e){e.cancelable&&e.preventDefault()}},{key:"onTouchEnd",value:function(e){var t=e.changedTouches[0];this.changePageOnTouch(e,this.props.isVertical?t.pageY-this.startPos.y:t.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(e,t){t<0?this.navForward(e):this.navBackward(e)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=document.createElement("style"),document.body.appendChild(this.thumbnailsStyle));var e,t="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=g(e=this.props.responsiveOptions)||y(e)||w(e)||S(),this.responsiveOptions.sort((function(e,t){var i=e.breakpoint,n=t.breakpoint;return-1*(null==i&&null!=n?-1:null!=i&&null==n?1:null==i&&null==n?0:"string"==typeof i&&"string"==typeof n?i.localeCompare(n,void 0,{numeric:!0}):i<n?-1:i>n?1:0)}));for(var i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];t+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=t}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var e=window.innerWidth,t={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=e&&(t=n)}this.state.numVisible!==t.numVisible&&this.setState({numVisible:t.numVisible})}}},{key:"bindDocumentListeners",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(e,i){var n=this.state.totalShiftedItems;i.numVisible===this.state.numVisible&&e.activeItemIndex===this.props.activeItemIndex||((n=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:n}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(n*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(n*(100/this.state.numVisible),"%, 0, 0)"),e.activeItemIndex!==this.props.activeItemIndex&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var e=this;return this.props.value.map((function(t,i){var s=-1*e.state.totalShiftedItems,a=s+e.state.numVisible-1;return n.default.createElement(E,{key:i,index:i,template:e.props.itemTemplate,item:t,active:s<=i&&a>=i,start:s===i,end:a===i,onItemClick:e.onItemClick,current:e.props.activeItemIndex===i})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,i=t.classNames("p-galleria-thumbnail-prev p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return n.default.createElement("button",{className:i,onClick:this.navBackward,disabled:e},n.default.createElement("span",{className:s}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,i=t.classNames("p-galleria-thumbnail-next p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return n.default.createElement("button",{className:i,onClick:this.navForward,disabled:e},n.default.createElement("span",{className:s}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderContent",value:function(){var e=this,t=this.renderItems(),i=this.props.isVertical?this.props.contentHeight:"",s=this.renderBackwardNavigator(),a=this.renderForwardNavigator();return n.default.createElement("div",{className:"p-galleria-thumbnail-container"},s,n.default.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:i}},n.default.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},t)),a)}},{key:"render",value:function(){var e=this.renderContent();return n.default.createElement("div",{className:"p-galleria-thumbnail-wrapper"},e)}}]),l}();function N(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function O(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?N(Object(i),!0).forEach((function(t){d(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):N(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function P(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var V=function(i){c(d,e.Component);var a,l,p=(a=d,l=P(),function(){var e,t=h(a);if(l){var i=h(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return u(this,e)});function d(e){var t;return s(this,d),(t=p.call(this,e)).state={visible:!1,slideShowActive:!1},t.props.onItemChange||(t.state=O(O({},t.state),{},{activeIndex:e.activeIndex})),t.onActiveItemChange=t.onActiveItemChange.bind(o(t)),t.show=t.show.bind(o(t)),t.hide=t.hide.bind(o(t)),t.startSlideShow=t.startSlideShow.bind(o(t)),t.stopSlideShow=t.stopSlideShow.bind(o(t)),t.onEnter=t.onEnter.bind(o(t)),t.onEntering=t.onEntering.bind(o(t)),t.onEntered=t.onEntered.bind(o(t)),t.onExit=t.onExit.bind(o(t)),t.onExited=t.onExited.bind(o(t)),t.galleriaRef=n.default.createRef(),t}return r(d,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(e){this.props.onItemChange?this.props.onItemChange(e):this.setState({activeIndex:e.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){t.DomHandler.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){t.ZIndexUtils.set("modal",this.mask,this.props.baseZIndex),t.DomHandler.addClass(this.mask,"p-component-overlay")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){t.DomHandler.removeClass(document.body,"p-overflow-hidden"),t.DomHandler.addClass(this.mask,"p-galleria-mask-leave")}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var e=this;this.interval=setInterval((function(){e.onActiveItemChange({index:e.props.circular&&e.props.value.length-1===e.activeItemIndex?0:e.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(e,t){var i=["top","left","bottom","right"].find((function(e){return e===t}));return i?"".concat(e,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),t.ZIndexUtils.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?n.default.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?n.default.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var e=this,i=this.isVertical(),s=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),a=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),r=t.classNames("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},s,a),o=this.props.fullScreen&&n.default.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},n.default.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),n.default.createElement(t.Ripple,null)),l=this.renderHeader(),c=this.renderFooter();return n.default.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:r,style:this.props.style},o,l,n.default.createElement("div",{className:"p-galleria-content"},n.default.createElement(b,{ref:function(t){return e.previewContent=t},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&n.default.createElement(C,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.props.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:i,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),c)}},{key:"renderGalleria",value:function(){var e=this,i=this.renderElement();if(this.props.fullScreen){var s=t.classNames("p-galleria-mask",{"p-galleria-visible":this.state.visible});return n.default.createElement(t.Portal,{element:n.default.createElement("div",{ref:function(t){return e.mask=t},className:s},n.default.createElement(t.CSSTransition,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},i))})}return i}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),d}();d(V,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null}),exports.Galleria=V;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/core");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=i(e);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(e)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function m(){return(m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var f=function(i){c(d,e.Component);var r,l,p=(r=d,l=v(),function(){var e,t=h(r);if(l){var i=h(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return u(this,e)});function d(e){var t;return s(this,d),(t=p.call(this,e)).navForward=t.navForward.bind(o(t)),t.navBackward=t.navBackward.bind(o(t)),t.next=t.next.bind(o(t)),t.prev=t.prev.bind(o(t)),t}return a(d,[{key:"step",value:function(e){this.itemsContainer&&(this.itemsContainer.style.transform=this.isVertical()?"translate3d(0, ".concat(100*e,"%, 0)"):"translate3d(".concat(100*e,"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s")}},{key:"next",value:function(){this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:this.props.activeItemIndex+1})}},{key:"prev",value:function(){this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"navBackward",value:function(e){this.stopSlideShow(),this.prev(),e&&e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow(),this.next(),e&&e.cancelable&&e.preventDefault()}},{key:"onIndicatorClick",value:function(e){this.stopSlideShow(),this.props.onActiveItemChange({index:e})}},{key:"onIndicatorMouseEnter",value:function(e){this.props.changeItemOnIndicatorHover&&(this.stopSlideShow(),this.props.onActiveItemChange({index:e}))}},{key:"onIndicatorKeyDown",value:function(e,t){13===e.which&&(this.stopSlideShow(),this.props.onActiveItemChange({index:t}))}},{key:"componentDidMount",value:function(){this.props.autoPlay&&this.props.startSlideShow()}},{key:"renderBackwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex,i=t.classNames("p-galleria-item-prev p-galleria-item-nav p-link",{"p-disabled":e});return n.default.createElement("button",{type:"button",className:i,onClick:this.navBackward,disabled:e},n.default.createElement("span",{className:"p-galleria-item-prev-icon pi pi-chevron-left"}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showItemNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1,i=t.classNames("p-galleria-item-next p-galleria-item-nav p-link",{"p-disabled":e});return n.default.createElement("button",{type:"button",className:i,onClick:this.navForward,disabled:e},n.default.createElement("span",{className:"p-galleria-item-next-icon pi pi-chevron-right"}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderCaption",value:function(){if(this.props.caption){var e=this.props.caption(this.props.value[this.props.activeItemIndex]);return n.default.createElement("div",{className:"p-galleria-caption"},e)}return null}},{key:"renderIndicator",value:function(e){var i=this,s=this.props.indicator&&this.props.indicator(e),r=t.classNames("p-galleria-indicator",{"p-highlight":this.props.activeItemIndex===e});return s||(s=n.default.createElement("button",{type:"button",tabIndex:-1,className:"p-link"},n.default.createElement(t.Ripple,null))),n.default.createElement("li",{className:r,key:"p-galleria-indicator-"+e,tabIndex:0,onClick:function(){return i.onIndicatorClick(e)},onMouseEnter:function(){return i.onIndicatorMouseEnter(e)},onKeyDown:function(t){return i.onIndicatorKeyDown(t,e)}},s)}},{key:"renderIndicators",value:function(){if(this.props.showIndicators){for(var e=t.classNames("p-galleria-indicators p-reset",this.props.indicatorsContentClassName),i=[],s=0;s<this.props.value.length;s++)i.push(this.renderIndicator(s));return n.default.createElement("ul",{className:e},i)}return null}},{key:"render",value:function(){var e=this,t=this.props.itemTemplate&&this.props.itemTemplate(this.props.value[this.props.activeItemIndex]),i=this.renderBackwardNavigator(),s=this.renderForwardNavigator(),r=this.renderCaption(),a=this.renderIndicators();return n.default.createElement("div",{ref:function(t){return e.props.forwardRef(t)},className:"p-galleria-item-wrapper"},n.default.createElement("div",{className:"p-galleria-item-container"},i,n.default.createElement("div",{className:"p-galleria-item"},t),s,r),a)}}]),d}(),b=n.default.forwardRef((function(e,t){return n.default.createElement(f,m({forwardRef:t},e))}));function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function y(e){if(Array.isArray(e))return I(e)}function g(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function w(e,t){if(e){if("string"==typeof e)return I(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?I(e,t):void 0}}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e){var t=x();return function(){var i,n=h(e);if(t){var s=h(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return u(this,i)}}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var E=function(i){c(l,e.Component);var r=k(l);function l(e){var t;return s(this,l),(t=r.call(this,e)).onItemClick=t.onItemClick.bind(o(t)),t.onItemKeyDown=t.onItemKeyDown.bind(o(t)),t}return a(l,[{key:"onItemClick",value:function(e){this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"onItemKeyDown",value:function(e){13===e.which&&this.props.onItemClick({originalEvent:e,index:this.props.index})}},{key:"render",value:function(){var e=this.props.template&&this.props.template(this.props.item),i=t.classNames(this.props.className,"p-galleria-thumbnail-item",{"p-galleria-thumbnail-item-current":this.props.current,"p-galleria-thumbnail-item-active":this.props.active,"p-galleria-thumbnail-item-start":this.props.start,"p-galleria-thumbnail-item-end":this.props.end});return n.default.createElement("div",{className:i},n.default.createElement("div",{className:"p-galleria-thumbnail-item-content",tabIndex:this.props.active?0:null,onClick:this.onItemClick,onKeyDown:this.onItemKeyDown},e))}}]),l}();d(E,"defaultProps",{index:null,template:null,item:null,current:!1,active:!1,start:!1,end:!1,className:null,onItemClick:null});var C=function(i){c(l,e.Component);var r=k(l);function l(e){var i;return s(this,l),(i=r.call(this,e)).state={numVisible:e.numVisible,totalShiftedItems:0,page:0},i.navForward=i.navForward.bind(o(i)),i.navBackward=i.navBackward.bind(o(i)),i.onTransitionEnd=i.onTransitionEnd.bind(o(i)),i.onTouchStart=i.onTouchStart.bind(o(i)),i.onTouchMove=i.onTouchMove.bind(o(i)),i.onTouchEnd=i.onTouchEnd.bind(o(i)),i.onItemClick=i.onItemClick.bind(o(i)),i.attributeSelector=t.UniqueComponentId(),i}return a(l,[{key:"step",value:function(e){var i=this.state.totalShiftedItems+e;e<0&&-1*i+this.state.numVisible>this.props.value.length-1?i=this.state.numVisible-this.props.value.length:e>0&&i>0&&(i=0),this.props.circular&&(e<0&&this.props.value.length-1===this.props.activeItemIndex?i=0:e>0&&0===this.props.activeItemIndex&&(i=this.state.numVisible-this.props.value.length)),this.itemsContainer&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(i*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(i*(100/this.state.numVisible),"%, 0, 0)"),this.itemsContainer.style.transition="transform 500ms ease 0s"),this.setState({totalShiftedItems:i})}},{key:"stopSlideShow",value:function(){this.props.slideShowActive&&this.props.stopSlideShow&&this.props.stopSlideShow()}},{key:"getMedianItemIndex",value:function(){var e=Math.floor(this.state.numVisible/2);return this.state.numVisible%2?e:e-1}},{key:"navBackward",value:function(e){this.stopSlideShow();var t=0!==this.props.activeItemIndex?this.props.activeItemIndex-1:0;this.state.numVisible-(t+this.state.totalShiftedItems)-1>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems!=0||this.props.circular)&&this.step(1),this.props.onActiveItemChange({index:this.props.circular&&0===this.props.activeItemIndex?this.props.value.length-1:t}),e.cancelable&&e.preventDefault()}},{key:"navForward",value:function(e){this.stopSlideShow();var t=this.props.activeItemIndex+1;t+this.state.totalShiftedItems>this.getMedianItemIndex()&&(-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1||this.props.circular)&&this.step(-1),this.props.onActiveItemChange({index:this.props.circular&&this.props.value.length-1===this.props.activeItemIndex?0:t}),e.cancelable&&e.preventDefault()}},{key:"onItemClick",value:function(e){this.stopSlideShow();var t=e.index;if(t!==this.props.activeItemIndex){var i=t+this.state.totalShiftedItems,n=0;t<this.props.activeItemIndex?(n=this.state.numVisible-i-1-this.getMedianItemIndex())>0&&-1*this.state.totalShiftedItems!=0&&this.step(n):(n=this.getMedianItemIndex()-i)<0&&-1*this.state.totalShiftedItems<this.getTotalPageNumber()-1&&this.step(n),this.props.onActiveItemChange({index:t})}}},{key:"onTransitionEnd",value:function(e){this.itemsContainer&&"transform"===e.propertyName&&(t.DomHandler.addClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="")}},{key:"onTouchStart",value:function(e){var t=e.changedTouches[0];this.startPos={x:t.pageX,y:t.pageY}}},{key:"onTouchMove",value:function(e){e.cancelable&&e.preventDefault()}},{key:"onTouchEnd",value:function(e){var t=e.changedTouches[0];this.changePageOnTouch(e,this.props.isVertical?t.pageY-this.startPos.y:t.pageX-this.startPos.x)}},{key:"changePageOnTouch",value:function(e,t){t<0?this.navForward(e):this.navBackward(e)}},{key:"getTotalPageNumber",value:function(){return this.props.value.length>this.state.numVisible?this.props.value.length-this.state.numVisible+1:0}},{key:"createStyle",value:function(){this.thumbnailsStyle||(this.thumbnailsStyle=document.createElement("style"),document.body.appendChild(this.thumbnailsStyle));var e,t="\n .p-galleria-thumbnail-items[".concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/this.state.numVisible,"%\n }\n ");if(this.props.responsiveOptions){this.responsiveOptions=y(e=this.props.responsiveOptions)||g(e)||w(e)||S(),this.responsiveOptions.sort((function(e,t){var i=e.breakpoint,n=t.breakpoint;return-1*(null==i&&null!=n?-1:null!=i&&null==n?1:null==i&&null==n?0:"string"==typeof i&&"string"==typeof n?i.localeCompare(n,void 0,{numeric:!0}):i<n?-1:i>n?1:0)}));for(var i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];t+="\n @media screen and (max-width: ".concat(n.breakpoint,") {\n .p-galleria-thumbnail-items[").concat(this.attributeSelector,"] .p-galleria-thumbnail-item {\n flex: 1 0 ").concat(100/n.numVisible,"%\n }\n }\n ")}}this.thumbnailsStyle.innerHTML=t}},{key:"calculatePosition",value:function(){if(this.itemsContainer&&this.responsiveOptions){for(var e=window.innerWidth,t={numVisible:this.props.numVisible},i=0;i<this.responsiveOptions.length;i++){var n=this.responsiveOptions[i];parseInt(n.breakpoint,10)>=e&&(t=n)}this.state.numVisible!==t.numVisible&&this.setState({numVisible:t.numVisible})}}},{key:"bindDocumentListeners",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.calculatePosition()},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentListeners",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"componentDidMount",value:function(){this.itemsContainer&&this.itemsContainer.setAttribute(this.attributeSelector,""),this.createStyle(),this.calculatePosition(),this.props.responsiveOptions&&this.bindDocumentListeners()}},{key:"componentDidUpdate",value:function(e,i){var n=this.state.totalShiftedItems;i.numVisible===this.state.numVisible&&e.activeItemIndex===this.props.activeItemIndex||((n=this.props.activeItemIndex<=this.getMedianItemIndex()?0:this.props.value.length-this.state.numVisible+this.getMedianItemIndex()<this.props.activeItemIndex?this.state.numVisible-this.props.value.length:this.props.value.length-this.state.numVisible<this.props.activeItemIndex&&this.state.numVisible%2==0?-1*this.props.activeItemIndex+this.getMedianItemIndex()+1:-1*this.props.activeItemIndex+this.getMedianItemIndex())!==this.state.totalShiftedItems&&this.setState({totalShiftedItems:n}),this.itemsContainer.style.transform=this.props.isVertical?"translate3d(0, ".concat(n*(100/this.state.numVisible),"%, 0)"):"translate3d(".concat(n*(100/this.state.numVisible),"%, 0, 0)"),e.activeItemIndex!==this.props.activeItemIndex&&(t.DomHandler.removeClass(this.itemsContainer,"p-items-hidden"),this.itemsContainer.style.transition="transform 500ms ease 0s"))}},{key:"componentWillUnmount",value:function(){this.props.responsiveOptions&&this.unbindDocumentListeners()}},{key:"renderItems",value:function(){var e=this;return this.props.value.map((function(t,i){var s=-1*e.state.totalShiftedItems,r=s+e.state.numVisible-1;return n.default.createElement(E,{key:i,index:i,template:e.props.itemTemplate,item:t,active:s<=i&&r>=i,start:s===i,end:r===i,onItemClick:e.onItemClick,current:e.props.activeItemIndex===i})}))}},{key:"renderBackwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&0===this.props.activeItemIndex||this.props.value.length<=this.state.numVisible,i=t.classNames("p-galleria-thumbnail-prev p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-prev-icon pi",{"pi-chevron-left":!this.props.isVertical,"pi-chevron-up":this.props.isVertical});return n.default.createElement("button",{className:i,onClick:this.navBackward,disabled:e},n.default.createElement("span",{className:s}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderForwardNavigator",value:function(){if(this.props.showThumbnailNavigators){var e=!this.props.circular&&this.props.activeItemIndex===this.props.value.length-1||this.props.value.length<=this.state.numVisible,i=t.classNames("p-galleria-thumbnail-next p-link",{"p-disabled":e}),s=t.classNames("p-galleria-thumbnail-next-icon pi",{"pi-chevron-right":!this.props.isVertical,"pi-chevron-down":this.props.isVertical});return n.default.createElement("button",{className:i,onClick:this.navForward,disabled:e},n.default.createElement("span",{className:s}),n.default.createElement(t.Ripple,null))}return null}},{key:"renderContent",value:function(){var e=this,t=this.renderItems(),i=this.props.isVertical?this.props.contentHeight:"",s=this.renderBackwardNavigator(),r=this.renderForwardNavigator();return n.default.createElement("div",{className:"p-galleria-thumbnail-container"},s,n.default.createElement("div",{className:"p-galleria-thumbnail-items-container",style:{height:i}},n.default.createElement("div",{ref:function(t){return e.itemsContainer=t},className:"p-galleria-thumbnail-items",onTransitionEnd:this.onTransitionEnd,onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd},t)),r)}},{key:"render",value:function(){var e=this.renderContent();return n.default.createElement("div",{className:"p-galleria-thumbnail-wrapper"},e)}}]),l}();function N(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function O(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?N(Object(i),!0).forEach((function(t){d(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):N(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function V(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var P=function(i){c(d,e.Component);var r,l,p=(r=d,l=V(),function(){var e,t=h(r);if(l){var i=h(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return u(this,e)});function d(e){var t;return s(this,d),(t=p.call(this,e)).state={visible:!1,numVisible:e.numVisible,slideShowActive:!1},t.props.onItemChange||(t.state=O(O({},t.state),{},{activeIndex:e.activeIndex})),t.onActiveItemChange=t.onActiveItemChange.bind(o(t)),t.show=t.show.bind(o(t)),t.hide=t.hide.bind(o(t)),t.startSlideShow=t.startSlideShow.bind(o(t)),t.stopSlideShow=t.stopSlideShow.bind(o(t)),t.onEnter=t.onEnter.bind(o(t)),t.onEntering=t.onEntering.bind(o(t)),t.onEntered=t.onEntered.bind(o(t)),t.onExit=t.onExit.bind(o(t)),t.onExited=t.onExited.bind(o(t)),t.galleriaRef=n.default.createRef(),t}return a(d,[{key:"activeItemIndex",get:function(){return this.props.onItemChange?this.props.activeIndex:this.state.activeIndex}},{key:"onActiveItemChange",value:function(e){this.props.onItemChange?this.props.onItemChange(e):this.setState({activeIndex:e.index})}},{key:"show",value:function(){this.setState({visible:!0})}},{key:"hide",value:function(){this.setState({visible:!1})}},{key:"onEnter",value:function(){t.DomHandler.addClass(document.body,"p-overflow-hidden")}},{key:"onEntering",value:function(){t.ZIndexUtils.set("modal",this.mask,this.props.baseZIndex),t.DomHandler.addMultipleClasses(this.mask,"p-component-overlay p-component-overlay-enter")}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExit",value:function(){t.DomHandler.removeClass(document.body,"p-overflow-hidden"),t.DomHandler.addClass(this.mask,"p-component-overlay-leave")}},{key:"onExited",value:function(){t.ZIndexUtils.clear(this.mask),this.props.onHide&&this.props.onHide()}},{key:"isAutoPlayActive",value:function(){return this.state.slideShowActive}},{key:"startSlideShow",value:function(){var e=this;this.interval=setInterval((function(){e.onActiveItemChange({index:e.props.circular&&e.props.value.length-1===e.activeItemIndex?0:e.activeItemIndex+1})}),this.props.transitionInterval),this.setState({slideShowActive:!0})}},{key:"stopSlideShow",value:function(){this.interval&&clearInterval(this.interval),this.setState({slideShowActive:!1})}},{key:"getPositionClassName",value:function(e,t){var i=["top","left","bottom","right"].find((function(e){return e===t}));return i?"".concat(e,"-").concat(i):""}},{key:"isVertical",value:function(){return"left"===this.props.thumbnailsPosition||"right"===this.props.thumbnailsPosition}},{key:"componentDidUpdate",value:function(e,t){e.value!==this.props.value&&this.props.value&&this.props.value.length<this.state.numVisible&&this.setState({numVisible:this.props.value.length}),e.numVisible!==this.props.numVisible&&this.setState({numVisible:this.props.numVisible})}},{key:"componentWillUnmount",value:function(){this.state.slideShowActive&&this.stopSlideShow(),t.ZIndexUtils.clear(this.mask)}},{key:"renderHeader",value:function(){return this.props.header?n.default.createElement("div",{className:"p-galleria-header"},this.props.header):null}},{key:"renderFooter",value:function(){return this.props.footer?n.default.createElement("div",{className:"p-galleria-footer"},this.props.footer):null}},{key:"renderElement",value:function(){var e=this,i=this.isVertical(),s=this.props.showThumbnails&&this.getPositionClassName("p-galleria-thumbnails",this.props.thumbnailsPosition),r=this.props.showIndicators&&this.getPositionClassName("p-galleria-indicators",this.props.indicatorsPosition),a=t.classNames("p-galleria p-component",this.props.className,{"p-galleria-fullscreen":this.props.fullScreen,"p-galleria-indicator-onitem":this.props.showIndicatorsOnItem,"p-galleria-item-nav-onhover":this.props.showItemNavigatorsOnHover&&!this.props.fullScreen},s,r),o=this.props.fullScreen&&n.default.createElement("button",{type:"button",className:"p-galleria-close p-link",onClick:this.hide},n.default.createElement("span",{className:"p-galleria-close-icon pi pi-times"}),n.default.createElement(t.Ripple,null)),l=this.renderHeader(),c=this.renderFooter();return n.default.createElement("div",{ref:this.galleriaRef,id:this.props.id,className:a,style:this.props.style},o,l,n.default.createElement("div",{className:"p-galleria-content"},n.default.createElement(b,{ref:function(t){return e.previewContent=t},value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.item,circular:this.props.circular,caption:this.props.caption,showIndicators:this.props.showIndicators,changeItemOnIndicatorHover:this.props.changeItemOnIndicatorHover,indicator:this.props.indicator,showItemNavigators:this.props.showItemNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,startSlideShow:this.startSlideShow,stopSlideShow:this.stopSlideShow}),this.props.showThumbnails&&n.default.createElement(C,{value:this.props.value,activeItemIndex:this.activeItemIndex,onActiveItemChange:this.onActiveItemChange,itemTemplate:this.props.thumbnail,numVisible:this.state.numVisible,responsiveOptions:this.props.responsiveOptions,circular:this.props.circular,isVertical:i,contentHeight:this.props.verticalThumbnailViewPortHeight,showThumbnailNavigators:this.props.showThumbnailNavigators,autoPlay:this.props.autoPlay,slideShowActive:this.state.slideShowActive,stopSlideShow:this.stopSlideShow})),c)}},{key:"renderGalleria",value:function(){var e=this,i=this.renderElement();if(this.props.fullScreen){var s=t.classNames("p-galleria-mask",{"p-galleria-visible":this.state.visible});return n.default.createElement(t.Portal,{element:n.default.createElement("div",{ref:function(t){return e.mask=t},className:s},n.default.createElement(t.CSSTransition,{nodeRef:this.galleriaRef,classNames:"p-galleria",in:this.state.visible,timeout:{enter:150,exit:150},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntering:this.onEntering,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},i))})}return i}},{key:"render",value:function(){return this.props.value&&this.props.value.length>0&&this.renderGalleria()}}]),d}();d(P,"defaultProps",{id:null,value:null,activeIndex:0,fullScreen:!1,item:null,thumbnail:null,indicator:null,caption:null,className:null,style:null,header:null,footer:null,numVisible:3,responsiveOptions:null,showItemNavigators:!1,showThumbnailNavigators:!0,showItemNavigatorsOnHover:!1,changeItemOnIndicatorHover:!1,circular:!1,autoPlay:!1,transitionInterval:4e3,showThumbnails:!0,thumbnailsPosition:"bottom",verticalThumbnailViewPortHeight:"300px",showIndicators:!1,showIndicatorsOnItem:!1,indicatorsPosition:"bottom",baseZIndex:0,transitionOptions:null,onItemChange:null}),exports.Galleria=P;
|
package/galleria/galleria.esm.js
CHANGED
|
@@ -74,6 +74,8 @@ function _typeof(obj) {
|
|
|
74
74
|
function _possibleConstructorReturn(self, call) {
|
|
75
75
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
76
76
|
return call;
|
|
77
|
+
} else if (call !== void 0) {
|
|
78
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
return _assertThisInitialized(self);
|
|
@@ -609,8 +611,8 @@ var GalleriaThumbnails = /*#__PURE__*/function (_Component2) {
|
|
|
609
611
|
}
|
|
610
612
|
}, {
|
|
611
613
|
key: "onTransitionEnd",
|
|
612
|
-
value: function onTransitionEnd() {
|
|
613
|
-
if (this.itemsContainer) {
|
|
614
|
+
value: function onTransitionEnd(e) {
|
|
615
|
+
if (this.itemsContainer && e.propertyName === 'transform') {
|
|
614
616
|
DomHandler.addClass(this.itemsContainer, 'p-items-hidden');
|
|
615
617
|
this.itemsContainer.style.transition = '';
|
|
616
618
|
}
|
|
@@ -915,6 +917,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
915
917
|
_this = _super.call(this, props);
|
|
916
918
|
_this.state = {
|
|
917
919
|
visible: false,
|
|
920
|
+
numVisible: props.numVisible,
|
|
918
921
|
slideShowActive: false
|
|
919
922
|
};
|
|
920
923
|
|
|
@@ -977,7 +980,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
977
980
|
key: "onEntering",
|
|
978
981
|
value: function onEntering() {
|
|
979
982
|
ZIndexUtils.set('modal', this.mask, this.props.baseZIndex);
|
|
980
|
-
DomHandler.
|
|
983
|
+
DomHandler.addMultipleClasses(this.mask, 'p-component-overlay p-component-overlay-enter');
|
|
981
984
|
}
|
|
982
985
|
}, {
|
|
983
986
|
key: "onEntered",
|
|
@@ -988,7 +991,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
988
991
|
key: "onExit",
|
|
989
992
|
value: function onExit() {
|
|
990
993
|
DomHandler.removeClass(document.body, 'p-overflow-hidden');
|
|
991
|
-
DomHandler.addClass(this.mask, 'p-
|
|
994
|
+
DomHandler.addClass(this.mask, 'p-component-overlay-leave');
|
|
992
995
|
}
|
|
993
996
|
}, {
|
|
994
997
|
key: "onExited",
|
|
@@ -1042,6 +1045,23 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
1042
1045
|
value: function isVertical() {
|
|
1043
1046
|
return this.props.thumbnailsPosition === 'left' || this.props.thumbnailsPosition === 'right';
|
|
1044
1047
|
}
|
|
1048
|
+
}, {
|
|
1049
|
+
key: "componentDidUpdate",
|
|
1050
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1051
|
+
if (prevProps.value !== this.props.value) {
|
|
1052
|
+
if (this.props.value && this.props.value.length < this.state.numVisible) {
|
|
1053
|
+
this.setState({
|
|
1054
|
+
numVisible: this.props.value.length
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
if (prevProps.numVisible !== this.props.numVisible) {
|
|
1060
|
+
this.setState({
|
|
1061
|
+
numVisible: this.props.numVisible
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1045
1065
|
}, {
|
|
1046
1066
|
key: "componentWillUnmount",
|
|
1047
1067
|
value: function componentWillUnmount() {
|
|
@@ -1125,7 +1145,7 @@ var Galleria = /*#__PURE__*/function (_Component) {
|
|
|
1125
1145
|
activeItemIndex: this.activeItemIndex,
|
|
1126
1146
|
onActiveItemChange: this.onActiveItemChange,
|
|
1127
1147
|
itemTemplate: this.props.thumbnail,
|
|
1128
|
-
numVisible: this.
|
|
1148
|
+
numVisible: this.state.numVisible,
|
|
1129
1149
|
responsiveOptions: this.props.responsiveOptions,
|
|
1130
1150
|
circular: this.props.circular,
|
|
1131
1151
|
isVertical: isVertical,
|