Select.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.Select = MWF.FCSelect = new Class({
  4. Extends: MWF.FC$Input,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "select",
  9. "path": "../x_component_process_FormDesigner/Module/Select/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/Select/select.html"
  11. },
  12. _preprocessingModuleData: function(){
  13. this.node.clearStyles();
  14. this.recoveryIconNode = this.node.getFirst();
  15. this.recoveryIconNode.dispose();
  16. this.recoveryTextNode = this.node.getFirst();
  17. this.recoveryTextNode.dispose();
  18. var inputNode = new Element("select").inject(this.node);
  19. if (this.json.properties) inputNode.set(this.json.properties);
  20. if (this.json.styles){
  21. this.json.recoveryStyles = Object.clone(this.json.styles);
  22. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  23. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  24. this.node.setStyle(key, value);
  25. delete this.json.styles[key];
  26. }
  27. }.bind(this));
  28. }
  29. if (this.json.inputStyles){
  30. this.json.recoveryInputStyles = Object.clone(this.json.inputStyles);
  31. var inputNode = this.node.getFirst();
  32. if (inputNode){
  33. if (this.json.recoveryInputStyles) Object.each(this.json.recoveryInputStyles, function(value, key){
  34. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  35. inputNode.setStyle(key, value);
  36. delete this.json.inputStyles[key];
  37. }
  38. }.bind(this));
  39. }
  40. }
  41. this.json.preprocessing = "y";
  42. },
  43. _recoveryModuleData: function(){
  44. if (this.json.recoveryStyles) this.json.styles = this.json.recoveryStyles;
  45. if (this.json.recoveryInputStyles) this.json.inputStyles = this.json.recoveryInputStyles;
  46. if (this.recoveryTextNode) {
  47. this.node.empty();
  48. this.recoveryTextNode.inject(this.node, "top");
  49. }
  50. if (this.recoveryIconNode) {
  51. this.recoveryIconNode.inject(this.node, "top");
  52. }
  53. this.json.recoveryStyles = null;
  54. this.json.recoveryInputStyles = null;
  55. this.recoveryIconNode = null;
  56. this.recoveryTextNode = null;
  57. }
  58. });