OODatetime.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Input", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.OODatetime = MWF.FCOODatetime = new Class({
  4. Extends: MWF.FC$Input,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "type": "OODatetime",
  9. "path": "../x_component_process_FormDesigner/Module/OODatetime/",
  10. "propertyPath": "../x_component_process_FormDesigner/Module/OODatetime/OODatetime.html"
  11. },
  12. _loadNodeStyles: function(){
  13. this.node.setAttribute('readonly', true);
  14. this.node.setAttribute('read', true);
  15. },
  16. _setEditStyle_custom: function(name){
  17. if (name==="id") this.node.set("placeholder", this.json.id);
  18. if (["label"].includes(name)){
  19. this.node.setAttribute(name, this.json[name]);
  20. }
  21. if (name==="showMode"){
  22. if (this.json.showMode==="disabled"){
  23. this.node.setAttribute("bgcolor", "#f3f3f3");
  24. this.node.setAttribute("readmode", false);
  25. }else if (this.json.showMode==="read"){
  26. // this.node.setAttribute("readmode", true);
  27. this.node.removeAttribute("bgcolor");
  28. }else{
  29. this.node.setAttribute("readmode", false);
  30. this.node.removeAttribute("bgcolor");
  31. }
  32. }
  33. if (name==="showIcon"){
  34. if (this.json.showIcon==="yes"){
  35. this.node.setAttribute("right-icon", this.json.properties["right-icon"] || "calendar");
  36. }else{
  37. this.node.removeAttribute("right-icon", "");
  38. }
  39. }
  40. if (name==="required"){
  41. if (this.json.required){
  42. this.node.setAttribute("required", true);
  43. }else{
  44. this.node.removeAttribute("required");
  45. }
  46. }
  47. },
  48. _createMoveNode: function(){
  49. this.moveNode = new Element("oo-datetime", {
  50. "MWFType": "OODatetime",
  51. // "label-style": "width:6.2vw; min-width:5em; max-width:9em",
  52. "id": this.json.id,
  53. "styles": this.css.moduleNodeMove,
  54. "placeholder": this.json.id,
  55. "read": "true",
  56. "events": {
  57. "selectstart": function(){
  58. return false;
  59. }
  60. }
  61. }).inject(this.form.container);
  62. },
  63. setPropertiesOrStyles: function(name){
  64. if (name=="styles"){
  65. try{
  66. this.setCustomStyles();
  67. }catch(e){}
  68. }
  69. if (name=="inputStyles"){
  70. try{
  71. this.setCustomInputStyles();
  72. }catch(e){}
  73. }
  74. if (name=="properties"){
  75. this.node.setProperties(this.json.properties);
  76. }
  77. },
  78. _preprocessingModuleData: function(){
  79. this.node.clearStyles();
  80. if (this.json.styles){
  81. this.json.recoveryStyles = Object.clone(this.json.styles);
  82. this.ooinput = this.node;
  83. if (this.json.recoveryStyles) Object.each(this.json.recoveryStyles, function(value, key){
  84. if ((value.indexOf("x_processplatform_assemble_surface")==-1 && value.indexOf("x_portal_assemble_surface")==-1)){
  85. this.ooinput.setStyle(key, value);
  86. delete this.json.styles[key];
  87. }
  88. }.bind(this));
  89. }
  90. this.json.preprocessing = "y";
  91. },
  92. });