Div.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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]){
  34. if (styles[this.json.templateType].styles) this.copyStyles(styles[this.json.templateType].styles, "styles");
  35. if (styles[this.json.templateType].properties) this.copyStyles(styles[this.json.templateType].properties, "properties");
  36. }
  37. }
  38. },
  39. _createMoveNode: function(){
  40. this.moveNode = new Element("div", {
  41. "MWFType": "div",
  42. "id": this.json.id,
  43. "styles": this.css.moduleNodeMove,
  44. "events": {
  45. "selectstart": function(){
  46. return false;
  47. }
  48. }
  49. }).inject(this.form.container);
  50. },
  51. _setEditStyle_custom: function(name, obj, oldValue){
  52. if (name=="templateType"){
  53. if (this.form.templateStyles){
  54. var moduleStyles = this.form.templateStyles[this.moduleName];
  55. if (moduleStyles) {
  56. if (oldValue){
  57. if (moduleStyles[oldValue]){
  58. this.removeStyles(moduleStyles[oldValue].styles, "styles");
  59. this.removeStyles(moduleStyles[oldValue].styles, "properties");
  60. }
  61. }
  62. if (moduleStyles[this.json.templateType]){
  63. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].styles, "styles");
  64. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].properties, "properties");
  65. }
  66. this.setPropertiesOrStyles("styles");
  67. this.setPropertiesOrStyles("properties");
  68. this.reloadMaplist();
  69. }
  70. }
  71. }
  72. }
  73. });