gd-sprest-bs 9.5.2 → 9.5.5

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,54 @@ 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
+ // Parse the new controls
770
+ for (var i = 0; i < controls.length; i++) {
771
+ var control = controls[i].name ? form.getControl(controls[i].name) : null;
772
+ if (control) {
773
+ // Append the control
774
+ customControls.push(control);
775
+ }
776
+ }
777
+ },
778
+ appendRows: function (rows) {
779
+ // Append the controls
780
+ form.appendRows(rows);
781
+ // Parse the rows
782
+ for (var i = 0; i < rows.length; i++) {
783
+ // Parse the columns
784
+ var columns = rows[i].columns;
785
+ for (var j = 0; j < columns.length; j++) {
786
+ // Get the control
787
+ var control = columns[j].control && columns[j].control.name ? form.getControl(columns[j].control.name) : null;
788
+ if (control) {
789
+ // Append the control
790
+ customControls.push(control);
791
+ }
792
+ }
793
+ }
794
+ },
767
795
  el: form.el,
768
- getControl: function (fieldName) { return mapper[fieldName] ? mapper[fieldName].control : null; },
796
+ getControl: function (fieldName) {
797
+ // See if it's in the mapper
798
+ if (mapper[fieldName]) {
799
+ // Return the control
800
+ return mapper[fieldName].control;
801
+ }
802
+ // Parse the custom controls
803
+ for (var i = 0; i < customControls.length; i++) {
804
+ var control = customControls[i];
805
+ // See if this is the target control
806
+ if (control.props.name == fieldName) {
807
+ // Return the control
808
+ return control;
809
+ }
810
+ }
811
+ // Not found
812
+ return null;
813
+ },
769
814
  getItem: function () { return props.info.item; },
770
815
  getValues: getValues,
771
816
  isValid: function () {
@@ -781,6 +826,12 @@ exports.ListForm.renderEditForm = function (props) {
781
826
  var controlIsValid = formField.isValid();
782
827
  isValid = isValid && controlIsValid;
783
828
  }
829
+ // Parse the custom controls
830
+ for (var i = 0; i < customControls.length; i++) {
831
+ // Validate the form field and update the status flag
832
+ var controlIsValid = customControls[i].isValid;
833
+ isValid = isValid && controlIsValid;
834
+ }
784
835
  // Return the flag
785
836
  return isValid;
786
837
  },