提交 6a635869 编写于 作者: 蔡祥熠

Merge branch 'fix/opinion' into 'wrdp'

Merge of fix/opinion 修复表单输入组件隐藏图标后仍占位置的问题,意见框加上常用意见 to wrdp

See merge request o2oa/o2oa!6177
......@@ -411,7 +411,7 @@
"org": {
"styles": {
"border-bottom": "1px solid #ccc",
"border-bottom": "0px solid #ccc",
"border-top": "0px",
"border-left": "0px",
"border-right": "0px",
......@@ -426,7 +426,7 @@
},
"reader": {
"styles": {
"border-bottom": "1px solid #ccc",
"border-bottom": "0px solid #ccc",
"border-top": "0px",
"border-left": "0px",
"border-right": "0px",
......@@ -441,7 +441,7 @@
},
"author": {
"styles": {
"border-bottom": "1px solid #ccc",
"border-bottom": "0px solid #ccc",
"border-top": "0px",
"border-left": "0px",
"border-right": "0px",
......
......@@ -620,5 +620,28 @@
"color": "#ffffff",
"font-size": "16px",
"cursor": "pointer"
},
"selectIdeaNode": {
"height": "129px",
"width": "145px",
"float": "right",
"background-color": "#FFF",
"overflow": "hidden"
},
"selectIdeaScrollNode": {
"height": "129px",
"margin-right": "6px",
"overflow": "hidden"
},
"selectIdeaItemNode": {
"height": "20px",
"line-height": "20px",
"font-size": "12px",
"cursor": "pointer",
"background-color": "#FFF",
"overflow": "hidden"
},
"selectIdeaItemNode_over": {
"background-color": "#e6ecf8"
}
}
\ No newline at end of file
......@@ -270,6 +270,7 @@ MWF.xApplication.cms.Xform.Attachment = MWF.CMSAttachment = new Class({
return false;
}
}
this.fireEvent("beforeUpload", [files]);
return true;
}.bind(this), true, accept, size, function (o) { //错误的回调
if (o.messageId && this.attachmentController.messageItemList) {
......
......@@ -122,6 +122,9 @@ MWF.xApplication.process.FormDesigner.Module.$Input = MWF.FC$Input = new Class({
this.node.getLast().set("text", this.json.id);
}
},
hasIcon: function(){
return this.json.showIcon!='no' && (!this.form.json || !this.form.json.hideModuleIcon);
},
_preprocessingModuleData: function(){
debugger;
this.node.clearStyles();
......@@ -138,9 +141,9 @@ MWF.xApplication.process.FormDesigner.Module.$Input = MWF.FC$Input = new Class({
}
}).inject(this.node);
this.node.setStyles({
"overflow": "hidden",
"overflow": this.hasIcon() ? "hidden" : "visible",
"position": "relative",
"margin-right": "20px",
"margin-right": this.hasIcon() ? "20px" : "0px",
"padding-right": "4px"
});
......
......@@ -54,6 +54,13 @@
<input type="radio" name="isHandwritingPreview" value="no" text{($.isHandwritingPreview=='no')?'checked':''}/>{{$.lp.no}}
</td>
</tr>
<!-- <tr>-->
<!-- <td class="editTableTitle">{{$.lp.commonIdea}}:</td>-->
<!-- <td class="editTableValue">-->
<!-- <input type="radio" name="isSelectIdea" value="yes" text{($.isSelectIdea=='yes')?'checked':''}/>{{$.lp.yes}}-->
<!-- <input type="radio" name="isSelectIdea" value="no" text{($.isSelectIdea!='yes')?'checked':''}/>{{$.lp.no}}-->
<!-- </td>-->
<!-- </tr>-->
</table>
<div class="MWFMaplist" name="styles" title="{{$.lp.style}}"></div>
......
......@@ -24,9 +24,9 @@ MWF.xApplication.process.FormDesigner.Module.Personfield = MWF.FCPersonfield = n
}
}).inject(this.node);
this.node.setStyles({
"overflow": "hidden",
"overflow": this.hasIcon() ? "hidden" : "visible",
"position": "relative",
"margin-right": "20px",
"margin-right": this.hasIcon() ? "20px" : "0px",
"min-height": "24px"
});
......
......@@ -544,6 +544,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"height": "Height",
"recording": "Record",
"writingPreview": "Writing Preview",
"commonIdea": "Common opinions",
"addressStyle": "Address Style",
......
......@@ -544,6 +544,7 @@ MWF.xApplication.process.FormDesigner.LP = {
"height": "高度",
"recording": "录音",
"writingPreview": "手写预览",
"commonIdea": "常用意见",
"addressStyle": "Address样式",
......
......@@ -655,6 +655,33 @@
"cursor": "pointer",
"background": "url("+"../x_component_process_Work/$Processor/default/audioRecord.png) no-repeat 5px center"
},
"selectIdeaNode": {
"height": "130px",
"width": "210px",
"float": "right",
"background-color": "#FFF",
"overflow": "hidden",
"border-top" : "1px solid #ccc",
"border-right" : "1px solid #ccc"
},
"selectIdeaScrollNode": {
"height": "130px",
"margin-right": "6px",
"overflow": "hidden"
},
"selectIdeaItemNode": {
"line-height": "18px",
"font-size": "14px",
"cursor": "pointer",
"background-color": "#FFF",
"margin-top": "2px",
"padding": "2px 2px 2px 12px",
"background": "url("+"../x_component_process_Work/$Processor/process/point.png) no-repeat 3px center",
"overflow": "hidden"
},
"selectIdeaItemNode_over": {
"background-color": "#e6ecf8"
},
"modelNode": {
"border-radius": "3px",
......
......@@ -89,7 +89,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
if (this.json.description){
var size = this.node.getFirst().getSize();
var w = size.x-3;
if( this.json.showIcon!='no' && !this.form.json.hideModuleIcon ){
if( this.hasIcon() ){
if (COMMON.Browser.safari) w = w-20;
}
......@@ -142,10 +142,16 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
"readonly": true
});
var overflow;
if(this.json.styles && this.json.styles.overflow){
overflow = this.json.styles.overflow;
}else{
overflow = this.hasIcon() ? "hidden" : "visible";
}
var node = new Element("div", {"styles": {
"overflow": "hidden",
"overflow": overflow,
"position": "relative",
"margin-right": "20px",
"margin-right": this.hasIcon() ? "20px" : "0px",
"padding-right": "4px"
}}).inject(this.node, "after");
input.inject(node);
......@@ -153,6 +159,9 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
this.node.destroy();
this.node = node;
},
hasIcon: function(){
return this.json.showIcon!='no' && ( !this.form.json || !this.form.json.hideModuleIcon );
},
_loadNodeEdit: function(){
if (!this.json.preprocessing) this._resetNodeEdit();
var input = this.node.getFirst();
......@@ -165,7 +174,7 @@ MWF.xApplication.process.Xform.$Input = MWF.APP$Input = new Class(
"click": this.clickSelect.bind(this)
}
});
if (this.json.showIcon!='no' && !this.form.json.hideModuleIcon ){
if ( this.hasIcon() ){
this.iconNode = new Element("div", {
"styles": this.form.css[this.iconStyle],
"events": {
......
......@@ -1131,6 +1131,11 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
* @event MWF.xApplication.process.Xform.Attachment#afterLoad
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 附件上传前触发。本事件中可以通过this.event获取上传的文件数组
* @event MWF.xApplication.process.Xform.Attachment#beforeUpload
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
/**
* 附件上传后触发。本事件中可以通过this.event获取上传附件的数据
* @event MWF.xApplication.process.Xform.Attachment#upload
......@@ -1161,7 +1166,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
* @event MWF.xApplication.process.Xform.Attachment#open
* @see {@link https://www.yuque.com/o2oa/ixsnyt/hm5uft#i0zTS|组件事件说明}
*/
"moduleEvents": ["upload", "delete", "afterDelete", "load", "afterLoad", "change","download","open", "queryLoad", "queryLoadController", "loadController", "postLoadController"]
"moduleEvents": ["beforeUpload", "upload", "delete", "afterDelete", "load", "afterLoad", "change","download","open", "queryLoad", "queryLoadController", "loadController", "postLoadController"]
},
initialize: function (node, json, form, options) {
......@@ -1361,6 +1366,7 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class(
return false;
}
}
this.fireEvent("beforeUpload", [files]);
return true;
}.bind(this), true, accept, size, function (o) { //错误的回调
if (o.messageId && this.attachmentController.messageItemList) {
......
......@@ -107,7 +107,6 @@ MWF.xApplication.process.Xform.Opinion = MWF.APPOpinion = new Class(
}
return true;
},
_resetNodeEdit: function () {
var input = new Element("textarea", {
"styles": {
......@@ -117,6 +116,7 @@ MWF.xApplication.process.Xform.Opinion = MWF.APPOpinion = new Class(
}
});
input.set(this.json.properties);
this.textarea = input;
var node = new Element("div", {
"styles": {
......@@ -130,7 +130,11 @@ MWF.xApplication.process.Xform.Opinion = MWF.APPOpinion = new Class(
this.node = node;
},
_loadNodeEdit: function () {
if (!this.json.preprocessing) this._resetNodeEdit();
if (!this.json.preprocessing) {
this._resetNodeEdit();
}else{
this.textarea = this.node.getElement("textarea");
}
var input = this.node.getFirst();
input.set(this.json.properties);
......@@ -141,6 +145,15 @@ MWF.xApplication.process.Xform.Opinion = MWF.APPOpinion = new Class(
});
this.input = input;
if( this.json.isSelectIdea === "yes" ){
this.selectIdeaNode = new Element("div", {"styles": this.form.css.selectIdeaNode}).inject(this.node);
this.underLineNode = new Element("div", {"styles": {
"border-top": "1px solid #ccc",
"clear": "both"
}}).inject(this.node);
this.loadSelectIdea()
}
this.mediaActionArea = new Element("div", {"styles": this.form.css.inputOpinionMediaActionArea}).inject(this.node);
if (this.json.isHandwriting !== "no") {
......@@ -235,6 +248,95 @@ MWF.xApplication.process.Xform.Opinion = MWF.APPOpinion = new Class(
this.startSearchOpinion();
}.bind(this));
this.setNodeSize();
},
setNodeSize: function(){
if( this.textarea ){
var x = 0;
if( this.selectIdeaNode ){
var size = this.selectIdeaNode.getSize();
x += size.x + 5;
this.textarea.setStyles({
"height": ( size.y - 6 ) + "px",
"resize":"none",
"border-bottom": "0px",
"padding-right": "0px"
});
this.node.setStyles({
"min-height": size.y + "px",
"height": "auto",
"overflow":"hidden",
"width": "100%"
});
}
if( this.handwritingAction ){
if( x ){
this.mediaActionArea.setStyle("right", x+"px");
}
var handWritingSize = this.handwritingAction.getSize();
this.textarea.setStyles({
"width": "calc( 100% - "+ x +"px )"
});
}
}
},
loadSelectIdea: function(){
this.selectIdeaScrollNode = new Element("div", {"styles": this.form.css.selectIdeaScrollNode}).inject(this.selectIdeaNode);
this.selectIdeaAreaNode = new Element("div", {
"styles": {
"overflow": "hidden"
}
}).inject(this.selectIdeaScrollNode);
MWF.require("MWF.widget.ScrollBar", function () {
new MWF.widget.ScrollBar(this.selectIdeaScrollNode, {
"style": "small",
"where": "before",
"distance": 30,
"friction": 4,
"indent": false,
"axis": {"x": false, "y": true}
});
}.bind(this));
MWF.UD.getDataJson("idea", function (json) {
if (json) {
if (json.ideas) {
this.setIdeaList(json.ideas);
}
} else {
MWF.UD.getPublicData("idea", function (pjson) {
if (pjson) {
if (pjson.ideas) {
this.setIdeaList(pjson.ideas);
}
}
}.bind(this));
}
}.bind(this));
},
setIdeaList: function (ideas) {
var _self = this;
ideas.each(function (idea) {
if (!idea) return;
new Element("div", {
"styles": this.form.css.selectIdeaItemNode,
"text": idea,
"events": {
"click": function () {
if ( !_self.textarea.get("value") ) {
_self.textarea.set("value", this.get("text"));
} else {
_self.textarea.set("value", _self.textarea.get("value") + ", " + this.get("text"));
}
},
"mouseover": function () {
this.setStyles(_self.form.css.selectIdeaItemNode_over);
},
"mouseout": function () {
this.setStyles(_self.form.css.selectIdeaItemNode);
}
}
}).inject(this.selectIdeaAreaNode);
}.bind(this));
},
audioRecord: function () {
......
......@@ -841,11 +841,17 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class(
},
_resetNodeInputEdit: function(){
var overflow;
if(this.json.styles && this.json.styles.overflow){
overflow = this.json.styles.overflow;
}else{
overflow = this.hasIcon() ? "hidden" : "visible";
}
var node = new Element("div", {
"styles": {
"overflow": "hidden",
"overflow": overflow,
//"position": "relative",
"margin-right": "20px"
"margin-right": this.hasIcon() ? "20px" : "0px"
}
}).inject(this.node, "after");
this.node.destroy();
......@@ -917,10 +923,17 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class(
"min-height": "24px"
}
});
var overflow;
if(this.json.styles && this.json.styles.overflow){
overflow = this.json.styles.overflow;
}else{
overflow = this.hasIcon() ? "hidden" : "visible";
}
var node = new Element("div", {"styles": {
"overflow": "hidden",
"overflow": overflow,
"position": "relative",
"margin-right": "20px",
"margin-right": this.hasIcon() ? "20px" : "0px",
"min-height": "24px"
}}).inject(this.node, "after");
input.inject(node);
......
......@@ -45,7 +45,7 @@ MWF.xApplication.process.Xform.Textfield = MWF.APPTextfield = new Class({
if (this.json.description){
var size = this.node.getFirst().getSize();
var w = size.x-3;
if( this.json.showIcon!='no' && !this.form.json.hideModuleIcon ){
if( this.hasIcon() ){
if (COMMON.Browser.safari) w = w-20;
}
this.descriptionNode = new Element("div", {"styles": this.form.css.descriptionNode, "text": this.json.description}).inject(this.node);
......@@ -114,10 +114,16 @@ MWF.xApplication.process.Xform.Textfield = MWF.APPTextfield = new Class({
}
});
var overflow;
if(this.json.styles && this.json.styles.overflow){
overflow = this.json.styles.overflow;
}else{
overflow = this.hasIcon() ? "hidden" : "visible";
}
var node = new Element("div", {"styles": {
"overflow": (this.json.styles && this.json.styles.overflow) ? this.json.styles.overflow : "hidden",
"overflow": overflow,
"position": "relative",
"margin-right": "20px",
"margin-right": this.hasIcon() ? "20px" : "0px",
"padding-right": "4px"
}}).inject(this.node, "after");
input.inject(node);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册