primevue 3.51.0 → 3.52.0

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.
Files changed (284) hide show
  1. package/accordion/Accordion.vue +5 -5
  2. package/accordion/accordion.cjs.js +5 -5
  3. package/accordion/accordion.cjs.min.js +1 -1
  4. package/accordion/accordion.esm.js +5 -5
  5. package/accordion/accordion.esm.min.js +1 -1
  6. package/accordion/accordion.js +5 -5
  7. package/accordion/accordion.min.js +1 -1
  8. package/autocomplete/AutoComplete.vue +7 -8
  9. package/autocomplete/autocomplete.cjs.js +9 -8
  10. package/autocomplete/autocomplete.cjs.min.js +1 -1
  11. package/autocomplete/autocomplete.esm.js +9 -8
  12. package/autocomplete/autocomplete.esm.min.js +1 -1
  13. package/autocomplete/autocomplete.js +9 -8
  14. package/autocomplete/autocomplete.min.js +1 -1
  15. package/calendar/Calendar.vue +13 -14
  16. package/calendar/calendar.cjs.js +12 -13
  17. package/calendar/calendar.cjs.min.js +1 -1
  18. package/calendar/calendar.esm.js +12 -13
  19. package/calendar/calendar.esm.min.js +1 -1
  20. package/calendar/calendar.js +12 -13
  21. package/calendar/calendar.min.js +1 -1
  22. package/cascadeselect/CascadeSelect.vue +3 -5
  23. package/cascadeselect/CascadeSelectSub.vue +4 -1
  24. package/cascadeselect/cascadeselect.cjs.js +14 -11
  25. package/cascadeselect/cascadeselect.cjs.min.js +1 -1
  26. package/cascadeselect/cascadeselect.esm.js +14 -11
  27. package/cascadeselect/cascadeselect.esm.min.js +1 -1
  28. package/cascadeselect/cascadeselect.js +14 -11
  29. package/cascadeselect/cascadeselect.min.js +1 -1
  30. package/chips/Chips.vue +5 -5
  31. package/chips/chips.cjs.js +5 -5
  32. package/chips/chips.cjs.min.js +1 -1
  33. package/chips/chips.esm.js +5 -5
  34. package/chips/chips.esm.min.js +1 -1
  35. package/chips/chips.js +5 -5
  36. package/chips/chips.min.js +1 -1
  37. package/config/PrimeVue.d.ts +1 -0
  38. package/config/config.cjs.js +2 -1
  39. package/config/config.cjs.min.js +1 -1
  40. package/config/config.esm.js +2 -1
  41. package/config/config.esm.min.js +1 -1
  42. package/config/config.js +2 -1
  43. package/config/config.min.js +1 -1
  44. package/contextmenu/ContextMenu.vue +4 -5
  45. package/contextmenu/contextmenu.cjs.js +3 -5
  46. package/contextmenu/contextmenu.cjs.min.js +1 -1
  47. package/contextmenu/contextmenu.esm.js +3 -5
  48. package/contextmenu/contextmenu.esm.min.js +1 -1
  49. package/contextmenu/contextmenu.js +3 -5
  50. package/contextmenu/contextmenu.min.js +1 -1
  51. package/core/core.js +54 -49
  52. package/core/core.min.js +8 -8
  53. package/datatable/BodyRow.vue +1 -0
  54. package/datatable/ColumnFilter.vue +4 -5
  55. package/datatable/DataTable.d.ts +6 -3
  56. package/datatable/datatable.cjs.js +4 -5
  57. package/datatable/datatable.cjs.min.js +1 -1
  58. package/datatable/datatable.esm.js +4 -5
  59. package/datatable/datatable.esm.min.js +1 -1
  60. package/datatable/datatable.js +4 -5
  61. package/datatable/datatable.min.js +1 -1
  62. package/dialog/Dialog.vue +4 -5
  63. package/dialog/dialog.cjs.js +3 -5
  64. package/dialog/dialog.cjs.min.js +1 -1
  65. package/dialog/dialog.esm.js +3 -5
  66. package/dialog/dialog.esm.min.js +1 -1
  67. package/dialog/dialog.js +3 -5
  68. package/dialog/dialog.min.js +1 -1
  69. package/dock/DockSub.vue +5 -5
  70. package/dock/dock.cjs.js +5 -5
  71. package/dock/dock.cjs.min.js +1 -1
  72. package/dock/dock.esm.js +5 -5
  73. package/dock/dock.esm.min.js +1 -1
  74. package/dock/dock.js +5 -5
  75. package/dock/dock.min.js +1 -1
  76. package/dropdown/Dropdown.vue +7 -6
  77. package/dropdown/dropdown.cjs.js +9 -7
  78. package/dropdown/dropdown.cjs.min.js +1 -1
  79. package/dropdown/dropdown.esm.js +9 -7
  80. package/dropdown/dropdown.esm.min.js +1 -1
  81. package/dropdown/dropdown.js +9 -7
  82. package/dropdown/dropdown.min.js +1 -1
  83. package/fieldset/Fieldset.vue +5 -5
  84. package/fieldset/fieldset.cjs.js +5 -5
  85. package/fieldset/fieldset.cjs.min.js +1 -1
  86. package/fieldset/fieldset.esm.js +5 -5
  87. package/fieldset/fieldset.esm.min.js +1 -1
  88. package/fieldset/fieldset.js +5 -5
  89. package/fieldset/fieldset.min.js +1 -1
  90. package/galleria/GalleriaContent.vue +6 -6
  91. package/galleria/galleria.cjs.js +6 -6
  92. package/galleria/galleria.cjs.min.js +1 -1
  93. package/galleria/galleria.esm.js +6 -6
  94. package/galleria/galleria.esm.min.js +1 -1
  95. package/galleria/galleria.js +6 -6
  96. package/galleria/galleria.min.js +1 -1
  97. package/inputnumber/InputNumber.d.ts +4 -0
  98. package/inputnumber/InputNumber.vue +20 -17
  99. package/inputnumber/inputnumber.cjs.js +23 -20
  100. package/inputnumber/inputnumber.cjs.min.js +1 -1
  101. package/inputnumber/inputnumber.esm.js +23 -20
  102. package/inputnumber/inputnumber.esm.min.js +1 -1
  103. package/inputnumber/inputnumber.js +23 -20
  104. package/inputnumber/inputnumber.min.js +1 -1
  105. package/inputotp/InputOtp.vue +1 -1
  106. package/inputotp/inputotp.cjs.js +1 -1
  107. package/inputotp/inputotp.cjs.min.js +1 -1
  108. package/inputotp/inputotp.esm.js +1 -1
  109. package/inputotp/inputotp.esm.min.js +1 -1
  110. package/inputotp/inputotp.js +1 -1
  111. package/inputotp/inputotp.min.js +1 -1
  112. package/knob/BaseKnob.vue +1 -1
  113. package/knob/Knob.d.ts +1 -1
  114. package/knob/Knob.vue +5 -1
  115. package/knob/knob.cjs.js +6 -2
  116. package/knob/knob.cjs.min.js +1 -1
  117. package/knob/knob.esm.js +6 -2
  118. package/knob/knob.esm.min.js +1 -1
  119. package/knob/knob.js +6 -2
  120. package/knob/knob.min.js +1 -1
  121. package/listbox/Listbox.vue +3 -5
  122. package/listbox/listbox.cjs.js +3 -5
  123. package/listbox/listbox.cjs.min.js +1 -1
  124. package/listbox/listbox.esm.js +3 -5
  125. package/listbox/listbox.esm.min.js +1 -1
  126. package/listbox/listbox.js +3 -5
  127. package/listbox/listbox.min.js +1 -1
  128. package/megamenu/MegaMenu.vue +3 -5
  129. package/megamenu/megamenu.cjs.js +3 -5
  130. package/megamenu/megamenu.cjs.min.js +1 -1
  131. package/megamenu/megamenu.esm.js +3 -5
  132. package/megamenu/megamenu.esm.min.js +1 -1
  133. package/megamenu/megamenu.js +3 -5
  134. package/megamenu/megamenu.min.js +1 -1
  135. package/menu/Menu.vue +19 -7
  136. package/menu/menu.cjs.js +8 -7
  137. package/menu/menu.cjs.min.js +1 -1
  138. package/menu/menu.esm.js +8 -7
  139. package/menu/menu.esm.min.js +1 -1
  140. package/menu/menu.js +8 -7
  141. package/menu/menu.min.js +1 -1
  142. package/menubar/Menubar.vue +3 -5
  143. package/menubar/menubar.cjs.js +3 -5
  144. package/menubar/menubar.cjs.min.js +1 -1
  145. package/menubar/menubar.esm.js +3 -5
  146. package/menubar/menubar.esm.min.js +1 -1
  147. package/menubar/menubar.js +3 -5
  148. package/menubar/menubar.min.js +1 -1
  149. package/multiselect/MultiSelect.vue +7 -6
  150. package/multiselect/multiselect.cjs.js +9 -7
  151. package/multiselect/multiselect.cjs.min.js +1 -1
  152. package/multiselect/multiselect.esm.js +9 -7
  153. package/multiselect/multiselect.esm.min.js +1 -1
  154. package/multiselect/multiselect.js +9 -7
  155. package/multiselect/multiselect.min.js +1 -1
  156. package/orderlist/OrderList.vue +4 -5
  157. package/orderlist/orderlist.cjs.js +3 -5
  158. package/orderlist/orderlist.cjs.min.js +1 -1
  159. package/orderlist/orderlist.esm.js +3 -5
  160. package/orderlist/orderlist.esm.min.js +1 -1
  161. package/orderlist/orderlist.js +3 -5
  162. package/orderlist/orderlist.min.js +1 -1
  163. package/package.json +1 -1
  164. package/paginator/Paginator.vue +0 -1
  165. package/paginator/paginator.cjs.js +1 -1
  166. package/paginator/paginator.cjs.min.js +1 -1
  167. package/paginator/paginator.esm.js +1 -1
  168. package/paginator/paginator.esm.min.js +1 -1
  169. package/paginator/paginator.js +1 -1
  170. package/paginator/paginator.min.js +1 -1
  171. package/panel/Panel.vue +5 -5
  172. package/panel/panel.cjs.js +5 -5
  173. package/panel/panel.cjs.min.js +1 -1
  174. package/panel/panel.esm.js +5 -5
  175. package/panel/panel.esm.min.js +1 -1
  176. package/panel/panel.js +5 -5
  177. package/panel/panel.min.js +1 -1
  178. package/panelmenu/PanelMenu.vue +5 -5
  179. package/panelmenu/panelmenu.cjs.js +5 -5
  180. package/panelmenu/panelmenu.cjs.min.js +1 -1
  181. package/panelmenu/panelmenu.esm.js +5 -5
  182. package/panelmenu/panelmenu.esm.min.js +1 -1
  183. package/panelmenu/panelmenu.js +5 -5
  184. package/panelmenu/panelmenu.min.js +1 -1
  185. package/password/Password.vue +3 -5
  186. package/password/password.cjs.js +3 -5
  187. package/password/password.cjs.min.js +1 -1
  188. package/password/password.esm.js +3 -5
  189. package/password/password.esm.min.js +1 -1
  190. package/password/password.js +3 -5
  191. package/password/password.min.js +1 -1
  192. package/picklist/PickList.vue +4 -5
  193. package/picklist/picklist.cjs.js +3 -5
  194. package/picklist/picklist.cjs.min.js +1 -1
  195. package/picklist/picklist.esm.js +3 -5
  196. package/picklist/picklist.esm.min.js +1 -1
  197. package/picklist/picklist.js +3 -5
  198. package/picklist/picklist.min.js +1 -1
  199. package/rating/Rating.vue +5 -5
  200. package/rating/rating.cjs.js +5 -5
  201. package/rating/rating.cjs.min.js +1 -1
  202. package/rating/rating.esm.js +5 -5
  203. package/rating/rating.esm.min.js +1 -1
  204. package/rating/rating.js +5 -5
  205. package/rating/rating.min.js +1 -1
  206. package/scrollpanel/ScrollPanel.vue +23 -19
  207. package/scrollpanel/scrollpanel.cjs.js +21 -19
  208. package/scrollpanel/scrollpanel.cjs.min.js +1 -1
  209. package/scrollpanel/scrollpanel.esm.js +21 -19
  210. package/scrollpanel/scrollpanel.esm.min.js +1 -1
  211. package/scrollpanel/scrollpanel.js +21 -19
  212. package/scrollpanel/scrollpanel.min.js +1 -1
  213. package/sidebar/BaseSidebar.vue +9 -0
  214. package/sidebar/sidebar.cjs.js +9 -0
  215. package/sidebar/sidebar.cjs.min.js +1 -1
  216. package/sidebar/sidebar.esm.js +9 -0
  217. package/sidebar/sidebar.esm.min.js +1 -1
  218. package/sidebar/sidebar.js +9 -0
  219. package/sidebar/sidebar.min.js +1 -1
  220. package/speeddial/SpeedDial.vue +4 -5
  221. package/speeddial/speeddial.cjs.js +3 -5
  222. package/speeddial/speeddial.cjs.min.js +1 -1
  223. package/speeddial/speeddial.esm.js +3 -5
  224. package/speeddial/speeddial.esm.min.js +1 -1
  225. package/speeddial/speeddial.js +3 -5
  226. package/speeddial/speeddial.min.js +1 -1
  227. package/splitbutton/SplitButton.vue +4 -5
  228. package/splitbutton/splitbutton.cjs.js +3 -5
  229. package/splitbutton/splitbutton.cjs.min.js +1 -1
  230. package/splitbutton/splitbutton.esm.js +3 -5
  231. package/splitbutton/splitbutton.esm.min.js +1 -1
  232. package/splitbutton/splitbutton.js +3 -5
  233. package/splitbutton/splitbutton.min.js +1 -1
  234. package/stepper/Stepper.vue +8 -5
  235. package/stepper/stepper.cjs.js +14 -11
  236. package/stepper/stepper.cjs.min.js +1 -1
  237. package/stepper/stepper.esm.js +14 -11
  238. package/stepper/stepper.esm.min.js +1 -1
  239. package/stepper/stepper.js +14 -11
  240. package/stepper/stepper.min.js +1 -1
  241. package/tabview/TabView.vue +3 -5
  242. package/tabview/tabview.cjs.js +3 -5
  243. package/tabview/tabview.cjs.min.js +1 -1
  244. package/tabview/tabview.esm.js +3 -5
  245. package/tabview/tabview.esm.min.js +1 -1
  246. package/tabview/tabview.js +3 -5
  247. package/tabview/tabview.min.js +1 -1
  248. package/tieredmenu/TieredMenu.vue +5 -5
  249. package/tieredmenu/tieredmenu.cjs.js +5 -5
  250. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  251. package/tieredmenu/tieredmenu.esm.js +5 -5
  252. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  253. package/tieredmenu/tieredmenu.js +5 -5
  254. package/tieredmenu/tieredmenu.min.js +1 -1
  255. package/toast/Toast.vue +4 -9
  256. package/toast/toast.cjs.js +8 -10
  257. package/toast/toast.cjs.min.js +1 -1
  258. package/toast/toast.esm.js +8 -10
  259. package/toast/toast.esm.min.js +1 -1
  260. package/toast/toast.js +8 -10
  261. package/toast/toast.min.js +1 -1
  262. package/tree/TreeNode.vue +1 -1
  263. package/tree/tree.cjs.js +3 -3
  264. package/tree/tree.cjs.min.js +1 -1
  265. package/tree/tree.esm.js +3 -3
  266. package/tree/tree.esm.min.js +1 -1
  267. package/tree/tree.js +3 -3
  268. package/tree/tree.min.js +1 -1
  269. package/treeselect/TreeSelect.vue +3 -5
  270. package/treeselect/treeselect.cjs.js +3 -5
  271. package/treeselect/treeselect.cjs.min.js +1 -1
  272. package/treeselect/treeselect.esm.js +3 -5
  273. package/treeselect/treeselect.esm.min.js +1 -1
  274. package/treeselect/treeselect.js +3 -5
  275. package/treeselect/treeselect.min.js +1 -1
  276. package/treetable/TreeTable.vue +3 -3
  277. package/treetable/treetable.cjs.js +3 -3
  278. package/treetable/treetable.cjs.min.js +1 -1
  279. package/treetable/treetable.esm.js +3 -3
  280. package/treetable/treetable.esm.min.js +1 -1
  281. package/treetable/treetable.js +3 -3
  282. package/treetable/treetable.min.js +1 -1
  283. package/vetur-attributes.json +3 -3
  284. package/web-types.json +4 -4
