primevue 3.15.0 → 3.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/AutoComplete.d.ts +182 -38
- package/autocomplete/AutoComplete.vue +636 -342
- package/autocomplete/autocomplete.cjs.js +745 -416
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +747 -418
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +745 -416
- package/autocomplete/autocomplete.min.js +1 -1
- package/button/Button.vue +4 -1
- package/button/button.cjs.js +5 -1
- package/button/button.cjs.min.js +1 -1
- package/button/button.esm.js +5 -1
- package/button/button.esm.min.js +1 -1
- package/button/button.js +5 -1
- package/button/button.min.js +1 -1
- package/calendar/Calendar.d.ts +51 -12
- package/calendar/Calendar.vue +259 -114
- package/calendar/calendar.cjs.js +414 -220
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +415 -221
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +414 -220
- package/calendar/calendar.min.js +1 -1
- package/carousel/Carousel.vue +25 -0
- package/carousel/carousel.cjs.js +25 -0
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +25 -0
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +25 -0
- package/carousel/carousel.min.js +1 -1
- package/cascadeselect/CascadeSelect.d.ts +97 -17
- package/cascadeselect/CascadeSelect.vue +560 -135
- package/cascadeselect/CascadeSelectSub.vue +48 -129
- package/cascadeselect/cascadeselect.cjs.js +670 -306
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +672 -308
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +670 -306
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/checkbox/Checkbox.d.ts +40 -4
- package/checkbox/Checkbox.vue +50 -13
- package/checkbox/checkbox.cjs.js +64 -23
- package/checkbox/checkbox.cjs.min.js +1 -1
- package/checkbox/checkbox.esm.js +65 -24
- package/checkbox/checkbox.esm.min.js +1 -1
- package/checkbox/checkbox.js +64 -23
- package/checkbox/checkbox.min.js +1 -1
- package/chips/Chips.d.ts +36 -12
- package/chips/Chips.vue +116 -22
- package/chips/chips.cjs.js +149 -37
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +150 -38
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +150 -39
- package/chips/chips.min.js +1 -1
- package/colorpicker/ColorPicker.d.ts +3 -6
- package/colorpicker/ColorPicker.vue +1 -5
- package/colorpicker/colorpicker.cjs.js +2 -7
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +2 -7
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +2 -7
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +4 -0
- package/column/Column.vue +4 -0
- package/column/column.cjs.js +4 -0
- package/column/column.cjs.min.js +1 -1
- package/column/column.esm.js +4 -0
- package/column/column.esm.min.js +1 -1
- package/column/column.js +4 -0
- package/column/column.min.js +1 -1
- package/config/PrimeVue.d.ts +42 -0
- package/config/config.cjs.js +35 -4
- package/config/config.cjs.min.js +1 -1
- package/config/config.esm.js +35 -4
- package/config/config.esm.min.js +1 -1
- package/config/config.js +35 -4
- package/config/config.min.js +1 -1
- package/confirmdialog/ConfirmDialog.vue +4 -1
- package/confirmdialog/confirmdialog.cjs.js +6 -2
- package/confirmdialog/confirmdialog.cjs.min.js +1 -1
- package/confirmdialog/confirmdialog.esm.js +6 -2
- package/confirmdialog/confirmdialog.esm.min.js +1 -1
- package/confirmdialog/confirmdialog.js +6 -2
- package/confirmdialog/confirmdialog.min.js +1 -1
- package/contextmenu/ContextMenu.d.ts +1 -1
- package/contextmenu/ContextMenuSub.vue +3 -3
- package/contextmenu/contextmenu.cjs.js +14 -8
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +15 -9
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +14 -8
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +1128 -772
- package/core/core.min.js +12 -12
- package/datatable/BodyCell.vue +11 -2
- package/datatable/DataTable.vue +23 -2
- package/datatable/datatable.cjs.js +34 -4
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +34 -4
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +34 -4
- package/datatable/datatable.min.js +1 -1
- package/dialog/Dialog.d.ts +5 -1
- package/dropdown/Dropdown.d.ts +92 -38
- package/dropdown/Dropdown.vue +538 -399
- package/dropdown/dropdown.cjs.js +657 -486
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +659 -488
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +657 -486
- package/dropdown/dropdown.min.js +1 -1
- package/editor/Editor.d.ts +32 -0
- package/editor/Editor.vue +15 -1
- package/editor/editor.cjs.js +15 -1
- package/editor/editor.cjs.min.js +1 -1
- package/editor/editor.esm.js +15 -1
- package/editor/editor.esm.min.js +1 -1
- package/editor/editor.js +15 -1
- package/editor/editor.min.js +1 -1
- package/inputmask/InputMask.vue +9 -6
- package/inputmask/inputmask.cjs.js +14 -6
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.esm.js +15 -7
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +14 -6
- package/inputmask/inputmask.min.js +1 -1
- package/inputnumber/InputNumber.d.ts +31 -7
- package/inputnumber/InputNumber.vue +53 -20
- package/inputnumber/inputnumber.cjs.js +75 -29
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +76 -30
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +75 -29
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/InputSwitch.d.ts +24 -8
- package/inputswitch/InputSwitch.vue +27 -12
- package/inputswitch/inputswitch.cjs.js +38 -20
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +39 -21
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +38 -20
- package/inputswitch/inputswitch.min.js +1 -1
- package/inputtext/InputText.vue +1 -2
- package/inputtext/inputtext.cjs.js +3 -4
- package/inputtext/inputtext.cjs.min.js +1 -1
- package/inputtext/inputtext.esm.js +4 -5
- package/inputtext/inputtext.esm.min.js +1 -1
- package/inputtext/inputtext.js +3 -4
- package/inputtext/inputtext.min.js +1 -1
- package/knob/Knob.d.ts +12 -0
- package/knob/Knob.vue +62 -2
- package/knob/knob.cjs.js +73 -5
- package/knob/knob.cjs.min.js +1 -1
- package/knob/knob.esm.js +73 -5
- package/knob/knob.esm.min.js +1 -1
- package/knob/knob.js +73 -5
- package/knob/knob.min.js +1 -1
- package/listbox/Listbox.d.ts +53 -7
- package/listbox/Listbox.vue +500 -135
- package/listbox/listbox.cjs.js +597 -193
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +599 -195
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +597 -193
- package/listbox/listbox.min.js +1 -1
- package/menu/Menu.d.ts +1 -1
- package/menu/Menuitem.vue +2 -2
- package/menu/menu.cjs.js +12 -6
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +13 -7
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +12 -6
- package/menu/menu.min.js +1 -1
- package/menubar/MenubarSub.vue +3 -3
- package/menubar/menubar.cjs.js +14 -8
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +15 -9
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +14 -8
- package/menubar/menubar.min.js +1 -1
- package/menuitem/MenuItem.d.ts +1 -1
- package/multiselect/MultiSelect.d.ts +111 -51
- package/multiselect/MultiSelect.vue +629 -338
- package/multiselect/multiselect.cjs.js +748 -428
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +750 -430
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +748 -428
- package/multiselect/multiselect.min.js +1 -1
- package/overlaypanel/OverlayPanel.d.ts +1 -1
- package/overlaypanel/OverlayPanel.vue +14 -2
- package/overlaypanel/overlaypanel.cjs.js +14 -2
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +14 -2
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +14 -2
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +2 -2
- package/paginator/Paginator.d.ts +2 -2
- package/password/Password.d.ts +36 -8
- package/password/Password.vue +50 -14
- package/password/password.cjs.js +69 -24
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +71 -26
- package/password/password.esm.min.js +1 -1
- package/password/password.js +69 -24
- package/password/password.min.js +1 -1
- package/picklist/PickList.d.ts +8 -0
- package/picklist/PickList.vue +10 -2
- package/picklist/picklist.cjs.js +68 -50
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +69 -51
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +68 -50
- package/picklist/picklist.min.js +1 -1
- package/portal/Portal.d.ts +1 -1
- package/radiobutton/RadioButton.d.ts +28 -4
- package/radiobutton/RadioButton.vue +36 -11
- package/radiobutton/radiobutton.cjs.js +49 -23
- package/radiobutton/radiobutton.cjs.min.js +1 -1
- package/radiobutton/radiobutton.esm.js +50 -24
- package/radiobutton/radiobutton.esm.min.js +1 -1
- package/radiobutton/radiobutton.js +49 -23
- package/radiobutton/radiobutton.min.js +1 -1
- package/rating/Rating.d.ts +4 -0
- package/rating/Rating.vue +61 -7
- package/rating/rating.cjs.js +90 -16
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +91 -17
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +90 -16
- package/rating/rating.min.js +1 -1
- package/resources/primevue.css +8 -0
- package/resources/primevue.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +82 -40
- package/resources/themes/arya-green/theme.css +82 -40
- package/resources/themes/arya-orange/theme.css +82 -40
- package/resources/themes/arya-purple/theme.css +82 -40
- package/resources/themes/bootstrap4-dark-blue/theme.css +82 -40
- package/resources/themes/bootstrap4-dark-purple/theme.css +82 -40
- package/resources/themes/bootstrap4-light-blue/theme.css +82 -40
- package/resources/themes/bootstrap4-light-purple/theme.css +82 -40
- package/resources/themes/fluent-light/theme.css +82 -40
- package/resources/themes/lara-dark-blue/theme.css +82 -40
- package/resources/themes/lara-dark-indigo/theme.css +82 -40
- package/resources/themes/lara-dark-purple/theme.css +82 -40
- package/resources/themes/lara-dark-teal/theme.css +82 -40
- package/resources/themes/lara-light-blue/theme.css +82 -40
- package/resources/themes/lara-light-indigo/theme.css +82 -40
- package/resources/themes/lara-light-purple/theme.css +82 -40
- package/resources/themes/lara-light-teal/theme.css +82 -40
- package/resources/themes/luna-amber/theme.css +82 -40
- package/resources/themes/luna-blue/theme.css +82 -40
- package/resources/themes/luna-green/theme.css +82 -40
- package/resources/themes/luna-pink/theme.css +82 -40
- package/resources/themes/md-dark-deeppurple/theme.css +82 -40
- package/resources/themes/md-dark-indigo/theme.css +82 -40
- package/resources/themes/md-light-deeppurple/theme.css +82 -40
- package/resources/themes/md-light-indigo/theme.css +82 -40
- package/resources/themes/mdc-dark-deeppurple/theme.css +82 -40
- package/resources/themes/mdc-dark-indigo/theme.css +82 -40
- package/resources/themes/mdc-light-deeppurple/theme.css +82 -40
- package/resources/themes/mdc-light-indigo/theme.css +82 -40
- package/resources/themes/nova/theme.css +82 -40
- package/resources/themes/nova-accent/theme.css +82 -40
- package/resources/themes/nova-alt/theme.css +82 -40
- package/resources/themes/nova-vue/theme.css +82 -40
- package/resources/themes/rhea/theme.css +82 -40
- package/resources/themes/saga-blue/theme.css +82 -40
- package/resources/themes/saga-green/theme.css +82 -40
- package/resources/themes/saga-orange/theme.css +82 -40
- package/resources/themes/saga-purple/theme.css +82 -40
- package/resources/themes/tailwind-light/theme.css +82 -40
- package/resources/themes/vela-blue/theme.css +82 -40
- package/resources/themes/vela-green/theme.css +82 -40
- package/resources/themes/vela-orange/theme.css +82 -40
- package/resources/themes/vela-purple/theme.css +82 -40
- package/ripple/ripple.cjs.js +1 -0
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +1 -0
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -0
- package/ripple/ripple.min.js +1 -1
- package/selectbutton/SelectButton.d.ts +6 -2
- package/selectbutton/SelectButton.vue +89 -12
- package/selectbutton/selectbutton.cjs.js +97 -22
- package/selectbutton/selectbutton.cjs.min.js +1 -1
- package/selectbutton/selectbutton.esm.js +99 -24
- package/selectbutton/selectbutton.esm.min.js +1 -1
- package/selectbutton/selectbutton.js +97 -22
- package/selectbutton/selectbutton.min.js +1 -1
- package/slider/Slider.d.ts +9 -1
- package/slider/Slider.vue +50 -34
- package/slider/slider.cjs.js +59 -38
- package/slider/slider.cjs.min.js +1 -1
- package/slider/slider.esm.js +59 -38
- package/slider/slider.esm.min.js +1 -1
- package/slider/slider.js +59 -38
- package/slider/slider.min.js +1 -1
- package/splitbutton/SplitButton.d.ts +1 -1
- package/splitter/Splitter.vue +30 -1
- package/splitter/splitter.cjs.js +30 -1
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +30 -1
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +30 -1
- package/splitter/splitter.min.js +1 -1
- package/textarea/Textarea.vue +1 -2
- package/textarea/textarea.cjs.js +3 -5
- package/textarea/textarea.cjs.min.js +1 -1
- package/textarea/textarea.esm.js +4 -6
- package/textarea/textarea.esm.min.js +1 -1
- package/textarea/textarea.js +3 -5
- package/textarea/textarea.min.js +1 -1
- package/tieredmenu/TieredMenu.d.ts +1 -1
- package/tieredmenu/TieredMenuSub.vue +3 -3
- package/tieredmenu/tieredmenu.cjs.js +14 -8
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +15 -9
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +14 -8
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/timeline/Timeline.d.ts +10 -1
- package/timeline/Timeline.vue +1 -1
- package/timeline/timeline.cjs.js +5 -1
- package/timeline/timeline.cjs.min.js +1 -1
- package/timeline/timeline.esm.js +5 -1
- package/timeline/timeline.esm.min.js +1 -1
- package/timeline/timeline.js +5 -1
- package/timeline/timeline.min.js +1 -1
- package/togglebutton/ToggleButton.d.ts +42 -0
- package/togglebutton/ToggleButton.vue +44 -7
- package/togglebutton/togglebutton.cjs.js +59 -13
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.esm.js +60 -14
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +59 -13
- package/togglebutton/togglebutton.min.js +1 -1
- package/tooltip/tooltip.cjs.js +20 -11
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +21 -12
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +20 -11
- package/tooltip/tooltip.min.js +1 -1
- package/tree/Tree.vue +5 -1
- package/tree/TreeNode.vue +20 -19
- package/tree/tree.cjs.js +47 -32
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +47 -32
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +47 -32
- package/tree/tree.min.js +1 -1
- package/treeselect/TreeSelect.d.ts +26 -10
- package/treeselect/TreeSelect.vue +52 -29
- package/treeselect/treeselect.cjs.js +74 -41
- package/treeselect/treeselect.cjs.min.js +1 -1
- package/treeselect/treeselect.esm.js +76 -43
- package/treeselect/treeselect.esm.min.js +1 -1
- package/treeselect/treeselect.js +74 -41
- package/treeselect/treeselect.min.js +1 -1
- package/tristatecheckbox/TriStateCheckbox.d.ts +20 -4
- package/tristatecheckbox/TriStateCheckbox.vue +52 -15
- package/tristatecheckbox/tristatecheckbox.cjs.js +67 -26
- package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +68 -27
- package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
- package/tristatecheckbox/tristatecheckbox.js +67 -26
- package/tristatecheckbox/tristatecheckbox.min.js +1 -1
- package/utils/Utils.d.ts +3 -2
- package/utils/utils.cjs.js +239 -173
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +239 -173
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +239 -173
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +612 -136
- package/vetur-tags.json +180 -59
- package/virtualscroller/VirtualScroller.d.ts +10 -0
- package/virtualscroller/VirtualScroller.vue +18 -17
- package/virtualscroller/virtualscroller.cjs.js +22 -20
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +22 -20
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +22 -20
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +1745 -338
package/listbox/listbox.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.listbox=function(e,t,l,i,o){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=n(l),r=n(i),a={name:"Listbox",emits:["update:modelValue","change","filter"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:Boolean,dataKey:null,multiple:Boolean,metaKeySelection:Boolean,filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},virtualScrollerOptions:{type:Object,default:null}},optionTouched:!1,virtualScroller:null,data:()=>({filterValue:null}),methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},onOptionSelect(e,t){this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1)},onOptionTouchEnd(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle(e,t){let l=this.isSelected(t),i=!1,o=null;if(!this.optionTouched&&this.metaKeySelection){let n=e.metaKey||e.ctrlKey;l?n&&(o=null,i=!0):(o=this.getOptionValue(t),i=!0)}else o=l?null:this.getOptionValue(t),i=!0;i&&this.updateModel(e,o)},onOptionSelectMultiple(e,t){let l=this.isSelected(t),i=!1,o=null;if(!this.optionTouched&&this.metaKeySelection){let n=e.metaKey||e.ctrlKey;l?(o=n?this.removeOption(t):[this.getOptionValue(t)],i=!0):(o=n&&this.modelValue||[],o=[...o,this.getOptionValue(t)],i=!0)}else o=l?this.removeOption(t):[...this.modelValue||[],this.getOptionValue(t)],i=!0;i&&this.updateModel(e,o)},isSelected(t){let l=!1,i=this.getOptionValue(t);if(this.multiple){if(this.modelValue)for(let t of this.modelValue)if(e.ObjectUtils.equals(t,i,this.equalityKey)){l=!0;break}}else l=e.ObjectUtils.equals(this.modelValue,i,this.equalityKey);return l},removeOption(t){return this.modelValue.filter((l=>!e.ObjectUtils.equals(l,this.getOptionValue(t),this.equalityKey)))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},onOptionKeyDown(e,t){let l=e.currentTarget;switch(e.which){case 40:var i=this.findNextItem(l);i&&i.focus(),e.preventDefault();break;case 38:var o=this.findPrevItem(l);o&&o.focus(),e.preventDefault();break;case 13:this.onOptionSelect(e,t),e.preventDefault()}},findNextItem(t){let l=t.nextElementSibling;return l?e.DomHandler.hasClass(l,"p-disabled")||e.DomHandler.hasClass(l,"p-listbox-item-group")?this.findNextItem(l):l:null},findPrevItem(t){let l=t.previousElementSibling;return l?e.DomHandler.hasClass(l,"p-disabled")||e.DomHandler.hasClass(l,"p-listbox-item-group")?this.findPrevItem(l):l:null},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},virtualScrollerRef(e){this.virtualScroller=e}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let l of this.options){let i=t.FilterService.filter(this.getOptionGroupChildren(l),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);i&&i.length&&e.push({...l,items:i})}return e}return t.FilterService.filter(this.options,this.searchFields,this.filterValue,"contains",this.filterLocale)}return this.options},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:s.default},components:{VirtualScroller:r.default}};const p={class:"p-listbox p-component"},d={key:0,class:"p-listbox-header"},u={class:"p-listbox-filter-container"},c=["placeholder"],h=o.createElementVNode("span",{class:"p-listbox-filter-icon pi pi-search"},null,-1),m=["tabindex","onClick","onKeydown","aria-label","aria-selected"],b={class:"p-listbox-item-group"},g=["tabindex","onClick","onKeydown","aria-label","aria-selected"],y={key:2,class:"p-listbox-empty-message"},f={key:3,class:"p-listbox-empty-message"};return function(e,t){void 0===t&&(t={});var l=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===l&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-listbox-list-wrapper {\n overflow: auto;\n}\n.p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n}\n.p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.p-listbox-item-group {\n cursor: auto;\n}\n.p-listbox-filter-container {\n position: relative;\n}\n.p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-listbox-filter {\n width: 100%;\n}\n"),a.render=function(e,t,l,i,n,s){const r=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createElementBlock("div",p,[o.renderSlot(e.$slots,"header",{value:l.modelValue,options:s.visibleOptions}),l.filter?(o.openBlock(),o.createElementBlock("div",d,[o.createElementVNode("div",u,[o.withDirectives(o.createElementVNode("input",{type:"text",class:"p-listbox-filter p-inputtext p-component","onUpdate:modelValue":t[0]||(t[0]=e=>n.filterValue=e),placeholder:l.filterPlaceholder,onInput:t[1]||(t[1]=(...e)=>s.onFilterChange&&s.onFilterChange(...e))},null,40,c),[[o.vModelText,n.filterValue]]),h])])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"p-listbox-list-wrapper",style:o.normalizeStyle(l.listStyle)},[o.createVNode(r,o.mergeProps({ref:s.virtualScrollerRef},l.virtualScrollerOptions,{style:l.listStyle,items:s.visibleOptions,disabled:s.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:i,contentRef:r,items:p,getItemOptions:d,contentStyle:u})=>[o.createElementVNode("ul",{ref:r,class:o.normalizeClass(["p-listbox-list",i]),style:o.normalizeStyle(u),role:"listbox","aria-multiselectable":"multiple"},[l.optionGroupLabel?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(p,((l,i)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:s.getOptionGroupRenderKey(l)},[o.createElementVNode("li",b,[o.renderSlot(e.$slots,"optiongroup",{option:l,index:s.getOptionIndex(i,d)},(()=>[o.createTextVNode(o.toDisplayString(s.getOptionGroupLabel(l)),1)]))]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.getOptionGroupChildren(l),((l,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("li",{tabindex:s.isOptionDisabled(l)?null:"0",class:o.normalizeClass(["p-listbox-item",{"p-highlight":s.isSelected(l),"p-disabled":s.isOptionDisabled(l)}]),key:s.getOptionRenderKey(l),onClick:e=>s.onOptionSelect(e,l),onTouchend:t[3]||(t[3]=e=>s.onOptionTouchEnd()),onKeydown:e=>s.onOptionKeyDown(e,l),role:"option","aria-label":s.getOptionLabel(l),"aria-selected":s.isSelected(l)},[o.renderSlot(e.$slots,"option",{option:l,index:s.getOptionIndex(i,d)},(()=>[o.createTextVNode(o.toDisplayString(s.getOptionLabel(l)),1)]))],42,g)),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(p,((l,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("li",{tabindex:s.isOptionDisabled(l)?null:"0",class:o.normalizeClass(["p-listbox-item",{"p-highlight":s.isSelected(l),"p-disabled":s.isOptionDisabled(l)}]),key:s.getOptionRenderKey(l),onClick:e=>s.onOptionSelect(e,l),onTouchend:t[2]||(t[2]=e=>s.onOptionTouchEnd()),onKeydown:e=>s.onOptionKeyDown(e,l),role:"option","aria-label":s.getOptionLabel(l),"aria-selected":s.isSelected(l)},[o.renderSlot(e.$slots,"option",{option:l,index:s.getOptionIndex(i,d)},(()=>[o.createTextVNode(o.toDisplayString(s.getOptionLabel(l)),1)]))],42,m)),[[a]]))),128)),n.filterValue&&(!p||p&&0===p.length)?(o.openBlock(),o.createElementBlock("li",y,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(s.emptyFilterMessageText),1)]))])):!l.options||l.options&&0===l.options.length?(o.openBlock(),o.createElementBlock("li",f,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(s.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],6)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["style","items","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:l.modelValue,options:s.visibleOptions})])},a}(primevue.utils,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.listbox=function(e,t,i,s,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(i),a=o(s),r={name:"Listbox",emits:["update:modelValue","change","focus","blur","filter"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,listStyle:null,disabled:Boolean,dataKey:null,multiple:Boolean,metaKeySelection:Boolean,filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},filterInputProps:null,virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},list:null,virtualScroller:null,optionTouched:!1,startRangeIndex:-1,searchTimeout:null,searchValue:"",selectOnFocus:!1,focusOnHover:!1,data:()=>({id:e.UniqueComponentId(),filterValue:null,focused:!1,focusedOptionIndex:-1}),watch:{options(){this.autoUpdateModel()}},mounted(){this.id=this.$attrs.id||this.id,this.autoUpdateModel()},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t,i){return(this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t))+"_"+i},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},onFirstHiddenFocus(){this.list.focus();const t=e.DomHandler.getFirstFocusableElement(this.$el,":not(.p-hidden-focusable)");this.$refs.lastHiddenFocusableElement.tabIndex=e.ObjectUtils.isEmpty(t)?-1:void 0,this.$refs.firstHiddenFocusableElement.tabIndex=-1},onLastHiddenFocus(t){if(t.relatedTarget===this.list){const t=e.DomHandler.getFirstFocusableElement(this.$el,":not(.p-hidden-focusable)");t&&t.focus(),this.$refs.firstHiddenFocusableElement.tabIndex=void 0}else this.$refs.firstHiddenFocusableElement.focus();this.$refs.lastHiddenFocusableElement.tabIndex=-1},onFocusout(e){!this.$el.contains(e.relatedTarget)&&this.$refs.lastHiddenFocusableElement&&this.$refs.firstHiddenFocusableElement&&(this.$refs.lastHiddenFocusableElement.tabIndex=this.$refs.firstHiddenFocusableElement.tabIndex=void 0)},onListFocus(e){this.focused=!0,this.focusedOptionIndex=this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.$emit("focus",e)},onListBlur(e){this.focused=!1,this.focusedOptionIndex=this.startRangeIndex=-1,this.searchValue="",this.$emit("blur",e)},onListKeyDown(t){switch(t.code){case"ArrowDown":this.onArrowDownKey(t);break;case"ArrowUp":this.onArrowUpKey(t);break;case"Home":this.onHomeKey(t);break;case"End":this.onEndKey(t);break;case"PageDown":this.onPageDownKey(t);break;case"PageUp":this.onPageUpKey(t);break;case"Enter":case"Space":this.onSpaceKey(t);break;case"Tab":break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(t);break;default:if("KeyA"===t.code&&this.multiple&&(t.metaKey||t.ctrlKey)){const e=this.visibleOptions.filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(t,e),t.preventDefault();break}e.ObjectUtils.isPrintableCharacter(t.key)&&(this.searchOptions(t,t.key),t.preventDefault())}},onOptionSelect(e,t,i=-1){this.disabled||this.isOptionDisabled(t)||(this.multiple?this.onOptionSelectMultiple(e,t):this.onOptionSelectSingle(e,t),this.optionTouched=!1,-1!==i&&(this.focusedOptionIndex=i))},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOptionTouchEnd(){this.disabled||(this.optionTouched=!0)},onOptionSelectSingle(e,t){let i=this.isSelected(t),s=!1,n=null;if(!this.optionTouched&&this.metaKeySelection){let o=e.metaKey||e.ctrlKey;i?o&&(n=null,s=!0):(n=this.getOptionValue(t),s=!0)}else n=i?null:this.getOptionValue(t),s=!0;s&&this.updateModel(e,n)},onOptionSelectMultiple(e,t){let i=this.isSelected(t),s=null;if(!this.optionTouched&&this.metaKeySelection){let n=e.metaKey||e.ctrlKey;i?s=n?this.removeOption(t):[this.getOptionValue(t)]:(s=n&&this.modelValue||[],s=[...s,this.getOptionValue(t)])}else s=i?this.removeOption(t):[...this.modelValue||[],this.getOptionValue(t)];this.updateModel(e,s)},onOptionSelectRange(e,t=-1,i=-1){if(-1===t&&(t=this.findNearestSelectedOptionIndex(i,!0)),-1===i&&(i=this.findNearestSelectedOptionIndex(t)),-1!==t&&-1!==i){const s=Math.min(t,i),n=Math.max(t,i),o=this.visibleOptions.slice(s,n+1).filter((e=>this.isValidOption(e))).map((e=>this.getOptionValue(e)));this.updateModel(e,o)}},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.focusedOptionIndex=this.startRangeIndex=-1},onFilterBlur(){this.focusedOptionIndex=this.startRangeIndex=-1},onFilterKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"ShiftLeft":case"ShiftRight":this.onShiftKey(e)}},onArrowDownKey(e){const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,this.startRangeIndex,t),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.multiple&&e.shiftKey&&this.onOptionSelectRange(e,t,this.startRangeIndex),this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowLeftKey(e,t=!1){t&&(this.focusedOptionIndex=-1)},onHomeKey(e,t=!1){if(t)e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1;else{let t=e.metaKey||e.ctrlKey,i=this.findFirstOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,i,this.startRangeIndex),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onEndKey(e,t=!1){if(t){const t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else{let t=e.metaKey||e.ctrlKey,i=this.findLastOptionIndex();this.multiple&&e.shiftKey&&t&&this.onOptionSelectRange(e,this.startRangeIndex,i),this.changeFocusedOptionIndex(e,i)}e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){-1!==this.focusedOptionIndex&&(this.multiple&&e.shiftKey?this.onOptionSelectRange(e,this.focusedOptionIndex):this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex])),e.preventDefault()},onSpaceKey(e){this.onEnterKey(e)},onShiftKey(){this.startRangeIndex=this.focusedOptionIndex},isOptionMatched(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(t){const i=this.getOptionValue(t);return this.multiple?(this.modelValue||[]).some((t=>e.ObjectUtils.equals(t,i,this.equalityKey))):e.ObjectUtils.equals(this.modelValue,i,this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return e.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(t){const i=t>0?e.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,t),(e=>this.isValidOption(e))):-1;return i>-1?i:t},findFirstSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findLastSelectedOptionIndex(){return this.hasSelectedOption?e.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidSelectedOption(e))):-1},findNextSelectedOptionIndex(e){const t=this.hasSelectedOption&&e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidSelectedOption(e))):-1;return t>-1?t+e+1:-1},findPrevSelectedOptionIndex(t){const i=this.hasSelectedOption&&t>0?e.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,t),(e=>this.isValidSelectedOption(e))):-1;return i>-1?i:-1},findNearestSelectedOptionIndex(e,t=!1){let i=-1;return this.hasSelectedOption&&(t?(i=this.findPrevSelectedOptionIndex(e),i=-1===i?this.findNextSelectedOptionIndex(e):i):(i=this.findNextSelectedOptionIndex(e),i=-1===i?this.findPrevSelectedOptionIndex(e):i)),i>-1?i:e},findFirstFocusedOptionIndex(){const e=this.findFirstSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findLastSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions(e,t){this.searchValue=(this.searchValue||"")+t;let i=-1;-1!==this.focusedOptionIndex?(i=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))),i=-1===i?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))):i+this.focusedOptionIndex):i=this.visibleOptions.findIndex((e=>this.isOptionMatched(e))),-1===i&&-1===this.focusedOptionIndex&&(i=this.findFirstFocusedOptionIndex()),-1!==i&&this.changeFocusedOptionIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500)},removeOption(t){return this.modelValue.filter((i=>!e.ObjectUtils.equals(i,this.getOptionValue(t),this.equalityKey)))},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&!this.multiple&&this.updateModel(e,this.getOptionValue(this.visibleOptions[t])))},scrollInView(t=-1){const i=-1!==t?`${this.id}_${t}`:this.focusedOptionId,s=e.DomHandler.findSingle(this.list,`li[id="${i}"]`);s?s.scrollIntoView&&s.scrollIntoView({block:"nearest",inline:"nearest"}):this.virtualScrollerDisabled||this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==t?t:this.focusedOptionIndex)},autoUpdateModel(){if(this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption){this.focusedOptionIndex=this.findFirstFocusedOptionIndex();const e=this.getOptionValue(this.visibleOptions[this.focusedOptionIndex]);this.updateModel(null,this.multiple?[e]:e)}},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const s=this.getOptionGroupChildren(t);return s&&s.forEach((t=>e.push(t))),e}),[])},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-listbox p-component",{"p-focus":this.focused,"p-disabled":this.disabled}]},visibleOptions(){const e=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];return this.filterValue?t.FilterService.filter(e,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale):e},hasSelectedOption(){return e.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},filterResultMessageText(){return e.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}",this.multiple?this.modelValue.length:"1"):this.emptySelectionMessageText},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:l.default},components:{VirtualScroller:a.default}};const d=["id"],p=["tabindex"],c={key:0,class:"p-listbox-header"},h={class:"p-listbox-filter-container"},u=["placeholder","aria-owns","aria-activedescendant","tabindex"],f=n.createElementVNode("span",{class:"p-listbox-filter-icon pi pi-search"},null,-1),O={role:"status","aria-live":"polite",class:"p-hidden-accessible"},b=["id","aria-multiselectable","aria-label","aria-labelledby","aria-activedescendant","aria-disabled"],m=["id"],x=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],g={key:0,class:"p-listbox-empty-message",role:"option"},y={key:1,class:"p-listbox-empty-message",role:"option"},v={key:0,role:"status","aria-live":"polite",class:"p-hidden-accessible"},S={role:"status","aria-live":"polite",class:"p-hidden-accessible"},I=["tabindex"];return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&s.firstChild?s.insertBefore(n,s.firstChild):s.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-listbox-list-wrapper {\n overflow: auto;\n}\n.p-listbox-list {\n list-style-type: none;\n margin: 0;\n padding: 0;\n}\n.p-listbox-item {\n cursor: pointer;\n position: relative;\n overflow: hidden;\n}\n.p-listbox-item-group {\n cursor: auto;\n}\n.p-listbox-filter-container {\n position: relative;\n}\n.p-listbox-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-listbox-filter {\n width: 100%;\n}\n"),r.render=function(e,t,i,s,o,l){const a=n.resolveComponent("VirtualScroller"),r=n.resolveDirective("ripple");return n.openBlock(),n.createElementBlock("div",{id:o.id,class:n.normalizeClass(l.containerClass),onFocusout:t[10]||(t[10]=(...e)=>l.onFocusout&&l.onFocusout(...e))},[n.createElementVNode("span",{ref:"firstHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:i.disabled?-1:i.tabindex,onFocus:t[0]||(t[0]=(...e)=>l.onFirstHiddenFocus&&l.onFirstHiddenFocus(...e))},null,40,p),n.renderSlot(e.$slots,"header",{value:i.modelValue,options:l.visibleOptions}),i.filter?(n.openBlock(),n.createElementBlock("div",c,[n.createElementVNode("div",h,[n.withDirectives(n.createElementVNode("input",n.mergeProps({ref:"filterInput",type:"text",class:"p-listbox-filter p-inputtext p-component","onUpdate:modelValue":t[1]||(t[1]=e=>o.filterValue=e),placeholder:i.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":l.focusedOptionId,tabindex:i.disabled||o.focused?-1:i.tabindex,onInput:t[2]||(t[2]=(...e)=>l.onFilterChange&&l.onFilterChange(...e)),onBlur:t[3]||(t[3]=(...e)=>l.onFilterBlur&&l.onFilterBlur(...e)),onKeydown:t[4]||(t[4]=(...e)=>l.onFilterKeyDown&&l.onFilterKeyDown(...e))},i.filterInputProps),null,16,u),[[n.vModelText,o.filterValue]]),f]),n.createElementVNode("span",O,n.toDisplayString(l.filterResultMessageText),1)])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref:"listWrapper",class:"p-listbox-list-wrapper",style:n.normalizeStyle(i.listStyle)},[n.createVNode(a,n.mergeProps({ref:l.virtualScrollerRef},i.virtualScrollerOptions,{style:i.listStyle,items:l.visibleOptions,tabindex:-1,disabled:l.virtualScrollerDisabled}),n.createSlots({content:n.withCtx((({styleClass:s,contentRef:a,items:d,getItemOptions:p,contentStyle:c,itemSize:h})=>[n.createElementVNode("ul",{ref:e=>l.listRef(e,a),id:o.id+"_list",class:n.normalizeClass(["p-listbox-list",s]),style:n.normalizeStyle(c),tabindex:-1,role:"listbox","aria-multiselectable":i.multiple,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-activedescendant":o.focused?l.focusedOptionId:void 0,"aria-disabled":i.disabled,onFocus:t[6]||(t[6]=(...e)=>l.onListFocus&&l.onListFocus(...e)),onBlur:t[7]||(t[7]=(...e)=>l.onListBlur&&l.onListBlur(...e)),onKeydown:t[8]||(t[8]=(...e)=>l.onListKeyDown&&l.onListKeyDown(...e))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(d,((i,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:l.getOptionRenderKey(i,l.getOptionIndex(s,p))},[l.isOptionGroup(i)?(n.openBlock(),n.createElementBlock("li",{key:0,id:o.id+"_"+l.getOptionIndex(s,p),style:n.normalizeStyle({height:h?h+"px":void 0}),class:"p-listbox-item-group",role:"option"},[n.renderSlot(e.$slots,"optiongroup",{option:i.optionGroup,index:l.getOptionIndex(s,p)},(()=>[n.createTextVNode(n.toDisplayString(l.getOptionGroupLabel(i.optionGroup)),1)]))],12,m)):n.withDirectives((n.openBlock(),n.createElementBlock("li",{key:1,id:o.id+"_"+l.getOptionIndex(s,p),style:n.normalizeStyle({height:h?h+"px":void 0}),class:n.normalizeClass(["p-listbox-item",{"p-highlight":l.isSelected(i),"p-focus":o.focusedOptionIndex===l.getOptionIndex(s,p),"p-disabled":l.isOptionDisabled(i)}]),role:"option","aria-label":l.getOptionLabel(i),"aria-selected":l.isSelected(i),"aria-disabled":l.isOptionDisabled(i),"aria-setsize":l.ariaSetSize,"aria-posinset":l.getAriaPosInset(l.getOptionIndex(s,p)),onClick:e=>l.onOptionSelect(e,i,l.getOptionIndex(s,p)),onMousemove:e=>l.onOptionMouseMove(e,l.getOptionIndex(s,p)),onTouchend:t[5]||(t[5]=e=>l.onOptionTouchEnd())},[n.renderSlot(e.$slots,"option",{option:i,index:l.getOptionIndex(s,p)},(()=>[n.createTextVNode(n.toDisplayString(l.getOptionLabel(i)),1)]))],46,x)),[[r]])],64)))),128)),o.filterValue&&(!d||d&&0===d.length)?(n.openBlock(),n.createElementBlock("li",g,[n.renderSlot(e.$slots,"emptyfilter",{},(()=>[n.createTextVNode(n.toDisplayString(l.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(n.openBlock(),n.createElementBlock("li",y,[n.renderSlot(e.$slots,"empty",{},(()=>[n.createTextVNode(n.toDisplayString(l.emptyMessageText),1)]))])):n.createCommentVNode("",!0)],46,b),!i.options||i.options&&0===i.options.length?(n.openBlock(),n.createElementBlock("span",v,n.toDisplayString(l.emptyMessageText),1)):n.createCommentVNode("",!0),n.createElementVNode("span",S,n.toDisplayString(l.selectedMessageText),1)])),_:2},[e.$slots.loader?{name:"loader",fn:n.withCtx((({options:t})=>[n.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["style","items","disabled"])],4),n.renderSlot(e.$slots,"footer",{value:i.modelValue,options:l.visibleOptions}),n.createElementVNode("span",{ref:"lastHiddenFocusableElement",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:i.disabled?-1:i.tabindex,onFocus:t[9]||(t[9]=(...e)=>l.onLastHiddenFocus&&l.onLastHiddenFocus(...e))},null,40,I)],42,d)},r}(primevue.utils,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
package/menu/Menu.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { VNode } from 'vue';
|
|
|
2
2
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
|
3
3
|
import { MenuItem } from '../menuitem';
|
|
4
4
|
|
|
5
|
-
type MenuAppendToType = 'body' | 'self' | string | undefined;
|
|
5
|
+
type MenuAppendToType = 'body' | 'self' | string | undefined | HTMLElement;
|
|
6
6
|
|
|
7
7
|
export interface MenuProps {
|
|
8
8
|
/**
|
package/menu/Menuitem.vue
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<template v-if="!template">
|
|
4
4
|
<router-link v-if="item.to && !disabled(item)" :to="item.to" custom v-slot="{navigate, href, isActive, isExactActive}">
|
|
5
5
|
<a :href="href" @click="onClick($event, navigate)" :class="linkClass(item, {isActive, isExactActive})" v-ripple role="menuitem">
|
|
6
|
-
<span :class="['p-menuitem-icon', item.icon]"></span>
|
|
6
|
+
<span :class="['p-menuitem-icon', item.icon]" v-if="item.icon"></span>
|
|
7
7
|
<span class="p-menuitem-text">{{label()}}</span>
|
|
8
8
|
</a>
|
|
9
9
|
</router-link>
|
|
10
10
|
<a v-else :href="item.url" :class="linkClass(item)" @click="onClick" :target="item.target" role="menuitem" :tabindex="disabled(item) ? null : '0'" v-ripple>
|
|
11
|
-
<span :class="['p-menuitem-icon', item.icon]"></span>
|
|
11
|
+
<span :class="['p-menuitem-icon', item.icon]" v-if="item.icon"></span>
|
|
12
12
|
<span class="p-menuitem-text">{{label()}}</span>
|
|
13
13
|
</a>
|
|
14
14
|
</template>
|
package/menu/menu.cjs.js
CHANGED
|
@@ -87,9 +87,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
87
87
|
class: vue.normalizeClass($options.linkClass($props.item, {isActive, isExactActive})),
|
|
88
88
|
role: "menuitem"
|
|
89
89
|
}, [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
($props.item.icon)
|
|
91
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
92
|
+
key: 0,
|
|
93
|
+
class: vue.normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
94
|
+
}, null, 2))
|
|
95
|
+
: vue.createCommentVNode("", true),
|
|
93
96
|
vue.createElementVNode("span", _hoisted_2$1, vue.toDisplayString($options.label()), 1)
|
|
94
97
|
], 10, _hoisted_1$1)), [
|
|
95
98
|
[_directive_ripple]
|
|
@@ -106,9 +109,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
106
109
|
role: "menuitem",
|
|
107
110
|
tabindex: $options.disabled($props.item) ? null : '0'
|
|
108
111
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
($props.item.icon)
|
|
113
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
114
|
+
key: 0,
|
|
115
|
+
class: vue.normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
116
|
+
}, null, 2))
|
|
117
|
+
: vue.createCommentVNode("", true),
|
|
112
118
|
vue.createElementVNode("span", _hoisted_4, vue.toDisplayString($options.label()), 1)
|
|
113
119
|
], 10, _hoisted_3)), [
|
|
114
120
|
[_directive_ripple]
|
package/menu/menu.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/ripple"),n=require("vue"),l=require("primevue/portal");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/ripple"),n=require("vue"),l=require("primevue/portal");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(t),r=s(i),a=s(l),c={name:"Menuitem",inheritAttrs:!1,emits:["click"],props:{item:null,template:null,exact:null},methods:{onClick(e,t){this.$emit("click",{originalEvent:e,item:this.item,navigate:t})},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},visible(){return"function"==typeof this.item.visible?this.item.visible():!1!==this.item.visible},disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label(){return"function"==typeof this.item.label?this.item.label():this.item.label}},computed:{containerClass(){return["p-menuitem",this.item.class]}},directives:{ripple:r.default}};const m=["href","onClick"],d={class:"p-menuitem-text"},u=["href","target","tabindex"],p={class:"p-menuitem-text"};c.render=function(e,t,i,l,s,o){const r=n.resolveComponent("router-link"),a=n.resolveDirective("ripple");return o.visible()?(n.openBlock(),n.createElementBlock("li",{key:0,class:n.normalizeClass(o.containerClass),role:"none",style:n.normalizeStyle(i.item.style)},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:i.item},null,8,["item"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[i.item.to&&!o.disabled(i.item)?(n.openBlock(),n.createBlock(r,{key:0,to:i.item.to,custom:""},{default:n.withCtx((({navigate:e,href:t,isActive:l,isExactActive:s})=>[n.withDirectives((n.openBlock(),n.createElementBlock("a",{href:t,onClick:t=>o.onClick(t,e),class:n.normalizeClass(o.linkClass(i.item,{isActive:l,isExactActive:s})),role:"menuitem"},[i.item.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",i.item.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",d,n.toDisplayString(o.label()),1)],10,m)),[[a]])])),_:1},8,["to"])):n.withDirectives((n.openBlock(),n.createElementBlock("a",{key:1,href:i.item.url,class:n.normalizeClass(o.linkClass(i.item)),onClick:t[0]||(t[0]=(...e)=>o.onClick&&o.onClick(...e)),target:i.item.target,role:"menuitem",tabindex:o.disabled(i.item)?null:"0"},[i.item.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",i.item.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",p,n.toDisplayString(o.label()),1)],10,u)),[[a]])],64))],6)):n.createCommentVNode("",!0)};var h={name:"Menu",emits:["show","hide"],inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},data:()=>({overlayVisible:!1}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&e.ZIndexUtils.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;this.disabled(t)||(t.command&&t.command(e),t.to&&e.navigate&&e.navigate(e.originalEvent),this.hide())},toggle(e){this.overlayVisible?this.hide():this.show(e)},show(e){this.overlayVisible=!0,this.target=e.currentTarget},hide(){this.overlayVisible=!1,this.target=null},onEnter(t){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&e.ZIndexUtils.set("menu",t,this.baseZIndex+this.$primevue.config.zIndex.menu),this.$emit("show")},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener(),this.$emit("hide")},onAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){e.DomHandler.absolutePosition(this.container,this.target),this.container.style.minWidth=e.DomHandler.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.target,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label,containerRef(e){this.container=e},onOverlayClick(e){o.default.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-menu p-component",{"p-menu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{Menuitem:c,Portal:a.default}};const k={class:"p-menu-list p-reset",role:"menu"},v={key:0,class:"p-submenu-header"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-menu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-menu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-menu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-menu .p-menuitem-text {\n line-height: 1;\n}\n"),h.render=function(e,t,i,l,s,o){const r=n.resolveComponent("Menuitem"),a=n.resolveComponent("Portal");return n.openBlock(),n.createBlock(a,{appendTo:i.appendTo,disabled:!i.popup},{default:n.withCtx((()=>[n.createVNode(n.Transition,{name:"p-connected-overlay",onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},{default:n.withCtx((()=>[!i.popup||s.overlayVisible?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:o.containerRef,class:o.containerClass},e.$attrs,{onClick:t[0]||(t[0]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))}),[n.createElementVNode("ul",k,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.model,((t,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:o.label(t)+l.toString()},[t.items&&o.visible(t)&&!t.separator?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.items?(n.openBlock(),n.createElementBlock("li",v,[n.renderSlot(e.$slots,"item",{item:t},(()=>[n.createTextVNode(n.toDisplayString(o.label(t)),1)]))])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.items,((t,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:t.label+l+s},[o.visible(t)&&!t.separator?(n.openBlock(),n.createBlock(r,{key:0,item:t,onClick:o.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"])):o.visible(t)&&t.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",t.class]),style:n.normalizeStyle(t.style),key:"separator"+l+s,role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],64)):o.visible(t)&&t.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",t.class]),style:n.normalizeStyle(t.style),key:"separator"+l.toString(),role:"separator"},null,6)):(n.openBlock(),n.createBlock(r,{key:o.label(t)+l.toString(),item:t,onClick:o.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"]))],64)))),128))])],16)):n.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo","disabled"])},module.exports=h;
|
package/menu/menu.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZIndexUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
|
|
2
2
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
|
3
3
|
import Ripple from 'primevue/ripple';
|
|
4
|
-
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, normalizeStyle, Fragment, createBlock, withCtx, withDirectives, createElementVNode, toDisplayString, resolveDynamicComponent,
|
|
4
|
+
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, normalizeStyle, Fragment, createBlock, withCtx, withDirectives, createCommentVNode, createElementVNode, toDisplayString, resolveDynamicComponent, createVNode, Transition, mergeProps, renderList, renderSlot, createTextVNode } from 'vue';
|
|
5
5
|
import Portal from 'primevue/portal';
|
|
6
6
|
|
|
7
7
|
var script$1 = {
|
|
@@ -79,9 +79,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
79
79
|
class: normalizeClass($options.linkClass($props.item, {isActive, isExactActive})),
|
|
80
80
|
role: "menuitem"
|
|
81
81
|
}, [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
($props.item.icon)
|
|
83
|
+
? (openBlock(), createElementBlock("span", {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
86
|
+
}, null, 2))
|
|
87
|
+
: createCommentVNode("", true),
|
|
85
88
|
createElementVNode("span", _hoisted_2$1, toDisplayString($options.label()), 1)
|
|
86
89
|
], 10, _hoisted_1$1)), [
|
|
87
90
|
[_directive_ripple]
|
|
@@ -98,9 +101,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
98
101
|
role: "menuitem",
|
|
99
102
|
tabindex: $options.disabled($props.item) ? null : '0'
|
|
100
103
|
}, [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
($props.item.icon)
|
|
105
|
+
? (openBlock(), createElementBlock("span", {
|
|
106
|
+
key: 0,
|
|
107
|
+
class: normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
108
|
+
}, null, 2))
|
|
109
|
+
: createCommentVNode("", true),
|
|
104
110
|
createElementVNode("span", _hoisted_4, toDisplayString($options.label()), 1)
|
|
105
111
|
], 10, _hoisted_3)), [
|
|
106
112
|
[_directive_ripple]
|
package/menu/menu.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ZIndexUtils as e,DomHandler as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import l from"primevue/ripple";import{resolveComponent as s,resolveDirective as r,openBlock as a,createElementBlock as o,normalizeClass as c,normalizeStyle as d,Fragment as u,createBlock as m,withCtx as p,withDirectives as h,
|
|
1
|
+
import{ZIndexUtils as e,DomHandler as t,ConnectedOverlayScrollHandler as i}from"primevue/utils";import n from"primevue/overlayeventbus";import l from"primevue/ripple";import{resolveComponent as s,resolveDirective as r,openBlock as a,createElementBlock as o,normalizeClass as c,normalizeStyle as d,Fragment as u,createBlock as m,withCtx as p,withDirectives as h,createCommentVNode as b,createElementVNode as v,toDisplayString as y,resolveDynamicComponent as k,createVNode as f,Transition as g,mergeProps as C,renderList as L,renderSlot as x,createTextVNode as E}from"vue";import z from"primevue/portal";var A={name:"Menuitem",inheritAttrs:!1,emits:["click"],props:{item:null,template:null,exact:null},methods:{onClick(e,t){this.$emit("click",{originalEvent:e,item:this.item,navigate:t})},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},visible(){return"function"==typeof this.item.visible?this.item.visible():!1!==this.item.visible},disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label(){return"function"==typeof this.item.label?this.item.label():this.item.label}},computed:{containerClass(){return["p-menuitem",this.item.class]}},directives:{ripple:l}};const S=["href","onClick"],w={class:"p-menuitem-text"},O=["href","target","tabindex"],T={class:"p-menuitem-text"};A.render=function(e,t,i,n,l,f){const g=s("router-link"),C=r("ripple");return f.visible()?(a(),o("li",{key:0,class:c(f.containerClass),role:"none",style:d(i.item.style)},[i.template?(a(),m(k(i.template),{key:1,item:i.item},null,8,["item"])):(a(),o(u,{key:0},[i.item.to&&!f.disabled(i.item)?(a(),m(g,{key:0,to:i.item.to,custom:""},{default:p((({navigate:e,href:t,isActive:n,isExactActive:l})=>[h((a(),o("a",{href:t,onClick:t=>f.onClick(t,e),class:c(f.linkClass(i.item,{isActive:n,isExactActive:l})),role:"menuitem"},[i.item.icon?(a(),o("span",{key:0,class:c(["p-menuitem-icon",i.item.icon])},null,2)):b("",!0),v("span",w,y(f.label()),1)],10,S)),[[C]])])),_:1},8,["to"])):h((a(),o("a",{key:1,href:i.item.url,class:c(f.linkClass(i.item)),onClick:t[0]||(t[0]=(...e)=>f.onClick&&f.onClick(...e)),target:i.item.target,role:"menuitem",tabindex:f.disabled(i.item)?null:"0"},[i.item.icon?(a(),o("span",{key:0,class:c(["p-menuitem-icon",i.item.icon])},null,2)):b("",!0),v("span",T,y(f.label()),1)],10,O)),[[C]])],64))],6)):b("",!0)};var $={name:"Menu",emits:["show","hide"],inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},data:()=>({overlayVisible:!1}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&e.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;this.disabled(t)||(t.command&&t.command(e),t.to&&e.navigate&&e.navigate(e.originalEvent),this.hide())},toggle(e){this.overlayVisible?this.hide():this.show(e)},show(e){this.overlayVisible=!0,this.target=e.currentTarget},hide(){this.overlayVisible=!1,this.target=null},onEnter(t){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&e.set("menu",t,this.baseZIndex+this.$primevue.config.zIndex.menu),this.$emit("show")},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener(),this.$emit("hide")},onAfterLeave(t){this.autoZIndex&&e.clear(t)},alignOverlay(){t.absolutePosition(this.container,this.target),this.container.style.minWidth=t.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new i(this.target,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!t.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label,containerRef(e){this.container=e},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-menu p-component",{"p-menu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{Menuitem:A,Portal:z}};const H={class:"p-menu-list p-reset",role:"menu"},V={key:0,class:"p-submenu-header"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-menu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-menu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-menu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-menu .p-menuitem-text {\n line-height: 1;\n}\n"),$.render=function(e,t,i,n,l,r){const h=s("Menuitem"),k=s("Portal");return a(),m(k,{appendTo:i.appendTo,disabled:!i.popup},{default:p((()=>[f(g,{name:"p-connected-overlay",onEnter:r.onEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},{default:p((()=>[!i.popup||l.overlayVisible?(a(),o("div",C({key:0,ref:r.containerRef,class:r.containerClass},e.$attrs,{onClick:t[0]||(t[0]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))}),[v("ul",H,[(a(!0),o(u,null,L(i.model,((t,n)=>(a(),o(u,{key:r.label(t)+n.toString()},[t.items&&r.visible(t)&&!t.separator?(a(),o(u,{key:0},[t.items?(a(),o("li",V,[x(e.$slots,"item",{item:t},(()=>[E(y(r.label(t)),1)]))])):b("",!0),(a(!0),o(u,null,L(t.items,((t,l)=>(a(),o(u,{key:t.label+n+l},[r.visible(t)&&!t.separator?(a(),m(h,{key:0,item:t,onClick:r.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"])):r.visible(t)&&t.separator?(a(),o("li",{class:c(["p-menu-separator",t.class]),style:d(t.style),key:"separator"+n+l,role:"separator"},null,6)):b("",!0)],64)))),128))],64)):r.visible(t)&&t.separator?(a(),o("li",{class:c(["p-menu-separator",t.class]),style:d(t.style),key:"separator"+n.toString(),role:"separator"},null,6)):(a(),m(h,{key:r.label(t)+n.toString(),item:t,onClick:r.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"]))],64)))),128))])],16)):b("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo","disabled"])};export{$ as default};
|
package/menu/menu.js
CHANGED
|
@@ -83,9 +83,12 @@ this.primevue.menu = (function (utils, OverlayEventBus, Ripple, vue, Portal) {
|
|
|
83
83
|
class: vue.normalizeClass($options.linkClass($props.item, {isActive, isExactActive})),
|
|
84
84
|
role: "menuitem"
|
|
85
85
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
($props.item.icon)
|
|
87
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: vue.normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
90
|
+
}, null, 2))
|
|
91
|
+
: vue.createCommentVNode("", true),
|
|
89
92
|
vue.createElementVNode("span", _hoisted_2$1, vue.toDisplayString($options.label()), 1)
|
|
90
93
|
], 10, _hoisted_1$1)), [
|
|
91
94
|
[_directive_ripple]
|
|
@@ -102,9 +105,12 @@ this.primevue.menu = (function (utils, OverlayEventBus, Ripple, vue, Portal) {
|
|
|
102
105
|
role: "menuitem",
|
|
103
106
|
tabindex: $options.disabled($props.item) ? null : '0'
|
|
104
107
|
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
($props.item.icon)
|
|
109
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
110
|
+
key: 0,
|
|
111
|
+
class: vue.normalizeClass(['p-menuitem-icon', $props.item.icon])
|
|
112
|
+
}, null, 2))
|
|
113
|
+
: vue.createCommentVNode("", true),
|
|
108
114
|
vue.createElementVNode("span", _hoisted_4, vue.toDisplayString($options.label()), 1)
|
|
109
115
|
], 10, _hoisted_3)), [
|
|
110
116
|
[_directive_ripple]
|
package/menu/menu.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.menu=function(e,t,i,n,l){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.menu=function(e,t,i,n,l){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=s(t),r=s(i),a=s(l),c={name:"Menuitem",inheritAttrs:!1,emits:["click"],props:{item:null,template:null,exact:null},methods:{onClick(e,t){this.$emit("click",{originalEvent:e,item:this.item,navigate:t})},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},visible(){return"function"==typeof this.item.visible?this.item.visible():!1!==this.item.visible},disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label(){return"function"==typeof this.item.label?this.item.label():this.item.label}},computed:{containerClass(){return["p-menuitem",this.item.class]}},directives:{ripple:r.default}};const m=["href","onClick"],d={class:"p-menuitem-text"},u=["href","target","tabindex"],p={class:"p-menuitem-text"};c.render=function(e,t,i,l,s,o){const r=n.resolveComponent("router-link"),a=n.resolveDirective("ripple");return o.visible()?(n.openBlock(),n.createElementBlock("li",{key:0,class:n.normalizeClass(o.containerClass),role:"none",style:n.normalizeStyle(i.item.style)},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:i.item},null,8,["item"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[i.item.to&&!o.disabled(i.item)?(n.openBlock(),n.createBlock(r,{key:0,to:i.item.to,custom:""},{default:n.withCtx((({navigate:e,href:t,isActive:l,isExactActive:s})=>[n.withDirectives((n.openBlock(),n.createElementBlock("a",{href:t,onClick:t=>o.onClick(t,e),class:n.normalizeClass(o.linkClass(i.item,{isActive:l,isExactActive:s})),role:"menuitem"},[i.item.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",i.item.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",d,n.toDisplayString(o.label()),1)],10,m)),[[a]])])),_:1},8,["to"])):n.withDirectives((n.openBlock(),n.createElementBlock("a",{key:1,href:i.item.url,class:n.normalizeClass(o.linkClass(i.item)),onClick:t[0]||(t[0]=(...e)=>o.onClick&&o.onClick(...e)),target:i.item.target,role:"menuitem",tabindex:o.disabled(i.item)?null:"0"},[i.item.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",i.item.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",p,n.toDisplayString(o.label()),1)],10,u)),[[a]])],64))],6)):n.createCommentVNode("",!0)};var h={name:"Menu",emits:["show","hide"],inheritAttrs:!1,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:String,default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},exact:{type:Boolean,default:!0}},data:()=>({overlayVisible:!1}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,beforeUnmount(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.target=null,this.container&&this.autoZIndex&&e.ZIndexUtils.clear(this.container),this.container=null},methods:{itemClick(e){const t=e.item;this.disabled(t)||(t.command&&t.command(e),t.to&&e.navigate&&e.navigate(e.originalEvent),this.hide())},toggle(e){this.overlayVisible?this.hide():this.show(e)},show(e){this.overlayVisible=!0,this.target=e.currentTarget},hide(){this.overlayVisible=!1,this.target=null},onEnter(t){this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&e.ZIndexUtils.set("menu",t,this.baseZIndex+this.$primevue.config.zIndex.menu),this.$emit("show")},onLeave(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener(),this.$emit("hide")},onAfterLeave(t){this.autoZIndex&&e.ZIndexUtils.clear(t)},alignOverlay(){e.DomHandler.absolutePosition(this.container,this.target),this.container.style.minWidth=e.DomHandler.getOuterWidth(this.target)+"px"},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.target,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label,containerRef(e){this.container=e},onOverlayClick(e){o.default.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-menu p-component",{"p-menu-overlay":this.popup,"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]}},components:{Menuitem:c,Portal:a.default}};const k={class:"p-menu-list p-reset",role:"menu"},v={key:0,class:"p-submenu-header"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-menu-overlay {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-menu ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-menu .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-menu .p-menuitem-text {\n line-height: 1;\n}\n"),h.render=function(e,t,i,l,s,o){const r=n.resolveComponent("Menuitem"),a=n.resolveComponent("Portal");return n.openBlock(),n.createBlock(a,{appendTo:i.appendTo,disabled:!i.popup},{default:n.withCtx((()=>[n.createVNode(n.Transition,{name:"p-connected-overlay",onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},{default:n.withCtx((()=>[!i.popup||s.overlayVisible?(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:o.containerRef,class:o.containerClass},e.$attrs,{onClick:t[0]||(t[0]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))}),[n.createElementVNode("ul",k,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.model,((t,l)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:o.label(t)+l.toString()},[t.items&&o.visible(t)&&!t.separator?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[t.items?(n.openBlock(),n.createElementBlock("li",v,[n.renderSlot(e.$slots,"item",{item:t},(()=>[n.createTextVNode(n.toDisplayString(o.label(t)),1)]))])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(t.items,((t,s)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:t.label+l+s},[o.visible(t)&&!t.separator?(n.openBlock(),n.createBlock(r,{key:0,item:t,onClick:o.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"])):o.visible(t)&&t.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",t.class]),style:n.normalizeStyle(t.style),key:"separator"+l+s,role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],64)):o.visible(t)&&t.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",t.class]),style:n.normalizeStyle(t.style),key:"separator"+l.toString(),role:"separator"},null,6)):(n.openBlock(),n.createBlock(r,{key:o.label(t)+l.toString(),item:t,onClick:o.itemClick,template:e.$slots.item,exact:i.exact},null,8,["item","onClick","template","exact"]))],64)))),128))])],16)):n.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo","disabled"])},h}(primevue.utils,primevue.overlayeventbus,primevue.ripple,Vue,primevue.portal);
|
package/menubar/MenubarSub.vue
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<template v-if="!template">
|
|
7
7
|
<router-link v-if="item.to && !disabled(item)" :to="item.to" custom v-slot="{navigate, href, isActive, isExactActive}">
|
|
8
8
|
<a :href="href" @click="onItemClick($event, item, navigate)" :class="linkClass(item, {isActive, isExactActive})" v-ripple @keydown="onItemKeyDown($event, item)" role="menuitem">
|
|
9
|
-
<span :class="['p-menuitem-icon', item.icon]"></span>
|
|
9
|
+
<span :class="['p-menuitem-icon', item.icon]" v-if="item.icon"></span>
|
|
10
10
|
<span class="p-menuitem-text">{{label(item)}}</span>
|
|
11
11
|
</a>
|
|
12
12
|
</router-link>
|
|
13
13
|
<a v-else :href="item.url" :class="linkClass(item)" :target="item.target" :aria-haspopup="item.items != null" :aria-expanded="item === activeItem"
|
|
14
14
|
@click="onItemClick($event, item)" @keydown="onItemKeyDown($event, item)" role="menuitem" :tabindex="disabled(item) ? null : '0'" v-ripple>
|
|
15
|
-
<span :class="['p-menuitem-icon', item.icon]"></span>
|
|
15
|
+
<span :class="['p-menuitem-icon', item.icon]" v-if="item.icon"></span>
|
|
16
16
|
<span class="p-menuitem-text">{{label(item)}}</span>
|
|
17
17
|
<span :class="getSubmenuIcon()" v-if="item.items"></span>
|
|
18
18
|
</a>
|
|
@@ -117,7 +117,7 @@ export default {
|
|
|
117
117
|
if (this.activeItem && item === this.activeItem)
|
|
118
118
|
this.activeItem = null;
|
|
119
119
|
else
|
|
120
|
-
|
|
120
|
+
this.activeItem = item;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
if (!item.items) {
|
package/menubar/menubar.cjs.js
CHANGED
|
@@ -95,7 +95,7 @@ var script$1 = {
|
|
|
95
95
|
if (this.activeItem && item === this.activeItem)
|
|
96
96
|
this.activeItem = null;
|
|
97
97
|
else
|
|
98
|
-
|
|
98
|
+
this.activeItem = item;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (!item.items) {
|
|
@@ -323,9 +323,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
323
323
|
onKeydown: $event => ($options.onItemKeyDown($event, item)),
|
|
324
324
|
role: "menuitem"
|
|
325
325
|
}, [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
(item.icon)
|
|
327
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
328
|
+
key: 0,
|
|
329
|
+
class: vue.normalizeClass(['p-menuitem-icon', item.icon])
|
|
330
|
+
}, null, 2))
|
|
331
|
+
: vue.createCommentVNode("", true),
|
|
329
332
|
vue.createElementVNode("span", _hoisted_4$1, vue.toDisplayString($options.label(item)), 1)
|
|
330
333
|
], 42, _hoisted_3$1)), [
|
|
331
334
|
[_directive_ripple]
|
|
@@ -345,13 +348,16 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
345
348
|
role: "menuitem",
|
|
346
349
|
tabindex: $options.disabled(item) ? null : '0'
|
|
347
350
|
}, [
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
(item.icon)
|
|
352
|
+
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
353
|
+
key: 0,
|
|
354
|
+
class: vue.normalizeClass(['p-menuitem-icon', item.icon])
|
|
355
|
+
}, null, 2))
|
|
356
|
+
: vue.createCommentVNode("", true),
|
|
351
357
|
vue.createElementVNode("span", _hoisted_6, vue.toDisplayString($options.label(item)), 1),
|
|
352
358
|
(item.items)
|
|
353
359
|
? (vue.openBlock(), vue.createElementBlock("span", {
|
|
354
|
-
key:
|
|
360
|
+
key: 1,
|
|
355
361
|
class: vue.normalizeClass($options.getSubmenuIcon())
|
|
356
362
|
}, null, 2))
|
|
357
363
|
: vue.createCommentVNode("", true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/utils"),t=require("primevue/ripple"),n=require("vue");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l={name:"MenubarSub",emits:["keydown-item","leaf-click"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},mobileActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)||this.mobileActive?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,n){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&n&&n(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let n=e.currentTarget.parentElement;switch(e.which){case 40:this.root?t.items&&this.expandSubmenu(t,n):this.navigateToNextItem(n),e.preventDefault();break;case 38:this.root||this.navigateToPrevItem(n),e.preventDefault();break;case 39:if(this.root){var i=this.findNextItem(n);i&&i.children[0].focus()}else t.items&&this.expandSubmenu(t,n);e.preventDefault();break;case 37:this.root&&this.navigateToPrevItem(n),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:n})},onChildItemKeyDown(e){this.root?38===e.originalEvent.which&&null==e.element.previousElementSibling&&this.collapseMenu(e.element):37===e.originalEvent.which&&this.collapseMenu(e.element)},findNextItem(t){let n=t.nextElementSibling;return n?e.DomHandler.hasClass(n,"p-disabled")||!e.DomHandler.hasClass(n,"p-menuitem")?this.findNextItem(n):n:null},findPrevItem(t){let n=t.previousElementSibling;return n?e.DomHandler.hasClass(n,"p-disabled")||!e.DomHandler.hasClass(n,"p-menuitem")?this.findPrevItem(n):n:null},expandSubmenu(e,t){this.activeItem=e,setTimeout((()=>{t.children[1].children[0].children[0].focus()}),50)},collapseMenu(e){this.activeItem=null,e.parentElement.previousElementSibling.focus()},navigateToNextItem(e){var t=this.findNextItem(e);t&&t.children[0].focus()},navigateToPrevItem(e){var t=this.findPrevItem(e);t&&t.children[0].focus()},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},getSubmenuIcon(){return["p-submenu-icon pi",{"pi-angle-right":!this.root,"pi-angle-down":this.root}]},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label},computed:{containerClass(){return{"p-submenu-list":!this.root,"p-menubar-root-list":this.root}}},directives:{ripple:i(t).default}};const o=["role"],s=["onMouseenter"],a=["href","onClick","onKeydown"],r={class:"p-menuitem-text"},c=["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"],m={class:"p-menuitem-text"};l.render=function(e,t,i,l,u,d){const p=n.resolveComponent("router-link"),b=n.resolveComponent("MenubarSub",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createElementBlock("ul",{class:n.normalizeClass(d.containerClass),role:i.root?"menubar":"menu"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.model,((e,t)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d.label(e)+t.toString()},[d.visible(e)&&!e.separator?(n.openBlock(),n.createElementBlock("li",{key:0,role:"none",class:n.normalizeClass(d.getItemClass(e)),style:n.normalizeStyle(e.style),onMouseenter:t=>d.onItemMouseEnter(t,e)},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:e},null,8,["item"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[e.to&&!d.disabled(e)?(n.openBlock(),n.createBlock(p,{key:0,to:e.to,custom:""},{default:n.withCtx((({navigate:t,href:i,isActive:l,isExactActive:o})=>[n.withDirectives((n.openBlock(),n.createElementBlock("a",{href:i,onClick:n=>d.onItemClick(n,e,t),class:n.normalizeClass(d.linkClass(e,{isActive:l,isExactActive:o})),onKeydown:t=>d.onItemKeyDown(t,e),role:"menuitem"},[n.createElementVNode("span",{class:n.normalizeClass(["p-menuitem-icon",e.icon])},null,2),n.createElementVNode("span",r,n.toDisplayString(d.label(e)),1)],42,a)),[[h]])])),_:2},1032,["to"])):n.withDirectives((n.openBlock(),n.createElementBlock("a",{key:1,href:e.url,class:n.normalizeClass(d.linkClass(e)),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===u.activeItem,onClick:t=>d.onItemClick(t,e),onKeydown:t=>d.onItemKeyDown(t,e),role:"menuitem",tabindex:d.disabled(e)?null:"0"},[n.createElementVNode("span",{class:n.normalizeClass(["p-menuitem-icon",e.icon])},null,2),n.createElementVNode("span",m,n.toDisplayString(d.label(e)),1),e.items?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(d.getSubmenuIcon())},null,2)):n.createCommentVNode("",!0)],42,c)),[[h]])],64)),d.visible(e)&&e.items?(n.openBlock(),n.createBlock(b,{model:e.items,key:d.label(e)+"_sub_",mobileActive:i.mobileActive,onLeafClick:d.onLeafClick,onKeydownItem:d.onChildItemKeyDown,parentActive:e===u.activeItem,template:i.template,exact:i.exact},null,8,["model","mobileActive","onLeafClick","onKeydownItem","parentActive","template","exact"])):n.createCommentVNode("",!0)],46,s)):n.createCommentVNode("",!0),d.visible(e)&&e.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",e.class]),style:n.normalizeStyle(e.style),key:"separator"+t.toString(),role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],10,o)};var u={name:"Menubar",props:{model:{type:Array,default:null},exact:{type:Boolean,default:!0}},outsideClickListener:null,data:()=>({mobileActive:!1}),beforeUnmount(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.$refs.rootmenu&&this.$refs.rootmenu.$el&&e.ZIndexUtils.clear(this.$refs.rootmenu.$el)},methods:{toggle(t){this.mobileActive?(this.mobileActive=!1,e.ZIndexUtils.clear(this.$refs.rootmenu.$el)):(this.mobileActive=!0,e.ZIndexUtils.set("menu",this.$refs.rootmenu.$el,this.$primevue.config.zIndex.menu)),this.bindOutsideClickListener(),t.preventDefault()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{!this.mobileActive||this.$refs.rootmenu.$el===e.target||this.$refs.rootmenu.$el.contains(e.target)||this.$refs.menubutton===e.target||this.$refs.menubutton.contains(e.target)||(this.mobileActive=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},onLeafClick(){this.mobileActive=!1}},computed:{containerClass(){return["p-menubar p-component",{"p-menubar-mobile-active":this.mobileActive}]}},components:{MenubarSub:l}};const d={key:0,class:"p-menubar-start"},p=[n.createElementVNode("i",{class:"pi pi-bars"},null,-1)],b={key:1,class:"p-menubar-end"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&i.firstChild?i.insertBefore(l,i.firstChild):i.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-menubar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-menubar .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-menubar .p-menuitem-text {\n line-height: 1;\n}\n.p-menubar .p-menuitem {\n position: relative;\n}\n.p-menubar-root-list {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n}\n.p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n}\n.p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 1;\n}\n.p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-menubar .p-menubar-custom,\n.p-menubar .p-menubar-end {\n margin-left: auto;\n -ms-flex-item-align: center;\n align-self: center;\n}\n.p-menubar-button {\n display: none;\n cursor: pointer;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n text-decoration: none;\n}\n"),u.render=function(e,t,i,l,o,s){const a=n.resolveComponent("MenubarSub");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(s.containerClass)},[e.$slots.start?(n.openBlock(),n.createElementBlock("div",d,[n.renderSlot(e.$slots,"start")])):n.createCommentVNode("",!0),n.createElementVNode("a",{ref:"menubutton",tabindex:"0",class:"p-menubar-button",onClick:t[0]||(t[0]=e=>s.toggle(e))},p,512),n.createVNode(a,{ref:"rootmenu",model:i.model,root:!0,mobileActive:o.mobileActive,onLeafClick:s.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","mobileActive","onLeafClick","template","exact"]),e.$slots.end?(n.openBlock(),n.createElementBlock("div",b,[n.renderSlot(e.$slots,"end")])):n.createCommentVNode("",!0)],2)},module.exports=u;
|
|
1
|
+
"use strict";var e=require("primevue/utils"),t=require("primevue/ripple"),n=require("vue");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l={name:"MenubarSub",emits:["keydown-item","leaf-click"],props:{model:{type:Array,default:null},root:{type:Boolean,default:!1},popup:{type:Boolean,default:!1},parentActive:{type:Boolean,default:!1},mobileActive:{type:Boolean,default:!1},template:{type:Function,default:null},exact:{type:Boolean,default:!0}},documentClickListener:null,watch:{parentActive(e){e||(this.activeItem=null)}},data:()=>({activeItem:null}),updated(){this.root&&this.activeItem&&this.bindDocumentClickListener()},beforeUnmount(){this.unbindDocumentClickListener()},methods:{onItemMouseEnter(e,t){this.disabled(t)||this.mobileActive?e.preventDefault():this.root?(this.activeItem||this.popup)&&(this.activeItem=t):this.activeItem=t},onItemClick(e,t,n){this.disabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),t.items&&(this.activeItem&&t===this.activeItem?this.activeItem=null:this.activeItem=t),t.items||this.onLeafClick(),t.to&&n&&n(e))},onLeafClick(){this.activeItem=null,this.$emit("leaf-click")},onItemKeyDown(e,t){let n=e.currentTarget.parentElement;switch(e.which){case 40:this.root?t.items&&this.expandSubmenu(t,n):this.navigateToNextItem(n),e.preventDefault();break;case 38:this.root||this.navigateToPrevItem(n),e.preventDefault();break;case 39:if(this.root){var i=this.findNextItem(n);i&&i.children[0].focus()}else t.items&&this.expandSubmenu(t,n);e.preventDefault();break;case 37:this.root&&this.navigateToPrevItem(n),e.preventDefault()}this.$emit("keydown-item",{originalEvent:e,element:n})},onChildItemKeyDown(e){this.root?38===e.originalEvent.which&&null==e.element.previousElementSibling&&this.collapseMenu(e.element):37===e.originalEvent.which&&this.collapseMenu(e.element)},findNextItem(t){let n=t.nextElementSibling;return n?e.DomHandler.hasClass(n,"p-disabled")||!e.DomHandler.hasClass(n,"p-menuitem")?this.findNextItem(n):n:null},findPrevItem(t){let n=t.previousElementSibling;return n?e.DomHandler.hasClass(n,"p-disabled")||!e.DomHandler.hasClass(n,"p-menuitem")?this.findPrevItem(n):n:null},expandSubmenu(e,t){this.activeItem=e,setTimeout((()=>{t.children[1].children[0].children[0].focus()}),50)},collapseMenu(e){this.activeItem=null,e.parentElement.previousElementSibling.focus()},navigateToNextItem(e){var t=this.findNextItem(e);t&&t.children[0].focus()},navigateToPrevItem(e){var t=this.findPrevItem(e);t&&t.children[0].focus()},getItemClass(e){return["p-menuitem",e.class,{"p-menuitem-active":this.activeItem===e}]},linkClass(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},bindDocumentClickListener(){this.documentClickListener||(this.documentClickListener=e=>{this.$el&&!this.$el.contains(e.target)&&(this.activeItem=null,this.unbindDocumentClickListener())},document.addEventListener("click",this.documentClickListener))},unbindDocumentClickListener(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)},getSubmenuIcon(){return["p-submenu-icon pi",{"pi-angle-right":!this.root,"pi-angle-down":this.root}]},visible:e=>"function"==typeof e.visible?e.visible():!1!==e.visible,disabled:e=>"function"==typeof e.disabled?e.disabled():e.disabled,label:e=>"function"==typeof e.label?e.label():e.label},computed:{containerClass(){return{"p-submenu-list":!this.root,"p-menubar-root-list":this.root}}},directives:{ripple:i(t).default}};const o=["role"],s=["onMouseenter"],a=["href","onClick","onKeydown"],r={class:"p-menuitem-text"},c=["href","target","aria-haspopup","aria-expanded","onClick","onKeydown","tabindex"],m={class:"p-menuitem-text"};l.render=function(e,t,i,l,u,d){const p=n.resolveComponent("router-link"),b=n.resolveComponent("MenubarSub",!0),h=n.resolveDirective("ripple");return n.openBlock(),n.createElementBlock("ul",{class:n.normalizeClass(d.containerClass),role:i.root?"menubar":"menu"},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.model,((e,t)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:d.label(e)+t.toString()},[d.visible(e)&&!e.separator?(n.openBlock(),n.createElementBlock("li",{key:0,role:"none",class:n.normalizeClass(d.getItemClass(e)),style:n.normalizeStyle(e.style),onMouseenter:t=>d.onItemMouseEnter(t,e)},[i.template?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(i.template),{key:1,item:e},null,8,["item"])):(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[e.to&&!d.disabled(e)?(n.openBlock(),n.createBlock(p,{key:0,to:e.to,custom:""},{default:n.withCtx((({navigate:t,href:i,isActive:l,isExactActive:o})=>[n.withDirectives((n.openBlock(),n.createElementBlock("a",{href:i,onClick:n=>d.onItemClick(n,e,t),class:n.normalizeClass(d.linkClass(e,{isActive:l,isExactActive:o})),onKeydown:t=>d.onItemKeyDown(t,e),role:"menuitem"},[e.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",e.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",r,n.toDisplayString(d.label(e)),1)],42,a)),[[h]])])),_:2},1032,["to"])):n.withDirectives((n.openBlock(),n.createElementBlock("a",{key:1,href:e.url,class:n.normalizeClass(d.linkClass(e)),target:e.target,"aria-haspopup":null!=e.items,"aria-expanded":e===u.activeItem,onClick:t=>d.onItemClick(t,e),onKeydown:t=>d.onItemKeyDown(t,e),role:"menuitem",tabindex:d.disabled(e)?null:"0"},[e.icon?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["p-menuitem-icon",e.icon])},null,2)):n.createCommentVNode("",!0),n.createElementVNode("span",m,n.toDisplayString(d.label(e)),1),e.items?(n.openBlock(),n.createElementBlock("span",{key:1,class:n.normalizeClass(d.getSubmenuIcon())},null,2)):n.createCommentVNode("",!0)],42,c)),[[h]])],64)),d.visible(e)&&e.items?(n.openBlock(),n.createBlock(b,{model:e.items,key:d.label(e)+"_sub_",mobileActive:i.mobileActive,onLeafClick:d.onLeafClick,onKeydownItem:d.onChildItemKeyDown,parentActive:e===u.activeItem,template:i.template,exact:i.exact},null,8,["model","mobileActive","onLeafClick","onKeydownItem","parentActive","template","exact"])):n.createCommentVNode("",!0)],46,s)):n.createCommentVNode("",!0),d.visible(e)&&e.separator?(n.openBlock(),n.createElementBlock("li",{class:n.normalizeClass(["p-menu-separator",e.class]),style:n.normalizeStyle(e.style),key:"separator"+t.toString(),role:"separator"},null,6)):n.createCommentVNode("",!0)],64)))),128))],10,o)};var u={name:"Menubar",props:{model:{type:Array,default:null},exact:{type:Boolean,default:!0}},outsideClickListener:null,data:()=>({mobileActive:!1}),beforeUnmount(){this.mobileActive=!1,this.unbindOutsideClickListener(),this.$refs.rootmenu&&this.$refs.rootmenu.$el&&e.ZIndexUtils.clear(this.$refs.rootmenu.$el)},methods:{toggle(t){this.mobileActive?(this.mobileActive=!1,e.ZIndexUtils.clear(this.$refs.rootmenu.$el)):(this.mobileActive=!0,e.ZIndexUtils.set("menu",this.$refs.rootmenu.$el,this.$primevue.config.zIndex.menu)),this.bindOutsideClickListener(),t.preventDefault()},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{!this.mobileActive||this.$refs.rootmenu.$el===e.target||this.$refs.rootmenu.$el.contains(e.target)||this.$refs.menubutton===e.target||this.$refs.menubutton.contains(e.target)||(this.mobileActive=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},onLeafClick(){this.mobileActive=!1}},computed:{containerClass(){return["p-menubar p-component",{"p-menubar-mobile-active":this.mobileActive}]}},components:{MenubarSub:l}};const d={key:0,class:"p-menubar-start"},p=[n.createElementVNode("i",{class:"pi pi-bars"},null,-1)],b={key:1,class:"p-menubar-end"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&i.firstChild?i.insertBefore(l,i.firstChild):i.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-menubar {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-menubar ul {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-menubar .p-menuitem-link {\n cursor: pointer;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n}\n.p-menubar .p-menuitem-text {\n line-height: 1;\n}\n.p-menubar .p-menuitem {\n position: relative;\n}\n.p-menubar-root-list {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-menubar-root-list > li ul {\n display: none;\n z-index: 1;\n}\n.p-menubar-root-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n}\n.p-menubar .p-submenu-list {\n display: none;\n position: absolute;\n z-index: 1;\n}\n.p-menubar .p-submenu-list > .p-menuitem-active > .p-submenu-list {\n display: block;\n left: 100%;\n top: 0;\n}\n.p-menubar .p-submenu-list .p-menuitem-link .p-submenu-icon {\n margin-left: auto;\n}\n.p-menubar .p-menubar-custom,\n.p-menubar .p-menubar-end {\n margin-left: auto;\n -ms-flex-item-align: center;\n align-self: center;\n}\n.p-menubar-button {\n display: none;\n cursor: pointer;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n text-decoration: none;\n}\n"),u.render=function(e,t,i,l,o,s){const a=n.resolveComponent("MenubarSub");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(s.containerClass)},[e.$slots.start?(n.openBlock(),n.createElementBlock("div",d,[n.renderSlot(e.$slots,"start")])):n.createCommentVNode("",!0),n.createElementVNode("a",{ref:"menubutton",tabindex:"0",class:"p-menubar-button",onClick:t[0]||(t[0]=e=>s.toggle(e))},p,512),n.createVNode(a,{ref:"rootmenu",model:i.model,root:!0,mobileActive:o.mobileActive,onLeafClick:s.onLeafClick,template:e.$slots.item,exact:i.exact},null,8,["model","mobileActive","onLeafClick","template","exact"]),e.$slots.end?(n.openBlock(),n.createElementBlock("div",b,[n.renderSlot(e.$slots,"end")])):n.createCommentVNode("",!0)],2)},module.exports=u;
|
package/menubar/menubar.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DomHandler, ZIndexUtils } from 'primevue/utils';
|
|
2
2
|
import Ripple from 'primevue/ripple';
|
|
3
|
-
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createBlock, withCtx, withDirectives, createElementVNode, toDisplayString,
|
|
3
|
+
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createBlock, withCtx, withDirectives, createCommentVNode, createElementVNode, toDisplayString, resolveDynamicComponent, renderSlot, createVNode } from 'vue';
|
|
4
4
|
|
|
5
5
|
var script$1 = {
|
|
6
6
|
name: 'MenubarSub',
|
|
@@ -89,7 +89,7 @@ var script$1 = {
|
|
|
89
89
|
if (this.activeItem && item === this.activeItem)
|
|
90
90
|
this.activeItem = null;
|
|
91
91
|
else
|
|
92
|
-
|
|
92
|
+
this.activeItem = item;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (!item.items) {
|
|
@@ -317,9 +317,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
317
317
|
onKeydown: $event => ($options.onItemKeyDown($event, item)),
|
|
318
318
|
role: "menuitem"
|
|
319
319
|
}, [
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
(item.icon)
|
|
321
|
+
? (openBlock(), createElementBlock("span", {
|
|
322
|
+
key: 0,
|
|
323
|
+
class: normalizeClass(['p-menuitem-icon', item.icon])
|
|
324
|
+
}, null, 2))
|
|
325
|
+
: createCommentVNode("", true),
|
|
323
326
|
createElementVNode("span", _hoisted_4$1, toDisplayString($options.label(item)), 1)
|
|
324
327
|
], 42, _hoisted_3$1)), [
|
|
325
328
|
[_directive_ripple]
|
|
@@ -339,13 +342,16 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
339
342
|
role: "menuitem",
|
|
340
343
|
tabindex: $options.disabled(item) ? null : '0'
|
|
341
344
|
}, [
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
+
(item.icon)
|
|
346
|
+
? (openBlock(), createElementBlock("span", {
|
|
347
|
+
key: 0,
|
|
348
|
+
class: normalizeClass(['p-menuitem-icon', item.icon])
|
|
349
|
+
}, null, 2))
|
|
350
|
+
: createCommentVNode("", true),
|
|
345
351
|
createElementVNode("span", _hoisted_6, toDisplayString($options.label(item)), 1),
|
|
346
352
|
(item.items)
|
|
347
353
|
? (openBlock(), createElementBlock("span", {
|
|
348
|
-
key:
|
|
354
|
+
key: 1,
|
|
349
355
|
class: normalizeClass($options.getSubmenuIcon())
|
|
350
356
|
}, null, 2))
|
|
351
357
|
: createCommentVNode("", true)
|