OOTextarea.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Input", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.OOTextarea = MWF.FCOOTextarea = new Class({
  4. Extends: MWF.FC$Input,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "OOTextarea",
  9. "path": "../x_component_process_FormDesigner/Module/OOTextarea/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/OOTextarea/OOTextarea.html"
  11. },
  12. _loadNodeStyles: function(){
  13. this.node.setAttribute('readonly', true);
  14. },
  15. _setEditStyle_custom: function(name){
  16. if (name==="id") this.node.set("placeholder", this.json.id);
  17. if (["label"].includes(name)){
  18. this.node.setAttribute(name, this.json[name]);
  19. }
  20. if (name==="showMode"){
  21. if (this.json.showMode==="disabled"){
  22. this.node.setAttribute("bgcolor", "#f3f3f3");
  23. this.node.setAttribute("readmode", false);
  24. }else if (this.json.showMode==="read"){
  25. // this.node.setAttribute("readmode", true);
  26. this.node.removeAttribute("bgcolor");
  27. }else{
  28. this.node.setAttribute("readmode", false);
  29. this.node.removeAttribute("bgcolor");
  30. }
  31. }
  32. if (name==="required"){
  33. if (this.json.required){
  34. this.node.setAttribute("required", true);
  35. }else{
  36. this.node.removeAttribute("required");
  37. }
  38. }
  39. if (name==="showIcon"){
  40. if (this.json.showIcon==="yes"){
  41. this.node.setAttribute("right-icon", this.json.properties["right-icon"] || "edit");
  42. }else{
  43. this.node.removeAttribute("right-icon");
  44. }
  45. }
  46. },
  47. _createMoveNode: function(){
  48. this.moveNode = new Element("oo-textarea", {
  49. "MWFType": "OOTextarea",
  50. "id": this.json.id,
  51. // "label-style": "width:6.2vw; min-width:5em; max-width:9em",
  52. "styles": this.css.moduleNodeMove,
  53. "placeholder": this.json.id,
  54. "readonly": "true",
  55. "events": {
  56. "selectstart": function(){
  57. return false;
  58. }
  59. }
  60. }).inject(this.form.container);
  61. },
  62. setPropertiesOrStyles: function(name){
  63. if (name=="styles"){
  64. try{
  65. this.setCustomStyles();
  66. }catch(e){}
  67. }
  68. if (name=="inputStyles"){
  69. try{
  70. this.setCustomInputStyles();
  71. }catch(e){}
  72. }
  73. if (name=="properties"){
  74. this.node.setProperties(this.json.properties);
  75. }
  76. },
  77. _preprocessingModuleData: function(){
  78. this.node.clearStyles();
  79. if (this.json.styles){
  80. this.json.recoveryStyles = Object.clone(this.json.styles);
  81. this.ooinput = this.node;
  82. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  83. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  84. this.ooinput.setStyle(key, value);
  85. delete this.json.styles[key];
  86. }
  87. }.bind(this));
  88. }
  89. this.json.preprocessing = "y";
  90. },
  91. });