Elcontainer.js 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. /** @class Div 容器组件。
  3. * @o2cn 容器组件
  4. * @example
  5. * //可以在脚本中获取该组件
  6. * //方法1:
  7. * var div = this.form.get("name"); //获取组件
  8. * //方法2
  9. * var div = this.target; //在组件事件脚本中获取
  10. * @extends MWF.xApplication.process.Xform.$Module
  11. * @o2category FormComponents
  12. * @o2range {Process|CMS|Portal}
  13. * @hideconstructor
  14. */
  15. MWF.xApplication.process.Xform.Elcontainer = MWF.APPElcontainer = new Class({
  16. Extends: MWF.APP$Module,
  17. _loadUserInterface: function(){
  18. this.node.addClass("o2_vue");
  19. var asides = this.node.getElements("aside");
  20. var headers = this.node.getElements("header");
  21. var mains = this.node.getElements("main");
  22. var footers = this.node.getElements("footer");
  23. if (!this.asides || !this.asides.length) this.asides = [];
  24. if (!this.headers || !this.headers.length) this.headers = [];
  25. if (!this.mains || !this.mains.length) this.mains = [];
  26. if (!this.footers || !this.footers.length) this.footers = [];
  27. asides.each(function(aside){ this.asides.push(this._loadSubModule(aside)); }.bind(this));
  28. headers.each(function(header){ this.headers.push(this._loadSubModule(header)); }.bind(this));
  29. mains.each(function(main){ this.mains.push(this._loadSubModule(main)); }.bind(this));
  30. footers.each(function(footer){ this.footers.push(this._loadSubModule(footer)); }.bind(this));
  31. },
  32. _loadSubModule: function(node){
  33. var json = this.form._getDomjson(node);
  34. var module = null;
  35. if (json){
  36. var container = this;
  37. module = this.form._loadModule(json, node, function(){
  38. this.container = container;
  39. });
  40. this.form.modules.push(module);
  41. }
  42. return module;
  43. }
  44. });
  45. MWF.xApplication.process.Xform.Elcontainer$Main = MWF.APPElcontainer$Main = new Class({
  46. Extends: MWF.APP$Module
  47. });
  48. MWF.xApplication.process.Xform.Elcontainer$Aside = MWF.APPElcontainer$Aside = new Class({
  49. Extends: MWF.APP$Module,
  50. _loadUserInterface: function(){
  51. var css = Object.clone(this.form.css["el-container-aside"]);
  52. if (this.json.recoveryStyles){
  53. var keys = Object.keys(css);
  54. keys.forEach(function(key){
  55. if (this.json.recoveryStyles[key]) delete css[key];
  56. }.bind(this))
  57. }
  58. this.node.setStyles(css);
  59. }
  60. });
  61. MWF.xApplication.process.Xform.Elcontainer$Header = MWF.APPElcontainer$Header = new Class({
  62. Extends: MWF.APP$Module,
  63. _loadUserInterface: function(){
  64. var css = Object.clone(this.form.css["el-container-header"]);
  65. if (this.json.recoveryStyles){
  66. var keys = Object.keys(css);
  67. keys.forEach(function(key){
  68. if (this.json.recoveryStyles[key]) delete css[key];
  69. }.bind(this))
  70. }
  71. this.node.setStyles(css);
  72. //this.node.setStyles(this.form.css["el-container-header"]);
  73. }
  74. });
  75. MWF.xApplication.process.Xform.Elcontainer$Footer = MWF.APPElcontainer$Footer = new Class({
  76. Extends: MWF.APP$Module,
  77. _loadUserInterface: function(){
  78. var css = Object.clone(this.form.css["el-container-footer"]);
  79. if (this.json.recoveryStyles){
  80. var keys = Object.keys(css);
  81. keys.forEach(function(key){
  82. if (this.json.recoveryStyles[key]) delete css[key];
  83. }.bind(this))
  84. }
  85. this.node.setStyles(css);
  86. //this.node.setStyles(this.form.css["el-container-footer"]);
  87. }
  88. });