primereact 10.6.5 → 10.6.6

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 (169) hide show
  1. package/README.md +1 -1
  2. package/api/api.d.ts +8 -0
  3. package/chart/chart.d.ts +1 -13
  4. package/column/column.d.ts +6 -0
  5. package/core/core.js +94 -30
  6. package/core/core.min.js +8 -8
  7. package/datatable/datatable.cjs.js +56 -46
  8. package/datatable/datatable.cjs.min.js +1 -1
  9. package/datatable/datatable.esm.js +56 -46
  10. package/datatable/datatable.esm.min.js +1 -1
  11. package/datatable/datatable.js +56 -46
  12. package/datatable/datatable.min.js +1 -1
  13. package/dialog/dialog.cjs.js +5 -3
  14. package/dialog/dialog.cjs.min.js +1 -1
  15. package/dialog/dialog.esm.js +5 -3
  16. package/dialog/dialog.esm.min.js +1 -1
  17. package/dialog/dialog.js +5 -3
  18. package/dialog/dialog.min.js +1 -1
  19. package/dropdown/dropdown.cjs.js +3 -3
  20. package/dropdown/dropdown.cjs.min.js +1 -1
  21. package/dropdown/dropdown.esm.js +3 -3
  22. package/dropdown/dropdown.esm.min.js +1 -1
  23. package/dropdown/dropdown.js +3 -3
  24. package/dropdown/dropdown.min.js +1 -1
  25. package/galleria/galleria.cjs.js +7 -0
  26. package/galleria/galleria.cjs.min.js +1 -1
  27. package/galleria/galleria.esm.js +8 -1
  28. package/galleria/galleria.esm.min.js +1 -1
  29. package/galleria/galleria.js +7 -0
  30. package/galleria/galleria.min.js +1 -1
  31. package/inputnumber/inputnumber.cjs.js +14 -11
  32. package/inputnumber/inputnumber.cjs.min.js +1 -1
  33. package/inputnumber/inputnumber.esm.js +14 -11
  34. package/inputnumber/inputnumber.esm.min.js +1 -1
  35. package/inputnumber/inputnumber.js +14 -11
  36. package/inputnumber/inputnumber.min.js +1 -1
  37. package/inputotp/inputotp.cjs.js +25 -1
  38. package/inputotp/inputotp.cjs.min.js +1 -1
  39. package/inputotp/inputotp.esm.js +26 -2
  40. package/inputotp/inputotp.esm.min.js +1 -1
  41. package/inputotp/inputotp.js +25 -1
  42. package/inputotp/inputotp.min.js +1 -1
  43. package/keyfilter/keyfilter.cjs.js +1 -1
  44. package/keyfilter/keyfilter.cjs.min.js +1 -1
  45. package/keyfilter/keyfilter.esm.js +1 -1
  46. package/keyfilter/keyfilter.esm.min.js +1 -1
  47. package/keyfilter/keyfilter.js +1 -1
  48. package/keyfilter/keyfilter.min.js +1 -1
  49. package/metergroup/metergroup.cjs.js +2 -1
  50. package/metergroup/metergroup.cjs.min.js +1 -1
  51. package/metergroup/metergroup.esm.js +2 -1
  52. package/metergroup/metergroup.esm.min.js +1 -1
  53. package/metergroup/metergroup.js +2 -1
  54. package/metergroup/metergroup.min.js +1 -1
  55. package/multiselect/multiselect.cjs.js +2 -2
  56. package/multiselect/multiselect.cjs.min.js +1 -1
  57. package/multiselect/multiselect.esm.js +2 -2
  58. package/multiselect/multiselect.esm.min.js +1 -1
  59. package/multiselect/multiselect.js +2 -2
  60. package/multiselect/multiselect.min.js +1 -1
  61. package/package.json +1 -1
  62. package/paginator/paginator.cjs.js +1 -1
  63. package/paginator/paginator.cjs.min.js +1 -1
  64. package/paginator/paginator.esm.js +1 -1
  65. package/paginator/paginator.esm.min.js +1 -1
  66. package/paginator/paginator.js +1 -1
  67. package/paginator/paginator.min.js +1 -1
  68. package/panelmenu/panelmenu.cjs.js +13 -12
  69. package/panelmenu/panelmenu.cjs.min.js +1 -1
  70. package/panelmenu/panelmenu.esm.js +13 -12
  71. package/panelmenu/panelmenu.esm.min.js +1 -1
  72. package/panelmenu/panelmenu.js +13 -12
  73. package/panelmenu/panelmenu.min.js +1 -1
  74. package/password/password.cjs.js +2 -2
  75. package/password/password.cjs.min.js +1 -1
  76. package/password/password.esm.js +2 -2
  77. package/password/password.esm.min.js +1 -1
  78. package/password/password.js +2 -2
  79. package/password/password.min.js +1 -1
  80. package/primereact.all.cjs.js +2859 -1916
  81. package/primereact.all.cjs.min.js +1 -1
  82. package/primereact.all.esm.js +2856 -1917
  83. package/primereact.all.esm.min.js +1 -1
  84. package/primereact.all.js +2859 -1916
  85. package/primereact.all.min.js +1 -1
  86. package/resources/themes/arya-blue/theme.css +62 -0
  87. package/resources/themes/arya-green/theme.css +62 -0
  88. package/resources/themes/arya-orange/theme.css +62 -0
  89. package/resources/themes/bootstrap4-dark-blue/theme.css +62 -0
  90. package/resources/themes/bootstrap4-dark-purple/theme.css +207 -43
  91. package/resources/themes/bootstrap4-light-blue/theme.css +62 -0
  92. package/resources/themes/bootstrap4-light-purple/theme.css +207 -43
  93. package/resources/themes/fluent-light/theme.css +62 -0
  94. package/resources/themes/lara-dark-amber/theme.css +62 -9
  95. package/resources/themes/lara-dark-blue/theme.css +62 -9
  96. package/resources/themes/lara-dark-cyan/theme.css +62 -9
  97. package/resources/themes/lara-dark-green/theme.css +62 -9
  98. package/resources/themes/lara-dark-indigo/theme.css +62 -9
  99. package/resources/themes/lara-dark-pink/theme.css +62 -9
  100. package/resources/themes/lara-dark-teal/theme.css +62 -9
  101. package/resources/themes/lara-light-amber/theme.css +62 -9
  102. package/resources/themes/lara-light-blue/theme.css +62 -9
  103. package/resources/themes/lara-light-cyan/theme.css +62 -9
  104. package/resources/themes/lara-light-green/theme.css +62 -9
  105. package/resources/themes/lara-light-indigo/theme.css +62 -9
  106. package/resources/themes/lara-light-pink/theme.css +62 -9
  107. package/resources/themes/lara-light-teal/theme.css +62 -9
  108. package/resources/themes/luna-amber/theme.css +62 -0
  109. package/resources/themes/luna-blue/theme.css +62 -0
  110. package/resources/themes/luna-green/theme.css +62 -0
  111. package/resources/themes/luna-pink/theme.css +62 -0
  112. package/resources/themes/md-dark-deeppurple/theme.css +225 -43
  113. package/resources/themes/md-dark-indigo/theme.css +213 -151
  114. package/resources/themes/md-light-deeppurple/theme.css +225 -43
  115. package/resources/themes/md-light-indigo/theme.css +62 -0
  116. package/resources/themes/mdc-dark-deeppurple/theme.css +225 -43
  117. package/resources/themes/mdc-dark-indigo/theme.css +213 -151
  118. package/resources/themes/mdc-light-deeppurple/theme.css +225 -43
  119. package/resources/themes/mdc-light-indigo/theme.css +62 -0
  120. package/resources/themes/mira/theme.css +62 -0
  121. package/resources/themes/nano/theme.css +62 -0
  122. package/resources/themes/nova/theme.css +62 -0
  123. package/resources/themes/nova-accent/theme.css +62 -0
  124. package/resources/themes/nova-alt/theme.css +62 -0
  125. package/resources/themes/rhea/theme.css +62 -0
  126. package/resources/themes/saga-blue/theme.css +62 -0
  127. package/resources/themes/saga-green/theme.css +62 -0
  128. package/resources/themes/saga-orange/theme.css +62 -0
  129. package/resources/themes/soho-dark/theme.css +87 -25
  130. package/resources/themes/soho-light/theme.css +62 -0
  131. package/resources/themes/tailwind-light/theme.css +62 -0
  132. package/resources/themes/vela-blue/theme.css +62 -0
  133. package/resources/themes/vela-green/theme.css +62 -0
  134. package/resources/themes/vela-orange/theme.css +62 -0
  135. package/resources/themes/viva-dark/theme.css +62 -0
  136. package/resources/themes/viva-light/theme.css +62 -0
  137. package/tabview/tabview.cjs.js +0 -2
  138. package/tabview/tabview.cjs.min.js +1 -1
  139. package/tabview/tabview.esm.js +0 -2
  140. package/tabview/tabview.esm.min.js +1 -1
  141. package/tabview/tabview.js +0 -2
  142. package/tabview/tabview.min.js +1 -1
  143. package/tooltip/tooltip.cjs.js +2 -2
  144. package/tooltip/tooltip.cjs.min.js +1 -1
  145. package/tooltip/tooltip.esm.js +2 -2
  146. package/tooltip/tooltip.esm.min.js +1 -1
  147. package/tooltip/tooltip.js +2 -2
  148. package/tooltip/tooltip.min.js +1 -1
  149. package/tree/tree.cjs.js +45 -8
  150. package/tree/tree.cjs.min.js +1 -1
  151. package/tree/tree.esm.js +45 -8
  152. package/tree/tree.esm.min.js +1 -1
  153. package/tree/tree.js +45 -8
  154. package/tree/tree.min.js +1 -1
  155. package/treetable/treetable.cjs.js +240 -7
  156. package/treetable/treetable.cjs.min.js +1 -1
  157. package/treetable/treetable.d.ts +29 -0
  158. package/treetable/treetable.esm.js +240 -7
  159. package/treetable/treetable.esm.min.js +1 -1
  160. package/treetable/treetable.js +240 -7
  161. package/treetable/treetable.min.js +1 -1
  162. package/utils/utils.d.ts +7 -4
  163. package/virtualscroller/virtualscroller.cjs.js +23 -1
  164. package/virtualscroller/virtualscroller.cjs.min.js +1 -1
  165. package/virtualscroller/virtualscroller.esm.js +23 -1
  166. package/virtualscroller/virtualscroller.esm.min.js +1 -1
  167. package/virtualscroller/virtualscroller.js +23 -1
  168. package/virtualscroller/virtualscroller.min.js +1 -1
  169. package/web-types.json +66 -28
