Elbutton.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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.Elbutton = MWF.FCElbutton = new Class({
  4. Extends: MWF.FC$ElElement,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elbutton/elbutton.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elbutton";
  12. this.moduleType = "element";
  13. this.moduleName = "elbutton";
  14. },
  15. _createElementHtml: function(){
  16. var html = "<el-button";
  17. // if (this.json.size && this.json.size!=="auto") html += " size=\""+this.json.size+"\"";
  18. // if (this.json.bttype && this.json.bttype!=="default") html += " type=\""+this.json.bttype+"\"";
  19. // if (this.json.plain===true) html += " plain";
  20. // if (this.json.round===true) html += " round";
  21. // if (this.json.circle===true) html += " circle";
  22. // if (this.json.icon) html += " icon=\""+this.json.icon+"\"";
  23. // if (this.json.disabled===true) html += " disabled";
  24. // if (this.json.loading===true) html += " loading";
  25. // if (this.json.autofocus===true) html += " autofocus";
  26. html += " :size=\"size\"";
  27. html += " :type=\"bttype\"";
  28. html += " :plain=\"plain\"";
  29. html += " :round=\"round\"";
  30. html += " :circle=\"circle\"";
  31. if( this.json.iconPosition !== "right" )html += " :icon=\"icon\"";
  32. html += " :disabled=\"disabled\"";
  33. html += " :loading=\"loading\"";
  34. if (this.json.elProperties){
  35. Object.keys(this.json.elProperties).forEach(function(k){
  36. if (this.json.elProperties[k]) html += " "+k+"=\""+this.json.elProperties[k]+"\"";
  37. }, this);
  38. }
  39. html += " :style=\"tmpElStyles\"";
  40. // if (this.json.elStyles){
  41. // var style = "";
  42. // Object.keys(this.json.elStyles).forEach(function(k){
  43. // if (this.json.elStyles[k]) style += k+":"+this.json.elStyles[k]+";";
  44. // }, this);
  45. // html += " style=\""+style+"\"";
  46. // }
  47. // html += ">"+((this.json.circle!==true && this.json.isText!==false) ? (this.json.name || this.json.id) : "")+"</el-button>";
  48. html += ">{{(isText===false) ? '' : name||id}}";
  49. if( this.json.iconPosition === "right" )html += "<i class=\""+ this.json.icon +" el-icon--right\"></i>";
  50. html += "</el-button>";
  51. return html;
  52. },
  53. _createCopyNode: function(){
  54. this.copyNode = new Element("div", {
  55. "styles": this.css.moduleNodeShow
  56. });
  57. this.copyNode.addEvent("selectstart", function(){
  58. return false;
  59. });
  60. },
  61. _getCopyNode: function(){
  62. if (!this.copyNode) this._createCopyNode();
  63. this.copyNode.setStyle("display", "inline-block");
  64. return this.copyNode;
  65. },
  66. _setEditStyle_custom: function(name){
  67. switch (name){
  68. case "name": this.setPropertyName(); break;
  69. case "id": this.setPropertyId(); break;
  70. case "buttonRadio":
  71. case "iconPosition":
  72. case "icon":
  73. case "vueSlot":
  74. if (this.isPropertyLoaded) if (this.vm) this.resetElement(); break;
  75. default: ;
  76. }
  77. },
  78. });