Div.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Container", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Div = MWF.FCDiv = new Class({
  4. Extends: MWF.FC$Container,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Div/div.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Div/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Div/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "container";
  16. this.moduleName = "div";
  17. this.Node = null;
  18. this.form = form;
  19. },
  20. clearTemplateStyles: function(styles){
  21. if (this.json.templateType){
  22. if (styles){
  23. if (styles[this.json.templateType]){
  24. if (styles[this.json.templateType].styles) this.removeStyles(styles[this.json.templateType].styles, "styles");
  25. if (styles[this.json.templateType].inputStyles) this.removeStyles(styles[this.json.templateType].inputStyles, "inputStyles");
  26. if (styles[this.json.templateType].properties) this.removeStyles(styles[this.json.templateType].properties, "properties");
  27. }
  28. }
  29. }
  30. },
  31. setTemplateStyles: function(styles){
  32. if (this.json.templateType){
  33. if (styles[this.json.templateType].styles) this.copyStyles(styles[this.json.templateType].styles, "styles");
  34. if (styles[this.json.templateType].properties) this.copyStyles(styles[this.json.templateType].properties, "properties");
  35. }
  36. },
  37. _createMoveNode: function(){
  38. this.moveNode = new Element("div", {
  39. "MWFType": "div",
  40. "id": this.json.id,
  41. "styles": this.css.moduleNodeMove,
  42. "events": {
  43. "selectstart": function(){
  44. return false;
  45. }
  46. }
  47. }).inject(this.form.container);
  48. },
  49. _setEditStyle_custom: function(name, obj, oldValue){
  50. if (name=="templateType"){
  51. if (this.form.templateStyles){
  52. var moduleStyles = this.form.templateStyles[this.moduleName];
  53. if (moduleStyles) {
  54. if (oldValue){
  55. if (moduleStyles[oldValue]){
  56. this.removeStyles(moduleStyles[oldValue].styles, "styles");
  57. this.removeStyles(moduleStyles[oldValue].styles, "properties");
  58. }
  59. }
  60. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].styles, "styles");
  61. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].properties, "properties");
  62. this.setPropertiesOrStyles("styles");
  63. this.setPropertiesOrStyles("properties");
  64. this.reloadMaplist();
  65. }
  66. }
  67. }
  68. }
  69. });