Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

textbox.component.js 5.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. var Unibase;
  2. (function (Unibase) {
  3. let Forms;
  4. (function (Forms) {
  5. let Controls;
  6. (function (Controls) {
  7. class TextBox {
  8. init(formpropertyid, prop, callback) {
  9. var instance = TextBox.Instance();
  10. instance.loadControlSettings(prop.ControlJsonText, prop.UniqueId);
  11. instance.loadPropertySettings(prop.PropertySettings, prop.UniqueId);
  12. if (callback != null)
  13. callback();
  14. }
  15. loadControl(containerid, prop) {
  16. var regExpr = "";
  17. var ErrMsg = "";
  18. var validationlist = prop.Validations;
  19. if (validationlist != null) {
  20. for (var i = 0; i < validationlist.length; i++) {
  21. regExpr += validationlist[i].RegularExp + '||';
  22. ErrMsg += validationlist[i].ErrorMessage + '||';
  23. }
  24. }
  25. var Isrequired = prop.IsRequired != true ? 'hidden' : '';
  26. var requiredClass = prop.IsRequired != true ? '' : 'required';
  27. var reqMark = prop.IsRequired != true ? '' : '*';
  28. var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
  29. if (prop.IncludedStages != null && prop.IncludedStages != "") {
  30. var StagesForRequired = prop.IncludedStages.split('|');
  31. Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
  32. requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
  33. reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
  34. }
  35. if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
  36. var ExcludedStages = prop.ExcludedStages.split('|');
  37. Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
  38. requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
  39. reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
  40. }
  41. let ControlId = 'txt_' + prop.UniqueId;
  42. if (prop.IsRequired)
  43. requiredClass = 'required';
  44. const { helpTooltipHtml, helpTextHtml, helpClass } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
  45. let html = `<div class="floating-label-form-group div_txt div_${prop.DocPropertyName} ${helpClass}" id="TxtDiv_${prop.FormPropertyId}">
  46. <label for="lbl" id="lbl_${ControlId}" class="lbl_txt">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnIsRequired_${prop.FormPropertyId}"> *</span></label>
  47. <input type="text" id="${ControlId}" class="type-control form-control type-control value-control ${requiredClass} floating-label-control txt_${prop.DocPropertyName}" placeholder="${prop.LabelName} ${reqMark}" data-placeholder="${prop.Placeholder}" data-label="${prop.LabelName} ${reqMark}" data-regularexp="${regExpr}" data-validatemsg="${ErrMsg}">
  48. <input type="hidden" id="hf_${prop.ControlId}" />
  49. ${helpTextHtml}
  50. </div>`;
  51. $("#" + containerid).append(html);
  52. }
  53. loadControlSettings(controlsettingjson, formpropertyid) {
  54. return null;
  55. }
  56. loadPropertySettings(propertysettings, formpropertyid) {
  57. if (propertysettings != null) {
  58. for (var i = 0; i < propertysettings.length; i++) {
  59. var data = propertysettings[i];
  60. if (data.ControlPropertyName == "MaxLength" && data.ControlPropertyValue != "") {
  61. $("#txt_" + formpropertyid).attr("MaxLength", data.ControlPropertyValue);
  62. }
  63. }
  64. }
  65. }
  66. bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
  67. if (propval == 'null')
  68. propval = '';
  69. var decodeText = unescape(propval);
  70. $("#txt_" + formpropertyid).val(decodeText);
  71. if (decodeText != "") {
  72. $("#TxtDiv_" + formpropertyid).addClass("floating-label-form-group-with-value");
  73. }
  74. }
  75. static Instance() {
  76. if (this.instance === undefined) {
  77. this.instance = new TextBox();
  78. }
  79. return this.instance;
  80. }
  81. }
  82. Controls.TextBox = TextBox;
  83. })(Controls = Forms.Controls || (Forms.Controls = {}));
  84. })(Forms = Unibase.Forms || (Unibase.Forms = {}));
  85. })(Unibase || (Unibase = {}));