@@ -1 +1 @@
1
- import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{useMergeProps as r,usePrevious as n,useStyle as o,useResizeListener as l,useEventListener as i,useMountEffect as s,useUpdateEffect as c}from"primereact/hooks";import{SpinnerIcon as a}from"primereact/icons/spinner";import{DomHandler as u,ObjectUtils as f,classNames as m,IconUtils as p}from"primereact/utils";import{ComponentBase as d}from"primereact/componentbase";function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},h.apply(this,arguments)}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){if("object"!==g(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=v(e,"string");return"symbol"===g(t)?t:String(t)}function w(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e){if(Array.isArray(e))return e}function b(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,l,i,s=[],c=!0,a=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=l.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(a)throw o}}return s}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){if(e){if("string"==typeof e)return z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(e,t):void 0}}function I(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,t){return S(e)||b(e,t)||T(e,t)||I()}var x=d.extend({defaultProps:{__TYPE:"VirtualScroller",__parentMetadata:null,id:null,style:null,className:null,tabIndex:0,items:null,itemSize:0,scrollHeight:null,scrollWidth:null,orientation:"vertical",step:0,numToleratedItems:null,delay:0,resizeDelay:10,appendOnly:!1,inline:!1,lazy:!1,disabled:!1,loaderDisabled:!1,loadingIcon:null,columns:null,loading:void 0,autoSize:!1,showSpacer:!0,showLoader:!1,loadingTemplate:null,loaderIconTemplate:null,itemTemplate:null,contentTemplate:null,onScroll:null,onScrollIndexChange:null,onLazyLoad:null,children:void 0},css:{styles:"\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /*contain: content;*/\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n"}});function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var E=e.memo(e.forwardRef((function(d,g){var v=r(),y=e.useContext(t),S=x.getProps(d,y),b=n(d)||{},z="vertical"===S.orientation,T="horizontal"===S.orientation,I="both"===S.orientation,R=O(e.useState(I?{rows:0,cols:0}:0),2),E=R[0],P=R[1],L=O(e.useState(I?{rows:0,cols:0}:0),2),M=L[0],H=L[1],W=O(e.useState(0),2),C=W[0],D=W[1],F=O(e.useState(I?{rows:0,cols:0}:0),2),N=F[0],A=F[1],V=O(e.useState(S.numToleratedItems),2),k=V[0],J=V[1],X=O(e.useState(S.loading||!1),2),_=X[0],B=X[1],U=O(e.useState([]),2),Y=U[0],Z=U[1],$=x.setMetaData({props:S,state:{first:E,last:M,page:C,numItemsInViewport:N,numToleratedItems:k,loading:_,loaderArr:Y}}).ptm;o(x.css.styles,{name:"virtualscroller"});var q=e.useRef(null),G=e.useRef(null),K=e.useRef(null),Q=e.useRef(null),ee=e.useRef(I?{top:0,left:0}:0),te=e.useRef(null),re=e.useRef(null),ne=e.useRef({}),oe=e.useRef({}),le=e.useRef(null),ie=e.useRef(null),se=e.useRef(null),ce=e.useRef(null),ae=e.useRef(!1),ue=e.useRef(null),fe=O(l({listener:function(e){return Pe()},when:!S.disabled}),1)[0],me=O(i({target:"window",type:"orientationchange",listener:function(e){return Pe()},when:!S.disabled}),1)[0],pe=function(){return q},de=function(e){return Math.floor((e+4*k)/(S.step||1))},he=function(e){return!S.step||C!==de(e)},ge=function(e){ee.current=I?{top:0,left:0}:0,q.current&&q.current.scrollTo(e)},ve=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",r=Se().numToleratedItems,n=Te(),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<=(arguments.length>1?arguments[1]:void 0)?0:e},l=function(e,t,r){return e*t+r},i=function(){return ge({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:t})},s=I?{rows:0,cols:0}:0,c=!1;I?(i(l((s={rows:o(e[0],r[0]),cols:o(e[1],r[1])}).cols,S.itemSize[1],n.left),l(s.rows,S.itemSize[0],n.top)),c=E.rows!==s.rows||E.cols!==s.cols):(s=o(e,r),T?i(l(s,S.itemSize,n.left),0):i(0,l(s,S.itemSize,n.top)),c=E!==s),ae.current=c,P(s)},ye=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(t){var n=we(),o=n.first,l=n.viewport,i=function(){return ge({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:r})},s="to-end"===t;if("to-start"===t){if(I)l.first.rows-o.rows>e[0]?i(l.first.cols*S.itemSize[1],(l.first.rows-1)*S.itemSize[0]):l.first.cols-o.cols>e[1]&&i((l.first.cols-1)*S.itemSize[1],l.first.rows*S.itemSize[0]);else if(l.first-o>e){var c=(l.first-1)*S.itemSize;T?i(c,0):i(0,c)}}else if(s)if(I)l.last.rows-o.rows<=e[0]+1?i(l.first.cols*S.itemSize[1],(l.first.rows+1)*S.itemSize[0]):l.last.cols-o.cols<=e[1]+1&&i((l.first.cols+1)*S.itemSize[1],l.first.rows*S.itemSize[0]);else if(l.last-o<=e+1){var a=(l.first+1)*S.itemSize;T?i(a,0):i(0,a)}}else ve(e,r)},we=function(){var e=function(e,t){return Math.floor(e/(t||e))},t=E,r=0;if(q.current){var n=q.current,o=n.scrollTop,l=n.scrollLeft;if(I)r={rows:(t={rows:e(o,S.itemSize[0]),cols:e(l,S.itemSize[1])}).rows+N.rows,cols:t.cols+N.cols};else r=(t=e(T?l:o,S.itemSize))+N}return{first:E,last:M,viewport:{first:t,last:r}}},Se=function(){var e=Te(),t=q.current?q.current.offsetWidth-e.left:0,r=q.current?q.current.offsetHeight-e.top:0,n=function(e,t){return Math.ceil(e/(t||e))},o=function(e){return Math.ceil(e/2)},l=I?{rows:n(r,S.itemSize[0]),cols:n(t,S.itemSize[1])}:n(T?t:r,S.itemSize);return{numItemsInViewport:l,numToleratedItems:k||(I?[o(l.rows),o(l.cols)]:o(l))}},be=function(e){S.autoSize&&!e&&Promise.resolve().then((function(){if(G.current){G.current.style.minHeight=G.current.style.minWidth="auto",G.current.style.position="relative",q.current.style.contain="none";var e=[u.getWidth(q.current),u.getHeight(q.current)],t=e[0],r=e[1];(I||T)&&(q.current.style.width=(t<le.current?t:S.scrollWidth||le.current)+"px"),(I||z)&&(q.current.style.height=(r<ie.current?r:S.scrollHeight||ie.current)+"px"),G.current.style.minHeight=G.current.style.minWidth="",G.current.style.position="",q.current.style.contain=""}}))},ze=function(){var e;return S.items?Math.min((arguments.length>1?arguments[1]:void 0)?(null===(e=S.columns||S.items[0])||void 0===e?void 0:e.length)||0:(S.items||[]).length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},Te=function(){if(G.current){var e=getComputedStyle(G.current),t=parseFloat(e.paddingLeft)+Math.max(parseFloat(e.left)||0,0),r=parseFloat(e.paddingRight)+Math.max(parseFloat(e.right)||0,0),n=parseFloat(e.paddingTop)+Math.max(parseFloat(e.top)||0,0),o=parseFloat(e.paddingBottom)+Math.max(parseFloat(e.bottom)||0,0);return{left:t,right:r,top:n,bottom:o,x:t+r,y:n+o}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},Ie=function(){if(q.current){var e=q.current.parentElement,t=S.scrollWidth||"".concat(q.current.offsetWidth||e.offsetWidth,"px"),r=S.scrollHeight||"".concat(q.current.offsetHeight||e.offsetHeight,"px"),n=function(e,t){return q.current.style[e]=t};I||T?(n("height",r),n("width",t)):n("height",r)}},Oe=function(){var e=S.items;if(e){var t=Te(),r=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return oe.current=j(j({},oe.current),w({},"".concat(e),(t||[]).length*r+n+"px"))};I?(r("height",e,S.itemSize[0],t.y),r("width",S.columns||e[1],S.itemSize[1],t.x)):T?r("width",S.columns||e,S.itemSize,t.x):r("height",e,S.itemSize,t.y)}},xe=function(e){if(G.current&&!S.appendOnly){var t=e?e.first:E,r=function(e,t){return e*t},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Q.current&&(Q.current.style.top="-".concat(t,"px")),ne.current=j(j({},ne.current),{transform:"translate3d(".concat(e,"px, ").concat(t,"px, 0)")})};if(I)n(r(t.cols,S.itemSize[1]),r(t.rows,S.itemSize[0]));else{var o=r(t,S.itemSize);T?n(o,0):n(0,o)}}},Re=function(e){var t=e.target,r=Te(),n=function(e,t){return e?e>t?e-t:e:0},o=function(e,t){return Math.floor(e/(t||e))},l=function(e,t,r,n,o,l){return e<=o?o:l?r-n-o:t+o-1},i=function(e,t,r,n,o,l,i){return e<=l?0:Math.max(0,i?e<t?r:e-l:e>t?r:e-2*l)},s=function(e,t,r,n,o,l){var i=t+n+2*o;return e>=o&&(i+=o+1),ze(i,l)},c=n(t.scrollTop,r.top),a=n(t.scrollLeft,r.left),u=I?{rows:0,cols:0}:0,f=M,m=!1,p=ee.current;if(I){var d=ee.current.top<=c,h=ee.current.left<=a;if(!S.appendOnly||S.appendOnly&&(d||h)){var g={rows:o(c,S.itemSize[0]),cols:o(a,S.itemSize[1])},v={rows:l(g.rows,E.rows,M.rows,N.rows,k[0],d),cols:l(g.cols,E.cols,M.cols,N.cols,k[1],h)};u={rows:i(g.rows,v.rows,E.rows,0,0,k[0],d),cols:i(g.cols,v.cols,E.cols,0,0,k[1],h)},f={rows:s(g.rows,u.rows,0,N.rows,k[0]),cols:s(g.cols,u.cols,0,N.cols,k[1],!0)},m=u.rows!==E.rows||f.rows!==M.rows||u.cols!==E.cols||f.cols!==M.cols||ae.current,p={top:c,left:a}}}else{var y=T?a:c,w=ee.current<=y;if(!S.appendOnly||S.appendOnly&&w){var b=o(y,S.itemSize);f=s(b,u=i(b,l(b,E,M,N,k,w),E,0,0,k,w),0,N,k),m=u!==E||f!==M||ae.current,p=y}}return{first:u,last:f,isRangeChanged:m,scrollPos:p}},je=function(e){var t=Re(e),r=t.first,n=t.last,o=t.scrollPos;if(t.isRangeChanged){var l={first:r,last:n};if(xe(l),P(r),H(n),ee.current=o,S.onScrollIndexChange&&S.onScrollIndexChange(l),S.lazy&&he(r)){var i={first:S.step?Math.min(de(r)*S.step,(S.items||[]).length-S.step):r,last:Math.min(S.step?(de(r)+1)*S.step:n,(S.items||[]).length)};(!ue.current||ue.current.first!==i.first||ue.current.last!==i.last)&&S.onLazyLoad&&S.onLazyLoad(i),ue.current=i}}},Ee=function(e){if(S.onScroll&&S.onScroll(e),S.delay){if(te.current&&clearTimeout(te.current),he(E)){if(!_&&S.showLoader)(Re(e).isRangeChanged||!!S.step&&he(E))&&B(!0);te.current=setTimeout((function(){je(e),!_||!S.showLoader||S.lazy&&void 0!==S.loading||(B(!1),D(de(E)))}),S.delay)}}else je(e)},Pe=function(){re.current&&clearTimeout(re.current),re.current=setTimeout((function(){if(q.current){var e=[u.getWidth(q.current),u.getHeight(q.current)],t=e[0],r=e[1],n=t!==le.current,o=r!==ie.current;(I?n||o:T?n:!!z&&o)&&(J(S.numToleratedItems),le.current=t,ie.current=r,se.current=u.getWidth(G.current),ce.current=u.getHeight(G.current))}}),S.resizeDelay)},Le=function(e){var t=(S.items||[]).length,r=I?E.rows+e:E+e;return{index:r,count:t,first:0===r,last:r===t-1,even:r%2==0,odd:r%2!=0,props:S}},Me=function(e,t){var r=Y.length||0;return j({index:e,count:r,first:0===e,last:e===r-1,even:e%2==0,odd:e%2!=0,props:S},t)},He=function(){var e=S.items;return e&&!_?I?e.slice(S.appendOnly?0:E.rows,M.rows).map((function(e){return S.columns?e:e.slice(S.appendOnly?0:E.cols,M.cols)})):T&&S.columns?e:e.slice(S.appendOnly?0:E,M):[]},We=function(){var e,t,r,n,o;S.disabled||(Ie(),e=Se(),t=e.numItemsInViewport,r=e.numToleratedItems,n=function(e,t,r){return ze(e+t+(e<r?2:3)*r,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},o=I?{rows:n(E.rows,t.rows,r[0]),cols:n(E.cols,t.cols,r[1],!0)}:n(E,t,r),A(t),J(r),H(o),S.showLoader&&Z(I?Array.from({length:t.rows}).map((function(){return Array.from({length:t.cols})})):Array.from({length:t})),S.lazy&&Promise.resolve().then((function(){ue.current={first:S.step?I?{rows:0,cols:E.cols}:0:E,last:Math.min(S.step?S.step:o,(S.items||[]).length)},S.onLazyLoad&&S.onLazyLoad(ue.current)})),Oe())};s((function(){q.current&&u.isVisible(q.current)&&(G.current=G.current||G.current||u.findSingle(q.current,".p-virtualscroller-content"),We(),fe(),me(),le.current=u.getWidth(q.current),ie.current=u.getHeight(q.current),se.current=u.getWidth(G.current),ce.current=u.getHeight(G.current))})),c((function(){We()}),[S.itemSize,S.scrollHeight,S.scrollWidth]),c((function(){S.numToleratedItems!==k&&J(S.numToleratedItems)}),[S.numToleratedItems]),c((function(){S.numToleratedItems===k&&We()}),[k]),c((function(){b.items&&b.items.length===(S.items||[]).length||We();var e=_;S.lazy&&b.loading!==S.loading&&S.loading!==_&&(B(S.loading),e=S.loading),be(e)})),c((function(){ee.current=I?{top:0,left:0}:0}),[S.orientation]),e.useImperativeHandle(g,(function(){return{props:S,getElementRef:pe,scrollTo:ge,scrollToIndex:ve,scrollInView:ye,getRenderedRange:we}}));var Ce=function(t){var r=Me(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=f.getJSXElement(S.loadingTemplate,r);return e.createElement(e.Fragment,{key:t},n)},De=function(t,r){var n=Le(r),o=f.getJSXElement(S.itemTemplate,t,n);return e.createElement(e.Fragment,{key:n.index},o)};if(S.disabled){var Fe=f.getJSXElement(S.contentTemplate,{items:S.items,rows:S.items,columns:S.columns});return e.createElement(e.Fragment,null,S.children,Fe)}var Ne=m("p-virtualscroller",{"p-virtualscroller-inline":S.inline,"p-virtualscroller-both p-both-scroll":I,"p-virtualscroller-horizontal p-horizontal-scroll":T},S.className),Ae=function(){var t="p-virtualscroller-loading-icon",r=v({className:t},$("loadingIcon")),n=S.loadingIcon||e.createElement(a,h({},r,{spin:!0})),o=p.getJSXIcon(n,j({},r),{props:S});if(!S.loaderDisabled&&S.showLoader&&_){var l=m("p-virtualscroller-loader",{"p-component-overlay":!S.loadingTemplate}),i=o;if(S.loadingTemplate)i=Y.map((function(e,t){return Ce(t,I&&{numCols:N.cols})}));else if(S.loaderIconTemplate){i=f.getJSXElement(S.loaderIconTemplate,{iconClassName:t,element:i,props:S})}var s=v({className:l},$("loader"));return e.createElement("div",s,i)}return null}(),Ve=function(){var t=He().map(De),r=m("p-virtualscroller-content",{"p-virtualscroller-loading":_}),n=v({ref:G,style:ne.current,className:r},$("content")),o=e.createElement("div",n,t);if(S.contentTemplate){var l={style:ne.current,className:r,spacerStyle:oe.current,contentRef:function(e){return G.current=f.getRefElement(e)},spacerRef:function(e){return K.current=f.getRefElement(e)},stickyRef:function(e){return Q.current=f.getRefElement(e)},items:He(),getItemOptions:function(e){return Le(e)},children:t,element:o,props:S,loading:_,getLoaderOptions:function(e,t){return Me(e,t)},loadingTemplate:S.loadingTemplate,itemSize:S.itemSize,rows:_?S.loaderDisabled?Y:[]:He(),columns:S.columns&&I||T?_&&S.loaderDisabled?I?Y[0]:Y:S.columns.slice(I?E.cols:E,I?M.cols:M):S.columns,vertical:z,horizontal:T,both:I};return f.getJSXElement(S.contentTemplate,l)}return o}(),ke=function(){if(S.showSpacer){var t=v({ref:K,style:oe.current,className:"p-virtualscroller-spacer"},$("spacer"));return e.createElement("div",t)}return null}(),Je=v({ref:q,className:Ne,tabIndex:S.tabIndex,style:S.style,onScroll:function(e){return Ee(e)}},x.getOtherProps(S),$("root"));return e.createElement("div",Je,Ve,ke,Ae)})));E.displayName="VirtualScroller";export{E as VirtualScroller};
1
+ import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{useMergeProps as r,usePrevious as n,useStyle as o,useResizeListener as l,useEventListener as i,useMountEffect as s,useUpdateEffect as c}from"primereact/hooks";import{SpinnerIcon as a}from"primereact/icons/spinner";import{DomHandler as u,ObjectUtils as f,classNames as m,IconUtils as p}from"primereact/utils";import{ComponentBase as d}from"primereact/componentbase";function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},h.apply(this,arguments)}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){if("object"!==g(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=v(e,"string");return"symbol"===g(t)?t:String(t)}function w(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function S(e){if(Array.isArray(e))return e}function b(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,l,i,s=[],c=!0,a=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=l.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(a)throw o}}return s}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function T(e,t){if(e){if("string"==typeof e)return z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(e,t):void 0}}function I(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e,t){return S(e)||b(e,t)||T(e,t)||I()}var x=d.extend({defaultProps:{__TYPE:"VirtualScroller",__parentMetadata:null,id:null,style:null,className:null,tabIndex:0,items:null,itemSize:0,scrollHeight:null,scrollWidth:null,orientation:"vertical",step:0,numToleratedItems:null,delay:0,resizeDelay:10,appendOnly:!1,inline:!1,lazy:!1,disabled:!1,loaderDisabled:!1,loadingIcon:null,columns:null,loading:void 0,autoSize:!1,showSpacer:!0,showLoader:!1,loadingTemplate:null,loaderIconTemplate:null,itemTemplate:null,contentTemplate:null,onScroll:null,onScrollIndexChange:null,onLazyLoad:null,children:void 0},css:{styles:"\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /*contain: content;*/\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n"}});function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var E=e.memo(e.forwardRef((function(d,g){var v=r(),y=e.useContext(t),S=x.getProps(d,y),b=n(d)||{},z="vertical"===S.orientation,T="horizontal"===S.orientation,I="both"===S.orientation,R=O(e.useState(I?{rows:0,cols:0}:0),2),E=R[0],P=R[1],L=O(e.useState(I?{rows:0,cols:0}:0),2),M=L[0],H=L[1],W=O(e.useState(0),2),C=W[0],D=W[1],F=O(e.useState(I?{rows:0,cols:0}:0),2),N=F[0],A=F[1],V=O(e.useState(S.numToleratedItems),2),k=V[0],J=V[1],X=O(e.useState(S.loading||!1),2),_=X[0],B=X[1],U=O(e.useState([]),2),Y=U[0],Z=U[1],$=x.setMetaData({props:S,state:{first:E,last:M,page:C,numItemsInViewport:N,numToleratedItems:k,loading:_,loaderArr:Y}}).ptm;o(x.css.styles,{name:"virtualscroller"});var q=e.useRef(null),G=e.useRef(null),K=e.useRef(null),Q=e.useRef(null),ee=e.useRef(I?{top:0,left:0}:0),te=e.useRef(null),re=e.useRef(null),ne=e.useRef({}),oe=e.useRef({}),le=e.useRef(null),ie=e.useRef(null),se=e.useRef(null),ce=e.useRef(null),ae=e.useRef(!1),ue=e.useRef(null),fe=O(l({listener:function(e){return Pe()},when:!S.disabled}),1)[0],me=O(i({target:"window",type:"orientationchange",listener:function(e){return Pe()},when:!S.disabled}),1)[0],pe=function(){return q},de=function(e){return Math.floor((e+4*k)/(S.step||1))},he=function(e){return!S.step||C!==de(e)},ge=function(e){ee.current=I?{top:0,left:0}:0,q.current&&q.current.scrollTo(e)},ve=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",r=Se().numToleratedItems,n=Te(),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<=(arguments.length>1?arguments[1]:void 0)?0:e},l=function(e,t,r){return e*t+r},i=function(){return ge({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:t})},s=I?{rows:0,cols:0}:0,c=!1;I?(i(l((s={rows:o(e[0],r[0]),cols:o(e[1],r[1])}).cols,S.itemSize[1],n.left),l(s.rows,S.itemSize[0],n.top)),c=E.rows!==s.rows||E.cols!==s.cols):(s=o(e,r),T?i(l(s,S.itemSize,n.left),0):i(0,l(s,S.itemSize,n.top)),c=E!==s),ae.current=c,P(s)},ye=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(t){var n=we(),o=n.first,l=n.viewport,i=function(){return ge({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:r})},s="to-end"===t;if("to-start"===t){if(I)l.first.rows-o.rows>e[0]?i(l.first.cols*S.itemSize[1],(l.first.rows-1)*S.itemSize[0]):l.first.cols-o.cols>e[1]&&i((l.first.cols-1)*S.itemSize[1],l.first.rows*S.itemSize[0]);else if(l.first-o>e){var c=(l.first-1)*S.itemSize;T?i(c,0):i(0,c)}}else if(s)if(I)l.last.rows-o.rows<=e[0]+1?i(l.first.cols*S.itemSize[1],(l.first.rows+1)*S.itemSize[0]):l.last.cols-o.cols<=e[1]+1&&i((l.first.cols+1)*S.itemSize[1],l.first.rows*S.itemSize[0]);else if(l.last-o<=e+1){var a=(l.first+1)*S.itemSize;T?i(a,0):i(0,a)}}else ve(e,r)},we=function(){var e=function(e,t){return Math.floor(e/(t||e))},t=E,r=0;if(q.current){var n=q.current,o=n.scrollTop,l=n.scrollLeft;if(I)r={rows:(t={rows:e(o,S.itemSize[0]),cols:e(l,S.itemSize[1])}).rows+N.rows,cols:t.cols+N.cols};else r=(t=e(T?l:o,S.itemSize))+N}return{first:E,last:M,viewport:{first:t,last:r}}},Se=function(){var e=Te(),t=q.current?q.current.offsetWidth-e.left:0,r=q.current?q.current.offsetHeight-e.top:0,n=function(e,t){return Math.ceil(e/(t||e))},o=function(e){return Math.ceil(e/2)},l=I?{rows:n(r,S.itemSize[0]),cols:n(t,S.itemSize[1])}:n(T?t:r,S.itemSize);return{numItemsInViewport:l,numToleratedItems:k||(I?[o(l.rows),o(l.cols)]:o(l))}},be=function(e){S.autoSize&&!e&&Promise.resolve().then((function(){if(G.current){G.current.style.minHeight=G.current.style.minWidth="auto",G.current.style.position="relative",q.current.style.contain="none";var e=[u.getWidth(q.current),u.getHeight(q.current)],t=e[0],r=e[1];(I||T)&&(q.current.style.width=(t<le.current?t:S.scrollWidth||le.current)+"px"),(I||z)&&(q.current.style.height=(r<ie.current?r:S.scrollHeight||ie.current)+"px"),G.current.style.minHeight=G.current.style.minWidth="",G.current.style.position="",q.current.style.contain=""}}))},ze=function(){var e;return S.items?Math.min((arguments.length>1?arguments[1]:void 0)?(null===(e=S.columns||S.items[0])||void 0===e?void 0:e.length)||0:(S.items||[]).length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},Te=function(){if(G.current){var e=getComputedStyle(G.current),t=parseFloat(e.paddingLeft)+Math.max(parseFloat(e.left)||0,0),r=parseFloat(e.paddingRight)+Math.max(parseFloat(e.right)||0,0),n=parseFloat(e.paddingTop)+Math.max(parseFloat(e.top)||0,0),o=parseFloat(e.paddingBottom)+Math.max(parseFloat(e.bottom)||0,0);return{left:t,right:r,top:n,bottom:o,x:t+r,y:n+o}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},Ie=function(){if(q.current){var e=q.current.parentElement,t=S.scrollWidth||"".concat(q.current.offsetWidth||e.offsetWidth,"px"),r=S.scrollHeight||"".concat(q.current.offsetHeight||e.offsetHeight,"px"),n=function(e,t){return q.current.style[e]=t};I||T?(n("height",r),n("width",t)):n("height",r)}},Oe=function(){var e=S.items;if(e){var t=Te(),r=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return oe.current=j(j({},oe.current),w({},"".concat(e),(t||[]).length*r+n+"px"))};I?(r("height",e,S.itemSize[0],t.y),r("width",S.columns||e[1],S.itemSize[1],t.x)):T?r("width",S.columns||e,S.itemSize,t.x):r("height",e,S.itemSize,t.y)}},xe=function(e){if(G.current&&!S.appendOnly){var t=e?e.first:E,r=function(e,t){return e*t},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Q.current&&(Q.current.style.top="-".concat(t,"px")),ne.current=j(j({},ne.current),{transform:"translate3d(".concat(e,"px, ").concat(t,"px, 0)")})};if(I)n(r(t.cols,S.itemSize[1]),r(t.rows,S.itemSize[0]));else{var o=r(t,S.itemSize);T?n(o,0):n(0,o)}}},Re=function(e){var t=e.target,r=Te(),n=function(e,t){return e?e>t?e-t:e:0},o=function(e,t){return Math.floor(e/(t||e))},l=function(e,t,r,n,o,l){return e<=o?o:l?r-n-o:t+o-1},i=function(e,t,r,n,o,l,i){return e<=l?0:Math.max(0,i?e<t?r:e-l:e>t?r:e-2*l)},s=function(e,t,r,n,o,l){var i=t+n+2*o;return e>=o&&(i+=o+1),ze(i,l)},c=n(t.scrollTop,r.top),a=n(t.scrollLeft,r.left),u=I?{rows:0,cols:0}:0,f=M,m=!1,p=ee.current;if(I){var d=ee.current.top<=c,h=ee.current.left<=a;if(!S.appendOnly||S.appendOnly&&(d||h)){var g={rows:o(c,S.itemSize[0]),cols:o(a,S.itemSize[1])},v={rows:l(g.rows,E.rows,M.rows,N.rows,k[0],d),cols:l(g.cols,E.cols,M.cols,N.cols,k[1],h)};u={rows:i(g.rows,v.rows,E.rows,0,0,k[0],d),cols:i(g.cols,v.cols,E.cols,0,0,k[1],h)},f={rows:s(g.rows,u.rows,0,N.rows,k[0]),cols:s(g.cols,u.cols,0,N.cols,k[1],!0)},m=u.rows!==E.rows||f.rows!==M.rows||u.cols!==E.cols||f.cols!==M.cols||ae.current,p={top:c,left:a}}}else{var y=T?a:c,w=ee.current<=y;if(!S.appendOnly||S.appendOnly&&w){var b=o(y,S.itemSize);f=s(b,u=i(b,l(b,E,M,N,k,w),E,0,0,k,w),0,N,k),m=u!==E||f!==M||ae.current,p=y}}return{first:u,last:f,isRangeChanged:m,scrollPos:p}},je=function(e){var t=Re(e),r=t.first,n=t.last,o=t.scrollPos;if(t.isRangeChanged){var l={first:r,last:n};if(xe(l),P(r),H(n),ee.current=o,S.onScrollIndexChange&&S.onScrollIndexChange(l),S.lazy&&he(r)){var i={first:S.step?Math.min(de(r)*S.step,(S.items||[]).length-S.step):r,last:Math.min(S.step?(de(r)+1)*S.step:n,(S.items||[]).length)};(!ue.current||ue.current.first!==i.first||ue.current.last!==i.last)&&S.onLazyLoad&&S.onLazyLoad(i),ue.current=i}}},Ee=function(e){if(S.onScroll&&S.onScroll(e),S.delay){if(te.current&&clearTimeout(te.current),he(E)){if(!_&&S.showLoader)(Re(e).isRangeChanged||!!S.step&&he(E))&&B(!0);te.current=setTimeout((function(){je(e),!_||!S.showLoader||S.lazy&&void 0!==S.loading||(B(!1),D(de(E)))}),S.delay)}}else je(e)},Pe=function(){re.current&&clearTimeout(re.current),re.current=setTimeout((function(){if(q.current){var e=[u.getWidth(q.current),u.getHeight(q.current)],t=e[0],r=e[1],n=t!==le.current,o=r!==ie.current;(I?n||o:T?n:!!z&&o)&&(J(S.numToleratedItems),le.current=t,ie.current=r,se.current=u.getWidth(G.current),ce.current=u.getHeight(G.current))}}),S.resizeDelay)},Le=function(e){var t=(S.items||[]).length,r=I?E.rows+e:E+e;return{index:r,count:t,first:0===r,last:r===t-1,even:r%2==0,odd:r%2!=0,props:S}},Me=function(e,t){var r=Y.length||0;return j({index:e,count:r,first:0===e,last:e===r-1,even:e%2==0,odd:e%2!=0,props:S},t)},He=function(){var e=S.items;return e&&!_?I?e.slice(S.appendOnly?0:E.rows,M.rows).map((function(e){return S.columns?e:e.slice(S.appendOnly?0:E.cols,M.cols)})):T&&S.columns?e:e.slice(S.appendOnly?0:E,M):[]},We=function(){var e,t,r,n,o;S.disabled||(Ie(),e=Se(),t=e.numItemsInViewport,r=e.numToleratedItems,n=function(e,t,r){return ze(e+t+(e<r?2:3)*r,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},o=I?{rows:n(E.rows,t.rows,r[0]),cols:n(E.cols,t.cols,r[1],!0)}:n(E,t,r),A(t),J(r),H(o),S.showLoader&&Z(I?Array.from({length:t.rows}).map((function(){return Array.from({length:t.cols})})):Array.from({length:t})),S.lazy&&Promise.resolve().then((function(){ue.current={first:S.step?I?{rows:0,cols:E.cols}:0:E,last:Math.min(S.step?S.step:o,(S.items||[]).length)},S.onLazyLoad&&S.onLazyLoad(ue.current)})),Oe())};s((function(){q.current&&u.isVisible(q.current)&&(G.current=G.current||G.current||u.findSingle(q.current,".p-virtualscroller-content"),We(),fe(),me(),le.current=u.getWidth(q.current),ie.current=u.getHeight(q.current),se.current=u.getWidth(G.current),ce.current=u.getHeight(G.current))})),c((function(){We()}),[S.itemSize,S.scrollHeight,S.scrollWidth]),c((function(){S.numToleratedItems!==k&&J(S.numToleratedItems)}),[S.numToleratedItems]),c((function(){S.numToleratedItems===k&&We()}),[k]),c((function(){var e=null!=b.items,t=null!=S.items,r=(e?b.items.length:0)!==(t?S.items.length:0);I&&!r&&(r=(e&&b.items.length>0?b.items[0].length:0)!==(t&&S.items.length>0?S.items[0].length:0));e&&!r||We();var n=_;S.lazy&&b.loading!==S.loading&&S.loading!==_&&(B(S.loading),n=S.loading),be(n)})),c((function(){ee.current=I?{top:0,left:0}:0}),[S.orientation]),e.useImperativeHandle(g,(function(){return{props:S,getElementRef:pe,scrollTo:ge,scrollToIndex:ve,scrollInView:ye,getRenderedRange:we}}));var Ce=function(t){var r=Me(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=f.getJSXElement(S.loadingTemplate,r);return e.createElement(e.Fragment,{key:t},n)},De=function(t,r){var n=Le(r),o=f.getJSXElement(S.itemTemplate,t,n);return e.createElement(e.Fragment,{key:n.index},o)};if(S.disabled){var Fe=f.getJSXElement(S.contentTemplate,{items:S.items,rows:S.items,columns:S.columns});return e.createElement(e.Fragment,null,S.children,Fe)}var Ne=m("p-virtualscroller",{"p-virtualscroller-inline":S.inline,"p-virtualscroller-both p-both-scroll":I,"p-virtualscroller-horizontal p-horizontal-scroll":T},S.className),Ae=function(){var t="p-virtualscroller-loading-icon",r=v({className:t},$("loadingIcon")),n=S.loadingIcon||e.createElement(a,h({},r,{spin:!0})),o=p.getJSXIcon(n,j({},r),{props:S});if(!S.loaderDisabled&&S.showLoader&&_){var l=m("p-virtualscroller-loader",{"p-component-overlay":!S.loadingTemplate}),i=o;if(S.loadingTemplate)i=Y.map((function(e,t){return Ce(t,I&&{numCols:N.cols})}));else if(S.loaderIconTemplate){i=f.getJSXElement(S.loaderIconTemplate,{iconClassName:t,element:i,props:S})}var s=v({className:l},$("loader"));return e.createElement("div",s,i)}return null}(),Ve=function(){var t=He().map(De),r=m("p-virtualscroller-content",{"p-virtualscroller-loading":_}),n=v({ref:G,style:ne.current,className:r},$("content")),o=e.createElement("div",n,t);if(S.contentTemplate){var l={style:ne.current,className:r,spacerStyle:oe.current,contentRef:function(e){return G.current=f.getRefElement(e)},spacerRef:function(e){return K.current=f.getRefElement(e)},stickyRef:function(e){return Q.current=f.getRefElement(e)},items:He(),getItemOptions:function(e){return Le(e)},children:t,element:o,props:S,loading:_,getLoaderOptions:function(e,t){return Me(e,t)},loadingTemplate:S.loadingTemplate,itemSize:S.itemSize,rows:_?S.loaderDisabled?Y:[]:He(),columns:S.columns&&I||T?_&&S.loaderDisabled?I?Y[0]:Y:S.columns.slice(I?E.cols:E,I?M.cols:M):S.columns,vertical:z,horizontal:T,both:I};return f.getJSXElement(S.contentTemplate,l)}return o}(),ke=function(){if(S.showSpacer){var t=v({ref:K,style:oe.current,className:"p-virtualscroller-spacer"},$("spacer"));return e.createElement("div",t)}return null}(),Je=v({ref:q,className:Ne,tabIndex:S.tabIndex,style:S.style,onScroll:function(e){return Ee(e)}},x.getOtherProps(S),$("root"));return e.createElement("div",Je,Ve,ke,Ae)})));E.displayName="VirtualScroller";export{E as VirtualScroller};
@@ -819,7 +819,29 @@ this.primereact.virtualscroller = (function (exports, React, api, hooks, spinner
819
819
  }
820
820
  }, [numToleratedItemsState]);
821
821
  hooks.useUpdateEffect(function () {
822
- if (!prevProps.items || prevProps.items.length !== (props.items || []).length) {
822
+ // Check if the previous/current rows array exists
823
+ var prevRowsExist = prevProps.items !== undefined && prevProps.items !== null;
824
+ var currentRowsExist = props.items !== undefined && props.items !== null;
825
+
826
+ // Get the length of the previous/current rows array, or 0 if it doesn't exist
827
+ var prevRowsLength = prevRowsExist ? prevProps.items.length : 0;
828
+ var currentRowsLength = currentRowsExist ? props.items.length : 0;
829
+
830
+ // Check if the length of the rows arrays has changed
831
+ var valuesChanged = prevRowsLength !== currentRowsLength;
832
+
833
+ // If both is true, we also need to check the lengths of the first element (assuming it's a matrix)
834
+ if (both && !valuesChanged) {
835
+ // Get the length of the columns or 0
836
+ var prevColumnsLength = prevRowsExist && prevProps.items.length > 0 ? prevProps.items[0].length : 0;
837
+ var currentColumnsLength = currentRowsExist && props.items.length > 0 ? props.items[0].length : 0;
838
+
839
+ // Check if the length of the columns has changed
840
+ valuesChanged = prevColumnsLength !== currentColumnsLength;
841
+ }
842
+
843
+ // If the previous items array doesn't exist or if any values have changed, call the init function
844
+ if (!prevRowsExist || valuesChanged) {
823
845
  init();
824
846
  }
825
847
  var loading = loadingState;
@@ -1 +1 @@
1
- this.primereact=this.primereact||{},this.primereact.virtualscroller=function(e,t,r,n,o,l,i){"use strict";function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=s(t);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if("object"!==u(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function m(e){var t=f(e,"string");return"symbol"===u(t)?t:String(t)}function p(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){if(Array.isArray(e))return e}function h(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,l,i,s=[],c=!0,a=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=l.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(a)throw o}}return s}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}function y(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(e,t){return d(e)||h(e,t)||v(e,t)||y()}var b=i.ComponentBase.extend({defaultProps:{__TYPE:"VirtualScroller",__parentMetadata:null,id:null,style:null,className:null,tabIndex:0,items:null,itemSize:0,scrollHeight:null,scrollWidth:null,orientation:"vertical",step:0,numToleratedItems:null,delay:0,resizeDelay:10,appendOnly:!1,inline:!1,lazy:!1,disabled:!1,loaderDisabled:!1,loadingIcon:null,columns:null,loading:void 0,autoSize:!1,showSpacer:!0,showLoader:!1,loadingTemplate:null,loaderIconTemplate:null,itemTemplate:null,contentTemplate:null,onScroll:null,onScrollIndexChange:null,onLazyLoad:null,children:void 0},css:{styles:"\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /*contain: content;*/\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n"}});function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var O=c.memo(c.forwardRef((function(e,t){var i=n.useMergeProps(),s=c.useContext(r.PrimeReactContext),u=b.getProps(e,s),f=n.usePrevious(e)||{},m="vertical"===u.orientation,d="horizontal"===u.orientation,h="both"===u.orientation,g=w(c.useState(h?{rows:0,cols:0}:0),2),v=g[0],y=g[1],S=w(c.useState(h?{rows:0,cols:0}:0),2),O=S[0],I=S[1],T=w(c.useState(0),2),j=T[0],x=T[1],R=w(c.useState(h?{rows:0,cols:0}:0),2),E=R[0],H=R[1],P=w(c.useState(u.numToleratedItems),2),D=P[0],L=P[1],M=w(c.useState(u.loading||!1),2),U=M[0],N=M[1],W=w(c.useState([]),2),C=W[0],F=W[1],A=b.setMetaData({props:u,state:{first:v,last:O,page:j,numItemsInViewport:E,numToleratedItems:D,loading:U,loaderArr:C}}).ptm;n.useStyle(b.css.styles,{name:"virtualscroller"});var V=c.useRef(null),_=c.useRef(null),k=c.useRef(null),J=c.useRef(null),X=c.useRef(h?{top:0,left:0}:0),B=c.useRef(null),Y=c.useRef(null),Z=c.useRef({}),$=c.useRef({}),q=c.useRef(null),G=c.useRef(null),K=c.useRef(null),Q=c.useRef(null),ee=c.useRef(!1),te=c.useRef(null),re=w(n.useResizeListener({listener:function(e){return Se()},when:!u.disabled}),1)[0],ne=w(n.useEventListener({target:"window",type:"orientationchange",listener:function(e){return Se()},when:!u.disabled}),1)[0],oe=function(){return V},le=function(e){return Math.floor((e+4*D)/(u.step||1))},ie=function(e){return!u.step||j!==le(e)},se=function(e){X.current=h?{top:0,left:0}:0,V.current&&V.current.scrollTo(e)},ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",r=fe().numToleratedItems,n=de(),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<=(arguments.length>1?arguments[1]:void 0)?0:e},l=function(e,t,r){return e*t+r},i=function(){return se({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:t})},s=h?{rows:0,cols:0}:0,c=!1;h?(i(l((s={rows:o(e[0],r[0]),cols:o(e[1],r[1])}).cols,u.itemSize[1],n.left),l(s.rows,u.itemSize[0],n.top)),c=v.rows!==s.rows||v.cols!==s.cols):(s=o(e,r),d?i(l(s,u.itemSize,n.left),0):i(0,l(s,u.itemSize,n.top)),c=v!==s),ee.current=c,y(s)},ae=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(t){var n=ue(),o=n.first,l=n.viewport,i=function(){return se({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:r})},s="to-end"===t;if("to-start"===t){if(h)l.first.rows-o.rows>e[0]?i(l.first.cols*u.itemSize[1],(l.first.rows-1)*u.itemSize[0]):l.first.cols-o.cols>e[1]&&i((l.first.cols-1)*u.itemSize[1],l.first.rows*u.itemSize[0]);else if(l.first-o>e){var c=(l.first-1)*u.itemSize;d?i(c,0):i(0,c)}}else if(s)if(h)l.last.rows-o.rows<=e[0]+1?i(l.first.cols*u.itemSize[1],(l.first.rows+1)*u.itemSize[0]):l.last.cols-o.cols<=e[1]+1&&i((l.first.cols+1)*u.itemSize[1],l.first.rows*u.itemSize[0]);else if(l.last-o<=e+1){var a=(l.first+1)*u.itemSize;d?i(a,0):i(0,a)}}else ce(e,r)},ue=function(){var e=function(e,t){return Math.floor(e/(t||e))},t=v,r=0;if(V.current){var n=V.current,o=n.scrollTop,l=n.scrollLeft;if(h)r={rows:(t={rows:e(o,u.itemSize[0]),cols:e(l,u.itemSize[1])}).rows+E.rows,cols:t.cols+E.cols};else r=(t=e(d?l:o,u.itemSize))+E}return{first:v,last:O,viewport:{first:t,last:r}}},fe=function(){var e=de(),t=V.current?V.current.offsetWidth-e.left:0,r=V.current?V.current.offsetHeight-e.top:0,n=function(e,t){return Math.ceil(e/(t||e))},o=function(e){return Math.ceil(e/2)},l=h?{rows:n(r,u.itemSize[0]),cols:n(t,u.itemSize[1])}:n(d?t:r,u.itemSize);return{numItemsInViewport:l,numToleratedItems:D||(h?[o(l.rows),o(l.cols)]:o(l))}},me=function(e){u.autoSize&&!e&&Promise.resolve().then((function(){if(_.current){_.current.style.minHeight=_.current.style.minWidth="auto",_.current.style.position="relative",V.current.style.contain="none";var e=[l.DomHandler.getWidth(V.current),l.DomHandler.getHeight(V.current)],t=e[0],r=e[1];(h||d)&&(V.current.style.width=(t<q.current?t:u.scrollWidth||q.current)+"px"),(h||m)&&(V.current.style.height=(r<G.current?r:u.scrollHeight||G.current)+"px"),_.current.style.minHeight=_.current.style.minWidth="",_.current.style.position="",V.current.style.contain=""}}))},pe=function(){var e;return u.items?Math.min((arguments.length>1?arguments[1]:void 0)?(null===(e=u.columns||u.items[0])||void 0===e?void 0:e.length)||0:(u.items||[]).length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},de=function(){if(_.current){var e=getComputedStyle(_.current),t=parseFloat(e.paddingLeft)+Math.max(parseFloat(e.left)||0,0),r=parseFloat(e.paddingRight)+Math.max(parseFloat(e.right)||0,0),n=parseFloat(e.paddingTop)+Math.max(parseFloat(e.top)||0,0),o=parseFloat(e.paddingBottom)+Math.max(parseFloat(e.bottom)||0,0);return{left:t,right:r,top:n,bottom:o,x:t+r,y:n+o}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},he=function(){if(V.current){var e=V.current.parentElement,t=u.scrollWidth||"".concat(V.current.offsetWidth||e.offsetWidth,"px"),r=u.scrollHeight||"".concat(V.current.offsetHeight||e.offsetHeight,"px"),n=function(e,t){return V.current.style[e]=t};h||d?(n("height",r),n("width",t)):n("height",r)}},ge=function(){var e=u.items;if(e){var t=de(),r=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return $.current=z(z({},$.current),p({},"".concat(e),(t||[]).length*r+n+"px"))};h?(r("height",e,u.itemSize[0],t.y),r("width",u.columns||e[1],u.itemSize[1],t.x)):d?r("width",u.columns||e,u.itemSize,t.x):r("height",e,u.itemSize,t.y)}},ve=function(e){if(_.current&&!u.appendOnly){var t=e?e.first:v,r=function(e,t){return e*t},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;J.current&&(J.current.style.top="-".concat(t,"px")),Z.current=z(z({},Z.current),{transform:"translate3d(".concat(e,"px, ").concat(t,"px, 0)")})};if(h)n(r(t.cols,u.itemSize[1]),r(t.rows,u.itemSize[0]));else{var o=r(t,u.itemSize);d?n(o,0):n(0,o)}}},ye=function(e){var t=e.target,r=de(),n=function(e,t){return e?e>t?e-t:e:0},o=function(e,t){return Math.floor(e/(t||e))},l=function(e,t,r,n,o,l){return e<=o?o:l?r-n-o:t+o-1},i=function(e,t,r,n,o,l,i){return e<=l?0:Math.max(0,i?e<t?r:e-l:e>t?r:e-2*l)},s=function(e,t,r,n,o,l){var i=t+n+2*o;return e>=o&&(i+=o+1),pe(i,l)},c=n(t.scrollTop,r.top),a=n(t.scrollLeft,r.left),f=h?{rows:0,cols:0}:0,m=O,p=!1,g=X.current;if(h){var y=X.current.top<=c,w=X.current.left<=a;if(!u.appendOnly||u.appendOnly&&(y||w)){var b={rows:o(c,u.itemSize[0]),cols:o(a,u.itemSize[1])},S={rows:l(b.rows,v.rows,O.rows,E.rows,D[0],y),cols:l(b.cols,v.cols,O.cols,E.cols,D[1],w)};f={rows:i(b.rows,S.rows,v.rows,0,0,D[0],y),cols:i(b.cols,S.cols,v.cols,0,0,D[1],w)},m={rows:s(b.rows,f.rows,0,E.rows,D[0]),cols:s(b.cols,f.cols,0,E.cols,D[1],!0)},p=f.rows!==v.rows||m.rows!==O.rows||f.cols!==v.cols||m.cols!==O.cols||ee.current,g={top:c,left:a}}}else{var z=d?a:c,I=X.current<=z;if(!u.appendOnly||u.appendOnly&&I){var T=o(z,u.itemSize);m=s(T,f=i(T,l(T,v,O,E,D,I),v,0,0,D,I),0,E,D),p=f!==v||m!==O||ee.current,g=z}}return{first:f,last:m,isRangeChanged:p,scrollPos:g}},we=function(e){var t=ye(e),r=t.first,n=t.last,o=t.scrollPos;if(t.isRangeChanged){var l={first:r,last:n};if(ve(l),y(r),I(n),X.current=o,u.onScrollIndexChange&&u.onScrollIndexChange(l),u.lazy&&ie(r)){var i={first:u.step?Math.min(le(r)*u.step,(u.items||[]).length-u.step):r,last:Math.min(u.step?(le(r)+1)*u.step:n,(u.items||[]).length)};(!te.current||te.current.first!==i.first||te.current.last!==i.last)&&u.onLazyLoad&&u.onLazyLoad(i),te.current=i}}},be=function(e){if(u.onScroll&&u.onScroll(e),u.delay){if(B.current&&clearTimeout(B.current),ie(v)){if(!U&&u.showLoader)(ye(e).isRangeChanged||!!u.step&&ie(v))&&N(!0);B.current=setTimeout((function(){we(e),!U||!u.showLoader||u.lazy&&void 0!==u.loading||(N(!1),x(le(v)))}),u.delay)}}else we(e)},Se=function(){Y.current&&clearTimeout(Y.current),Y.current=setTimeout((function(){if(V.current){var e=[l.DomHandler.getWidth(V.current),l.DomHandler.getHeight(V.current)],t=e[0],r=e[1],n=t!==q.current,o=r!==G.current;(h?n||o:d?n:!!m&&o)&&(L(u.numToleratedItems),q.current=t,G.current=r,K.current=l.DomHandler.getWidth(_.current),Q.current=l.DomHandler.getHeight(_.current))}}),u.resizeDelay)},ze=function(e){var t=(u.items||[]).length,r=h?v.rows+e:v+e;return{index:r,count:t,first:0===r,last:r===t-1,even:r%2==0,odd:r%2!=0,props:u}},Oe=function(e,t){var r=C.length||0;return z({index:e,count:r,first:0===e,last:e===r-1,even:e%2==0,odd:e%2!=0,props:u},t)},Ie=function(){var e=u.items;return e&&!U?h?e.slice(u.appendOnly?0:v.rows,O.rows).map((function(e){return u.columns?e:e.slice(u.appendOnly?0:v.cols,O.cols)})):d&&u.columns?e:e.slice(u.appendOnly?0:v,O):[]},Te=function(){var e,t,r,n,o;u.disabled||(he(),e=fe(),t=e.numItemsInViewport,r=e.numToleratedItems,n=function(e,t,r){return pe(e+t+(e<r?2:3)*r,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},o=h?{rows:n(v.rows,t.rows,r[0]),cols:n(v.cols,t.cols,r[1],!0)}:n(v,t,r),H(t),L(r),I(o),u.showLoader&&F(h?Array.from({length:t.rows}).map((function(){return Array.from({length:t.cols})})):Array.from({length:t})),u.lazy&&Promise.resolve().then((function(){te.current={first:u.step?h?{rows:0,cols:v.cols}:0:v,last:Math.min(u.step?u.step:o,(u.items||[]).length)},u.onLazyLoad&&u.onLazyLoad(te.current)})),ge())};n.useMountEffect((function(){V.current&&l.DomHandler.isVisible(V.current)&&(_.current=_.current||_.current||l.DomHandler.findSingle(V.current,".p-virtualscroller-content"),Te(),re(),ne(),q.current=l.DomHandler.getWidth(V.current),G.current=l.DomHandler.getHeight(V.current),K.current=l.DomHandler.getWidth(_.current),Q.current=l.DomHandler.getHeight(_.current))})),n.useUpdateEffect((function(){Te()}),[u.itemSize,u.scrollHeight,u.scrollWidth]),n.useUpdateEffect((function(){u.numToleratedItems!==D&&L(u.numToleratedItems)}),[u.numToleratedItems]),n.useUpdateEffect((function(){u.numToleratedItems===D&&Te()}),[D]),n.useUpdateEffect((function(){f.items&&f.items.length===(u.items||[]).length||Te();var e=U;u.lazy&&f.loading!==u.loading&&u.loading!==U&&(N(u.loading),e=u.loading),me(e)})),n.useUpdateEffect((function(){X.current=h?{top:0,left:0}:0}),[u.orientation]),c.useImperativeHandle(t,(function(){return{props:u,getElementRef:oe,scrollTo:se,scrollToIndex:ce,scrollInView:ae,getRenderedRange:ue}}));var je=function(e){var t=Oe(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r=l.ObjectUtils.getJSXElement(u.loadingTemplate,t);return c.createElement(c.Fragment,{key:e},r)},xe=function(e,t){var r=ze(t),n=l.ObjectUtils.getJSXElement(u.itemTemplate,e,r);return c.createElement(c.Fragment,{key:r.index},n)};if(u.disabled){var Re=l.ObjectUtils.getJSXElement(u.contentTemplate,{items:u.items,rows:u.items,columns:u.columns});return c.createElement(c.Fragment,null,u.children,Re)}var Ee=l.classNames("p-virtualscroller",{"p-virtualscroller-inline":u.inline,"p-virtualscroller-both p-both-scroll":h,"p-virtualscroller-horizontal p-horizontal-scroll":d},u.className),He=function(){var e="p-virtualscroller-loading-icon",t=i({className:e},A("loadingIcon")),r=u.loadingIcon||c.createElement(o.SpinnerIcon,a({},t,{spin:!0})),n=l.IconUtils.getJSXIcon(r,z({},t),{props:u});if(!u.loaderDisabled&&u.showLoader&&U){var s=l.classNames("p-virtualscroller-loader",{"p-component-overlay":!u.loadingTemplate}),f=n;if(u.loadingTemplate)f=C.map((function(e,t){return je(t,h&&{numCols:E.cols})}));else if(u.loaderIconTemplate){f=l.ObjectUtils.getJSXElement(u.loaderIconTemplate,{iconClassName:e,element:f,props:u})}var m=i({className:s},A("loader"));return c.createElement("div",m,f)}return null}(),Pe=function(){var e=Ie().map(xe),t=l.classNames("p-virtualscroller-content",{"p-virtualscroller-loading":U}),r=i({ref:_,style:Z.current,className:t},A("content")),n=c.createElement("div",r,e);if(u.contentTemplate){var o={style:Z.current,className:t,spacerStyle:$.current,contentRef:function(e){return _.current=l.ObjectUtils.getRefElement(e)},spacerRef:function(e){return k.current=l.ObjectUtils.getRefElement(e)},stickyRef:function(e){return J.current=l.ObjectUtils.getRefElement(e)},items:Ie(),getItemOptions:function(e){return ze(e)},children:e,element:n,props:u,loading:U,getLoaderOptions:function(e,t){return Oe(e,t)},loadingTemplate:u.loadingTemplate,itemSize:u.itemSize,rows:U?u.loaderDisabled?C:[]:Ie(),columns:u.columns&&h||d?U&&u.loaderDisabled?h?C[0]:C:u.columns.slice(h?v.cols:v,h?O.cols:O):u.columns,vertical:m,horizontal:d,both:h};return l.ObjectUtils.getJSXElement(u.contentTemplate,o)}return n}(),De=function(){if(u.showSpacer){var e=i({ref:k,style:$.current,className:"p-virtualscroller-spacer"},A("spacer"));return c.createElement("div",e)}return null}(),Le=i({ref:V,className:Ee,tabIndex:u.tabIndex,style:u.style,onScroll:function(e){return be(e)}},b.getOtherProps(u),A("root"));return c.createElement("div",Le,Pe,De,He)})));return O.displayName="VirtualScroller",e.VirtualScroller=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.icons.spinner,primereact.utils,primereact.componentbase);
1
+ this.primereact=this.primereact||{},this.primereact.virtualscroller=function(e,t,r,n,o,l,i){"use strict";function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=s(t);function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if("object"!==u(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function m(e){var t=f(e,"string");return"symbol"===u(t)?t:String(t)}function p(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){if(Array.isArray(e))return e}function h(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,l,i,s=[],c=!0,a=!1;try{if(l=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=l.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){a=!0,o=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(a)throw o}}return s}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}function y(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function w(e,t){return d(e)||h(e,t)||v(e,t)||y()}var b=i.ComponentBase.extend({defaultProps:{__TYPE:"VirtualScroller",__parentMetadata:null,id:null,style:null,className:null,tabIndex:0,items:null,itemSize:0,scrollHeight:null,scrollWidth:null,orientation:"vertical",step:0,numToleratedItems:null,delay:0,resizeDelay:10,appendOnly:!1,inline:!1,lazy:!1,disabled:!1,loaderDisabled:!1,loadingIcon:null,columns:null,loading:void 0,autoSize:!1,showSpacer:!0,showLoader:!1,loadingTemplate:null,loaderIconTemplate:null,itemTemplate:null,contentTemplate:null,onScroll:null,onScrollIndexChange:null,onLazyLoad:null,children:void 0},css:{styles:"\n.p-virtualscroller {\n position: relative;\n overflow: auto;\n contain: strict;\n transform: translateZ(0);\n will-change: scroll-position;\n outline: 0 none;\n}\n\n.p-virtualscroller-content {\n position: absolute;\n top: 0;\n left: 0;\n /*contain: content;*/\n min-height: 100%;\n min-width: 100%;\n will-change: transform;\n}\n\n.p-virtualscroller-spacer {\n position: absolute;\n top: 0;\n left: 0;\n height: 1px;\n width: 1px;\n transform-origin: 0 0;\n pointer-events: none;\n}\n\n.p-virtualscroller-loader {\n position: sticky;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.p-virtualscroller-loader.p-component-overlay {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-virtualscroller-loading-icon {\n font-size: 2rem;\n}\n\n.p-virtualscroller-horizontal > .p-virtualscroller-content {\n display: flex;\n}\n\n/* Inline */\n.p-virtualscroller-inline .p-virtualscroller-content {\n position: static;\n}\n"}});function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var O=c.memo(c.forwardRef((function(e,t){var i=n.useMergeProps(),s=c.useContext(r.PrimeReactContext),u=b.getProps(e,s),f=n.usePrevious(e)||{},m="vertical"===u.orientation,d="horizontal"===u.orientation,h="both"===u.orientation,g=w(c.useState(h?{rows:0,cols:0}:0),2),v=g[0],y=g[1],S=w(c.useState(h?{rows:0,cols:0}:0),2),O=S[0],I=S[1],T=w(c.useState(0),2),j=T[0],x=T[1],R=w(c.useState(h?{rows:0,cols:0}:0),2),E=R[0],H=R[1],P=w(c.useState(u.numToleratedItems),2),D=P[0],L=P[1],M=w(c.useState(u.loading||!1),2),U=M[0],N=M[1],W=w(c.useState([]),2),C=W[0],F=W[1],A=b.setMetaData({props:u,state:{first:v,last:O,page:j,numItemsInViewport:E,numToleratedItems:D,loading:U,loaderArr:C}}).ptm;n.useStyle(b.css.styles,{name:"virtualscroller"});var V=c.useRef(null),_=c.useRef(null),k=c.useRef(null),J=c.useRef(null),X=c.useRef(h?{top:0,left:0}:0),B=c.useRef(null),Y=c.useRef(null),Z=c.useRef({}),$=c.useRef({}),q=c.useRef(null),G=c.useRef(null),K=c.useRef(null),Q=c.useRef(null),ee=c.useRef(!1),te=c.useRef(null),re=w(n.useResizeListener({listener:function(e){return Se()},when:!u.disabled}),1)[0],ne=w(n.useEventListener({target:"window",type:"orientationchange",listener:function(e){return Se()},when:!u.disabled}),1)[0],oe=function(){return V},le=function(e){return Math.floor((e+4*D)/(u.step||1))},ie=function(e){return!u.step||j!==le(e)},se=function(e){X.current=h?{top:0,left:0}:0,V.current&&V.current.scrollTo(e)},ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"auto",r=fe().numToleratedItems,n=de(),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return e<=(arguments.length>1?arguments[1]:void 0)?0:e},l=function(e,t,r){return e*t+r},i=function(){return se({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:t})},s=h?{rows:0,cols:0}:0,c=!1;h?(i(l((s={rows:o(e[0],r[0]),cols:o(e[1],r[1])}).cols,u.itemSize[1],n.left),l(s.rows,u.itemSize[0],n.top)),c=v.rows!==s.rows||v.cols!==s.cols):(s=o(e,r),d?i(l(s,u.itemSize,n.left),0):i(0,l(s,u.itemSize,n.top)),c=v!==s),ee.current=c,y(s)},ae=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"auto";if(t){var n=ue(),o=n.first,l=n.viewport,i=function(){return se({left:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,top:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,behavior:r})},s="to-end"===t;if("to-start"===t){if(h)l.first.rows-o.rows>e[0]?i(l.first.cols*u.itemSize[1],(l.first.rows-1)*u.itemSize[0]):l.first.cols-o.cols>e[1]&&i((l.first.cols-1)*u.itemSize[1],l.first.rows*u.itemSize[0]);else if(l.first-o>e){var c=(l.first-1)*u.itemSize;d?i(c,0):i(0,c)}}else if(s)if(h)l.last.rows-o.rows<=e[0]+1?i(l.first.cols*u.itemSize[1],(l.first.rows+1)*u.itemSize[0]):l.last.cols-o.cols<=e[1]+1&&i((l.first.cols+1)*u.itemSize[1],l.first.rows*u.itemSize[0]);else if(l.last-o<=e+1){var a=(l.first+1)*u.itemSize;d?i(a,0):i(0,a)}}else ce(e,r)},ue=function(){var e=function(e,t){return Math.floor(e/(t||e))},t=v,r=0;if(V.current){var n=V.current,o=n.scrollTop,l=n.scrollLeft;if(h)r={rows:(t={rows:e(o,u.itemSize[0]),cols:e(l,u.itemSize[1])}).rows+E.rows,cols:t.cols+E.cols};else r=(t=e(d?l:o,u.itemSize))+E}return{first:v,last:O,viewport:{first:t,last:r}}},fe=function(){var e=de(),t=V.current?V.current.offsetWidth-e.left:0,r=V.current?V.current.offsetHeight-e.top:0,n=function(e,t){return Math.ceil(e/(t||e))},o=function(e){return Math.ceil(e/2)},l=h?{rows:n(r,u.itemSize[0]),cols:n(t,u.itemSize[1])}:n(d?t:r,u.itemSize);return{numItemsInViewport:l,numToleratedItems:D||(h?[o(l.rows),o(l.cols)]:o(l))}},me=function(e){u.autoSize&&!e&&Promise.resolve().then((function(){if(_.current){_.current.style.minHeight=_.current.style.minWidth="auto",_.current.style.position="relative",V.current.style.contain="none";var e=[l.DomHandler.getWidth(V.current),l.DomHandler.getHeight(V.current)],t=e[0],r=e[1];(h||d)&&(V.current.style.width=(t<q.current?t:u.scrollWidth||q.current)+"px"),(h||m)&&(V.current.style.height=(r<G.current?r:u.scrollHeight||G.current)+"px"),_.current.style.minHeight=_.current.style.minWidth="",_.current.style.position="",V.current.style.contain=""}}))},pe=function(){var e;return u.items?Math.min((arguments.length>1?arguments[1]:void 0)?(null===(e=u.columns||u.items[0])||void 0===e?void 0:e.length)||0:(u.items||[]).length,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0):0},de=function(){if(_.current){var e=getComputedStyle(_.current),t=parseFloat(e.paddingLeft)+Math.max(parseFloat(e.left)||0,0),r=parseFloat(e.paddingRight)+Math.max(parseFloat(e.right)||0,0),n=parseFloat(e.paddingTop)+Math.max(parseFloat(e.top)||0,0),o=parseFloat(e.paddingBottom)+Math.max(parseFloat(e.bottom)||0,0);return{left:t,right:r,top:n,bottom:o,x:t+r,y:n+o}}return{left:0,right:0,top:0,bottom:0,x:0,y:0}},he=function(){if(V.current){var e=V.current.parentElement,t=u.scrollWidth||"".concat(V.current.offsetWidth||e.offsetWidth,"px"),r=u.scrollHeight||"".concat(V.current.offsetHeight||e.offsetHeight,"px"),n=function(e,t){return V.current.style[e]=t};h||d?(n("height",r),n("width",t)):n("height",r)}},ge=function(){var e=u.items;if(e){var t=de(),r=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return $.current=z(z({},$.current),p({},"".concat(e),(t||[]).length*r+n+"px"))};h?(r("height",e,u.itemSize[0],t.y),r("width",u.columns||e[1],u.itemSize[1],t.x)):d?r("width",u.columns||e,u.itemSize,t.x):r("height",e,u.itemSize,t.y)}},ve=function(e){if(_.current&&!u.appendOnly){var t=e?e.first:v,r=function(e,t){return e*t},n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;J.current&&(J.current.style.top="-".concat(t,"px")),Z.current=z(z({},Z.current),{transform:"translate3d(".concat(e,"px, ").concat(t,"px, 0)")})};if(h)n(r(t.cols,u.itemSize[1]),r(t.rows,u.itemSize[0]));else{var o=r(t,u.itemSize);d?n(o,0):n(0,o)}}},ye=function(e){var t=e.target,r=de(),n=function(e,t){return e?e>t?e-t:e:0},o=function(e,t){return Math.floor(e/(t||e))},l=function(e,t,r,n,o,l){return e<=o?o:l?r-n-o:t+o-1},i=function(e,t,r,n,o,l,i){return e<=l?0:Math.max(0,i?e<t?r:e-l:e>t?r:e-2*l)},s=function(e,t,r,n,o,l){var i=t+n+2*o;return e>=o&&(i+=o+1),pe(i,l)},c=n(t.scrollTop,r.top),a=n(t.scrollLeft,r.left),f=h?{rows:0,cols:0}:0,m=O,p=!1,g=X.current;if(h){var y=X.current.top<=c,w=X.current.left<=a;if(!u.appendOnly||u.appendOnly&&(y||w)){var b={rows:o(c,u.itemSize[0]),cols:o(a,u.itemSize[1])},S={rows:l(b.rows,v.rows,O.rows,E.rows,D[0],y),cols:l(b.cols,v.cols,O.cols,E.cols,D[1],w)};f={rows:i(b.rows,S.rows,v.rows,0,0,D[0],y),cols:i(b.cols,S.cols,v.cols,0,0,D[1],w)},m={rows:s(b.rows,f.rows,0,E.rows,D[0]),cols:s(b.cols,f.cols,0,E.cols,D[1],!0)},p=f.rows!==v.rows||m.rows!==O.rows||f.cols!==v.cols||m.cols!==O.cols||ee.current,g={top:c,left:a}}}else{var z=d?a:c,I=X.current<=z;if(!u.appendOnly||u.appendOnly&&I){var T=o(z,u.itemSize);m=s(T,f=i(T,l(T,v,O,E,D,I),v,0,0,D,I),0,E,D),p=f!==v||m!==O||ee.current,g=z}}return{first:f,last:m,isRangeChanged:p,scrollPos:g}},we=function(e){var t=ye(e),r=t.first,n=t.last,o=t.scrollPos;if(t.isRangeChanged){var l={first:r,last:n};if(ve(l),y(r),I(n),X.current=o,u.onScrollIndexChange&&u.onScrollIndexChange(l),u.lazy&&ie(r)){var i={first:u.step?Math.min(le(r)*u.step,(u.items||[]).length-u.step):r,last:Math.min(u.step?(le(r)+1)*u.step:n,(u.items||[]).length)};(!te.current||te.current.first!==i.first||te.current.last!==i.last)&&u.onLazyLoad&&u.onLazyLoad(i),te.current=i}}},be=function(e){if(u.onScroll&&u.onScroll(e),u.delay){if(B.current&&clearTimeout(B.current),ie(v)){if(!U&&u.showLoader)(ye(e).isRangeChanged||!!u.step&&ie(v))&&N(!0);B.current=setTimeout((function(){we(e),!U||!u.showLoader||u.lazy&&void 0!==u.loading||(N(!1),x(le(v)))}),u.delay)}}else we(e)},Se=function(){Y.current&&clearTimeout(Y.current),Y.current=setTimeout((function(){if(V.current){var e=[l.DomHandler.getWidth(V.current),l.DomHandler.getHeight(V.current)],t=e[0],r=e[1],n=t!==q.current,o=r!==G.current;(h?n||o:d?n:!!m&&o)&&(L(u.numToleratedItems),q.current=t,G.current=r,K.current=l.DomHandler.getWidth(_.current),Q.current=l.DomHandler.getHeight(_.current))}}),u.resizeDelay)},ze=function(e){var t=(u.items||[]).length,r=h?v.rows+e:v+e;return{index:r,count:t,first:0===r,last:r===t-1,even:r%2==0,odd:r%2!=0,props:u}},Oe=function(e,t){var r=C.length||0;return z({index:e,count:r,first:0===e,last:e===r-1,even:e%2==0,odd:e%2!=0,props:u},t)},Ie=function(){var e=u.items;return e&&!U?h?e.slice(u.appendOnly?0:v.rows,O.rows).map((function(e){return u.columns?e:e.slice(u.appendOnly?0:v.cols,O.cols)})):d&&u.columns?e:e.slice(u.appendOnly?0:v,O):[]},Te=function(){var e,t,r,n,o;u.disabled||(he(),e=fe(),t=e.numItemsInViewport,r=e.numToleratedItems,n=function(e,t,r){return pe(e+t+(e<r?2:3)*r,arguments.length>3&&void 0!==arguments[3]&&arguments[3])},o=h?{rows:n(v.rows,t.rows,r[0]),cols:n(v.cols,t.cols,r[1],!0)}:n(v,t,r),H(t),L(r),I(o),u.showLoader&&F(h?Array.from({length:t.rows}).map((function(){return Array.from({length:t.cols})})):Array.from({length:t})),u.lazy&&Promise.resolve().then((function(){te.current={first:u.step?h?{rows:0,cols:v.cols}:0:v,last:Math.min(u.step?u.step:o,(u.items||[]).length)},u.onLazyLoad&&u.onLazyLoad(te.current)})),ge())};n.useMountEffect((function(){V.current&&l.DomHandler.isVisible(V.current)&&(_.current=_.current||_.current||l.DomHandler.findSingle(V.current,".p-virtualscroller-content"),Te(),re(),ne(),q.current=l.DomHandler.getWidth(V.current),G.current=l.DomHandler.getHeight(V.current),K.current=l.DomHandler.getWidth(_.current),Q.current=l.DomHandler.getHeight(_.current))})),n.useUpdateEffect((function(){Te()}),[u.itemSize,u.scrollHeight,u.scrollWidth]),n.useUpdateEffect((function(){u.numToleratedItems!==D&&L(u.numToleratedItems)}),[u.numToleratedItems]),n.useUpdateEffect((function(){u.numToleratedItems===D&&Te()}),[D]),n.useUpdateEffect((function(){var e=null!=f.items,t=null!=u.items,r=(e?f.items.length:0)!==(t?u.items.length:0);h&&!r&&(r=(e&&f.items.length>0?f.items[0].length:0)!==(t&&u.items.length>0?u.items[0].length:0));e&&!r||Te();var n=U;u.lazy&&f.loading!==u.loading&&u.loading!==U&&(N(u.loading),n=u.loading),me(n)})),n.useUpdateEffect((function(){X.current=h?{top:0,left:0}:0}),[u.orientation]),c.useImperativeHandle(t,(function(){return{props:u,getElementRef:oe,scrollTo:se,scrollToIndex:ce,scrollInView:ae,getRenderedRange:ue}}));var je=function(e){var t=Oe(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r=l.ObjectUtils.getJSXElement(u.loadingTemplate,t);return c.createElement(c.Fragment,{key:e},r)},xe=function(e,t){var r=ze(t),n=l.ObjectUtils.getJSXElement(u.itemTemplate,e,r);return c.createElement(c.Fragment,{key:r.index},n)};if(u.disabled){var Re=l.ObjectUtils.getJSXElement(u.contentTemplate,{items:u.items,rows:u.items,columns:u.columns});return c.createElement(c.Fragment,null,u.children,Re)}var Ee=l.classNames("p-virtualscroller",{"p-virtualscroller-inline":u.inline,"p-virtualscroller-both p-both-scroll":h,"p-virtualscroller-horizontal p-horizontal-scroll":d},u.className),He=function(){var e="p-virtualscroller-loading-icon",t=i({className:e},A("loadingIcon")),r=u.loadingIcon||c.createElement(o.SpinnerIcon,a({},t,{spin:!0})),n=l.IconUtils.getJSXIcon(r,z({},t),{props:u});if(!u.loaderDisabled&&u.showLoader&&U){var s=l.classNames("p-virtualscroller-loader",{"p-component-overlay":!u.loadingTemplate}),f=n;if(u.loadingTemplate)f=C.map((function(e,t){return je(t,h&&{numCols:E.cols})}));else if(u.loaderIconTemplate){f=l.ObjectUtils.getJSXElement(u.loaderIconTemplate,{iconClassName:e,element:f,props:u})}var m=i({className:s},A("loader"));return c.createElement("div",m,f)}return null}(),Pe=function(){var e=Ie().map(xe),t=l.classNames("p-virtualscroller-content",{"p-virtualscroller-loading":U}),r=i({ref:_,style:Z.current,className:t},A("content")),n=c.createElement("div",r,e);if(u.contentTemplate){var o={style:Z.current,className:t,spacerStyle:$.current,contentRef:function(e){return _.current=l.ObjectUtils.getRefElement(e)},spacerRef:function(e){return k.current=l.ObjectUtils.getRefElement(e)},stickyRef:function(e){return J.current=l.ObjectUtils.getRefElement(e)},items:Ie(),getItemOptions:function(e){return ze(e)},children:e,element:n,props:u,loading:U,getLoaderOptions:function(e,t){return Oe(e,t)},loadingTemplate:u.loadingTemplate,itemSize:u.itemSize,rows:U?u.loaderDisabled?C:[]:Ie(),columns:u.columns&&h||d?U&&u.loaderDisabled?h?C[0]:C:u.columns.slice(h?v.cols:v,h?O.cols:O):u.columns,vertical:m,horizontal:d,both:h};return l.ObjectUtils.getJSXElement(u.contentTemplate,o)}return n}(),De=function(){if(u.showSpacer){var e=i({ref:k,style:$.current,className:"p-virtualscroller-spacer"},A("spacer"));return c.createElement("div",e)}return null}(),Le=i({ref:V,className:Ee,tabIndex:u.tabIndex,style:u.style,onScroll:function(e){return be(e)}},b.getOtherProps(u),A("root"));return c.createElement("div",Le,Pe,De,He)})));return O.displayName="VirtualScroller",e.VirtualScroller=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.hooks,primereact.icons.spinner,primereact.utils,primereact.componentbase);
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "react",
4
4
  "name": "PrimeReact",
5
- "version": "10.6.5",
5
+ "version": "10.6.6",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -2171,15 +2171,6 @@
2171
2171
  "description": "Chart components are based on Chart.js, an open source HTML5 based charting library.\n\n[Live Demo](https://www.primereact.org/chart)",
2172
2172
  "doc-url": "https://www.primereact.org/chart",
2173
2173
  "attributes": [
2174
- {
2175
- "name": "id",
2176
- "default": "null",
2177
- "description": "Unique identifier of the element.",
2178
- "value": {
2179
- "kind": "expression",
2180
- "type": "string"
2181
- }
2182
- },
2183
2174
  {
2184
2175
  "name": "type",
2185
2176
  "default": "null",
@@ -2234,24 +2225,6 @@
2234
2225
  "type": "string"
2235
2226
  }
2236
2227
  },
2237
- {
2238
- "name": "style",
2239
- "default": "null",
2240
- "description": "Inline style of the element.",
2241
- "value": {
2242
- "kind": "expression",
2243
- "type": "CSSProperties"
2244
- }
2245
- },
2246
- {
2247
- "name": "className",
2248
- "default": "null",
2249
- "description": "Style class of the element.",
2250
- "value": {
2251
- "kind": "expression",
2252
- "type": "string"
2253
- }
2254
- },
2255
2228
  {
2256
2229
  "name": "ariaLabel",
2257
2230
  "default": "null",
@@ -3281,6 +3254,15 @@
3281
3254
  "type": "CSSProperties"
3282
3255
  }
3283
3256
  },
3257
+ {
3258
+ "name": "cellEditValidateOnClose",
3259
+ "default": "false",
3260
+ "description": "When enabled and cellEditorValidator is set, force to call cellEditorValidator\nbefore cell editor is closed. If cellEditorValidator returns false, editor stays open.",
3261
+ "value": {
3262
+ "kind": "expression",
3263
+ "type": "boolean"
3264
+ }
3265
+ },
3284
3266
  {
3285
3267
  "name": "cellEditValidatorEvent",
3286
3268
  "default": "click",
@@ -21852,6 +21834,24 @@
21852
21834
  "type": "null | 0 | 1 | -1"
21853
21835
  }
21854
21836
  },
21837
+ {
21838
+ "name": "stateKey",
21839
+ "default": "null",
21840
+ "description": "Unique identifier of a stateful table to use in state storage.",
21841
+ "value": {
21842
+ "kind": "expression",
21843
+ "type": "string"
21844
+ }
21845
+ },
21846
+ {
21847
+ "name": "stateStorage",
21848
+ "default": "session",
21849
+ "description": "Defines where a stateful table keeps its state, valid values are \"session\" for sessionStorage, \"local\" for localStorage and \"custom\".",
21850
+ "value": {
21851
+ "kind": "expression",
21852
+ "type": "\"custom\" | \"local\" | \"session\""
21853
+ }
21854
+ },
21855
21855
  {
21856
21856
  "name": "stripedRows",
21857
21857
  "default": "false",
@@ -21926,6 +21926,22 @@
21926
21926
  }
21927
21927
  ],
21928
21928
  "events": [
21929
+ {
21930
+ "name": "customRestoreState",
21931
+ "description": "A function to implement custom restoreState with stateStorage=\"custom\". Need to return state object.",
21932
+ "arguments": []
21933
+ },
21934
+ {
21935
+ "name": "customSaveState",
21936
+ "description": "A function to implement custom saveState with stateStorage=\"custom\".",
21937
+ "arguments": [
21938
+ {
21939
+ "name": "state",
21940
+ "type": "object",
21941
+ "description": "The object to be stored."
21942
+ }
21943
+ ]
21944
+ },
21929
21945
  {
21930
21946
  "name": "onColReorder",
21931
21947
  "description": "Callback to invoke when a column is reordered.",
@@ -22080,6 +22096,28 @@
22080
22096
  }
22081
22097
  ]
22082
22098
  },
22099
+ {
22100
+ "name": "onStateRestore",
22101
+ "description": "Callback to invoke table state is restored.",
22102
+ "arguments": [
22103
+ {
22104
+ "name": "state",
22105
+ "type": "object",
22106
+ "description": "Table state."
22107
+ }
22108
+ ]
22109
+ },
22110
+ {
22111
+ "name": "onStateSave",
22112
+ "description": "Callback to invoke table state is saved.",
22113
+ "arguments": [
22114
+ {
22115
+ "name": "state",
22116
+ "type": "object",
22117
+ "description": "Table state."
22118
+ }
22119
+ ]
22120
+ },
22083
22121
  {
22084
22122
  "name": "onToggle",
22085
22123
  "description": "Callback to invoke when a node is toggled.",