kopia lustrzana https://github.com/c9/core
fix checked-spinner element in forms
rodzic
137984726c
commit
a54c7978bb
|
@ -169,8 +169,9 @@ define(function(require, exports, module) {
|
||||||
function onAfterChange(e) {
|
function onAfterChange(e) {
|
||||||
if (ignoreChange)
|
if (ignoreChange)
|
||||||
return;
|
return;
|
||||||
if (options.path)
|
var path = e.currentTarget && e.currentTarget.getAttribute("settingPath") || options.path;
|
||||||
settings.set(options.path, e.value);
|
if (path)
|
||||||
|
settings.set(path, e.value);
|
||||||
|
|
||||||
if (options.onchange)
|
if (options.onchange)
|
||||||
options.onchange({ value: e.value, type: e.currentTarget.tagName });
|
options.onchange({ value: e.value, type: e.currentTarget.tagName });
|
||||||
|
@ -191,7 +192,7 @@ define(function(require, exports, module) {
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
case "checkbox":
|
case "checkbox":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.checkbox({
|
main = new ui.checkbox({
|
||||||
value: options.path
|
value: options.path
|
||||||
? settings.get(options.path)
|
? settings.get(options.path)
|
||||||
|
@ -205,7 +206,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "dropdown":
|
case "dropdown":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.dropdown({
|
main = new ui.dropdown({
|
||||||
items: options.items,
|
items: options.items,
|
||||||
width: options.width || widths.dropdown,
|
width: options.width || widths.dropdown,
|
||||||
|
@ -223,7 +224,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "spinner":
|
case "spinner":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.spinner({
|
main = new ui.spinner({
|
||||||
width: options.width || widths.spinner,
|
width: options.width || widths.spinner,
|
||||||
value: options.path
|
value: options.path
|
||||||
|
@ -244,7 +245,7 @@ define(function(require, exports, module) {
|
||||||
? settings.get(options.checkboxPath)
|
? settings.get(options.checkboxPath)
|
||||||
: (options.defaultCheckboxValue || ""),
|
: (options.defaultCheckboxValue || ""),
|
||||||
width: width, maxwidth: maxwidth,
|
width: width, maxwidth: maxwidth,
|
||||||
label: name + ":",
|
label: name,
|
||||||
skin: "checkbox_black",
|
skin: "checkbox_black",
|
||||||
onafterchange: onAfterChange,
|
onafterchange: onAfterChange,
|
||||||
settingPath: options.checkboxPath,
|
settingPath: options.checkboxPath,
|
||||||
|
@ -278,7 +279,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "textbox":
|
case "textbox":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.textbox({
|
main = new ui.textbox({
|
||||||
skin: skins.textbox || "searchbox",
|
skin: skins.textbox || "searchbox",
|
||||||
margin: "-3 0 0 0",
|
margin: "-3 0 0 0",
|
||||||
|
@ -295,7 +296,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "password":
|
case "password":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.password({
|
main = new ui.password({
|
||||||
skin: skins.password || "forminput",
|
skin: skins.password || "forminput",
|
||||||
width: options.width || widths.password,
|
width: options.width || widths.password,
|
||||||
|
@ -308,7 +309,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "colorbox":
|
case "colorbox":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.colorbox({
|
main = new ui.colorbox({
|
||||||
width: options.width || widths.colorbox,
|
width: options.width || widths.colorbox,
|
||||||
value: options.path
|
value: options.path
|
||||||
|
@ -322,7 +323,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "button":
|
case "button":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
new ui.button({
|
new ui.button({
|
||||||
skin: "blackbutton",
|
skin: "blackbutton",
|
||||||
height: 24,
|
height: 24,
|
||||||
|
@ -370,7 +371,7 @@ define(function(require, exports, module) {
|
||||||
break;
|
break;
|
||||||
case "textarea":
|
case "textarea":
|
||||||
childNodes = [
|
childNodes = [
|
||||||
new ui.label({ width: width, maxwidth: maxwidth, caption: name + ":" }),
|
new ui.label({ width: width, maxwidth: maxwidth, caption: name }),
|
||||||
main = new ui.textarea({
|
main = new ui.textarea({
|
||||||
width: options.width || widths.textarea,
|
width: options.width || widths.textarea,
|
||||||
height: options.height || 200,
|
height: options.height || 200,
|
||||||
|
@ -389,7 +390,7 @@ define(function(require, exports, module) {
|
||||||
edge: options.edge || edge,
|
edge: options.edge || edge,
|
||||||
type: options.type,
|
type: options.type,
|
||||||
childNodes: [
|
childNodes: [
|
||||||
new ui.label({ height: 40, caption: name + ":" }),
|
new ui.label({ height: 40, caption: name }),
|
||||||
main = new ui.textarea({
|
main = new ui.textarea({
|
||||||
width: options.width || widths.textarea,
|
width: options.width || widths.textarea,
|
||||||
height: options.height || 200,
|
height: options.height || 200,
|
||||||
|
|
|
@ -81,18 +81,19 @@ define(function(require, module, exports) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isDynProp) {
|
||||||
oldHandler.call(_self, func(value));
|
oldHandler.call(_self, func(value));
|
||||||
|
|
||||||
function listen() {
|
|
||||||
var v = func(value);
|
|
||||||
if (_self[prop] != v)
|
|
||||||
oldHandler.call(_self, v);
|
|
||||||
}
|
|
||||||
settings.on(value, listen);
|
settings.on(value, listen);
|
||||||
|
|
||||||
this.once("DOMNodeRemovedFromDocument", function() {
|
this.once("DOMNodeRemovedFromDocument", function() {
|
||||||
settings.off(value, listen);
|
settings.off(value, listen);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
function listen() {
|
||||||
|
var v = func(value);
|
||||||
|
if (_self[prop] != v)
|
||||||
|
oldHandler.call(_self, v);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
wrap(apf.item.prototype, "checked", false);
|
wrap(apf.item.prototype, "checked", false);
|
||||||
|
|
Ładowanie…
Reference in New Issue