From 319e8525eab8edc2e199f6ed833859efd8176830 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 7 Oct 2018 13:48:57 +0800 Subject: [PATCH] 20181007 release --- docs/basic-sort.md | 2 +- docs/column-props.md | 14 +++++++ docs/exposed-api.md | 51 +++++++++++++++++++++++++ website/blog/2018-10-07-version-bump.md | 26 +++++++++++++ website/i18n/en.json | 3 ++ website/sidebars.json | 3 ++ 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 docs/exposed-api.md create mode 100644 website/blog/2018-10-07-version-bump.md diff --git a/docs/basic-sort.md b/docs/basic-sort.md index 289f298..a4e5591 100644 --- a/docs/basic-sort.md +++ b/docs/basic-sort.md @@ -79,4 +79,4 @@ There're two way you can change or prettify the header when sorting: [`headerSor ## Custom the Sort Caret -**Coming Soon!** \ No newline at end of file +See [`column.sortCaret`](./column-props.html#columnsortcaret-function). \ No newline at end of file diff --git a/docs/column-props.md b/docs/column-props.md index d006cc2..08e4164 100644 --- a/docs/column-props.md +++ b/docs/column-props.md @@ -16,6 +16,7 @@ Definition of columns props on BootstrapTable * [formatExtraData](#columnformatextradata-any) * [sort](#columnsort-bool) * [sortFunc](#columnsortfunc-function) +* [sortCaret](#columnsortcaret-function) * [onSort](#columnonsort-function) * [classes](#columnclasses-string-function) * [style](#columnstyle-object-function) @@ -128,6 +129,19 @@ Enable the column sort via a `true` value given. ``` > The possible value of `order` argument is **`asc`** and **`desc`**. +## column.sortCaret - [Function] +Use`column.sortCaret` to custom the sort caret. This callback function accept two arguments: `order` and `column` + ```js +{ + // omit... + sort: true, + sortCaret: (order, column) => { + return //... + } +} +``` +> The possible value of `order` argument is **`asc`**, **`desc`** and **`undefined`**. + ## column.onSort - [Function] `column.onSort` is an event listener for subscribing the event of sort: diff --git a/docs/exposed-api.md b/docs/exposed-api.md new file mode 100644 index 0000000..995ada7 --- /dev/null +++ b/docs/exposed-api.md @@ -0,0 +1,51 @@ +--- +id: exposed-api +title: Introduction Exposed API +sidebar_label: Introduction +--- + +`react-bootstrap-table2` support some hooks function that you can use to know what state changes, for example: a row is select or unselect. +In addition, we also allow you use `React` `Refs` to directly access the components so that you can easier to get some table states. + +**[Live Demo](../storybook/index.html?selectedKind=Basic%20Table&selectedStory=Exposed%20API)** + +## Add a Refs on `BootstrapTable` + +```js + this.node = n } + ... +/> +``` + +## Get Current Display Rows + +`this.node.table.props.data` + +## Get Current Selected Rows + +`this.node.selectionContext.state.selected` + +## Get Current Expanded Rows + +`this.node.rowExpandContext.state.expanded` + +## Get Current Page + +`this.node.paginationContext.currPage` + +## Get Current Size Per Page + +`this.node.paginationContext.currSizePerPage` + +## Get Current Sorting Column + +`this.node.sortContext.state.sortColumn` + +## Get Current Sorting Order + +`this.node.sortContext.state.sortOrder` + +## Get Current Filters + +`this.node.filterContext.currFilters` \ No newline at end of file diff --git a/website/blog/2018-10-07-version-bump.md b/website/blog/2018-10-07-version-bump.md new file mode 100644 index 0000000..e685562 --- /dev/null +++ b/website/blog/2018-10-07-version-bump.md @@ -0,0 +1,26 @@ +--- +title: New Release (2018-10-07) +author: Allen Fang +authorURL: https://twitter.com/allenfang_tw +--- + +## Changed Packages + +This release bump following packages: + +* `react-bootstrap-table-next@1.2.1` +* `react-bootstrap-table2-paginator@1.0.3` +* `react-bootstrap-table2-toolkit@1.1.1` + + +## Changelog + +### Bug fixes +* Fixed remote search bug([#591](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/591)) +* Fixed wrong calculation for `from` and `to` in pagination when remote search/filter enable and data is shrink below the current page([#594](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/594)) + +### Features +* Implement `column.sortCaret`([#593](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/593)) for customing the sort caret + +### Enhancements +* Easy to access the exposed API from react `ref`([#592](https://github.com/react-bootstrap-table/react-bootstrap-table2/pull/592)) diff --git a/website/i18n/en.json b/website/i18n/en.json index 3e38aea..5009b49 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -33,6 +33,8 @@ "cell-edit-props": "Cell Editing Props", "column-props": "Columns Props", "export-csv-props": "Export CSV Props", + "exposed-api": "Introduction Exposed API", + "Introduction": "Introduction", "filter-props": "Column Filter Props", "getting-started": "Getting Started", "Getting Started": "Getting Started", @@ -53,6 +55,7 @@ "Basic Usage": "Basic Usage", "Remote Table": "Remote Table", "Table Toolkits": "Table Toolkits", + "Exposed API": "Exposed API", "Table Definition": "Table Definition", "Column Definition": "Column Definition", "Cell Editing Definition": "Cell Editing Definition", diff --git a/website/sidebars.json b/website/sidebars.json index 6b50dd2..2233b61 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -24,6 +24,9 @@ "toolkits-getting-started", "basic-search", "basic-export-csv" + ], + "Exposed API": [ + "exposed-api" ] }, "api": {