ImportTips.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. MWF.xApplication.Strategy = MWF.xApplication.Strategy || {};
  2. MWF.xDesktop.requireApp("Strategy", "Template", null, false);
  3. MWF.xDesktop.requireApp("Template", "MPopupForm", null, false);
  4. MWF.xDesktop.requireApp("Template", "MForm", null, false);
  5. MWF.xDesktop.requireApp("Template", "MTooltips", null, false);
  6. MWF.xDesktop.requireApp("Strategy","Attachment",null,false);
  7. MWF.xApplication.Strategy.ImportTips = new Class({
  8. Extends: MTooltips,
  9. Implements: [Options, Events],
  10. options : {
  11. style : "", //如果有style,就加载 style/css.wcss
  12. axis: "y", //箭头在x轴还是y轴上展现
  13. position : { //node 固定的位置
  14. x : "auto", //x轴上left center right, auto 系统自动计算
  15. y : "auto" //y 轴上top middle bottom, auto 系统自动计算
  16. },
  17. priorityOfAuto :{
  18. x : [ "center", "right", "left" ], //当position x 为 auto 时候的优先级
  19. y : [ "middle", "bottom", "top" ] //当position y 为 auto 时候的优先级
  20. },
  21. isFitToContainer : true, //当position x 不为 auto, y 不为 auto 的时候,自动设置偏移量,使tooltip不超过容器的可见范围
  22. event : "mouseenter", //事件类型,有target 时有效, mouseenter对应mouseleave,click 对应 container 的 click
  23. hiddenDelay : 1000, //ms , 有target 且 事件类型为 mouseenter 时有效
  24. displayDelay : 0, //ms , 有target 且事件类型为 mouseenter 时有效
  25. hasArrow : true,
  26. isAutoShow : false,
  27. isAutoHide : true,
  28. hasCloseAction : true,
  29. overflow : "hidden", //弹出框超过container的时候怎么处理,hidden 表示超过的隐藏,scroll 表示超过的时候显示滚动条,
  30. nodeStyles : {
  31. "min-width" : "300px",
  32. "min-height":"100px",
  33. "border-radius" : "4px"
  34. }
  35. },
  36. //_getHtml : function(){
  37. //
  38. // var container = new Element("div");
  39. // var divClick = new Element("div.click",{
  40. // "styles":{
  41. // "width":"50px",
  42. // "height":"30px",
  43. // "cursor":"pointer"
  44. // },
  45. // "text":"关闭"
  46. // }).inject(container);
  47. // divClick.addEvents({
  48. // "click":function(){
  49. // alert("click")
  50. // }.bind(this)
  51. // });
  52. //
  53. // var html = container.get("html");
  54. //
  55. // return html;
  56. //},
  57. _customNode : function( node, contentNode ){
  58. var container = new Element("div").inject(contentNode);
  59. var divClick = new Element("div.click",{
  60. "styles":{
  61. "width":"50px",
  62. "height":"30px",
  63. "cursor":"pointer"
  64. },
  65. "text":"关闭"
  66. }).inject(container);
  67. divClick.addEvents({
  68. "click":function(){
  69. this.destroy()
  70. }.bind(this)
  71. });
  72. }
  73. });