Eltime.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.Eltime = MWF.FCEltime = new Class({
  4. Extends: MWF.FC$ElElement,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "../x_component_process_FormDesigner/Module/Eltime/eltime.html"
  9. },
  10. _initModuleType: function(){
  11. this.className = "Eltime";
  12. this.moduleType = "element";
  13. this.moduleName = "eltime";
  14. },
  15. _createElementHtml: function() {
  16. if (this.json.timeSelectType === "select"){
  17. // if (this.json.isRange ) {
  18. // return this.createSelectRangeElementHtml();
  19. // } else {
  20. return this.createSelectElementHtml();
  21. // }
  22. }else{
  23. if (this.json.isRange) {
  24. return this.createPickerRangeElementHtml();
  25. } else {
  26. return this.createPickerElementHtml();
  27. }
  28. }
  29. },
  30. getCommonHtml: function(){
  31. var html = "";
  32. html += " readonly";
  33. html += " :clearable=\"clearable\"";
  34. html += " :size=\"size\"";
  35. html += " :prefix-icon=\"prefixIcon\"";
  36. if (this.json.elProperties){
  37. Object.keys(this.json.elProperties).forEach(function(k){
  38. if (this.json.elProperties[k]) html += " "+k+"=\""+this.json.elProperties[k]+"\"";
  39. }, this);
  40. }
  41. html += " :style=\"tmpElStyles\">";
  42. if (this.json.vueSlot) html += this.json.vueSlot;
  43. return html;
  44. },
  45. createSelectElementHtml: function(){
  46. var html = "<el-time-select";
  47. // html += " :value=\"id\"";
  48. html += " :placeholder=\"id\"";
  49. html += this.getCommonHtml();
  50. html += "</el-time-select>";
  51. return html;
  52. },
  53. // createSelectRangeElementHtml: function(){
  54. // var html = "<el-time-select";
  55. // html += " :value=\"id\"";
  56. // html += this.getCommonHtml();
  57. // html += "</el-time-select>";
  58. //
  59. // html += "<span style='padding: 0px 5px;'>"+this.json.rangeSeparator+"</span>";
  60. //
  61. // html += "<el-time-select";
  62. // html += " :value=\"id\"";
  63. // html += this.getCommonHtml();
  64. // html += "</el-time-select>";
  65. // return html;
  66. // },
  67. createPickerElementHtml: function(){
  68. var html = "<el-time-picker";
  69. html += " :placeholder=\"id\"";
  70. html += this.getCommonHtml();
  71. html += "</el-time-picker>";
  72. return html;
  73. },
  74. createPickerRangeElementHtml: function(){
  75. var html = "<el-time-picker";
  76. html += " is-range";
  77. html += " :range-separator=\"rangeSeparator\"";
  78. html += " :start-placeholder=\"id\"";
  79. html += " :end-placeholder=\"id\"";
  80. html += this.getCommonHtml();
  81. html += "</el-time-picker>";
  82. return html;
  83. },
  84. _createCopyNode: function(){
  85. this.copyNode = new Element("div", {
  86. "styles": this.css.moduleNodeShow
  87. });
  88. this.copyNode.addEvent("selectstart", function(){
  89. return false;
  90. });
  91. },
  92. _getCopyNode: function(){
  93. if (!this.copyNode) this._createCopyNode();
  94. this.copyNode.setStyle("display", "inline-block");
  95. return this.copyNode;
  96. },
  97. _setEditStyle_custom: function(name){
  98. switch (name){
  99. case "name": this.setPropertyName(); break;
  100. case "id": this.setPropertyId(); break;
  101. case "buttonRadio":
  102. case "vueSlot":
  103. if (this.isPropertyLoaded) if (this.vm) this.resetElement(); break;
  104. case "isRange":
  105. case "timeSelectType":
  106. if (this.isPropertyLoaded) if (this.vm) this.resetElement(); break;
  107. default: break;
  108. }
  109. },
  110. setPropertyName: function(){
  111. // if (this.json.name){
  112. // var input = this.node.getElement("input");
  113. // if (input) input.set("value", this.json.name);
  114. // }
  115. },
  116. setPropertyId: function(){
  117. // if (!this.json.name){
  118. // var input = this.node.getElement("input");
  119. // if (input) input.set("value", this.json.id);
  120. // }
  121. }
  122. });