Skip to content

Commit

Permalink
refactor: make the showValidationSummaryText( ) method public
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Jan 26, 2021
1 parent b5babc3 commit bb949fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,20 @@ export class SlickCompositeEditorComponent implements ExternalResource {
}
}

/** Show a Validation Summary text (as a <div>) when a validation fails or simply hide it when there's no error */
showValidationSummaryText(isShowing: boolean, errorMsg = '') {
if (isShowing) {
this._modalBodyTopValidationElm.textContent = errorMsg;
this._modalBodyTopValidationElm.style.display = 'block';
this._modalBodyTopValidationElm.scrollIntoView?.();
this._modalSaveButtonElm.disabled = false;
this._modalSaveButtonElm.classList.remove('saving');
} else {
this._modalBodyTopValidationElm.style.display = 'none';
this._modalBodyTopValidationElm.textContent = errorMsg;
}
}

// --
// private methods
// ----------------
Expand Down Expand Up @@ -832,20 +846,6 @@ export class SlickCompositeEditorComponent implements ExternalResource {
dataView.updateItem(this._originalDataContext[idPropName], this._originalDataContext);
}

/** Show the Validation Summary text (as a <div>) when a validation fails or simply hide it when there's no error */
private showValidationSummaryText(isShowing: boolean, errorMsg = '') {
if (isShowing) {
this._modalBodyTopValidationElm.textContent = errorMsg;
this._modalBodyTopValidationElm.style.display = 'block';
this._modalBodyTopValidationElm.scrollIntoView?.();
this._modalSaveButtonElm.disabled = false;
this._modalSaveButtonElm.classList.remove('saving');
} else {
this._modalBodyTopValidationElm.style.display = 'none';
this._modalBodyTopValidationElm.textContent = errorMsg;
}
}

/** Validate all the Composite Editors that are defined in the form */
private validateCompositeEditors(targetElm?: HTMLElement): EditorValidationResult {
let validationResults: EditorValidationResult = { valid: true, msg: '' };
Expand Down
Binary file not shown.

0 comments on commit bb949fe

Please sign in to comment.