Elinput.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.Elinput = MWF.FCElinput = new Class({
  4. Extends: MWF.FC$ElElement,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elinput/elinput.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elinput";
  12. this.moduleType = "element";
  13. this.moduleName = "elinput";
  14. },
  15. _createElementHtml: function(){
  16. //var html = "<el-input placeholder=\"请输入内容\"></el-input>";
  17. var html = "<el-input";
  18. // if (this.json.description) html += " placeholder=\""+this.json.description+"\"";
  19. // html += " type=\""+(this.json.inputType || "text")+"\"";
  20. // if (this.json.maxlength) html += " maxlength=\""+this.json.maxlength+"\"";
  21. // if (this.json.showWordLimit) html += " show-word-limit";
  22. // if (this.json.clearable) html += " clearable";
  23. // if (this.json.showPassword) html += " show-password";
  24. // if (this.json.size && this.json.size!=="default") html += " size=\""+this.json.size+"\"";
  25. // html += " rows=\""+(this.json.textareaRows || "2")+"\"";
  26. html += " :placeholder=\"id\"";
  27. html += " :type=\"inputType\"";
  28. html += " :maxlength=\"maxlength\"";
  29. html += " :show-word-limit=\"showWordLimit\"";
  30. html += " :clearable=\"clearable\"";
  31. html += " :show-password=\"showPassword\"";
  32. html += " :size=\"size\"";
  33. html += " :rows=\"rows\"";
  34. html += " :resize=\"resize\"";
  35. html += " :prefix-icon=\"prefixIcon\"";
  36. html += " :suffix-icon=\"suffixIcon\"";
  37. // if (this.json.autosize){
  38. // var o = {};
  39. // if (this.json.minRows) o.minRows = this.json.minRows;
  40. // if (this.json.maxRows) o.maxRows = this.json.maxRows;
  41. // html += " autosize=\""+JSON.stringify(o)+"\"";
  42. // }
  43. // if (this.json.resize) html += " resize=\""+this.json.resize+"\"";
  44. // if (this.json.prefixIcon) html += " prefix-icon=\""+this.json.prefixIcon+"\"";
  45. // if (this.json.suffixIcon) html += " suffix-icon=\""+this.json.suffixIcon+"\"";
  46. if (this.json.elProperties){
  47. Object.keys(this.json.elProperties).forEach(function(k){
  48. if (this.json.elProperties[k]) html += " "+k+"=\""+this.json.elProperties[k]+"\"";
  49. }, this);
  50. }
  51. html += " :style=\"tmpElStyles\"";
  52. // if (this.json.elStyles){
  53. // var style = "";
  54. // Object.keys(this.json.elStyles).forEach(function(k){
  55. // if (this.json.elStyles[k]) style += k+":"+this.json.elStyles[k]+";";
  56. // }, this);
  57. // html += " style=\""+style+"\"";
  58. // }
  59. html += " :value=\"id\">";
  60. if (this.json.vueSlot) html += this.json.vueSlot;
  61. html += "</el-input>";
  62. return html;
  63. },
  64. _createCopyNode: function(){
  65. this.copyNode = new Element("div", {
  66. "styles": this.css.moduleNodeShow
  67. });
  68. this.copyNode.addEvent("selectstart", function(){
  69. return false;
  70. });
  71. },
  72. _getCopyNode: function(){
  73. if (!this.copyNode) this._createCopyNode();
  74. this.copyNode.setStyle("display", "inline-block");
  75. return this.copyNode;
  76. },
  77. setPropertyName: function(){
  78. if (this.json.name){
  79. var input = this.node.getElement("input");
  80. if (input) input.set("value", this.json.name);
  81. }
  82. },
  83. setPropertyId: function(){
  84. if (!this.json.name){
  85. var input = this.node.getElement("input");
  86. if (input) input.set("value", this.json.id);
  87. }
  88. }
  89. });