OOSelect.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.OOInput", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.OOSelect = MWF.FCOOSelect = new Class({
  4. Extends: MWF.FCOOInput,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "OOSelect",
  9. "path": "../x_component_process_FormDesigner/Module/OOSelect/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/OOSelect/OOSelect.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. },
  40. _createMoveNode: function(){
  41. this.moveNode = new Element("oo-select", {
  42. "MWFType": "OOSelect",
  43. "id": this.json.id,
  44. // "label-style": "width:6.2vw; min-width:5em; max-width:9em",
  45. "styles": this.css.moduleNodeMove,
  46. "placeholder": this.json.id,
  47. "readonly": "true",
  48. "events": {
  49. "selectstart": function(){
  50. return false;
  51. }
  52. }
  53. }).inject(this.form.container);
  54. // this.moveNode._elements.input.setAttribute("readonly", true);
  55. },
  56. setPropertiesOrStyles: function(name){
  57. if (name=="styles"){
  58. try{
  59. this.setCustomStyles();
  60. }catch(e){}
  61. }
  62. if (name=="inputStyles"){
  63. try{
  64. this.setCustomInputStyles();
  65. }catch(e){}
  66. }
  67. if (name=="properties"){
  68. this.node.setProperties(this.json.properties);
  69. }
  70. },
  71. _preprocessingModuleData: function(){
  72. this.node.clearStyles();
  73. if (this.json.styles){
  74. this.json.recoveryStyles = Object.clone(this.json.styles);
  75. this.ooinput = this.node;
  76. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  77. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  78. this.ooinput.setStyle(key, value);
  79. delete this.json.styles[key];
  80. }
  81. }.bind(this));
  82. }
  83. this.json.preprocessing = "y";
  84. },
  85. });