Merge pull request +15560 from c9/ide-more-forms-issues

Ide more forms issues
pull/449/head
Harutyun Amirjanyan 2017-08-14 14:02:28 +04:00 zatwierdzone przez GitHub
commit 7338d3a35f
4 zmienionych plików z 49 dodań i 46 usunięć

Wyświetl plik

@ -296,7 +296,9 @@ define(function(require, exports, module) {
path: "project/language/@unusedFunctionArgs", path: "project/language/@unusedFunctionArgs",
position: 9000 position: 9000
}, },
"Ignore Messages Matching <a href=\"http://en.wikipedia.org/wiki/Regular_expression\" target=\"blank\">Regex</a>": { "Ignore Messages Matching Regex": {
title: [null, "Ignore Messages Matching ", ["a", {
href: "http://en.wikipedia.org/wiki/Regular_expression", target: "blank"}, "Regex"]],
type: "textbox", type: "textbox",
path: "project/language/@ignoredMarkers", path: "project/language/@ignoredMarkers",
width: 300, width: 300,
@ -305,7 +307,9 @@ define(function(require, exports, module) {
}, },
"JavaScript Support": { "JavaScript Support": {
position: 1100, position: 1100,
"Customize JavaScript Warnings With <a href=\"http://eslint.org/docs/user-guide/configuring\" target=\"blank\">.eslintrc</a>": { "Customize JavaScript Warnings With .eslintrc": {
title: [null, "Customize JavaScript Warnings With ", ["a", {
href: "http://eslint.org/docs/user-guide/configuring", target: "blank"}, ".eslintrc"]],
position: 210, position: 210,
type: "checkbox", type: "checkbox",
path: "project/language/@eslintrc", path: "project/language/@eslintrc",

Wyświetl plik

@ -114,12 +114,10 @@ define(function(require, exports, module) {
var heading = headings[name]; var heading = headings[name];
if (!heading) { if (!heading) {
if (!hack) { if (!hack) {
var aml = container.appendChild(new apf.bar()); var aml = container.appendChild(new ui.bar());
aml.$int.innerHTML = '<div class="header"><span></span><div>' ui.buildDom(["div", { class: "header" },
+ apf.escapeXML((debug ["span"], ["div", (debug ? "[" + (position || "") + "] " : "") + name]
? "\[" + (position || "") + "\] " ]);
: "") + name)
+ '</div></div>';
} }
heading = headings[name] = { heading = headings[name] = {
@ -160,15 +158,20 @@ define(function(require, exports, module) {
if (options.setting && !options.path) if (options.setting && !options.path)
options.path = options.setting; options.path = options.setting;
if (debug) name = options.title || name;
name = "[" + (position || "") + "] " + name; var positionMark = debug ? "[" + (position || "") + "] " : "";
if (typeof name == "string")
name = positionMark + name + ":";
else
name = [null, positionMark, name, ":"];
var ignoreChange = false; var ignoreChange = false;
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 });
@ -189,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)
@ -203,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,
@ -221,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
@ -242,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,
@ -276,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",
@ -293,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,
@ -306,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
@ -320,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,
@ -368,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,
@ -387,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,

Wyświetl plik

@ -584,7 +584,7 @@ apf.browserDetect();
apf.buildDom = function buildDom(arr, parent) { apf.buildDom = function buildDom(arr, parent) {
if (typeof arr == "string") { if (typeof arr == "string" && arr) {
var txt = document.createTextNode(arr); var txt = document.createTextNode(arr);
if (parent) if (parent)
parent.appendChild(txt); parent.appendChild(txt);
@ -593,20 +593,20 @@ apf.buildDom = function buildDom(arr, parent) {
if (!Array.isArray(arr)) if (!Array.isArray(arr))
return arr; return arr;
if (typeof arr[0] == "object") { if (typeof arr[0] != "string" || !arr[0]) {
var els = []; var els = [];
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var ch = buildDom(arr[i]); var ch = buildDom(arr[i], parent);
els.push(ch); ch && els.push(ch);
if (parent)
parent.appendChild(ch);
} }
return els; return els;
} }
var el = document.createElement(arr[0]); var el = document.createElement(arr[0]);
var options = arr[1]; var options = arr[1];
if (options) { var childIndex = 1;
if (options && typeof options == "object" && !Array.isArray(options)) {
childIndex = 2;
Object.keys(options).forEach(function(n) { Object.keys(options).forEach(function(n) {
var val = options[n]; var val = options[n];
if (n == "class") { if (n == "class") {
@ -618,7 +618,7 @@ apf.buildDom = function buildDom(arr, parent) {
el.setAttribute(n, val); el.setAttribute(n, val);
}); });
} }
for (var i = 2; i < arr.length; i++) for (var i = childIndex; i < arr.length; i++)
buildDom(arr[i], el); buildDom(arr[i], el);
if (parent) if (parent)
parent.appendChild(el); parent.appendChild(el);
@ -13049,7 +13049,10 @@ apf.checkbox = function(struct, tagName) {
this.checked = apf.isTrue(value); this.checked = apf.isTrue(value);
} }
this.updateClass(); if (this.checked)
apf.setStyleClass(this.$ext, this.$baseCSSname + "Checked");
else
apf.setStyleClass(this.$ext, "", [this.$baseCSSname + "Checked"]);
}; };
/** /**
@ -13188,15 +13191,7 @@ apf.checkbox = function(struct, tagName) {
this.$notfromext = this.$input && this.$input != this.$ext; this.$notfromext = this.$input && this.$input != this.$ext;
this.$setupEvents(); this.$setupEvents();
this.updateClass();
}; };
this.updateClass = function() {
if (this.checked)
apf.setStyleClass(this.$ext, this.$baseCSSname + "Checked");
else
apf.setStyleClass(this.$ext, "", [this.$baseCSSname + "Checked"]);
}
this.$childProperty = "label"; this.$childProperty = "label";

Wyświetl plik

@ -81,18 +81,19 @@ define(function(require, module, exports) {
} }
} }
oldHandler.call(_self, func(value)); if (isDynProp) {
oldHandler.call(_self, func(value));
settings.on(value, listen);
this.once("DOMNodeRemovedFromDocument", function() {
settings.off(value, listen);
});
}
function listen() { function listen() {
var v = func(value); var v = func(value);
if (_self[prop] != v) if (_self[prop] != v)
oldHandler.call(_self, v); oldHandler.call(_self, v);
} }
settings.on(value, listen);
this.once("DOMNodeRemovedFromDocument", function() {
settings.off(value, listen);
});
}; };
} }
wrap(apf.item.prototype, "checked", false); wrap(apf.item.prototype, "checked", false);