Elcarousel.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.Elcarousel = MWF.FCElcarousel = new Class({
  4. Extends: MWF.FC$ElElement,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Elcarousel/elcarousel.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Elcarousel";
  12. this.moduleType = "element";
  13. this.moduleName = "elcarousel";
  14. },
  15. _createElementHtml: function(){
  16. var html = "<el-carousel";
  17. html += " height="+ (this.json.height ? (this.json.height+"px") : "");
  18. html += " initial-index=1";
  19. html += " indicator-position=\"outside\"";
  20. html += " arrow=\"always\"";
  21. html += " interval=30000";
  22. html += " :type=\"carouselType\"";
  23. html += " loop";
  24. html += " :direction=\"direction\"";
  25. // html += " :initial-index=\"initialIndex\"";
  26. // html += " :trigger=\"trigger\"";
  27. // html += " :autoplay=\"autoplay\"";
  28. // html += " :interval=\"interval\"";
  29. // html += " :indicator-position=\"indicatorPosition\"";
  30. // html += " :arrow=\"arrow\"";
  31. // html += " :type=\"carouselType\"";
  32. // html += " :loop=\"loop\"";
  33. // html += " :direction=\"direction\"";
  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.vueSlot){
  41. html += this.json.vueSlot;
  42. }else{
  43. var lineHeight = this.json.height ? ( "line-height:"+this.json.height + "px;") : "";
  44. html += "<el-carousel-item v-for='item in 3' :key='item'>";
  45. html += "<div style=\"text-align: center;"+lineHeight+"\">"+this.json.id+"</div>";
  46. html += "</el-carousel-item>";
  47. }
  48. html += "</el-carousel>";
  49. return html;
  50. },
  51. _createCopyNode: function(){
  52. this.copyNode = new Element("div", {
  53. "styles": this.css.moduleNodeShow
  54. });
  55. this.copyNode.addEvent("selectstart", function(){
  56. return false;
  57. });
  58. },
  59. _getCopyNode: function(){
  60. if (!this.copyNode) this._createCopyNode();
  61. // this.copyNode.setStyle("display", "inline-block");
  62. return this.copyNode;
  63. },
  64. _setEditStyle_custom: function(name){
  65. switch (name){
  66. case "name": this.setPropertyName(); break;
  67. case "id":
  68. case "height":
  69. case "vueSlot":
  70. if (this.isPropertyLoaded) if (this.vm) this.resetElement(); break;
  71. default: break;
  72. }
  73. },
  74. setPropertyName: function(){
  75. // if (this.json.name){
  76. // var input = this.node.getElement("input");
  77. // if (input) input.set("value", this.json.name);
  78. // }
  79. },
  80. setPropertyId: function(){
  81. // if (!this.json.name){
  82. // var input = this.node.getElement("input");
  83. // if (input) input.set("value", this.json.id);
  84. // }
  85. }
  86. });