-
Notifications
You must be signed in to change notification settings - Fork 0
/
52-bc4eac5649ec72ccd951.js
1 lines (1 loc) · 24.2 KB
/
52-bc4eac5649ec72ccd951.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[52],{702:function(n,a,s){"use strict";s.r(a),s.d(a,"default",function(){return x});var t=s(580),p=s.n(t),e=s(23),o=s.n(e),c=s(24),u=s.n(c),l=s(25),i=s.n(l),k=s(26),r=s.n(k),d=s(32),h=s.n(d),m=s(27),g=s.n(m),y=s(28),v=s.n(y),f=s(0),D=s.n(f),Y=s(111),b=s(82),w=function(){var n=function(n){function a(){var n,s;o()(this,a);for(var t=arguments.length,p=new Array(t),e=0;e<t;e++)p[e]=arguments[e];return s=i()(this,(n=r()(a)).call.apply(n,[this].concat(p))),v()(h()(s),"state",{}),v()(h()(s),"handleChange",function(n,a){b.db.success(JSON.stringify({value:n,chooseDays:a})),s.setState({value:n,chooseDays:a})}),v()(h()(s),"handleChange1",function(n,a){b.db.success(JSON.stringify({value:n,chooseDays:a})),s.setState({value1:n,chooseDays1:a})}),s}return g()(a,n),u()(a,[{key:"render",value:function(){var n=this.state,a=n.value,s=n.chooseDays,t=n.value1,p=n.chooseDays1;return D.a.createElement("div",null,D.a.createElement(b.t,{onChange:this.handleChange,value:a,format:"YYYY-MM-DD HH:mm:ss",valueType:"number",chooseDays:s}),D.a.createElement("br",null),D.a.createElement(b.t,{onChange:this.handleChange1,value:t,format:"YYYY-MM-DD HH:mm:ss",chooseDays:p,preset:[{text:"Today",value:0},{text:"Yesterday",value:1},{text:"7 days",value:7},{text:"30 days",value:30}]}))}}]),a}(f.Component);return D.a.createElement(n,null)},C=function(){var n=function(n){function a(){var n,s;o()(this,a);for(var t=arguments.length,p=new Array(t),e=0;e<t;e++)p[e]=arguments[e];return s=i()(this,(n=r()(a)).call.apply(n,[this].concat(p))),v()(h()(s),"state",{}),v()(h()(s),"handleChange",function(n,a){b.db.success(JSON.stringify({value:n,chooseDays:a})),s.setState({value:n,chooseDays:a})}),v()(h()(s),"handleChange1",function(n,a){b.db.success(JSON.stringify({value:n,chooseDays:a})),s.setState({value1:n,chooseDays1:a})}),s}return g()(a,n),u()(a,[{key:"render",value:function(){var n=this.state,a=n.value,s=n.chooseDays,t=n.value1,p=n.chooseDays1;return D.a.createElement("div",null,D.a.createElement(b.t,{onChange:this.handleChange,value:a,format:"YYYY-MM-DD HH:mm:ss",valueType:"number",chooseDays:s}),D.a.createElement("br",null),D.a.createElement(b.t,{onChange:this.handleChange1,value:t,format:"YYYY-MM-DD HH:mm:ss",chooseDays:p,preset:[{text:"Previous cycle",value:["2019-01-01","2019-01-02"]},{text:"January",value:["2019-01-01","2019-01-31"]}]}))}}]),a}(f.Component);return D.a.createElement(n,null)};function E(n){return D.a.createElement(n.tag,p()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function N(n){return D.a.createElement(E,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function M(n){return D.a.createElement(E,{tag:"style",html:n.style})}var S=function(n){function a(){var n,s;o()(this,a);for(var t=arguments.length,p=new Array(t),e=0;e<t;e++)p[e]=arguments[e];return s=i()(this,(n=r()(a)).call.apply(n,[this].concat(p))),v()(h()(s),"state",{showCode:!1}),v()(h()(s),"toggle",function(){s.setState({showCode:!s.state.showCode})}),s}return g()(a,n),u()(a,[{key:"render",value:function(){var n=this.state.showCode,a=this.props,s=a.title,t=a.src,p=a.children;return D.a.createElement("div",{className:"zandoc-react-demo"},D.a.createElement("div",{className:"zandoc-react-demo__preview"},p),D.a.createElement("div",{className:"zandoc-react-demo__bottom",onClick:this.toggle},D.a.createElement("div",{className:"zandoc-react-demo__title"},D.a.createElement("p",null,s||"")),D.a.createElement("i",{className:"zenticon zenticon-caret-up zandoc-react-demo__toggle ".concat(n?"zandoc-react-demo__toggle-on":"zandoc-react-demo__toggle-off")})),n&&D.a.createElement("pre",{className:"zandoc-react-demo__code"},D.a.createElement(E,{tag:"code",html:t,attributes:{className:"language-jsx"}})))}}]),a}(f.Component),x=function(n){function a(){return o()(this,a),i()(this,r()(a).apply(this,arguments))}return g()(a,n),u()(a,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var a=document.querySelector('a[href="'.concat(n,'"]'));a&&Object(Y.a)(document.documentElement,0,function n(a,s){for(;a;)return a.offsetTop&&"static"!==getComputedStyle(a).position&&(s+=a.offsetTop),n(a.parentNode,s);return s}(a,-9))}}},{key:"render",value:function(){return D.a.createElement("div",{className:"zandoc-react-container",key:null},D.a.createElement(M,{style:""}),D.a.createElement(N,{html:'<h2 class="anchor-heading"><a href="#daterangequickpicker">¶</a><a href="javascript:void(0)" id="daterangequickpicker" class="anchor-point"></a>DateRangeQuickPicker</h2>\n<p>DateRangeQuickPicker is used for time range selection, it has 2 quick options which points previous 7 days and previous 30 days.</p>\n<h3 class="anchor-heading"><a href="#usage-scenarios">¶</a><a href="javascript:void(0)" id="usage-scenarios" class="anchor-point"></a>Usage Scenarios</h3>\n<p>As a filter control above list pages.</p>\n<h3 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h3>'}),D.a.createElement(S,{title:"Basic Usage",id:"Demobasic",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> DateRangeQuickPicker<span class="token punctuation">,</span> Notify <span class="token punctuation">}</span> <span class="token keyword">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">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">handleChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span>JSON<span class="token punctuation">.</span><span class="token function">stringify</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n value<span class="token punctuation">,</span>\n chooseDays\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">handleChange1</span> <span class="token operator">=</span> <span class="token punctuation">(</span>value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span>JSON<span class="token punctuation">.</span><span class="token function">stringify</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n value1<span class="token punctuation">:</span> value<span class="token punctuation">,</span>\n chooseDays1<span class="token punctuation">:</span> chooseDays\n <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">const</span> <span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">,</span> value1<span class="token punctuation">,</span> chooseDays1 <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n\n <span class="token keyword">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>DateRangeQuickPicker</span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>handleChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>value<span class="token punctuation">}</span></span>\n <span class="token attr-name">format</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>YYYY-MM-DD HH:mm:ss<span class="token punctuation">"</span></span>\n <span class="token attr-name">valueType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>number<span class="token punctuation">"</span></span>\n <span class="token attr-name">chooseDays</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>chooseDays<span class="token punctuation">}</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span>\n <span class="token operator"><</span>DateRangeQuickPicker\n onChange<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>handleChange1<span class="token punctuation">}</span>\n value<span class="token operator">=</span><span class="token punctuation">{</span>value1<span class="token punctuation">}</span>\n format<span class="token operator">=</span><span class="token string">"YYYY-MM-DD HH:mm:ss"</span>\n chooseDays<span class="token operator">=</span><span class="token punctuation">{</span>chooseDays1<span class="token punctuation">}</span>\n preset<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span><span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'Today\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token number">0</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'Yesterday\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token number">1</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'7 days\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token number">7</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'30 days\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token number">30</span>\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">}</span>\n <span class="token operator">/</span><span class="token operator">></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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</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>'},D.a.createElement(w)),D.a.createElement(S,{title:"Quickly choose a time range",id:"Demopreset",src:'<span class="token keyword">import</span> <span class="token punctuation">{</span> DateRangeQuickPicker<span class="token punctuation">,</span> Notify <span class="token punctuation">}</span> <span class="token keyword">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">Simple</span> <span class="token keyword">extends</span> <span class="token class-name">Component</span> <span class="token punctuation">{</span>\n state <span class="token operator">=</span> <span class="token punctuation">{</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">handleChange</span> <span class="token operator">=</span> <span class="token punctuation">(</span>value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span>JSON<span class="token punctuation">.</span><span class="token function">stringify</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n value<span class="token punctuation">,</span>\n chooseDays\n <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token punctuation">}</span><span class="token punctuation">;</span>\n\n <span class="token function-variable function">handleChange1</span> <span class="token operator">=</span> <span class="token punctuation">(</span>value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>\n Notify<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span>JSON<span class="token punctuation">.</span><span class="token function">stringify</span><span class="token punctuation">(</span><span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>\n <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">setState</span><span class="token punctuation">(</span><span class="token punctuation">{</span>\n value1<span class="token punctuation">:</span> value<span class="token punctuation">,</span>\n chooseDays1<span class="token punctuation">:</span> chooseDays\n <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">const</span> <span class="token punctuation">{</span> value<span class="token punctuation">,</span> chooseDays<span class="token punctuation">,</span> value1<span class="token punctuation">,</span> chooseDays1 <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>state<span class="token punctuation">;</span>\n\n <span class="token keyword">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>DateRangeQuickPicker</span>\n <span class="token attr-name">onChange</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>handleChange<span class="token punctuation">}</span></span>\n <span class="token attr-name">value</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>value<span class="token punctuation">}</span></span>\n <span class="token attr-name">format</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>YYYY-MM-DD HH:mm:ss<span class="token punctuation">"</span></span>\n <span class="token attr-name">valueType</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>number<span class="token punctuation">"</span></span>\n <span class="token attr-name">chooseDays</span><span class="token script language-javascript"><span class="token punctuation">=</span><span class="token punctuation">{</span>chooseDays<span class="token punctuation">}</span></span>\n <span class="token punctuation">/></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span> <span class="token punctuation">/></span></span>\n <span class="token operator"><</span>DateRangeQuickPicker\n onChange<span class="token operator">=</span><span class="token punctuation">{</span><span class="token keyword">this</span><span class="token punctuation">.</span>handleChange1<span class="token punctuation">}</span>\n value<span class="token operator">=</span><span class="token punctuation">{</span>value1<span class="token punctuation">}</span>\n format<span class="token operator">=</span><span class="token string">"YYYY-MM-DD HH:mm:ss"</span>\n chooseDays<span class="token operator">=</span><span class="token punctuation">{</span>chooseDays1<span class="token punctuation">}</span>\n preset<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">[</span><span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'Previous cycle\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">\'2019-01-01\'</span><span class="token punctuation">,</span> <span class="token string">\'2019-01-02\'</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>\n text<span class="token punctuation">:</span> <span class="token string">\'January\'</span><span class="token punctuation">,</span>\n value<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string">\'2019-01-01\'</span><span class="token punctuation">,</span> <span class="token string">\'2019-01-31\'</span><span class="token punctuation">]</span>\n <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">}</span>\n <span class="token operator">/</span><span class="token operator">></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\nReactDOM<span class="token punctuation">.</span><span class="token function">render</span><span class="token punctuation">(</span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>Simple</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>'},D.a.createElement(C)),D.a.createElement(N,{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>Props</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n<th>Alternatives</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>prefix</td>\n<td>custom prefix</td>\n<td>string</td>\n<td><code>'zent'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>className</td>\n<td>custom classname</td>\n<td>string</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>preset</td>\n<td>custom quick option text</td>\n<td>array</td>\n<td><code>[{text: '7 days', value: 7}, {text: '30 days', value: 30}]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>change event callback</td>\n<td>func</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>value</td>\n<td>starting and end time</td>\n<td>array</td>\n<td><code>[]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>valueType</td>\n<td>Argument type of onChange</td>\n<td>string</td>\n<td><code>''</code></td>\n<td><code>'date'</code>\n, \n<code>'number'</code>\n, \n<code>'string'</code></td>\n</tr>\n<tr>\n<td>format</td>\n<td>Format of returned Date string</td>\n<td>string</td>\n<td><code>'YYYY-MM-DD'</code>\n, \n<code>'YYYY-MM-DD HH:mm:ss'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>chooseDays</td>\n<td>Number of choosen days</td>\n<td>number\n|\narray</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>min</td>\n<td>Minimum value of optional date</td>\n<td>string\n|\nDate</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n<tr>\n<td>max</td>\n<td>Maximum number of optional date</td>\n<td>string\n|\nDate</td>\n<td><code>''</code></td>\n<td></td>\n</tr>\n</tbody>\n</table>"}))}}]),a}(f.Component)}}]);