提交 b9fadc7e 编写于 作者: U unknown

单选和复选按钮增加每行选项数配置

上级 c9829920
......@@ -20,6 +20,14 @@
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.options}}:</td>
<td class="editTableValue">
......
......@@ -20,6 +20,14 @@
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.options}}:</td>
<td class="editTableValue">
......
......@@ -19,6 +19,14 @@
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.options}}:</td>
......
......@@ -5,6 +5,7 @@
"description": "",
"itemType": "values",
"itemValues": [],
"countPerline": "0",
"compute": "create", //create, show, save
"section": "no",
"sectionBy": "person",
......
......@@ -19,6 +19,14 @@
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.options}}:</td>
......
......@@ -5,6 +5,7 @@
"description": "",
"itemType": "values",
"itemValues": [],
"countPerline": "0",
"itemScript": {
"code": "",
"html": ""
......
......@@ -20,11 +20,19 @@
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<!-- <tr>-->
<!-- <td class="editTableTitle">{{$.lp.newline}}:</td>-->
<!-- <td class="editTableValue">-->
<!-- <input type="radio" name="newline" value="true" text{($.newline)?'checked':''}/>{{$.lp.yes}}-->
<!-- <input type="radio" name="newline" value="false" text{(!$.newline)?'checked':''}/>{{$.lp.no}}-->
<!-- </td>-->
<!-- </tr>-->
<tr>
<td class="editTableTitle">{{$.lp.newline}}:</td>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="radio" name="newline" value="true" text{($.newline)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="newline" value="false" text{(!$.newline)?'checked':''}/>{{$.lp.no}}
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
......
......@@ -5,6 +5,7 @@
"description": "",
"itemType": "values",
"itemValues": [],
"countPerline": "0",
"compute": "create", //create, show, save
"section": "no",
"sectionBy": "person",
......
......@@ -19,6 +19,14 @@
<input type="radio" name="isReadonly" value="true" text{($.isReadonly)?'checked':''}/>{{$.lp.yes}}
<input type="radio" name="isReadonly" value="false" text{(!$.isReadonly)?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.countPerline}}:</td>
<td class="editTableValue">
<input type="text" name="countPerline" value="text{$.countPerline}" class="editTableInput" onkeyup="this.value=this.value.replace(/[^\d]/g,'')"/>
<div style="color:#999999; padding:5px;">{{$.lp.countPerlineNote}}</div>
</td>
</td>
</tr>
<tr>
<td class="editTableTitle">{{$.lp.options}}:</td>
......
......@@ -5,6 +5,7 @@
"description": "",
"itemType": "values",
"itemValues": [],
"countPerline": "0",
"itemScript": {
"code": "",
"html": ""
......
......@@ -1254,7 +1254,8 @@ MWF.xApplication.process.FormDesigner.LP = {
"menuItem": "Menu Item",
"dropdownDefaultText": "Dropdown Menu",
"showButton": "Show Button",
"newline": "one line per option",
"countPerline": "Options per line",
"countPerlineNote": "0 means no limit",
"wps" : {
"config":"Config",
......
......@@ -1260,7 +1260,8 @@ MWF.xApplication.process.FormDesigner.LP = {
"menuItem": "菜单项",
"dropdownDefaultText": "下拉菜单",
"showButton": "显示按钮",
"newline": "每个选项一行",
"countPerline": "每行选项数",
"countPerlineNote": "0表示不限制",
"wps" : {
"config":"配置",
......
......@@ -45,7 +45,34 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox = new Class(
texts.push(t);
}
});
this.node.set("text", texts.join(", "));
if( !this.isNumber(this.json.countPerline) ) {
if( this.json.newline ){
texts.each(function(t){
new Element("div", { "text": t }).inject(this.node)
}.bind(this))
}else{
this.node.set("text", texts.join(", "));
}
}else{
var div;
var countPerLine = this.json.countPerline.toInt();
if( countPerLine === 0 ){
div = new Element("div").inject( this.node );
div.set("text", texts.join(", "));
}else{
var textsPerLine = [];
texts.each(function(t, i){
if( i % countPerLine === 0){ //如果需要换行了
if( div && textsPerLine.length )div.set("text", textsPerLine.join(",") +",");
textsPerLine = [];
div = new Element("div").inject( this.node );
}
textsPerLine.push( t );
}.bind(this));
if( div && textsPerLine.length )div.set("text", textsPerLine.join(","));
}
}
}
},
_resetNodeEdit: function(){
......@@ -154,23 +181,34 @@ MWF.xApplication.process.Xform.Checkbox = MWF.APPCheckbox = new Class(
var optionItems = this.getOptions();
this._setOptions(optionItems);
},
isNumber : function( d ){
return parseInt(d).toString() !== "NaN"
},
_setOptions: function(optionItems){
var p = o2.promiseAll(optionItems).then(function(radioValues){
this.moduleSelectAG = null;
if (!radioValues) radioValues = [];
var node;
if (o2.typeOf(radioValues)==="array"){
var flag = (new MWF.widget.UUID).toString();
radioValues.each(function(item){
radioValues.each(function(item, i){
var tmps = item.split("|");
var text = tmps[0];
var value = tmps[1] || text;
var node;
if( this.json.newline ){
node = new Element("div").inject(this.node);
if( !this.isNumber(this.json.countPerline) ) {
if( this.json.newline ){
node = new Element("div").inject(this.node);
}else{
node = this.node;
}
}else{
node = this.node;
var countPerLine = this.json.countPerline.toInt();
if( countPerLine === 0 && i===0 ){
node = new Element("div").inject(this.node);
}else if( i % countPerLine === 0){
node = new Element("div").inject(this.node);
}
}
var radio = new Element("input", {
......
......@@ -171,32 +171,52 @@ MWF.xApplication.process.Xform.Radio = MWF.APPRadio = new Class(
var optionItems = this.getOptions();
this._setOptions(optionItems);
},
isNumber : function( d ){
return parseInt(d).toString() !== "NaN"
},
_setOptions: function(optionItems){
var p = o2.promiseAll(optionItems).then(function(radioValues){
this.moduleSelectAG = null;
if (!radioValues) radioValues = [];
var node;
if (o2.typeOf(radioValues)==="array"){
var flag = (new MWF.widget.UUID).toString();
radioValues.each(function(item){
radioValues.each(function(item, i){
var tmps = item.split("|");
var text = tmps[0];
var value = tmps[1] || text;
if( !this.isNumber(this.json.countPerline) ) {
if( this.json.newline ){
node = new Element("div").inject(this.node);
}else{
node = this.node;
}
}else{
var countPerLine = this.json.countPerline.toInt();
if( countPerLine === 0 && i===0 ){
node = new Element("div").inject(this.node);
}else if( i % countPerLine === 0){
node = new Element("div").inject(this.node);
}
}
var radio = new Element("input", {
"type": "radio",
"name": (this.json.properties && this.json.properties.name) ? this.json.properties.name : flag+this.json.id,
"value": value,
"showText": text,
"styles": this.json.buttonStyles
}).inject(this.node);
}).inject(node);
//radio.appendText(text, "after");
var textNode = new Element( "span", {
"text" : text,
"styles" : { "cursor" : "default" }
}).inject(this.node);
}).inject(node);
textNode.addEvent("click", function( ev ){
if( this.radio.get("disabled") === true || this.radio.get("disabled") === "true" )return;
this.radio.checked = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册