mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Make Component#enabled work for row type.
This commit is contained in:
parent
f4c4522c18
commit
e1fba03b34
2 changed files with 17 additions and 6 deletions
|
@ -98,6 +98,8 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
|||
this._row = row;
|
||||
this._parent = parent; // The parent component, if any.
|
||||
this._nested = !!parent;
|
||||
if (!parent)
|
||||
DomElement.set(row, 'id', 'palettejs-row-' + name);
|
||||
var type = this._type = props.type in this._types
|
||||
? props.type
|
||||
: 'options' in props
|
||||
|
@ -260,7 +262,13 @@ var Component = Base.extend(Callback, /** @lends Component# */{
|
|||
this._previousEnabled = enabled ? undefined : prev; // clear
|
||||
enabled = enabled && prev;
|
||||
}
|
||||
DomElement.set(this._input, 'disabled', !enabled);
|
||||
if (this._input) {
|
||||
DomElement.set(this._input, 'disabled', !enabled);
|
||||
} else if (this._components) {
|
||||
for (var i = 0; i < this._components.length; i++) {
|
||||
this._components[i].setEnabled(enabled, _fromPalette);
|
||||
}
|
||||
}
|
||||
this._enabled = !!enabled;
|
||||
},
|
||||
|
||||
|
|
|
@ -39,11 +39,14 @@ var Pane = Base.extend(Callback, /** @lends Pane# */{
|
|||
this._values = values;
|
||||
this._numCells = 2; // 2 cells per row is the default (label / item).
|
||||
for (var name in components) {
|
||||
var row = DomElement.create('tr', { class: 'palettejs-row' }),
|
||||
component = new Component(this, name, components[name],
|
||||
values[name], row);
|
||||
DomElement.set(row, 'id', 'palettejs-row-' + component._name);
|
||||
this._table.appendChild(row);
|
||||
var component = components[name];
|
||||
if (Base.isPlainObject(component)) {
|
||||
var row = DomElement.addChildren(this._table,
|
||||
['tr', { class: 'palettejs-row' }])[0];
|
||||
new Component(this, name, components[name], values[name], row);
|
||||
} else {
|
||||
delete components[name];
|
||||
}
|
||||
}
|
||||
if (this._numCells > 2) {
|
||||
// Update colspan in all components that are not nested in another
|
||||
|
|
Loading…
Reference in a new issue