From 028834da8b8b8465f3a7573f024f1d36b43ccc9e Mon Sep 17 00:00:00 2001 From: AllenFang Date: Tue, 8 May 2018 22:33:46 +0800 Subject: [PATCH 1/5] add release command --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 56c17c7..5564378 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "test:watch": "jest --watch", "storybook": "cd ./packages/react-bootstrap-table2-example && yarn storybook", "gh-pages:clean": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:clean", - "gh-pages:build": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:build" + "gh-pages:build": "cd ./packages/react-bootstrap-table2-example && yarn gh-pages:build", + "release": "yarn install && yarn build && lerna publish" }, "repository": { "type": "git", From 888aa1d08b37b16225b6e10f749ad222711e3afe Mon Sep 17 00:00:00 2001 From: Allen Date: Thu, 10 May 2018 14:07:24 +0800 Subject: [PATCH 2/5] fix #303 (#330) --- packages/react-bootstrap-table2-filter/src/wrapper.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-bootstrap-table2-filter/src/wrapper.js b/packages/react-bootstrap-table2-filter/src/wrapper.js index f13e615..1e85d5b 100644 --- a/packages/react-bootstrap-table2-filter/src/wrapper.js +++ b/packages/react-bootstrap-table2-filter/src/wrapper.js @@ -30,13 +30,11 @@ export default (Base, { // I think this condition only isRemoteFilter is enough store.filteredData = store.getAllData(); this.setState(() => ({ isDataChanged: true, currFilters: store.filters })); - } else if (isDataChanged) { - if (!isRemoteFilter && Object.keys(this.state.currFilters).length > 0) { + } else { + if (Object.keys(this.state.currFilters).length > 0) { store.filteredData = filters(store, columns, _)(this.state.currFilters); } this.setState(() => ({ isDataChanged })); - } else { - this.setState(() => ({ isDataChanged: false })); } } From 43e73313e651c448e99fc6ce2e24896a7d26c060 Mon Sep 17 00:00:00 2001 From: MikeSha Date: Sat, 12 May 2018 08:40:24 +0300 Subject: [PATCH 3/5] implement wrapperClasses(#325) --- packages/react-bootstrap-table2/src/bootstrap-table.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-bootstrap-table2/src/bootstrap-table.js b/packages/react-bootstrap-table2/src/bootstrap-table.js index 0e801cb..91e46cc 100644 --- a/packages/react-bootstrap-table2/src/bootstrap-table.js +++ b/packages/react-bootstrap-table2/src/bootstrap-table.js @@ -52,9 +52,12 @@ class BootstrapTable extends PropsBaseResolver(Component) { caption, rowStyle, rowClasses, + wrapperClasses, rowEvents } = this.props; + const tableWrapperClass = cs('react-bootstrap-table', wrapperClasses); + const tableClass = cs('table', { 'table-striped': striped, 'table-hover': hover, @@ -75,7 +78,7 @@ class BootstrapTable extends PropsBaseResolver(Component) { const tableCaption = (caption && { caption }); return ( -
+
{ tableCaption }
Date: Sat, 12 May 2018 13:54:40 +0800 Subject: [PATCH 4/5] patch docs, example and test for wrapperClasses --- docs/README.md | 4 ++++ .../examples/basic/customized-id-classes.js | 4 ++++ .../stories/stylesheet/base-table/_index.scss | 4 ++++ .../test/bootstrap-table.test.js | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/docs/README.md b/docs/README.md index 181b4a8..b7c5982 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,6 +17,7 @@ * [condensed](#condensed) * [id](#id) * [classes](#classes) +* [wrapperClasses](#wrapperClasses) * [cellEdit](#cellEdit) * [selectRow](#selectRow) * [rowStyle](#rowStyle) @@ -107,6 +108,9 @@ Same as bootstrap `.table-condensed` class for making a table more compact by cu Customize id on `table` element. ### classes - [String] Customize class on `table` element. + +### wrapperClasses - [String] +Customize class on the outer element which wrap up the `table` element. ### cellEdit - [Object] Makes table cells editable, please see [cellEdit definition](./cell-edit.md) for more detail. diff --git a/packages/react-bootstrap-table2-example/examples/basic/customized-id-classes.js b/packages/react-bootstrap-table2-example/examples/basic/customized-id-classes.js index d14c606..fae4bf7 100644 --- a/packages/react-bootstrap-table2-example/examples/basic/customized-id-classes.js +++ b/packages/react-bootstrap-table2-example/examples/basic/customized-id-classes.js @@ -33,6 +33,7 @@ const columns = [{ + `; export default () => ( @@ -43,6 +44,9 @@ export default () => (

Customized table className

+

Customized wrapper className

+ + { sourceCode } ); diff --git a/packages/react-bootstrap-table2-example/stories/stylesheet/base-table/_index.scss b/packages/react-bootstrap-table2-example/stories/stylesheet/base-table/_index.scss index 34353eb..beaf76d 100644 --- a/packages/react-bootstrap-table2-example/stories/stylesheet/base-table/_index.scss +++ b/packages/react-bootstrap-table2-example/stories/stylesheet/base-table/_index.scss @@ -5,3 +5,7 @@ table.foo { table#bar { background-color: $light-blue; } + +div.boo { + border: 2px solid salmon; +} \ No newline at end of file diff --git a/packages/react-bootstrap-table2/test/bootstrap-table.test.js b/packages/react-bootstrap-table2/test/bootstrap-table.test.js index 682dc73..b1d4062 100644 --- a/packages/react-bootstrap-table2/test/bootstrap-table.test.js +++ b/packages/react-bootstrap-table2/test/bootstrap-table.test.js @@ -74,6 +74,25 @@ describe('BootstrapTable', () => { }); }); + describe('when props.wrapperClasses was defined', () => { + const classes = 'foo'; + + beforeEach(() => { + wrapper = shallow( + ); + }); + + it('should display customized classes correctly', () => { + expect(wrapper.find(`.${classes}`).length).toBe(1); + }); + }); + describe('when props.id was defined', () => { const id = 'foo'; From ed2ba2a5c5f0640c0360a370aa24cc1cb0ce1912 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Mon, 14 May 2018 22:44:28 +0800 Subject: [PATCH 5/5] fix #334 --- packages/react-bootstrap-table2-filter/src/wrapper.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-bootstrap-table2-filter/src/wrapper.js b/packages/react-bootstrap-table2-filter/src/wrapper.js index 1e85d5b..33867fd 100644 --- a/packages/react-bootstrap-table2-filter/src/wrapper.js +++ b/packages/react-bootstrap-table2-filter/src/wrapper.js @@ -48,7 +48,8 @@ export default (Base, { onFilter(column, filterType) { return (filterVal) => { const { store, columns } = this.props; - const currFilters = Object.assign({}, this.state.currFilters); + // watch out here if migration to context API, #334 + const currFilters = Object.assign({}, store.filters); const { dataField, filter } = column; if (!_.isDefined(filterVal) || filterVal === '') {