gd-sprest-bs 9.5.3 → 9.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -282,6 +282,7 @@ exports.ListForm.renderDisplayForm = function (props) {
282
282
  };
283
283
  // Render the edit form
284
284
  exports.ListForm.renderEditForm = function (props) {
285
+ var customControls = [];
285
286
  var mapper = {};
286
287
  var rows = [];
287
288
  var value = {};
@@ -762,10 +763,60 @@ exports.ListForm.renderEditForm = function (props) {
762
763
  };
763
764
  // Create the form object
764
765
  var formObj = {
765
- appendControls: function (controls) { form.appendControls(controls); },
766
- appendRows: function (rows) { form.appendRows(rows); },
766
+ appendControls: function (controls) {
767
+ // Append the controls
768
+ form.appendControls(controls);
769
+ // Wait for the controls to be loaded
770
+ setTimeout(function () {
771
+ // Parse the new controls
772
+ for (var i = 0; i < controls.length; i++) {
773
+ var control = controls[i].name ? form.getControl(controls[i].name) : null;
774
+ if (control) {
775
+ // Append the control
776
+ customControls.push(control);
777
+ }
778
+ }
779
+ }, 10);
780
+ },
781
+ appendRows: function (rows) {
782
+ // Append the controls
783
+ form.appendRows(rows);
784
+ // Wait for the controls to be loaded
785
+ setTimeout(function () {
786
+ // Parse the rows
787
+ for (var i = 0; i < rows.length; i++) {
788
+ // Parse the columns
789
+ var columns = rows[i].columns;
790
+ for (var j = 0; j < columns.length; j++) {
791
+ // Get the control
792
+ var control = columns[j].control && columns[j].control.name ? form.getControl(columns[j].control.name) : null;
793
+ if (control) {
794
+ // Append the control
795
+ customControls.push(control);
796
+ }
797
+ }
798
+ }
799
+ }, 10);
800
+ },
767
801
  el: form.el,
768
- getControl: function (fieldName) { return mapper[fieldName] ? mapper[fieldName].control : null; },
802
+ getControl: function (fieldName) {
803
+ // See if it's in the mapper
804
+ if (mapper[fieldName]) {
805
+ // Return the control
806
+ return mapper[fieldName].control;
807
+ }
808
+ // Parse the custom controls
809
+ for (var i = 0; i < customControls.length; i++) {
810
+ var control = customControls[i];
811
+ // See if this is the target control
812
+ if (control.props.name == fieldName) {
813
+ // Return the control
814
+ return control;
815
+ }
816
+ }
817
+ // Not found
818
+ return null;
819
+ },
769
820
  getItem: function () { return props.info.item; },
770
821
  getValues: getValues,
771
822
  isValid: function () {
@@ -781,6 +832,12 @@ exports.ListForm.renderEditForm = function (props) {
781
832
  var controlIsValid = formField.isValid();
782
833
  isValid = isValid && controlIsValid;
783
834
  }
835
+ // Parse the custom controls
836
+ for (var i = 0; i < customControls.length; i++) {
837
+ // Validate the form field and update the status flag
838
+ var controlIsValid = customControls[i].isValid;
839
+ isValid = isValid && controlIsValid;
840
+ }
784
841
  // Return the flag
785
842
  return isValid;
786
843
  },