primereact 10.7.0 → 10.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/api/api.cjs.js +18 -14
- package/api/api.cjs.min.js +1 -1
- package/api/api.d.ts +3 -3
- package/api/api.esm.js +18 -14
- package/api/api.esm.min.js +1 -1
- package/api/api.js +18 -14
- package/api/api.min.js +1 -1
- package/autocomplete/autocomplete.cjs.js +18 -7
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.d.ts +4 -3
- package/autocomplete/autocomplete.esm.js +18 -7
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +18 -7
- package/autocomplete/autocomplete.min.js +1 -1
- package/button/button.d.ts +2 -2
- package/calendar/calendar.cjs.js +14 -10
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.d.ts +4 -3
- package/calendar/calendar.esm.js +14 -10
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +14 -10
- package/calendar/calendar.min.js +1 -1
- package/cascadeselect/cascadeselect.d.ts +4 -3
- package/column/column.d.ts +8 -14
- package/core/core.js +54 -62
- package/core/core.min.js +9 -9
- package/datatable/datatable.cjs.js +59 -62
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.d.ts +38 -2
- package/datatable/datatable.esm.js +59 -62
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +59 -62
- package/datatable/datatable.min.js +1 -1
- package/dialog/dialog.cjs.js +1 -1
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +1 -1
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +1 -1
- package/dialog/dialog.min.js +1 -1
- package/dropdown/dropdown.cjs.js +13 -7
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +13 -7
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +13 -7
- package/dropdown/dropdown.min.js +1 -1
- package/editor/editor.cjs.js +15 -3
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +16 -3
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +15 -3
- package/editor/editor.min.js +1 -1
- package/icons/sortamountdown/index.cjs.js +1 -16
- package/icons/sortamountdown/index.cjs.min.js +1 -1
- package/icons/sortamountdown/index.esm.js +1 -16
- package/icons/sortamountdown/index.esm.min.js +1 -1
- package/icons/sortamountdown/index.js +1 -16
- package/icons/sortamountdown/index.min.js +1 -1
- package/icons/sortamountupalt/index.cjs.js +1 -16
- package/icons/sortamountupalt/index.cjs.min.js +1 -1
- package/icons/sortamountupalt/index.esm.js +1 -16
- package/icons/sortamountupalt/index.esm.min.js +1 -1
- package/icons/sortamountupalt/index.js +1 -16
- package/icons/sortamountupalt/index.min.js +1 -1
- package/inplace/inplace.d.ts +1 -1
- package/inputnumber/inputnumber.cjs.js +1 -0
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +1 -0
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +1 -0
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/inputotp.cjs.js +4 -3
- package/inputotp/inputotp.cjs.min.js +1 -1
- package/inputotp/inputotp.d.ts +2 -3
- package/inputotp/inputotp.esm.js +4 -3
- package/inputotp/inputotp.esm.min.js +1 -1
- package/inputotp/inputotp.js +4 -3
- package/inputotp/inputotp.min.js +1 -1
- package/listbox/listbox.cjs.js +4 -0
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +4 -0
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +4 -0
- package/listbox/listbox.min.js +1 -1
- package/mention/mention.cjs.js +1 -0
- package/mention/mention.cjs.min.js +1 -1
- package/mention/mention.esm.js +1 -0
- package/mention/mention.esm.min.js +1 -1
- package/mention/mention.js +1 -0
- package/mention/mention.min.js +1 -1
- package/menu/menu.cjs.js +3 -3
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +3 -3
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +3 -3
- package/menu/menu.min.js +1 -1
- package/menubar/menubar.cjs.js +1 -1
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +1 -1
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +1 -1
- package/menubar/menubar.min.js +1 -1
- package/messages/messages.d.ts +21 -0
- package/multiselect/multiselect.cjs.js +8 -5
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.d.ts +1 -9
- package/multiselect/multiselect.esm.js +8 -5
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +8 -5
- package/multiselect/multiselect.min.js +1 -1
- package/orderlist/orderlist.cjs.js +3 -2
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +3 -2
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +3 -2
- package/orderlist/orderlist.min.js +1 -1
- package/package.json +1 -1
- package/paginator/paginator.cjs.js +9 -7
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +9 -7
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +9 -7
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/panelmenu.d.ts +2 -2
- package/password/password.cjs.js +1 -0
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +1 -0
- package/password/password.esm.min.js +1 -1
- package/password/password.js +1 -0
- package/password/password.min.js +1 -1
- package/picklist/picklist.cjs.js +9 -7
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +9 -7
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +9 -7
- package/picklist/picklist.min.js +1 -1
- package/primereact.all.cjs.js +342 -314
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +342 -314
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +342 -314
- package/primereact.all.min.js +1 -1
- package/radiobutton/radiobutton.cjs.js +9 -9
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +9 -9
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +9 -9
- package/radiobutton/radiobutton.min.js +1 -1
- package/resources/themes/lara-dark-amber/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-amber/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-amber/theme.css +2 -2
- package/resources/themes/lara-dark-blue/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-blue/theme.css +2 -2
- package/resources/themes/lara-dark-cyan/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/theme.css +2 -2
- package/resources/themes/lara-dark-green/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-green/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-green/theme.css +2 -2
- package/resources/themes/lara-dark-indigo/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/theme.css +2 -2
- package/resources/themes/lara-dark-pink/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-pink/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-pink/theme.css +2 -2
- package/resources/themes/lara-dark-purple/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-purple/theme.css +6 -6
- package/resources/themes/lara-dark-teal/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-dark-teal/theme.css +2 -2
- package/resources/themes/lara-light-amber/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-amber/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-amber/theme.css +2 -2
- package/resources/themes/lara-light-blue/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-blue/theme.css +2 -2
- package/resources/themes/lara-light-cyan/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-cyan/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-cyan/theme.css +2 -2
- package/resources/themes/lara-light-green/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-green/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-green/theme.css +2 -2
- package/resources/themes/lara-light-indigo/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-indigo/theme.css +2 -2
- package/resources/themes/lara-light-pink/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-pink/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-pink/theme.css +2 -2
- package/resources/themes/lara-light-purple/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-purple/theme.css +6 -6
- package/resources/themes/lara-light-teal/fonts/InterVariable-Italic.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/InterVariable.woff2 +0 -0
- package/resources/themes/lara-light-teal/theme.css +2 -2
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/md-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/md-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/md-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/md-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/mdc-dark-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/mdc-dark-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/mdc-light-deeppurple/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-500.woff2 +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/mdc-light-indigo/fonts/roboto-v20-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/mira/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/mira/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/mira/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/mira/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/mira/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/mira/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/mira/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/mira/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-300.woff +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-300.woff2 +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-700.woff +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/soho-dark/fonts/lato-v17-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-300.woff +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-300.woff2 +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-700.woff +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/soho-light/fonts/lato-v17-latin-ext_latin-regular.woff2 +0 -0
- 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/viva-dark/fonts/poppins-v15-latin-ext_latin-300.woff +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-300.woff2 +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-600.woff +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-600.woff2 +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-700.woff +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/viva-dark/fonts/poppins-v15-latin-ext_latin-regular.woff2 +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-300.woff +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-300.woff2 +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-600.woff +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-600.woff2 +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-700.woff +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-700.woff2 +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-regular.woff +0 -0
- package/resources/themes/viva-light/fonts/poppins-v15-latin-ext_latin-regular.woff2 +0 -0
- package/sidebar/sidebar.cjs.js +1 -1
- package/sidebar/sidebar.cjs.min.js +1 -1
- package/sidebar/sidebar.esm.js +1 -1
- package/sidebar/sidebar.esm.min.js +1 -1
- package/sidebar/sidebar.js +1 -1
- package/sidebar/sidebar.min.js +1 -1
- package/stepper/stepper.cjs.js +7 -1
- package/stepper/stepper.cjs.min.js +1 -1
- package/stepper/stepper.esm.js +8 -2
- package/stepper/stepper.esm.min.js +1 -1
- package/stepper/stepper.js +7 -1
- package/stepper/stepper.min.js +1 -1
- package/toast/toast.cjs.js +9 -7
- package/toast/toast.cjs.min.js +1 -1
- package/toast/toast.d.ts +1 -1
- package/toast/toast.esm.js +9 -7
- package/toast/toast.esm.min.js +1 -1
- package/toast/toast.js +9 -7
- package/toast/toast.min.js +1 -1
- package/tree/tree.cjs.js +5 -1
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +5 -1
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +5 -1
- package/tree/tree.min.js +1 -1
- package/treetable/treetable.d.ts +6 -6
- package/utils/utils.cjs.js +5 -0
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.esm.js +5 -0
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +5 -0
- package/utils/utils.min.js +1 -1
- package/web-types.json +16 -7
- package/resources/themes/lara-dark-amber/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-amber/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-blue/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-cyan/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-green/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-green/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-indigo/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-pink/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-pink/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-purple/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-dark-teal/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-amber/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-amber/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-blue/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-cyan/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-cyan/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-green/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-green/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-indigo/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-pink/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-pink/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-purple/fonts/Inter-roman.var.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-italic.var.woff2 +0 -0
- package/resources/themes/lara-light-teal/fonts/Inter-roman.var.woff2 +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import n,{PrimeReactContext as t,ariaLabel as r}from"primereact/api";import{ComponentBase as i,useHandleStyle as o}from"primereact/componentbase";import{useMergeProps as a,useEventListener as u,useResizeListener as c,useMountEffect as l,useUpdateEffect as s,useUnmountEffect as m}from"primereact/hooks";import{BarsIcon as f}from"primereact/icons/bars";import{classNames as p,ObjectUtils as d,IconUtils as b,DomHandler as v,UniqueComponentId as y,ZIndexUtils as g}from"primereact/utils";import{AngleDownIcon as x}from"primereact/icons/angledown";import{AngleRightIcon as I}from"primereact/icons/angleright";import{Ripple as h}from"primereact/ripple";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(e)}function k(e,n){if("object"!==E(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function S(e){var n=k(e,"string");return"symbol"===E(n)?n:String(n)}function w(e,n,t){return(n=S(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function O(e){if(Array.isArray(e))return e}function P(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,i,o,a,u=[],c=!0,l=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(u.push(r.value),u.length!==n);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}function N(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function K(e,n){if(e){if("string"==typeof e)return N(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?N(e,n):void 0}}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,n){return O(e)||P(e,n)||K(e,n)||j()}var A=i.extend({defaultProps:{__TYPE:"Menubar",id:null,model:null,style:null,className:null,start:null,ariaLabel:null,ariaLabelledBy:null,onFocus:null,onBlur:null,submenuIcon:null,menuIcon:null,end:null,children:void 0},css:{classes:{start:"p-menubar-start",end:"p-menubar-end",button:"p-menubar-button",root:function(e){return p("p-menubar p-component",{"p-menubar-mobile-active":e.mobileActiveState})},separator:"p-menuitem-separator",icon:"p-menuitem-icon",label:"p-menuitem-text",submenuIcon:"p-submenu-icon",menuitem:function(e){return p("p-menuitem",{"p-menuitem-active p-highlight":e.active,"p-focus":e.focused,"p-disabled":e.disabled})},menu:"p-menubar-root-list",content:"p-menuitem-content",submenu:"p-submenu-list",action:function(e){return p("p-menuitem-link",{"p-disabled":e.disabled})}},styles:"\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 1;\n }\n\n .p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n }\n\n .p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n\n .p-menubar .p-menubar-end {\n margin-left: auto;\n align-self: center;\n }\n\n .p-menubar-button {\n display: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n }\n}\n"}});function C(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function L(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?C(Object(t),!0).forEach((function(n){w(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var M=e.memo(e.forwardRef((function(n,t){var r=a(),i=n.ptm,o=n.cx,u=function(e,t,r){return i(t,{props:n,hostName:n.hostName,context:{item:e,index:r,active:y(e),focused:k(e),disabled:E(e),level:n.level}})},c=function(e,t){E(t)||n.mobileActive?e.preventDefault():n.onItemMouseEnter&&n.onItemMouseEnter({originalEvent:e,processedItem:t})},l=function(e,n){var t=n.item;E(n)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),s({originalEvent:e,processedItem:n,isFocus:!0}),t.url||(e.preventDefault(),e.stopPropagation()))},s=function(e){n.onLeafClick&&n.onLeafClick(e)},m=function(e){var n;return null===(n=e.item)||void 0===n?void 0:n.id},f=function(e){return"".concat(n.id,"_").concat(e.key)},v=function(e,n,t){return e&&e.item?d.getItemValue(e.item[n],t):void 0},y=function(e){return n.activeItemPath.some((function(n){return n.key===e.key}))},g=function(e){return!1!==v(e,"visible")},E=function(e){return v(e,"disabled")},k=function(e){return n.focusedItemId===f(e)},S=function(e){return d.isNotEmpty(e.items)},O=function(e){return e-n.model.slice(0,e).filter((function(e){return g(e)&&v(e,"separator")})).length+1},P=function(t){var a=n.id+"_separator_"+t,u=r({key:a,"data-id":a,className:o("separator"),role:"separator"},i("separator",{hostName:n.hostName}));return e.createElement("li",u)},N=function(t){var r=t&&t.items;return r?e.createElement(M,{id:n.id,hostName:n.hostName,menuProps:n.menuProps,level:n.level+1,model:r,activeItemPath:n.activeItemPath,focusedItemId:n.focusedItemId,onLeafClick:s,onItemMouseEnter:n.onItemMouseEnter,submenuIcon:n.submenuIcon,ptm:i,style:{display:y(t)?"block":"none"},cx:o}):null},K=function(t,i){var a=t.item;if(!g(t))return null;var s=m(t),P=f(t),K=y(t),j=k(t),D=E(t)||!1,A=S(t),C=p("p-menuitem-link",{"p-disabled":D}),M=p("p-menuitem-icon",v(t,"icon")),T=r({className:o("icon")},u(t,"icon",i)),R=b.getJSXIcon(a.icon,L({},T),{props:n.menuProps}),B=r({className:o("label")},u(t,"label",i)),F=a.label&&e.createElement("span",B,a.label),_=v(t,"items"),J=r({className:o("submenuIcon")},u(t,"submenuIcon",i)),X=_&&b.getJSXIcon(n.root?n.submenuIcon||e.createElement(x,J):n.submenuIcon||e.createElement(I,J),L({},J),{props:L({menuProps:n.menuProps},n)}),z=N(t),U=r({href:a.url||"#",tabIndex:"-1","aria-hidden":"true",className:o("action",{disabled:D}),onFocus:function(e){return e.stopPropagation()},target:v(t,"target"),"aria-haspopup":null!=_},u(t,"action",i)),V=e.createElement("a",U,R,F,X,e.createElement(h,null));a.template&&(V=d.getJSXElement(a.template,a,{className:C,labelClassName:"p-menuitem-text",iconClassName:M,submenuIconClassName:"p-submenu-icon",element:V,props:n}));var H=r({onClick:function(e){return l(e,t)},onMouseEnter:function(e){return c(e,t)},className:o("content")},u(t,"content",i)),W=v(t,"className"),Z=r(w({id:s,key:P,"data-id":P,role:"menuitem","aria-label":a.label,"aria-disabled":D,"aria-expanded":A?K:void 0,"aria-haspopup":A&&!a.url?"menu":void 0,"aria-level":n.level+1,"aria-setsize":n.model.filter((function(e){return g(e)&&!v(e,"separator")})).length,"aria-posinset":O(i),"data-p-highlight":K,"data-p-focused":j,"data-p-disabled":D,className:p(W,o("menuitem",{active:K,focused:j,disabled:D}))},"data-p-disabled",D||!1),u(t,"menuitem",i));return e.createElement("li",Z,e.createElement("div",H,V),z)},j=n.root?"menubar":"menu",D=n.root?"menu":"submenu",A=n.root?"0":null,C=n.model?n.model.map((function(e,n){return v(e,"separator")?P(n):K(e,n)})):null,T=r({ref:t,className:o(D),level:n.level,onFocus:n.onFocus,onBlur:n.onBlur,onKeyDown:n.onKeyDown,"data-id":n.id,tabIndex:A,"aria-activedescendant":n.ariaActivedescendant,style:n.style,role:j},i(D));return e.createElement("ul",T,C)})));function T(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function R(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){w(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}M.displayName="MenubarSub";var B=e.memo(e.forwardRef((function(i,x){var I=a(),h=e.useContext(t),E=A.getProps(i,h),k=D(e.useState(E.id),2),S=k[0],O=k[1],P=D(e.useState(!1),2),N=P[0],K=P[1],j=D(e.useState(!1),2),C=j[0],L=j[1],T=D(e.useState({index:-1,level:0,parentKey:""}),2),B=T[0],F=T[1],_=D(e.useState(null),2),J=_[0],X=_[1],z=D(e.useState([]),2),U=z[0],V=z[1],H=D(e.useState([]),2),W=H[0],Z=H[1],Y=D(e.useState([]),2),$=Y[0],q=Y[1],G=D(e.useState(!1),2),Q=G[0],ee=G[1],ne=D(e.useState(!1),2),te=ne[0],re=ne[1],ie=e.useRef(null),oe=e.useRef(null),ae=e.useRef(null),ue=e.useRef(""),ce=e.useRef(null),le=e.useRef(!1),se=A.setMetaData({props:E,state:{id:S,mobileActive:N}}),me=se.ptm,fe=se.cx;o(A.css.styles,se.isUnstyled,{name:"menubar"});var pe=D(u({type:"click",listener:function(e){Ee(e)&&(ie.current&&!ie.current.contains(e.target)&&he())}}),2),de=pe[0],be=pe[1],ve=D(c({listener:function(e){v.isTouchDevice()||he(e)}}),2),ye=ve[0],ge=ve[1],xe=function(e){N?(K(!1),he()):(K(!0),setTimeout((function(){Ie()}),1)),e.preventDefault()},Ie=function(){F({index:We(),level:0,parentKey:""}),v.focus(oe.current)},he=function(e){N&&(K(!1),setTimeout((function(){v.focus(ae.current)}),0)),V([]),F({index:-1,level:0,parentKey:""}),e&&v.focus(oe.current),re(!1)},Ee=function(e){return oe.current!==e.target&&!oe.current.contains(e.target)&&ae.current!==e.target&&!ae.current.contains(e.target)},ke=function(e,n){return e?d.getItemValue(e[n]):void 0},Se=function(e){return ke(e,"separator")},we=function(e){return e?ke(e.item,"label"):void 0},Oe=function(e){return e&&d.isNotEmpty(e.items)},Pe=function(e){var n=e.processedItem,t=e.isFocus;if(!d.isEmpty(n)){var r=n.index,i=n.key,o=n.level,a=n.parentKey,u=d.isNotEmpty(n.items),c=U.filter((function(e){return e.parentKey!==a&&e.parentKey!==i}));u&&c.push(n),F({index:r,level:o,parentKey:a}),V(c),u&&re(!0),t&&v.focus(oe.current)}},Ne=function(e){var n=W[B.index];if(n?d.isEmpty(n.parent):null){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),setTimeout((function(){return ee(!0)}),0))}else{var t=-1!==B.index?Ue(B.index):We();$e(t)}e.preventDefault()},Ke=function(e){var n=W[B.index];if(d.isEmpty(n.parent)){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),le.current=!0,setTimeout((function(){return ee(!0)}),0))}else{var t=U.find((function(e){return e.key===n.parentKey}));if(0===B.index&&t&&""===t.parentKey)F({index:-1,parentKey:t?t.parentKey:""}),ue.current="",je(e);else{var r=-1!==B.index?Ve(B.index):Ze();$e(r)}}e.preventDefault()},je=function(e){var n=W[B.index],t=n?U.find((function(e){return e.key===n.parentKey})):null;if(t)Pe({originalEvent:e,processedItem:t}),V(U.filter((function(e){return e.key!==t.key})));else{var r=-1!==B.index?Ve(B.index):Ze();$e(r)}e.preventDefault()},De=function(e){var n=W[B.index];if(n?U.find((function(e){return e.key===n.parentKey})):null){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),setTimeout((function(){return ee(!0)}),0))}else{var t=-1!==B.index?Ue(B.index):We();$e(t)}e.preventDefault()},Ae=function(e){$e(Xe()),e.preventDefault()},Ce=function(e){$e(ze()),e.preventDefault()},Le=function(e){if(-1!==B.index){var n=v.findSingle(oe.current,'li[data-id="'.concat("".concat(J),'"]')),t=n&&v.findSingle(n,'a[data-pc-section="action"]');t?t.click():n&&n.click()}e.preventDefault()},Me=function(e){Le(e)},Te=function(e){he(!0),F({focusedItemInfo:B,index:We()})},Re=function(e){if(-1!==B.index){var n=W[B.index];!Oe(n)&&Pe({originalEvent:e,processedItem:n})}he()},Be=function(e){return Fe(e)&&we(e).toLocaleLowerCase().startsWith(ue.current.toLocaleLowerCase())},Fe=function(e){return!!e&&!ke(e.item,"disabled")&&!Se(e.item)},_e=function(e){return Fe(e)&&Je(e)},Je=function(e){return U.some((function(n){return n.key===e.key}))},Xe=function(){return W.findIndex((function(e){return Fe(e)}))},ze=function(){return d.findLastIndex(W,(function(e){return Fe(e)}))},Ue=function(e){var n=e<W.length-1?W.slice(e+1).findIndex((function(e){return Fe(e)})):-1;return n>-1?n+e+1:e},Ve=function(e){var n=e>0?d.findLastIndex(W.slice(0,e),(function(e){return Fe(e)})):-1;return n>-1?n:e},He=function(){return W.findIndex((function(e){return _e(e)}))},We=function(){var e=He();return e<0?Xe():e},Ze=function(){var e=He();return e<0?ze():e},Ye=function(e,n){ue.current=(ue.current||"")+n;var t=-1,r=!1;return-1!==(t=-1!==B.index?-1===(t=W.slice(B.index).findIndex((function(e){return Be(e)})))?W.slice(0,B.index).findIndex((function(e){return Be(e)})):t+B.index:W.findIndex((function(e){return Be(e)})))&&(r=!0),-1===t&&-1===B.index&&(t=We()),-1!==t&&$e(t),ce.current&&clearTimeout(ce.current),ce.current=setTimeout((function(){ue.current="",ce.current=null}),500),r},$e=function(e){B.index!==e&&(F(R(R({},B),{},{index:e})),qe())},qe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=-1!==e?"".concat(S,"_").concat(e):J,t=v.findSingle(oe.current,'li[data-id="'.concat(n,'"]'));t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"start"})},Ge=e.useCallback((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=[];return e&&e.forEach((function(e,o){var a=(""!==r?r+"_":"")+o,u={item:e,index:o,level:n,key:a,parent:t,parentKey:r};u.items=Ge(e.items,n+1,u,a),i.push(u)})),i}),[]);l((function(){S||O(y())})),s((function(){N?(de(),ye(),g.set("menu",oe.current,h&&h.autoZIndex||n.autoZIndex,h&&h.zIndex.menu||n.zIndex.menu)):(ge(),be(),g.clear(oe.current))}),[N]),e.useEffect((function(){var e=Ge(E.model||[],0,null,"");q(e)}),[E.model,Ge]),s((function(){var e=U.find((function(e){return e.key===B.parentKey}));Z(e?e.items:$)}),[U,B,$]),s((function(){d.isNotEmpty(U)?(de(),ye()):(be(),ge())}),[U]),s((function(){if(Q){var e=-1!==B.index?Ue(B.index):le.current?ze():We();$e(e),le.current=!1,ee(!1)}}),[Q]),s((function(){X(-1!==B.index?"".concat(S).concat(d.isNotEmpty(B.parentKey)?"_"+B.parentKey:"","_").concat(B.index):null)}),[B]),m((function(){g.clear(oe.current)})),e.useImperativeHandle(x,(function(){return{props:E,toggle:xe,getElement:function(){return ie.current},getRootMenu:function(){return oe.current},getMenuButton:function(){return ae.current}}}));var Qe=function(){if(E.start){var n=d.getJSXElement(E.start,E),t=I({className:fe("start")},me("start"));return e.createElement("div",t,n)}return null}(),en=function(){if(E.end){var n=d.getJSXElement(E.end,E),t=I({className:fe("end")},me("end"));return e.createElement("div",t,n)}return null}(),nn=function(){if(E.model&&E.model.length<1)return null;var n=I(w(w(w(w({ref:ae,href:"#",tabIndex:"0","aria-haspopup":!!(N&&E.model&&E.model.length>0),"aria-expanded":N,"aria-label":r("navigation"),"aria-controls":S,role:"button"},"tabIndex",0),"className",fe("button")),"onKeyDown",(function(e){var n;("Enter"===(n=e).code||"NumpadEnter"===n.code||"Space"===n.code)&&xe(n)})),"onClick",(function(e){return xe(e)})),me("button")),t=I(me("popupIcon")),i=b.getJSXIcon(E.menuIcon||e.createElement(f,t),R({},t),{props:E});return e.createElement("a",n,i)}(),tn=e.createElement(M,{hostName:"Menubar",ariaActivedescendant:C?J:void 0,level:0,id:S,ref:oe,menuProps:E,model:$,onLeafClick:function(e){var n=e.originalEvent,t=e.processedItem,r=Oe(t),i=d.isEmpty(t.parent);if(Je(t)){var o=t.index,a=t.key,u=t.level,c=t.parentKey;V(U.filter((function(e){return a!==e.key&&a.startsWith(e.key)}))),F({index:o,level:u,parentKey:c}),r||re(!i),setTimeout((function(){v.focus(oe.current),r&&re(!0)}),0)}else if(r)v.focus(oe.current),Pe({originalEvent:n,processedItem:t});else{var l=i?t:U.find((function(e){return""===e.parentKey})),s=l?l.index:-1;he(n),F({index:s,parentKey:l?l.parentKey:""}),K(!1)}},onItemMouseEnter:function(e){!N&&te&&Pe(e)},onFocus:function(e){L(!0),F(-1!==B.index?B:{index:We(),level:0,parentKey:""}),E.onFocus&&E.onFocus(e)},onBlur:function(e){L(!1),F({index:-1,level:0,parentKey:""}),ue.current="",re(!1),E.onBlur&&E.onBlur(e)},onKeyDown:function(e){var n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":Ne(e);break;case"ArrowUp":Ke(e);break;case"ArrowLeft":je(e);break;case"ArrowRight":De(e);break;case"Home":Ae(e);break;case"End":Ce(e);break;case"Space":Me(e);break;case"Enter":case"NumpadEnter":Le(e);break;case"Escape":Te();break;case"Tab":Re(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&d.isPrintableCharacter(e.key)&&Ye(e,e.key)}},root:!0,activeItemPath:U,focusedItemId:C?J:void 0,submenuIcon:E.submenuIcon,ptm:me,cx:fe}),rn=I({id:E.id,ref:ie,className:p(E.className,fe("root",{mobileActiveState:N})),style:E.style},A.getOtherProps(E),me("root"));return e.createElement("div",rn,Qe,nn,tn,en)})));B.displayName="Menubar";export{B as Menubar};
|
|
1
|
+
import*as e from"react";import n,{PrimeReactContext as t,ariaLabel as r}from"primereact/api";import{ComponentBase as i,useHandleStyle as o}from"primereact/componentbase";import{useMergeProps as a,useEventListener as u,useResizeListener as c,useMountEffect as l,useUpdateEffect as s,useUnmountEffect as m}from"primereact/hooks";import{BarsIcon as f}from"primereact/icons/bars";import{classNames as p,ObjectUtils as d,IconUtils as b,DomHandler as v,UniqueComponentId as y,ZIndexUtils as g}from"primereact/utils";import{AngleDownIcon as x}from"primereact/icons/angledown";import{AngleRightIcon as I}from"primereact/icons/angleright";import{Ripple as h}from"primereact/ripple";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(e)}function k(e,n){if("object"!==E(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function S(e){var n=k(e,"string");return"symbol"===E(n)?n:String(n)}function w(e,n,t){return(n=S(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function O(e){if(Array.isArray(e))return e}function P(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,i,o,a,u=[],c=!0,l=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(u.push(r.value),u.length!==n);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}function N(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function K(e,n){if(e){if("string"==typeof e)return N(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?N(e,n):void 0}}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,n){return O(e)||P(e,n)||K(e,n)||j()}var A=i.extend({defaultProps:{__TYPE:"Menubar",id:null,model:null,style:null,className:null,start:null,ariaLabel:null,ariaLabelledBy:null,onFocus:null,onBlur:null,submenuIcon:null,menuIcon:null,end:null,children:void 0},css:{classes:{start:"p-menubar-start",end:"p-menubar-end",button:"p-menubar-button",root:function(e){return p("p-menubar p-component",{"p-menubar-mobile-active":e.mobileActiveState})},separator:"p-menuitem-separator",icon:"p-menuitem-icon",label:"p-menuitem-text",submenuIcon:"p-submenu-icon",menuitem:function(e){return p("p-menuitem",{"p-menuitem-active p-highlight":e.active,"p-focus":e.focused,"p-disabled":e.disabled})},menu:"p-menubar-root-list",content:"p-menuitem-content",submenu:"p-submenu-list",action:function(e){return p("p-menuitem-link",{"p-disabled":e.disabled})}},styles:"\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 5;\n }\n\n .p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n }\n\n .p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n\n .p-menubar .p-menubar-end {\n margin-left: auto;\n align-self: center;\n }\n\n .p-menubar-button {\n display: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n }\n}\n"}});function C(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function L(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?C(Object(t),!0).forEach((function(n){w(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var M=e.memo(e.forwardRef((function(n,t){var r=a(),i=n.ptm,o=n.cx,u=function(e,t,r){return i(t,{props:n,hostName:n.hostName,context:{item:e,index:r,active:y(e),focused:k(e),disabled:E(e),level:n.level}})},c=function(e,t){E(t)||n.mobileActive?e.preventDefault():n.onItemMouseEnter&&n.onItemMouseEnter({originalEvent:e,processedItem:t})},l=function(e,n){var t=n.item;E(n)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),s({originalEvent:e,processedItem:n,isFocus:!0}),t.url||(e.preventDefault(),e.stopPropagation()))},s=function(e){n.onLeafClick&&n.onLeafClick(e)},m=function(e){var n;return null===(n=e.item)||void 0===n?void 0:n.id},f=function(e){return"".concat(n.id,"_").concat(e.key)},v=function(e,n,t){return e&&e.item?d.getItemValue(e.item[n],t):void 0},y=function(e){return n.activeItemPath.some((function(n){return n.key===e.key}))},g=function(e){return!1!==v(e,"visible")},E=function(e){return v(e,"disabled")},k=function(e){return n.focusedItemId===f(e)},S=function(e){return d.isNotEmpty(e.items)},O=function(e){return e-n.model.slice(0,e).filter((function(e){return g(e)&&v(e,"separator")})).length+1},P=function(t){var a=n.id+"_separator_"+t,u=r({key:a,"data-id":a,className:o("separator"),role:"separator"},i("separator",{hostName:n.hostName}));return e.createElement("li",u)},N=function(t){var r=t&&t.items;return r?e.createElement(M,{id:n.id,hostName:n.hostName,menuProps:n.menuProps,level:n.level+1,model:r,activeItemPath:n.activeItemPath,focusedItemId:n.focusedItemId,onLeafClick:s,onItemMouseEnter:n.onItemMouseEnter,submenuIcon:n.submenuIcon,ptm:i,style:{display:y(t)?"block":"none"},cx:o}):null},K=function(t,i){var a=t.item;if(!g(t))return null;var s=m(t),P=f(t),K=y(t),j=k(t),D=E(t)||!1,A=S(t),C=p("p-menuitem-link",{"p-disabled":D}),M=p("p-menuitem-icon",v(t,"icon")),T=r({className:o("icon")},u(t,"icon",i)),R=b.getJSXIcon(a.icon,L({},T),{props:n.menuProps}),B=r({className:o("label")},u(t,"label",i)),F=a.label&&e.createElement("span",B,a.label),_=v(t,"items"),J=r({className:o("submenuIcon")},u(t,"submenuIcon",i)),X=_&&b.getJSXIcon(n.root?n.submenuIcon||e.createElement(x,J):n.submenuIcon||e.createElement(I,J),L({},J),{props:L({menuProps:n.menuProps},n)}),z=N(t),U=r({href:a.url||"#",tabIndex:"-1","aria-hidden":"true",className:o("action",{disabled:D}),onFocus:function(e){return e.stopPropagation()},target:v(t,"target"),"aria-haspopup":null!=_},u(t,"action",i)),V=e.createElement("a",U,R,F,X,e.createElement(h,null));a.template&&(V=d.getJSXElement(a.template,a,{className:C,labelClassName:"p-menuitem-text",iconClassName:M,submenuIconClassName:"p-submenu-icon",element:V,props:n}));var H=r({onClick:function(e){return l(e,t)},onMouseEnter:function(e){return c(e,t)},className:o("content")},u(t,"content",i)),W=v(t,"className"),Z=r(w({id:s,key:P,"data-id":P,role:"menuitem","aria-label":a.label,"aria-disabled":D,"aria-expanded":A?K:void 0,"aria-haspopup":A&&!a.url?"menu":void 0,"aria-level":n.level+1,"aria-setsize":n.model.filter((function(e){return g(e)&&!v(e,"separator")})).length,"aria-posinset":O(i),"data-p-highlight":K,"data-p-focused":j,"data-p-disabled":D,className:p(W,o("menuitem",{active:K,focused:j,disabled:D}))},"data-p-disabled",D||!1),u(t,"menuitem",i));return e.createElement("li",Z,e.createElement("div",H,V),z)},j=n.root?"menubar":"menu",D=n.root?"menu":"submenu",A=n.root?"0":null,C=n.model?n.model.map((function(e,n){return v(e,"separator")?P(n):K(e,n)})):null,T=r({ref:t,className:o(D),level:n.level,onFocus:n.onFocus,onBlur:n.onBlur,onKeyDown:n.onKeyDown,"data-id":n.id,tabIndex:A,"aria-activedescendant":n.ariaActivedescendant,style:n.style,role:j},i(D));return e.createElement("ul",T,C)})));function T(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function R(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?T(Object(t),!0).forEach((function(n){w(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):T(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}M.displayName="MenubarSub";var B=e.memo(e.forwardRef((function(i,x){var I=a(),h=e.useContext(t),E=A.getProps(i,h),k=D(e.useState(E.id),2),S=k[0],O=k[1],P=D(e.useState(!1),2),N=P[0],K=P[1],j=D(e.useState(!1),2),C=j[0],L=j[1],T=D(e.useState({index:-1,level:0,parentKey:""}),2),B=T[0],F=T[1],_=D(e.useState(null),2),J=_[0],X=_[1],z=D(e.useState([]),2),U=z[0],V=z[1],H=D(e.useState([]),2),W=H[0],Z=H[1],Y=D(e.useState([]),2),$=Y[0],q=Y[1],G=D(e.useState(!1),2),Q=G[0],ee=G[1],ne=D(e.useState(!1),2),te=ne[0],re=ne[1],ie=e.useRef(null),oe=e.useRef(null),ae=e.useRef(null),ue=e.useRef(""),ce=e.useRef(null),le=e.useRef(!1),se=A.setMetaData({props:E,state:{id:S,mobileActive:N}}),me=se.ptm,fe=se.cx;o(A.css.styles,se.isUnstyled,{name:"menubar"});var pe=D(u({type:"click",listener:function(e){Ee(e)&&(ie.current&&!ie.current.contains(e.target)&&he())}}),2),de=pe[0],be=pe[1],ve=D(c({listener:function(e){v.isTouchDevice()||he(e)}}),2),ye=ve[0],ge=ve[1],xe=function(e){N?(K(!1),he()):(K(!0),setTimeout((function(){Ie()}),1)),e.preventDefault()},Ie=function(){F({index:We(),level:0,parentKey:""}),v.focus(oe.current)},he=function(e){N&&(K(!1),setTimeout((function(){v.focus(ae.current)}),0)),V([]),F({index:-1,level:0,parentKey:""}),e&&v.focus(oe.current),re(!1)},Ee=function(e){return oe.current!==e.target&&!oe.current.contains(e.target)&&ae.current!==e.target&&!ae.current.contains(e.target)},ke=function(e,n){return e?d.getItemValue(e[n]):void 0},Se=function(e){return ke(e,"separator")},we=function(e){return e?ke(e.item,"label"):void 0},Oe=function(e){return e&&d.isNotEmpty(e.items)},Pe=function(e){var n=e.processedItem,t=e.isFocus;if(!d.isEmpty(n)){var r=n.index,i=n.key,o=n.level,a=n.parentKey,u=d.isNotEmpty(n.items),c=U.filter((function(e){return e.parentKey!==a&&e.parentKey!==i}));u&&c.push(n),F({index:r,level:o,parentKey:a}),V(c),u&&re(!0),t&&v.focus(oe.current)}},Ne=function(e){var n=W[B.index];if(n?d.isEmpty(n.parent):null){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),setTimeout((function(){return ee(!0)}),0))}else{var t=-1!==B.index?Ue(B.index):We();$e(t)}e.preventDefault()},Ke=function(e){var n=W[B.index];if(d.isEmpty(n.parent)){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),le.current=!0,setTimeout((function(){return ee(!0)}),0))}else{var t=U.find((function(e){return e.key===n.parentKey}));if(0===B.index&&t&&""===t.parentKey)F({index:-1,parentKey:t?t.parentKey:""}),ue.current="",je(e);else{var r=-1!==B.index?Ve(B.index):Ze();$e(r)}}e.preventDefault()},je=function(e){var n=W[B.index],t=n?U.find((function(e){return e.key===n.parentKey})):null;if(t)Pe({originalEvent:e,processedItem:t}),V(U.filter((function(e){return e.key!==t.key})));else{var r=-1!==B.index?Ve(B.index):Ze();$e(r)}e.preventDefault()},De=function(e){var n=W[B.index];if(n?U.find((function(e){return e.key===n.parentKey})):null){Oe(n)&&(Pe({originalEvent:e,processedItem:n}),F({index:-1,parentKey:n.key}),setTimeout((function(){return ee(!0)}),0))}else{var t=-1!==B.index?Ue(B.index):We();$e(t)}e.preventDefault()},Ae=function(e){$e(Xe()),e.preventDefault()},Ce=function(e){$e(ze()),e.preventDefault()},Le=function(e){if(-1!==B.index){var n=v.findSingle(oe.current,'li[data-id="'.concat("".concat(J),'"]')),t=n&&v.findSingle(n,'a[data-pc-section="action"]');t?t.click():n&&n.click()}e.preventDefault()},Me=function(e){Le(e)},Te=function(e){he(!0),F({focusedItemInfo:B,index:We()})},Re=function(e){if(-1!==B.index){var n=W[B.index];!Oe(n)&&Pe({originalEvent:e,processedItem:n})}he()},Be=function(e){return Fe(e)&&we(e).toLocaleLowerCase().startsWith(ue.current.toLocaleLowerCase())},Fe=function(e){return!!e&&!ke(e.item,"disabled")&&!Se(e.item)},_e=function(e){return Fe(e)&&Je(e)},Je=function(e){return U.some((function(n){return n.key===e.key}))},Xe=function(){return W.findIndex((function(e){return Fe(e)}))},ze=function(){return d.findLastIndex(W,(function(e){return Fe(e)}))},Ue=function(e){var n=e<W.length-1?W.slice(e+1).findIndex((function(e){return Fe(e)})):-1;return n>-1?n+e+1:e},Ve=function(e){var n=e>0?d.findLastIndex(W.slice(0,e),(function(e){return Fe(e)})):-1;return n>-1?n:e},He=function(){return W.findIndex((function(e){return _e(e)}))},We=function(){var e=He();return e<0?Xe():e},Ze=function(){var e=He();return e<0?ze():e},Ye=function(e,n){ue.current=(ue.current||"")+n;var t=-1,r=!1;return-1!==(t=-1!==B.index?-1===(t=W.slice(B.index).findIndex((function(e){return Be(e)})))?W.slice(0,B.index).findIndex((function(e){return Be(e)})):t+B.index:W.findIndex((function(e){return Be(e)})))&&(r=!0),-1===t&&-1===B.index&&(t=We()),-1!==t&&$e(t),ce.current&&clearTimeout(ce.current),ce.current=setTimeout((function(){ue.current="",ce.current=null}),500),r},$e=function(e){B.index!==e&&(F(R(R({},B),{},{index:e})),qe())},qe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=-1!==e?"".concat(S,"_").concat(e):J,t=v.findSingle(oe.current,'li[data-id="'.concat(n,'"]'));t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"start"})},Ge=e.useCallback((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=[];return e&&e.forEach((function(e,o){var a=(""!==r?r+"_":"")+o,u={item:e,index:o,level:n,key:a,parent:t,parentKey:r};u.items=Ge(e.items,n+1,u,a),i.push(u)})),i}),[]);l((function(){S||O(y())})),s((function(){N?(de(),ye(),g.set("menu",oe.current,h&&h.autoZIndex||n.autoZIndex,h&&h.zIndex.menu||n.zIndex.menu)):(ge(),be(),g.clear(oe.current))}),[N]),e.useEffect((function(){var e=Ge(E.model||[],0,null,"");q(e)}),[E.model,Ge]),s((function(){var e=U.find((function(e){return e.key===B.parentKey}));Z(e?e.items:$)}),[U,B,$]),s((function(){d.isNotEmpty(U)?(de(),ye()):(be(),ge())}),[U]),s((function(){if(Q){var e=-1!==B.index?Ue(B.index):le.current?ze():We();$e(e),le.current=!1,ee(!1)}}),[Q]),s((function(){X(-1!==B.index?"".concat(S).concat(d.isNotEmpty(B.parentKey)?"_"+B.parentKey:"","_").concat(B.index):null)}),[B]),m((function(){g.clear(oe.current)})),e.useImperativeHandle(x,(function(){return{props:E,toggle:xe,getElement:function(){return ie.current},getRootMenu:function(){return oe.current},getMenuButton:function(){return ae.current}}}));var Qe=function(){if(E.start){var n=d.getJSXElement(E.start,E),t=I({className:fe("start")},me("start"));return e.createElement("div",t,n)}return null}(),en=function(){if(E.end){var n=d.getJSXElement(E.end,E),t=I({className:fe("end")},me("end"));return e.createElement("div",t,n)}return null}(),nn=function(){if(E.model&&E.model.length<1)return null;var n=I(w(w(w(w({ref:ae,href:"#",tabIndex:"0","aria-haspopup":!!(N&&E.model&&E.model.length>0),"aria-expanded":N,"aria-label":r("navigation"),"aria-controls":S,role:"button"},"tabIndex",0),"className",fe("button")),"onKeyDown",(function(e){var n;("Enter"===(n=e).code||"NumpadEnter"===n.code||"Space"===n.code)&&xe(n)})),"onClick",(function(e){return xe(e)})),me("button")),t=I(me("popupIcon")),i=b.getJSXIcon(E.menuIcon||e.createElement(f,t),R({},t),{props:E});return e.createElement("a",n,i)}(),tn=e.createElement(M,{hostName:"Menubar",ariaActivedescendant:C?J:void 0,level:0,id:S,ref:oe,menuProps:E,model:$,onLeafClick:function(e){var n=e.originalEvent,t=e.processedItem,r=Oe(t),i=d.isEmpty(t.parent);if(Je(t)){var o=t.index,a=t.key,u=t.level,c=t.parentKey;V(U.filter((function(e){return a!==e.key&&a.startsWith(e.key)}))),F({index:o,level:u,parentKey:c}),r||re(!i),setTimeout((function(){v.focus(oe.current),r&&re(!0)}),0)}else if(r)v.focus(oe.current),Pe({originalEvent:n,processedItem:t});else{var l=i?t:U.find((function(e){return""===e.parentKey})),s=l?l.index:-1;he(n),F({index:s,parentKey:l?l.parentKey:""}),K(!1)}},onItemMouseEnter:function(e){!N&&te&&Pe(e)},onFocus:function(e){L(!0),F(-1!==B.index?B:{index:We(),level:0,parentKey:""}),E.onFocus&&E.onFocus(e)},onBlur:function(e){L(!1),F({index:-1,level:0,parentKey:""}),ue.current="",re(!1),E.onBlur&&E.onBlur(e)},onKeyDown:function(e){var n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":Ne(e);break;case"ArrowUp":Ke(e);break;case"ArrowLeft":je(e);break;case"ArrowRight":De(e);break;case"Home":Ae(e);break;case"End":Ce(e);break;case"Space":Me(e);break;case"Enter":case"NumpadEnter":Le(e);break;case"Escape":Te();break;case"Tab":Re(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&d.isPrintableCharacter(e.key)&&Ye(e,e.key)}},root:!0,activeItemPath:U,focusedItemId:C?J:void 0,submenuIcon:E.submenuIcon,ptm:me,cx:fe}),rn=I({id:E.id,ref:ie,className:p(E.className,fe("root",{mobileActiveState:N})),style:E.style},A.getOtherProps(E),me("root"));return e.createElement("div",rn,Qe,nn,tn,en)})));B.displayName="Menubar";export{B as Menubar};
|
package/menubar/menubar.js
CHANGED
|
@@ -155,7 +155,7 @@ this.primereact.menubar = (function (exports, React, PrimeReact, componentbase,
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
var styles = "\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index:
|
|
158
|
+
var styles = "\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 5;\n }\n\n .p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n }\n\n .p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n\n .p-menubar .p-menubar-end {\n margin-left: auto;\n align-self: center;\n }\n\n .p-menubar-button {\n display: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n }\n}\n";
|
|
159
159
|
var MenubarBase = componentbase.ComponentBase.extend({
|
|
160
160
|
defaultProps: {
|
|
161
161
|
__TYPE: 'Menubar',
|
package/menubar/menubar.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primereact=this.primereact||{},this.primereact.menubar=function(e,n,t,r,i,o,a,u,c,l){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var f=m(n),p=s(t);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function b(e,n){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function v(e){var n=b(e,"string");return"symbol"===d(n)?n:String(n)}function y(e,n,t){return(n=v(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function g(e){if(Array.isArray(e))return e}function x(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,i,o,a,u=[],c=!0,l=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(u.push(r.value),u.length!==n);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}function I(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function h(e,n){if(e){if("string"==typeof e)return I(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I(e,n):void 0}}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,n){return g(e)||x(e,n)||h(e,n)||E()}var k=r.ComponentBase.extend({defaultProps:{__TYPE:"Menubar",id:null,model:null,style:null,className:null,start:null,ariaLabel:null,ariaLabelledBy:null,onFocus:null,onBlur:null,submenuIcon:null,menuIcon:null,end:null,children:void 0},css:{classes:{start:"p-menubar-start",end:"p-menubar-end",button:"p-menubar-button",root:function(e){return a.classNames("p-menubar p-component",{"p-menubar-mobile-active":e.mobileActiveState})},separator:"p-menuitem-separator",icon:"p-menuitem-icon",label:"p-menuitem-text",submenuIcon:"p-submenu-icon",menuitem:function(e){return a.classNames("p-menuitem",{"p-menuitem-active p-highlight":e.active,"p-focus":e.focused,"p-disabled":e.disabled})},menu:"p-menubar-root-list",content:"p-menuitem-content",submenu:"p-submenu-list",action:function(e){return a.classNames("p-menuitem-link",{"p-disabled":e.disabled})}},styles:"\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 1;\n }\n\n .p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n }\n\n .p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n\n .p-menubar .p-menubar-end {\n margin-left: auto;\n align-self: center;\n }\n\n .p-menubar-button {\n display: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n }\n}\n"}});function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function P(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var S=f.memo(f.forwardRef((function(e,n){var t=i.useMergeProps(),r=e.ptm,o=e.cx,s=function(n,t,i){return r(t,{props:e,hostName:e.hostName,context:{item:n,index:i,active:x(n),focused:E(n),disabled:h(n),level:e.level}})},m=function(n,t){h(t)||e.mobileActive?n.preventDefault():e.onItemMouseEnter&&e.onItemMouseEnter({originalEvent:n,processedItem:t})},p=function(e,n){var t=n.item;h(n)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),d({originalEvent:e,processedItem:n,isFocus:!0}),t.url||(e.preventDefault(),e.stopPropagation()))},d=function(n){e.onLeafClick&&e.onLeafClick(n)},b=function(e){var n;return null===(n=e.item)||void 0===n?void 0:n.id},v=function(n){return"".concat(e.id,"_").concat(n.key)},g=function(e,n,t){return e&&e.item?a.ObjectUtils.getItemValue(e.item[n],t):void 0},x=function(n){return e.activeItemPath.some((function(e){return e.key===n.key}))},I=function(e){return!1!==g(e,"visible")},h=function(e){return g(e,"disabled")},E=function(n){return e.focusedItemId===v(n)},O=function(e){return a.ObjectUtils.isNotEmpty(e.items)},k=function(n){return n-e.model.slice(0,n).filter((function(e){return I(e)&&g(e,"separator")})).length+1},j=function(n){var i=e.id+"_separator_"+n,a=t({key:i,"data-id":i,className:o("separator"),role:"separator"},r("separator",{hostName:e.hostName}));return f.createElement("li",a)},N=function(n){var t=n&&n.items;return t?f.createElement(S,{id:e.id,hostName:e.hostName,menuProps:e.menuProps,level:e.level+1,model:t,activeItemPath:e.activeItemPath,focusedItemId:e.focusedItemId,onLeafClick:d,onItemMouseEnter:e.onItemMouseEnter,submenuIcon:e.submenuIcon,ptm:r,style:{display:x(n)?"block":"none"},cx:o}):null},w=function(n,r){var i=n.item;if(!I(n))return null;var d=b(n),j=v(n),S=x(n),w=E(n),D=h(n)||!1,U=O(n),K=a.classNames("p-menuitem-link",{"p-disabled":D}),M=a.classNames("p-menuitem-icon",g(n,"icon")),A=t({className:o("icon")},s(n,"icon",r)),C=a.IconUtils.getJSXIcon(i.icon,P({},A),{props:e.menuProps}),L=t({className:o("label")},s(n,"label",r)),R=i.label&&f.createElement("span",L,i.label),H=g(n,"items"),T=t({className:o("submenuIcon")},s(n,"submenuIcon",r)),_=H&&a.IconUtils.getJSXIcon(e.root?e.submenuIcon||f.createElement(u.AngleDownIcon,T):e.submenuIcon||f.createElement(c.AngleRightIcon,T),P({},T),{props:P({menuProps:e.menuProps},e)}),B=N(n),F=t({href:i.url||"#",tabIndex:"-1","aria-hidden":"true",className:o("action",{disabled:D}),onFocus:function(e){return e.stopPropagation()},target:g(n,"target"),"aria-haspopup":null!=H},s(n,"action",r)),z=f.createElement("a",F,C,R,_,f.createElement(l.Ripple,null));i.template&&(z=a.ObjectUtils.getJSXElement(i.template,i,{className:K,labelClassName:"p-menuitem-text",iconClassName:M,submenuIconClassName:"p-submenu-icon",element:z,props:e}));var J=t({onClick:function(e){return p(e,n)},onMouseEnter:function(e){return m(e,n)},className:o("content")},s(n,"content",r)),X=g(n,"className"),Z=t(y({id:d,key:j,"data-id":j,role:"menuitem","aria-label":i.label,"aria-disabled":D,"aria-expanded":U?S:void 0,"aria-haspopup":U&&!i.url?"menu":void 0,"aria-level":e.level+1,"aria-setsize":e.model.filter((function(e){return I(e)&&!g(e,"separator")})).length,"aria-posinset":k(r),"data-p-highlight":S,"data-p-focused":w,"data-p-disabled":D,className:a.classNames(X,o("menuitem",{active:S,focused:w,disabled:D}))},"data-p-disabled",D||!1),s(n,"menuitem",r));return f.createElement("li",Z,f.createElement("div",J,z),B)},D=e.root?"menubar":"menu",U=e.root?"menu":"submenu",K=e.root?"0":null,M=e.model?e.model.map((function(e,n){return g(e,"separator")?j(n):w(e,n)})):null,A=t({ref:n,className:o(U),level:e.level,onFocus:e.onFocus,onBlur:e.onBlur,onKeyDown:e.onKeyDown,"data-id":e.id,tabIndex:K,"aria-activedescendant":e.ariaActivedescendant,style:e.style,role:D},r(U));return f.createElement("ul",A,M)})));function N(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function w(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?N(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):N(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}S.displayName="MenubarSub";var D=f.memo(f.forwardRef((function(e,n){var u=i.useMergeProps(),c=f.useContext(t.PrimeReactContext),l=k.getProps(e,c),s=O(f.useState(l.id),2),m=s[0],d=s[1],b=O(f.useState(!1),2),v=b[0],g=b[1],x=O(f.useState(!1),2),I=x[0],h=x[1],E=O(f.useState({index:-1,level:0,parentKey:""}),2),j=E[0],P=E[1],N=O(f.useState(null),2),D=N[0],U=N[1],K=O(f.useState([]),2),M=K[0],A=K[1],C=O(f.useState([]),2),L=C[0],R=C[1],H=O(f.useState([]),2),T=H[0],_=H[1],B=O(f.useState(!1),2),F=B[0],z=B[1],J=O(f.useState(!1),2),X=J[0],Z=J[1],V=f.useRef(null),W=f.useRef(null),q=f.useRef(null),Y=f.useRef(""),$=f.useRef(null),G=f.useRef(!1),Q=k.setMetaData({props:l,state:{id:m,mobileActive:v}}),ee=Q.ptm,ne=Q.cx;r.useHandleStyle(k.css.styles,Q.isUnstyled,{name:"menubar"});var te=O(i.useEventListener({type:"click",listener:function(e){me(e)&&(V.current&&!V.current.contains(e.target)&&se())}}),2),re=te[0],ie=te[1],oe=O(i.useResizeListener({listener:function(e){a.DomHandler.isTouchDevice()||se(e)}}),2),ae=oe[0],ue=oe[1],ce=function(e){v?(g(!1),se()):(g(!0),setTimeout((function(){le()}),1)),e.preventDefault()},le=function(){P({index:Le(),level:0,parentKey:""}),a.DomHandler.focus(W.current)},se=function(e){v&&(g(!1),setTimeout((function(){a.DomHandler.focus(q.current)}),0)),A([]),P({index:-1,level:0,parentKey:""}),e&&a.DomHandler.focus(W.current),Z(!1)},me=function(e){return W.current!==e.target&&!W.current.contains(e.target)&&q.current!==e.target&&!q.current.contains(e.target)},fe=function(e,n){return e?a.ObjectUtils.getItemValue(e[n]):void 0},pe=function(e){return fe(e,"separator")},de=function(e){return e?fe(e.item,"label"):void 0},be=function(e){return e&&a.ObjectUtils.isNotEmpty(e.items)},ve=function(e){var n=e.processedItem,t=e.isFocus;if(!a.ObjectUtils.isEmpty(n)){var r=n.index,i=n.key,o=n.level,u=n.parentKey,c=a.ObjectUtils.isNotEmpty(n.items),l=M.filter((function(e){return e.parentKey!==u&&e.parentKey!==i}));c&&l.push(n),P({index:r,level:o,parentKey:u}),A(l),c&&Z(!0),t&&a.DomHandler.focus(W.current)}},ye=function(e){var n=L[j.index];if(n?a.ObjectUtils.isEmpty(n.parent):null){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),setTimeout((function(){return z(!0)}),0))}else{var t=-1!==j.index?Me(j.index):Le();Te(t)}e.preventDefault()},ge=function(e){var n=L[j.index];if(a.ObjectUtils.isEmpty(n.parent)){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),G.current=!0,setTimeout((function(){return z(!0)}),0))}else{var t=M.find((function(e){return e.key===n.parentKey}));if(0===j.index&&t&&""===t.parentKey)P({index:-1,parentKey:t?t.parentKey:""}),Y.current="",xe(e);else{var r=-1!==j.index?Ae(j.index):Re();Te(r)}}e.preventDefault()},xe=function(e){var n=L[j.index],t=n?M.find((function(e){return e.key===n.parentKey})):null;if(t)ve({originalEvent:e,processedItem:t}),A(M.filter((function(e){return e.key!==t.key})));else{var r=-1!==j.index?Ae(j.index):Re();Te(r)}e.preventDefault()},Ie=function(e){var n=L[j.index];if(n?M.find((function(e){return e.key===n.parentKey})):null){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),setTimeout((function(){return z(!0)}),0))}else{var t=-1!==j.index?Me(j.index):Le();Te(t)}e.preventDefault()},he=function(e){Te(Ue()),e.preventDefault()},Ee=function(e){Te(Ke()),e.preventDefault()},Oe=function(e){if(-1!==j.index){var n=a.DomHandler.findSingle(W.current,'li[data-id="'.concat("".concat(D),'"]')),t=n&&a.DomHandler.findSingle(n,'a[data-pc-section="action"]');t?t.click():n&&n.click()}e.preventDefault()},ke=function(e){Oe(e)},je=function(e){se(!0),P({focusedItemInfo:j,index:Le()})},Pe=function(e){if(-1!==j.index){var n=L[j.index];!be(n)&&ve({originalEvent:e,processedItem:n})}se()},Se=function(e){return Ne(e)&&de(e).toLocaleLowerCase().startsWith(Y.current.toLocaleLowerCase())},Ne=function(e){return!!e&&!fe(e.item,"disabled")&&!pe(e.item)},we=function(e){return Ne(e)&&De(e)},De=function(e){return M.some((function(n){return n.key===e.key}))},Ue=function(){return L.findIndex((function(e){return Ne(e)}))},Ke=function(){return a.ObjectUtils.findLastIndex(L,(function(e){return Ne(e)}))},Me=function(e){var n=e<L.length-1?L.slice(e+1).findIndex((function(e){return Ne(e)})):-1;return n>-1?n+e+1:e},Ae=function(e){var n=e>0?a.ObjectUtils.findLastIndex(L.slice(0,e),(function(e){return Ne(e)})):-1;return n>-1?n:e},Ce=function(){return L.findIndex((function(e){return we(e)}))},Le=function(){var e=Ce();return e<0?Ue():e},Re=function(){var e=Ce();return e<0?Ke():e},He=function(e,n){Y.current=(Y.current||"")+n;var t=-1,r=!1;return-1!==(t=-1!==j.index?-1===(t=L.slice(j.index).findIndex((function(e){return Se(e)})))?L.slice(0,j.index).findIndex((function(e){return Se(e)})):t+j.index:L.findIndex((function(e){return Se(e)})))&&(r=!0),-1===t&&-1===j.index&&(t=Le()),-1!==t&&Te(t),$.current&&clearTimeout($.current),$.current=setTimeout((function(){Y.current="",$.current=null}),500),r},Te=function(e){j.index!==e&&(P(w(w({},j),{},{index:e})),_e())},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=-1!==e?"".concat(m,"_").concat(e):D,t=a.DomHandler.findSingle(W.current,'li[data-id="'.concat(n,'"]'));t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"start"})},Be=f.useCallback((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=[];return e&&e.forEach((function(e,o){var a=(""!==r?r+"_":"")+o,u={item:e,index:o,level:n,key:a,parent:t,parentKey:r};u.items=Be(e.items,n+1,u,a),i.push(u)})),i}),[]);i.useMountEffect((function(){m||d(a.UniqueComponentId())})),i.useUpdateEffect((function(){v?(re(),ae(),a.ZIndexUtils.set("menu",W.current,c&&c.autoZIndex||p.default.autoZIndex,c&&c.zIndex.menu||p.default.zIndex.menu)):(ue(),ie(),a.ZIndexUtils.clear(W.current))}),[v]),f.useEffect((function(){var e=Be(l.model||[],0,null,"");_(e)}),[l.model,Be]),i.useUpdateEffect((function(){var e=M.find((function(e){return e.key===j.parentKey}));R(e?e.items:T)}),[M,j,T]),i.useUpdateEffect((function(){a.ObjectUtils.isNotEmpty(M)?(re(),ae()):(ie(),ue())}),[M]),i.useUpdateEffect((function(){if(F){var e=-1!==j.index?Me(j.index):G.current?Ke():Le();Te(e),G.current=!1,z(!1)}}),[F]),i.useUpdateEffect((function(){U(-1!==j.index?"".concat(m).concat(a.ObjectUtils.isNotEmpty(j.parentKey)?"_"+j.parentKey:"","_").concat(j.index):null)}),[j]),i.useUnmountEffect((function(){a.ZIndexUtils.clear(W.current)})),f.useImperativeHandle(n,(function(){return{props:l,toggle:ce,getElement:function(){return V.current},getRootMenu:function(){return W.current},getMenuButton:function(){return q.current}}}));var Fe=function(){if(l.start){var e=a.ObjectUtils.getJSXElement(l.start,l),n=u({className:ne("start")},ee("start"));return f.createElement("div",n,e)}return null}(),ze=function(){if(l.end){var e=a.ObjectUtils.getJSXElement(l.end,l),n=u({className:ne("end")},ee("end"));return f.createElement("div",n,e)}return null}(),Je=function(){if(l.model&&l.model.length<1)return null;var e=u(y(y(y(y({ref:q,href:"#",tabIndex:"0","aria-haspopup":!!(v&&l.model&&l.model.length>0),"aria-expanded":v,"aria-label":t.ariaLabel("navigation"),"aria-controls":m,role:"button"},"tabIndex",0),"className",ne("button")),"onKeyDown",(function(e){var n;("Enter"===(n=e).code||"NumpadEnter"===n.code||"Space"===n.code)&&ce(n)})),"onClick",(function(e){return ce(e)})),ee("button")),n=u(ee("popupIcon")),r=a.IconUtils.getJSXIcon(l.menuIcon||f.createElement(o.BarsIcon,n),w({},n),{props:l});return f.createElement("a",e,r)}(),Xe=f.createElement(S,{hostName:"Menubar",ariaActivedescendant:I?D:void 0,level:0,id:m,ref:W,menuProps:l,model:T,onLeafClick:function(e){var n=e.originalEvent,t=e.processedItem,r=be(t),i=a.ObjectUtils.isEmpty(t.parent);if(De(t)){var o=t.index,u=t.key,c=t.level,l=t.parentKey;A(M.filter((function(e){return u!==e.key&&u.startsWith(e.key)}))),P({index:o,level:c,parentKey:l}),r||Z(!i),setTimeout((function(){a.DomHandler.focus(W.current),r&&Z(!0)}),0)}else if(r)a.DomHandler.focus(W.current),ve({originalEvent:n,processedItem:t});else{var s=i?t:M.find((function(e){return""===e.parentKey})),m=s?s.index:-1;se(n),P({index:m,parentKey:s?s.parentKey:""}),g(!1)}},onItemMouseEnter:function(e){!v&&X&&ve(e)},onFocus:function(e){h(!0),P(-1!==j.index?j:{index:Le(),level:0,parentKey:""}),l.onFocus&&l.onFocus(e)},onBlur:function(e){h(!1),P({index:-1,level:0,parentKey:""}),Y.current="",Z(!1),l.onBlur&&l.onBlur(e)},onKeyDown:function(e){var n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":ye(e);break;case"ArrowUp":ge(e);break;case"ArrowLeft":xe(e);break;case"ArrowRight":Ie(e);break;case"Home":he(e);break;case"End":Ee(e);break;case"Space":ke(e);break;case"Enter":case"NumpadEnter":Oe(e);break;case"Escape":je();break;case"Tab":Pe(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&a.ObjectUtils.isPrintableCharacter(e.key)&&He(e,e.key)}},root:!0,activeItemPath:M,focusedItemId:I?D:void 0,submenuIcon:l.submenuIcon,ptm:ee,cx:ne}),Ze=u({id:l.id,ref:V,className:a.classNames(l.className,ne("root",{mobileActiveState:v})),style:l.style},k.getOtherProps(l),ee("root"));return f.createElement("div",Ze,Fe,Je,Xe,ze)})));return D.displayName="Menubar",e.Menubar=D,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.bars,primereact.utils,primereact.icons.angledown,primereact.icons.angleright,primereact.ripple);
|
|
1
|
+
this.primereact=this.primereact||{},this.primereact.menubar=function(e,n,t,r,i,o,a,u,c,l){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var f=m(n),p=s(t);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function b(e,n){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==d(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}function v(e){var n=b(e,"string");return"symbol"===d(n)?n:String(n)}function y(e,n,t){return(n=v(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function g(e){if(Array.isArray(e))return e}function x(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,i,o,a,u=[],c=!0,l=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;c=!1}else for(;!(c=(r=o.call(t)).done)&&(u.push(r.value),u.length!==n);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}function I(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function h(e,n){if(e){if("string"==typeof e)return I(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I(e,n):void 0}}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,n){return g(e)||x(e,n)||h(e,n)||E()}var k=r.ComponentBase.extend({defaultProps:{__TYPE:"Menubar",id:null,model:null,style:null,className:null,start:null,ariaLabel:null,ariaLabelledBy:null,onFocus:null,onBlur:null,submenuIcon:null,menuIcon:null,end:null,children:void 0},css:{classes:{start:"p-menubar-start",end:"p-menubar-end",button:"p-menubar-button",root:function(e){return a.classNames("p-menubar p-component",{"p-menubar-mobile-active":e.mobileActiveState})},separator:"p-menuitem-separator",icon:"p-menuitem-icon",label:"p-menuitem-text",submenuIcon:"p-submenu-icon",menuitem:function(e){return a.classNames("p-menuitem",{"p-menuitem-active p-highlight":e.active,"p-focus":e.focused,"p-disabled":e.disabled})},menu:"p-menubar-root-list",content:"p-menuitem-content",submenu:"p-submenu-list",action:function(e){return a.classNames("p-menuitem-link",{"p-disabled":e.disabled})}},styles:"\n@layer primereact {\n .p-menubar {\n display: flex;\n align-items: center;\n }\n\n .p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n\n .p-menubar .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n .p-menubar .p-menuitem-text {\n line-height: 1;\n }\n\n .p-menubar .p-menuitem {\n position: relative;\n }\n\n .p-menubar-root-list {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n }\n\n .p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n }\n\n .p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n }\n\n .p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 5;\n }\n\n .p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n }\n\n .p-menubar .p-submenu-list .p-menuitem .p-menuitem-content .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n }\n\n .p-menubar .p-menubar-end {\n margin-left: auto;\n align-self: center;\n }\n\n .p-menubar-button {\n display: none;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n text-decoration: none;\n }\n}\n"}});function j(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function P(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?j(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var S=f.memo(f.forwardRef((function(e,n){var t=i.useMergeProps(),r=e.ptm,o=e.cx,s=function(n,t,i){return r(t,{props:e,hostName:e.hostName,context:{item:n,index:i,active:x(n),focused:E(n),disabled:h(n),level:e.level}})},m=function(n,t){h(t)||e.mobileActive?n.preventDefault():e.onItemMouseEnter&&e.onItemMouseEnter({originalEvent:n,processedItem:t})},p=function(e,n){var t=n.item;h(n)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),d({originalEvent:e,processedItem:n,isFocus:!0}),t.url||(e.preventDefault(),e.stopPropagation()))},d=function(n){e.onLeafClick&&e.onLeafClick(n)},b=function(e){var n;return null===(n=e.item)||void 0===n?void 0:n.id},v=function(n){return"".concat(e.id,"_").concat(n.key)},g=function(e,n,t){return e&&e.item?a.ObjectUtils.getItemValue(e.item[n],t):void 0},x=function(n){return e.activeItemPath.some((function(e){return e.key===n.key}))},I=function(e){return!1!==g(e,"visible")},h=function(e){return g(e,"disabled")},E=function(n){return e.focusedItemId===v(n)},O=function(e){return a.ObjectUtils.isNotEmpty(e.items)},k=function(n){return n-e.model.slice(0,n).filter((function(e){return I(e)&&g(e,"separator")})).length+1},j=function(n){var i=e.id+"_separator_"+n,a=t({key:i,"data-id":i,className:o("separator"),role:"separator"},r("separator",{hostName:e.hostName}));return f.createElement("li",a)},N=function(n){var t=n&&n.items;return t?f.createElement(S,{id:e.id,hostName:e.hostName,menuProps:e.menuProps,level:e.level+1,model:t,activeItemPath:e.activeItemPath,focusedItemId:e.focusedItemId,onLeafClick:d,onItemMouseEnter:e.onItemMouseEnter,submenuIcon:e.submenuIcon,ptm:r,style:{display:x(n)?"block":"none"},cx:o}):null},w=function(n,r){var i=n.item;if(!I(n))return null;var d=b(n),j=v(n),S=x(n),w=E(n),D=h(n)||!1,U=O(n),K=a.classNames("p-menuitem-link",{"p-disabled":D}),M=a.classNames("p-menuitem-icon",g(n,"icon")),A=t({className:o("icon")},s(n,"icon",r)),C=a.IconUtils.getJSXIcon(i.icon,P({},A),{props:e.menuProps}),L=t({className:o("label")},s(n,"label",r)),R=i.label&&f.createElement("span",L,i.label),H=g(n,"items"),T=t({className:o("submenuIcon")},s(n,"submenuIcon",r)),_=H&&a.IconUtils.getJSXIcon(e.root?e.submenuIcon||f.createElement(u.AngleDownIcon,T):e.submenuIcon||f.createElement(c.AngleRightIcon,T),P({},T),{props:P({menuProps:e.menuProps},e)}),B=N(n),F=t({href:i.url||"#",tabIndex:"-1","aria-hidden":"true",className:o("action",{disabled:D}),onFocus:function(e){return e.stopPropagation()},target:g(n,"target"),"aria-haspopup":null!=H},s(n,"action",r)),z=f.createElement("a",F,C,R,_,f.createElement(l.Ripple,null));i.template&&(z=a.ObjectUtils.getJSXElement(i.template,i,{className:K,labelClassName:"p-menuitem-text",iconClassName:M,submenuIconClassName:"p-submenu-icon",element:z,props:e}));var J=t({onClick:function(e){return p(e,n)},onMouseEnter:function(e){return m(e,n)},className:o("content")},s(n,"content",r)),X=g(n,"className"),Z=t(y({id:d,key:j,"data-id":j,role:"menuitem","aria-label":i.label,"aria-disabled":D,"aria-expanded":U?S:void 0,"aria-haspopup":U&&!i.url?"menu":void 0,"aria-level":e.level+1,"aria-setsize":e.model.filter((function(e){return I(e)&&!g(e,"separator")})).length,"aria-posinset":k(r),"data-p-highlight":S,"data-p-focused":w,"data-p-disabled":D,className:a.classNames(X,o("menuitem",{active:S,focused:w,disabled:D}))},"data-p-disabled",D||!1),s(n,"menuitem",r));return f.createElement("li",Z,f.createElement("div",J,z),B)},D=e.root?"menubar":"menu",U=e.root?"menu":"submenu",K=e.root?"0":null,M=e.model?e.model.map((function(e,n){return g(e,"separator")?j(n):w(e,n)})):null,A=t({ref:n,className:o(U),level:e.level,onFocus:e.onFocus,onBlur:e.onBlur,onKeyDown:e.onKeyDown,"data-id":e.id,tabIndex:K,"aria-activedescendant":e.ariaActivedescendant,style:e.style,role:D},r(U));return f.createElement("ul",A,M)})));function N(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function w(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?N(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):N(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}S.displayName="MenubarSub";var D=f.memo(f.forwardRef((function(e,n){var u=i.useMergeProps(),c=f.useContext(t.PrimeReactContext),l=k.getProps(e,c),s=O(f.useState(l.id),2),m=s[0],d=s[1],b=O(f.useState(!1),2),v=b[0],g=b[1],x=O(f.useState(!1),2),I=x[0],h=x[1],E=O(f.useState({index:-1,level:0,parentKey:""}),2),j=E[0],P=E[1],N=O(f.useState(null),2),D=N[0],U=N[1],K=O(f.useState([]),2),M=K[0],A=K[1],C=O(f.useState([]),2),L=C[0],R=C[1],H=O(f.useState([]),2),T=H[0],_=H[1],B=O(f.useState(!1),2),F=B[0],z=B[1],J=O(f.useState(!1),2),X=J[0],Z=J[1],V=f.useRef(null),W=f.useRef(null),q=f.useRef(null),Y=f.useRef(""),$=f.useRef(null),G=f.useRef(!1),Q=k.setMetaData({props:l,state:{id:m,mobileActive:v}}),ee=Q.ptm,ne=Q.cx;r.useHandleStyle(k.css.styles,Q.isUnstyled,{name:"menubar"});var te=O(i.useEventListener({type:"click",listener:function(e){me(e)&&(V.current&&!V.current.contains(e.target)&&se())}}),2),re=te[0],ie=te[1],oe=O(i.useResizeListener({listener:function(e){a.DomHandler.isTouchDevice()||se(e)}}),2),ae=oe[0],ue=oe[1],ce=function(e){v?(g(!1),se()):(g(!0),setTimeout((function(){le()}),1)),e.preventDefault()},le=function(){P({index:Le(),level:0,parentKey:""}),a.DomHandler.focus(W.current)},se=function(e){v&&(g(!1),setTimeout((function(){a.DomHandler.focus(q.current)}),0)),A([]),P({index:-1,level:0,parentKey:""}),e&&a.DomHandler.focus(W.current),Z(!1)},me=function(e){return W.current!==e.target&&!W.current.contains(e.target)&&q.current!==e.target&&!q.current.contains(e.target)},fe=function(e,n){return e?a.ObjectUtils.getItemValue(e[n]):void 0},pe=function(e){return fe(e,"separator")},de=function(e){return e?fe(e.item,"label"):void 0},be=function(e){return e&&a.ObjectUtils.isNotEmpty(e.items)},ve=function(e){var n=e.processedItem,t=e.isFocus;if(!a.ObjectUtils.isEmpty(n)){var r=n.index,i=n.key,o=n.level,u=n.parentKey,c=a.ObjectUtils.isNotEmpty(n.items),l=M.filter((function(e){return e.parentKey!==u&&e.parentKey!==i}));c&&l.push(n),P({index:r,level:o,parentKey:u}),A(l),c&&Z(!0),t&&a.DomHandler.focus(W.current)}},ye=function(e){var n=L[j.index];if(n?a.ObjectUtils.isEmpty(n.parent):null){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),setTimeout((function(){return z(!0)}),0))}else{var t=-1!==j.index?Me(j.index):Le();Te(t)}e.preventDefault()},ge=function(e){var n=L[j.index];if(a.ObjectUtils.isEmpty(n.parent)){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),G.current=!0,setTimeout((function(){return z(!0)}),0))}else{var t=M.find((function(e){return e.key===n.parentKey}));if(0===j.index&&t&&""===t.parentKey)P({index:-1,parentKey:t?t.parentKey:""}),Y.current="",xe(e);else{var r=-1!==j.index?Ae(j.index):Re();Te(r)}}e.preventDefault()},xe=function(e){var n=L[j.index],t=n?M.find((function(e){return e.key===n.parentKey})):null;if(t)ve({originalEvent:e,processedItem:t}),A(M.filter((function(e){return e.key!==t.key})));else{var r=-1!==j.index?Ae(j.index):Re();Te(r)}e.preventDefault()},Ie=function(e){var n=L[j.index];if(n?M.find((function(e){return e.key===n.parentKey})):null){be(n)&&(ve({originalEvent:e,processedItem:n}),P({index:-1,parentKey:n.key}),setTimeout((function(){return z(!0)}),0))}else{var t=-1!==j.index?Me(j.index):Le();Te(t)}e.preventDefault()},he=function(e){Te(Ue()),e.preventDefault()},Ee=function(e){Te(Ke()),e.preventDefault()},Oe=function(e){if(-1!==j.index){var n=a.DomHandler.findSingle(W.current,'li[data-id="'.concat("".concat(D),'"]')),t=n&&a.DomHandler.findSingle(n,'a[data-pc-section="action"]');t?t.click():n&&n.click()}e.preventDefault()},ke=function(e){Oe(e)},je=function(e){se(!0),P({focusedItemInfo:j,index:Le()})},Pe=function(e){if(-1!==j.index){var n=L[j.index];!be(n)&&ve({originalEvent:e,processedItem:n})}se()},Se=function(e){return Ne(e)&&de(e).toLocaleLowerCase().startsWith(Y.current.toLocaleLowerCase())},Ne=function(e){return!!e&&!fe(e.item,"disabled")&&!pe(e.item)},we=function(e){return Ne(e)&&De(e)},De=function(e){return M.some((function(n){return n.key===e.key}))},Ue=function(){return L.findIndex((function(e){return Ne(e)}))},Ke=function(){return a.ObjectUtils.findLastIndex(L,(function(e){return Ne(e)}))},Me=function(e){var n=e<L.length-1?L.slice(e+1).findIndex((function(e){return Ne(e)})):-1;return n>-1?n+e+1:e},Ae=function(e){var n=e>0?a.ObjectUtils.findLastIndex(L.slice(0,e),(function(e){return Ne(e)})):-1;return n>-1?n:e},Ce=function(){return L.findIndex((function(e){return we(e)}))},Le=function(){var e=Ce();return e<0?Ue():e},Re=function(){var e=Ce();return e<0?Ke():e},He=function(e,n){Y.current=(Y.current||"")+n;var t=-1,r=!1;return-1!==(t=-1!==j.index?-1===(t=L.slice(j.index).findIndex((function(e){return Se(e)})))?L.slice(0,j.index).findIndex((function(e){return Se(e)})):t+j.index:L.findIndex((function(e){return Se(e)})))&&(r=!0),-1===t&&-1===j.index&&(t=Le()),-1!==t&&Te(t),$.current&&clearTimeout($.current),$.current=setTimeout((function(){Y.current="",$.current=null}),500),r},Te=function(e){j.index!==e&&(P(w(w({},j),{},{index:e})),_e())},_e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,n=-1!==e?"".concat(m,"_").concat(e):D,t=a.DomHandler.findSingle(W.current,'li[data-id="'.concat(n,'"]'));t&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"start"})},Be=f.useCallback((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=[];return e&&e.forEach((function(e,o){var a=(""!==r?r+"_":"")+o,u={item:e,index:o,level:n,key:a,parent:t,parentKey:r};u.items=Be(e.items,n+1,u,a),i.push(u)})),i}),[]);i.useMountEffect((function(){m||d(a.UniqueComponentId())})),i.useUpdateEffect((function(){v?(re(),ae(),a.ZIndexUtils.set("menu",W.current,c&&c.autoZIndex||p.default.autoZIndex,c&&c.zIndex.menu||p.default.zIndex.menu)):(ue(),ie(),a.ZIndexUtils.clear(W.current))}),[v]),f.useEffect((function(){var e=Be(l.model||[],0,null,"");_(e)}),[l.model,Be]),i.useUpdateEffect((function(){var e=M.find((function(e){return e.key===j.parentKey}));R(e?e.items:T)}),[M,j,T]),i.useUpdateEffect((function(){a.ObjectUtils.isNotEmpty(M)?(re(),ae()):(ie(),ue())}),[M]),i.useUpdateEffect((function(){if(F){var e=-1!==j.index?Me(j.index):G.current?Ke():Le();Te(e),G.current=!1,z(!1)}}),[F]),i.useUpdateEffect((function(){U(-1!==j.index?"".concat(m).concat(a.ObjectUtils.isNotEmpty(j.parentKey)?"_"+j.parentKey:"","_").concat(j.index):null)}),[j]),i.useUnmountEffect((function(){a.ZIndexUtils.clear(W.current)})),f.useImperativeHandle(n,(function(){return{props:l,toggle:ce,getElement:function(){return V.current},getRootMenu:function(){return W.current},getMenuButton:function(){return q.current}}}));var Fe=function(){if(l.start){var e=a.ObjectUtils.getJSXElement(l.start,l),n=u({className:ne("start")},ee("start"));return f.createElement("div",n,e)}return null}(),ze=function(){if(l.end){var e=a.ObjectUtils.getJSXElement(l.end,l),n=u({className:ne("end")},ee("end"));return f.createElement("div",n,e)}return null}(),Je=function(){if(l.model&&l.model.length<1)return null;var e=u(y(y(y(y({ref:q,href:"#",tabIndex:"0","aria-haspopup":!!(v&&l.model&&l.model.length>0),"aria-expanded":v,"aria-label":t.ariaLabel("navigation"),"aria-controls":m,role:"button"},"tabIndex",0),"className",ne("button")),"onKeyDown",(function(e){var n;("Enter"===(n=e).code||"NumpadEnter"===n.code||"Space"===n.code)&&ce(n)})),"onClick",(function(e){return ce(e)})),ee("button")),n=u(ee("popupIcon")),r=a.IconUtils.getJSXIcon(l.menuIcon||f.createElement(o.BarsIcon,n),w({},n),{props:l});return f.createElement("a",e,r)}(),Xe=f.createElement(S,{hostName:"Menubar",ariaActivedescendant:I?D:void 0,level:0,id:m,ref:W,menuProps:l,model:T,onLeafClick:function(e){var n=e.originalEvent,t=e.processedItem,r=be(t),i=a.ObjectUtils.isEmpty(t.parent);if(De(t)){var o=t.index,u=t.key,c=t.level,l=t.parentKey;A(M.filter((function(e){return u!==e.key&&u.startsWith(e.key)}))),P({index:o,level:c,parentKey:l}),r||Z(!i),setTimeout((function(){a.DomHandler.focus(W.current),r&&Z(!0)}),0)}else if(r)a.DomHandler.focus(W.current),ve({originalEvent:n,processedItem:t});else{var s=i?t:M.find((function(e){return""===e.parentKey})),m=s?s.index:-1;se(n),P({index:m,parentKey:s?s.parentKey:""}),g(!1)}},onItemMouseEnter:function(e){!v&&X&&ve(e)},onFocus:function(e){h(!0),P(-1!==j.index?j:{index:Le(),level:0,parentKey:""}),l.onFocus&&l.onFocus(e)},onBlur:function(e){h(!1),P({index:-1,level:0,parentKey:""}),Y.current="",Z(!1),l.onBlur&&l.onBlur(e)},onKeyDown:function(e){var n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":ye(e);break;case"ArrowUp":ge(e);break;case"ArrowLeft":xe(e);break;case"ArrowRight":Ie(e);break;case"Home":he(e);break;case"End":Ee(e);break;case"Space":ke(e);break;case"Enter":case"NumpadEnter":Oe(e);break;case"Escape":je();break;case"Tab":Pe(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&a.ObjectUtils.isPrintableCharacter(e.key)&&He(e,e.key)}},root:!0,activeItemPath:M,focusedItemId:I?D:void 0,submenuIcon:l.submenuIcon,ptm:ee,cx:ne}),Ze=u({id:l.id,ref:V,className:a.classNames(l.className,ne("root",{mobileActiveState:v})),style:l.style},k.getOtherProps(l),ee("root"));return f.createElement("div",Ze,Fe,Je,Xe,ze)})));return D.displayName="Menubar",e.Menubar=D,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.hooks,primereact.icons.bars,primereact.utils,primereact.icons.angledown,primereact.icons.angleright,primereact.ripple);
|
package/messages/messages.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ export declare type MessagesPassThroughTransitionType = ReactCSSTransitionProps
|
|
|
22
22
|
*/
|
|
23
23
|
export interface MessagesPassThroughMethodOptions {
|
|
24
24
|
props: MessagesProps;
|
|
25
|
+
state: MessagesState;
|
|
26
|
+
hostName?: string;
|
|
27
|
+
index?: number;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
/**
|
|
@@ -68,6 +71,19 @@ export interface MessagesPassThroughOptions {
|
|
|
68
71
|
transition?: MessagesPassThroughTransitionType;
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Defines current inline state in Messages component.
|
|
76
|
+
*/
|
|
77
|
+
export interface MessagesState {
|
|
78
|
+
/**
|
|
79
|
+
* Array of messages
|
|
80
|
+
*/
|
|
81
|
+
messages: Array<{
|
|
82
|
+
_pId: number;
|
|
83
|
+
message: MessagesMessage;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
export interface MessagesMessage {
|
|
72
88
|
/**
|
|
73
89
|
* Unique id of the message.
|
|
@@ -163,6 +179,11 @@ export interface MessagesProps extends Omit<React.DetailedHTMLProps<React.HTMLAt
|
|
|
163
179
|
* @type {PassThroughOptions}
|
|
164
180
|
*/
|
|
165
181
|
ptOptions?: PassThroughOptions;
|
|
182
|
+
/**
|
|
183
|
+
* When enabled, it removes component related styles in the core.
|
|
184
|
+
* @defaultValue false
|
|
185
|
+
*/
|
|
186
|
+
unstyled?: boolean;
|
|
166
187
|
}
|
|
167
188
|
|
|
168
189
|
/**
|
|
@@ -636,6 +636,7 @@ var MultiSelectHeader = /*#__PURE__*/React__namespace.memo(function (props) {
|
|
|
636
636
|
className: "p-multiselect-filter",
|
|
637
637
|
placeholder: props.filterPlaceholder,
|
|
638
638
|
pt: ptm('filterInput'),
|
|
639
|
+
unstyled: props.unstyled,
|
|
639
640
|
__parentMetadata: {
|
|
640
641
|
parent: props.metaData
|
|
641
642
|
}
|
|
@@ -663,7 +664,7 @@ var MultiSelectHeader = /*#__PURE__*/React__namespace.memo(function (props) {
|
|
|
663
664
|
}, getPTOptions('headerSelectAllLabel'));
|
|
664
665
|
var headerCheckboxIconProps = mergeProps({
|
|
665
666
|
className: cx('headerCheckboxIcon')
|
|
666
|
-
}, getPTOptions('
|
|
667
|
+
}, getPTOptions('headerCheckbox.icon'));
|
|
667
668
|
var headerCheckboxContainerProps = mergeProps({
|
|
668
669
|
className: cx('headerCheckboxContainer')
|
|
669
670
|
}, getPTOptions('headerCheckboxContainer'));
|
|
@@ -762,7 +763,7 @@ var MultiSelectItem = /*#__PURE__*/React__namespace.memo(function (props) {
|
|
|
762
763
|
};
|
|
763
764
|
var checkboxIconProps = mergeProps({
|
|
764
765
|
className: cx('checkboxIcon')
|
|
765
|
-
}, getPTOptions('
|
|
766
|
+
}, getPTOptions('checkbox.icon'));
|
|
766
767
|
var icon = props.checkboxIcon || /*#__PURE__*/React__namespace.createElement(check.CheckIcon, checkboxIconProps);
|
|
767
768
|
var checkboxIcon = props.selected ? utils.IconUtils.getJSXIcon(icon, _objectSpread$2({}, checkboxIconProps), {
|
|
768
769
|
selected: props.selected
|
|
@@ -1263,7 +1264,7 @@ var MultiSelect = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
|
|
|
1263
1264
|
index !== -1 && setFocusedOptionIndex(index);
|
|
1264
1265
|
};
|
|
1265
1266
|
var onClick = function onClick(event) {
|
|
1266
|
-
if (!props.inline && !props.disabled && !props.loading && !isPanelClicked(event) &&
|
|
1267
|
+
if (!props.inline && !props.disabled && !props.loading && !isPanelClicked(event) && !isClearClicked(event)) {
|
|
1267
1268
|
overlayVisibleState ? hide() : show();
|
|
1268
1269
|
utils.DomHandler.focus(inputRef.current);
|
|
1269
1270
|
event.preventDefault();
|
|
@@ -1864,6 +1865,7 @@ var MultiSelect = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
|
|
|
1864
1865
|
}
|
|
1865
1866
|
};
|
|
1866
1867
|
var removeChip = function removeChip(event, item) {
|
|
1868
|
+
event.stopPropagation();
|
|
1867
1869
|
var value = props.value.filter(function (val) {
|
|
1868
1870
|
return !utils.ObjectUtils.equals(val, item, equalityKey);
|
|
1869
1871
|
});
|
|
@@ -2040,7 +2042,7 @@ var MultiSelect = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
|
|
|
2040
2042
|
empty: empty
|
|
2041
2043
|
})
|
|
2042
2044
|
}, ptm('label'));
|
|
2043
|
-
return /*#__PURE__*/React__namespace.createElement("div", labelContainerProps, /*#__PURE__*/React__namespace.createElement("div", labelProps, content || props.placeholder || 'empty'));
|
|
2045
|
+
return /*#__PURE__*/React__namespace.createElement("div", labelContainerProps, /*#__PURE__*/React__namespace.createElement("div", labelProps, content || props.placeholder || props.emptyMessage || 'empty'));
|
|
2044
2046
|
};
|
|
2045
2047
|
var visibleOptions = getVisibleOptions();
|
|
2046
2048
|
var hasTooltip = utils.ObjectUtils.isNotEmpty(props.tooltip);
|
|
@@ -2090,7 +2092,8 @@ var MultiSelect = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namesp
|
|
|
2090
2092
|
role: 'combobox',
|
|
2091
2093
|
'aria-expanded': overlayVisibleState,
|
|
2092
2094
|
disabled: props.disabled,
|
|
2093
|
-
tabIndex: !props.disabled ? props.tabIndex : -1
|
|
2095
|
+
tabIndex: !props.disabled ? props.tabIndex : -1,
|
|
2096
|
+
value: JSON.stringify(props.value)
|
|
2094
2097
|
}, ariaProps), ptm('input'));
|
|
2095
2098
|
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("div", rootProps, /*#__PURE__*/React__namespace.createElement("div", hiddenInputWrapperProps, /*#__PURE__*/React__namespace.createElement("input", _extends({}, inputProps, {
|
|
2096
2099
|
readOnly: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),l=require("primereact/hooks"),r=require("primereact/icons/chevrondown"),i=require("primereact/icons/spinner"),o=require("primereact/icons/times"),a=require("primereact/icons/timescircle"),c=require("primereact/overlayservice"),u=require("primereact/tooltip"),s=require("primereact/utils"),p=require("primereact/csstransition"),f=require("primereact/portal"),d=require("primereact/virtualscroller"),m=require("primereact/icons/check"),b=require("primereact/icons/search"),v=require("primereact/inputtext"),h=require("primereact/ripple");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var O=g(e),x=y(t);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},I.apply(this,arguments)}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(e)}function S(e,t){if("object"!==E(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,t||"default");if("object"!==E(l))return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function k(e){var t=S(e,"string");return"symbol"===E(t)?t:String(t)}function j(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(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 C(e){if(Array.isArray(e))return w(e)}function N(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function P(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 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 F(e){return C(e)||N(e)||P(e)||D()}function U(e){throw new TypeError('"'+e+'" is read-only')}function L(e){if(Array.isArray(e))return e}function A(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,r,i,o,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(l=i.call(n)).done)&&(a.push(l.value),a.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function M(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){return L(e)||A(e,t)||P(e,t)||M()}var H=n.ComponentBase.extend({defaultProps:{__TYPE:"MultiSelect",appendTo:null,ariaLabelledBy:null,checkboxIcon:null,className:null,clearIcon:null,closeIcon:null,dataKey:null,disabled:!1,display:"comma",dropdownIcon:null,emptyFilterMessage:null,emptyMessage:null,filter:!1,filterBy:null,filterInputAutoFocus:!0,filterLocale:void 0,selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,fixedPlaceholder:!1,flex:!1,id:null,inline:!1,inputId:null,inputRef:null,invalid:!1,variant:null,itemCheckboxIcon:null,itemClassName:null,itemTemplate:null,loading:!1,loadingIcon:null,maxSelectedLabels:null,name:null,onBlur:null,onChange:null,onClick:null,onFilter:null,onFocus:null,onHide:null,onRemove:null,onSelectAll:null,onShow:null,optionDisabled:null,optionGroupChildren:null,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,overlayVisible:!1,panelClassName:null,panelFooterTemplate:null,panelHeaderTemplate:null,panelStyle:null,placeholder:null,removeIcon:null,resetFilterOnHide:!1,scrollHeight:"200px",selectAll:!1,selectAllLabel:null,selectedItemTemplate:null,selectedItemsLabel:"{0} items selected",selectionLimit:null,showClear:!1,showSelectAll:!0,style:null,tabIndex:0,tooltip:null,tooltipOptions:null,transitionOptions:null,useOptionAsValue:!1,value:null,virtualScrollerOptions:null,children:void 0},css:{classes:{root:function(e){var t=e.props,n=e.context,l=e.focusedState,r=e.overlayVisibleState;return s.classNames("p-multiselect p-component p-inputwrapper",{"p-multiselect-chip":"chip"===t.display,"p-disabled":t.disabled,"p-invalid":t.invalid,"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle,"p-multiselect-clearable":t.showClear&&!t.disabled,"p-focus":l,"p-inputwrapper-filled":s.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":l||r})},label:function(e){var t=e.props,n=e.empty;return s.classNames("p-multiselect-label",{"p-placeholder":n&&t.placeholder,"p-multiselect-label-empty":n&&!t.placeholder&&!t.selectedItemTemplate,"p-multiselect-items-label":!n&&"chip"!==t.display&&t.value.length>t.maxSelectedLabels})},panel:function(e){var t=e.panelProps,n=e.context;return s.classNames("p-multiselect-panel p-component",{"p-multiselect-inline":t.inline,"p-multiselect-flex":t.flex,"p-multiselect-limited":!e.allowOptionSelect,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===x.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===x.default.ripple})},list:function(e){return"p-multiselect-items p-component"},labelContainer:"p-multiselect-label-container",triggerIcon:"p-multiselect-trigger-icon p-c",trigger:"p-multiselect-trigger",clearIcon:"p-multiselect-clear-icon",tokenLabel:"p-multiselect-token-label",token:"p-multiselect-token",removeTokenIcon:"p-multiselect-token-icon",wrapper:"p-multiselect-items-wrapper",emptyMessage:"p-multiselect-empty-message",itemGroup:"p-multiselect-item-group",closeButton:"p-multiselect-close p-link",header:"p-multiselect-header",closeIcon:"p-multiselect-close-icon",headerCheckboxContainer:"p-multiselect-select-all",headerCheckboxIcon:"p-multiselect-select-all p-checkbox-icon p-c",headerSelectAllLabel:"p-multiselect-select-all-label",filterContainer:"p-multiselect-filter-container",filterIcon:"p-multiselect-filter-icon",item:function(e){var t=e.itemProps;return s.classNames("p-multiselect-item",{"p-highlight":t.selected,"p-disabled":t.disabled,"p-focus":t.focusedOptionIndex===t.index})},checkboxContainer:"p-multiselect-checkbox",checkboxIcon:"p-checkbox-icon p-c",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-multiselect {\n display: inline-flex;\n user-select: none;\n cursor: pointer;\n }\n \n .p-multiselect-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n cursor: pointer;\n }\n \n .p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n }\n \n .p-multiselect-label {\n display: block;\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n \n .p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n .p-multiselect-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n }\n \n .p-multiselect-token-icon {\n cursor: pointer;\n }\n \n .p-multiselect .p-multiselect-panel {\n min-width: 100%;\n }\n \n .p-multiselect-inline.p-multiselect-panel {\n border: none;\n position: initial;\n background: none;\n box-shadow: none;\n }\n \n .p-multiselect-inline.p-multiselect-panel .p-multiselect-items {\n padding: 0;\n }\n \n .p-multiselect-flex.p-multiselect-panel .p-multiselect-items {\n display: flex;\n flex-wrap: wrap;\n }\n \n .p-multiselect-items-wrapper {\n overflow: auto;\n }\n \n .p-multiselect-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-multiselect-item {\n cursor: pointer;\n display: flex;\n align-items: center;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n outline: none;\n }\n \n .p-multiselect-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n \n .p-multiselect-select-all-label {\n margin-left: 0.5rem;\n }\n \n .p-multiselect-filter-container {\n position: relative;\n flex: 1 1 auto;\n }\n \n .p-multiselect-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-multiselect-filter-container .p-inputtext {\n width: 100%;\n }\n \n .p-multiselect-close {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n position: relative;\n margin-left: auto;\n }\n \n .p-multiselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n right: 3rem;\n }\n \n .p-fluid .p-multiselect {\n display: flex;\n }\n}\n",inlineStyles:{root:function(e){var t=e.props;return t.showClear&&!t.disabled&&{position:"relative"}},itemGroup:function(e){var t=e.scrollerOptions;return{height:t.props?t.props.itemSize:void 0}}}}}),R=n.ComponentBase.extend({defaultProps:{__TYPE:"Checkbox",autoFocus:!1,checked:!1,className:null,disabled:!1,falseValue:!1,icon:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,name:null,onChange:null,onContextMenu:null,onMouseDown:null,readOnly:!1,required:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,trueValue:!0,value:null,children:void 0},css:{classes:{box:"p-checkbox-box",input:"p-checkbox-input",icon:"p-checkbox-icon",root:function(e){var t=e.props,n=e.context;return s.classNames("p-checkbox p-component",{"p-highlight":e.checked,"p-disabled":t.disabled,"p-invalid":t.invalid,"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})}}}});function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var G=O.memo(O.forwardRef((function(e,r){var i=l.useMergeProps(),o=O.useContext(t.PrimeReactContext),a=R.getProps(e,o),c=T(O.useState(!1),2),p=c[1],f=R.setMetaData({props:a,state:{focused:c[0]},context:{checked:a.checked===a.trueValue,disabled:a.disabled}}),d=f.ptm,b=f.cx;n.useHandleStyle(R.css.styles,f.isUnstyled,{name:"checkbox"});var v=O.useRef(null),h=O.useRef(a.inputRef),y=function(){return a.checked===a.trueValue},g=function(e){if(!a.disabled&&!a.readonly&&a.onChange){var t,n=y()?a.falseValue:a.trueValue;if(null==a||null===(t=a.onChange)||void 0===t||t.call(a,{originalEvent:e,value:a.value,checked:n,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{type:"checkbox",name:a.name,id:a.id,value:a.value,checked:n}}),e.defaultPrevented)return;s.DomHandler.focus(h.current)}};O.useImperativeHandle(r,(function(){return{props:a,focus:function(){return s.DomHandler.focus(h.current)},getElement:function(){return v.current},getInput:function(){return h.current}}})),O.useEffect((function(){s.ObjectUtils.combinedRefs(h,a.inputRef)}),[h,a.inputRef]),l.useUpdateEffect((function(){h.current.checked=y()}),[a.checked,a.trueValue]),l.useMountEffect((function(){a.autoFocus&&s.DomHandler.focus(h.current,a.autoFocus)}));var x,E,S,k,j,w=y(),C=s.ObjectUtils.isNotEmpty(a.tooltip),N=R.getOtherProps(a),P=i({id:a.id,className:s.classNames(a.className,b("root",{checked:w,context:o})),style:a.style,"data-p-highlight":w,"data-p-disabled":a.disabled,onContextMenu:a.onContextMenu,onMouseDown:a.onMouseDown},N,d("root"));return O.createElement(O.Fragment,null,O.createElement("div",I({ref:v},P),(k=s.ObjectUtils.reduceKeys(N,s.DomHandler.ARIA_PROPS),j=i(q({id:a.inputId,type:"checkbox",className:b("input"),name:a.name,tabIndex:a.tabIndex,onFocus:function(e){return p(!0),void(null==a||null===(t=a.onFocus)||void 0===t||t.call(a));var t},onBlur:function(e){return p(!1),void(null==a||null===(t=a.onBlur)||void 0===t||t.call(a));var t},onChange:function(e){return g(e)},disabled:a.disabled,readOnly:a.readOnly,required:a.required,"aria-invalid":a.invalid,checked:w},k),d("input")),O.createElement("input",I({ref:h},j))),(x=i({className:b("icon")},d("icon")),E=i({className:b("box",{checked:w}),"data-p-highlight":w,"data-p-disabled":a.disabled},d("box")),S=s.IconUtils.getJSXIcon(w?a.icon||O.createElement(m.CheckIcon,x):null,q({},x),{props:a,checked:w}),O.createElement("div",E,S))),C&&O.createElement(u.Tooltip,I({target:v,content:a.tooltip,pt:d("tooltip")},a.tooltipOptions)))})));function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}G.displayName="Checkbox";var J=O.memo((function(e){var n=l.useMergeProps(),r=e.ptm,i=e.cx,a=e.isUnstyled,c={filter:function(e){return p(e)},reset:function(){return e.resetFilter()}},u=function(t,n){return r(t,_({hostName:e.hostName},n))},p=function(t){e.onFilter&&e.onFilter({originalEvent:t,query:t.target.value})},f=function(t){if(e.onSelectAll)e.onSelectAll({originalEvent:t,checked:e.selectAll});else{var n=e.isAllSelected()?[]:e.visibleOptions.filter((function(t){return e.isValidOption(t)})).map((function(t){return e.getOptionValue(t)}));e.updateModel(t,n,n)}},d=function(){var t=n({className:i("filterIcon")},u("filterIcon")),l=s.IconUtils.getJSXIcon(e.filterIcon||O.createElement(b.SearchIcon,t),_({},t),{props:e});if(e.filter){var o=n({className:i("filterContainer")},u("filterContainer")),a=O.createElement("div",o,O.createElement(v.InputText,{ref:e.filterRef,type:"text",role:"searchbox",value:e.filterValue,onChange:p,className:"p-multiselect-filter",placeholder:e.filterPlaceholder,pt:r("filterInput"),__parentMetadata:{parent:e.metaData}}),l);if(e.filterTemplate)a=s.ObjectUtils.getJSXElement(e.filterTemplate,{className:o.className,element:a,filterOptions:c,onFilter:p,filterIconClassName:e.filterIconClassName,props:e});return O.createElement(O.Fragment,null,a)}return null}(),y=e.id?e.id+"_selectall":s.UniqueComponentId(),g=n({htmlFor:y,className:i("headerSelectAllLabel")},u("headerSelectAllLabel")),x=n({className:i("headerCheckboxIcon")},u("headerCheckboxIcon")),I=n({className:i("headerCheckboxContainer")},u("headerCheckboxContainer")),E=s.IconUtils.getJSXIcon(e.itemCheckboxIcon||O.createElement(m.CheckIcon,x),_({},x),{selected:e.selected}),S=e.showSelectAll&&O.createElement("div",I,O.createElement(G,{id:y,checked:e.selectAll,onChange:f,role:"checkbox","aria-checked":e.selectAll,icon:E,pt:r("headerCheckbox"),unstyled:a()}),!e.filter&&O.createElement("label",g,e.selectAllLabel)),k=n({className:i("closeIcon"),"aria-hidden":!0},u("closeIcon")),j=s.IconUtils.getJSXIcon(e.closeIcon||O.createElement(o.TimesIcon,k),_({},k),{props:e}),w=n({className:i("header")},u("header")),C=n({type:"button",className:i("closeButton"),"aria-label":t.localeOption("close"),onClick:e.onClose},u("closeButton")),N=O.createElement("button",C,j,O.createElement(h.Ripple,null)),P=O.createElement("div",w,S,d,N);return e.template?s.ObjectUtils.getJSXElement(e.template,{className:"p-multiselect-header",checkboxElement:S,checked:e.selectAll,onChange:f,filterElement:d,closeElement:N,closeElementClassName:"p-multiselect-close p-link",closeIconClassName:"p-multiselect-close-icon",onCloseClick:e.onClose,element:P,itemCheckboxIcon:E,props:e}):P}));function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}J.displayName="MultiSelectHeader";var z=O.memo((function(e){var t=T(O.useState(!1),2),n=t[0],r=t[1],i=O.useRef(null),o=l.useMergeProps(),a=e.ptm,c=e.cx,u=e.isUnstyled,p=function(t){return a(t,{hostName:e.hostName,context:{selected:e.selected,disabled:e.disabled,focused:n,focusedIndex:e.focusedIndex,index:e.index}})},f=o({className:c("checkboxIcon")},p("checkboxIcon")),d=e.selected?s.IconUtils.getJSXIcon(e.checkboxIcon||O.createElement(m.CheckIcon,f),B({},f),{selected:e.selected}):null,b=e.template?s.ObjectUtils.getJSXElement(e.template,e.option):e.label,v=e.disabled?-1:e.tabIndex,y=o({className:c("checkboxContainer")},p("checkboxContainer")),g=o({className:s.classNames(e.className,e.option.className,c("item",{itemProps:e})),style:e.style,onClick:function(t){e.onClick&&e.onClick(t,e.option),t.preventDefault(),t.stopPropagation()},onFocus:function(e){var t;r(!0),null==i||null===(t=i.current)||void 0===t||t.getInput().focus()},onBlur:function(e){r(!1)},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,e.index)},tabIndex:v,role:"option","aria-selected":e.selected,"data-p-highlight":e.selected,"data-p-disabled":e.disabled},p("item"));return O.createElement("li",g,O.createElement("div",y,O.createElement(G,{ref:i,checked:e.selected,icon:d,pt:a("checkbox"),unstyled:u()})),O.createElement("span",null,b),O.createElement(h.Ripple,null))}));function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}z.displayName="MultiSelectItem";var Y=O.memo(O.forwardRef((function(e,n){var r=O.useRef(null),i=O.useRef(null),o=l.useMergeProps(),a=O.useContext(t.PrimeReactContext),c=e.ptm,u=e.cx,m=e.sx,b=e.isUnstyled,v=function(t,n){return c(t,W({hostName:e.hostName},n))},h=function(){e.onEnter((function(){if(r.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return r.current.scrollToIndex(t)}),0)}}))},y=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&i.current&&s.DomHandler.focus(i.current,!1)}))},g=function(t){r.current&&r.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},x=function(){if(e.panelFooterTemplate){var t=s.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide);return O.createElement("div",{className:"p-multiselect-footer"},t)}return null},E=function(t,n){var l;e.focusOnHover&&(null==e||null===(l=e.changeFocusedOptionIndex)||void 0===l||l.call(e,t,n))},S=function(t,n){return e.getOptionGroupChildren(t).map((function(t,l){var r=e.getOptionLabel(t),i=l+"_"+e.getOptionRenderKey(t),o=e.isOptionDisabled(t),a=o?null:e.tabIndex||0,s=e.isSelected(t);return O.createElement(z,{hostName:e.hostName,index:l,key:i,focusedOptionIndex:e.focusedOptionIndex,label:r,option:t,style:n,template:e.itemTemplate,selected:s,onClick:e.onOptionSelect,onMouseMove:E,tabIndex:a,disabled:o,className:e.itemClassName,checkboxIcon:e.checkboxIcon,isUnstyled:b,ptm:c,cx:u})}))},k=function(){var n=s.ObjectUtils.getJSXElement(e.emptyFilterMessage,e)||t.localeOption("emptyFilterMessage"),l=o({className:u("emptyMessage")},v("emptyMessage"));return O.createElement("li",l,n)},j=function(t,n){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={height:l.props?l.props.itemSize:void 0};if(e.optionGroupLabel){var i=e.optionGroupTemplate?s.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=S(t,r),p=n+"_"+e.getOptionGroupRenderKey(t),f=o({className:u("itemGroup"),style:m("itemGroup",{scrollerOptions:l})},v("itemGroup"));return O.createElement(O.Fragment,{key:p},O.createElement("li",f,i),a)}var d=e.getOptionLabel(t),h=n+"_"+e.getOptionRenderKey(t),y=e.isOptionDisabled(t),g=y?null:e.tabIndex||0,x=e.isSelected(t);return O.createElement(z,{hostName:e.hostName,key:h,focusedOptionIndex:e.focusedOptionIndex,label:d,option:t,style:r,index:n,template:e.itemTemplate,selected:x,onClick:e.onOptionSelect,onMouseMove:E,tabIndex:g,disabled:y,className:e.itemClassName,checkboxIcon:e.checkboxIcon,isUnstyled:b,ptm:c,cx:u})},w=function(){if(e.virtualScrollerOptions){var n=W(W({},e.virtualScrollerOptions),{style:W(W({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:s.classNames("p-multiselect-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(W(W({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&j(e,t.index,t)},contentTemplate:function(t){var n=e.visibleOptions&&e.visibleOptions.length||!e.hasFilter?t.children:k(),l=o({ref:t.contentRef,style:t.style,className:s.classNames(t.className,u("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox","aria-multiselectable":!0},v("list"));return O.createElement("ul",l,n)}});return O.createElement(d.VirtualScroller,I({ref:r},n,{pt:c("virtualScroller"),__parentMetadata:{parent:e.metaData}}))}var l,i,a=s.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(j):e.hasFilter?k():(l=s.ObjectUtils.getJSXElement(e.emptyMessage,e)||t.localeOption("emptyMessage"),i=o({className:u("emptyMessage")},v("emptyMessage")),O.createElement("li",i,l)),p=o({className:u("wrapper"),style:{maxHeight:e.scrollHeight}},v("wrapper")),f=o({className:u("list"),role:"listbox","aria-multiselectable":!0},v("list"));return O.createElement("div",p,O.createElement("ul",f,a))},C=function(){var t=e.allowOptionSelect(),l=O.createElement(J,{hostName:e.hostName,id:e.id,filter:e.filter,filterRef:i,filterValue:e.filterValue,filterTemplate:e.filterTemplate,visibleOptions:e.visibleOptions,isValidOption:e.isValidOption,getOptionValue:e.getOptionValue,updateModel:e.updateModel,onFilter:g,filterPlaceholder:e.filterPlaceholder,onClose:e.onCloseClick,showSelectAll:e.showSelectAll,selectAll:e.isAllSelected(),selectAllLabel:e.selectAllLabel,onSelectAll:e.onSelectAll,template:e.panelHeaderTemplate,resetFilter:e.resetFilter,closeIcon:e.closeIcon,filterIcon:e.filterIcon,itemCheckboxIcon:e.itemCheckboxIcon,ptm:c,cx:u,isUnstyled:b,metaData:e.metaData}),r=w(),f=x(),d=o({className:s.classNames(e.panelClassName,u("panel",{panelProps:e,context:a,allowOptionSelect:t})),style:e.panelStyle,onClick:e.onClick},v("panel"));if(e.inline)return O.createElement("div",I({ref:n},d),r,f);var m=o({classNames:u("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:h,onEntered:y,onExit:e.onExit,onExited:e.onExited},v("transition")),E=o({ref:e.firstHiddenFocusableElementOnOverlay,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onFirstHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},c("hiddenFirstFocusableEl")),S=o({ref:e.lastHiddenFocusableElementOnOverlay,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onLastHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},c("hiddenLastFocusableEl"));return O.createElement(p.CSSTransition,I({nodeRef:n},m),O.createElement("div",I({ref:n},d),O.createElement("span",E),l,r,f,O.createElement("span",S)))}();return e.inline?C:O.createElement(f.Portal,{element:C,appendTo:e.appendTo})})));function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=te(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var l=0,r=function(){};return{s:r,n:function(){return l>=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:r}}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,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function te(e,t){if(e){if("string"==typeof e)return ne(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)?ne(e,t):void 0}}function ne(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}Y.displayName="MultiSelectPanel";var le=O.memo(O.forwardRef((function(e,p){var f=l.useMergeProps(),d=O.useContext(t.PrimeReactContext),m=H.getProps(e,d),b=T(O.useState(null),2),v=b[0],h=b[1],y=T(O.useState(!1),2),g=y[0],E=y[1],S=T(O.useState(""),2),k=S[0],w=S[1],C=T(O.useState(-1),2),N=C[0],P=C[1],D=T(O.useState(!1),2),L=D[0],A=D[1],M=T(O.useState(m.inline),2),R=M[0],V=M[1],q=O.useRef(null),G=O.useRef(null),K=O.useRef(null),_=O.useRef(null),J=O.useRef(null),X=O.useRef(m.inputRef),B=O.useRef(null),z=O.useRef(null),Z=k&&k.trim().length>0,W=s.ObjectUtils.isEmpty(m.value),$=m.optionValue?null:m.dataKey,te={props:m,state:{filterState:k,focused:L,overlayVisible:R}},ne=H.setMetaData(te),le=ne.ptm,re=ne.cx,ie=ne.sx,oe=ne.isUnstyled;n.useHandleStyle(H.css.styles,oe,{name:"multiselect"});var ae=T(l.useOverlayListener({target:q,overlay:z,listener:function(e,t){t.valid&&("outside"===t.type?!Pe(e)&&!De(e)&&Ce():Ce())},when:R}),2),ce=ae[0],ue=ae[1],se=function(){return!m.selectionLimit||!m.value||m.value&&m.value.length<m.selectionLimit},pe=function(e){var t=Ke()&&e<ut.length-1?ut.slice(e+1).findIndex((function(e){return Be(e)})):-1;return t>-1?t+e+1:-1},fe=function(e){var t=Ke()&&e>0?s.ObjectUtils.findLastIndex(ut.slice(0,e),(function(e){return Be(e)})):-1;return t>-1?t:-1},de=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=-1;return Ke()&&(n=t?-1===(n=fe(e))?pe(e):n:-1===(n=pe(e))?fe(e):n),n>-1?n:e},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===t&&(t=de(n,!0)),-1===n&&(n=de(t)),-1!==t&&-1!==n){var l=Math.min(t,n),r=Math.max(t,n),i=ut.slice(l,r+1).filter((function(e){return Xe(e)})).map((function(e){return He(e)}));Se(e,i,i)}},be=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(!m.disabled&&!Ve(t)){var l=null;l=Le(t)?m.value.filter((function(e){return!s.ObjectUtils.equals(e,He(t),$)})):[].concat(F(m.value||[]),[He(t)]),Se(e,l,t),-1!==n&&h(n)}},ve=function(e){if(R){var t=-1!==v?Qe(v):g?Ye():Ze();e.shiftKey&&me(e,N,t),nt(e,t)}else we(),m.editable&&nt(e,ze());e.preventDefault()},he=function(e){if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==v&&be(e,ut[v]),R&&Ce(),e.preventDefault();else{var t=-1!==v?et(v):g?$e():We();nt(e,t),!R&&we(),e.preventDefault()}},ye=function(e){R?-1!==v&&(e.shiftKey?me(e,v):be(e,ut[v])):(h(-1),ve(e)),e.preventDefault()},ge=function(e){var t=e.currentTarget;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){t.setSelectionRange(0,e.shiftKey?t.value.length:0),h(-1)}else{var n=e.metaKey||e.ctrlKey,l=Ye();e.shiftKey&&n&&me(e,l,N),nt(e,l),!R&&we()}e.preventDefault()},Oe=function(e){var t=e.currentTarget;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var n=t.value.length;t.setSelectionRange(e.shiftKey?0:n,n),U("focusedOptionIndex")}else{var l=e.metaKey||e.ctrlKey,r=$e();e.shiftKey&&l&&me(e,N,r),nt(e,r),!R&&we()}e.preventDefault()},xe=function(e){e.preventDefault()},Ie=function(e){e.preventDefault()},Ee=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(R&&_e()?(s.DomHandler.focus(e.shiftKey?J.current:_.current),e.preventDefault()):(-1!==v&&be(e,ut[v]),R&&Ce(filter)))},Se=function(e,t,n){m.onChange&&m.onChange({originalEvent:e,value:t,selectedOption:n,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:m.name,id:m.id,value:t}})},ke=function(){w(""),m.onFilter&&m.onFilter({filter:""})},je=function(e){var t;R&&((t=e?e.currentTarget:s.DomHandler.findSingle(z.current,'li[data-p-highlight="true"]'))&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"}))},we=function(){V(!0),h(-1!==v?v:m.autoOptionFocus?Ze():ze()),s.DomHandler.focus(X.current)},Ce=function(){h(-1),V(!1),E(!1)},Ne=function(){s.DomHandler.alignOverlay(z.current,B.current.parentElement,m.appendTo||d&&d.appendTo||x.default.appendTo)},Pe=function(e){return"clearicon"===s.DomHandler.getAttribute(e.target,"data-pc-section")},De=function(e){return"headercheckboxcontainer"===s.DomHandler.getAttribute(e.target,"data-pc-section")},Fe=function(e){return z.current&&z.current.contains(e.target)},Ue=function(e,t){return t.findIndex((function(t){return e.some((function(e){return s.ObjectUtils.equals(e,He(t),$)}))}))},Le=function(e){if(m.value){var t=He(e),n=qe(e);return m.value.some((function(e){return s.ObjectUtils.equals(n?e:He(e),t,$)}))}return!1},Ae=function(e){var t;if(m.options)if(m.optionGroupLabel){var n,l=ee(m.options);try{for(l.s();!(n=l.n()).done;){if(t=Me(e,Re(n.value)))break}}catch(e){l.e(e)}finally{l.f()}}else t=Me(e,m.options),s.ObjectUtils.isEmpty(t)&&(t=Me(e,m.value));return t?Te(t):null},Me=function(e,t){return t.find((function(t){return s.ObjectUtils.equals(He(t),e,$)}))},Te=function(e){return m.optionLabel?s.ObjectUtils.resolveFieldData(e,m.optionLabel):e&&void 0!==e.label?e.label:e},He=function(e){if(m.useOptionAsValue)return e;if(m.optionValue){var t=s.ObjectUtils.resolveFieldData(e,m.optionValue);return null!==t?t:e}return e&&void 0!==e.value?e.value:e},Re=function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupChildren)},Ve=function(e){var t;if(!se()&&!Le(e))return!0;var n=m.optionDisabled;return n?s.ObjectUtils.isFunction(n)?n(e):s.ObjectUtils.resolveFieldData(e,n):e&&null!==(t=e.disabled)&&void 0!==t&&t},qe=function(e){return!m.useOptionAsValue&&m.optionValue||e&&void 0!==e.value},Ge=function(e){return m.optionGroupLabel&&e.optionGroup&&e.group},Ke=function(){return s.ObjectUtils.isNotEmpty(m.value)},_e=function(){return s.DomHandler.getFocusableElements(z.current,':not([data-p-hidden-focusable="true"])').length>0},Je=function(e){var t;return Xe(e)&&(null===(t=Te(e))||void 0===t?void 0:t.toLocaleLowerCase(m.filterLocale).startsWith(G.current.toLocaleLowerCase(m.filterLocale)))},Xe=function(e){return s.ObjectUtils.isNotEmpty(e)&&!(Ve(e)||Ge(e))},Be=function(e){return Xe(e)&&Le(e)},ze=function(){if(Ke())for(var e,t=function(){var e=m.value[n],t=ut.findIndex((function(t){return Be(t)&&(n=e,l=He(t),s.ObjectUtils.equals(n,l,$));var n,l}));if(t>-1)return{v:t}},n=m.value.length-1;n>=0;n--)if(e=t())return e.v;return-1},Ze=function(){var e=ze();return e<0?Ye():e},We=function(){var e=ze();return e<0?$e():e},Ye=function(){return ut.findIndex((function(e){return Xe(e)}))},$e=function(){return s.ObjectUtils.findLastIndex(ut,(function(e){return Xe(e)}))},Qe=function(e){var t=e<ut.length-1?ut.slice(e+1).findIndex((function(e){return Xe(e)})):-1;return t>-1?t+e+1:e},et=function(e){var t=e>0?s.ObjectUtils.findLastIndex(ut.slice(0,e),(function(e){return Xe(e)})):-1;return t>-1?t:e},tt=function(e){G.current=(G.current||"")+e.key;var t=-1;s.ObjectUtils.isNotEmpty(G.current)&&(-1===(t=-1!==v?-1===(t=ut.slice(v).findIndex((function(e){return Je(e)})))?ut.slice(0,v).findIndex((function(e){return Je(e)})):t+v:ut.findIndex((function(e){return Je(e)})))&&-1===v&&(t=Ze()),-1!==t&&nt(e,t)),K.current&&clearTimeout(K.current),K.current=setTimeout((function(){G.current="",K.current=null}),500)},nt=function(e,t){v!==t&&(h(t),je(e),m.selectOnFocus&&be(e,ut[t],!1))},lt=function(e,t){var n=m.value.filter((function(e){return!s.ObjectUtils.equals(e,t,$)}));m.onRemove&&m.onRemove({originalEvent:e,value:n}),Se(e,n,t)},rt=function(){var e=/{(.*?)}/,n=m.selectedItemsLabel||t.localeOption("selectionMessage");return e.test(n)?n.replace(n.match(e)[0],m.value.length+""):n},it=function(){if(!W&&!m.fixedPlaceholder)return s.ObjectUtils.isNotEmpty(m.maxSelectedLabels)&&m.value.length>m.maxSelectedLabels?rt():s.ObjectUtils.isArray(m.value)?m.value.reduce((function(e,t,n){return e+(0!==n?", ":"")+Ae(t)}),""):""};O.useImperativeHandle(p,(function(){return{props:m,show:we,hide:Ce,focus:function(){return s.DomHandler.focus(X.current)},getElement:function(){return q.current},getOverlay:function(){return z.current},getInput:function(){return X.current}}})),l.useMountEffect((function(){Ne()})),O.useEffect((function(){s.ObjectUtils.combinedRefs(X,m.inputRef)}),[X,m.inputRef]),O.useEffect((function(){setTimeout((function(){m.overlayVisible?we():Ce()}),100)}),[m.overlayVisible]),l.useUpdateEffect((function(){R&&k&&Z&&Ne()}),[R,k,Z]),l.useUnmountEffect((function(){s.ZIndexUtils.clear(z.current)}));var ot,at,ct,ut=function(){if(Z){var e=k.trim().toLocaleLowerCase(m.filterLocale),n=m.filterBy?m.filterBy.split(","):[m.optionLabel||"label"];if(m.optionGroupLabel){var l,r=[],i=ee(m.options);try{for(i.s();!(l=i.n()).done;){var o=l.value,a=t.FilterService.filter(Re(o),n,e,m.filterMatchMode,m.filterLocale);a&&a.length&&r.push(Q(Q({},o),j({},m.optionGroupChildren,a)))}}catch(e){i.e(e)}finally{i.f()}return r}return t.FilterService.filter(m.options,n,e,m.filterMatchMode,m.filterLocale)}return m.options}(),st=s.ObjectUtils.isNotEmpty(m.tooltip),pt=H.getOtherProps(m),ft=s.ObjectUtils.reduceKeys(pt,s.DomHandler.ARIA_PROPS),dt=f({className:re("triggerIcon")},le("triggerIcon")),mt=f({className:re("trigger")},le("trigger")),bt=m.loadingIcon?s.IconUtils.getJSXIcon(m.loadingIcon,Q({},dt),{props:m}):O.createElement(i.SpinnerIcon,I({spin:!0},dt)),vt=m.dropdownIcon?s.IconUtils.getJSXIcon(m.dropdownIcon,Q({},dt),{props:m}):O.createElement(r.ChevronDownIcon,dt),ht=O.createElement("div",mt,m.loading?bt:vt),yt=!m.inline&&(ot=m.selectedItemTemplate?W?s.ObjectUtils.getJSXElement(m.selectedItemTemplate):s.ObjectUtils.isNotEmpty(m.maxSelectedLabels)&&m.value.length>m.maxSelectedLabels?rt():m.value.map((function(e,t){var n=s.ObjectUtils.getJSXElement(m.selectedItemTemplate,e);return O.createElement(O.Fragment,{key:t},n)})):"chip"!==m.display||W?it():m.value.slice(0,m.maxSelectedLabels||m.value.length).map((function(e,t){var n={context:{value:e,index:t}},l=Ae(e),r=l+"_"+t,i=f({key:t,className:re("removeTokenIcon"),onClick:function(t){return lt(t,e)}},le("removeTokenIcon",n)),o=!m.disabled&&(m.removeIcon?s.IconUtils.getJSXIcon(m.removeIcon,Q({},i),{props:m}):O.createElement(a.TimesCircleIcon,i)),c=f({className:re("token")},le("token",n)),u=f({className:re("tokenLabel")},le("tokenLabel",n));return O.createElement("div",I({},c,{key:r}),O.createElement("span",u,l),o)})),at=f({ref:B,className:re("labelContainer")},le("labelContainer")),ct=f({className:re("label",{empty:W})},le("label")),O.createElement("div",at,O.createElement("div",ct,ot||m.placeholder||"empty"))),gt=!m.inline&&function(){var e=f({className:re("clearIcon"),onClick:function(e){return Se(e,[],[])}},le("clearIcon")),t=s.IconUtils.getJSXIcon(m.clearIcon||O.createElement(o.TimesIcon,e),Q({},e),{props:m});return W||!m.showClear||m.disabled?null:t}(),Ot=f(Q(Q({ref:q,id:m.id,style:Q(Q({},m.style),ie("root")),className:s.classNames(m.className,re("root",{focusedState:L,context:d,overlayVisibleState:R}))},pt),{},{onClick:function(e){m.inline||m.disabled||m.loading||Fe(e)||"removetokenicon"===s.DomHandler.getAttribute(e.target,"data-pc-section")||Pe(e)||(R?Ce():we(),s.DomHandler.focus(X.current),e.preventDefault()),E(!0)}}),H.getOtherProps(m),le("root")),xt=f({className:"p-hidden-accessible","data-p-hidden-accessible":!0},le("hiddenInputWrapper")),It=f(Q({ref:X,id:m.inputId,name:m.name,type:"text",onFocus:function(e){A(!0),m.onFocus&&m.onFocus(e)},onBlur:function(e){A(!1),m.onBlur&&m.onBlur(e)},onKeyDown:function(e){var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowUp":if(m.inline)break;he(e);break;case"ArrowDown":if(m.inline)break;ve(e);break;case"Space":case"NumpadEnter":case"Enter":if(m.inline)break;ye(e);break;case"Home":if(m.inline)break;ge(e),e.preventDefault();break;case"End":if(m.inline)break;Oe(e),e.preventDefault();break;case"PageDown":Ie(e);break;case"PageUp":xe(e);break;case"Escape":if(m.inline)break;Ce();break;case"Tab":Ee(e);break;case"ShiftLeft":case"ShiftRight":P(v);break;default:if("KeyA"===e.code&&t){var n=ut.filter((function(e){return Xe(e)})).map((function(e){return He(e)}));Se(e,n,n),e.preventDefault();break}!t&&s.ObjectUtils.isPrintableCharacter(e.key)&&(!R&&we(),tt(e),e.preventDefault())}E(!1)},role:"combobox","aria-expanded":R,disabled:m.disabled,tabIndex:m.disabled?-1:m.tabIndex},ft),le("input"));return O.createElement(O.Fragment,null,O.createElement("div",Ot,O.createElement("div",xt,O.createElement("input",I({},It,{readOnly:!0}))),!m.inline&&O.createElement(O.Fragment,null,yt,gt,ht),O.createElement(Y,I({hostName:"MultiSelect",ref:z,visibleOptions:ut},m,{onClick:function(e){c.OverlayService.emit("overlay-click",{originalEvent:e,target:q.current})},onOverlayHide:Ce,filterValue:k,focusedOptionIndex:v,onFirstHiddenFocus:function(e){var t=e.relatedTarget===X.current?s.DomHandler.getFirstFocusableElement(z.current,':not([data-p-hidden-focusable="true"])'):X.current;s.DomHandler.focus(t)},onLastHiddenFocus:function(e){var t=e.relatedTarget===X.current?s.DomHandler.getLastFocusableElement(z.current,':not([data-p-hidden-focusable="true"])'):X.current;s.DomHandler.focus(t)},firstHiddenFocusableElementOnOverlay:_,lastHiddenFocusableElementOnOverlay:J,setFocusedOptionIndex:h,hasFilter:Z,isValidOption:Xe,getOptionValue:He,updateModel:Se,onFilterInputChange:function(e){var t=e.query;w(t),m.onFilter&&m.onFilter({originalEvent:e,filter:t})},resetFilter:ke,onCloseClick:function(e){Ce(),s.DomHandler.focus(X.current),e.preventDefault(),e.stopPropagation()},onSelectAll:function(e){if(m.onSelectAll)m.onSelectAll(e);else{var t=null;if(e.checked){if(t=[],ut){var n=ut.filter((function(e){return Ve(e)&&Le(e)}));t=n.map((function(e){return He(e)}))}}else if(ut){var l=ut.filter((function(e){return!Ve(e)||Le(e)}));m.optionGroupLabel?(t=[],l.forEach((function(e){return t=[].concat(F(t),F(Re(e).filter((function(e){return!Ve(e)})).map((function(e){return He(e)}))))}))):t=l.map((function(e){return He(e)}))}m.selectionLimit&&t&&t.length&&(t=t.slice(0,m.selectionLimit)),Se(e.originalEvent,t,t)}},getOptionLabel:Te,getOptionRenderKey:function(e){return m.dataKey?s.ObjectUtils.resolveFieldData(e,m.dataKey):Te(e)},isOptionDisabled:Ve,getOptionGroupChildren:Re,getOptionGroupLabel:function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupLabel)},getOptionGroupRenderKey:function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupLabel)},isSelected:Le,getSelectedOptionIndex:function(){if(null!=m.value&&m.options){if(m.optionGroupLabel){var e=0,t=m.options.findIndex((function(t,n){return(e=n)&&-1!==Ue(m.value,Re(t))}));return-1!==t?{group:e,option:t}:-1}return Ue(m.value,m.options)}return-1},isAllSelected:function(){if(m.onSelectAll)return m.selectAll;if(s.ObjectUtils.isEmpty(ut))return!1;var e=ut.filter((function(e){return!Ve(e)}));if(m.optionGroupLabel){var t,n=!0,l=ee(e);try{for(l.s();!(t=l.n()).done;){!0===Re(t.value).filter((function(e){return!Ve(e)})).some((function(e){return!Le(e)}))&&(n=!1)}}catch(e){l.e(e)}finally{l.f()}return n}return!e.some((function(e){return!Le(e)}))},onOptionSelect:be,allowOptionSelect:se,in:R,onEnter:function(e){s.ZIndexUtils.set("overlay",z.current,d&&d.autoZIndex||x.default.autoZIndex,d&&d.zIndex.overlay||x.default.zIndex.overlay),s.DomHandler.addStyles(z.current,{position:"absolute",top:"0",left:"0"}),Ne(),je(),e&&e()},onEntered:function(e){e&&e(),ce(),m.onShow&&m.onShow()},onExit:function(){ue()},onExited:function(){m.filter&&m.resetFilterOnHide&&ke(),s.ZIndexUtils.clear(z.current),m.onHide&&m.onHide()},ptm:le,cx:re,sx:ie,isUnstyled:oe,metaData:te,changeFocusedOptionIndex:nt}))),st&&O.createElement(u.Tooltip,I({target:q,content:m.tooltip,pt:le("tooltip")},m.tooltipOptions)))})));le.displayName="MultiSelect",exports.MultiSelect=le;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/api"),n=require("primereact/componentbase"),l=require("primereact/hooks"),r=require("primereact/icons/chevrondown"),i=require("primereact/icons/spinner"),o=require("primereact/icons/times"),a=require("primereact/icons/timescircle"),c=require("primereact/overlayservice"),u=require("primereact/tooltip"),s=require("primereact/utils"),p=require("primereact/csstransition"),f=require("primereact/portal"),d=require("primereact/virtualscroller"),m=require("primereact/icons/check"),b=require("primereact/icons/search"),v=require("primereact/inputtext"),h=require("primereact/ripple");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var O=g(e),x=y(t);function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e},I.apply(this,arguments)}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},S(e)}function E(e,t){if("object"!==S(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var l=n.call(e,t||"default");if("object"!==S(l))return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function k(e){var t=E(e,"string");return"symbol"===S(t)?t:String(t)}function j(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(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 C(e){if(Array.isArray(e))return w(e)}function N(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function P(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 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 F(e){return C(e)||N(e)||P(e)||D()}function U(e){throw new TypeError('"'+e+'" is read-only')}function L(e){if(Array.isArray(e))return e}function M(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var l,r,i,o,a=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(l=i.call(n)).done)&&(a.push(l.value),a.length!==t);c=!0);}catch(e){u=!0,r=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return a}}function A(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(e,t){return L(e)||M(e,t)||P(e,t)||A()}var H=n.ComponentBase.extend({defaultProps:{__TYPE:"MultiSelect",appendTo:null,ariaLabelledBy:null,checkboxIcon:null,className:null,clearIcon:null,closeIcon:null,dataKey:null,disabled:!1,display:"comma",dropdownIcon:null,emptyFilterMessage:null,emptyMessage:null,filter:!1,filterBy:null,filterInputAutoFocus:!0,filterLocale:void 0,selectOnFocus:!1,focusOnHover:!0,autoOptionFocus:!1,filterMatchMode:"contains",filterPlaceholder:null,filterTemplate:null,fixedPlaceholder:!1,flex:!1,id:null,inline:!1,inputId:null,inputRef:null,invalid:!1,variant:null,itemCheckboxIcon:null,itemClassName:null,itemTemplate:null,loading:!1,loadingIcon:null,maxSelectedLabels:null,name:null,onBlur:null,onChange:null,onClick:null,onFilter:null,onFocus:null,onHide:null,onRemove:null,onSelectAll:null,onShow:null,optionDisabled:null,optionGroupChildren:null,optionGroupLabel:null,optionGroupTemplate:null,optionLabel:null,optionValue:null,options:null,overlayVisible:!1,panelClassName:null,panelFooterTemplate:null,panelHeaderTemplate:null,panelStyle:null,placeholder:null,removeIcon:null,resetFilterOnHide:!1,scrollHeight:"200px",selectAll:!1,selectAllLabel:null,selectedItemTemplate:null,selectedItemsLabel:"{0} items selected",selectionLimit:null,showClear:!1,showSelectAll:!0,style:null,tabIndex:0,tooltip:null,tooltipOptions:null,transitionOptions:null,useOptionAsValue:!1,value:null,virtualScrollerOptions:null,children:void 0},css:{classes:{root:function(e){var t=e.props,n=e.context,l=e.focusedState,r=e.overlayVisibleState;return s.classNames("p-multiselect p-component p-inputwrapper",{"p-multiselect-chip":"chip"===t.display,"p-disabled":t.disabled,"p-invalid":t.invalid,"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle,"p-multiselect-clearable":t.showClear&&!t.disabled,"p-focus":l,"p-inputwrapper-filled":s.ObjectUtils.isNotEmpty(t.value),"p-inputwrapper-focus":l||r})},label:function(e){var t=e.props,n=e.empty;return s.classNames("p-multiselect-label",{"p-placeholder":n&&t.placeholder,"p-multiselect-label-empty":n&&!t.placeholder&&!t.selectedItemTemplate,"p-multiselect-items-label":!n&&"chip"!==t.display&&t.value.length>t.maxSelectedLabels})},panel:function(e){var t=e.panelProps,n=e.context;return s.classNames("p-multiselect-panel p-component",{"p-multiselect-inline":t.inline,"p-multiselect-flex":t.flex,"p-multiselect-limited":!e.allowOptionSelect,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===x.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===x.default.ripple})},list:function(e){return"p-multiselect-items p-component"},labelContainer:"p-multiselect-label-container",triggerIcon:"p-multiselect-trigger-icon p-c",trigger:"p-multiselect-trigger",clearIcon:"p-multiselect-clear-icon",tokenLabel:"p-multiselect-token-label",token:"p-multiselect-token",removeTokenIcon:"p-multiselect-token-icon",wrapper:"p-multiselect-items-wrapper",emptyMessage:"p-multiselect-empty-message",itemGroup:"p-multiselect-item-group",closeButton:"p-multiselect-close p-link",header:"p-multiselect-header",closeIcon:"p-multiselect-close-icon",headerCheckboxContainer:"p-multiselect-select-all",headerCheckboxIcon:"p-multiselect-select-all p-checkbox-icon p-c",headerSelectAllLabel:"p-multiselect-select-all-label",filterContainer:"p-multiselect-filter-container",filterIcon:"p-multiselect-filter-icon",item:function(e){var t=e.itemProps;return s.classNames("p-multiselect-item",{"p-highlight":t.selected,"p-disabled":t.disabled,"p-focus":t.focusedOptionIndex===t.index})},checkboxContainer:"p-multiselect-checkbox",checkboxIcon:"p-checkbox-icon p-c",transition:"p-connected-overlay"},styles:"\n@layer primereact {\n .p-multiselect {\n display: inline-flex;\n user-select: none;\n cursor: pointer;\n }\n \n .p-multiselect-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n cursor: pointer;\n }\n \n .p-multiselect-label-container {\n overflow: hidden;\n flex: 1 1 auto;\n cursor: pointer;\n }\n \n .p-multiselect-label {\n display: block;\n white-space: nowrap;\n cursor: pointer;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n \n .p-multiselect-label-empty {\n overflow: hidden;\n visibility: hidden;\n }\n \n .p-multiselect-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n }\n \n .p-multiselect-token-icon {\n cursor: pointer;\n }\n \n .p-multiselect .p-multiselect-panel {\n min-width: 100%;\n }\n \n .p-multiselect-inline.p-multiselect-panel {\n border: none;\n position: initial;\n background: none;\n box-shadow: none;\n }\n \n .p-multiselect-inline.p-multiselect-panel .p-multiselect-items {\n padding: 0;\n }\n \n .p-multiselect-flex.p-multiselect-panel .p-multiselect-items {\n display: flex;\n flex-wrap: wrap;\n }\n \n .p-multiselect-items-wrapper {\n overflow: auto;\n }\n \n .p-multiselect-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-multiselect-item {\n cursor: pointer;\n display: flex;\n align-items: center;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n outline: none;\n }\n \n .p-multiselect-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n \n .p-multiselect-select-all-label {\n margin-left: 0.5rem;\n }\n \n .p-multiselect-filter-container {\n position: relative;\n flex: 1 1 auto;\n }\n \n .p-multiselect-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-multiselect-filter-container .p-inputtext {\n width: 100%;\n }\n \n .p-multiselect-close {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n overflow: hidden;\n position: relative;\n margin-left: auto;\n }\n \n .p-multiselect-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n right: 3rem;\n }\n \n .p-fluid .p-multiselect {\n display: flex;\n }\n}\n",inlineStyles:{root:function(e){var t=e.props;return t.showClear&&!t.disabled&&{position:"relative"}},itemGroup:function(e){var t=e.scrollerOptions;return{height:t.props?t.props.itemSize:void 0}}}}}),R=n.ComponentBase.extend({defaultProps:{__TYPE:"Checkbox",autoFocus:!1,checked:!1,className:null,disabled:!1,falseValue:!1,icon:null,id:null,inputId:null,inputRef:null,invalid:!1,variant:null,name:null,onChange:null,onContextMenu:null,onMouseDown:null,readOnly:!1,required:!1,style:null,tabIndex:null,tooltip:null,tooltipOptions:null,trueValue:!0,value:null,children:void 0},css:{classes:{box:"p-checkbox-box",input:"p-checkbox-input",icon:"p-checkbox-icon",root:function(e){var t=e.props,n=e.context;return s.classNames("p-checkbox p-component",{"p-highlight":e.checked,"p-disabled":t.disabled,"p-invalid":t.invalid,"p-variant-filled":t.variant?"filled"===t.variant:n&&"filled"===n.inputStyle})}}}});function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var G=O.memo(O.forwardRef((function(e,r){var i=l.useMergeProps(),o=O.useContext(t.PrimeReactContext),a=R.getProps(e,o),c=T(O.useState(!1),2),p=c[1],f=R.setMetaData({props:a,state:{focused:c[0]},context:{checked:a.checked===a.trueValue,disabled:a.disabled}}),d=f.ptm,b=f.cx;n.useHandleStyle(R.css.styles,f.isUnstyled,{name:"checkbox"});var v=O.useRef(null),h=O.useRef(a.inputRef),y=function(){return a.checked===a.trueValue},g=function(e){if(!a.disabled&&!a.readonly&&a.onChange){var t,n=y()?a.falseValue:a.trueValue;if(null==a||null===(t=a.onChange)||void 0===t||t.call(a,{originalEvent:e,value:a.value,checked:n,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{type:"checkbox",name:a.name,id:a.id,value:a.value,checked:n}}),e.defaultPrevented)return;s.DomHandler.focus(h.current)}};O.useImperativeHandle(r,(function(){return{props:a,focus:function(){return s.DomHandler.focus(h.current)},getElement:function(){return v.current},getInput:function(){return h.current}}})),O.useEffect((function(){s.ObjectUtils.combinedRefs(h,a.inputRef)}),[h,a.inputRef]),l.useUpdateEffect((function(){h.current.checked=y()}),[a.checked,a.trueValue]),l.useMountEffect((function(){a.autoFocus&&s.DomHandler.focus(h.current,a.autoFocus)}));var x,S,E,k,j,w=y(),C=s.ObjectUtils.isNotEmpty(a.tooltip),N=R.getOtherProps(a),P=i({id:a.id,className:s.classNames(a.className,b("root",{checked:w,context:o})),style:a.style,"data-p-highlight":w,"data-p-disabled":a.disabled,onContextMenu:a.onContextMenu,onMouseDown:a.onMouseDown},N,d("root"));return O.createElement(O.Fragment,null,O.createElement("div",I({ref:v},P),(k=s.ObjectUtils.reduceKeys(N,s.DomHandler.ARIA_PROPS),j=i(q({id:a.inputId,type:"checkbox",className:b("input"),name:a.name,tabIndex:a.tabIndex,onFocus:function(e){return p(!0),void(null==a||null===(t=a.onFocus)||void 0===t||t.call(a));var t},onBlur:function(e){return p(!1),void(null==a||null===(t=a.onBlur)||void 0===t||t.call(a));var t},onChange:function(e){return g(e)},disabled:a.disabled,readOnly:a.readOnly,required:a.required,"aria-invalid":a.invalid,checked:w},k),d("input")),O.createElement("input",I({ref:h},j))),(x=i({className:b("icon")},d("icon")),S=i({className:b("box",{checked:w}),"data-p-highlight":w,"data-p-disabled":a.disabled},d("box")),E=s.IconUtils.getJSXIcon(w?a.icon||O.createElement(m.CheckIcon,x):null,q({},x),{props:a,checked:w}),O.createElement("div",S,E))),C&&O.createElement(u.Tooltip,I({target:v,content:a.tooltip,pt:d("tooltip")},a.tooltipOptions)))})));function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}G.displayName="Checkbox";var _=O.memo((function(e){var n=l.useMergeProps(),r=e.ptm,i=e.cx,a=e.isUnstyled,c={filter:function(e){return p(e)},reset:function(){return e.resetFilter()}},u=function(t,n){return r(t,J({hostName:e.hostName},n))},p=function(t){e.onFilter&&e.onFilter({originalEvent:t,query:t.target.value})},f=function(t){if(e.onSelectAll)e.onSelectAll({originalEvent:t,checked:e.selectAll});else{var n=e.isAllSelected()?[]:e.visibleOptions.filter((function(t){return e.isValidOption(t)})).map((function(t){return e.getOptionValue(t)}));e.updateModel(t,n,n)}},d=function(){var t=n({className:i("filterIcon")},u("filterIcon")),l=s.IconUtils.getJSXIcon(e.filterIcon||O.createElement(b.SearchIcon,t),J({},t),{props:e});if(e.filter){var o=n({className:i("filterContainer")},u("filterContainer")),a=O.createElement("div",o,O.createElement(v.InputText,{ref:e.filterRef,type:"text",role:"searchbox",value:e.filterValue,onChange:p,className:"p-multiselect-filter",placeholder:e.filterPlaceholder,pt:r("filterInput"),unstyled:e.unstyled,__parentMetadata:{parent:e.metaData}}),l);if(e.filterTemplate)a=s.ObjectUtils.getJSXElement(e.filterTemplate,{className:o.className,element:a,filterOptions:c,onFilter:p,filterIconClassName:e.filterIconClassName,props:e});return O.createElement(O.Fragment,null,a)}return null}(),y=e.id?e.id+"_selectall":s.UniqueComponentId(),g=n({htmlFor:y,className:i("headerSelectAllLabel")},u("headerSelectAllLabel")),x=n({className:i("headerCheckboxIcon")},u("headerCheckbox.icon")),I=n({className:i("headerCheckboxContainer")},u("headerCheckboxContainer")),S=s.IconUtils.getJSXIcon(e.itemCheckboxIcon||O.createElement(m.CheckIcon,x),J({},x),{selected:e.selected}),E=e.showSelectAll&&O.createElement("div",I,O.createElement(G,{id:y,checked:e.selectAll,onChange:f,role:"checkbox","aria-checked":e.selectAll,icon:S,pt:r("headerCheckbox"),unstyled:a()}),!e.filter&&O.createElement("label",g,e.selectAllLabel)),k=n({className:i("closeIcon"),"aria-hidden":!0},u("closeIcon")),j=s.IconUtils.getJSXIcon(e.closeIcon||O.createElement(o.TimesIcon,k),J({},k),{props:e}),w=n({className:i("header")},u("header")),C=n({type:"button",className:i("closeButton"),"aria-label":t.localeOption("close"),onClick:e.onClose},u("closeButton")),N=O.createElement("button",C,j,O.createElement(h.Ripple,null)),P=O.createElement("div",w,E,d,N);return e.template?s.ObjectUtils.getJSXElement(e.template,{className:"p-multiselect-header",checkboxElement:E,checked:e.selectAll,onChange:f,filterElement:d,closeElement:N,closeElementClassName:"p-multiselect-close p-link",closeIconClassName:"p-multiselect-close-icon",onCloseClick:e.onClose,element:P,itemCheckboxIcon:S,props:e}):P}));function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}_.displayName="MultiSelectHeader";var z=O.memo((function(e){var t=T(O.useState(!1),2),n=t[0],r=t[1],i=O.useRef(null),o=l.useMergeProps(),a=e.ptm,c=e.cx,u=e.isUnstyled,p=function(t){return a(t,{hostName:e.hostName,context:{selected:e.selected,disabled:e.disabled,focused:n,focusedIndex:e.focusedIndex,index:e.index}})},f=o({className:c("checkboxIcon")},p("checkbox.icon")),d=e.selected?s.IconUtils.getJSXIcon(e.checkboxIcon||O.createElement(m.CheckIcon,f),B({},f),{selected:e.selected}):null,b=e.template?s.ObjectUtils.getJSXElement(e.template,e.option):e.label,v=e.disabled?-1:e.tabIndex,y=o({className:c("checkboxContainer")},p("checkboxContainer")),g=o({className:s.classNames(e.className,e.option.className,c("item",{itemProps:e})),style:e.style,onClick:function(t){e.onClick&&e.onClick(t,e.option),t.preventDefault(),t.stopPropagation()},onFocus:function(e){var t;r(!0),null==i||null===(t=i.current)||void 0===t||t.getInput().focus()},onBlur:function(e){r(!1)},onMouseMove:function(t){return null==e?void 0:e.onMouseMove(t,e.index)},tabIndex:v,role:"option","aria-selected":e.selected,"data-p-highlight":e.selected,"data-p-disabled":e.disabled},p("item"));return O.createElement("li",g,O.createElement("div",y,O.createElement(G,{ref:i,checked:e.selected,icon:d,pt:a("checkbox"),unstyled:u()})),O.createElement("span",null,b),O.createElement(h.Ripple,null))}));function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}z.displayName="MultiSelectItem";var Y=O.memo(O.forwardRef((function(e,n){var r=O.useRef(null),i=O.useRef(null),o=l.useMergeProps(),a=O.useContext(t.PrimeReactContext),c=e.ptm,u=e.cx,m=e.sx,b=e.isUnstyled,v=function(t,n){return c(t,W({hostName:e.hostName},n))},h=function(){e.onEnter((function(){if(r.current){var t=e.getSelectedOptionIndex();-1!==t&&setTimeout((function(){return r.current.scrollToIndex(t)}),0)}}))},y=function(){e.onEntered((function(){e.filter&&e.filterInputAutoFocus&&i.current&&s.DomHandler.focus(i.current,!1)}))},g=function(t){r.current&&r.current.scrollToIndex(0),e.onFilterInputChange&&e.onFilterInputChange(t)},x=function(){if(e.panelFooterTemplate){var t=s.ObjectUtils.getJSXElement(e.panelFooterTemplate,e,e.onOverlayHide);return O.createElement("div",{className:"p-multiselect-footer"},t)}return null},S=function(t,n){var l;e.focusOnHover&&(null==e||null===(l=e.changeFocusedOptionIndex)||void 0===l||l.call(e,t,n))},E=function(t,n){return e.getOptionGroupChildren(t).map((function(t,l){var r=e.getOptionLabel(t),i=l+"_"+e.getOptionRenderKey(t),o=e.isOptionDisabled(t),a=o?null:e.tabIndex||0,s=e.isSelected(t);return O.createElement(z,{hostName:e.hostName,index:l,key:i,focusedOptionIndex:e.focusedOptionIndex,label:r,option:t,style:n,template:e.itemTemplate,selected:s,onClick:e.onOptionSelect,onMouseMove:S,tabIndex:a,disabled:o,className:e.itemClassName,checkboxIcon:e.checkboxIcon,isUnstyled:b,ptm:c,cx:u})}))},k=function(){var n=s.ObjectUtils.getJSXElement(e.emptyFilterMessage,e)||t.localeOption("emptyFilterMessage"),l=o({className:u("emptyMessage")},v("emptyMessage"));return O.createElement("li",l,n)},j=function(t,n){var l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={height:l.props?l.props.itemSize:void 0};if(e.optionGroupLabel){var i=e.optionGroupTemplate?s.ObjectUtils.getJSXElement(e.optionGroupTemplate,t,n):e.getOptionGroupLabel(t),a=E(t,r),p=n+"_"+e.getOptionGroupRenderKey(t),f=o({className:u("itemGroup"),style:m("itemGroup",{scrollerOptions:l})},v("itemGroup"));return O.createElement(O.Fragment,{key:p},O.createElement("li",f,i),a)}var d=e.getOptionLabel(t),h=n+"_"+e.getOptionRenderKey(t),y=e.isOptionDisabled(t),g=y?null:e.tabIndex||0,x=e.isSelected(t);return O.createElement(z,{hostName:e.hostName,key:h,focusedOptionIndex:e.focusedOptionIndex,label:d,option:t,style:r,index:n,template:e.itemTemplate,selected:x,onClick:e.onOptionSelect,onMouseMove:S,tabIndex:g,disabled:y,className:e.itemClassName,checkboxIcon:e.checkboxIcon,isUnstyled:b,ptm:c,cx:u})},w=function(){if(e.virtualScrollerOptions){var n=W(W({},e.virtualScrollerOptions),{style:W(W({},e.virtualScrollerOptions.style),{height:e.scrollHeight}),className:s.classNames("p-multiselect-items-wrapper",e.virtualScrollerOptions.className),items:e.visibleOptions,autoSize:!0,onLazyLoad:function(t){return e.virtualScrollerOptions.onLazyLoad(W(W({},t),{filter:e.filterValue}))},itemTemplate:function(e,t){return e&&j(e,t.index,t)},contentTemplate:function(t){var n=e.visibleOptions&&e.visibleOptions.length||!e.hasFilter?t.children:k(),l=o({ref:t.contentRef,style:t.style,className:s.classNames(t.className,u("list",{virtualScrollerProps:e.virtualScrollerOptions})),role:"listbox","aria-multiselectable":!0},v("list"));return O.createElement("ul",l,n)}});return O.createElement(d.VirtualScroller,I({ref:r},n,{pt:c("virtualScroller"),__parentMetadata:{parent:e.metaData}}))}var l,i,a=s.ObjectUtils.isNotEmpty(e.visibleOptions)?e.visibleOptions.map(j):e.hasFilter?k():(l=s.ObjectUtils.getJSXElement(e.emptyMessage,e)||t.localeOption("emptyMessage"),i=o({className:u("emptyMessage")},v("emptyMessage")),O.createElement("li",i,l)),p=o({className:u("wrapper"),style:{maxHeight:e.scrollHeight}},v("wrapper")),f=o({className:u("list"),role:"listbox","aria-multiselectable":!0},v("list"));return O.createElement("div",p,O.createElement("ul",f,a))},C=function(){var t=e.allowOptionSelect(),l=O.createElement(_,{hostName:e.hostName,id:e.id,filter:e.filter,filterRef:i,filterValue:e.filterValue,filterTemplate:e.filterTemplate,visibleOptions:e.visibleOptions,isValidOption:e.isValidOption,getOptionValue:e.getOptionValue,updateModel:e.updateModel,onFilter:g,filterPlaceholder:e.filterPlaceholder,onClose:e.onCloseClick,showSelectAll:e.showSelectAll,selectAll:e.isAllSelected(),selectAllLabel:e.selectAllLabel,onSelectAll:e.onSelectAll,template:e.panelHeaderTemplate,resetFilter:e.resetFilter,closeIcon:e.closeIcon,filterIcon:e.filterIcon,itemCheckboxIcon:e.itemCheckboxIcon,ptm:c,cx:u,isUnstyled:b,metaData:e.metaData}),r=w(),f=x(),d=o({className:s.classNames(e.panelClassName,u("panel",{panelProps:e,context:a,allowOptionSelect:t})),style:e.panelStyle,onClick:e.onClick},v("panel"));if(e.inline)return O.createElement("div",I({ref:n},d),r,f);var m=o({classNames:u("transition"),in:e.in,timeout:{enter:120,exit:100},options:e.transitionOptions,unmountOnExit:!0,onEnter:h,onEntered:y,onExit:e.onExit,onExited:e.onExited},v("transition")),S=o({ref:e.firstHiddenFocusableElementOnOverlay,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onFirstHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},c("hiddenFirstFocusableEl")),E=o({ref:e.lastHiddenFocusableElementOnOverlay,role:"presentation","aria-hidden":"true",className:"p-hidden-accessible p-hidden-focusable",tabIndex:"0",onFocus:e.onLastHiddenFocus,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0},c("hiddenLastFocusableEl"));return O.createElement(p.CSSTransition,I({nodeRef:n},m),O.createElement("div",I({ref:n},d),O.createElement("span",S),l,r,f,O.createElement("span",E)))}();return e.inline?C:O.createElement(f.Portal,{element:C,appendTo:e.appendTo})})));function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,l)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ee(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=te(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var l=0,r=function(){};return{s:r,n:function(){return l>=e.length?{done:!0}:{done:!1,value:e[l++]}},e:function(e){throw e},f:r}}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,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function te(e,t){if(e){if("string"==typeof e)return ne(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)?ne(e,t):void 0}}function ne(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}Y.displayName="MultiSelectPanel";var le=O.memo(O.forwardRef((function(e,p){var f=l.useMergeProps(),d=O.useContext(t.PrimeReactContext),m=H.getProps(e,d),b=T(O.useState(null),2),v=b[0],h=b[1],y=T(O.useState(!1),2),g=y[0],S=y[1],E=T(O.useState(""),2),k=E[0],w=E[1],C=T(O.useState(-1),2),N=C[0],P=C[1],D=T(O.useState(!1),2),L=D[0],M=D[1],A=T(O.useState(m.inline),2),R=A[0],V=A[1],q=O.useRef(null),G=O.useRef(null),K=O.useRef(null),J=O.useRef(null),_=O.useRef(null),X=O.useRef(m.inputRef),B=O.useRef(null),z=O.useRef(null),Z=k&&k.trim().length>0,W=s.ObjectUtils.isEmpty(m.value),$=m.optionValue?null:m.dataKey,te={props:m,state:{filterState:k,focused:L,overlayVisible:R}},ne=H.setMetaData(te),le=ne.ptm,re=ne.cx,ie=ne.sx,oe=ne.isUnstyled;n.useHandleStyle(H.css.styles,oe,{name:"multiselect"});var ae=T(l.useOverlayListener({target:q,overlay:z,listener:function(e,t){t.valid&&("outside"===t.type?!Pe(e)&&!De(e)&&Ce():Ce())},when:R}),2),ce=ae[0],ue=ae[1],se=function(){return!m.selectionLimit||!m.value||m.value&&m.value.length<m.selectionLimit},pe=function(e){var t=Ke()&&e<ut.length-1?ut.slice(e+1).findIndex((function(e){return Be(e)})):-1;return t>-1?t+e+1:-1},fe=function(e){var t=Ke()&&e>0?s.ObjectUtils.findLastIndex(ut.slice(0,e),(function(e){return Be(e)})):-1;return t>-1?t:-1},de=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=-1;return Ke()&&(n=t?-1===(n=fe(e))?pe(e):n:-1===(n=pe(e))?fe(e):n),n>-1?n:e},me=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(-1===t&&(t=de(n,!0)),-1===n&&(n=de(t)),-1!==t&&-1!==n){var l=Math.min(t,n),r=Math.max(t,n),i=ut.slice(l,r+1).filter((function(e){return Xe(e)})).map((function(e){return He(e)}));Ee(e,i,i)}},be=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;if(!m.disabled&&!Ve(t)){var l=null;l=Le(t)?m.value.filter((function(e){return!s.ObjectUtils.equals(e,He(t),$)})):[].concat(F(m.value||[]),[He(t)]),Ee(e,l,t),-1!==n&&h(n)}},ve=function(e){if(R){var t=-1!==v?Qe(v):g?Ye():Ze();e.shiftKey&&me(e,N,t),nt(e,t)}else we(),m.editable&&nt(e,ze());e.preventDefault()},he=function(e){if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==v&&be(e,ut[v]),R&&Ce(),e.preventDefault();else{var t=-1!==v?et(v):g?$e():We();nt(e,t),!R&&we(),e.preventDefault()}},ye=function(e){R?-1!==v&&(e.shiftKey?me(e,v):be(e,ut[v])):(h(-1),ve(e)),e.preventDefault()},ge=function(e){var t=e.currentTarget;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){t.setSelectionRange(0,e.shiftKey?t.value.length:0),h(-1)}else{var n=e.metaKey||e.ctrlKey,l=Ye();e.shiftKey&&n&&me(e,l,N),nt(e,l),!R&&we()}e.preventDefault()},Oe=function(e){var t=e.currentTarget;if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var n=t.value.length;t.setSelectionRange(e.shiftKey?0:n,n),U("focusedOptionIndex")}else{var l=e.metaKey||e.ctrlKey,r=$e();e.shiftKey&&l&&me(e,N,r),nt(e,r),!R&&we()}e.preventDefault()},xe=function(e){e.preventDefault()},Ie=function(e){e.preventDefault()},Se=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(R&&Je()?(s.DomHandler.focus(e.shiftKey?_.current:J.current),e.preventDefault()):(-1!==v&&be(e,ut[v]),R&&Ce(filter)))},Ee=function(e,t,n){m.onChange&&m.onChange({originalEvent:e,value:t,selectedOption:n,stopPropagation:function(){null==e||e.stopPropagation()},preventDefault:function(){null==e||e.preventDefault()},target:{name:m.name,id:m.id,value:t}})},ke=function(){w(""),m.onFilter&&m.onFilter({filter:""})},je=function(e){var t;R&&((t=e?e.currentTarget:s.DomHandler.findSingle(z.current,'li[data-p-highlight="true"]'))&&t.scrollIntoView&&t.scrollIntoView({block:"nearest",inline:"nearest"}))},we=function(){V(!0),h(-1!==v?v:m.autoOptionFocus?Ze():ze()),s.DomHandler.focus(X.current)},Ce=function(){h(-1),V(!1),S(!1)},Ne=function(){s.DomHandler.alignOverlay(z.current,B.current.parentElement,m.appendTo||d&&d.appendTo||x.default.appendTo)},Pe=function(e){return"clearicon"===s.DomHandler.getAttribute(e.target,"data-pc-section")},De=function(e){return"headercheckboxcontainer"===s.DomHandler.getAttribute(e.target,"data-pc-section")},Fe=function(e){return z.current&&z.current.contains(e.target)},Ue=function(e,t){return t.findIndex((function(t){return e.some((function(e){return s.ObjectUtils.equals(e,He(t),$)}))}))},Le=function(e){if(m.value){var t=He(e),n=qe(e);return m.value.some((function(e){return s.ObjectUtils.equals(n?e:He(e),t,$)}))}return!1},Me=function(e){var t;if(m.options)if(m.optionGroupLabel){var n,l=ee(m.options);try{for(l.s();!(n=l.n()).done;){if(t=Ae(e,Re(n.value)))break}}catch(e){l.e(e)}finally{l.f()}}else t=Ae(e,m.options),s.ObjectUtils.isEmpty(t)&&(t=Ae(e,m.value));return t?Te(t):null},Ae=function(e,t){return t.find((function(t){return s.ObjectUtils.equals(He(t),e,$)}))},Te=function(e){return m.optionLabel?s.ObjectUtils.resolveFieldData(e,m.optionLabel):e&&void 0!==e.label?e.label:e},He=function(e){if(m.useOptionAsValue)return e;if(m.optionValue){var t=s.ObjectUtils.resolveFieldData(e,m.optionValue);return null!==t?t:e}return e&&void 0!==e.value?e.value:e},Re=function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupChildren)},Ve=function(e){var t;if(!se()&&!Le(e))return!0;var n=m.optionDisabled;return n?s.ObjectUtils.isFunction(n)?n(e):s.ObjectUtils.resolveFieldData(e,n):e&&null!==(t=e.disabled)&&void 0!==t&&t},qe=function(e){return!m.useOptionAsValue&&m.optionValue||e&&void 0!==e.value},Ge=function(e){return m.optionGroupLabel&&e.optionGroup&&e.group},Ke=function(){return s.ObjectUtils.isNotEmpty(m.value)},Je=function(){return s.DomHandler.getFocusableElements(z.current,':not([data-p-hidden-focusable="true"])').length>0},_e=function(e){var t;return Xe(e)&&(null===(t=Te(e))||void 0===t?void 0:t.toLocaleLowerCase(m.filterLocale).startsWith(G.current.toLocaleLowerCase(m.filterLocale)))},Xe=function(e){return s.ObjectUtils.isNotEmpty(e)&&!(Ve(e)||Ge(e))},Be=function(e){return Xe(e)&&Le(e)},ze=function(){if(Ke())for(var e,t=function(){var e=m.value[n],t=ut.findIndex((function(t){return Be(t)&&(n=e,l=He(t),s.ObjectUtils.equals(n,l,$));var n,l}));if(t>-1)return{v:t}},n=m.value.length-1;n>=0;n--)if(e=t())return e.v;return-1},Ze=function(){var e=ze();return e<0?Ye():e},We=function(){var e=ze();return e<0?$e():e},Ye=function(){return ut.findIndex((function(e){return Xe(e)}))},$e=function(){return s.ObjectUtils.findLastIndex(ut,(function(e){return Xe(e)}))},Qe=function(e){var t=e<ut.length-1?ut.slice(e+1).findIndex((function(e){return Xe(e)})):-1;return t>-1?t+e+1:e},et=function(e){var t=e>0?s.ObjectUtils.findLastIndex(ut.slice(0,e),(function(e){return Xe(e)})):-1;return t>-1?t:e},tt=function(e){G.current=(G.current||"")+e.key;var t=-1;s.ObjectUtils.isNotEmpty(G.current)&&(-1===(t=-1!==v?-1===(t=ut.slice(v).findIndex((function(e){return _e(e)})))?ut.slice(0,v).findIndex((function(e){return _e(e)})):t+v:ut.findIndex((function(e){return _e(e)})))&&-1===v&&(t=Ze()),-1!==t&&nt(e,t)),K.current&&clearTimeout(K.current),K.current=setTimeout((function(){G.current="",K.current=null}),500)},nt=function(e,t){v!==t&&(h(t),je(e),m.selectOnFocus&&be(e,ut[t],!1))},lt=function(e,t){e.stopPropagation();var n=m.value.filter((function(e){return!s.ObjectUtils.equals(e,t,$)}));m.onRemove&&m.onRemove({originalEvent:e,value:n}),Ee(e,n,t)},rt=function(){var e=/{(.*?)}/,n=m.selectedItemsLabel||t.localeOption("selectionMessage");return e.test(n)?n.replace(n.match(e)[0],m.value.length+""):n},it=function(){if(!W&&!m.fixedPlaceholder)return s.ObjectUtils.isNotEmpty(m.maxSelectedLabels)&&m.value.length>m.maxSelectedLabels?rt():s.ObjectUtils.isArray(m.value)?m.value.reduce((function(e,t,n){return e+(0!==n?", ":"")+Me(t)}),""):""};O.useImperativeHandle(p,(function(){return{props:m,show:we,hide:Ce,focus:function(){return s.DomHandler.focus(X.current)},getElement:function(){return q.current},getOverlay:function(){return z.current},getInput:function(){return X.current}}})),l.useMountEffect((function(){Ne()})),O.useEffect((function(){s.ObjectUtils.combinedRefs(X,m.inputRef)}),[X,m.inputRef]),O.useEffect((function(){setTimeout((function(){m.overlayVisible?we():Ce()}),100)}),[m.overlayVisible]),l.useUpdateEffect((function(){R&&k&&Z&&Ne()}),[R,k,Z]),l.useUnmountEffect((function(){s.ZIndexUtils.clear(z.current)}));var ot,at,ct,ut=function(){if(Z){var e=k.trim().toLocaleLowerCase(m.filterLocale),n=m.filterBy?m.filterBy.split(","):[m.optionLabel||"label"];if(m.optionGroupLabel){var l,r=[],i=ee(m.options);try{for(i.s();!(l=i.n()).done;){var o=l.value,a=t.FilterService.filter(Re(o),n,e,m.filterMatchMode,m.filterLocale);a&&a.length&&r.push(Q(Q({},o),j({},m.optionGroupChildren,a)))}}catch(e){i.e(e)}finally{i.f()}return r}return t.FilterService.filter(m.options,n,e,m.filterMatchMode,m.filterLocale)}return m.options}(),st=s.ObjectUtils.isNotEmpty(m.tooltip),pt=H.getOtherProps(m),ft=s.ObjectUtils.reduceKeys(pt,s.DomHandler.ARIA_PROPS),dt=f({className:re("triggerIcon")},le("triggerIcon")),mt=f({className:re("trigger")},le("trigger")),bt=m.loadingIcon?s.IconUtils.getJSXIcon(m.loadingIcon,Q({},dt),{props:m}):O.createElement(i.SpinnerIcon,I({spin:!0},dt)),vt=m.dropdownIcon?s.IconUtils.getJSXIcon(m.dropdownIcon,Q({},dt),{props:m}):O.createElement(r.ChevronDownIcon,dt),ht=O.createElement("div",mt,m.loading?bt:vt),yt=!m.inline&&(ot=m.selectedItemTemplate?W?s.ObjectUtils.getJSXElement(m.selectedItemTemplate):s.ObjectUtils.isNotEmpty(m.maxSelectedLabels)&&m.value.length>m.maxSelectedLabels?rt():m.value.map((function(e,t){var n=s.ObjectUtils.getJSXElement(m.selectedItemTemplate,e);return O.createElement(O.Fragment,{key:t},n)})):"chip"!==m.display||W?it():m.value.slice(0,m.maxSelectedLabels||m.value.length).map((function(e,t){var n={context:{value:e,index:t}},l=Me(e),r=l+"_"+t,i=f({key:t,className:re("removeTokenIcon"),onClick:function(t){return lt(t,e)}},le("removeTokenIcon",n)),o=!m.disabled&&(m.removeIcon?s.IconUtils.getJSXIcon(m.removeIcon,Q({},i),{props:m}):O.createElement(a.TimesCircleIcon,i)),c=f({className:re("token")},le("token",n)),u=f({className:re("tokenLabel")},le("tokenLabel",n));return O.createElement("div",I({},c,{key:r}),O.createElement("span",u,l),o)})),at=f({ref:B,className:re("labelContainer")},le("labelContainer")),ct=f({className:re("label",{empty:W})},le("label")),O.createElement("div",at,O.createElement("div",ct,ot||m.placeholder||m.emptyMessage||"empty"))),gt=!m.inline&&function(){var e=f({className:re("clearIcon"),onClick:function(e){return Ee(e,[],[])}},le("clearIcon")),t=s.IconUtils.getJSXIcon(m.clearIcon||O.createElement(o.TimesIcon,e),Q({},e),{props:m});return W||!m.showClear||m.disabled?null:t}(),Ot=f(Q(Q({ref:q,id:m.id,style:Q(Q({},m.style),ie("root")),className:s.classNames(m.className,re("root",{focusedState:L,context:d,overlayVisibleState:R}))},pt),{},{onClick:function(e){m.inline||m.disabled||m.loading||Fe(e)||Pe(e)||(R?Ce():we(),s.DomHandler.focus(X.current),e.preventDefault()),S(!0)}}),H.getOtherProps(m),le("root")),xt=f({className:"p-hidden-accessible","data-p-hidden-accessible":!0},le("hiddenInputWrapper")),It=f(Q({ref:X,id:m.inputId,name:m.name,type:"text",onFocus:function(e){M(!0),m.onFocus&&m.onFocus(e)},onBlur:function(e){M(!1),m.onBlur&&m.onBlur(e)},onKeyDown:function(e){var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowUp":if(m.inline)break;he(e);break;case"ArrowDown":if(m.inline)break;ve(e);break;case"Space":case"NumpadEnter":case"Enter":if(m.inline)break;ye(e);break;case"Home":if(m.inline)break;ge(e),e.preventDefault();break;case"End":if(m.inline)break;Oe(e),e.preventDefault();break;case"PageDown":Ie(e);break;case"PageUp":xe(e);break;case"Escape":if(m.inline)break;Ce();break;case"Tab":Se(e);break;case"ShiftLeft":case"ShiftRight":P(v);break;default:if("KeyA"===e.code&&t){var n=ut.filter((function(e){return Xe(e)})).map((function(e){return He(e)}));Ee(e,n,n),e.preventDefault();break}!t&&s.ObjectUtils.isPrintableCharacter(e.key)&&(!R&&we(),tt(e),e.preventDefault())}S(!1)},role:"combobox","aria-expanded":R,disabled:m.disabled,tabIndex:m.disabled?-1:m.tabIndex,value:JSON.stringify(m.value)},ft),le("input"));return O.createElement(O.Fragment,null,O.createElement("div",Ot,O.createElement("div",xt,O.createElement("input",I({},It,{readOnly:!0}))),!m.inline&&O.createElement(O.Fragment,null,yt,gt,ht),O.createElement(Y,I({hostName:"MultiSelect",ref:z,visibleOptions:ut},m,{onClick:function(e){c.OverlayService.emit("overlay-click",{originalEvent:e,target:q.current})},onOverlayHide:Ce,filterValue:k,focusedOptionIndex:v,onFirstHiddenFocus:function(e){var t=e.relatedTarget===X.current?s.DomHandler.getFirstFocusableElement(z.current,':not([data-p-hidden-focusable="true"])'):X.current;s.DomHandler.focus(t)},onLastHiddenFocus:function(e){var t=e.relatedTarget===X.current?s.DomHandler.getLastFocusableElement(z.current,':not([data-p-hidden-focusable="true"])'):X.current;s.DomHandler.focus(t)},firstHiddenFocusableElementOnOverlay:J,lastHiddenFocusableElementOnOverlay:_,setFocusedOptionIndex:h,hasFilter:Z,isValidOption:Xe,getOptionValue:He,updateModel:Ee,onFilterInputChange:function(e){var t=e.query;w(t),m.onFilter&&m.onFilter({originalEvent:e,filter:t})},resetFilter:ke,onCloseClick:function(e){Ce(),s.DomHandler.focus(X.current),e.preventDefault(),e.stopPropagation()},onSelectAll:function(e){if(m.onSelectAll)m.onSelectAll(e);else{var t=null;if(e.checked){if(t=[],ut){var n=ut.filter((function(e){return Ve(e)&&Le(e)}));t=n.map((function(e){return He(e)}))}}else if(ut){var l=ut.filter((function(e){return!Ve(e)||Le(e)}));m.optionGroupLabel?(t=[],l.forEach((function(e){return t=[].concat(F(t),F(Re(e).filter((function(e){return!Ve(e)})).map((function(e){return He(e)}))))}))):t=l.map((function(e){return He(e)}))}m.selectionLimit&&t&&t.length&&(t=t.slice(0,m.selectionLimit)),Ee(e.originalEvent,t,t)}},getOptionLabel:Te,getOptionRenderKey:function(e){return m.dataKey?s.ObjectUtils.resolveFieldData(e,m.dataKey):Te(e)},isOptionDisabled:Ve,getOptionGroupChildren:Re,getOptionGroupLabel:function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupLabel)},getOptionGroupRenderKey:function(e){return s.ObjectUtils.resolveFieldData(e,m.optionGroupLabel)},isSelected:Le,getSelectedOptionIndex:function(){if(null!=m.value&&m.options){if(m.optionGroupLabel){var e=0,t=m.options.findIndex((function(t,n){return(e=n)&&-1!==Ue(m.value,Re(t))}));return-1!==t?{group:e,option:t}:-1}return Ue(m.value,m.options)}return-1},isAllSelected:function(){if(m.onSelectAll)return m.selectAll;if(s.ObjectUtils.isEmpty(ut))return!1;var e=ut.filter((function(e){return!Ve(e)}));if(m.optionGroupLabel){var t,n=!0,l=ee(e);try{for(l.s();!(t=l.n()).done;){!0===Re(t.value).filter((function(e){return!Ve(e)})).some((function(e){return!Le(e)}))&&(n=!1)}}catch(e){l.e(e)}finally{l.f()}return n}return!e.some((function(e){return!Le(e)}))},onOptionSelect:be,allowOptionSelect:se,in:R,onEnter:function(e){s.ZIndexUtils.set("overlay",z.current,d&&d.autoZIndex||x.default.autoZIndex,d&&d.zIndex.overlay||x.default.zIndex.overlay),s.DomHandler.addStyles(z.current,{position:"absolute",top:"0",left:"0"}),Ne(),je(),e&&e()},onEntered:function(e){e&&e(),ce(),m.onShow&&m.onShow()},onExit:function(){ue()},onExited:function(){m.filter&&m.resetFilterOnHide&&ke(),s.ZIndexUtils.clear(z.current),m.onHide&&m.onHide()},ptm:le,cx:re,sx:ie,isUnstyled:oe,metaData:te,changeFocusedOptionIndex:nt}))),st&&O.createElement(u.Tooltip,I({target:q,content:m.tooltip,pt:le("tooltip")},m.tooltipOptions)))})));le.displayName="MultiSelect",exports.MultiSelect=le;
|
|
@@ -96,10 +96,6 @@ export interface MultiSelectPassThroughOptions {
|
|
|
96
96
|
* Uses to pass attributes to the header checkbox's container DOM element.
|
|
97
97
|
*/
|
|
98
98
|
headerCheckboxContainer?: MultiSelectPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
|
|
99
|
-
/**
|
|
100
|
-
* Uses to pass attributes to the header checkbox icon's DOM element.
|
|
101
|
-
*/
|
|
102
|
-
headerCheckboxIcon?: MultiSelectPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
|
|
103
99
|
/**
|
|
104
100
|
* Uses to pass attributes to the header checkbox's DOM element.
|
|
105
101
|
*/
|
|
@@ -152,11 +148,7 @@ export interface MultiSelectPassThroughOptions {
|
|
|
152
148
|
/**
|
|
153
149
|
* Uses to pass attributes to the checkbox's DOM element.
|
|
154
150
|
*/
|
|
155
|
-
checkbox?:
|
|
156
|
-
/**
|
|
157
|
-
* Uses to pass attributes to the checkbox icon's DOM element.
|
|
158
|
-
*/
|
|
159
|
-
checkboxIcon?: MultiSelectPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
|
|
151
|
+
checkbox?: CheckboxPassThroughOptions;
|
|
160
152
|
/**
|
|
161
153
|
* Uses to pass attributes to the emptyMessage's DOM element.
|
|
162
154
|
*/
|