json-vision
Advanced tools
Comparing version 0.0.36 to 0.1.0
@@ -18,4 +18,2 @@ 'use strict'; | ||
var React = require('react'); | ||
var clone = require('lodash/lang/clone'); | ||
var assign = require('lodash/object/assign'); | ||
var Matterkit = require('react-matterkit'); | ||
@@ -64,5 +62,7 @@ var ItemGroup = Matterkit.ItemGroup; | ||
button = React.createElement(Button, _extends({}, btn, { | ||
mod: _extends({ kind: 'stamp' }, btn.mod), | ||
onClick: function () { | ||
return _this2.handleButtonClick(btn); | ||
} })); | ||
} | ||
})); | ||
} | ||
@@ -69,0 +69,0 @@ |
@@ -24,3 +24,3 @@ 'use strict'; | ||
value: function nthKey(n) { | ||
return this._getAt(n * 2); | ||
return this._getAt(2 + n * 2); | ||
} | ||
@@ -30,3 +30,3 @@ }, { | ||
value: function nthParent(n) { | ||
return this._getAt(1 + n * 2); | ||
return this._getAt(3 + n * 2); | ||
} | ||
@@ -33,0 +33,0 @@ }, { |
@@ -47,2 +47,3 @@ 'use strict'; | ||
children: (0, _settingsModel.primitive)(), | ||
mutateValue: (0, _settingsModel.primitive)(), //boolean | ||
includeInheriteds: (0, _settingsModel.primitive)(), //boolean | ||
@@ -49,0 +50,0 @@ highlighted: (0, _settingsModel.primitive)(), |
@@ -47,2 +47,4 @@ 'use strict'; | ||
match = path.length === 2; | ||
} else { | ||
throw Error('[json-vision] unknown select command: ' + selector); | ||
} | ||
@@ -49,0 +51,0 @@ } else if (selectorType === 'instanceOf') { |
@@ -57,11 +57,14 @@ 'use strict'; | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
parentLeaf.settings.children[connect.key] = value; | ||
} else { | ||
connect.parent[connect.key] = value; | ||
if (settings.mutateValue) { | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
parentLeaf.settings.children[connect.key] = value; | ||
} else { | ||
connect.parent[connect.key] = value; | ||
} | ||
root.reportChange(); | ||
} | ||
root.reportChange(); | ||
_this._callOnChangeHandler(); | ||
_this._callOnChangeHandler(value); | ||
}; | ||
@@ -75,11 +78,12 @@ | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
delete parentLeaf.settings.children[connect.key]; | ||
} else { | ||
delete connect.parent[connect.key]; | ||
if (settings.mutateValue) { | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
delete parentLeaf.settings.children[connect.key]; | ||
} else { | ||
delete connect.parent[connect.key]; | ||
} | ||
root.reportChange(); | ||
} | ||
root.reportChange(); | ||
_this._callOnChangeHandler(); | ||
}; | ||
@@ -86,0 +90,0 @@ |
{ | ||
"name": "json-vision", | ||
"version": "0.0.36", | ||
"version": "0.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
var React = require('react') | ||
var clone = require('lodash/lang/clone') | ||
var assign = require('lodash/object/assign') | ||
var Matterkit = require('react-matterkit') | ||
@@ -30,3 +28,5 @@ var {ItemGroup, Button} = Matterkit | ||
{...btn} | ||
onClick={() => this.handleButtonClick(btn)}/> | ||
mod = {{kind: 'stamp', ...btn.mod}} | ||
onClick = {() => this.handleButtonClick(btn)} | ||
/> | ||
} | ||
@@ -33,0 +33,0 @@ |
@@ -25,7 +25,7 @@ export default class Connect { | ||
nthKey(n) { | ||
return this._getAt(n * 2) | ||
return this._getAt(2 + n * 2) | ||
} | ||
nthParent(n) { | ||
return this._getAt(1 + n * 2) | ||
return this._getAt(3 + n * 2) | ||
} | ||
@@ -32,0 +32,0 @@ |
@@ -40,2 +40,3 @@ import {memorize, primitive, object, objectOf, arrayOf, func} | ||
children: primitive(), | ||
mutateValue: primitive(),//boolean | ||
includeInheriteds: primitive(),//boolean | ||
@@ -42,0 +43,0 @@ highlighted: primitive(), |
@@ -71,2 +71,5 @@ var includes = require('lodash/collection/includes') | ||
} | ||
else { | ||
throw Error(`[json-vision] unknown select command: ${selector}`) | ||
} | ||
} | ||
@@ -73,0 +76,0 @@ else if (selectorType === 'instanceOf') { |
@@ -103,12 +103,15 @@ import keysIn from 'lodash/object/keysIn' | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
parentLeaf.settings.children[connect.key] = value | ||
if (settings.mutateValue) { | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
parentLeaf.settings.children[connect.key] = value | ||
} | ||
else { | ||
connect.parent[connect.key] = value | ||
} | ||
root.reportChange() | ||
} | ||
else { | ||
connect.parent[connect.key] = value | ||
} | ||
root.reportChange() | ||
this._callOnChangeHandler() | ||
this._callOnChangeHandler(value) | ||
} | ||
@@ -119,12 +122,13 @@ | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
delete parentLeaf.settings.children[connect.key] | ||
if (settings.mutateValue) { | ||
if (parentLeaf && parentLeaf.settings.children) { | ||
//if the children of the parentLeaf set by the settings modify there | ||
delete parentLeaf.settings.children[connect.key] | ||
} | ||
else { | ||
delete connect.parent[connect.key] | ||
} | ||
root.reportChange() | ||
} | ||
else { | ||
delete connect.parent[connect.key] | ||
} | ||
root.reportChange() | ||
this._callOnChangeHandler() | ||
} | ||
@@ -131,0 +135,0 @@ |
106748
2872