Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit 2037771

Browse files
Fixed merge conflicts with master
2 parents badc461 + b6c362c commit 2037771

File tree

8 files changed

+87
-99
lines changed

8 files changed

+87
-99
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,5 @@ node_modules
9393

9494
# Linux trash folder which might appear on any partition or disk
9595
.Trash-*
96+
97+
.idea

CHANGELOG.md

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,143 @@
1-
# Release Notes
1+
# Changelog
2+
3+
## (2019-01-02) `v2.0.0`
4+
5+
### Added
6+
7+
- `DatFolder` now accepts a `closed` boolean prop to determine if the folder should be closed or open by default
8+
9+
### Changed
10+
11+
- React v16.0.0 is now required as a peer dependency
12+
- README updated with more docs, included a note about the React v16 peer dependency
213

314
## (2017-12-09) `v1.0.3`
415

516
### Added
617

7-
* Section on React version to README
8-
* Point regarding animations for `DatFolder` to Roadmap
9-
* License section to README
18+
- Section on React version to README
19+
- Point regarding animations for `DatFolder` to Roadmap
20+
- License section to README
1021

1122
## (2017-10-09) `v1.0.2`
1223

1324
### Changed
1425

15-
* Minor code formatting updates
16-
* Installation guidelines
26+
- Minor code formatting updates
27+
- Installation guidelines
1728

1829
## (2017-10-09) `v1.0.1`
1930

2031
### Changed
2132

22-
* ES7 property initializers are now used to set initial state in all components rather than `componentWillMount`
33+
- ES7 property initializers are now used to set initial state in all components rather than `componentWillMount`
2334

2435
## (2017-10-09) `v1.0.0`
2536

2637
### Added
2738

28-
* A lot of documentation to the README
29-
* Deploy script to `./example` app which deploys to github pages
39+
- A lot of documentation to the README
40+
- Deploy script to `./example` app which deploys to github pages
3041

3142
### Changed
3243

33-
* Changed default export from `Dat` to `DatGui`
44+
- Changed default export from `Dat` to `DatGui`
3445

3546
## (2017-10-08) `v0.0.21`
3647

3748
### Changed
3849

39-
* Removed custom check box styling from `DatBoolean` component
40-
* Ensured sliders are the same height as number inputs
41-
* Minor style changes for consistency
50+
- Removed custom check box styling from `DatBoolean` component
51+
- Ensured sliders are the same height as number inputs
52+
- Minor style changes for consistency
4253

4354
## (2017-10-08) `v0.0.20`
4455

45-
### Changed
56+
### Changed
4657

47-
* Housekeeping in preparation for `v1.0.0`
58+
- Housekeeping in preparation for `v1.0.0`
4859

4960
## (2017-10-06) `v0.0.19`
5061

5162
### Added
5263

53-
* `DatPresets` component - this allows you to set presets for your DatGUI component and switch between them easily
64+
- `DatPresets` component - this allows you to set presets for your DatGUI component and switch between them easily
5465

5566
### Changed
5667

57-
* Removed final reference to `reactcss`, this can be completely removed from dependencies now
58-
* Removed unnecessary arrow functions in some `setState` callbacks
59-
* Fixed bug where `DatNumber` input updates weren't updating sliders
68+
- Removed final reference to `reactcss`, this can be completely removed from dependencies now
69+
- Removed unnecessary arrow functions in some `setState` callbacks
70+
- Fixed bug where `DatNumber` input updates weren't updating sliders
6071

6172
## (2017-10-05) `v0.0.18`
6273

63-
### Added
74+
### Added
6475

65-
* `DatColor` component - this allows color pickers, powered by `react-color` to be rendered for mutating colors
66-
* Added `example:promote` script for pushing development code up from `example/src/dev` into `src`
76+
- `DatColor` component - this allows color pickers, powered by `react-color` to be rendered for mutating colors
77+
- Added `example:promote` script for pushing development code up from `example/src/dev` into `src`
6778

6879
### Changed
6980

70-
* Example updated with `DatColor` included
81+
- Example updated with `DatColor` included
7182

7283
## (2017-10-04) `v0.0.17`
7384

7485
### Added
7586

76-
* `DatSelect` component
87+
- `DatSelect` component
7788

7889
### Changed
7990

80-
* Example updated with `DatSelect` included
91+
- Example updated with `DatSelect` included
8192

8293
## (2017-10-03) `v0.0.16`
8394

8495
### Added
8596

86-
* Support for nested folders via `DatFolder`
97+
- Support for nested folders via `DatFolder`
8798

