-
Notifications
You must be signed in to change notification settings - Fork 0
/
5099-97a82f8a506b32350d3b.js
1 lines (1 loc) · 40.4 KB
/
5099-97a82f8a506b32350d3b.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[5099],{45099:(n,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>x});var t=s(73450),e=s(27378),p=s(57318),o=s(87230),c=s(39215),l=s(80964),u=s(24246);function r(n,a){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);a&&(t=t.filter((function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),s.push.apply(s,t)}return s}function i(n){for(var a=1;a<arguments.length;a++){var s=null!=arguments[a]?arguments[a]:{};a%2?r(Object(s),!0).forEach((function(a){(0,t.Z)(n,a,s[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach((function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))}))}return n}var k=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{value:2}),(0,t.Z)(this,"onChange",(n=>{this.setState({value:n})}))}render(){return(0,u.jsx)(o.j,{value:this.state.value,onChange:this.onChange})}}return(0,u.jsx)(n,{})},d=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{value:2.5}),(0,t.Z)(this,"onChange",(n=>{this.setState({value:n})}))}render(){return(0,u.jsx)(o.j,{allowHalf:!0,value:this.state.value,onChange:this.onChange})}}return(0,u.jsx)(n,{})},m=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{value:2.5}),(0,t.Z)(this,"onChange",(n=>{this.setState({value:n})}))}render(){return(0,u.jsx)(o.j,{disabled:!0,allowHalf:!0,value:this.state.value,onChange:this.onChange})}}return(0,u.jsx)(n,{})},h=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{value:2.5}),(0,t.Z)(this,"onChange",(n=>{this.setState({value:n})}))}render(){return(0,u.jsxs)("ul",{children:[(0,u.jsx)("li",{children:(0,u.jsx)(o.j,{character:(0,u.jsx)(c.J,{type:"youzan"}),allowHalf:!0,value:this.state.value,onChange:this.onChange})}),(0,u.jsx)("li",{children:(0,u.jsx)(o.j,{character:"赞",allowHalf:!0,value:this.state.value,onChange:this.onChange})})]})}}return(0,u.jsx)(n,{})},v=function(){class n extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{value:"3.7"}),(0,t.Z)(this,"onNumberChange",(n=>{this.setState({value:n})}))}render(){return(0,u.jsxs)("div",{children:[(0,u.jsx)(l.Y,{className:"zent-doc-rate-readonly-number",value:this.state.value,onChange:this.onNumberChange,max:5,min:0,decimal:1,showCounter:!0}),(0,u.jsx)(o.j,{value:+this.state.value,readOnly:!0})]})}}return(0,u.jsx)(n,{})};function f(n){return(0,u.jsx)(n.tag,i(i({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function g(n){return(0,u.jsx)(f,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function y(n){return(0,u.jsx)(f,{tag:"style",html:n.style})}function w(n,a){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(a+=n.offsetTop),w(n.parentNode,a);return a}class b extends e.Component{constructor(...n){super(...n),(0,t.Z)(this,"state",{showCode:!1}),(0,t.Z)(this,"toggle",(()=>{this.setState({showCode:!this.state.showCode})}))}render(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,e=a.children;return(0,u.jsxs)("div",{className:"zandoc-react-demo",children:[(0,u.jsx)("div",{className:"zandoc-react-demo__preview",children:e}),(0,u.jsxs)("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle,children:[(0,u.jsx)("div",{className:"zandoc-react-demo__title",children:(0,u.jsx)("p",{children:s||""})}),(0,u.jsx)("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})]}),n&&(0,u.jsx)("pre",{className:"zandoc-react-demo__code",children:(0,u.jsx)(f,{tag:"code",html:t,attributes:{className:"language-jsx"}})})]})}}class x extends e.Component{componentDidMount(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&(0,p.l)(document.documentElement,0,w(a,-9))}}render(){return e.createElement("div",{className:"zandoc-react-container"},e.createElement(y,{style:".zent-doc-rate-readonly-number {\n\t\twidth: 120px;\n\t\tmargin-bottom: 8px;\n\t}\n\t\t.zent-doc-rate-readonly-number .zent-input {\n\t\t\tmin-width: 62px;\n\t\t}"}),e.createElement(g,{html:'<h2 class="anchor-heading"><a href="#rate-ping-fen">¶</a><a href="javascript:void(0)" id="rate-ping-fen" class="anchor-point"></a>Rate 评分</h2>\n<p>评分组件。</p>\n<h3 class="anchor-heading"><a href="#dai-ma-yan-shi">¶</a><a href="javascript:void(0)" id="dai-ma-yan-shi" class="anchor-point"></a>代码演示</h3>'}),e.createElement(b,{title:"基础用法",id:"Demobasic",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Rate</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">App</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n value<span class="token operator">:</span> <span class="token number">2</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onChange</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(k)),e.createElement(b,{title:"允许半心",id:"Demoallowhalf",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Rate</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">App</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n value<span class="token operator">:</span> <span class="token number">2.5</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">allowHalf</span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onChange</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(d)),e.createElement(b,{title:"禁用",id:"Demodisabled",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Rate</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">App</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n value<span class="token operator">:</span> <span class="token number">2.5</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">disabled</span> <span class="token attr-name">allowHalf</span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onChange</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(m)),e.createElement(b,{title:"自定义字符",id:"Democharacter",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Rate</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Icon</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">App</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n value<span class="token operator">:</span> <span class="token number">2.5</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onChange</span> <span class="token operator">=</span> <span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>ul</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">character</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Icon</span></span> <span class="token attr-name">type</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>youzan<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span><span class="token punctuation">}</span></span> <span class="token attr-name">allowHalf</span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onChange</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>li</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">character</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>赞<span class="token punctuation">"</span></span> <span class="token attr-name">allowHalf</span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onChange</span><span class="token punctuation">}</span></span> <span class="token punctuation">/></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>li</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>ul</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(h)),e.createElement(b,{title:"仅展示结果(无交互效果)",id:"Demoreadonly",src:'<span class="token keyword module">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">Rate</span><span class="token punctuation">,</span> <span class="token maybe-class-name">NumberInput</span> <span class="token punctuation">}</span></span> <span class="token keyword module">from</span> <span class="token string">\'zent\'</span><span class="token punctuation">;</span>\n\n<span class="token keyword">class</span> <span class="token class-name">App</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n value<span class="token operator">:</span> <span class="token string">\'3.7\'</span><span class="token punctuation">,</span>\n <span class="token punctuation">}</span>\n\n <span class="token function-variable function">onNumberChange</span> <span class="token operator">=</span> <span class="token parameter">value</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token method function property-access">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value <span class="token punctuation">}</span><span class="token punctuation">)</span>\n <span class="token punctuation">}</span>\n\n <span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>\n <span class="token keyword control-flow">return</span> <span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>div</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">NumberInput</span></span>\n <span class="token attr-name">className</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>zent-doc-rate-readonly-number<span class="token punctuation">"</span></span>\n <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">onNumberChange</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">max</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">5.0</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">min</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">0</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">decimal</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token number">1</span><span class="token punctuation">}</span></span>\n <span class="token attr-name">showCounter</span>\n <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">Rate</span></span> <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token script-punctuation punctuation">=</span><span class="token punctuation">{</span><span class="token operator">+</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">.</span><span class="token property-access">value</span><span class="token punctuation">}</span></span> <span class="token attr-name">readOnly</span> <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>div</span><span class="token punctuation">></span></span>\n <span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n<span class="token punctuation">}</span>\n\n<span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span><span class="token class-name">App</span></span> <span class="token punctuation">/></span></span>\n <span class="token punctuation">,</span> mountNode\n<span class="token punctuation">)</span><span class="token punctuation">;</span>'},e.createElement(v)),e.createElement(g,{html:'<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<table class="table">\n<thead>\n<tr>\n<th>属性</th>\n<th>说明</th>\n<th>类型</th>\n<th>是否必须</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>onChange</td>\n<td>选择时的回调</td>\n<td><code>Function(value: number)</code></td>\n<td>是</td>\n<td>-</td>\n<td></td>\n</tr>\n<tr>\n<td>value</td>\n<td>当前数,受控值</td>\n<td><code>number</code></td>\n<td>否</td>\n<td>0</td>\n<td></td>\n</tr>\n<tr>\n<td>allowClear</td>\n<td>是否允许再次点击后清除</td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>true</code></td>\n<td></td>\n</tr>\n<tr>\n<td>allowHalf</td>\n<td>是否允许半选</td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>character</td>\n<td>自定义字符</td>\n<td><code>ReactNode</code></td>\n<td>否</td>\n<td><code><Icon type="star" /></code></td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>自定义样式类名</td>\n<td><code>string</code></td>\n<td>否</td>\n<td>-</td>\n<td></td>\n</tr>\n<tr>\n<td>count</td>\n<td><code>star</code>\n 总数</td>\n<td><code>number</code></td>\n<td>否</td>\n<td>5</td>\n<td></td>\n</tr>\n<tr>\n<td>disabled</td>\n<td>禁用,无法进行交互</td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>readOnly</td>\n<td>只读,仅用于展示,与 \n<code>disabled</code>\n 除语义差别外,主要区别是 cursor 不同,为真时可精确到 0.1 分显示</td>\n<td><code>boolean</code></td>\n<td>否</td>\n<td><code>false</code></td>\n<td></td>\n</tr>\n<tr>\n<td>style</td>\n<td>自定义样式对象</td>\n<td><code>object</code></td>\n<td>否</td>\n<td>-</td>\n<td></td>\n</tr>\n</tbody>\n</table>'}))}}},80964:(n,a,s)=>{"use strict";s.d(a,{Y:()=>O,Z:()=>I});var t=s(59312),e=s(24246),p=s(27378),o=s(60042),c=s.n(o),l=s(9828),u=s.n(l),r=s(27036),i=s(82285),k=s(77125),d=s(1348);function m(n,a,s){return n>=s?n:a<=s?a:s}function h(n){var a=function(n){return"number"!=typeof n||Number.isNaN(n)?Number.MAX_SAFE_INTEGER:m(Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,n)}(n.max),s=function(n){return"number"!=typeof n||Number.isNaN(n)?Number.MIN_SAFE_INTEGER:m(Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,n)}(n.min);return s>a?(function(n,a){for(var s=[],t=2;t<arguments.length;t++)s[t-2]=arguments[t]}(!1,"max is smaller than min"),{min:a,max:s}):{min:s,max:a}}function v(n,a,s){var t,e=null;return null==n?(t=null,e=""):"string"==typeof n?t=parseInt(n,10)||0:Number.isNaN(n)?(t=0,e=""):t=Math.floor(n),null!==t&&(t=Math.min(s,t),t=Math.max(a,t)),null===e&&(e=String(t)),{value:t,input:e}}function f(n,a,s){if(null===n)return{canDec:!1,canInc:!1};var t=!0,e=!0;return a>=n&&(t=!1),s<=n&&(e=!1),{canDec:t,canInc:e}}function g(n){return n.startsWith("+")?n.substring(1):n}var y=new(u())(0);function w(n){return""===n||"."===n||"-"===n||"+"===n}function b(n){return/^[-+]?\d*\.?\d*$/.test(n)}function x(n,a){return Number.isFinite(a)?new(u())(a):new(u())(1).div(Math.pow(10,n))}function C(n){return b(n=String(n))?new(u())(g(n)):null}function j(n){return{min:C(n.min),max:C(n.max)}}function N(n,a,s,t){if(null==n)return{input:"",value:y};if(w(n=String(n))||!b(n))return{input:"",value:y};if(""===n||w(n))return{input:n,value:y};var e=new(u())(g(n));return null!==a&&1===a.cmp(e)&&(e=a),null!==s&&-1===s.cmp(e)&&(e=s),{input:e.toFixed(t),value:e}}function z(n,a,s){var t=!0,e=!0;return null!==a&&(t=-1===a.cmp(n)),null!==s&&(e=1===s.cmp(n)),{canDec:t,canInc:e}}var S=s(72551),E=Object.is;function R(n,a){if(!0===n.integer){var s=h(n),e=s.min,p=s.max;return(0,t.pi)({prevProps:n,min:e,max:p,delta:(o=n.step,Number.isFinite(o)?Math.round(o):1)},a?v(n.value,e,p):{})}var o,c=j(n);return e=c.min,p=c.max,(0,t.pi)({prevProps:n,min:e,max:p,delta:x(n.decimal,n.step)},a?N(n.value,e,p,n.decimal):{})}var O=function(n){function a(a){var s=n.call(this,a)||this;return s.focused=!1,s.inputRef=(0,p.createRef)(),s.inputContext={renderInner:function(n){return s.renderChild(n)}},s.onUserInput=function(n){var a=n.target.value;if(!1===s.props.integer){var t=s.props.onInput;w(a)?s.setState({input:a,value:y}):b(a)&&(s.setState({input:a,value:new(u())(g(a))}),t&&t(a))}else if(t=s.props.onInput,function(n){return""===n||"-"===n||"+"===n}(a))s.setState({input:a,value:null}),t&&t(a);else if(function(n){return/^[-+]?\d*$/.test(n.toString())}(a)){var e=parseInt(a,10)||0;s.setState({input:a,value:e}),t&&t(a)}},s.onFocus=function(n){s.focused=!0;var a=s.props.onFocus;a&&a(n)},s.onBlur=function(n){if(s.focused=!1,!0===s.props.integer){var a=s.props.onChange,t=s.state,e=v(t.value,t.min,t.max);null==a||a(e.value),s.setState(e),null==(p=s.props.onBlur)||p(n)}else{var p,o=s.props,c=(a=o.onChange,o.decimal),l=s.state;e=N(l.input,l.min,l.max,c),null==a||a(e.input),s.setState(e),(p=s.props.onBlur)&&p(n)}},s.inc=function(){s.step("inc")},s.dec=function(){s.step("dec")},s.state=R(a,!0),s}return(0,t.ZT)(a,n),a.prototype.step=function(n){if(!this.props.disabled)if(!0===this.props.integer){var a=this.state,s=a.value,t=a.min,e=a.max,p=a.delta,o=f(s,t,e),c=o.canInc,l=o.canDec;if(null===s||"inc"===n&&!c||"dec"===n&&!l)return;var u=void 0;u="inc"===n?s+p:s-p,null==(i=this.props.onChange)||i(u),this.setState({value:u,input:String(u)})}else{var r=this.props,i=r.onChange,k=r.decimal,d=this.state,m=(s=d.value,t=d.min,e=d.max,p=d.delta,z(s,t,e));if(c=m.canInc,l=m.canDec,"inc"===n&&!c||"dec"===n&&!l)return;u=void 0;var h=(u="inc"===n?s.plus(p):s.minus(p)).toFixed(k);null==i||i(h),this.setState({value:u,input:h})}},a.getDerivedStateFromProps=function(n,a){var s=a.prevProps;if(n===s)return null;var e=function(n){return(0,S.n)(n,"value")&&(0,S.n)(n,"onChange")}(n);if(n.integer!==s.integer)return R(n,e);if(!0===n.integer){var p=(0,t.pi)((0,t.pi)({},a),{prevProps:n}),o=!1;if(!E(n.min,s.min)||!E(n.max,s.max)){var c=h(n),l=c.min,u=c.max;p.min=l,p.max=u,o=!0}if(e&&(o||!E(n.value,s.value))){var r=v(n.value,p.min,p.max),i=r.value,k=r.input;p.value=i,p.input=k}return p}var d=(0,t.pi)((0,t.pi)({},a),{prevProps:n}),m=!1;if(!E(n.min,s.min)||!E(n.max,s.max)){var f=j(n);l=f.min,u=f.max,d.min=l,d.max=u,m=!0}if(e&&(m||!E(n.value,s.value)||!E(n.decimal,s.decimal))){var g=N(n.value,d.min,d.max,n.decimal);i=g.value,k=g.input,d.value=i,d.input=k}return E(n.step,s.step)&&E(n.decimal,s.decimal)||(d.delta=x(n.decimal,n.step)),d},a.prototype.checkPropsValue=function(){if(!0===this.props.integer)this.props.value!==this.state.value&&(a=this.props.onChange)&&a(this.state.value);else{var n=this.props,a=n.onChange,s=n.decimal,t=n.value,e=this.state.value.toFixed(s),p="number"==typeof t?t.toFixed(s):t;a&&""!==this.props.value&&""!==this.state.input&&p!==e&&a(e)}},a.prototype.componentDidMount=function(){"value"in this.props&&!this.focused&&this.checkPropsValue()},a.prototype.componentDidUpdate=function(n){n!==this.props&&"value"in this.props&&!this.focused&&this.checkPropsValue()},a.prototype.renderChild=function(n){var a,s=this.props,p=s.disabled,o=void 0===p?this.context.value:p,l=s.readOnly,u=s.showCounter,i=s.showStepper;if(!0===this.props.integer){var k=this.state,d=k.min,m=k.max;a=f(k.value,d,m)}else{var h=this.state;a=z(h.value,d=h.min,m=h.max)}var v=a.canDec,g=a.canInc,y=o||l||!g,w=o||l||!v,b=c()({"zent-number-input-arrow":!0,"zent-number-input-arrowup":!0,"zent-number-input-arrow-disable":y}),x=c()({"zent-number-input-arrow":!0,"zent-number-input-arrowdown":!0,"zent-number-input-arrow-disable":w}),C=c()({"zent-number-input-count":!0,"zent-number-input-countreduce":!0,"zent-number-input-count-disable":w}),j=c()({"zent-number-input-count":!0,"zent-number-input-countadd":!0,"zent-number-input-count-disable":y});return(0,e.jsxs)(e.Fragment,{children:[u&&(0,e.jsx)("div",(0,t.pi)({className:C,onClick:this.dec,"data-zv":"9.12.16"},{children:"–"}),void 0),n,u&&(0,e.jsx)("div",(0,t.pi)({className:j,onClick:this.inc,"data-zv":"9.12.16"},{children:"+"}),void 0),i&&(0,e.jsxs)("div",(0,t.pi)({className:"zent-number-input-arrows","data-zv":"9.12.16"},{children:[(0,e.jsx)("div",(0,t.pi)({className:b,onClick:this.inc,"data-zv":"9.12.16"},{children:(0,e.jsx)(r.Z,{type:"up"},void 0)}),void 0),(0,e.jsx)("div",(0,t.pi)({className:x,onClick:this.dec,"data-zv":"9.12.16"},{children:(0,e.jsx)(r.Z,{type:"down"},void 0)}),void 0)]}),void 0)]},void 0)},a.prototype.render=function(){var n=this.props,a=(n.integer,n.className),s=n.disabled,p=n.readOnly,o=(n.type,n.onChange,n.showStepper),l=n.showCounter,u=(n.min,n.max,n.decimal,n.onInput,(0,t._T)(n,["integer","className","disabled","readOnly","type","onChange","showStepper","showCounter","min","max","decimal","onInput"])),r=this.state.input;if(o&&l)throw new Error("NumberInput: showStepper、 showCounter cannot exist at the same time");return(0,e.jsx)(k.r.Provider,(0,t.pi)({value:this.inputContext},{children:(0,e.jsx)(i.I,(0,t.pi)({ref:this.inputRef,autoComplete:"off"},u,{readOnly:p,disabled:s,className:c()("zent-number-input",a),value:r,onChange:this.onUserInput,onFocus:this.onFocus,onBlur:this.onBlur}),void 0)}),void 0)},a.defaultProps={integer:!1,type:"number",decimal:0,size:"normal"},a.contextType=d.d,a}(p.Component),I=O},87230:(n,a,s)=>{"use strict";s.d(a,{j:()=>k});var t=s(59312),e=s(24246),p=s(27378),o=s(60042),c=s.n(o),l=function(n){var a=n.className;return(0,e.jsx)("svg",(0,t.pi)({className:a,width:"1em",height:"1em",viewBox:"0 0 12 12",version:"1.1","data-zv":"9.12.16"},{children:(0,e.jsx)("path",{fill:"currentColor",d:"M5.99995351,10.2785052 L3.0526252,11.9161235 C2.73134341,12.0946367 2.3262008,11.9788615 2.14771388,11.6575325 C2.07507647,11.5267638 2.048604,11.3753341 2.07256714,11.227673 L2.644706,7.70214784 L0.18800271,5.17127401 C-0.0680077998,4.90753426 -0.0617734594,4.4861629 0.201927499,4.23011474 C0.30111659,4.13380419 0.42783327,4.07077947 0.564476058,4.04979499 L3.92629651,3.5335141 L5.39699811,0.384084246 C5.55252473,0.0510321934 5.9485563,-0.0928620579 6.28155937,0.0626874406 C6.42306565,0.128786625 6.53681945,0.242557148 6.60290891,0.384084246 L8.07361051,3.5335141 L11.435431,4.04979499 C11.7987051,4.10558366 12.047978,4.44534453 11.9921975,4.80867212 C11.9712161,4.94533501 11.9082007,5.07207032 11.8119043,5.17127401 L9.35520102,7.70214784 L9.92733988,11.227673 C9.98622287,11.5905106 9.73986227,11.9323896 9.37707808,11.9912813 C9.22943868,12.015248 9.07803132,11.9887716 8.94728182,11.9161235 L5.99995351,10.2785052 Z","data-zv":"9.12.16"},void 0)}),void 0)},u=function(n){function a(){var a=null!==n&&n.apply(this,arguments)||this;return a.elRef=(0,p.createRef)(),a.onHover=function(n){var s=a.props;(0,s.onHover)(n,s.index)},a.onClick=function(n){var s=a.props;(0,s.onClick)(n,s.index)},a.getFloatValue=function(){return 100*a.props.value%100+"%"},a}return(0,t.ZT)(a,n),a.prototype.getClassName=function(){var n=this.props,a=n.index,s=n.value,t=n.allowHalf,e=n.readOnly,p=a+1,o=p<=s,l=p>Math.ceil(s),u=t&&s+.5===p,r=e&&p>s&&p===Math.ceil(s);return c()("zent-rate-star",{"zent-rate-star-full":o,"zent-rate-star-zero":l,"zent-rate-star-half":u,"zent-rate-star-part":r})},a.prototype.render=function(){var n=this.onHover,a=this.onClick,s=this.props,p=s.disabled,o=s.character,c=s.readOnly,l=p||c;return(0,e.jsxs)("li",(0,t.pi)({ref:this.elRef,className:this.getClassName(),onClick:l?void 0:a,onMouseMove:l?void 0:n,"data-zv":"9.12.16"},{children:[(0,e.jsx)("div",(0,t.pi)({className:"zent-rate-star-first",style:c?{width:this.getFloatValue()}:void 0,"data-zv":"9.12.16"},{children:o}),void 0),(0,e.jsx)("div",(0,t.pi)({className:"zent-rate-star-second","data-zv":"9.12.16"},{children:o}),void 0)]}),void 0)},a}(p.Component),r=s(1348);function i(n){for(var a=[],s=0;s<n;s+=1)a.push((0,p.createRef)());return a}var k=function(n){function a(a){var s=n.call(this,a)||this;return s.onHover=function(n,a){var t=s.getStarValue(a,n.pageX);t!==s.state.cleanedValue&&s.setState({hoverValue:t,cleanedValue:null})},s.onMouseLeave=function(){s.setState({hoverValue:null,cleanedValue:null})},s.onClick=function(n,a){var t=s.props.onChange,e=s.getStarValue(a,n.pageX),p=!1;s.props.allowClear&&(p=e===s.props.value),s.onMouseLeave(),t&&t(p?0:e),s.setState({cleanedValue:p?e:null})},s.state={cleanedValue:null,hoverValue:null,starRefs:i(a.count)},s}return(0,t.ZT)(a,n),a.prototype.getStarDOM=function(n){var a=this.state.starRefs[n];if(!a)throw new Error("Missing Star Ref, this looks like a bug of zent, please file an issue");var s=a.current;if(!s)throw new Error("Missing Star instance, this looks like a bug of zent, please file an issue");var t=s.elRef.current;if(!t)throw new Error("Missing Star element, this looks like a bug of zent, please file an issue");return t},a.prototype.getStarValue=function(n,a){var s=n+1;if(this.props.allowHalf){var t=this.getStarDOM(n);a-t.getBoundingClientRect().left<t.clientWidth/2&&(s-=.5)}return s},a.getDerivedStateFromProps=function(n,a){var s=n.count;return s!==a.starRefs.length?{starRefs:i(s)}:null},a.prototype.render=function(){for(var n=this.props,a=n.count,s=n.allowHalf,p=n.style,o=n.disabled,l=void 0===o?this.context.value:o,r=n.className,i=n.character,k=n.value,d=n.readOnly,m=this.state,h=m.hoverValue,v=m.starRefs,f=[],g=0;g<a;g++)f.push((0,e.jsx)(u,{ref:v[g],index:g,disabled:l,allowHalf:s,value:null!==h?h:k,onClick:this.onClick,onHover:this.onHover,character:i,readOnly:d},g));return(0,e.jsx)("ul",(0,t.pi)({className:c()("zent-rate",{"zent-rate-disabled":l,"zent-rate-readonly":d},r),style:p,onMouseLeave:l||d?void 0:this.onMouseLeave,"data-zv":"9.12.16"},{children:f}),void 0)},a.defaultProps={value:0,count:5,allowHalf:!1,allowClear:!0,character:(0,e.jsx)(l,{className:"zent-rate-star-icon"},void 0),readOnly:!1},a.contextType=r.d,a}(p.Component)}}]);