mirror of
https://github.com/owncast/owncast.git
synced 2025-01-05 08:07:58 +03:00
1 line
No EOL
14 KiB
JavaScript
Vendored
1 line
No EOL
14 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5891],{55891:function(e,t,n){n.r(t),n.d(t,{default:function(){return f}});var a=n(87462),r=n(4942),i=n(1413),o=n(15671),s=n(43144),l=n(32531),c=n(73568),u=n(67294),p=n(94184),h=n.n(p),es_Pager=function(e){var t,n="".concat(e.rootPrefixCls,"-item"),a=h()(n,"".concat(n,"-").concat(e.page),(t={},(0,r.Z)(t,"".concat(n,"-active"),e.active),(0,r.Z)(t,"".concat(n,"-disabled"),!e.page),(0,r.Z)(t,e.className,!!e.className),t));return u.createElement("li",{title:e.showTitle?e.page:null,className:a,onClick:function(){e.onClick(e.page)},onKeyPress:function(t){e.onKeyPress(t,e.onClick,e.page)},tabIndex:"0"},e.itemRender(e.page,"page",u.createElement("a",{rel:"nofollow"},e.page)))},g={ENTER:13,ARROW_UP:38,ARROW_DOWN:40},d=function(e){(0,l.Z)(Options,e);var t=(0,c.Z)(Options);function Options(){var e;(0,o.Z)(this,Options);for(var n=arguments.length,a=Array(n),r=0;r<n;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))).state={goInputText:""},e.buildOptionText=function(t){return"".concat(t," ").concat(e.props.locale.items_per_page)},e.changeSize=function(t){e.props.changeSize(Number(t))},e.handleChange=function(t){e.setState({goInputText:t.target.value})},e.handleBlur=function(t){var n=e.props,a=n.goButton,r=n.quickGo,i=n.rootPrefixCls,o=e.state.goInputText;!a&&""!==o&&(e.setState({goInputText:""}),t.relatedTarget&&(t.relatedTarget.className.indexOf("".concat(i,"-item-link"))>=0||t.relatedTarget.className.indexOf("".concat(i,"-item"))>=0)||r(e.getValidValue()))},e.go=function(t){""!==e.state.goInputText&&(t.keyCode===g.ENTER||"click"===t.type)&&(e.setState({goInputText:""}),e.props.quickGo(e.getValidValue()))},e}return(0,s.Z)(Options,[{key:"getValidValue",value:function(){var e=this.state.goInputText;return!e||isNaN(e)?void 0:Number(e)}},{key:"getPageSizeOptions",value:function(){var e=this.props,t=e.pageSize,n=e.pageSizeOptions;return n.some(function(e){return e.toString()===t.toString()})?n:n.concat([t.toString()]).sort(function(e,t){return(isNaN(Number(e))?0:Number(e))-(isNaN(Number(t))?0:Number(t))})}},{key:"render",value:function(){var e=this,t=this.props,n=t.pageSize,a=t.locale,r=t.rootPrefixCls,i=t.changeSize,o=t.quickGo,s=t.goButton,l=t.selectComponentClass,c=t.buildOptionText,p=t.selectPrefixCls,h=t.disabled,g=this.state.goInputText,d="".concat(r,"-options"),m=null,f=null,v=null;if(!i&&!o)return null;var P=this.getPageSizeOptions();if(i&&l){var C=P.map(function(t,n){return u.createElement(l.Option,{key:n,value:t.toString()},(c||e.buildOptionText)(t))});m=u.createElement(l,{disabled:h,prefixCls:p,showSearch:!1,className:"".concat(d,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(n||P[0]).toString(),onChange:this.changeSize,getPopupContainer:function(e){return e.parentNode},"aria-label":a.page_size,defaultOpen:!1},C)}return o&&(s&&(v="boolean"==typeof s?u.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:h,className:"".concat(d,"-quick-jumper-button")},a.jump_to_confirm):u.createElement("span",{onClick:this.go,onKeyUp:this.go},s)),f=u.createElement("div",{className:"".concat(d,"-quick-jumper")},a.jump_to,u.createElement("input",{disabled:h,type:"text",value:g,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur,"aria-label":a.page}),a.page,v)),u.createElement("li",{className:"".concat(d)},m,f)}}]),Options}(u.Component);function noop(){}function isInteger(e){var t=Number(e);return"number"==typeof t&&!isNaN(t)&&isFinite(t)&&Math.floor(t)===t}function defaultItemRender(e,t,n){return n}function calculatePage(e,t,n){var a=void 0===e?t.pageSize:e;return Math.floor((n.total-1)/a)+1}d.defaultProps={pageSizeOptions:["10","20","50","100"]};var m=function(e){(0,l.Z)(Pagination,e);var t=(0,c.Z)(Pagination);function Pagination(e){(0,o.Z)(this,Pagination),(n=t.call(this,e)).getJumpPrevPage=function(){return Math.max(1,n.state.current-(n.props.showLessItems?3:5))},n.getJumpNextPage=function(){return Math.min(calculatePage(void 0,n.state,n.props),n.state.current+(n.props.showLessItems?3:5))},n.getItemIcon=function(e,t){var a=n.props.prefixCls,r=e||u.createElement("button",{type:"button","aria-label":t,className:"".concat(a,"-item-link")});return"function"==typeof e&&(r=u.createElement(e,(0,i.Z)({},n.props))),r},n.savePaginationNode=function(e){n.paginationNode=e},n.isValid=function(e){var t=n.props.total;return isInteger(e)&&e!==n.state.current&&isInteger(t)&&t>0},n.shouldDisplayQuickJumper=function(){var e=n.props,t=e.showQuickJumper;return!(e.total<=n.state.pageSize)&&t},n.handleKeyDown=function(e){(e.keyCode===g.ARROW_UP||e.keyCode===g.ARROW_DOWN)&&e.preventDefault()},n.handleKeyUp=function(e){var t=n.getValidValue(e);t!==n.state.currentInputValue&&n.setState({currentInputValue:t}),e.keyCode===g.ENTER?n.handleChange(t):e.keyCode===g.ARROW_UP?n.handleChange(t-1):e.keyCode===g.ARROW_DOWN&&n.handleChange(t+1)},n.handleBlur=function(e){var t=n.getValidValue(e);n.handleChange(t)},n.changePageSize=function(e){var t=n.state.current,a=calculatePage(e,n.state,n.props);t=t>a?a:t,0===a&&(t=n.state.current),"number"!=typeof e||("pageSize"in n.props||n.setState({pageSize:e}),"current"in n.props||n.setState({current:t,currentInputValue:t})),n.props.onShowSizeChange(t,e),"onChange"in n.props&&n.props.onChange&&n.props.onChange(t,e)},n.handleChange=function(e){var t=n.props,a=t.disabled,r=t.onChange,i=n.state,o=i.pageSize,s=i.current,l=i.currentInputValue;if(n.isValid(e)&&!a){var c=calculatePage(void 0,n.state,n.props),u=e;return e>c?u=c:e<1&&(u=1),"current"in n.props||n.setState({current:u}),u!==l&&n.setState({currentInputValue:u}),r(u,o),u}return s},n.prev=function(){n.hasPrev()&&n.handleChange(n.state.current-1)},n.next=function(){n.hasNext()&&n.handleChange(n.state.current+1)},n.jumpPrev=function(){n.handleChange(n.getJumpPrevPage())},n.jumpNext=function(){n.handleChange(n.getJumpNextPage())},n.hasPrev=function(){return n.state.current>1},n.hasNext=function(){return n.state.current<calculatePage(void 0,n.state,n.props)},n.runIfEnter=function(e,t){if("Enter"===e.key||13===e.charCode){for(var n=arguments.length,a=Array(n>2?n-2:0),r=2;r<n;r++)a[r-2]=arguments[r];t.apply(void 0,a)}},n.runIfEnterPrev=function(e){n.runIfEnter(e,n.prev)},n.runIfEnterNext=function(e){n.runIfEnter(e,n.next)},n.runIfEnterJumpPrev=function(e){n.runIfEnter(e,n.jumpPrev)},n.runIfEnterJumpNext=function(e){n.runIfEnter(e,n.jumpNext)},n.handleGoTO=function(e){(e.keyCode===g.ENTER||"click"===e.type)&&n.handleChange(n.state.currentInputValue)};var n,a=e.onChange!==noop;"current"in e&&!a&&console.warn("Warning: You provided a `current` prop to a Pagination component without an `onChange` handler. This will render a read-only component.");var r=e.defaultCurrent;"current"in e&&(r=e.current);var s=e.defaultPageSize;return"pageSize"in e&&(s=e.pageSize),r=Math.min(r,calculatePage(s,void 0,e)),n.state={current:r,currentInputValue:r,pageSize:s},n}return(0,s.Z)(Pagination,[{key:"componentDidUpdate",value:function(e,t){var n=this.props.prefixCls;if(t.current!==this.state.current&&this.paginationNode){var a=this.paginationNode.querySelector(".".concat(n,"-item-").concat(t.current));a&&document.activeElement===a&&a.blur()}}},{key:"getValidValue",value:function(e){var t=e.target.value,n=calculatePage(void 0,this.state,this.props),a=this.state.currentInputValue;return""===t?t:isNaN(Number(t))?a:t>=n?n:Number(t)}},{key:"getShowSizeChanger",value:function(){var e=this.props,t=e.showSizeChanger,n=e.total,a=e.totalBoundaryShowSizeChanger;return void 0!==t?t:n>a}},{key:"renderPrev",value:function(e){var t=this.props,n=t.prevIcon,a=(0,t.itemRender)(e,"prev",this.getItemIcon(n,"prev page")),r=!this.hasPrev();return(0,u.isValidElement)(a)?(0,u.cloneElement)(a,{disabled:r}):a}},{key:"renderNext",value:function(e){var t=this.props,n=t.nextIcon,a=(0,t.itemRender)(e,"next",this.getItemIcon(n,"next page")),r=!this.hasNext();return(0,u.isValidElement)(a)?(0,u.cloneElement)(a,{disabled:r}):a}},{key:"render",value:function(){var e=this,t=this.props,n=t.prefixCls,i=t.className,o=t.style,s=t.disabled,l=t.hideOnSinglePage,c=t.total,p=t.locale,g=t.showQuickJumper,m=t.showLessItems,f=t.showTitle,v=t.showTotal,P=t.simple,C=t.itemRender,x=t.showPrevNextJumpers,N=t.jumpPrevIcon,y=t.jumpNextIcon,E=t.selectComponentClass,I=t.selectPrefixCls,S=t.pageSizeOptions,b=this.state,k=b.current,_=b.pageSize,z=b.currentInputValue;if(!0===l&&c<=_)return null;var O=calculatePage(void 0,this.state,this.props),w=[],T=null,R=null,V=null,j=null,K=null,Z=g&&g.goButton,J=m?1:2,U=k-1>0?k-1:0,B=k+1<O?k+1:O,D=Object.keys(this.props).reduce(function(t,n){return("data-"===n.substr(0,5)||"aria-"===n.substr(0,5)||"role"===n)&&(t[n]=e.props[n]),t},{}),W=v&&u.createElement("li",{className:"".concat(n,"-total-text")},v(c,[0===c?0:(k-1)*_+1,k*_>c?c:k*_]));if(P)return Z&&(K="boolean"==typeof Z?u.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},p.jump_to_confirm):u.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Z),K=u.createElement("li",{title:f?"".concat(p.jump_to).concat(k,"/").concat(O):null,className:"".concat(n,"-simple-pager")},K)),u.createElement("ul",(0,a.Z)({className:h()(n,"".concat(n,"-simple"),(0,r.Z)({},"".concat(n,"-disabled"),s),i),style:o,ref:this.savePaginationNode},D),W,u.createElement("li",{title:f?p.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:h()("".concat(n,"-prev"),(0,r.Z)({},"".concat(n,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(U)),u.createElement("li",{title:f?"".concat(k,"/").concat(O):null,className:"".concat(n,"-simple-pager")},u.createElement("input",{type:"text",value:z,disabled:s,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,onBlur:this.handleBlur,size:"3"}),u.createElement("span",{className:"".concat(n,"-slash")},"/"),O),u.createElement("li",{title:f?p.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:h()("".concat(n,"-next"),(0,r.Z)({},"".concat(n,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(B)),K);if(O<=3+2*J){var G={locale:p,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:f,itemRender:C};O||w.push(u.createElement(es_Pager,(0,a.Z)({},G,{key:"noPager",page:1,className:"".concat(n,"-item-disabled")})));for(var A=1;A<=O;A+=1){var M=k===A;w.push(u.createElement(es_Pager,(0,a.Z)({},G,{key:A,page:A,active:M})))}}else{var q=m?p.prev_3:p.prev_5,L=m?p.next_3:p.next_5;x&&(T=u.createElement("li",{title:f?q:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:h()("".concat(n,"-jump-prev"),(0,r.Z)({},"".concat(n,"-jump-prev-custom-icon"),!!N))},C(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(N,"prev page"))),R=u.createElement("li",{title:f?L:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:h()("".concat(n,"-jump-next"),(0,r.Z)({},"".concat(n,"-jump-next-custom-icon"),!!y))},C(this.getJumpNextPage(),"jump-next",this.getItemIcon(y,"next page")))),j=u.createElement(es_Pager,{locale:p,last:!0,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:O,page:O,active:!1,showTitle:f,itemRender:C}),V=u.createElement(es_Pager,{locale:p,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:f,itemRender:C});var Q=Math.max(1,k-J),F=Math.min(k+J,O);k-1<=J&&(F=1+2*J),O-k<=J&&(Q=O-2*J);for(var Y=Q;Y<=F;Y+=1){var H=k===Y;w.push(u.createElement(es_Pager,{locale:p,rootPrefixCls:n,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:Y,page:Y,active:H,showTitle:f,itemRender:C}))}k-1>=2*J&&3!==k&&(w[0]=(0,u.cloneElement)(w[0],{className:"".concat(n,"-item-after-jump-prev")}),w.unshift(T)),O-k>=2*J&&k!==O-2&&(w[w.length-1]=(0,u.cloneElement)(w[w.length-1],{className:"".concat(n,"-item-before-jump-next")}),w.push(R)),1!==Q&&w.unshift(V),F!==O&&w.push(j)}var X=!this.hasPrev()||!O,$=!this.hasNext()||!O;return u.createElement("ul",(0,a.Z)({className:h()(n,i,(0,r.Z)({},"".concat(n,"-disabled"),s)),style:o,ref:this.savePaginationNode},D),W,u.createElement("li",{title:f?p.prev_page:null,onClick:this.prev,tabIndex:X?null:0,onKeyPress:this.runIfEnterPrev,className:h()("".concat(n,"-prev"),(0,r.Z)({},"".concat(n,"-disabled"),X)),"aria-disabled":X},this.renderPrev(U)),w,u.createElement("li",{title:f?p.next_page:null,onClick:this.next,tabIndex:$?null:0,onKeyPress:this.runIfEnterNext,className:h()("".concat(n,"-next"),(0,r.Z)({},"".concat(n,"-disabled"),$)),"aria-disabled":$},this.renderNext(B)),u.createElement(d,{disabled:s,locale:p,rootPrefixCls:n,selectComponentClass:E,selectPrefixCls:I,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:k,pageSize:_,pageSizeOptions:S,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Z}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n={};if("current"in e&&(n.current=e.current,e.current!==t.current&&(n.currentInputValue=n.current)),"pageSize"in e&&e.pageSize!==t.pageSize){var a=t.current,r=calculatePage(e.pageSize,t,e);a=a>r?r:a,"current"in e||(n.current=a,n.currentInputValue=a),n.pageSize=e.pageSize}return n}}]),Pagination}(u.Component);m.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:noop,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:noop,locale:{items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},style:{},itemRender:defaultItemRender,totalBoundaryShowSizeChanger:50};var f=m}}]); |