88-
### Changed
99+
### Changed
89100

90-
* Example `App.js` has been updated to include a nested folder example
101+
- Example `App.js` has been updated to include a nested folder example
91102

92103
## (2017-10-02) `v0.0.15`
93104

94105
### Changed
95106

96-
* SCSS is now broken up into partials which align with the various components
107+
- SCSS is now broken up into partials which align with the various components
97108

98109
### Added
99110

100-
* Added `DatFolder` component
101-
* Added this to the example
111+
- Added `DatFolder` component
112+
- Added this to the example
102113

103114
## (2017-10-02) `v0.0.14`
104115

105116
### Changed
106117

107-
* Updated component files to use `.js` file extension rather than `.jsx`
108-
* Removed `examples` directory and created single `example` directory which is now powered by `create-react-app`
109-
* Rewrote `webpack.config.js` so that it is compatible with Webpack v2
110-
* Updated a bunch of dependencies in `package.json`
111-
* Separated out `Slider` component from `DatNumber` and also added `utils` file
112-
* Switched all event handlers in components to ES7 syntax
113-
* Some code formatting
114-
* Changed `build` directory to `dist`
118+
- Updated component files to use `.js` file extension rather than `.jsx`
119+
- Removed `examples` directory and created single `example` directory which is now powered by `create-react-app`
120+
- Rewrote `webpack.config.js` so that it is compatible with Webpack v2
121+
- Updated a bunch of dependencies in `package.json`
122+
- Separated out `Slider` component from `DatNumber` and also added `utils` file
123+
- Switched all event handlers in components to ES7 syntax
124+
- Some code formatting
125+
- Changed `build` directory to `dist`
115126

116127
### Added
117128

118-
* `example` directory
119-
* `src/components/Slider.js`
120-
* `src/components/utils.js`
121-
* `src/style` directory
122-
* `.editorconfig` file
123-
* `.eslintrc.json` file
124-
* `.babelrc` file
125-
* `scripts` directory
126-
* A number of `npm` scripts to `package.json`
127-
* This change log!
129+
- `example` directory
130+
- `src/components/Slider.js`
131+
- `src/components/utils.js`
132+
- `src/style` directory
133+
- `.editorconfig` file
134+
- `.eslintrc.json` file
135+
- `.babelrc` file
136+
- `scripts` directory
137+
- A number of `npm` scripts to `package.json`
138+
- This change log!
128139

129140
### Removed
130141

131-
* The build no longer creates minified files, can add these back if required but I think it's better for the user to perform this step in their own build pipeline
132-
* ES5 examples, don't think many people are coding with React and ES5 nowadays
142+
- The build no longer creates minified files, can add these back if required but I think it's better for the user to perform this step in their own build pipeline
143+
- ES5 examples, don't think many people are coding with React and ES5 nowadays

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ Component which wraps other components to render them within an expandable/colla
165165
* `title: string` - The folder title eg., `<DatFolder title='MyAwesomeFolder' />`
166166
* `children: array` - The child components to render
167167

168+
###### optional
169+
170+
* `closed: boolean` - Whether the initial state of the folder is closed, defaults to `true`
171+
168172
#### `DatNumber`
169173

170174
A number component for updating numeric values. Will render a slider if `min`, `max` and `step` props are supplied.

build/react-dat-gui.js

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6626,8 +6626,6 @@ Object.defineProperty(exports, "__esModule", {
66266626
value: true
66276627
});
66286628

6629-
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
6630-
66316629
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
66326630

66336631
var _react = __webpack_require__(0);
@@ -6644,8 +6642,6 @@ var _classnames2 = _interopRequireDefault(_classnames);
66446642

66456643
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
66466644

6647-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
6648-
66496645
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
66506646

66516647
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
@@ -6667,7 +6663,7 @@ var DatFolder = function (_Component) {
66676663
}
66686664

