OOInput.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.OOInput = MWF.FCOOInput = new Class({
  4. Extends: MWF.FC$Input,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "OOInput",
  9. "path": "../x_component_process_FormDesigner/Module/OOInput/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/OOInput/OOInput.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==="dataType"){
  33. this.node.setAttribute("type", this.json.dataType);
  34. this.node._elements.input.value = '';
  35. }
  36. if (name==="showIcon"){
  37. if (this.json.showIcon==="yes"){
  38. this.node.setAttribute("right-icon", this.json.properties["right-icon"] || "edit");
  39. }else{
  40. this.node.removeAttribute("right-icon");
  41. }
  42. }
  43. if (name==="required"){
  44. if (this.json.required){
  45. this.node.setAttribute("required", true);
  46. }else{
  47. this.node.removeAttribute("required");
  48. }
  49. }
  50. },
  51. _createMoveNode: function(){
  52. this.moveNode = new Element("oo-input", {
  53. "MWFType": "OOInput",
  54. "id": this.json.id,
  55. // "label-style": "width:6.2vw; min-width:5em; max-width:9em",
  56. "styles": this.css.moduleNodeMove,
  57. "placeholder": this.json.id,
  58. "readonly": "true",
  59. "events": {
  60. "selectstart": function(){
  61. return false;
  62. }
  63. }
  64. }).inject(this.form.container);
  65. },
  66. setPropertiesOrStyles: function(name){
  67. if (name=="styles"){
  68. try{
  69. this.setCustomStyles();
  70. }catch(e){}
  71. }
  72. if (name=="inputStyles"){
  73. try{
  74. this.setCustomInputStyles();
  75. }catch(e){}
  76. }
  77. if (name=="properties"){
  78. this.node.setProperties(this.json.properties);
  79. }
  80. },
  81. _preprocessingModuleData: function(){
  82. this.node.clearStyles();
  83. if (this.json.styles){
  84. this.json.recoveryStyles = Object.clone(this.json.styles);
  85. this.ooinput = this.node;
  86. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  87. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  88. this.ooinput.setStyle(key, value);
  89. delete this.json.styles[key];
  90. }
  91. }.bind(this));
  92. }
  93. this.json.preprocessing = "y";
  94. },
  95. });