primevue 3.22.3 → 3.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/Accordion.vue +7 -3
- package/accordion/accordion.cjs.js +7 -3
- package/accordion/accordion.cjs.min.js +1 -1
- package/accordion/accordion.esm.js +8 -4
- package/accordion/accordion.esm.min.js +1 -1
- package/accordion/accordion.js +7 -3
- package/accordion/accordion.min.js +1 -1
- package/autocomplete/AutoComplete.vue +6 -3
- package/autocomplete/autocomplete.cjs.js +12 -9
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +13 -10
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +12 -9
- package/autocomplete/autocomplete.min.js +1 -1
- package/breadcrumb/Breadcrumb.vue +2 -2
- package/breadcrumb/breadcrumb.cjs.js +17 -10
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +17 -10
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +17 -10
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/cascadeselect/CascadeSelect.vue +6 -3
- package/cascadeselect/cascadeselect.cjs.js +9 -6
- package/cascadeselect/cascadeselect.cjs.min.js +1 -1
- package/cascadeselect/cascadeselect.esm.js +10 -7
- package/cascadeselect/cascadeselect.esm.min.js +1 -1
- package/cascadeselect/cascadeselect.js +9 -6
- package/cascadeselect/cascadeselect.min.js +1 -1
- package/contextmenu/ContextMenu.vue +6 -3
- package/contextmenu/contextmenu.cjs.js +8 -5
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +9 -6
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +8 -5
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +45 -33
- package/core/core.min.js +4 -4
- package/datatable/BodyCell.vue +4 -2
- package/datatable/datatable.cjs.js +4 -2
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +4 -2
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +4 -2
- package/datatable/datatable.min.js +1 -1
- package/dock/DockSub.vue +9 -3
- package/dock/dock.cjs.js +10 -4
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +11 -5
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +10 -4
- package/dock/dock.min.js +1 -1
- package/dropdown/Dropdown.vue +6 -3
- package/dropdown/dropdown.cjs.js +13 -10
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +14 -11
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +13 -10
- package/dropdown/dropdown.min.js +1 -1
- package/listbox/Listbox.vue +6 -3
- package/listbox/listbox.cjs.js +11 -8
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +12 -9
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +11 -8
- package/listbox/listbox.min.js +1 -1
- package/megamenu/MegaMenu.vue +7 -3
- package/megamenu/megamenu.cjs.js +10 -6
- package/megamenu/megamenu.cjs.min.js +1 -1
- package/megamenu/megamenu.esm.js +11 -7
- package/megamenu/megamenu.esm.min.js +1 -1
- package/megamenu/megamenu.js +10 -6
- package/megamenu/megamenu.min.js +1 -1
- package/menu/Menu.vue +8 -3
- package/menu/menu.cjs.js +13 -8
- package/menu/menu.cjs.min.js +1 -1
- package/menu/menu.esm.js +14 -9
- package/menu/menu.esm.min.js +1 -1
- package/menu/menu.js +13 -8
- package/menu/menu.min.js +1 -1
- package/menubar/Menubar.vue +7 -3
- package/menubar/menubar.cjs.js +10 -6
- package/menubar/menubar.cjs.min.js +1 -1
- package/menubar/menubar.esm.js +11 -7
- package/menubar/menubar.esm.min.js +1 -1
- package/menubar/menubar.js +10 -6
- package/menubar/menubar.min.js +1 -1
- package/multiselect/MultiSelect.vue +6 -3
- package/multiselect/multiselect.cjs.js +11 -8
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +12 -9
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +11 -8
- package/multiselect/multiselect.min.js +1 -1
- package/orderlist/OrderList.vue +8 -3
- package/orderlist/orderlist.cjs.js +11 -6
- package/orderlist/orderlist.cjs.min.js +1 -1
- package/orderlist/orderlist.esm.js +12 -7
- package/orderlist/orderlist.esm.min.js +1 -1
- package/orderlist/orderlist.js +11 -6
- package/orderlist/orderlist.min.js +1 -1
- package/package.json +1 -1
- package/panelmenu/PanelMenu.vue +9 -6
- package/panelmenu/PanelMenuList.vue +1 -1
- package/panelmenu/panelmenu.cjs.js +11 -8
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +11 -8
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +11 -8
- package/panelmenu/panelmenu.min.js +1 -1
- package/picklist/PickList.vue +8 -2
- package/picklist/picklist.cjs.js +8 -2
- package/picklist/picklist.cjs.min.js +1 -1
- package/picklist/picklist.esm.js +9 -3
- package/picklist/picklist.esm.min.js +1 -1
- package/picklist/picklist.js +8 -2
- package/picklist/picklist.min.js +1 -1
- package/rating/Rating.vue +9 -3
- package/rating/rating.cjs.js +11 -5
- package/rating/rating.cjs.min.js +1 -1
- package/rating/rating.esm.js +12 -6
- package/rating/rating.esm.min.js +1 -1
- package/rating/rating.js +11 -5
- package/rating/rating.min.js +1 -1
- package/resources/themes/arya-blue/theme.css +7 -0
- package/resources/themes/arya-green/theme.css +7 -0
- package/resources/themes/arya-orange/theme.css +7 -0
- package/resources/themes/arya-purple/theme.css +7 -0
- package/resources/themes/bootstrap4-dark-blue/theme.css +7 -0
- package/resources/themes/bootstrap4-dark-purple/theme.css +7 -0
- package/resources/themes/bootstrap4-light-blue/theme.css +7 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +7 -0
- package/resources/themes/fluent-light/theme.css +7 -0
- package/resources/themes/lara-dark-blue/theme.css +7 -0
- package/resources/themes/lara-dark-indigo/theme.css +7 -0
- package/resources/themes/lara-dark-purple/theme.css +7 -0
- package/resources/themes/lara-dark-teal/theme.css +7 -0
- package/resources/themes/lara-light-blue/theme.css +7 -0
- package/resources/themes/lara-light-indigo/theme.css +7 -0
- package/resources/themes/lara-light-purple/theme.css +7 -0
- package/resources/themes/lara-light-teal/theme.css +7 -0
- package/resources/themes/luna-amber/theme.css +7 -0
- package/resources/themes/luna-blue/theme.css +7 -0
- package/resources/themes/luna-green/theme.css +7 -0
- package/resources/themes/luna-pink/theme.css +7 -0
- package/resources/themes/md-dark-deeppurple/theme.css +10 -2
- package/resources/themes/md-dark-indigo/theme.css +10 -2
- package/resources/themes/md-light-deeppurple/theme.css +10 -2
- package/resources/themes/md-light-indigo/theme.css +10 -2
- package/resources/themes/mdc-dark-deeppurple/theme.css +10 -2
- package/resources/themes/mdc-dark-indigo/theme.css +10 -2
- package/resources/themes/mdc-light-deeppurple/theme.css +10 -2
- package/resources/themes/mdc-light-indigo/theme.css +10 -2
- package/resources/themes/nova/theme.css +7 -0
- package/resources/themes/nova-accent/theme.css +7 -0
- package/resources/themes/nova-alt/theme.css +7 -0
- package/resources/themes/nova-vue/theme.css +7 -0
- package/resources/themes/rhea/theme.css +7 -0
- package/resources/themes/saga-blue/theme.css +7 -0
- package/resources/themes/saga-green/theme.css +7 -0
- package/resources/themes/saga-orange/theme.css +7 -0
- package/resources/themes/saga-purple/theme.css +7 -0
- package/resources/themes/tailwind-light/theme.css +7 -0
- package/resources/themes/vela-blue/theme.css +7 -0
- package/resources/themes/vela-green/theme.css +7 -0
- package/resources/themes/vela-orange/theme.css +7 -0
- package/resources/themes/vela-purple/theme.css +7 -0
- package/speeddial/SpeedDial.vue +6 -3
- package/speeddial/speeddial.cjs.js +11 -8
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +12 -9
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +11 -8
- package/speeddial/speeddial.min.js +1 -1
- package/tabview/TabView.vue +6 -3
- package/tabview/tabview.cjs.js +6 -3
- package/tabview/tabview.cjs.min.js +1 -1
- package/tabview/tabview.esm.js +7 -4
- package/tabview/tabview.esm.min.js +1 -1
- package/tabview/tabview.js +6 -3
- package/tabview/tabview.min.js +1 -1
- package/tieredmenu/TieredMenu.vue +7 -3
- package/tieredmenu/tieredmenu.cjs.js +10 -6
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +11 -7
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +10 -6
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/utils/utils.cjs.js +9 -9
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +9 -9
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +9 -9
- package/utils/utils.min.js +1 -1
- package/web-types.json +1 -1
package/accordion/Accordion.vue
CHANGED
|
@@ -78,14 +78,21 @@ export default {
|
|
|
78
78
|
},
|
|
79
79
|
data() {
|
|
80
80
|
return {
|
|
81
|
+
id: this.$attrs.id,
|
|
81
82
|
d_activeIndex: this.activeIndex
|
|
82
83
|
};
|
|
83
84
|
},
|
|
84
85
|
watch: {
|
|
86
|
+
'$attrs.id': function (newValue) {
|
|
87
|
+
this.id = newValue || UniqueComponentId();
|
|
88
|
+
},
|
|
85
89
|
activeIndex(newValue) {
|
|
86
90
|
this.d_activeIndex = newValue;
|
|
87
91
|
}
|
|
88
92
|
},
|
|
93
|
+
mounted() {
|
|
94
|
+
this.id = this.id || UniqueComponentId();
|
|
95
|
+
},
|
|
89
96
|
methods: {
|
|
90
97
|
isAccordionTab(child) {
|
|
91
98
|
return child.type.name === 'AccordionTab';
|
|
@@ -255,9 +262,6 @@ export default {
|
|
|
255
262
|
|
|
256
263
|
return tabs;
|
|
257
264
|
}, []);
|
|
258
|
-
},
|
|
259
|
-
id() {
|
|
260
|
-
return this.$attrs.id || UniqueComponentId();
|
|
261
265
|
}
|
|
262
266
|
},
|
|
263
267
|
directives: {
|
|
@@ -43,14 +43,21 @@ var script = {
|
|
|
43
43
|
},
|
|
44
44
|
data() {
|
|
45
45
|
return {
|
|
46
|
+
id: this.$attrs.id,
|
|
46
47
|
d_activeIndex: this.activeIndex
|
|
47
48
|
};
|
|
48
49
|
},
|
|
49
50
|
watch: {
|
|
51
|
+
'$attrs.id': function (newValue) {
|
|
52
|
+
this.id = newValue || utils.UniqueComponentId();
|
|
53
|
+
},
|
|
50
54
|
activeIndex(newValue) {
|
|
51
55
|
this.d_activeIndex = newValue;
|
|
52
56
|
}
|
|
53
57
|
},
|
|
58
|
+
mounted() {
|
|
59
|
+
this.id = this.id || utils.UniqueComponentId();
|
|
60
|
+
},
|
|
54
61
|
methods: {
|
|
55
62
|
isAccordionTab(child) {
|
|
56
63
|
return child.type.name === 'AccordionTab';
|
|
@@ -217,9 +224,6 @@ var script = {
|
|
|
217
224
|
|
|
218
225
|
return tabs;
|
|
219
226
|
}, []);
|
|
220
|
-
},
|
|
221
|
-
id() {
|
|
222
|
-
return this.$attrs.id || utils.UniqueComponentId();
|
|
223
227
|
}
|
|
224
228
|
},
|
|
225
229
|
directives: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/ripple"),t=require("primevue/utils"),n=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"Accordion",emits:["update:activeIndex","tab-open","tab-close","tab-click"],props:{multiple:{type:Boolean,default:!1},activeIndex:{type:[Number,Array],default:null},lazy:{type:Boolean,default:!1},expandIcon:{type:String,default:"pi pi-chevron-right"},collapseIcon:{type:String,default:"pi pi-chevron-down"},tabindex:{type:Number,default:0},selectOnFocus:{type:Boolean,default:!1}},data(){return{d_activeIndex:this.activeIndex}},watch:{activeIndex(e){this.d_activeIndex=e}},methods:{isAccordionTab:e=>"AccordionTab"===e.type.name,isTabActive(e){return this.multiple?this.d_activeIndex&&this.d_activeIndex.includes(e):this.d_activeIndex===e},getTabProp:(e,t)=>e.props?e.props[t]:void 0,getKey(e,t){return this.getTabProp(e,"header")||t},getTabHeaderActionId(e){return`${this.id}_${e}_header_action`},getTabContentId(e){return`${this.id}_${e}_content`},onTabClick(e,t,n){this.changeActiveIndex(e,t,n),this.$emit("tab-click",{originalEvent:e,index:n})},onTabKeyDown(e,t,n){switch(e.code){case"ArrowDown":this.onTabArrowDownKey(e);break;case"ArrowUp":this.onTabArrowUpKey(e);break;case"Home":this.onTabHomeKey(e);break;case"End":this.onTabEndKey(e);break;case"Enter":case"Space":this.onTabEnterKey(e,t,n)}},onTabArrowDownKey(e){const t=this.findNextHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabHomeKey(e),e.preventDefault()},onTabArrowUpKey(e){const t=this.findPrevHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabEndKey(e),e.preventDefault()},onTabHomeKey(e){const t=this.findFirstHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEndKey(e){const t=this.findLastHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEnterKey(e,t,n){this.changeActiveIndex(e,t,n),e.preventDefault()},findNextHeaderAction(e,n=!1){const a=n?e:e.nextElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findNextHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findPrevHeaderAction(e,n=!1){const a=n?e:e.previousElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findPrevHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findFirstHeaderAction(){return this.findNextHeaderAction(this.$el.firstElementChild,!0)},findLastHeaderAction(){return this.findPrevHeaderAction(this.$el.lastElementChild,!0)},changeActiveIndex(e,t,n){if(!this.getTabProp(t,"disabled")){const t=this.isTabActive(n),a=t?"tab-close":"tab-open";this.multiple?t?this.d_activeIndex=this.d_activeIndex.filter((e=>e!==n)):this.d_activeIndex?this.d_activeIndex.push(n):this.d_activeIndex=[n]:this.d_activeIndex=this.d_activeIndex===n?null:n,this.$emit("update:activeIndex",this.d_activeIndex),this.$emit(a,{originalEvent:e,index:n})}},changeFocusedTab(e,n){if(n&&(t.DomHandler.focus(n),this.selectOnFocus)){const t=parseInt(n.parentElement.parentElement.dataset.index,10),a=this.tabs[t];this.changeActiveIndex(e,a,t)}},getTabClass(e){return["p-accordion-tab",{"p-accordion-tab-active":this.isTabActive(e)}]},getTabHeaderClass(e,t){return["p-accordion-header",this.getTabProp(e,"headerClass"),{"p-highlight":this.isTabActive(t),"p-disabled":this.getTabProp(e,"disabled")}]},getTabHeaderIconClass(e){return["p-accordion-toggle-icon",this.isTabActive(e)?this.collapseIcon:this.expandIcon]},getTabContentClass(e){return["p-toggleable-content",this.getTabProp(e,"contentClass")]}},computed:{tabs(){return this.$slots.default().reduce(((e,t)=>(this.isAccordionTab(t)?e.push(t):t.children&&t.children instanceof Array&&t.children.forEach((t=>{this.isAccordionTab(t)&&e.push(t)})),e)),[])}
|
|
1
|
+
"use strict";var e=require("primevue/ripple"),t=require("primevue/utils"),n=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"Accordion",emits:["update:activeIndex","tab-open","tab-close","tab-click"],props:{multiple:{type:Boolean,default:!1},activeIndex:{type:[Number,Array],default:null},lazy:{type:Boolean,default:!1},expandIcon:{type:String,default:"pi pi-chevron-right"},collapseIcon:{type:String,default:"pi pi-chevron-down"},tabindex:{type:Number,default:0},selectOnFocus:{type:Boolean,default:!1}},data(){return{id:this.$attrs.id,d_activeIndex:this.activeIndex}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeIndex(e){this.d_activeIndex=e}},mounted(){this.id=this.id||t.UniqueComponentId()},methods:{isAccordionTab:e=>"AccordionTab"===e.type.name,isTabActive(e){return this.multiple?this.d_activeIndex&&this.d_activeIndex.includes(e):this.d_activeIndex===e},getTabProp:(e,t)=>e.props?e.props[t]:void 0,getKey(e,t){return this.getTabProp(e,"header")||t},getTabHeaderActionId(e){return`${this.id}_${e}_header_action`},getTabContentId(e){return`${this.id}_${e}_content`},onTabClick(e,t,n){this.changeActiveIndex(e,t,n),this.$emit("tab-click",{originalEvent:e,index:n})},onTabKeyDown(e,t,n){switch(e.code){case"ArrowDown":this.onTabArrowDownKey(e);break;case"ArrowUp":this.onTabArrowUpKey(e);break;case"Home":this.onTabHomeKey(e);break;case"End":this.onTabEndKey(e);break;case"Enter":case"Space":this.onTabEnterKey(e,t,n)}},onTabArrowDownKey(e){const t=this.findNextHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabHomeKey(e),e.preventDefault()},onTabArrowUpKey(e){const t=this.findPrevHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabEndKey(e),e.preventDefault()},onTabHomeKey(e){const t=this.findFirstHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEndKey(e){const t=this.findLastHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEnterKey(e,t,n){this.changeActiveIndex(e,t,n),e.preventDefault()},findNextHeaderAction(e,n=!1){const a=n?e:e.nextElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findNextHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findPrevHeaderAction(e,n=!1){const a=n?e:e.previousElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findPrevHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findFirstHeaderAction(){return this.findNextHeaderAction(this.$el.firstElementChild,!0)},findLastHeaderAction(){return this.findPrevHeaderAction(this.$el.lastElementChild,!0)},changeActiveIndex(e,t,n){if(!this.getTabProp(t,"disabled")){const t=this.isTabActive(n),a=t?"tab-close":"tab-open";this.multiple?t?this.d_activeIndex=this.d_activeIndex.filter((e=>e!==n)):this.d_activeIndex?this.d_activeIndex.push(n):this.d_activeIndex=[n]:this.d_activeIndex=this.d_activeIndex===n?null:n,this.$emit("update:activeIndex",this.d_activeIndex),this.$emit(a,{originalEvent:e,index:n})}},changeFocusedTab(e,n){if(n&&(t.DomHandler.focus(n),this.selectOnFocus)){const t=parseInt(n.parentElement.parentElement.dataset.index,10),a=this.tabs[t];this.changeActiveIndex(e,a,t)}},getTabClass(e){return["p-accordion-tab",{"p-accordion-tab-active":this.isTabActive(e)}]},getTabHeaderClass(e,t){return["p-accordion-header",this.getTabProp(e,"headerClass"),{"p-highlight":this.isTabActive(t),"p-disabled":this.getTabProp(e,"disabled")}]},getTabHeaderIconClass(e){return["p-accordion-toggle-icon",this.isTabActive(e)?this.collapseIcon:this.expandIcon]},getTabContentClass(e){return["p-toggleable-content",this.getTabProp(e,"contentClass")]}},computed:{tabs(){return this.$slots.default().reduce(((e,t)=>(this.isAccordionTab(t)?e.push(t):t.children&&t.children instanceof Array&&t.children.forEach((t=>{this.isAccordionTab(t)&&e.push(t)})),e)),[])}},directives:{ripple:a(e).default}};const o={class:"p-accordion p-component"},r=["data-index"],d=["id","tabindex","aria-disabled","aria-expanded","aria-controls","onClick","onKeydown"],c={key:0,class:"p-accordion-header-text"},s=["id","aria-labelledby"],l={class:"p-accordion-content"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-accordion-header-action {\n cursor: pointer;\n display: flex;\n align-items: center;\n user-select: none;\n position: relative;\n text-decoration: none;\n}\n.p-accordion-header-action:focus {\n z-index: 1;\n}\n.p-accordion-header-text {\n line-height: 1;\n}\n"),i.render=function(e,t,a,i,p,h){return n.openBlock(),n.createElementBlock("div",o,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.tabs,((e,t)=>(n.openBlock(),n.createElementBlock("div",{key:h.getKey(e,t),class:n.normalizeClass(h.getTabClass(t)),"data-index":t},[n.createElementVNode("div",n.mergeProps({style:h.getTabProp(e,"headerStyle"),class:h.getTabHeaderClass(e,t)},h.getTabProp(e,"headerProps")),[n.createElementVNode("a",n.mergeProps({id:h.getTabHeaderActionId(t),class:"p-accordion-header-link p-accordion-header-action",tabindex:h.getTabProp(e,"disabled")?-1:a.tabindex,role:"button","aria-disabled":h.getTabProp(e,"disabled"),"aria-expanded":h.isTabActive(t),"aria-controls":h.getTabContentId(t),onClick:n=>h.onTabClick(n,e,t),onKeydown:n=>h.onTabKeyDown(n,e,t)},h.getTabProp(e,"headerActionProps")),[n.createElementVNode("span",{class:n.normalizeClass(h.getTabHeaderIconClass(t)),"aria-hidden":"true"},null,2),e.props&&e.props.header?(n.openBlock(),n.createElementBlock("span",c,n.toDisplayString(e.props.header),1)):n.createCommentVNode("",!0),e.children&&e.children.header?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.children.header),{key:1})):n.createCommentVNode("",!0)],16,d)],16),n.createVNode(n.Transition,{name:"p-toggleable-content"},{default:n.withCtx((()=>[!a.lazy||h.isTabActive(t)?n.withDirectives((n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,id:h.getTabContentId(t),style:h.getTabProp(e,"contentStyle"),class:h.getTabContentClass(e),role:"region","aria-labelledby":h.getTabHeaderActionId(t)},h.getTabProp(e,"contentProps")),[n.createElementVNode("div",l,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e)))])],16,s)),[[n.vShow,!!a.lazy||h.isTabActive(t)]]):n.createCommentVNode("",!0)])),_:2},1024)],10,r)))),128))])},module.exports=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Ripple from 'primevue/ripple';
|
|
2
|
-
import {
|
|
2
|
+
import { UniqueComponentId, DomHandler } from 'primevue/utils';
|
|
3
3
|
import { openBlock, createElementBlock, Fragment, renderList, normalizeClass, createElementVNode, mergeProps, toDisplayString, createCommentVNode, createBlock, resolveDynamicComponent, createVNode, Transition, withCtx, withDirectives, vShow } from 'vue';
|
|
4
4
|
|
|
5
5
|
var script = {
|
|
@@ -37,14 +37,21 @@ var script = {
|
|
|
37
37
|
},
|
|
38
38
|
data() {
|
|
39
39
|
return {
|
|
40
|
+
id: this.$attrs.id,
|
|
40
41
|
d_activeIndex: this.activeIndex
|
|
41
42
|
};
|
|
42
43
|
},
|
|
43
44
|
watch: {
|
|
45
|
+
'$attrs.id': function (newValue) {
|
|
46
|
+
this.id = newValue || UniqueComponentId();
|
|
47
|
+
},
|
|
44
48
|
activeIndex(newValue) {
|
|
45
49
|
this.d_activeIndex = newValue;
|
|
46
50
|
}
|
|
47
51
|
},
|
|
52
|
+
mounted() {
|
|
53
|
+
this.id = this.id || UniqueComponentId();
|
|
54
|
+
},
|
|
48
55
|
methods: {
|
|
49
56
|
isAccordionTab(child) {
|
|
50
57
|
return child.type.name === 'AccordionTab';
|
|
@@ -211,9 +218,6 @@ var script = {
|
|
|
211
218
|
|
|
212
219
|
return tabs;
|
|
213
220
|
}, []);
|
|
214
|
-
},
|
|
215
|
-
id() {
|
|
216
|
-
return this.$attrs.id || UniqueComponentId();
|
|
217
221
|
}
|
|
218
222
|
},
|
|
219
223
|
directives: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"primevue/ripple";import{
|
|
1
|
+
import e from"primevue/ripple";import{UniqueComponentId as t,DomHandler as n}from"primevue/utils";import{openBlock as a,createElementBlock as i,Fragment as d,renderList as o,normalizeClass as r,createElementVNode as s,mergeProps as c,toDisplayString as l,createCommentVNode as h,createBlock as p,resolveDynamicComponent as b,createVNode as u,Transition as g,withCtx as T,withDirectives as v,vShow as f}from"vue";var m={name:"Accordion",emits:["update:activeIndex","tab-open","tab-close","tab-click"],props:{multiple:{type:Boolean,default:!1},activeIndex:{type:[Number,Array],default:null},lazy:{type:Boolean,default:!1},expandIcon:{type:String,default:"pi pi-chevron-right"},collapseIcon:{type:String,default:"pi pi-chevron-down"},tabindex:{type:Number,default:0},selectOnFocus:{type:Boolean,default:!1}},data(){return{id:this.$attrs.id,d_activeIndex:this.activeIndex}},watch:{"$attrs.id":function(e){this.id=e||t()},activeIndex(e){this.d_activeIndex=e}},mounted(){this.id=this.id||t()},methods:{isAccordionTab:e=>"AccordionTab"===e.type.name,isTabActive(e){return this.multiple?this.d_activeIndex&&this.d_activeIndex.includes(e):this.d_activeIndex===e},getTabProp:(e,t)=>e.props?e.props[t]:void 0,getKey(e,t){return this.getTabProp(e,"header")||t},getTabHeaderActionId(e){return`${this.id}_${e}_header_action`},getTabContentId(e){return`${this.id}_${e}_content`},onTabClick(e,t,n){this.changeActiveIndex(e,t,n),this.$emit("tab-click",{originalEvent:e,index:n})},onTabKeyDown(e,t,n){switch(e.code){case"ArrowDown":this.onTabArrowDownKey(e);break;case"ArrowUp":this.onTabArrowUpKey(e);break;case"Home":this.onTabHomeKey(e);break;case"End":this.onTabEndKey(e);break;case"Enter":case"Space":this.onTabEnterKey(e,t,n)}},onTabArrowDownKey(e){const t=this.findNextHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabHomeKey(e),e.preventDefault()},onTabArrowUpKey(e){const t=this.findPrevHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabEndKey(e),e.preventDefault()},onTabHomeKey(e){const t=this.findFirstHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEndKey(e){const t=this.findLastHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEnterKey(e,t,n){this.changeActiveIndex(e,t,n),e.preventDefault()},findNextHeaderAction(e,t=!1){const a=t?e:e.nextElementSibling,i=n.findSingle(a,".p-accordion-header");return i?n.hasClass(i,"p-disabled")?this.findNextHeaderAction(i.parentElement):n.findSingle(i,".p-accordion-header-action"):null},findPrevHeaderAction(e,t=!1){const a=t?e:e.previousElementSibling,i=n.findSingle(a,".p-accordion-header");return i?n.hasClass(i,"p-disabled")?this.findPrevHeaderAction(i.parentElement):n.findSingle(i,".p-accordion-header-action"):null},findFirstHeaderAction(){return this.findNextHeaderAction(this.$el.firstElementChild,!0)},findLastHeaderAction(){return this.findPrevHeaderAction(this.$el.lastElementChild,!0)},changeActiveIndex(e,t,n){if(!this.getTabProp(t,"disabled")){const t=this.isTabActive(n),a=t?"tab-close":"tab-open";this.multiple?t?this.d_activeIndex=this.d_activeIndex.filter((e=>e!==n)):this.d_activeIndex?this.d_activeIndex.push(n):this.d_activeIndex=[n]:this.d_activeIndex=this.d_activeIndex===n?null:n,this.$emit("update:activeIndex",this.d_activeIndex),this.$emit(a,{originalEvent:e,index:n})}},changeFocusedTab(e,t){if(t&&(n.focus(t),this.selectOnFocus)){const n=parseInt(t.parentElement.parentElement.dataset.index,10),a=this.tabs[n];this.changeActiveIndex(e,a,n)}},getTabClass(e){return["p-accordion-tab",{"p-accordion-tab-active":this.isTabActive(e)}]},getTabHeaderClass(e,t){return["p-accordion-header",this.getTabProp(e,"headerClass"),{"p-highlight":this.isTabActive(t),"p-disabled":this.getTabProp(e,"disabled")}]},getTabHeaderIconClass(e){return["p-accordion-toggle-icon",this.isTabActive(e)?this.collapseIcon:this.expandIcon]},getTabContentClass(e){return["p-toggleable-content",this.getTabProp(e,"contentClass")]}},computed:{tabs(){return this.$slots.default().reduce(((e,t)=>(this.isAccordionTab(t)?e.push(t):t.children&&t.children instanceof Array&&t.children.forEach((t=>{this.isAccordionTab(t)&&e.push(t)})),e)),[])}},directives:{ripple:e}};const x={class:"p-accordion p-component"},y=["data-index"],A=["id","tabindex","aria-disabled","aria-expanded","aria-controls","onClick","onKeydown"],I={key:0,class:"p-accordion-header-text"},C=["id","aria-labelledby"],E={class:"p-accordion-content"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-accordion-header-action {\n cursor: pointer;\n display: flex;\n align-items: center;\n user-select: none;\n position: relative;\n text-decoration: none;\n}\n.p-accordion-header-action:focus {\n z-index: 1;\n}\n.p-accordion-header-text {\n line-height: 1;\n}\n"),m.render=function(e,t,n,m,H,P){return a(),i("div",x,[(a(!0),i(d,null,o(P.tabs,((e,t)=>(a(),i("div",{key:P.getKey(e,t),class:r(P.getTabClass(t)),"data-index":t},[s("div",c({style:P.getTabProp(e,"headerStyle"),class:P.getTabHeaderClass(e,t)},P.getTabProp(e,"headerProps")),[s("a",c({id:P.getTabHeaderActionId(t),class:"p-accordion-header-link p-accordion-header-action",tabindex:P.getTabProp(e,"disabled")?-1:n.tabindex,role:"button","aria-disabled":P.getTabProp(e,"disabled"),"aria-expanded":P.isTabActive(t),"aria-controls":P.getTabContentId(t),onClick:n=>P.onTabClick(n,e,t),onKeydown:n=>P.onTabKeyDown(n,e,t)},P.getTabProp(e,"headerActionProps")),[s("span",{class:r(P.getTabHeaderIconClass(t)),"aria-hidden":"true"},null,2),e.props&&e.props.header?(a(),i("span",I,l(e.props.header),1)):h("",!0),e.children&&e.children.header?(a(),p(b(e.children.header),{key:1})):h("",!0)],16,A)],16),u(g,{name:"p-toggleable-content"},{default:T((()=>[!n.lazy||P.isTabActive(t)?v((a(),i("div",c({key:0,id:P.getTabContentId(t),style:P.getTabProp(e,"contentStyle"),class:P.getTabContentClass(e),role:"region","aria-labelledby":P.getTabHeaderActionId(t)},P.getTabProp(e,"contentProps")),[s("div",E,[(a(),p(b(e)))])],16,C)),[[f,!!n.lazy||P.isTabActive(t)]]):h("",!0)])),_:2},1024)],10,y)))),128))])};export{m as default};
|
package/accordion/accordion.js
CHANGED
|
@@ -41,14 +41,21 @@ this.primevue.accordion = (function (Ripple, utils, vue) {
|
|
|
41
41
|
},
|
|
42
42
|
data() {
|
|
43
43
|
return {
|
|
44
|
+
id: this.$attrs.id,
|
|
44
45
|
d_activeIndex: this.activeIndex
|
|
45
46
|
};
|
|
46
47
|
},
|
|
47
48
|
watch: {
|
|
49
|
+
'$attrs.id': function (newValue) {
|
|
50
|
+
this.id = newValue || utils.UniqueComponentId();
|
|
51
|
+
},
|
|
48
52
|
activeIndex(newValue) {
|
|
49
53
|
this.d_activeIndex = newValue;
|
|
50
54
|
}
|
|
51
55
|
},
|
|
56
|
+
mounted() {
|
|
57
|
+
this.id = this.id || utils.UniqueComponentId();
|
|
58
|
+
},
|
|
52
59
|
methods: {
|
|
53
60
|
isAccordionTab(child) {
|
|
54
61
|
return child.type.name === 'AccordionTab';
|
|
@@ -215,9 +222,6 @@ this.primevue.accordion = (function (Ripple, utils, vue) {
|
|
|
215
222
|
|
|
216
223
|
return tabs;
|
|
217
224
|
}, []);
|
|
218
|
-
},
|
|
219
|
-
id() {
|
|
220
|
-
return this.$attrs.id || utils.UniqueComponentId();
|
|
221
225
|
}
|
|
222
226
|
},
|
|
223
227
|
directives: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.accordion=function(e,t,n){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"Accordion",emits:["update:activeIndex","tab-open","tab-close","tab-click"],props:{multiple:{type:Boolean,default:!1},activeIndex:{type:[Number,Array],default:null},lazy:{type:Boolean,default:!1},expandIcon:{type:String,default:"pi pi-chevron-right"},collapseIcon:{type:String,default:"pi pi-chevron-down"},tabindex:{type:Number,default:0},selectOnFocus:{type:Boolean,default:!1}},data(){return{d_activeIndex:this.activeIndex}},watch:{activeIndex(e){this.d_activeIndex=e}},methods:{isAccordionTab:e=>"AccordionTab"===e.type.name,isTabActive(e){return this.multiple?this.d_activeIndex&&this.d_activeIndex.includes(e):this.d_activeIndex===e},getTabProp:(e,t)=>e.props?e.props[t]:void 0,getKey(e,t){return this.getTabProp(e,"header")||t},getTabHeaderActionId(e){return`${this.id}_${e}_header_action`},getTabContentId(e){return`${this.id}_${e}_content`},onTabClick(e,t,n){this.changeActiveIndex(e,t,n),this.$emit("tab-click",{originalEvent:e,index:n})},onTabKeyDown(e,t,n){switch(e.code){case"ArrowDown":this.onTabArrowDownKey(e);break;case"ArrowUp":this.onTabArrowUpKey(e);break;case"Home":this.onTabHomeKey(e);break;case"End":this.onTabEndKey(e);break;case"Enter":case"Space":this.onTabEnterKey(e,t,n)}},onTabArrowDownKey(e){const t=this.findNextHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabHomeKey(e),e.preventDefault()},onTabArrowUpKey(e){const t=this.findPrevHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabEndKey(e),e.preventDefault()},onTabHomeKey(e){const t=this.findFirstHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEndKey(e){const t=this.findLastHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEnterKey(e,t,n){this.changeActiveIndex(e,t,n),e.preventDefault()},findNextHeaderAction(e,n=!1){const a=n?e:e.nextElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findNextHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findPrevHeaderAction(e,n=!1){const a=n?e:e.previousElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findPrevHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findFirstHeaderAction(){return this.findNextHeaderAction(this.$el.firstElementChild,!0)},findLastHeaderAction(){return this.findPrevHeaderAction(this.$el.lastElementChild,!0)},changeActiveIndex(e,t,n){if(!this.getTabProp(t,"disabled")){const t=this.isTabActive(n),a=t?"tab-close":"tab-open";this.multiple?t?this.d_activeIndex=this.d_activeIndex.filter((e=>e!==n)):this.d_activeIndex?this.d_activeIndex.push(n):this.d_activeIndex=[n]:this.d_activeIndex=this.d_activeIndex===n?null:n,this.$emit("update:activeIndex",this.d_activeIndex),this.$emit(a,{originalEvent:e,index:n})}},changeFocusedTab(e,n){if(n&&(t.DomHandler.focus(n),this.selectOnFocus)){const t=parseInt(n.parentElement.parentElement.dataset.index,10),a=this.tabs[t];this.changeActiveIndex(e,a,t)}},getTabClass(e){return["p-accordion-tab",{"p-accordion-tab-active":this.isTabActive(e)}]},getTabHeaderClass(e,t){return["p-accordion-header",this.getTabProp(e,"headerClass"),{"p-highlight":this.isTabActive(t),"p-disabled":this.getTabProp(e,"disabled")}]},getTabHeaderIconClass(e){return["p-accordion-toggle-icon",this.isTabActive(e)?this.collapseIcon:this.expandIcon]},getTabContentClass(e){return["p-toggleable-content",this.getTabProp(e,"contentClass")]}},computed:{tabs(){return this.$slots.default().reduce(((e,t)=>(this.isAccordionTab(t)?e.push(t):t.children&&t.children instanceof Array&&t.children.forEach((t=>{this.isAccordionTab(t)&&e.push(t)})),e)),[])}
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.accordion=function(e,t,n){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i={name:"Accordion",emits:["update:activeIndex","tab-open","tab-close","tab-click"],props:{multiple:{type:Boolean,default:!1},activeIndex:{type:[Number,Array],default:null},lazy:{type:Boolean,default:!1},expandIcon:{type:String,default:"pi pi-chevron-right"},collapseIcon:{type:String,default:"pi pi-chevron-down"},tabindex:{type:Number,default:0},selectOnFocus:{type:Boolean,default:!1}},data(){return{id:this.$attrs.id,d_activeIndex:this.activeIndex}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeIndex(e){this.d_activeIndex=e}},mounted(){this.id=this.id||t.UniqueComponentId()},methods:{isAccordionTab:e=>"AccordionTab"===e.type.name,isTabActive(e){return this.multiple?this.d_activeIndex&&this.d_activeIndex.includes(e):this.d_activeIndex===e},getTabProp:(e,t)=>e.props?e.props[t]:void 0,getKey(e,t){return this.getTabProp(e,"header")||t},getTabHeaderActionId(e){return`${this.id}_${e}_header_action`},getTabContentId(e){return`${this.id}_${e}_content`},onTabClick(e,t,n){this.changeActiveIndex(e,t,n),this.$emit("tab-click",{originalEvent:e,index:n})},onTabKeyDown(e,t,n){switch(e.code){case"ArrowDown":this.onTabArrowDownKey(e);break;case"ArrowUp":this.onTabArrowUpKey(e);break;case"Home":this.onTabHomeKey(e);break;case"End":this.onTabEndKey(e);break;case"Enter":case"Space":this.onTabEnterKey(e,t,n)}},onTabArrowDownKey(e){const t=this.findNextHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabHomeKey(e),e.preventDefault()},onTabArrowUpKey(e){const t=this.findPrevHeaderAction(e.target.parentElement.parentElement);t?this.changeFocusedTab(e,t):this.onTabEndKey(e),e.preventDefault()},onTabHomeKey(e){const t=this.findFirstHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEndKey(e){const t=this.findLastHeaderAction();this.changeFocusedTab(e,t),e.preventDefault()},onTabEnterKey(e,t,n){this.changeActiveIndex(e,t,n),e.preventDefault()},findNextHeaderAction(e,n=!1){const a=n?e:e.nextElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findNextHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findPrevHeaderAction(e,n=!1){const a=n?e:e.previousElementSibling,i=t.DomHandler.findSingle(a,".p-accordion-header");return i?t.DomHandler.hasClass(i,"p-disabled")?this.findPrevHeaderAction(i.parentElement):t.DomHandler.findSingle(i,".p-accordion-header-action"):null},findFirstHeaderAction(){return this.findNextHeaderAction(this.$el.firstElementChild,!0)},findLastHeaderAction(){return this.findPrevHeaderAction(this.$el.lastElementChild,!0)},changeActiveIndex(e,t,n){if(!this.getTabProp(t,"disabled")){const t=this.isTabActive(n),a=t?"tab-close":"tab-open";this.multiple?t?this.d_activeIndex=this.d_activeIndex.filter((e=>e!==n)):this.d_activeIndex?this.d_activeIndex.push(n):this.d_activeIndex=[n]:this.d_activeIndex=this.d_activeIndex===n?null:n,this.$emit("update:activeIndex",this.d_activeIndex),this.$emit(a,{originalEvent:e,index:n})}},changeFocusedTab(e,n){if(n&&(t.DomHandler.focus(n),this.selectOnFocus)){const t=parseInt(n.parentElement.parentElement.dataset.index,10),a=this.tabs[t];this.changeActiveIndex(e,a,t)}},getTabClass(e){return["p-accordion-tab",{"p-accordion-tab-active":this.isTabActive(e)}]},getTabHeaderClass(e,t){return["p-accordion-header",this.getTabProp(e,"headerClass"),{"p-highlight":this.isTabActive(t),"p-disabled":this.getTabProp(e,"disabled")}]},getTabHeaderIconClass(e){return["p-accordion-toggle-icon",this.isTabActive(e)?this.collapseIcon:this.expandIcon]},getTabContentClass(e){return["p-toggleable-content",this.getTabProp(e,"contentClass")]}},computed:{tabs(){return this.$slots.default().reduce(((e,t)=>(this.isAccordionTab(t)?e.push(t):t.children&&t.children instanceof Array&&t.children.forEach((t=>{this.isAccordionTab(t)&&e.push(t)})),e)),[])}},directives:{ripple:a(e).default}};const o={class:"p-accordion p-component"},r=["data-index"],d=["id","tabindex","aria-disabled","aria-expanded","aria-controls","onClick","onKeydown"],c={key:0,class:"p-accordion-header-text"},s=["id","aria-labelledby"],l={class:"p-accordion-content"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-accordion-header-action {\n cursor: pointer;\n display: flex;\n align-items: center;\n user-select: none;\n position: relative;\n text-decoration: none;\n}\n.p-accordion-header-action:focus {\n z-index: 1;\n}\n.p-accordion-header-text {\n line-height: 1;\n}\n"),i.render=function(e,t,a,i,p,h){return n.openBlock(),n.createElementBlock("div",o,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(h.tabs,((e,t)=>(n.openBlock(),n.createElementBlock("div",{key:h.getKey(e,t),class:n.normalizeClass(h.getTabClass(t)),"data-index":t},[n.createElementVNode("div",n.mergeProps({style:h.getTabProp(e,"headerStyle"),class:h.getTabHeaderClass(e,t)},h.getTabProp(e,"headerProps")),[n.createElementVNode("a",n.mergeProps({id:h.getTabHeaderActionId(t),class:"p-accordion-header-link p-accordion-header-action",tabindex:h.getTabProp(e,"disabled")?-1:a.tabindex,role:"button","aria-disabled":h.getTabProp(e,"disabled"),"aria-expanded":h.isTabActive(t),"aria-controls":h.getTabContentId(t),onClick:n=>h.onTabClick(n,e,t),onKeydown:n=>h.onTabKeyDown(n,e,t)},h.getTabProp(e,"headerActionProps")),[n.createElementVNode("span",{class:n.normalizeClass(h.getTabHeaderIconClass(t)),"aria-hidden":"true"},null,2),e.props&&e.props.header?(n.openBlock(),n.createElementBlock("span",c,n.toDisplayString(e.props.header),1)):n.createCommentVNode("",!0),e.children&&e.children.header?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e.children.header),{key:1})):n.createCommentVNode("",!0)],16,d)],16),n.createVNode(n.Transition,{name:"p-toggleable-content"},{default:n.withCtx((()=>[!a.lazy||h.isTabActive(t)?n.withDirectives((n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,id:h.getTabContentId(t),style:h.getTabProp(e,"contentStyle"),class:h.getTabContentClass(e),role:"region","aria-labelledby":h.getTabHeaderActionId(t)},h.getTabProp(e,"contentProps")),[n.createElementVNode("div",l,[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(e)))])],16,s)),[[n.vShow,!!a.lazy||h.isTabActive(t)]]):n.createCommentVNode("",!0)])),_:2},1024)],10,r)))),128))])},i}(primevue.ripple,primevue.utils,Vue);
|
|
@@ -316,6 +316,7 @@ export default {
|
|
|
316
316
|
dirty: false,
|
|
317
317
|
data() {
|
|
318
318
|
return {
|
|
319
|
+
id: this.$attrs.id,
|
|
319
320
|
focused: false,
|
|
320
321
|
focusedOptionIndex: -1,
|
|
321
322
|
focusedMultipleOptionIndex: -1,
|
|
@@ -324,6 +325,9 @@ export default {
|
|
|
324
325
|
};
|
|
325
326
|
},
|
|
326
327
|
watch: {
|
|
328
|
+
'$attrs.id': function (newValue) {
|
|
329
|
+
this.id = newValue || UniqueComponentId();
|
|
330
|
+
},
|
|
327
331
|
suggestions() {
|
|
328
332
|
if (this.searching) {
|
|
329
333
|
ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : !!this.$slots.empty ? this.show() : this.hide();
|
|
@@ -335,6 +339,8 @@ export default {
|
|
|
335
339
|
}
|
|
336
340
|
},
|
|
337
341
|
mounted() {
|
|
342
|
+
this.id = this.id || UniqueComponentId();
|
|
343
|
+
|
|
338
344
|
this.autoUpdateModel();
|
|
339
345
|
},
|
|
340
346
|
updated() {
|
|
@@ -1056,9 +1062,6 @@ export default {
|
|
|
1056
1062
|
selectedMessageText() {
|
|
1057
1063
|
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
|
|
1058
1064
|
},
|
|
1059
|
-
id() {
|
|
1060
|
-
return this.$attrs.id || UniqueComponentId();
|
|
1061
|
-
},
|
|
1062
1065
|
focusedOptionId() {
|
|
1063
1066
|
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
|
|
1064
1067
|
},
|
|
@@ -186,6 +186,7 @@ var script = {
|
|
|
186
186
|
dirty: false,
|
|
187
187
|
data() {
|
|
188
188
|
return {
|
|
189
|
+
id: this.$attrs.id,
|
|
189
190
|
focused: false,
|
|
190
191
|
focusedOptionIndex: -1,
|
|
191
192
|
focusedMultipleOptionIndex: -1,
|
|
@@ -194,6 +195,9 @@ var script = {
|
|
|
194
195
|
};
|
|
195
196
|
},
|
|
196
197
|
watch: {
|
|
198
|
+
'$attrs.id': function (newValue) {
|
|
199
|
+
this.id = newValue || utils.UniqueComponentId();
|
|
200
|
+
},
|
|
197
201
|
suggestions() {
|
|
198
202
|
if (this.searching) {
|
|
199
203
|
utils.ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : !!this.$slots.empty ? this.show() : this.hide();
|
|
@@ -205,6 +209,8 @@ var script = {
|
|
|
205
209
|
}
|
|
206
210
|
},
|
|
207
211
|
mounted() {
|
|
212
|
+
this.id = this.id || utils.UniqueComponentId();
|
|
213
|
+
|
|
208
214
|
this.autoUpdateModel();
|
|
209
215
|
},
|
|
210
216
|
updated() {
|
|
@@ -912,9 +918,6 @@ var script = {
|
|
|
912
918
|
selectedMessageText() {
|
|
913
919
|
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
|
|
914
920
|
},
|
|
915
|
-
id() {
|
|
916
|
-
return this.$attrs.id || utils.UniqueComponentId();
|
|
917
|
-
},
|
|
918
921
|
focusedOptionId() {
|
|
919
922
|
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
|
|
920
923
|
},
|
|
@@ -997,7 +1000,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
997
1000
|
"aria-haspopup": "listbox",
|
|
998
1001
|
"aria-autocomplete": "list",
|
|
999
1002
|
"aria-expanded": $data.overlayVisible,
|
|
1000
|
-
"aria-controls": $
|
|
1003
|
+
"aria-controls": $data.id + '_list',
|
|
1001
1004
|
"aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
|
|
1002
1005
|
onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFocus && $options.onFocus(...args))),
|
|
1003
1006
|
onBlur: _cache[1] || (_cache[1] = (...args) => ($options.onBlur && $options.onBlur(...args))),
|
|
@@ -1022,7 +1025,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1022
1025
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList($props.modelValue, (option, i) => {
|
|
1023
1026
|
return (vue.openBlock(), vue.createElementBlock("li", {
|
|
1024
1027
|
key: i,
|
|
1025
|
-
id: $
|
|
1028
|
+
id: $data.id + '_multiple_option_' + i,
|
|
1026
1029
|
class: vue.normalizeClass(['p-autocomplete-token', { 'p-focus': $data.focusedMultipleOptionIndex === i }]),
|
|
1027
1030
|
role: "option",
|
|
1028
1031
|
"aria-label": $options.getOptionLabel(option),
|
|
@@ -1057,7 +1060,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1057
1060
|
"aria-haspopup": "listbox",
|
|
1058
1061
|
"aria-autocomplete": "list",
|
|
1059
1062
|
"aria-expanded": $data.overlayVisible,
|
|
1060
|
-
"aria-controls": $
|
|
1063
|
+
"aria-controls": $data.id + '_list',
|
|
1061
1064
|
"aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
|
|
1062
1065
|
onFocus: _cache[5] || (_cache[5] = (...args) => ($options.onFocus && $options.onFocus(...args))),
|
|
1063
1066
|
onBlur: _cache[6] || (_cache[6] = (...args) => ($options.onBlur && $options.onBlur(...args))),
|
|
@@ -1121,7 +1124,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1121
1124
|
content: vue.withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle, itemSize }) => [
|
|
1122
1125
|
vue.createElementVNode("ul", {
|
|
1123
1126
|
ref: (el) => $options.listRef(el, contentRef),
|
|
1124
|
-
id: $
|
|
1127
|
+
id: $data.id + '_list',
|
|
1125
1128
|
class: vue.normalizeClass(['p-autocomplete-items', styleClass]),
|
|
1126
1129
|
style: vue.normalizeStyle(contentStyle),
|
|
1127
1130
|
role: "listbox"
|
|
@@ -1133,7 +1136,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1133
1136
|
($options.isOptionGroup(option))
|
|
1134
1137
|
? (vue.openBlock(), vue.createElementBlock("li", {
|
|
1135
1138
|
key: 0,
|
|
1136
|
-
id: $
|
|
1139
|
+
id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
|
|
1137
1140
|
style: vue.normalizeStyle({ height: itemSize ? itemSize + 'px' : undefined }),
|
|
1138
1141
|
class: "p-autocomplete-item-group",
|
|
1139
1142
|
role: "option"
|
|
@@ -1148,7 +1151,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1148
1151
|
], 12, _hoisted_10))
|
|
1149
1152
|
: vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
|
|
1150
1153
|
key: 1,
|
|
1151
|
-
id: $
|
|
1154
|
+
id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
|
|
1152
1155
|
style: vue.normalizeStyle({ height: itemSize ? itemSize + 'px' : undefined }),
|
|
1153
1156
|
class: vue.normalizeClass(['p-autocomplete-item', { 'p-highlight': $options.isSelected(option), 'p-focus': $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), 'p-disabled': $options.isOptionDisabled(option) }]),
|
|
1154
1157
|
role: "option",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/button"),t=require("primevue/overlayeventbus"),i=require("primevue/portal"),o=require("primevue/ripple"),n=require("primevue/utils"),s=require("primevue/virtualscroller"),l=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(e),d=a(t),p=a(i),u=a(o),c=a(s),h={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},dropdownClass:{type:String,default:null},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data:()=>({focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}),watch:{suggestions(){this.searching&&(n.ObjectUtils.isNotEmpty(this.suggestions)||this.$slots.empty?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(n.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?n.ObjectUtils.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?n.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&n.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&n.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&n.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){this.disabled||(!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){if(this.disabled)e.preventDefault();else switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((e=>this.isOptionMatched(e,this.$refs.focusInput.value||"")));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.disabled||(this.focused=!0)},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){if(this.disabled)e.preventDefault();else switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||n.DomHandler.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(n.DomHandler.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const o=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],o])):this.updateModel(e,o),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){d.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(n.ObjectUtils.isEmpty(t.value)&&this.hasSelectedOption?(n.DomHandler.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const{currentTarget:t}=e,i=t.value.length;t.setSelectionRange(0,e.shiftKey?i:0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const{currentTarget:t}=e,i=t.value.length;t.setSelectionRange(e.shiftKey?0:i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(n.ObjectUtils.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,n.DomHandler.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){n.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){n.ZIndexUtils.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?n.DomHandler.relativePosition(this.overlay,e):(this.overlay.style.minWidth=n.DomHandler.getOuterWidth(e)+"px",n.DomHandler.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(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 n.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!n.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return n.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return n.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(e){const t=e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],o=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,o),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,n.DomHandler.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=n.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},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 o=this.getOptionGroupChildren(t);return o&&o.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||n.ObjectUtils.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return n.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return n.ObjectUtils.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},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},id(){return this.$attrs.id||n.UniqueComponentId()},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:r.default,VirtualScroller:c.default,Portal:p.default},directives:{ripple:u.default}};const f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],m=["aria-activedescendant"],y=["id","aria-label","aria-setsize","aria-posinset"],O={class:"p-autocomplete-token-label"},g=["onClick"],b={class:"p-autocomplete-input-token",role:"option"},v=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],x={role:"status","aria-live":"polite",class:"p-hidden-accessible"},I=["id"],S=["id"],C=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],k={key:0,class:"p-autocomplete-empty-message",role:"option"},w={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n flex: 1 1 auto;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),h.render=function(e,t,i,o,n,s){const a=l.resolveComponent("Button"),r=l.resolveComponent("VirtualScroller"),d=l.resolveComponent("Portal"),p=l.resolveDirective("ripple");return l.openBlock(),l.createElementBlock("div",{ref:"container",class:l.normalizeClass(s.containerClass),onClick:t[15]||(t[15]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.multiple?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("input",l.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":n.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":n.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,f)),i.multiple?(l.openBlock(),l.createElementBlock("ul",{key:1,ref:"multiContainer",class:l.normalizeClass(s.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":n.focused?s.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>s.onMultipleContainerFocus&&s.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onMultipleContainerBlur&&s.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>s.onMultipleContainerKeyDown&&s.onMultipleContainerKeyDown(...e))},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.modelValue,((t,o)=>(l.openBlock(),l.createElementBlock("li",{key:o,id:s.id+"_multiple_option_"+o,class:l.normalizeClass(["p-autocomplete-token",{"p-focus":n.focusedMultipleOptionIndex===o}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":o+1},[l.renderSlot(e.$slots,"chip",{value:t},(()=>[l.createElementVNode("span",O,l.toDisplayString(s.getOptionLabel(t)),1)])),l.createElementVNode("span",{class:l.normalizeClass(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>s.removeOption(e,o),"aria-hidden":"true"},null,10,g)],10,y)))),128)),l.createElementVNode("li",b,[l.createElementVNode("input",l.mergeProps({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":n.overlayVisible,"aria-controls":s.id+"_list","aria-activedescendant":n.focused?s.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,v)])],42,m)):l.createCommentVNode("",!0),n.searching?(l.openBlock(),l.createElementBlock("i",{key:2,class:l.normalizeClass(s.loadingIconClass),"aria-hidden":"true"},null,2)):l.createCommentVNode("",!0),i.dropdown?(l.openBlock(),l.createBlock(a,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:l.normalizeClass(["p-autocomplete-dropdown",i.dropdownClass]),tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:s.onDropdownClick},null,8,["icon","class","disabled","onClick"])):l.createCommentVNode("",!0),l.createElementVNode("span",x,l.toDisplayString(s.searchResultMessageText),1),l.createVNode(d,{appendTo:i.appendTo},{default:l.withCtx((()=>[l.createVNode(l.Transition,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:l.withCtx((()=>[n.overlayVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.overlayRef,class:s.panelStyleClass,style:{...i.panelStyle,"max-height":s.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[l.renderSlot(e.$slots,"header",{value:i.modelValue,suggestions:s.visibleOptions}),l.createVNode(r,l.mergeProps({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled}),l.createSlots({content:l.withCtx((({styleClass:t,contentRef:i,items:o,getItemOptions:a,contentStyle:r,itemSize:d})=>[l.createElementVNode("ul",{ref:e=>s.listRef(e,i),id:s.id+"_list",class:l.normalizeClass(["p-autocomplete-items",t]),style:l.normalizeStyle(r),role:"listbox"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o,((t,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,a))},[s.isOptionGroup(t)?(l.openBlock(),l.createElementBlock("li",{key:0,id:s.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:d?d+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[l.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,S)):l.withDirectives((l.openBlock(),l.createElementBlock("li",{key:1,id:s.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:d?d+"px":void 0}),class:l.normalizeClass(["p-autocomplete-item",{"p-highlight":s.isSelected(t),"p-focus":n.focusedOptionIndex===s.getOptionIndex(i,a),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,a)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,a))},[e.$slots.option?l.renderSlot(e.$slots,"option",{key:0,option:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)])):l.renderSlot(e.$slots,"item",{key:1,item:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)]))],46,C)),[[p]])],64)))),128)),!o||o&&0===o.length?(l.openBlock(),l.createElementBlock("li",k,[l.renderSlot(e.$slots,"empty",{},(()=>[l.createTextVNode(l.toDisplayString(s.searchResultMessageText),1)]))])):l.createCommentVNode("",!0)],14,I)])),_:2},[e.$slots.loader?{name:"loader",fn:l.withCtx((({options:t})=>[l.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),l.renderSlot(e.$slots,"footer",{value:i.modelValue,suggestions:s.visibleOptions}),l.createElementVNode("span",w,l.toDisplayString(s.selectedMessageText),1)],16)):l.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)},module.exports=h;
|
|
1
|
+
"use strict";var e=require("primevue/button"),t=require("primevue/overlayeventbus"),i=require("primevue/portal"),o=require("primevue/ripple"),n=require("primevue/utils"),s=require("primevue/virtualscroller"),l=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=a(e),d=a(t),p=a(i),u=a(o),c=a(s),h={name:"AutoComplete",emits:["update:modelValue","change","focus","blur","item-select","item-unselect","dropdown-click","clear","complete","before-show","before-hide","show","hide"],props:{modelValue:null,suggestions:{type:Array,default:null},field:{type:[String,Function],default:null},optionLabel:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},dropdown:{type:Boolean,default:!1},dropdownMode:{type:String,default:"blank"},autoHighlight:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},dataKey:{type:String,default:null},minLength:{type:Number,default:1},delay:{type:Number,default:300},appendTo:{type:String,default:"body"},forceSelection:{type:Boolean,default:!1},completeOnFocus:{type:Boolean,default:!1},inputId:{type:String,default:null},inputStyle:{type:null,default:null},inputClass:{type:String,default:null},inputProps:{type:null,default:null},panelStyle:{type:null,default:null},panelClass:{type:String,default:null},panelProps:{type:null,default:null},dropdownIcon:{type:String,default:"pi pi-chevron-down"},dropdownClass:{type:String,default:null},loadingIcon:{type:String,default:"pi pi-spinner"},removeTokenIcon:{type:String,default:"pi pi-times-circle"},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},selectOnFocus:{type:Boolean,default:!1},searchLocale:{type:String,default:void 0},searchMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptySearchMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,resizeListener:null,scrollHandler:null,overlay:null,virtualScroller:null,searchTimeout:null,focusOnHover:!1,dirty:!1,data(){return{id:this.$attrs.id,focused:!1,focusedOptionIndex:-1,focusedMultipleOptionIndex:-1,overlayVisible:!1,searching:!1}},watch:{"$attrs.id":function(e){this.id=e||n.UniqueComponentId()},suggestions(){this.searching&&(n.ObjectUtils.isNotEmpty(this.suggestions)||this.$slots.empty?this.show():this.hide(),this.focusedOptionIndex=this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.searching=!1),this.autoUpdateModel()}},mounted(){this.id=this.id||n.UniqueComponentId(),this.autoUpdateModel()},updated(){this.overlayVisible&&this.alignOverlay()},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(n.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.field||this.optionLabel?n.ObjectUtils.resolveFieldData(e,this.field||this.optionLabel):e},getOptionValue:e=>e,getOptionRenderKey(e,t){return(this.dataKey?n.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&n.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return n.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.dirty=!0,this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&n.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.dirty=e,this.overlayVisible=!1,this.focusedOptionIndex=-1,e&&n.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){this.disabled||(!this.dirty&&this.completeOnFocus&&this.search(e,e.target.value,"focus"),this.dirty=!0,this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur(e){this.dirty=!1,this.focused=!1,this.focusedOptionIndex=-1,this.$emit("blur",e)},onKeyDown(e){if(this.disabled)e.preventDefault();else switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e)}},onInput(e){this.searchTimeout&&clearTimeout(this.searchTimeout);let t=e.target.value;this.multiple||this.updateModel(e,t),0===t.length?(this.hide(),this.$emit("clear")):t.length>=this.minLength?(this.focusedOptionIndex=-1,this.searchTimeout=setTimeout((()=>{this.search(e,t,"input")}),this.delay)):this.hide()},onChange(e){if(this.forceSelection){let t=!1;if(this.visibleOptions){const i=this.visibleOptions.find((e=>this.isOptionMatched(e,this.$refs.focusInput.value||"")));void 0!==i&&(t=!0,!this.isSelected(i)&&this.onOptionSelect(e,i))}t||(this.$refs.focusInput.value="",this.$emit("clear"),!this.multiple&&this.updateModel(e,null))}},onMultipleContainerFocus(){this.disabled||(this.focused=!0)},onMultipleContainerBlur(){this.focusedMultipleOptionIndex=-1,this.focused=!1},onMultipleContainerKeyDown(e){if(this.disabled)e.preventDefault();else switch(e.code){case"ArrowLeft":this.onArrowLeftKeyOnMultiple(e);break;case"ArrowRight":this.onArrowRightKeyOnMultiple(e);break;case"Backspace":this.onBackspaceKeyOnMultiple(e)}},onContainerClick(e){this.disabled||this.searching||this.isInputClicked(e)||this.isDropdownClicked(e)||this.overlay&&this.overlay.contains(e.target)||n.DomHandler.focus(this.$refs.focusInput)},onDropdownClick(e){let t;this.overlayVisible?this.hide(!0):(n.DomHandler.focus(this.$refs.focusInput),t=this.$refs.focusInput.value,"blank"===this.dropdownMode?this.search(e,"","dropdown"):"current"===this.dropdownMode&&this.search(e,t,"dropdown")),this.$emit("dropdown-click",{originalEvent:e,query:t})},onOptionSelect(e,t,i=!0){const o=this.getOptionValue(t);this.multiple?(this.$refs.focusInput.value="",this.isSelected(t)||this.updateModel(e,[...this.modelValue||[],o])):this.updateModel(e,o),this.$emit("item-select",{originalEvent:e,value:t}),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onOverlayClick(e){d.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){if(!this.overlayVisible)return;const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()},onArrowUpKey(e){if(this.overlayVisible)if(e.altKey)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),e.preventDefault()}},onArrowLeftKey(e){const t=e.currentTarget;this.focusedOptionIndex=-1,this.multiple&&(n.ObjectUtils.isEmpty(t.value)&&this.hasSelectedOption?(n.DomHandler.focus(this.$refs.multiContainer),this.focusedMultipleOptionIndex=this.modelValue.length):e.stopPropagation())},onArrowRightKey(e){this.focusedOptionIndex=-1,this.multiple&&e.stopPropagation()},onHomeKey(e){const{currentTarget:t}=e,i=t.value.length;t.setSelectionRange(0,e.shiftKey?i:0),this.focusedOptionIndex=-1,e.preventDefault()},onEndKey(e){const{currentTarget:t}=e,i=t.value.length;t.setSelectionRange(e.shiftKey?0:i,i),this.focusedOptionIndex=-1,e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e){-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide()},onBackspaceKey(e){if(this.multiple){if(n.ObjectUtils.isNotEmpty(this.modelValue)&&!this.$refs.focusInput.value){const t=this.modelValue[this.modelValue.length-1],i=this.modelValue.slice(0,-1);this.$emit("update:modelValue",i),this.$emit("item-unselect",{originalEvent:e,value:t})}e.stopPropagation()}},onArrowLeftKeyOnMultiple(){this.focusedMultipleOptionIndex=this.focusedMultipleOptionIndex<1?0:this.focusedMultipleOptionIndex-1},onArrowRightKeyOnMultiple(){this.focusedMultipleOptionIndex++,this.focusedMultipleOptionIndex>this.modelValue.length-1&&(this.focusedMultipleOptionIndex=-1,n.DomHandler.focus(this.$refs.focusInput))},onBackspaceKeyOnMultiple(e){-1!==this.focusedMultipleOptionIndex&&this.removeOption(e,this.focusedMultipleOptionIndex)},onOverlayEnter(e){n.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay()},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){n.ZIndexUtils.clear(e)},alignOverlay(){let e=this.multiple?this.$refs.multiContainer:this.$refs.focusInput;"self"===this.appendTo?n.DomHandler.relativePosition(this.overlay,e):(this.overlay.style.minWidth=n.DomHandler.getOuterWidth(e)+"px",n.DomHandler.absolutePosition(this.overlay,e))},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&this.isOutsideClicked(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 n.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!n.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isOutsideClicked(e){return!this.overlay.contains(e.target)&&!this.isInputClicked(e)&&!this.isDropdownClicked(e)},isInputClicked(e){return this.multiple?e.target===this.$refs.multiContainer||this.$refs.multiContainer.contains(e.target):e.target===this.$refs.focusInput},isDropdownClicked(e){return!!this.$refs.dropdownButton&&(e.target===this.$refs.dropdownButton||this.$refs.dropdownButton.$el.contains(e.target))},isOptionMatched(e,t){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.searchLocale)===t.toLocaleLowerCase(this.searchLocale)},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return n.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return n.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(e){const t=e>0?n.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},search(e,t,i){null!=t&&("input"===i&&0===t.trim().length||(this.searching=!0,this.$emit("complete",{originalEvent:e,query:t})))},removeOption(e,t){const i=this.modelValue[t],o=this.modelValue.filter(((e,i)=>i!==t)).map((e=>this.getOptionValue(e)));this.updateModel(e,o),this.$emit("item-unselect",{originalEvent:e,value:i}),this.dirty=!0,n.DomHandler.focus(this.$refs.focusInput)},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),(this.selectOnFocus||this.autoHighlight)&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=n.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){(this.selectOnFocus||this.autoHighlight)&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},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 o=this.getOptionGroupChildren(t);return o&&o.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{containerClass(){return["p-autocomplete p-component p-inputwrapper",{"p-disabled":this.disabled,"p-focus":this.focused,"p-autocomplete-dd":this.dropdown,"p-autocomplete-multiple":this.multiple,"p-inputwrapper-filled":this.modelValue||n.ObjectUtils.isNotEmpty(this.inputValue),"p-inputwrapper-focus":this.focused,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-autocomplete-input p-inputtext p-component",this.inputClass,{"p-autocomplete-dd-input":this.dropdown}]},multiContainerClass:()=>["p-autocomplete-multiple-container p-component p-inputtext"],panelStyleClass(){return["p-autocomplete-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},loadingIconClass(){return["p-autocomplete-loader pi-spin",this.loadingIcon]},visibleOptions(){return this.optionGroupLabel?this.flatOptions(this.suggestions):this.suggestions||[]},inputValue(){if(this.modelValue){if("object"==typeof this.modelValue){const e=this.getOptionLabel(this.modelValue);return null!=e?e:this.modelValue}return this.modelValue}return""},hasSelectedOption(){return n.ObjectUtils.isNotEmpty(this.modelValue)},equalityKey(){return this.dataKey},searchResultMessageText(){return n.ObjectUtils.isNotEmpty(this.visibleOptions)&&this.overlayVisible?this.searchMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptySearchMessageText},searchMessageText(){return this.searchMessage||this.$primevue.config.locale.searchMessage||""},emptySearchMessageText(){return this.emptySearchMessage||this.$primevue.config.locale.emptySearchMessage||""},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},focusedMultipleOptionId(){return-1!==this.focusedMultipleOptionIndex?`${this.id}_multiple_option_${this.focusedMultipleOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},components:{Button:r.default,VirtualScroller:c.default,Portal:p.default},directives:{ripple:u.default}};const f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],m=["aria-activedescendant"],y=["id","aria-label","aria-setsize","aria-posinset"],O={class:"p-autocomplete-token-label"},g=["onClick"],b={class:"p-autocomplete-input-token",role:"option"},v=["id","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],x={role:"status","aria-live":"polite",class:"p-hidden-accessible"},I=["id"],S=["id"],C=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],k={key:0,class:"p-autocomplete-empty-message",role:"option"},w={role:"status","aria-live":"polite",class:"p-hidden-accessible"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-autocomplete {\n display: inline-flex;\n position: relative;\n}\n.p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-autocomplete-dd .p-autocomplete-input {\n flex: 1 1 auto;\n width: 1%;\n}\n.p-autocomplete-dd .p-autocomplete-input,\n.p-autocomplete-dd .p-autocomplete-multiple-container {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-autocomplete-dd .p-autocomplete-dropdown {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0px;\n}\n.p-autocomplete .p-autocomplete-panel {\n min-width: 100%;\n}\n.p-autocomplete-panel {\n position: absolute;\n overflow: auto;\n top: 0;\n left: 0;\n}\n.p-autocomplete-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-autocomplete-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-autocomplete-multiple-container {\n margin: 0;\n padding: 0;\n list-style-type: none;\n cursor: text;\n overflow: hidden;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n}\n.p-autocomplete-token {\n cursor: default;\n display: inline-flex;\n align-items: center;\n flex: 0 0 auto;\n}\n.p-autocomplete-token-icon {\n cursor: pointer;\n}\n.p-autocomplete-input-token {\n flex: 1 1 auto;\n display: inline-flex;\n}\n.p-autocomplete-input-token input {\n border: 0 none;\n outline: 0 none;\n background-color: transparent;\n margin: 0;\n padding: 0;\n box-shadow: none;\n border-radius: 0;\n width: 100%;\n}\n.p-fluid .p-autocomplete {\n display: flex;\n}\n.p-fluid .p-autocomplete-dd .p-autocomplete-input {\n width: 1%;\n}\n"),h.render=function(e,t,i,o,n,s){const a=l.resolveComponent("Button"),r=l.resolveComponent("VirtualScroller"),d=l.resolveComponent("Portal"),p=l.resolveDirective("ripple");return l.openBlock(),l.createElementBlock("div",{ref:"container",class:l.normalizeClass(s.containerClass),onClick:t[15]||(t[15]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.multiple?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("input",l.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.inputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":n.overlayVisible,"aria-controls":n.id+"_list","aria-activedescendant":n.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[4]||(t[4]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,f)),i.multiple?(l.openBlock(),l.createElementBlock("ul",{key:1,ref:"multiContainer",class:l.normalizeClass(s.multiContainerClass),tabindex:"-1",role:"listbox","aria-orientation":"horizontal","aria-activedescendant":n.focused?s.focusedMultipleOptionId:void 0,onFocus:t[10]||(t[10]=(...e)=>s.onMultipleContainerFocus&&s.onMultipleContainerFocus(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onMultipleContainerBlur&&s.onMultipleContainerBlur(...e)),onKeydown:t[12]||(t[12]=(...e)=>s.onMultipleContainerKeyDown&&s.onMultipleContainerKeyDown(...e))},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(i.modelValue,((t,o)=>(l.openBlock(),l.createElementBlock("li",{key:o,id:n.id+"_multiple_option_"+o,class:l.normalizeClass(["p-autocomplete-token",{"p-focus":n.focusedMultipleOptionIndex===o}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":!0,"aria-setsize":i.modelValue.length,"aria-posinset":o+1},[l.renderSlot(e.$slots,"chip",{value:t},(()=>[l.createElementVNode("span",O,l.toDisplayString(s.getOptionLabel(t)),1)])),l.createElementVNode("span",{class:l.normalizeClass(["p-autocomplete-token-icon",i.removeTokenIcon]),onClick:e=>s.removeOption(e,o),"aria-hidden":"true"},null,10,g)],10,y)))),128)),l.createElementVNode("li",b,[l.createElementVNode("input",l.mergeProps({ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:i.inputClass,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-expanded":n.overlayVisible,"aria-controls":n.id+"_list","aria-activedescendant":n.focused?s.focusedOptionId:void 0,onFocus:t[5]||(t[5]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[6]||(t[6]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[7]||(t[7]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[8]||(t[8]=(...e)=>s.onInput&&s.onInput(...e)),onChange:t[9]||(t[9]=(...e)=>s.onChange&&s.onChange(...e))},i.inputProps),null,16,v)])],42,m)):l.createCommentVNode("",!0),n.searching?(l.openBlock(),l.createElementBlock("i",{key:2,class:l.normalizeClass(s.loadingIconClass),"aria-hidden":"true"},null,2)):l.createCommentVNode("",!0),i.dropdown?(l.openBlock(),l.createBlock(a,{key:3,ref:"dropdownButton",type:"button",icon:i.dropdownIcon,class:l.normalizeClass(["p-autocomplete-dropdown",i.dropdownClass]),tabindex:"-1",disabled:i.disabled,"aria-hidden":"true",onClick:s.onDropdownClick},null,8,["icon","class","disabled","onClick"])):l.createCommentVNode("",!0),l.createElementVNode("span",x,l.toDisplayString(s.searchResultMessageText),1),l.createVNode(d,{appendTo:i.appendTo},{default:l.withCtx((()=>[l.createVNode(l.Transition,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:l.withCtx((()=>[n.overlayVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.overlayRef,class:s.panelStyleClass,style:{...i.panelStyle,"max-height":s.virtualScrollerDisabled?i.scrollHeight:""},onClick:t[13]||(t[13]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[14]||(t[14]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[l.renderSlot(e.$slots,"header",{value:i.modelValue,suggestions:s.visibleOptions}),l.createVNode(r,l.mergeProps({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{style:{height:i.scrollHeight},items:s.visibleOptions,tabindex:-1,disabled:s.virtualScrollerDisabled}),l.createSlots({content:l.withCtx((({styleClass:t,contentRef:i,items:o,getItemOptions:a,contentStyle:r,itemSize:d})=>[l.createElementVNode("ul",{ref:e=>s.listRef(e,i),id:n.id+"_list",class:l.normalizeClass(["p-autocomplete-items",t]),style:l.normalizeStyle(r),role:"listbox"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(o,((t,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,a))},[s.isOptionGroup(t)?(l.openBlock(),l.createElementBlock("li",{key:0,id:n.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:d?d+"px":void 0}),class:"p-autocomplete-item-group",role:"option"},[l.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,item:t.optionGroup,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,S)):l.withDirectives((l.openBlock(),l.createElementBlock("li",{key:1,id:n.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:d?d+"px":void 0}),class:l.normalizeClass(["p-autocomplete-item",{"p-highlight":s.isSelected(t),"p-focus":n.focusedOptionIndex===s.getOptionIndex(i,a),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,a)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,a))},[e.$slots.option?l.renderSlot(e.$slots,"option",{key:0,option:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)])):l.renderSlot(e.$slots,"item",{key:1,item:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)]))],46,C)),[[p]])],64)))),128)),!o||o&&0===o.length?(l.openBlock(),l.createElementBlock("li",k,[l.renderSlot(e.$slots,"empty",{},(()=>[l.createTextVNode(l.toDisplayString(s.searchResultMessageText),1)]))])):l.createCommentVNode("",!0)],14,I)])),_:2},[e.$slots.loader?{name:"loader",fn:l.withCtx((({options:t})=>[l.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["style","items","disabled"]),l.renderSlot(e.$slots,"footer",{value:i.modelValue,suggestions:s.visibleOptions}),l.createElementVNode("span",w,l.toDisplayString(s.selectedMessageText),1)],16)):l.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],2)},module.exports=h;
|
|
@@ -2,7 +2,7 @@ import Button from 'primevue/button';
|
|
|
2
2
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
|
3
3
|
import Portal from 'primevue/portal';
|
|
4
4
|
import Ripple from 'primevue/ripple';
|
|
5
|
-
import { ObjectUtils, ZIndexUtils, DomHandler, ConnectedOverlayScrollHandler
|
|
5
|
+
import { UniqueComponentId, ObjectUtils, ZIndexUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
|
|
6
6
|
import VirtualScroller from 'primevue/virtualscroller';
|
|
7
7
|
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, mergeProps, createCommentVNode, Fragment, renderList, renderSlot, createElementVNode, toDisplayString, createBlock, createVNode, withCtx, Transition, createSlots, normalizeStyle, createTextVNode, withDirectives } from 'vue';
|
|
8
8
|
|
|
@@ -176,6 +176,7 @@ var script = {
|
|
|
176
176
|
dirty: false,
|
|
177
177
|
data() {
|
|
178
178
|
return {
|
|
179
|
+
id: this.$attrs.id,
|
|
179
180
|
focused: false,
|
|
180
181
|
focusedOptionIndex: -1,
|
|
181
182
|
focusedMultipleOptionIndex: -1,
|
|
@@ -184,6 +185,9 @@ var script = {
|
|
|
184
185
|
};
|
|
185
186
|
},
|
|
186
187
|
watch: {
|
|
188
|
+
'$attrs.id': function (newValue) {
|
|
189
|
+
this.id = newValue || UniqueComponentId();
|
|
190
|
+
},
|
|
187
191
|
suggestions() {
|
|
188
192
|
if (this.searching) {
|
|
189
193
|
ObjectUtils.isNotEmpty(this.suggestions) ? this.show() : !!this.$slots.empty ? this.show() : this.hide();
|
|
@@ -195,6 +199,8 @@ var script = {
|
|
|
195
199
|
}
|
|
196
200
|
},
|
|
197
201
|
mounted() {
|
|
202
|
+
this.id = this.id || UniqueComponentId();
|
|
203
|
+
|
|
198
204
|
this.autoUpdateModel();
|
|
199
205
|
},
|
|
200
206
|
updated() {
|
|
@@ -902,9 +908,6 @@ var script = {
|
|
|
902
908
|
selectedMessageText() {
|
|
903
909
|
return this.hasSelectedOption ? this.selectionMessageText.replaceAll('{0}', this.multiple ? this.modelValue.length : '1') : this.emptySelectionMessageText;
|
|
904
910
|
},
|
|
905
|
-
id() {
|
|
906
|
-
return this.$attrs.id || UniqueComponentId();
|
|
907
|
-
},
|
|
908
911
|
focusedOptionId() {
|
|
909
912
|
return this.focusedOptionIndex !== -1 ? `${this.id}_${this.focusedOptionIndex}` : null;
|
|
910
913
|
},
|
|
@@ -987,7 +990,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
987
990
|
"aria-haspopup": "listbox",
|
|
988
991
|
"aria-autocomplete": "list",
|
|
989
992
|
"aria-expanded": $data.overlayVisible,
|
|
990
|
-
"aria-controls": $
|
|
993
|
+
"aria-controls": $data.id + '_list',
|
|
991
994
|
"aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
|
|
992
995
|
onFocus: _cache[0] || (_cache[0] = (...args) => ($options.onFocus && $options.onFocus(...args))),
|
|
993
996
|
onBlur: _cache[1] || (_cache[1] = (...args) => ($options.onBlur && $options.onBlur(...args))),
|
|
@@ -1012,7 +1015,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1012
1015
|
(openBlock(true), createElementBlock(Fragment, null, renderList($props.modelValue, (option, i) => {
|
|
1013
1016
|
return (openBlock(), createElementBlock("li", {
|
|
1014
1017
|
key: i,
|
|
1015
|
-
id: $
|
|
1018
|
+
id: $data.id + '_multiple_option_' + i,
|
|
1016
1019
|
class: normalizeClass(['p-autocomplete-token', { 'p-focus': $data.focusedMultipleOptionIndex === i }]),
|
|
1017
1020
|
role: "option",
|
|
1018
1021
|
"aria-label": $options.getOptionLabel(option),
|
|
@@ -1047,7 +1050,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1047
1050
|
"aria-haspopup": "listbox",
|
|
1048
1051
|
"aria-autocomplete": "list",
|
|
1049
1052
|
"aria-expanded": $data.overlayVisible,
|
|
1050
|
-
"aria-controls": $
|
|
1053
|
+
"aria-controls": $data.id + '_list',
|
|
1051
1054
|
"aria-activedescendant": $data.focused ? $options.focusedOptionId : undefined,
|
|
1052
1055
|
onFocus: _cache[5] || (_cache[5] = (...args) => ($options.onFocus && $options.onFocus(...args))),
|
|
1053
1056
|
onBlur: _cache[6] || (_cache[6] = (...args) => ($options.onBlur && $options.onBlur(...args))),
|
|
@@ -1111,7 +1114,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1111
1114
|
content: withCtx(({ styleClass, contentRef, items, getItemOptions, contentStyle, itemSize }) => [
|
|
1112
1115
|
createElementVNode("ul", {
|
|
1113
1116
|
ref: (el) => $options.listRef(el, contentRef),
|
|
1114
|
-
id: $
|
|
1117
|
+
id: $data.id + '_list',
|
|
1115
1118
|
class: normalizeClass(['p-autocomplete-items', styleClass]),
|
|
1116
1119
|
style: normalizeStyle(contentStyle),
|
|
1117
1120
|
role: "listbox"
|
|
@@ -1123,7 +1126,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1123
1126
|
($options.isOptionGroup(option))
|
|
1124
1127
|
? (openBlock(), createElementBlock("li", {
|
|
1125
1128
|
key: 0,
|
|
1126
|
-
id: $
|
|
1129
|
+
id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
|
|
1127
1130
|
style: normalizeStyle({ height: itemSize ? itemSize + 'px' : undefined }),
|
|
1128
1131
|
class: "p-autocomplete-item-group",
|
|
1129
1132
|
role: "option"
|
|
@@ -1138,7 +1141,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1138
1141
|
], 12, _hoisted_10))
|
|
1139
1142
|
: withDirectives((openBlock(), createElementBlock("li", {
|
|
1140
1143
|
key: 1,
|
|
1141
|
-
id: $
|
|
1144
|
+
id: $data.id + '_' + $options.getOptionIndex(i, getItemOptions),
|
|
1142
1145
|
style: normalizeStyle({ height: itemSize ? itemSize + 'px' : undefined }),
|
|
1143
1146
|
class: normalizeClass(['p-autocomplete-item', { 'p-highlight': $options.isSelected(option), 'p-focus': $data.focusedOptionIndex === $options.getOptionIndex(i, getItemOptions), 'p-disabled': $options.isOptionDisabled(option) }]),
|
|
1144
1147
|
role: "option",
|