@churchillliving/se-ui-toolkit 6.53.721 → 6.53.722

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.
@@ -2366,7 +2366,7 @@ class GridService {
2366
2366
  return filter.value;
2367
2367
  }
2368
2368
  }
2369
- checkValidity(columns, row) {
2369
+ checkValidity(columns, row, singleCell = false) {
2370
2370
  let isValid = true;
2371
2371
  columns.map((item) => {
2372
2372
  if (item.validations && !item.disabled) {
@@ -2375,7 +2375,8 @@ class GridService {
2375
2375
  for (let i = 0; i < item.validations.length; i++) {
2376
2376
  const minMaxValidDate = calendarMinMaxValue(item, row[item.field], i);
2377
2377
  const valid = item.validations && item.header;
2378
- if (item.validations[i].type == EGridValidator.REQUIRED &&
2378
+ if (!singleCell &&
2379
+ item.validations[i].type == EGridValidator.REQUIRED &&
2379
2380
  !row[item.field] &&
2380
2381
  !item.hidden &&
2381
2382
  valid) {
@@ -6866,8 +6867,11 @@ class GridComponent {
6866
6867
  this.gridService.rowUpdate = false;
6867
6868
  }
6868
6869
  // check the validation of the field
6869
- gridValidation(columns, row) {
6870
- if (!this.gridService.checkValidity(columns, row)) {
6870
+ gridValidation(columns, row, singleCell = false) {
6871
+ if (singleCell == true) {
6872
+ columns = [{ ...columns }];
6873
+ }
6874
+ if (!this.gridService.checkValidity(columns, row, singleCell)) {
6871
6875
  let errorMessageDetails = '';
6872
6876
  columns?.forEach((column) => {
6873
6877
  if (column.errorMessage) {
@@ -6875,18 +6879,40 @@ class GridComponent {
6875
6879
  }
6876
6880
  });
6877
6881
  let isRequired = columns.some((column) => column.errorMessage && !row[column.field]);
6878
- if (isRequired) {
6882
+ if (isRequired && !singleCell) {
6879
6883
  this.alertService.error(errorMessageDetails, 5000, 'REQUIRED FIELD');
6880
6884
  }
6881
6885
  else {
6882
6886
  this.alertService.error(errorMessageDetails, 5000, 'INVALID FIELD');
6887
+ if (singleCell) {
6888
+ this.setErrorCell(columns[0], row);
6889
+ }
6883
6890
  }
6884
6891
  return false;
6885
6892
  }
6886
6893
  else {
6894
+ if (singleCell) {
6895
+ this.setErrorCell(columns[0], row);
6896
+ }
6887
6897
  return true;
6888
6898
  }
6889
6899
  }
6900
+ setErrorCell(column, row) {
6901
+ if (column.errorMessage) {
6902
+ console.log('error message: ', column.errorMessage);
6903
+ if (row[column.field.toLowerCase() + '_obj']) {
6904
+ row[column.field.toLowerCase() + '_obj'] = { ...row[column.field + '_obj'], errorMessage: column.errorMessage };
6905
+ }
6906
+ else {
6907
+ row[column.field.toLowerCase() + '_obj'] = { errorMessage: column.errorMessage };
6908
+ }
6909
+ }
6910
+ else {
6911
+ if (row[column.field.toLowerCase() + '_obj']) {
6912
+ delete row[column.field.toLowerCase() + '_obj'].errorMessage;
6913
+ }
6914
+ }
6915
+ }
6890
6916
  /**
6891
6917
  *
6892
6918
  * @param row : any
@@ -7635,6 +7661,7 @@ class GridComponent {
7635
7661
  // Invoke onChange Event
7636
7662
  onChangeEvent(column, row) {
7637
7663
  // set dropdown displayField value base on optionLabel & optionValue.
7664
+ this.gridValidation(column, row, true);
7638
7665
  this.displayFieldDropdownValue(column, row);
7639
7666
  this.onClearValue(column, row);
7640
7667
  this.browserCloseEvent(true);