@@ -64,13 +64,13 @@ var script = {
64
64
  };
65
65
  },
66
66
  watch: {
67
- '$attrs.name': {
68
- immediate: true,
69
- handler: function handler(newValue) {
70
- this.name = newValue || UniqueComponentId();
71
- }
67
+ '$attrs.name': function $attrsName(newValue) {
68
+ this.name = newValue || UniqueComponentId();
72
69
  }
73
70
  },
71
+ mounted: function mounted() {
72
+ this.name = this.name || UniqueComponentId();
73
+ },
74
74
  methods: {
75
75
  getPTOptions: function getPTOptions(key, value) {
76
76
  return this.ptm(key, {
@@ -1 +1 @@
1
- import e from"primevue/icons/ban";import n from"primevue/icons/star";import t from"primevue/icons/starfill";import{UniqueComponentId as o,DomHandler as a}from"primevue/utils";import c from"primevue/basecomponent";import i from"primevue/rating/style";import{openBlock as l,createElementBlock as s,mergeProps as r,createElementVNode as u,renderSlot as d,normalizeClass as p,createBlock as f,resolveDynamicComponent as m,createCommentVNode as h,Fragment as I,renderList as b}from"vue";var v={name:"Rating",extends:{name:"BaseRating",extends:c,props:{modelValue:{type:Number,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},stars:{type:Number,default:5},cancel:{type:Boolean,default:!0},onIcon:{type:String,default:void 0},offIcon:{type:String,default:void 0},cancelIcon:{type:String,default:void 0}},style:i,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","focus","blur"],data:function(){return{name:this.$attrs.name,focusedOptionIndex:-1,isFocusVisibleItem:!0}},watch:{"$attrs.name":{immediate:!0,handler:function(e){this.name=e||o()}}},methods:{getPTOptions:function(e,n){return this.ptm(e,{context:{active:n<=this.modelValue,focused:n===this.focusedOptionIndex}})},onOptionClick:function(e,n){if(!this.readonly&&!this.disabled){this.onOptionSelect(e,n),this.isFocusVisibleItem=!1;var t=a.getFirstFocusableElement(e.currentTarget);t&&a.focus(t)}},onFocus:function(e,n){this.focusedOptionIndex=n,this.$emit("focus",e)},onBlur:function(e){this.focusedOptionIndex=-1,this.$emit("blur",e)},onChange:function(e,n){this.onOptionSelect(e,n),this.isFocusVisibleItem=!0},onOptionSelect:function(e,n){this.focusedOptionIndex=n,this.updateModel(e,n||null)},updateModel:function(e,n){this.$emit("update:modelValue",n),this.$emit("change",{originalEvent:e,value:n})},cancelAriaLabel:function(){return this.$primevue.config.locale.clear},starAriaLabel:function(e){return 1===e?this.$primevue.config.locale.aria.star:this.$primevue.config.locale.aria.stars.replace(/{star}/g,e)}},components:{StarFillIcon:t,StarIcon:n,BanIcon:e}},y=["data-p-focused"],g=["name","checked","disabled","readonly","aria-label"],x=["onClick","data-p-active","data-p-focused"],O=["value","name","checked","disabled","readonly","aria-label","onFocus","onChange"];v.render=function(e,n,t,o,a,c){return l(),s("div",r({class:e.cx("root")},e.ptmi("root")),[e.cancel?(l(),s("div",r({key:0,class:e.cx("cancelItem"),onClick:n[3]||(n[3]=function(e){return c.onOptionClick(e,0)})},c.getPTOptions("cancelItem",0),{"data-p-focused":0===a.focusedOptionIndex}),[u("span",r({class:"p-hidden-accessible"},e.ptm("hiddenCancelInputWrapper"),{"data-p-hidden-accessible":!0}),[u("input",r({type:"radio",value:"0",name:a.name,checked:0===e.modelValue,disabled:e.disabled,readonly:e.readonly,"aria-label":c.cancelAriaLabel(),onFocus:n[0]||(n[0]=function(e){return c.onFocus(e,0)}),onBlur:n[1]||(n[1]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:n[2]||(n[2]=function(e){return c.onChange(e,0)})},e.ptm("hiddenCancelInput")),null,16,g)],16),d(e.$slots,"cancelicon",{class:p(e.cx("cancelIcon"))},(function(){return[(l(),f(m(e.cancelIcon?"span":"BanIcon"),r({class:[e.cx("cancelIcon"),e.cancelIcon]},e.ptm("cancelIcon")),null,16,["class"]))]}))],16,y)):h("",!0),(l(!0),s(I,null,b(e.stars,(function(t){return l(),s("div",r({key:t,class:e.cx("item",{value:t}),onClick:function(e){return c.onOptionClick(e,t)}},c.getPTOptions("item",t),{"data-p-active":t<=e.modelValue,"data-p-focused":t===a.focusedOptionIndex}),[u("span",r({class:"p-hidden-accessible"},e.ptm("hiddenItemInputWrapper"),{"data-p-hidden-accessible":!0}),[u("input",r({type:"radio",value:t,name:a.name,checked:e.modelValue===t,disabled:e.disabled,readonly:e.readonly,"aria-label":c.starAriaLabel(t),onFocus:function(e){return c.onFocus(e,t)},onBlur:n[4]||(n[4]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:function(e){return c.onChange(e,t)}},e.ptm("hiddenItemInput")),null,16,O)],16),t<=e.modelValue?d(e.$slots,"onicon",{key:0,value:t,class:p(e.cx("onIcon"))},(function(){return[(l(),f(m(e.onIcon?"span":"StarFillIcon"),r({class:[e.cx("onIcon"),e.onIcon]},e.ptm("onIcon")),null,16,["class"]))]})):d(e.$slots,"officon",{key:1,value:t,class:p(e.cx("offIcon"))},(function(){return[(l(),f(m(e.offIcon?"span":"StarIcon"),r({class:[e.cx("offIcon"),e.offIcon]},e.ptm("offIcon")),null,16,["class"]))]}))],16,x)})),128))],16)};export{v as default};
1
+ import e from"primevue/icons/ban";import n from"primevue/icons/star";import t from"primevue/icons/starfill";import{UniqueComponentId as o,DomHandler as a}from"primevue/utils";import c from"primevue/basecomponent";import i from"primevue/rating/style";import{openBlock as l,createElementBlock as s,mergeProps as u,createElementVNode as r,renderSlot as d,normalizeClass as p,createBlock as f,resolveDynamicComponent as m,createCommentVNode as h,Fragment as I,renderList as b}from"vue";var v={name:"Rating",extends:{name:"BaseRating",extends:c,props:{modelValue:{type:Number,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},stars:{type:Number,default:5},cancel:{type:Boolean,default:!0},onIcon:{type:String,default:void 0},offIcon:{type:String,default:void 0},cancelIcon:{type:String,default:void 0}},style:i,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","focus","blur"],data:function(){return{name:this.$attrs.name,focusedOptionIndex:-1,isFocusVisibleItem:!0}},watch:{"$attrs.name":function(e){this.name=e||o()}},mounted:function(){this.name=this.name||o()},methods:{getPTOptions:function(e,n){return this.ptm(e,{context:{active:n<=this.modelValue,focused:n===this.focusedOptionIndex}})},onOptionClick:function(e,n){if(!this.readonly&&!this.disabled){this.onOptionSelect(e,n),this.isFocusVisibleItem=!1;var t=a.getFirstFocusableElement(e.currentTarget);t&&a.focus(t)}},onFocus:function(e,n){this.focusedOptionIndex=n,this.$emit("focus",e)},onBlur:function(e){this.focusedOptionIndex=-1,this.$emit("blur",e)},onChange:function(e,n){this.onOptionSelect(e,n),this.isFocusVisibleItem=!0},onOptionSelect:function(e,n){this.focusedOptionIndex=n,this.updateModel(e,n||null)},updateModel:function(e,n){this.$emit("update:modelValue",n),this.$emit("change",{originalEvent:e,value:n})},cancelAriaLabel:function(){return this.$primevue.config.locale.clear},starAriaLabel:function(e){return 1===e?this.$primevue.config.locale.aria.star:this.$primevue.config.locale.aria.stars.replace(/{star}/g,e)}},components:{StarFillIcon:t,StarIcon:n,BanIcon:e}},y=["data-p-focused"],g=["name","checked","disabled","readonly","aria-label"],x=["onClick","data-p-active","data-p-focused"],O=["value","name","checked","disabled","readonly","aria-label","onFocus","onChange"];v.render=function(e,n,t,o,a,c){return l(),s("div",u({class:e.cx("root")},e.ptmi("root")),[e.cancel?(l(),s("div",u({key:0,class:e.cx("cancelItem"),onClick:n[3]||(n[3]=function(e){return c.onOptionClick(e,0)})},c.getPTOptions("cancelItem",0),{"data-p-focused":0===a.focusedOptionIndex}),[r("span",u({class:"p-hidden-accessible"},e.ptm("hiddenCancelInputWrapper"),{"data-p-hidden-accessible":!0}),[r("input",u({type:"radio",value:"0",name:a.name,checked:0===e.modelValue,disabled:e.disabled,readonly:e.readonly,"aria-label":c.cancelAriaLabel(),onFocus:n[0]||(n[0]=function(e){return c.onFocus(e,0)}),onBlur:n[1]||(n[1]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:n[2]||(n[2]=function(e){return c.onChange(e,0)})},e.ptm("hiddenCancelInput")),null,16,g)],16),d(e.$slots,"cancelicon",{class:p(e.cx("cancelIcon"))},(function(){return[(l(),f(m(e.cancelIcon?"span":"BanIcon"),u({class:[e.cx("cancelIcon"),e.cancelIcon]},e.ptm("cancelIcon")),null,16,["class"]))]}))],16,y)):h("",!0),(l(!0),s(I,null,b(e.stars,(function(t){return l(),s("div",u({key:t,class:e.cx("item",{value:t}),onClick:function(e){return c.onOptionClick(e,t)}},c.getPTOptions("item",t),{"data-p-active":t<=e.modelValue,"data-p-focused":t===a.focusedOptionIndex}),[r("span",u({class:"p-hidden-accessible"},e.ptm("hiddenItemInputWrapper"),{"data-p-hidden-accessible":!0}),[r("input",u({type:"radio",value:t,name:a.name,checked:e.modelValue===t,disabled:e.disabled,readonly:e.readonly,"aria-label":c.starAriaLabel(t),onFocus:function(e){return c.onFocus(e,t)},onBlur:n[4]||(n[4]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:function(e){return c.onChange(e,t)}},e.ptm("hiddenItemInput")),null,16,O)],16),t<=e.modelValue?d(e.$slots,"onicon",{key:0,value:t,class:p(e.cx("onIcon"))},(function(){return[(l(),f(m(e.onIcon?"span":"StarFillIcon"),u({class:[e.cx("onIcon"),e.onIcon]},e.ptm("onIcon")),null,16,["class"]))]})):d(e.$slots,"officon",{key:1,value:t,class:p(e.cx("offIcon"))},(function(){return[(l(),f(m(e.offIcon?"span":"StarIcon"),u({class:[e.cx("offIcon"),e.offIcon]},e.ptm("offIcon")),null,16,["class"]))]}))],16,x)})),128))],16)};export{v as default};
package/rating/rating.js CHANGED
@@ -68,13 +68,13 @@ this.primevue.rating = (function (BanIcon, StarIcon, StarFillIcon, utils, BaseCo
68
68
  };
69
69
  },
70
70
  watch: {
71
- '$attrs.name': {
72
- immediate: true,
73
- handler: function handler(newValue) {
74
- this.name = newValue || utils.UniqueComponentId();
75
- }
71
+ '$attrs.name': function $attrsName(newValue) {
72
+ this.name = newValue || utils.UniqueComponentId();
76
73
  }
77
74
  },
75
+ mounted: function mounted() {
76
+ this.name = this.name || utils.UniqueComponentId();
77
+ },
78
78
  methods: {
79
79
  getPTOptions: function getPTOptions(key, value) {
80
80
  return this.ptm(key, {
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.rating=function(e,n,t,o,a,c,l){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e),s=i(n),u=i(t),d={name:"Rating",extends:{name:"BaseRating",extends:i(a).default,props:{modelValue:{type:Number,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},stars:{type:Number,default:5},cancel:{type:Boolean,default:!0},onIcon:{type:String,default:void 0},offIcon:{type:String,default:void 0},cancelIcon:{type:String,default:void 0}},style:i(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","focus","blur"],data:function(){return{name:this.$attrs.name,focusedOptionIndex:-1,isFocusVisibleItem:!0}},watch:{"$attrs.name":{immediate:!0,handler:function(e){this.name=e||o.UniqueComponentId()}}},methods:{getPTOptions:function(e,n){return this.ptm(e,{context:{active:n<=this.modelValue,focused:n===this.focusedOptionIndex}})},onOptionClick:function(e,n){if(!this.readonly&&!this.disabled){this.onOptionSelect(e,n),this.isFocusVisibleItem=!1;var t=o.DomHandler.getFirstFocusableElement(e.currentTarget);t&&o.DomHandler.focus(t)}},onFocus:function(e,n){this.focusedOptionIndex=n,this.$emit("focus",e)},onBlur:function(e){this.focusedOptionIndex=-1,this.$emit("blur",e)},onChange:function(e,n){this.onOptionSelect(e,n),this.isFocusVisibleItem=!0},onOptionSelect:function(e,n){this.focusedOptionIndex=n,this.updateModel(e,n||null)},updateModel:function(e,n){this.$emit("update:modelValue",n),this.$emit("change",{originalEvent:e,value:n})},cancelAriaLabel:function(){return this.$primevue.config.locale.clear},starAriaLabel:function(e){return 1===e?this.$primevue.config.locale.aria.star:this.$primevue.config.locale.aria.stars.replace(/{star}/g,e)}},components:{StarFillIcon:u.default,StarIcon:s.default,BanIcon:r.default}},p=["data-p-focused"],m=["name","checked","disabled","readonly","aria-label"],f=["onClick","data-p-active","data-p-focused"],h=["value","name","checked","disabled","readonly","aria-label","onFocus","onChange"];return d.render=function(e,n,t,o,a,c){return l.openBlock(),l.createElementBlock("div",l.mergeProps({class:e.cx("root")},e.ptmi("root")),[e.cancel?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("cancelItem"),onClick:n[3]||(n[3]=function(e){return c.onOptionClick(e,0)})},c.getPTOptions("cancelItem",0),{"data-p-focused":0===a.focusedOptionIndex}),[l.createElementVNode("span",l.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenCancelInputWrapper"),{"data-p-hidden-accessible":!0}),[l.createElementVNode("input",l.mergeProps({type:"radio",value:"0",name:a.name,checked:0===e.modelValue,disabled:e.disabled,readonly:e.readonly,"aria-label":c.cancelAriaLabel(),onFocus:n[0]||(n[0]=function(e){return c.onFocus(e,0)}),onBlur:n[1]||(n[1]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:n[2]||(n[2]=function(e){return c.onChange(e,0)})},e.ptm("hiddenCancelInput")),null,16,m)],16),l.renderSlot(e.$slots,"cancelicon",{class:l.normalizeClass(e.cx("cancelIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.cancelIcon?"span":"BanIcon"),l.mergeProps({class:[e.cx("cancelIcon"),e.cancelIcon]},e.ptm("cancelIcon")),null,16,["class"]))]}))],16,p)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(e.stars,(function(t){return l.openBlock(),l.createElementBlock("div",l.mergeProps({key:t,class:e.cx("item",{value:t}),onClick:function(e){return c.onOptionClick(e,t)}},c.getPTOptions("item",t),{"data-p-active":t<=e.modelValue,"data-p-focused":t===a.focusedOptionIndex}),[l.createElementVNode("span",l.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenItemInputWrapper"),{"data-p-hidden-accessible":!0}),[l.createElementVNode("input",l.mergeProps({type:"radio",value:t,name:a.name,checked:e.modelValue===t,disabled:e.disabled,readonly:e.readonly,"aria-label":c.starAriaLabel(t),onFocus:function(e){return c.onFocus(e,t)},onBlur:n[4]||(n[4]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:function(e){return c.onChange(e,t)}},e.ptm("hiddenItemInput")),null,16,h)],16),t<=e.modelValue?l.renderSlot(e.$slots,"onicon",{key:0,value:t,class:l.normalizeClass(e.cx("onIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.onIcon?"span":"StarFillIcon"),l.mergeProps({class:[e.cx("onIcon"),e.onIcon]},e.ptm("onIcon")),null,16,["class"]))]})):l.renderSlot(e.$slots,"officon",{key:1,value:t,class:l.normalizeClass(e.cx("offIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.offIcon?"span":"StarIcon"),l.mergeProps({class:[e.cx("offIcon"),e.offIcon]},e.ptm("offIcon")),null,16,["class"]))]}))],16,f)})),128))],16)},d}(primevue.icons.ban,primevue.icons.star,primevue.icons.starfill,primevue.utils,primevue.basecomponent,primevue.rating.style,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.rating=function(e,n,t,o,a,c,l){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=i(e),s=i(n),u=i(t),d={name:"Rating",extends:{name:"BaseRating",extends:i(a).default,props:{modelValue:{type:Number,default:null},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},stars:{type:Number,default:5},cancel:{type:Boolean,default:!0},onIcon:{type:String,default:void 0},offIcon:{type:String,default:void 0},cancelIcon:{type:String,default:void 0}},style:i(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","focus","blur"],data:function(){return{name:this.$attrs.name,focusedOptionIndex:-1,isFocusVisibleItem:!0}},watch:{"$attrs.name":function(e){this.name=e||o.UniqueComponentId()}},mounted:function(){this.name=this.name||o.UniqueComponentId()},methods:{getPTOptions:function(e,n){return this.ptm(e,{context:{active:n<=this.modelValue,focused:n===this.focusedOptionIndex}})},onOptionClick:function(e,n){if(!this.readonly&&!this.disabled){this.onOptionSelect(e,n),this.isFocusVisibleItem=!1;var t=o.DomHandler.getFirstFocusableElement(e.currentTarget);t&&o.DomHandler.focus(t)}},onFocus:function(e,n){this.focusedOptionIndex=n,this.$emit("focus",e)},onBlur:function(e){this.focusedOptionIndex=-1,this.$emit("blur",e)},onChange:function(e,n){this.onOptionSelect(e,n),this.isFocusVisibleItem=!0},onOptionSelect:function(e,n){this.focusedOptionIndex=n,this.updateModel(e,n||null)},updateModel:function(e,n){this.$emit("update:modelValue",n),this.$emit("change",{originalEvent:e,value:n})},cancelAriaLabel:function(){return this.$primevue.config.locale.clear},starAriaLabel:function(e){return 1===e?this.$primevue.config.locale.aria.star:this.$primevue.config.locale.aria.stars.replace(/{star}/g,e)}},components:{StarFillIcon:u.default,StarIcon:s.default,BanIcon:r.default}},p=["data-p-focused"],m=["name","checked","disabled","readonly","aria-label"],f=["onClick","data-p-active","data-p-focused"],h=["value","name","checked","disabled","readonly","aria-label","onFocus","onChange"];return d.render=function(e,n,t,o,a,c){return l.openBlock(),l.createElementBlock("div",l.mergeProps({class:e.cx("root")},e.ptmi("root")),[e.cancel?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("cancelItem"),onClick:n[3]||(n[3]=function(e){return c.onOptionClick(e,0)})},c.getPTOptions("cancelItem",0),{"data-p-focused":0===a.focusedOptionIndex}),[l.createElementVNode("span",l.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenCancelInputWrapper"),{"data-p-hidden-accessible":!0}),[l.createElementVNode("input",l.mergeProps({type:"radio",value:"0",name:a.name,checked:0===e.modelValue,disabled:e.disabled,readonly:e.readonly,"aria-label":c.cancelAriaLabel(),onFocus:n[0]||(n[0]=function(e){return c.onFocus(e,0)}),onBlur:n[1]||(n[1]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:n[2]||(n[2]=function(e){return c.onChange(e,0)})},e.ptm("hiddenCancelInput")),null,16,m)],16),l.renderSlot(e.$slots,"cancelicon",{class:l.normalizeClass(e.cx("cancelIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.cancelIcon?"span":"BanIcon"),l.mergeProps({class:[e.cx("cancelIcon"),e.cancelIcon]},e.ptm("cancelIcon")),null,16,["class"]))]}))],16,p)):l.createCommentVNode("",!0),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(e.stars,(function(t){return l.openBlock(),l.createElementBlock("div",l.mergeProps({key:t,class:e.cx("item",{value:t}),onClick:function(e){return c.onOptionClick(e,t)}},c.getPTOptions("item",t),{"data-p-active":t<=e.modelValue,"data-p-focused":t===a.focusedOptionIndex}),[l.createElementVNode("span",l.mergeProps({class:"p-hidden-accessible"},e.ptm("hiddenItemInputWrapper"),{"data-p-hidden-accessible":!0}),[l.createElementVNode("input",l.mergeProps({type:"radio",value:t,name:a.name,checked:e.modelValue===t,disabled:e.disabled,readonly:e.readonly,"aria-label":c.starAriaLabel(t),onFocus:function(e){return c.onFocus(e,t)},onBlur:n[4]||(n[4]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)}),onChange:function(e){return c.onChange(e,t)}},e.ptm("hiddenItemInput")),null,16,h)],16),t<=e.modelValue?l.renderSlot(e.$slots,"onicon",{key:0,value:t,class:l.normalizeClass(e.cx("onIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.onIcon?"span":"StarFillIcon"),l.mergeProps({class:[e.cx("onIcon"),e.onIcon]},e.ptm("onIcon")),null,16,["class"]))]})):l.renderSlot(e.$slots,"officon",{key:1,value:t,class:l.normalizeClass(e.cx("offIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.offIcon?"span":"StarIcon"),l.mergeProps({class:[e.cx("offIcon"),e.offIcon]},e.ptm("offIcon")),null,16,["class"]))]}))],16,f)})),128))],16)},d}(primevue.icons.ban,primevue.icons.star,primevue.icons.starfill,primevue.utils,primevue.basecomponent,primevue.rating.style,Vue);
@@ -69,14 +69,13 @@ export default {
69
69
  };
70
70
  },
71
71
  watch: {
72
- '$attrs.id': {
73
- immediate: true,
74
- handler: function (newValue) {
75
- this.id = newValue || UniqueComponentId();
76
- }
72
+ '$attrs.id': function (newValue) {
73
+ this.id = newValue || UniqueComponentId();
77
74
  }
78
75
  },
79
76
  mounted() {
77
+ this.id = this.id || UniqueComponentId();
78
+
80
79
  if (this.$el.offsetParent) {
81
80
  this.initialize();
82
81
  }
@@ -130,22 +129,27 @@ export default {
130
129
  this.scrollYRatio = ownHeight / totalHeight;
131
130
 
132
131
  this.frame = this.requestAnimationFrame(() => {
133
- if (this.scrollXRatio >= 1) {
134
- this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
135
- !this.isUnstyled && DomHandler.addClass(this.$refs.xBar, 'p-scrollpanel-hidden');
136
- } else {
137
- this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
138
- !this.isUnstyled && DomHandler.removeClass(this.$refs.xBar, 'p-scrollpanel-hidden');
139
- this.$refs.xBar.style.cssText = 'width:' + Math.max(this.scrollXRatio * 100, 10) + '%; left:' + (this.$refs.content.scrollLeft / totalWidth) * 100 + '%;bottom:' + bottom + 'px;';
132
+ if (this.$refs.xBar) {
133
+ if (this.scrollXRatio >= 1) {
134
+ this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
135
+ !this.isUnstyled && DomHandler.addClass(this.$refs.xBar, 'p-scrollpanel-hidden');
136
+ } else {
137
+ this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
138
+ !this.isUnstyled && DomHandler.removeClass(this.$refs.xBar, 'p-scrollpanel-hidden');
139
+ this.$refs.xBar.style.cssText = 'width:' + Math.max(this.scrollXRatio * 100, 10) + '%; left:' + (this.$refs.content.scrollLeft / totalWidth) * 100 + '%;bottom:' + bottom + 'px;';
140
+ }
140
141
  }
141
142
 
142
- if (this.scrollYRatio >= 1) {
143
- this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
144
- !this.isUnstyled && DomHandler.addClass(this.$refs.yBar, 'p-scrollpanel-hidden');
145
- } else {
146
- this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
147
- !this.isUnstyled && DomHandler.removeClass(this.$refs.yBar, 'p-scrollpanel-hidden');
148
- this.$refs.yBar.style.cssText = 'height:' + Math.max(this.scrollYRatio * 100, 10) + '%; top: calc(' + (this.$refs.content.scrollTop / totalHeight) * 100 + '% - ' + this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
143
+ if (this.$refs.yBar) {
144
+ if (this.scrollYRatio >= 1) {
145
+ this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
146
+ !this.isUnstyled && DomHandler.addClass(this.$refs.yBar, 'p-scrollpanel-hidden');
147
+ } else {
148
+ this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
149
+ !this.isUnstyled && DomHandler.removeClass(this.$refs.yBar, 'p-scrollpanel-hidden');
150
+ this.$refs.yBar.style.cssText =
151
+ 'height:' + Math.max(this.scrollYRatio * 100, 10) + '%; top: calc(' + (this.$refs.content.scrollTop / totalHeight) * 100 + '% - ' + this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
152
+ }
149
153
  }
150
154
  });
151
155
  }
@@ -53,14 +53,12 @@ var script = {
53
53
  };
54
54
  },
55
55
  watch: {
56
- '$attrs.id': {
57
- immediate: true,
58
- handler: function handler(newValue) {
59
- this.id = newValue || utils.UniqueComponentId();
60
- }
56
+ '$attrs.id': function $attrsId(newValue) {
57
+ this.id = newValue || utils.UniqueComponentId();
61
58
  }
62
59
  },
63
60
  mounted: function mounted() {
61
+ this.id = this.id || utils.UniqueComponentId();
64
62
  if (this.$el.offsetParent) {
65
63
  this.initialize();
66
64
  }
@@ -109,21 +107,25 @@ var script = {
109
107
  var right = (this.$el.clientWidth - this.$refs.yBar.clientWidth) * -1;
110
108
  this.scrollYRatio = ownHeight / totalHeight;
111
109
  this.frame = this.requestAnimationFrame(function () {
112
- if (_this.scrollXRatio >= 1) {
113
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
114
- !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
115
- } else {
116
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
117
- !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
118
- _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
110
+ if (_this.$refs.xBar) {
111
+ if (_this.scrollXRatio >= 1) {
112
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
113
+ !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
114
+ } else {
115
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
116
+ !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
117
+ _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
118
+ }
119
119
  }
120
- if (_this.scrollYRatio >= 1) {
121
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
122
- !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
123
- } else {
124
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
125
- !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
126
- _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
120
+ if (_this.$refs.yBar) {
121
+ if (_this.scrollYRatio >= 1) {
122
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
123
+ !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
124
+ } else {
125
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
126
+ !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
127
+ _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
128
+ }
127
129
  }
128
130
  });
129
131
  }
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/utils"),t=require("primevue/basecomponent"),n=require("primevue/scrollpanel/style"),o=require("vue");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:s(t).default,props:{step:{type:Number,default:5}},style:s(n).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":{immediate:!0,handler:function(t){this.id=t||e.UniqueComponentId()}}},mounted:function(){this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var t=getComputedStyle(this.$el),n=getComputedStyle(this.$refs.xBar),o=e.DomHandler.getHeight(this.$el)-parseInt(n.height,10);"none"!==t["max-height"]&&0===o&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(n.height,10)>parseInt(t["max-height"],10)?t["max-height"]:this.$refs.content.offsetHeight+parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)+"px")},moveBar:function(){var t=this;if(this.$refs.content){var n=this.$refs.content.scrollWidth,o=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/n;var s=this.$refs.content.scrollHeight,r=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/s,this.frame=this.requestAnimationFrame((function(){t.scrollXRatio>=1?(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.xBar,"p-scrollpanel-hidden")):(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.xBar,"p-scrollpanel-hidden"),t.$refs.xBar.style.cssText="width:"+Math.max(100*t.scrollXRatio,10)+"%; left:"+t.$refs.content.scrollLeft/n*100+"%;bottom:"+o+"px;"),t.scrollYRatio>=1?(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.yBar,"p-scrollpanel-hidden")):(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.yBar,"p-scrollpanel-hidden"),t.$refs.yBar.style.cssText="height:"+Math.max(100*t.scrollYRatio,10)+"%; top: calc("+t.$refs.content.scrollTop/s*100+"% - "+t.$refs.xBar.clientHeight+"px);right:"+r+"px;")}))}},onYBarMouseDown:function(t){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=t.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onXBarMouseDown:function(t){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=t.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var n=this;this.clearTimer(),this.timer=setTimeout((function(){n.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,n=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=n/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,n=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=n/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},i=["id"],a=["aria-controls","aria-valuenow"],l=["aria-controls","aria-valuenow"];r.render=function(e,t,n,s,r,c){return o.openBlock(),o.createElementBlock("div",o.mergeProps({class:e.cx("root")},e.ptmi("root")),[o.createElementVNode("div",o.mergeProps({class:e.cx("wrapper")},e.ptm("wrapper")),[o.createElementVNode("div",o.mergeProps({ref:"content",id:c.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return c.onScroll&&c.onScroll.apply(c,arguments)}),onMouseenter:t[1]||(t[1]=function(){return c.moveBar&&c.moveBar.apply(c,arguments)})},e.ptm("content")),[o.renderSlot(e.$slots,"default")],16,i)],16),o.createElementVNode("div",o.mergeProps({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":c.contentId,"aria-valuenow":r.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return c.onXBarMouseDown&&c.onXBarMouseDown.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(e){return c.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[5]||(t[5]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)}),onBlur:t[6]||(t[6]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,a),o.createElementVNode("div",o.mergeProps({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":c.contentId,"aria-valuenow":r.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return c.onYBarMouseDown&&c.onYBarMouseDown.apply(c,arguments)}),onKeydown:t[8]||(t[8]=function(e){return c.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[10]||(t[10]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,l)],16)},module.exports=r;
1
+ "use strict";var e=require("primevue/utils"),t=require("primevue/basecomponent"),n=require("primevue/scrollpanel/style"),o=require("vue");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:s(t).default,props:{step:{type:Number,default:5}},style:s(n).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":function(t){this.id=t||e.UniqueComponentId()}},mounted:function(){this.id=this.id||e.UniqueComponentId(),this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var t=getComputedStyle(this.$el),n=getComputedStyle(this.$refs.xBar),o=e.DomHandler.getHeight(this.$el)-parseInt(n.height,10);"none"!==t["max-height"]&&0===o&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(n.height,10)>parseInt(t["max-height"],10)?t["max-height"]:this.$refs.content.offsetHeight+parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)+"px")},moveBar:function(){var t=this;if(this.$refs.content){var n=this.$refs.content.scrollWidth,o=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/n;var s=this.$refs.content.scrollHeight,r=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/s,this.frame=this.requestAnimationFrame((function(){t.$refs.xBar&&(t.scrollXRatio>=1?(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.xBar,"p-scrollpanel-hidden")):(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.xBar,"p-scrollpanel-hidden"),t.$refs.xBar.style.cssText="width:"+Math.max(100*t.scrollXRatio,10)+"%; left:"+t.$refs.content.scrollLeft/n*100+"%;bottom:"+o+"px;")),t.$refs.yBar&&(t.scrollYRatio>=1?(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.yBar,"p-scrollpanel-hidden")):(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.yBar,"p-scrollpanel-hidden"),t.$refs.yBar.style.cssText="height:"+Math.max(100*t.scrollYRatio,10)+"%; top: calc("+t.$refs.content.scrollTop/s*100+"% - "+t.$refs.xBar.clientHeight+"px);right:"+r+"px;"))}))}},onYBarMouseDown:function(t){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=t.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onXBarMouseDown:function(t){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=t.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var n=this;this.clearTimer(),this.timer=setTimeout((function(){n.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,n=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=n/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,n=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=n/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},i=["id"],a=["aria-controls","aria-valuenow"],l=["aria-controls","aria-valuenow"];r.render=function(e,t,n,s,r,c){return o.openBlock(),o.createElementBlock("div",o.mergeProps({class:e.cx("root")},e.ptmi("root")),[o.createElementVNode("div",o.mergeProps({class:e.cx("wrapper")},e.ptm("wrapper")),[o.createElementVNode("div",o.mergeProps({ref:"content",id:c.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return c.onScroll&&c.onScroll.apply(c,arguments)}),onMouseenter:t[1]||(t[1]=function(){return c.moveBar&&c.moveBar.apply(c,arguments)})},e.ptm("content")),[o.renderSlot(e.$slots,"default")],16,i)],16),o.createElementVNode("div",o.mergeProps({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":c.contentId,"aria-valuenow":r.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return c.onXBarMouseDown&&c.onXBarMouseDown.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(e){return c.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[5]||(t[5]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)}),onBlur:t[6]||(t[6]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,a),o.createElementVNode("div",o.mergeProps({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":c.contentId,"aria-valuenow":r.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return c.onYBarMouseDown&&c.onYBarMouseDown.apply(c,arguments)}),onKeydown:t[8]||(t[8]=function(e){return c.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[10]||(t[10]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,l)],16)},module.exports=r;
@@ -46,14 +46,12 @@ var script = {
46
46
  };
47
47
  },
48
48
  watch: {
49
- '$attrs.id': {
50
- immediate: true,
51
- handler: function handler(newValue) {
52
- this.id = newValue || UniqueComponentId();
53
- }
49
+ '$attrs.id': function $attrsId(newValue) {
50
+ this.id = newValue || UniqueComponentId();
54
51
  }
55
52
  },
56
53
  mounted: function mounted() {
54
+ this.id = this.id || UniqueComponentId();
57
55
  if (this.$el.offsetParent) {
58
56
  this.initialize();
59
57
  }
@@ -102,21 +100,25 @@ var script = {
102
100
  var right = (this.$el.clientWidth - this.$refs.yBar.clientWidth) * -1;
103
101
  this.scrollYRatio = ownHeight / totalHeight;
104
102
  this.frame = this.requestAnimationFrame(function () {
105
- if (_this.scrollXRatio >= 1) {
106
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
107
- !_this.isUnstyled && DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
108
- } else {
109
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
110
- !_this.isUnstyled && DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
111
- _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
103
+ if (_this.$refs.xBar) {
104
+ if (_this.scrollXRatio >= 1) {
105
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
106
+ !_this.isUnstyled && DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
107
+ } else {
108
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
109
+ !_this.isUnstyled && DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
110
+ _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
111
+ }
112
112
  }
113
- if (_this.scrollYRatio >= 1) {
114
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
115
- !_this.isUnstyled && DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
116
- } else {
117
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
118
- !_this.isUnstyled && DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
119
- _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
113
+ if (_this.$refs.yBar) {
114
+ if (_this.scrollYRatio >= 1) {
115
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
116
+ !_this.isUnstyled && DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
117
+ } else {
118
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
119
+ !_this.isUnstyled && DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
120
+ _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
121
+ }
120
122
  }
121
123
  });
122
124
  }
@@ -1 +1 @@
1
- import{UniqueComponentId as e,DomHandler as t}from"primevue/utils";import s from"primevue/basecomponent";import n from"primevue/scrollpanel/style";import{openBlock as o,createElementBlock as i,mergeProps as r,createElementVNode as a,renderSlot as l}from"vue";var c={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:s,props:{step:{type:Number,default:5}},style:n,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":{immediate:!0,handler:function(t){this.id=t||e()}}},mounted:function(){this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var e=getComputedStyle(this.$el),s=getComputedStyle(this.$refs.xBar),n=t.getHeight(this.$el)-parseInt(s.height,10);"none"!==e["max-height"]&&0===n&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(s.height,10)>parseInt(e["max-height"],10)?e["max-height"]:this.$refs.content.offsetHeight+parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)+parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth)+"px")},moveBar:function(){var e=this;if(this.$refs.content){var s=this.$refs.content.scrollWidth,n=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/s;var o=this.$refs.content.scrollHeight,i=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/o,this.frame=this.requestAnimationFrame((function(){e.scrollXRatio>=1?(e.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!e.isUnstyled&&t.addClass(e.$refs.xBar,"p-scrollpanel-hidden")):(e.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!e.isUnstyled&&t.removeClass(e.$refs.xBar,"p-scrollpanel-hidden"),e.$refs.xBar.style.cssText="width:"+Math.max(100*e.scrollXRatio,10)+"%; left:"+e.$refs.content.scrollLeft/s*100+"%;bottom:"+n+"px;"),e.scrollYRatio>=1?(e.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!e.isUnstyled&&t.addClass(e.$refs.yBar,"p-scrollpanel-hidden")):(e.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!e.isUnstyled&&t.removeClass(e.$refs.yBar,"p-scrollpanel-hidden"),e.$refs.yBar.style.cssText="height:"+Math.max(100*e.scrollYRatio,10)+"%; top: calc("+e.$refs.content.scrollTop/o*100+"% - "+e.$refs.xBar.clientHeight+"px);right:"+i+"px;")}))}},onYBarMouseDown:function(e){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=e.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&t.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&t.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),e.preventDefault()},onXBarMouseDown:function(e){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=e.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),e.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var s=this;this.clearTimer(),this.timer=setTimeout((function(){s.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,s=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=s/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,s=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=s/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},u=["id"],h=["aria-controls","aria-valuenow"],d=["aria-controls","aria-valuenow"];c.render=function(e,t,s,n,c,p){return o(),i("div",r({class:e.cx("root")},e.ptmi("root")),[a("div",r({class:e.cx("wrapper")},e.ptm("wrapper")),[a("div",r({ref:"content",id:p.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return p.onScroll&&p.onScroll.apply(p,arguments)}),onMouseenter:t[1]||(t[1]=function(){return p.moveBar&&p.moveBar.apply(p,arguments)})},e.ptm("content")),[l(e.$slots,"default")],16,u)],16),a("div",r({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":p.contentId,"aria-valuenow":c.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return p.onXBarMouseDown&&p.onXBarMouseDown.apply(p,arguments)}),onKeydown:t[3]||(t[3]=function(e){return p.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return p.onKeyUp&&p.onKeyUp.apply(p,arguments)}),onFocus:t[5]||(t[5]=function(){return p.onFocus&&p.onFocus.apply(p,arguments)}),onBlur:t[6]||(t[6]=function(){return p.onBlur&&p.onBlur.apply(p,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,h),a("div",r({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":p.contentId,"aria-valuenow":c.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return p.onYBarMouseDown&&p.onYBarMouseDown.apply(p,arguments)}),onKeydown:t[8]||(t[8]=function(e){return p.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return p.onKeyUp&&p.onKeyUp.apply(p,arguments)}),onFocus:t[10]||(t[10]=function(){return p.onFocus&&p.onFocus.apply(p,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,d)],16)};export{c as default};
1
+ import{UniqueComponentId as e,DomHandler as t}from"primevue/utils";import s from"primevue/basecomponent";import n from"primevue/scrollpanel/style";import{openBlock as o,createElementBlock as i,mergeProps as r,createElementVNode as a,renderSlot as l}from"vue";var c={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:s,props:{step:{type:Number,default:5}},style:n,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":function(t){this.id=t||e()}},mounted:function(){this.id=this.id||e(),this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var e=getComputedStyle(this.$el),s=getComputedStyle(this.$refs.xBar),n=t.getHeight(this.$el)-parseInt(s.height,10);"none"!==e["max-height"]&&0===n&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(s.height,10)>parseInt(e["max-height"],10)?e["max-height"]:this.$refs.content.offsetHeight+parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)+parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth)+"px")},moveBar:function(){var e=this;if(this.$refs.content){var s=this.$refs.content.scrollWidth,n=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/s;var o=this.$refs.content.scrollHeight,i=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/o,this.frame=this.requestAnimationFrame((function(){e.$refs.xBar&&(e.scrollXRatio>=1?(e.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!e.isUnstyled&&t.addClass(e.$refs.xBar,"p-scrollpanel-hidden")):(e.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!e.isUnstyled&&t.removeClass(e.$refs.xBar,"p-scrollpanel-hidden"),e.$refs.xBar.style.cssText="width:"+Math.max(100*e.scrollXRatio,10)+"%; left:"+e.$refs.content.scrollLeft/s*100+"%;bottom:"+n+"px;")),e.$refs.yBar&&(e.scrollYRatio>=1?(e.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!e.isUnstyled&&t.addClass(e.$refs.yBar,"p-scrollpanel-hidden")):(e.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!e.isUnstyled&&t.removeClass(e.$refs.yBar,"p-scrollpanel-hidden"),e.$refs.yBar.style.cssText="height:"+Math.max(100*e.scrollYRatio,10)+"%; top: calc("+e.$refs.content.scrollTop/o*100+"% - "+e.$refs.xBar.clientHeight+"px);right:"+i+"px;"))}))}},onYBarMouseDown:function(e){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=e.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&t.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&t.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),e.preventDefault()},onXBarMouseDown:function(e){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=e.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),e.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var s=this;this.clearTimer(),this.timer=setTimeout((function(){s.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,s=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=s/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,s=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=s/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&t.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},u=["id"],h=["aria-controls","aria-valuenow"],d=["aria-controls","aria-valuenow"];c.render=function(e,t,s,n,c,p){return o(),i("div",r({class:e.cx("root")},e.ptmi("root")),[a("div",r({class:e.cx("wrapper")},e.ptm("wrapper")),[a("div",r({ref:"content",id:p.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return p.onScroll&&p.onScroll.apply(p,arguments)}),onMouseenter:t[1]||(t[1]=function(){return p.moveBar&&p.moveBar.apply(p,arguments)})},e.ptm("content")),[l(e.$slots,"default")],16,u)],16),a("div",r({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":p.contentId,"aria-valuenow":c.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return p.onXBarMouseDown&&p.onXBarMouseDown.apply(p,arguments)}),onKeydown:t[3]||(t[3]=function(e){return p.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return p.onKeyUp&&p.onKeyUp.apply(p,arguments)}),onFocus:t[5]||(t[5]=function(){return p.onFocus&&p.onFocus.apply(p,arguments)}),onBlur:t[6]||(t[6]=function(){return p.onBlur&&p.onBlur.apply(p,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,h),a("div",r({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":p.contentId,"aria-valuenow":c.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return p.onYBarMouseDown&&p.onYBarMouseDown.apply(p,arguments)}),onKeydown:t[8]||(t[8]=function(e){return p.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return p.onKeyUp&&p.onKeyUp.apply(p,arguments)}),onFocus:t[10]||(t[10]=function(){return p.onFocus&&p.onFocus.apply(p,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,d)],16)};export{c as default};
@@ -50,14 +50,12 @@ this.primevue.scrollpanel = (function (utils, BaseComponent, ScrollPanelStyle, v
50
50
  };
51
51
  },
52
52
  watch: {
53
- '$attrs.id': {
54
- immediate: true,
55
- handler: function handler(newValue) {
56
- this.id = newValue || utils.UniqueComponentId();
57
- }
53
+ '$attrs.id': function $attrsId(newValue) {
54
+ this.id = newValue || utils.UniqueComponentId();
58
55
  }
59
56
  },
60
57
  mounted: function mounted() {
58
+ this.id = this.id || utils.UniqueComponentId();
61
59
  if (this.$el.offsetParent) {
62
60
  this.initialize();
63
61
  }
@@ -106,21 +104,25 @@ this.primevue.scrollpanel = (function (utils, BaseComponent, ScrollPanelStyle, v
106
104
  var right = (this.$el.clientWidth - this.$refs.yBar.clientWidth) * -1;
107
105
  this.scrollYRatio = ownHeight / totalHeight;
108
106
  this.frame = this.requestAnimationFrame(function () {
109
- if (_this.scrollXRatio >= 1) {
110
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
111
- !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
112
- } else {
113
- _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
114
- !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
115
- _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
107
+ if (_this.$refs.xBar) {
108
+ if (_this.scrollXRatio >= 1) {
109
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'true');
110
+ !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
111
+ } else {
112
+ _this.$refs.xBar.setAttribute('data-p-scrollpanel-hidden', 'false');
113
+ !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.xBar, 'p-scrollpanel-hidden');
114
+ _this.$refs.xBar.style.cssText = 'width:' + Math.max(_this.scrollXRatio * 100, 10) + '%; left:' + _this.$refs.content.scrollLeft / totalWidth * 100 + '%;bottom:' + bottom + 'px;';
115
+ }
116
116
  }
117
- if (_this.scrollYRatio >= 1) {
118
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
119
- !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
120
- } else {
121
- _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
122
- !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
123
- _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
117
+ if (_this.$refs.yBar) {
118
+ if (_this.scrollYRatio >= 1) {
119
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'true');
120
+ !_this.isUnstyled && utils.DomHandler.addClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
121
+ } else {
122
+ _this.$refs.yBar.setAttribute('data-p-scrollpanel-hidden', 'false');
123
+ !_this.isUnstyled && utils.DomHandler.removeClass(_this.$refs.yBar, 'p-scrollpanel-hidden');
124
+ _this.$refs.yBar.style.cssText = 'height:' + Math.max(_this.scrollYRatio * 100, 10) + '%; top: calc(' + _this.$refs.content.scrollTop / totalHeight * 100 + '% - ' + _this.$refs.xBar.clientHeight + 'px);right:' + right + 'px;';
125
+ }
124
126
  }
125
127
  });
126
128
  }
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.scrollpanel=function(e,t,n,s){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:o(t).default,props:{step:{type:Number,default:5}},style:o(n).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":{immediate:!0,handler:function(t){this.id=t||e.UniqueComponentId()}}},mounted:function(){this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var t=getComputedStyle(this.$el),n=getComputedStyle(this.$refs.xBar),s=e.DomHandler.getHeight(this.$el)-parseInt(n.height,10);"none"!==t["max-height"]&&0===s&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(n.height,10)>parseInt(t["max-height"],10)?t["max-height"]:this.$refs.content.offsetHeight+parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)+"px")},moveBar:function(){var t=this;if(this.$refs.content){var n=this.$refs.content.scrollWidth,s=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/n;var o=this.$refs.content.scrollHeight,r=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/o,this.frame=this.requestAnimationFrame((function(){t.scrollXRatio>=1?(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.xBar,"p-scrollpanel-hidden")):(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.xBar,"p-scrollpanel-hidden"),t.$refs.xBar.style.cssText="width:"+Math.max(100*t.scrollXRatio,10)+"%; left:"+t.$refs.content.scrollLeft/n*100+"%;bottom:"+s+"px;"),t.scrollYRatio>=1?(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.yBar,"p-scrollpanel-hidden")):(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.yBar,"p-scrollpanel-hidden"),t.$refs.yBar.style.cssText="height:"+Math.max(100*t.scrollYRatio,10)+"%; top: calc("+t.$refs.content.scrollTop/o*100+"% - "+t.$refs.xBar.clientHeight+"px);right:"+r+"px;")}))}},onYBarMouseDown:function(t){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=t.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onXBarMouseDown:function(t){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=t.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var n=this;this.clearTimer(),this.timer=setTimeout((function(){n.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,n=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=n/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,n=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=n/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},i=["id"],a=["aria-controls","aria-valuenow"],l=["aria-controls","aria-valuenow"];return r.render=function(e,t,n,o,r,c){return s.openBlock(),s.createElementBlock("div",s.mergeProps({class:e.cx("root")},e.ptmi("root")),[s.createElementVNode("div",s.mergeProps({class:e.cx("wrapper")},e.ptm("wrapper")),[s.createElementVNode("div",s.mergeProps({ref:"content",id:c.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return c.onScroll&&c.onScroll.apply(c,arguments)}),onMouseenter:t[1]||(t[1]=function(){return c.moveBar&&c.moveBar.apply(c,arguments)})},e.ptm("content")),[s.renderSlot(e.$slots,"default")],16,i)],16),s.createElementVNode("div",s.mergeProps({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":c.contentId,"aria-valuenow":r.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return c.onXBarMouseDown&&c.onXBarMouseDown.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(e){return c.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[5]||(t[5]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)}),onBlur:t[6]||(t[6]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,a),s.createElementVNode("div",s.mergeProps({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":c.contentId,"aria-valuenow":r.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return c.onYBarMouseDown&&c.onYBarMouseDown.apply(c,arguments)}),onKeydown:t[8]||(t[8]=function(e){return c.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[10]||(t[10]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,l)],16)},r}(primevue.utils,primevue.basecomponent,primevue.scrollpanel.style,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.scrollpanel=function(e,t,n,s){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r={name:"ScrollPanel",extends:{name:"BaseScrollPanel",extends:o(t).default,props:{step:{type:Number,default:5}},style:o(n).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,initialized:!1,documentResizeListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,frame:null,scrollXRatio:null,scrollYRatio:null,isXBarClicked:!1,isYBarClicked:!1,lastPageX:null,lastPageY:null,timer:null,outsideClickListener:null,data:function(){return{id:this.$attrs.id,orientation:"vertical",lastScrollTop:0,lastScrollLeft:0}},watch:{"$attrs.id":function(t){this.id=t||e.UniqueComponentId()}},mounted:function(){this.id=this.id||e.UniqueComponentId(),this.$el.offsetParent&&this.initialize()},updated:function(){!this.initialized&&this.$el.offsetParent&&this.initialize()},beforeUnmount:function(){this.unbindDocumentResizeListener(),this.frame&&window.cancelAnimationFrame(this.frame)},methods:{initialize:function(){this.moveBar(),this.bindDocumentResizeListener(),this.calculateContainerHeight()},calculateContainerHeight:function(){var t=getComputedStyle(this.$el),n=getComputedStyle(this.$refs.xBar),s=e.DomHandler.getHeight(this.$el)-parseInt(n.height,10);"none"!==t["max-height"]&&0===s&&(this.$el.style.height=this.$refs.content.offsetHeight+parseInt(n.height,10)>parseInt(t["max-height"],10)?t["max-height"]:this.$refs.content.offsetHeight+parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth)+"px")},moveBar:function(){var t=this;if(this.$refs.content){var n=this.$refs.content.scrollWidth,s=-1*(this.$el.clientHeight-this.$refs.xBar.clientHeight);this.scrollXRatio=this.$refs.content.clientWidth/n;var o=this.$refs.content.scrollHeight,r=-1*(this.$el.clientWidth-this.$refs.yBar.clientWidth);this.scrollYRatio=this.$refs.content.clientHeight/o,this.frame=this.requestAnimationFrame((function(){t.$refs.xBar&&(t.scrollXRatio>=1?(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.xBar,"p-scrollpanel-hidden")):(t.$refs.xBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.xBar,"p-scrollpanel-hidden"),t.$refs.xBar.style.cssText="width:"+Math.max(100*t.scrollXRatio,10)+"%; left:"+t.$refs.content.scrollLeft/n*100+"%;bottom:"+s+"px;")),t.$refs.yBar&&(t.scrollYRatio>=1?(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","true"),!t.isUnstyled&&e.DomHandler.addClass(t.$refs.yBar,"p-scrollpanel-hidden")):(t.$refs.yBar.setAttribute("data-p-scrollpanel-hidden","false"),!t.isUnstyled&&e.DomHandler.removeClass(t.$refs.yBar,"p-scrollpanel-hidden"),t.$refs.yBar.style.cssText="height:"+Math.max(100*t.scrollYRatio,10)+"%; top: calc("+t.$refs.content.scrollTop/o*100+"% - "+t.$refs.xBar.clientHeight+"px);right:"+r+"px;"))}))}},onYBarMouseDown:function(t){this.isYBarClicked=!0,this.$refs.yBar.focus(),this.lastPageY=t.pageY,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.yBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","true"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onXBarMouseDown:function(t){this.isXBarClicked=!0,this.$refs.xBar.focus(),this.lastPageX=t.pageX,this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),this.bindDocumentMouseListeners(),t.preventDefault()},onScroll:function(e){this.lastScrollLeft!==e.target.scrollLeft?(this.lastScrollLeft=e.target.scrollLeft,this.orientation="horizontal"):this.lastScrollTop!==e.target.scrollTop&&(this.lastScrollTop=e.target.scrollTop,this.orientation="vertical"),this.moveBar()},onKeyDown:function(e){if("vertical"===this.orientation)switch(e.code){case"ArrowDown":this.setTimer("scrollTop",this.step),e.preventDefault();break;case"ArrowUp":this.setTimer("scrollTop",-1*this.step),e.preventDefault();break;case"ArrowLeft":case"ArrowRight":e.preventDefault()}else if("horizontal"===this.orientation)switch(e.code){case"ArrowRight":this.setTimer("scrollLeft",this.step),e.preventDefault();break;case"ArrowLeft":this.setTimer("scrollLeft",-1*this.step),e.preventDefault();break;case"ArrowDown":case"ArrowUp":e.preventDefault()}},onKeyUp:function(){this.clearTimer()},repeat:function(e,t){this.$refs.content[e]+=t,this.moveBar()},setTimer:function(e,t){var n=this;this.clearTimer(),this.timer=setTimeout((function(){n.repeat(e,t)}),40)},clearTimer:function(){this.timer&&clearTimeout(this.timer)},onDocumentMouseMove:function(e){this.isXBarClicked?this.onMouseMoveForXBar(e):(this.isYBarClicked||this.onMouseMoveForXBar(e),this.onMouseMoveForYBar(e))},onMouseMoveForXBar:function(e){var t=this,n=e.pageX-this.lastPageX;this.lastPageX=e.pageX,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollLeft+=n/t.scrollXRatio}))},onMouseMoveForYBar:function(e){var t=this,n=e.pageY-this.lastPageY;this.lastPageY=e.pageY,this.frame=this.requestAnimationFrame((function(){t.$refs.content.scrollTop+=n/t.scrollYRatio}))},onFocus:function(e){this.$refs.xBar.isSameNode(e.target)?this.orientation="horizontal":this.$refs.yBar.isSameNode(e.target)&&(this.orientation="vertical")},onBlur:function(){"horizontal"===this.orientation&&(this.orientation="vertical")},onDocumentMouseUp:function(){this.$refs.yBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.yBar,"p-scrollpanel-grabbed"),this.$refs.xBar.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(this.$refs.xBar,"p-scrollpanel-grabbed"),document.body.setAttribute("data-p-scrollpanel-grabbed","false"),!this.isUnstyled&&e.DomHandler.removeClass(document.body,"p-scrollpanel-grabbed"),this.unbindDocumentMouseListeners(),this.isXBarClicked=!1,this.isYBarClicked=!1},requestAnimationFrame:function(e){return(window.requestAnimationFrame||this.timeoutFrame)(e)},refresh:function(){this.moveBar()},scrollTop:function(e){var t=this.$refs.content.scrollHeight-this.$refs.content.clientHeight;this.$refs.content.scrollTop=e=e>t?t:e>0?e:0},timeoutFrame:function(e){setTimeout(e,0)},bindDocumentMouseListeners:function(){var e=this;this.documentMouseMoveListener||(this.documentMouseMoveListener=function(t){e.onDocumentMouseMove(t)},document.addEventListener("mousemove",this.documentMouseMoveListener)),this.documentMouseUpListener||(this.documentMouseUpListener=function(t){e.onDocumentMouseUp(t)},document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseListeners:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null),this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},bindDocumentResizeListener:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(){e.moveBar()},window.addEventListener("resize",this.documentResizeListener))},unbindDocumentResizeListener:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},computed:{contentId:function(){return this.id+"_content"}}},i=["id"],a=["aria-controls","aria-valuenow"],l=["aria-controls","aria-valuenow"];return r.render=function(e,t,n,o,r,c){return s.openBlock(),s.createElementBlock("div",s.mergeProps({class:e.cx("root")},e.ptmi("root")),[s.createElementVNode("div",s.mergeProps({class:e.cx("wrapper")},e.ptm("wrapper")),[s.createElementVNode("div",s.mergeProps({ref:"content",id:c.contentId,class:e.cx("content"),onScroll:t[0]||(t[0]=function(){return c.onScroll&&c.onScroll.apply(c,arguments)}),onMouseenter:t[1]||(t[1]=function(){return c.moveBar&&c.moveBar.apply(c,arguments)})},e.ptm("content")),[s.renderSlot(e.$slots,"default")],16,i)],16),s.createElementVNode("div",s.mergeProps({ref:"xBar",class:e.cx("barx"),tabindex:"0",role:"scrollbar","aria-orientation":"horizontal","aria-controls":c.contentId,"aria-valuenow":r.lastScrollLeft,onMousedown:t[2]||(t[2]=function(){return c.onXBarMouseDown&&c.onXBarMouseDown.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(e){return c.onKeyDown(e)}),onKeyup:t[4]||(t[4]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[5]||(t[5]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)}),onBlur:t[6]||(t[6]=function(){return c.onBlur&&c.onBlur.apply(c,arguments)})},e.ptm("barx"),{"data-pc-group-section":"bar"}),null,16,a),s.createElementVNode("div",s.mergeProps({ref:"yBar",class:e.cx("bary"),tabindex:"0",role:"scrollbar","aria-orientation":"vertical","aria-controls":c.contentId,"aria-valuenow":r.lastScrollTop,onMousedown:t[7]||(t[7]=function(){return c.onYBarMouseDown&&c.onYBarMouseDown.apply(c,arguments)}),onKeydown:t[8]||(t[8]=function(e){return c.onKeyDown(e)}),onKeyup:t[9]||(t[9]=function(){return c.onKeyUp&&c.onKeyUp.apply(c,arguments)}),onFocus:t[10]||(t[10]=function(){return c.onFocus&&c.onFocus.apply(c,arguments)})},e.ptm("bary"),{"data-pc-group-section":"bar"}),null,16,l)],16)},r}(primevue.utils,primevue.basecomponent,primevue.scrollpanel.style,Vue);
@@ -52,6 +52,15 @@ export default {
52
52
  return {
53
53
  $parentInstance: this
54
54
  };
55
+ },
56
+ watch: {
57
+ dismissable(newValue) {
58
+ if (newValue) {
59
+ this.bindOutsideClickListener();
60
+ } else {
61
+ this.unbindOutsideClickListener();
62
+ }
63
+ }
55
64
  }
56
65
  };
57
66
  </script>
@@ -68,6 +68,15 @@ var script$1 = {
68
68
  return {
69
69
  $parentInstance: this
70
70
  };
71
+ },
72
+ watch: {
73
+ dismissable: function dismissable(newValue) {
74
+ if (newValue) {
75
+ this.bindOutsideClickListener();
76
+ } else {
77
+ this.unbindOutsideClickListener();
78
+ }
79
+ }
71
80
  }
72
81
  };
73
82
 
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/focustrap"),t=require("primevue/icons/times"),n=require("primevue/portal"),o=require("primevue/ripple"),i=require("primevue/utils"),s=require("primevue/basecomponent"),r=require("primevue/sidebar/style"),l=require("vue");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=c(e),u=c(t),d=c(n),m=c(o),h={name:"Sidebar",extends:{name:"BaseSidebar",extends:c(s).default,props:{visible:{type:Boolean,default:!1},position:{type:String,default:"left"},header:{type:null,default:null},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},dismissable:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},closeIcon:{type:String,default:void 0},modal:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1}},style:c(r).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide"],data:function(){return{containerVisible:this.visible}},container:null,mask:null,content:null,headerContainer:null,closeButton:null,outsideClickListener:null,documentKeydownListener:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.disableDocumentSettings(),this.mask&&this.autoZIndex&&i.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},methods:{hide:function(){this.$emit("update:visible",!1)},onEnter:function(){this.$emit("show"),this.focus(),this.bindDocumentKeyDownListener(),this.autoZIndex&&i.ZIndexUtils.set("modal",this.mask,this.baseZIndex||this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.enableDocumentSettings()},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&i.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide")},onAfterLeave:function(){this.autoZIndex&&i.ZIndexUtils.clear(this.mask),this.unbindDocumentKeyDownListener(),this.containerVisible=!1,this.disableDocumentSettings(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissable&&this.modal&&this.mask===e.target&&this.hide()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.header&&e(this.headerContainer);t||(t=this.$slots.default&&e(this.container))||(t=this.closeButton),t&&i.DomHandler.focus(t)},enableDocumentSettings:function(){this.dismissable&&!this.modal&&this.bindOutsideClickListener(),this.blockScroll&&i.DomHandler.blockBodyScroll()},disableDocumentSettings:function(){this.unbindOutsideClickListener(),this.blockScroll&&i.DomHandler.unblockBodyScroll()},onKeydown:function(e){"Escape"===e.code&&this.hide()},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},closeButtonRef:function(e){this.closeButton=e},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeydown,document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.isOutsideClicked(t)&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},isOutsideClicked:function(e){return this.container&&!this.container.contains(e.target)}},computed:{fullScreen:function(){return"full"===this.position},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},directives:{focustrap:a.default,ripple:m.default},components:{Portal:d.default,TimesIcon:u.default}},f=["aria-modal"],p=["aria-label"];h.render=function(e,t,n,o,i,s){var r=l.resolveComponent("Portal"),c=l.resolveDirective("ripple"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(r,null,{default:l.withCtx((function(){return[i.containerVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.maskRef,onMousedown:t[1]||(t[1]=function(){return s.onMaskClick&&s.onMaskClick.apply(s,arguments)}),class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position})},e.ptm("mask")),[l.createVNode(l.Transition,l.mergeProps({name:"p-sidebar",onEnter:s.onEnter,onAfterEnter:s.onAfterEnter,onBeforeLeave:s.onBeforeLeave,onLeave:s.onLeave,onAfterLeave:s.onAfterLeave,appear:""},e.ptm("transition")),{default:l.withCtx((function(){return[e.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.containerRef,class:e.cx("root"),role:"complementary","aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,onClose:s.hide,closeCallback:s.hide}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createElementVNode("div",l.mergeProps({ref:s.headerContainerRef,class:e.cx("header")},e.ptm("header")),[l.renderSlot(e.$slots,"header",{class:l.normalizeClass(e.cx("title"))},(function(){return[e.header?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("title")},e.ptm("title")),l.toDisplayString(e.header),17)):l.createCommentVNode("",!0)]})),e.showCloseIcon?l.withDirectives((l.openBlock(),l.createElementBlock("button",l.mergeProps({key:0,ref:s.closeButtonRef,type:"button",class:e.cx("closeButton"),"aria-label":s.closeAriaLabel,onClick:t[0]||(t[0]=function(){return s.hide&&s.hide.apply(s,arguments)})},e.ptm("closeButton"),{"data-pc-group-section":"iconcontainer"}),[l.renderSlot(e.$slots,"closeicon",{class:l.normalizeClass(e.cx("closeIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),l.mergeProps({class:[e.cx("closeIcon"),e.closeIcon]},e.ptm("closeIcon")),null,16,["class"]))]}))],16,p)),[[c]]):l.createCommentVNode("",!0)],16),l.createElementVNode("div",l.mergeProps({ref:s.contentRef,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"default")],16)],64))],16,f)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):l.createCommentVNode("",!0)]})),_:3})},module.exports=h;
1
+ "use strict";var e=require("primevue/focustrap"),t=require("primevue/icons/times"),n=require("primevue/portal"),i=require("primevue/ripple"),o=require("primevue/utils"),s=require("primevue/basecomponent"),r=require("primevue/sidebar/style"),l=require("vue");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=c(e),u=c(t),d=c(n),m=c(i),h={name:"Sidebar",extends:{name:"BaseSidebar",extends:c(s).default,props:{visible:{type:Boolean,default:!1},position:{type:String,default:"left"},header:{type:null,default:null},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},dismissable:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},closeIcon:{type:String,default:void 0},modal:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1}},style:c(r).default,provide:function(){return{$parentInstance:this}},watch:{dismissable:function(e){e?this.bindOutsideClickListener():this.unbindOutsideClickListener()}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide"],data:function(){return{containerVisible:this.visible}},container:null,mask:null,content:null,headerContainer:null,closeButton:null,outsideClickListener:null,documentKeydownListener:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.disableDocumentSettings(),this.mask&&this.autoZIndex&&o.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},methods:{hide:function(){this.$emit("update:visible",!1)},onEnter:function(){this.$emit("show"),this.focus(),this.bindDocumentKeyDownListener(),this.autoZIndex&&o.ZIndexUtils.set("modal",this.mask,this.baseZIndex||this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.enableDocumentSettings()},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&o.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide")},onAfterLeave:function(){this.autoZIndex&&o.ZIndexUtils.clear(this.mask),this.unbindDocumentKeyDownListener(),this.containerVisible=!1,this.disableDocumentSettings(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissable&&this.modal&&this.mask===e.target&&this.hide()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.header&&e(this.headerContainer);t||(t=this.$slots.default&&e(this.container))||(t=this.closeButton),t&&o.DomHandler.focus(t)},enableDocumentSettings:function(){this.dismissable&&!this.modal&&this.bindOutsideClickListener(),this.blockScroll&&o.DomHandler.blockBodyScroll()},disableDocumentSettings:function(){this.unbindOutsideClickListener(),this.blockScroll&&o.DomHandler.unblockBodyScroll()},onKeydown:function(e){"Escape"===e.code&&this.hide()},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},closeButtonRef:function(e){this.closeButton=e},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeydown,document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.isOutsideClicked(t)&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},isOutsideClicked:function(e){return this.container&&!this.container.contains(e.target)}},computed:{fullScreen:function(){return"full"===this.position},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},directives:{focustrap:a.default,ripple:m.default},components:{Portal:d.default,TimesIcon:u.default}},f=["aria-modal"],p=["aria-label"];h.render=function(e,t,n,i,o,s){var r=l.resolveComponent("Portal"),c=l.resolveDirective("ripple"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(r,null,{default:l.withCtx((function(){return[o.containerVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.maskRef,onMousedown:t[1]||(t[1]=function(){return s.onMaskClick&&s.onMaskClick.apply(s,arguments)}),class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position})},e.ptm("mask")),[l.createVNode(l.Transition,l.mergeProps({name:"p-sidebar",onEnter:s.onEnter,onAfterEnter:s.onAfterEnter,onBeforeLeave:s.onBeforeLeave,onLeave:s.onLeave,onAfterLeave:s.onAfterLeave,appear:""},e.ptm("transition")),{default:l.withCtx((function(){return[e.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.containerRef,class:e.cx("root"),role:"complementary","aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,onClose:s.hide,closeCallback:s.hide}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createElementVNode("div",l.mergeProps({ref:s.headerContainerRef,class:e.cx("header")},e.ptm("header")),[l.renderSlot(e.$slots,"header",{class:l.normalizeClass(e.cx("title"))},(function(){return[e.header?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("title")},e.ptm("title")),l.toDisplayString(e.header),17)):l.createCommentVNode("",!0)]})),e.showCloseIcon?l.withDirectives((l.openBlock(),l.createElementBlock("button",l.mergeProps({key:0,ref:s.closeButtonRef,type:"button",class:e.cx("closeButton"),"aria-label":s.closeAriaLabel,onClick:t[0]||(t[0]=function(){return s.hide&&s.hide.apply(s,arguments)})},e.ptm("closeButton"),{"data-pc-group-section":"iconcontainer"}),[l.renderSlot(e.$slots,"closeicon",{class:l.normalizeClass(e.cx("closeIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),l.mergeProps({class:[e.cx("closeIcon"),e.closeIcon]},e.ptm("closeIcon")),null,16,["class"]))]}))],16,p)),[[c]]):l.createCommentVNode("",!0)],16),l.createElementVNode("div",l.mergeProps({ref:s.contentRef,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"default")],16)],64))],16,f)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):l.createCommentVNode("",!0)]})),_:3})},module.exports=h;
@@ -57,6 +57,15 @@ var script$1 = {
57
57
  return {
58
58
  $parentInstance: this
59
59
  };
60
+ },
61
+ watch: {
62
+ dismissable: function dismissable(newValue) {
63
+ if (newValue) {
64
+ this.bindOutsideClickListener();
65
+ } else {
66
+ this.unbindOutsideClickListener();
67
+ }
68
+ }
60
69
  }
61
70
  };
62
71