20180604 release

This commit is contained in:
AllenFang
2018-06-03 23:05:44 +08:00
parent 5376ce25dd
commit d2d39fcc21
31 changed files with 348 additions and 101 deletions

View File

@@ -23,6 +23,7 @@
<li>TextFilter</li>
<li>SelectFilter</li>
<li>NumberFilter</li>
<li>DateFilter</li>
<li><strong>Coming soon!</strong></li>
</ul>
<h2><a class="anchor" aria-hidden="true" name="text-filter"></a><a href="#text-filter" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Text Filter</h2>
@@ -129,6 +130,40 @@
getFilter: <span class="hljs-function">(<span class="hljs-params">f</span>) =&gt;</span> { ... } <span class="hljs-comment">// accept callback function and you can call it for filter programmtically</span>
})
<span class="hljs-comment">// omit...</span>
</code></pre>
<h2><a class="anchor" aria-hidden="true" name="date-filter"></a><a href="#date-filter" aria-hidden="true" class="hash-link" ><svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Date Filter</h2>
<pre><code class="hljs css js"><span class="hljs-keyword">import</span> filterFactory, { dateFilter } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-bootstrap-table2-filter'</span>;
<span class="hljs-keyword">const</span> columns = [..., {
<span class="hljs-attr">dataField</span>: <span class="hljs-string">'date'</span>,
<span class="hljs-attr">text</span>: <span class="hljs-string">'Product date'</span>,
<span class="hljs-attr">filter</span>: dateFilter()
}];
<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">BootstrapTable</span> <span class="hljs-attr">keyField</span>=<span class="hljs-string">'id'</span> <span class="hljs-attr">data</span>=<span class="hljs-string">{</span> <span class="hljs-attr">products</span> } <span class="hljs-attr">columns</span>=<span class="hljs-string">{</span> <span class="hljs-attr">columns</span> } <span class="hljs-attr">filter</span>=<span class="hljs-string">{</span> <span class="hljs-attr">filterFactory</span>() } /&gt;</span>
</span></code></pre>
<blockquote>
<p><strong>Notes:</strong> date filter accept a Javascript Date object in your raw data.</p>
</blockquote>
<p>Date filter is same as other filter, you can custom the date filter via <code>dateFilter</code> factory function:</p>
<pre><code class="hljs css js"><span class="hljs-keyword">import</span> filterFactory, { selectFilter, Comparator } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-bootstrap-table2-filter'</span>;
<span class="hljs-comment">// omit...</span>
<span class="hljs-keyword">const</span> dateFilter = dateFilter({
<span class="hljs-attr">delay</span>: <span class="hljs-number">600</span>, <span class="hljs-comment">// how long will trigger filtering after user typing, default is 500 ms</span>
placeholder: <span class="hljs-string">'custom placeholder'</span>, <span class="hljs-comment">// placeholder for date input</span>
withoutEmptyComparatorOption: <span class="hljs-literal">true</span>, <span class="hljs-comment">// dont render empty option for comparator</span>
comparators: [Comparator.EQ, Comparator.GT, Comparator.LT], <span class="hljs-comment">// Custom the comparators</span>
style: { <span class="hljs-attr">display</span>: <span class="hljs-string">'inline-grid'</span> }, <span class="hljs-comment">// custom the style on date filter</span>
className: <span class="hljs-string">'custom-dateFilter-class'</span>, <span class="hljs-comment">// custom the class on date filter</span>
comparatorStyle: { <span class="hljs-attr">backgroundColor</span>: <span class="hljs-string">'antiquewhite'</span> }, <span class="hljs-comment">// custom the style on comparator select</span>
comparatorClassName: <span class="hljs-string">'custom-comparator-class'</span>, <span class="hljs-comment">// custom the class on comparator select</span>
dateStyle: { <span class="hljs-attr">backgroundColor</span>: <span class="hljs-string">'cadetblue'</span>, <span class="hljs-attr">margin</span>: <span class="hljs-string">'0px'</span> }, <span class="hljs-comment">// custom the style on date input</span>
dateClassName: <span class="hljs-string">'custom-date-class'</span>, <span class="hljs-comment">// custom the class on date input</span>
defaultValue: { <span class="hljs-attr">date</span>: <span class="hljs-keyword">new</span> <span class="hljs-built_in">Date</span>(<span class="hljs-number">2018</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>), <span class="hljs-attr">comparator</span>: Comparator.GT } <span class="hljs-comment">// default value</span>
});
<span class="hljs-comment">// omit...</span>
</code></pre>
<hr />
@@ -172,5 +207,6 @@
<li><a href="../storybook/index.html?selectedKind=Column%20Filter&amp;selectedStory=Programmatically%20Text%20Filter%20">Example For Programmtically Text Filter</a></li>
<li><a href="../storybook/index.html?selectedKind=Column%20Filter&amp;selectedStory=Programmatically%20Select%20Filter%20">Example For Programmtically Select Filter</a></li>
<li><a href="../storybook/index.html?selectedKind=Column%20Filter&amp;selectedStory=Programmatically%20Number%20Filter%20">Example For Programmtically Number Filter</a></li>
<li><a href="../storybook/index.html?selectedKind=Column%20Filter&amp;selectedStory=Programmatically%Date%20Filter%20">Example For Programmtically Date Filter</a></li>
</ul>
</span></div></article></div><div class="docs-prevnext"><a class="docs-prev button" href="basic-row-select.html">← Row Selection</a><a class="docs-next button" href="basic-celledit.html">Cell Edit →</a></div></div></div></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/react-bootstrap-table2/" class="nav-home"></a><div><h5>Docs</h5><a href="/react-bootstrap-table2/docs/en/getting-started.html">Getting Started</a><a href="/react-bootstrap-table2/docs/en/table-props.html">API References</a></div><div><h5>Community</h5><a href="https://stackoverflow.com/questions/tagged/react-bootstrap-table" target="_blank">Stack Overflow</a><a href="https://discordapp.com/">Project Chat</a><a href="https://twitter.com/" target="_blank">Twitter</a></div><div><h5>More</h5><a href="/react-bootstrap-table2/blog/index.html">Blog</a><a href="https://github.com/react-bootstrap-table/react-bootstrap-table2">GitHub</a><a class="github-button" href="https://github.com/react-bootstrap-table/react-bootstrap-table2" data-icon="octicon-star" data-count-href="/facebook/docusaurus/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><section class="copyright">Copyright © 2018 react-bootstrap-table2.</section></footer></div></body></html>