Select.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Select = MWF.FCSelect = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Select/select.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Select/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Select/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "select";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. _createMoveNode: function(){
  22. this.moveNode = new Element("div", {
  23. "MWFType": "select",
  24. "styles": this.css.moduleNodeMove,
  25. "id": this.json.id,
  26. "events": {
  27. "selectstart": function(){
  28. return false;
  29. }
  30. }
  31. }).inject(this.form.container);
  32. var icon = new Element("div", {
  33. "styles": this.css.selectIcon
  34. }).inject(this.moveNode);
  35. var text = new Element("div", {
  36. "styles": this.css.moduleText,
  37. "text": this.json.id
  38. }).inject(this.moveNode);
  39. },
  40. _loadNodeStyles: function(){
  41. var icon = this.node.getFirst("div");
  42. var text = this.node.getLast("div");
  43. icon.setStyles(this.css.selectIcon);
  44. text.setStyles(this.css.moduleText);
  45. },
  46. _getCopyNode: function(){
  47. if (!this.copyNode) this._createCopyNode();
  48. this.copyNode.setStyle("display", "inline-block");
  49. return this.copyNode;
  50. },
  51. _setEditStyle_custom: function(name){
  52. if (name=="styles"){
  53. if (this.parentContainer){
  54. if (this.parentContainer.moduleName == "datagrid$Data"){
  55. if (!this.json.styles.width) this.json.styles.width = "90%";
  56. }
  57. }
  58. this.setCustomStyles();
  59. }
  60. if (name=="id"){
  61. this.node.getLast().set("text", this.json.id);
  62. }
  63. }
  64. });