OORadioGroup.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.Radio", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.OORadioGroup = MWF.FCOORadioGroup = new Class({
  4. Extends: MWF.FCRadio,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "OORadioGroup",
  9. "path": "../x_component_process_FormDesigner/Module/OORadioGroup/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/OORadioGroup/OORadioGroup.html",
  11. "tag": "oo-radio-group"
  12. },
  13. _createMoveNode: function(){
  14. this.moveNode = new Element("div", {
  15. "MWFType": this.options.type,
  16. "id": this.json.id,
  17. "styles": this.css.moduleNodeMove,
  18. "events": {
  19. "selectstart": function(){
  20. return false;
  21. }
  22. }
  23. }).inject(this.form.container);
  24. this._createNodeContent();
  25. },
  26. _createNodeContent: function( node ){
  27. var radioNode = new Element(this.options.tag, {
  28. styles:{"float": "left"},
  29. // "label-style": "width:6.2vw; min-width:5em; max-width:9em"
  30. }).inject(node || this.moveNode || this.node);
  31. var infoNode = new Element("div", {
  32. styles: {
  33. "display": "flex",
  34. "align-items": "center",
  35. "gap": "0.25em",
  36. "padding": "0 0.2em"
  37. }
  38. }).inject(node || this.moveNode || this.node);
  39. var icon = new Element("div", {
  40. "styles": this.css.textfieldIcon
  41. }).inject(infoNode);
  42. var text = new Element("div", {
  43. "styles": this.css.moduleText,
  44. "text": this.json.id
  45. }).inject(infoNode);
  46. },
  47. _resetModuleDomNode: function(){
  48. if (this.json.preprocessing){
  49. this.node.empty();
  50. this._createNodeContent(this.node);
  51. }
  52. },
  53. _loadNodeStyles: function(){
  54. this.node.setStyles(this.css.moduleNodeMove);
  55. },
  56. setPropertiesOrStyles: function(name){
  57. if (name==="styles"){
  58. try{
  59. this.setCustomStyles();
  60. }catch(e){}
  61. }
  62. if (name==="properties"){
  63. this.node.getElement(this.options.tag).setProperties(this.json.properties);
  64. }
  65. },
  66. setCustomStyles: function(){
  67. this._recoveryModuleData();
  68. this.node.clearStyles();
  69. if (this.node){
  70. this.node.setProperties(this.json.properties);
  71. this.node.clearStyles();
  72. this.node.setStyles(this.json.styles);
  73. }
  74. this.node.setStyles(this.css.moduleNode);
  75. if (this.initialStyles) this.node.setStyles(this.initialStyles);
  76. this._setEditStyle_custom('label');
  77. this._setEditStyle_custom('showMode');
  78. },
  79. _setEditStyle_custom: function(name){
  80. if (name==="id"){
  81. this.node.getLast().getLast().set("text", this.json.id);
  82. }
  83. if (name==="label"){
  84. this.node.getElement(this.options.tag).setAttribute("label", this.json.label||'');
  85. }
  86. if (name==="showMode"){
  87. if (this.json.showMode==="disabled"){
  88. this.node.setStyle("background-color", "#f3f3f3");
  89. this.node.getLast().getFirst().show();
  90. }else if (this.json.showMode==="read"){
  91. this.node.getLast().getFirst().hide();
  92. this.node.setStyle("background-color", "#ffffff");
  93. }else{
  94. this.node.setStyle("background-color", "#ffffff");
  95. this.node.getLast().getFirst().show();
  96. }
  97. }
  98. },
  99. setCustomInputStyles: function(){
  100. this._recoveryModuleData();
  101. },
  102. _preprocessingModuleData: function(){}
  103. });