Skip to content

Commit 7d16e88

Browse files
author
Worth Lutz
committed
fix lint errors
1 parent a658267 commit 7d16e88

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

examples/src/js/PropsDemoExample.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ const initialParams = [
286286

287287
class PropsDemoExample extends React.Component {
288288
state = {
289+
clicked: {
290+
value: 'nothing yet',
291+
},
289292
nodes: initialNodes,
290293
checkboxParams: initialParams,
291294
};
@@ -295,7 +298,8 @@ class PropsDemoExample extends React.Component {
295298
}
296299

297300
onClick = (clicked) => {
298-
console.log(`clicked = ${clicked.value}`);
301+
// console.log(`clicked = ${clicked.value}`);
302+
this.setState({ clicked });
299303
}
300304

301305
onExpand = (node, nodes) => {
@@ -306,10 +310,6 @@ class PropsDemoExample extends React.Component {
306310
this.setState({ checkboxParams: params });
307311
}
308312

309-
onUpdate = (checkedArray) => {
310-
this.setState({ checked: checkedArray });
311-
}
312-
313313
getParams = () => {
314314
const { checkboxParams } = this.state;
315315
const params = {};
@@ -349,6 +349,7 @@ class PropsDemoExample extends React.Component {
349349
render() {
350350
const {
351351
checkboxParams,
352+
clicked,
352353
nodes,
353354
} = this.state;
354355

@@ -367,8 +368,8 @@ class PropsDemoExample extends React.Component {
367368
clickHandler = this.onClick;
368369
}
369370

370-
console.log(params);
371-
console.log('------------------------------------------------');
371+
// console.log(params);
372+
// console.log('------------------------------------------------');
372373

373374
return (
374375
<div style={{ display: 'flex' }}>
@@ -382,6 +383,12 @@ class PropsDemoExample extends React.Component {
382383
onExpand={this.onExpand}
383384
/>
384385
</div>
386+
<div style={style3}>
387+
<p>
388+
Clicked:
389+
{clicked.value}
390+
</p>
391+
</div>
385392
<div style={style3}>
386393
<p>
387394
CheckboxTree props

src/js/CheckboxTree.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CheckboxTree extends React.Component {
2424
expandOnClick: PropTypes.bool,
2525
icons: iconsShape,
2626
iconsClass: PropTypes.string,
27-
id: PropTypes.string,
27+
// id: PropTypes.string,
2828
lang: languageShape,
2929
name: PropTypes.string,
3030
nameAsArray: PropTypes.bool,
@@ -60,7 +60,7 @@ class CheckboxTree extends React.Component {
6060
radioOn: <span className="rct-icon rct-icon-radio-on" />,
6161
},
6262
iconsClass: 'fa4',
63-
id: null,
63+
// id: null,
6464
lang: {
6565
collapseAll: 'Collapse all',
6666
expandAll: 'Expand all',
@@ -248,6 +248,7 @@ class CheckboxTree extends React.Component {
248248
const isRadioGroup = !!node.radioGroup;
249249
const isRadioNode = !!parent.radioGroup;
250250

251+
/*
251252
//---------------------------------------------------------------
252253
// this checks for multiple checked === true nodes in a RadioGroup
253254
// This fixes the problem by mutating the prop!
@@ -263,6 +264,7 @@ class CheckboxTree extends React.Component {
263264
}
264265
}
265266
//---------------------------------------------------------------
267+
*/
266268

267269
// determine if node needs to be disabled
268270
let nodeDisabled = disabled || node.disabled || forceDisabled;

src/js/NativeCheckbox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class NativeCheckbox extends React.PureComponent {
99

1010
static defaultProps = {
1111
indeterminate: false,
12+
isRadioNode: false,
1213
};
1314

1415
componentDidMount() {
@@ -29,7 +30,7 @@ class NativeCheckbox extends React.PureComponent {
2930
const props = { ...this.props };
3031

3132
const { isRadioNode } = props;
32-
const type = isRadioNode ? "radio" : "checkbox";
33+
const type = isRadioNode ? 'radio' : 'checkbox';
3334

3435
// Remove property that does not exist in HTML
3536
delete props.indeterminate;

src/js/TreeNode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ class TreeNode extends React.Component {
125125
}
126126

127127
if (!noCascade && (node.children && node.children.length > 0) && !isRadioGroup) {
128-
const newChildren = node.children.map(child => this.toggleChecked(child, newCheckState));
128+
const newChildren =
129+
node.children.map(child => this.toggleChecked(child, newCheckState));
129130
return { ...node, children: newChildren };
130131
}
131132
return { ...node, checked: newCheckState };

0 commit comments

Comments
 (0)