Elicon.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$ElElement", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Elicon = MWF.FCElicon = new Class({
  4. Extends: MWF.FC$ElElement,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elicon/elicon.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elicon";
  12. this.moduleType = "element";
  13. this.moduleName = "elicon";
  14. },
  15. _createElementHtml: function(){
  16. var html = "<i :class='icon'";
  17. if (this.json.elProperties){
  18. Object.keys(this.json.elProperties).forEach(function(k){
  19. if (this.json.elProperties[k]) html += " "+k+"=\""+this.json.elProperties[k]+"\"";
  20. }, this);
  21. }
  22. html += " :style=\"[tmpElStyles, {fontSize: iconSize+'px', color: iconColor}]\"";
  23. // var styles = {};
  24. // if (this.json.iconSize) styles["font-size"] = this.json.iconSize+"px";
  25. // if (this.json.iconColor) styles["color"] = this.json.iconColor;
  26. // styles = Object.merge(styles, this.json.elStyles);
  27. //
  28. // if (styles){
  29. // var style = "";
  30. // Object.keys(styles).forEach(function(k){
  31. // if (styles[k]) style += k+":"+styles[k]+";";
  32. // }, this);
  33. // html += " style=\""+style+"\"";
  34. // }
  35. html += "></i>";
  36. return html;
  37. },
  38. _createMoveNode: function(){
  39. this.moveNode = new Element("div", {
  40. "MWFType": "label",
  41. "styles": this.css.moduleNodeMove,
  42. "events": {
  43. "selectstart": function(){
  44. return false;
  45. }
  46. }
  47. }).inject(this.form.container);
  48. },
  49. _createCopyNode: function(){
  50. this.copyNode = new Element("div", {
  51. "styles": this.css.moduleNodeShow
  52. });
  53. this.copyNode.addEvent("selectstart", function(){
  54. return false;
  55. });
  56. },
  57. _getCopyNode: function(){
  58. if (!this.copyNode) this._createCopyNode();
  59. this.copyNode.setStyle("display", "inline-block");
  60. return this.copyNode;
  61. },
  62. setPropertyName: function(){},
  63. setPropertyId: function(){},
  64. _preprocessingModuleData: function(){
  65. this.node.clearStyles();
  66. //if (this.initialStyles) this.node.setStyles(this.initialStyles);
  67. if( this.json.tmpElStyles )delete this.json.tmpElStyles;
  68. this.json.recoveryStyles = Object.clone(this.json.styles);
  69. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  70. if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1)){
  71. //需要运行时处理
  72. }else{
  73. this.node.setStyle(key, value);
  74. delete this.json.styles[key];
  75. }
  76. }.bind(this));
  77. this.json.preprocessing = "y";
  78. },
  79. });