Make checks based on state, not conf.value

This commit is contained in:
Ilya Ig. Petrov 2017-05-28 19:05:27 +05:00
parent 88792658aa
commit 32d8e93ddf
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,6 @@ export default function getInfoLi() {
.infoRow { .infoRow {
position: relative; position: relative;
flex-wrap: wrap;
} }
.infoRow > input[type="checkbox"] { .infoRow > input[type="checkbox"] {
position: relative; position: relative;
@ -119,7 +118,7 @@ export default function getInfoLi() {
const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key ); const iddy = props.idPrefix + ( props.ifDashify ? camelToDash(props.conf.key) : props.conf.key );
return ( return (
<li class={scopedCss.infoRow + ' horFlex'}> <li class={scopedCss.infoRow + ' horFlex'} style={ props.children && 'flex-wrap: wrap'}>
<input <input
type={props.type} type={props.type}
name={props.name} name={props.name}

View File

@ -69,6 +69,7 @@ export default function getMain(theState) {
handleModChange({targetConf, targetIndex, newValue}) { handleModChange({targetConf, targetIndex, newValue}) {
console.log('NEW VALUE', newValue);
const oldCats = this.state.catToOrderedMods; const oldCats = this.state.catToOrderedMods;
const newCats = Object.keys(this.state.catToOrderedMods).reduce((acc, cat) => { const newCats = Object.keys(this.state.catToOrderedMods).reduce((acc, cat) => {

View File

@ -20,10 +20,10 @@ export default function getModList(theState) {
handleCheck(confMeta, ifChecked) { handleCheck(confMeta, ifChecked) {
this.state.checks[confMeta.index] = ifChecked;
if (ifChecked === false || !confMeta.ifChild) { if (ifChecked === false || !confMeta.ifChild) {
this.handleNewValue(confMeta, ifChecked); this.handleNewValue(confMeta, ifChecked);
} else { } else {
console.log('SET STATE', confMeta.index);
this.setState({ this.setState({
checks: this.state.checks.map( checks: this.state.checks.map(
(ch, i) => i === confMeta.index ? ifChecked : ch (ch, i) => i === confMeta.index ? ifChecked : ch
@ -63,7 +63,7 @@ export default function getModList(theState) {
conf={conf} conf={conf}
type='checkbox' type='checkbox'
name={props.name} name={props.name}
checked={conf.value} checked={this.state.checks[index]}
key={index} key={index}
onChange={(event) => this.handleCheck(confMeta, event.target.checked)} onChange={(event) => this.handleCheck(confMeta, event.target.checked)}
> >

View File

@ -96,7 +96,7 @@ export default function getProxyEditor(theState) {
font-weight: 900; font-weight: 900;
} }
table.editor .export { table.editor .export {
padding-right: 2px; /*padding-right: 2px;*/
} }
/* LAST COLUMN: BUTTONS */ /* LAST COLUMN: BUTTONS */