66696665
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DatFolder.__proto__ || Object.getPrototypeOf(DatFolder)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
6670-
closed: true
6666+
closed: _this.props.closed
66716667
}, _this.handleClick = function () {
66726668
var closed = !_this.state.closed;
66736669

@@ -6676,24 +6672,12 @@ var DatFolder = function (_Component) {
66766672
}
66776673

66786674
_createClass(DatFolder, [{
6679-
key: 'renderChildren',
6680-
value: function renderChildren() {
6681-
// Disable this rule to take title out of the props so nested folders can have unique titles.
6682-
// eslint-disable-next-line no-unused-vars
6683-
var _props = this.props,
6684-
children = _props.children,
6685-
title = _props.title,
6686-
rest = _objectWithoutProperties(_props, ['children', 'title']);
6687-
6688-
return _react2.default.Children.map(children, function (child) {
6689-
return (0, _react.cloneElement)(child, _extends({}, rest));
6690-
});
6691-
}
6692-
}, {
66936675
key: 'render',
66946676
value: function render() {
66956677
var closed = this.state.closed;
6696-
var title = this.props.title;
6678+
var _props = this.props,
6679+
title = _props.title,
6680+
children = _props.children;
66976681

66986682

66996683
return _react2.default.createElement(
@@ -6710,7 +6694,7 @@ var DatFolder = function (_Component) {
67106694
_react2.default.createElement(
67116695
'ul',
67126696
null,
6713-
this.renderChildren()
6697+
children
67146698
)
67156699
)
67166700
);
@@ -6724,7 +6708,8 @@ DatFolder.propTypes = {
67246708
title: _propTypes2.default.string.isRequired
67256709
};
67266710
DatFolder.defaultProps = {
6727-
title: 'Folder'
6711+
title: 'Folder',
6712+
closed: true
67286713
};
67296714
exports.default = DatFolder;
67306715
module.exports = exports['default'];

build/react-dat-gui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/src/react-dat-gui/components/DatFolder.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React, { Component, cloneElement } from 'react';
1+
import React, { Component } from 'react';
22

33
import PropTypes from 'prop-types';
44
import cx from 'classnames';
55

66
export default class DatFolder extends Component {
77
state = {
8-
closed: true,
8+
closed: this.props.closed,
99
}
1010

1111
static propTypes = {
@@ -14,6 +14,7 @@ export default class DatFolder extends Component {
1414

1515
static defaultProps = {
1616
title: 'Folder',
17+
closed: true
1718
}
1819

1920
handleClick = () => {
@@ -22,17 +23,9 @@ export default class DatFolder extends Component {
2223
this.setState({ closed });
2324
}
2425

25-
renderChildren() {
26-
// Disable this rule to take title out of the props so nested folders can have unique titles.
27-
// eslint-disable-next-line no-unused-vars
28-
const { children, title, ...rest } = this.props;
29-
30-
return React.Children.map(children, child => cloneElement(child, {...rest}));
31-
}
32-
3326
render() {
3427
const { closed } = this.state;
35-
const { title } = this.props;
28+
const { title, children } = this.props;
3629

3730
return (
3831
<li className={cx('folder', { 'closed': closed })}>
@@ -41,7 +34,7 @@ export default class DatFolder extends Component {
4134
{title}
4235
</div>
4336
<ul>
44-
{this.renderChildren()}
37+
{children}
4538
</ul>
4639
</div>
4740
</li>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-dat-gui",
3-
"version": "1.0.3",
3+
"version": "2.0.0",
44
"description": "dat.GUI reimagined for React",
55
"main": "build/react-dat-gui.js",
66
"style": "build/react-dat-gui.css",

src/components/DatFolder.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React, { Component, cloneElement } from 'react';
1+
import React, { Component } from 'react';
22

33
import PropTypes from 'prop-types';
44
import cx from 'classnames';
55

66
export default class DatFolder extends Component {
77
state = {
8-
closed: true,
8+
closed: this.props.closed,
99
}
1010

1111
static propTypes = {
@@ -14,6 +14,7 @@ export default class DatFolder extends Component {
1414

1515
static defaultProps = {
1616
title: 'Folder',
17+
closed: true
1718
}
1819

1920
handleClick = () => {
@@ -22,17 +23,9 @@ export default class DatFolder extends Component {
2223
this.setState({ closed });
2324
}
2425

25-
renderChildren() {
26-
// Disable this rule to take title out of the props so nested folders can have unique titles.
27-
// eslint-disable-next-line no-unused-vars
28-
const { children, title, ...rest } = this.props;
29-
30-
return React.Children.map(children, child => cloneElement(child, {...rest}));
31-
}
32-
3326
render() {
3427
const { closed } = this.state;
35-
const { title } = this.props;
28+
const { title, children } = this.props;
3629

3730
return (
3831
<li className={cx('folder', { 'closed': closed })}>
@@ -41,7 +34,7 @@ export default class DatFolder extends Component {
4134
{title}
4235
</div>
4336
<ul>
44-
{this.renderChildren()}
37+
{children}
4538
</ul>
4639
</div>
4740
</li>

0 commit comments

Comments
 (0)