mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 07:50:08 +08:00
Mark fields as dirty on changes
- Mark all fields that call formControl setValue as dirty -- set value does not mark the field as dirty - The isDirty flag is used to calculate if the record was changed
This commit is contained in:
parent
bf4bce5945
commit
8ad9d8474b
8 changed files with 18 additions and 0 deletions
|
@ -15,5 +15,7 @@ export class BaseBooleanComponent extends BaseFieldComponent {
|
|||
}
|
||||
|
||||
this.field.value = newValue;
|
||||
this.field.formControl.setValue(newValue);
|
||||
this.field.formControl.markAsDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ export class BooleanFilterFieldComponent extends BaseEnumComponent implements On
|
|||
if (item && item.value) {
|
||||
this.field.value = item.value;
|
||||
this.field.formControl.setValue(item.value);
|
||||
this.field.formControl.markAsDirty();
|
||||
this.field.criteria.operator = '=';
|
||||
this.field.criteria.values = [item.value];
|
||||
return;
|
||||
|
@ -39,6 +40,7 @@ export class BooleanFilterFieldComponent extends BaseEnumComponent implements On
|
|||
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
this.selectedValues = [];
|
||||
this.field.criteria.operator = '';
|
||||
this.field.criteria.values = [];
|
||||
|
@ -49,6 +51,7 @@ export class BooleanFilterFieldComponent extends BaseEnumComponent implements On
|
|||
public onRemove(): void {
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
this.field.criteria.operator = '';
|
||||
this.field.criteria.values = [];
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -25,11 +25,13 @@ export class DynamicEnumEditFieldComponent extends BaseEnumComponent {
|
|||
if (item && item.value) {
|
||||
this.field.value = item.value;
|
||||
this.field.formControl.setValue(item.value);
|
||||
this.field.formControl.markAsDirty();
|
||||
return;
|
||||
}
|
||||
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
this.selectedValues = [];
|
||||
|
||||
return;
|
||||
|
@ -38,6 +40,7 @@ export class DynamicEnumEditFieldComponent extends BaseEnumComponent {
|
|||
public onRemove(): void {
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
setTimeout(() => {
|
||||
this.tag.focus(true, true);
|
||||
this.tag.dropdown.show();
|
||||
|
|
|
@ -25,11 +25,13 @@ export class EnumEditFieldComponent extends BaseEnumComponent {
|
|||
if (item && item.value) {
|
||||
this.field.value = item.value;
|
||||
this.field.formControl.setValue(item.value);
|
||||
this.field.formControl.markAsDirty();
|
||||
return;
|
||||
}
|
||||
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
this.selectedValues = [];
|
||||
|
||||
return;
|
||||
|
@ -38,6 +40,7 @@ export class EnumEditFieldComponent extends BaseEnumComponent {
|
|||
public onRemove(): void {
|
||||
this.field.value = '';
|
||||
this.field.formControl.setValue('');
|
||||
this.field.formControl.markAsDirty();
|
||||
setTimeout(() => {
|
||||
this.tag.focus(true, true);
|
||||
this.tag.dropdown.show();
|
||||
|
|
|
@ -25,6 +25,7 @@ export class MultiEnumEditFieldComponent extends BaseMultiEnumComponent {
|
|||
const value = this.selectedValues.map(option => option.value);
|
||||
this.field.valueList = value;
|
||||
this.field.formControl.setValue(value);
|
||||
this.field.formControl.markAsDirty();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -33,6 +34,8 @@ export class MultiEnumEditFieldComponent extends BaseMultiEnumComponent {
|
|||
const value = this.selectedValues.map(option => option.value);
|
||||
this.field.valueList = value;
|
||||
this.field.formControl.setValue(value);
|
||||
this.field.formControl.markAsDirty();
|
||||
|
||||
setTimeout(() => {
|
||||
this.tag.focus(true, true);
|
||||
this.tag.dropdown.show();
|
||||
|
|
|
@ -33,6 +33,7 @@ export class MultiEnumFilterFieldComponent extends BaseMultiEnumComponent implem
|
|||
const value = this.selectedValues.map(option => option.value);
|
||||
this.field.valueList = value;
|
||||
this.field.formControl.setValue(value);
|
||||
this.field.formControl.markAsDirty();
|
||||
this.field.criteria.operator = '=';
|
||||
this.field.criteria.values = value;
|
||||
|
||||
|
@ -48,6 +49,7 @@ export class MultiEnumFilterFieldComponent extends BaseMultiEnumComponent implem
|
|||
|
||||
this.field.valueList = value;
|
||||
this.field.formControl.setValue(value);
|
||||
this.field.formControl.markAsDirty();
|
||||
this.field.criteria.operator = '=';
|
||||
this.field.criteria.values = value;
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -56,5 +56,6 @@ export class RelateEditFieldComponent extends BaseRelateComponent {
|
|||
this.field.value = relateValue;
|
||||
this.field.valueObject = relate;
|
||||
this.field.formControl.setValue(relateValue);
|
||||
this.field.formControl.markAsDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ export class VarcharFilterFieldComponent extends BaseFieldComponent implements O
|
|||
this.field.value = current;
|
||||
const formattedValue = this.typeFormatter.toUserFormat(this.field.type, current, {mode: 'edit'});
|
||||
this.field.formControl.setValue(formattedValue);
|
||||
this.field.formControl.markAsDirty();
|
||||
|
||||
this.subscribeValueChanges();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue