@sumaris-net/ngx-components 1.23.31 → 1.23.33

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.
@@ -3851,10 +3851,14 @@ class AppNullForm {
3851
3851
  this.error = null;
3852
3852
  this.enabled = false;
3853
3853
  this.loading = false;
3854
+ this.touched = false;
3854
3855
  }
3855
3856
  get disabled() {
3856
3857
  return !this.enabled;
3857
3858
  }
3859
+ get untouched() {
3860
+ return !this.touched;
3861
+ }
3858
3862
  disable(opts) { }
3859
3863
  enable(opts) { }
3860
3864
  markAsPristine(opts) { }
@@ -3914,6 +3918,12 @@ class AppFormProvider {
3914
3918
  get loading() {
3915
3919
  return this.delegate.loading;
3916
3920
  }
3921
+ get touched() {
3922
+ return this.delegate.touched;
3923
+ }
3924
+ get untouched() {
3925
+ return this.delegate.untouched;
3926
+ }
3917
3927
  ready() {
3918
3928
  return this.delegate.ready();
3919
3929
  }
@@ -17732,6 +17742,10 @@ class AppForm {
17732
17742
  get empty() {
17733
17743
  return !this.form || (!this.form.dirty && !this.form.touched);
17734
17744
  }
17745
+ get touched() {
17746
+ var _a;
17747
+ return ((_a = this.form) === null || _a === void 0 ? void 0 : _a.touched) || false;
17748
+ }
17735
17749
  get untouched() {
17736
17750
  return !this.form || this.form.untouched;
17737
17751
  }
@@ -22975,6 +22989,7 @@ class AppTable {
22975
22989
  this.readySubject = new BehaviorSubject(false);
22976
22990
  this.loadingSubject = new BehaviorSubject(true);
22977
22991
  this.savingSubject = new BehaviorSubject(false);
22992
+ this.touchedSubject = new BehaviorSubject(false);
22978
22993
  this.dirtySubject = new BehaviorSubject(false);
22979
22994
  this.errorSubject = new BehaviorSubject(undefined);
22980
22995
  this.selection = new SelectionModel(true, []);
@@ -23078,6 +23093,12 @@ class AppTable {
23078
23093
  var _a;
23079
23094
  return this.editedRow && this.editedRow.editing ? (_a = this.editedRow.validator) === null || _a === void 0 ? void 0 : _a.pending : false;
23080
23095
  }
23096
+ get touched() {
23097
+ return this.touchedSubject.value;
23098
+ }
23099
+ get untouched() {
23100
+ return !this.touchedSubject.value;
23101
+ }
23081
23102
  disable(opts) {
23082
23103
  if (this.sort)
23083
23104
  this.sort.disabled = true;
@@ -23121,18 +23142,24 @@ class AppTable {
23121
23142
  }
23122
23143
  markAsUntouched(opts) {
23123
23144
  var _a;
23124
- if (this.dirtySubject.value !== false || (this.editedRow && this.editedRow.id !== this.previouslyEditedRowId)) {
23145
+ let needEmitEvent = false;
23146
+ if (this.touchedSubject.value) {
23147
+ this.touchedSubject.next(false);
23148
+ needEmitEvent = true;
23149
+ }
23150
+ if (this.dirty || (this.editedRow && this.editedRow.id !== this.previouslyEditedRowId)) {
23125
23151
  // Cancel the current editing row only if editing and if it was not previously saved
23126
- this.dirtySubject.next(false);
23127
23152
  if ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) {
23128
23153
  this.dataSource.cancelOrDelete(this.editedRow);
23154
+ // Mark row as pristine
23155
+ this.checkIfRowPristine(this.editedRow, { emitEvent: false });
23129
23156
  }
23130
23157
  this.editedRow = null;
23131
- if (!opts || opts.emitEvent !== false) {
23132
- this.markForCheck();
23133
- }
23158
+ needEmitEvent = true;
23134
23159
  }
23135
23160
  this.previouslyEditedRowId = undefined;
23161
+ if (needEmitEvent && (!opts || opts.emitEvent !== false))
23162
+ this.markForCheck();
23136
23163
  }
23137
23164
  /**
23138
23165
  * @deprecated prefer to use markAllAsTouched()
@@ -23150,11 +23177,13 @@ class AppTable {
23150
23177
  }
23151
23178
  markAllAsTouched(opts) {
23152
23179
  var _a, _b;
23180
+ if (this.touchedSubject.value !== true) {
23181
+ this.touchedSubject.next(true);
23182
+ if (!opts || opts.emitEvent !== false)
23183
+ this.markForCheck();
23184
+ }
23153
23185
  if ((_a = this.editedRow) === null || _a === void 0 ? void 0 : _a.editing) {
23154
23186
  (_b = this.editedRow.validator) === null || _b === void 0 ? void 0 : _b.markAllAsTouched();
23155
- if (!opts || opts.emitEvent !== false) {
23156
- this.markForCheck();
23157
- }
23158
23187
  }
23159
23188
  }
23160
23189
  markAsSaving(opts) {
@@ -24600,6 +24629,7 @@ class AppEditor {
24600
24629
  this.loadingSubject = new BehaviorSubject(true);
24601
24630
  this.errorSubject = new BehaviorSubject(undefined);
24602
24631
  this.savingSubject = new BehaviorSubject(false);
24632
+ this.touchedSubject = new BehaviorSubject(false);
24603
24633
  this.debug = false;
24604
24634
  this.submitted = false;
24605
24635
  this.toolbar = null;
@@ -24667,6 +24697,12 @@ class AppEditor {
24667
24697
  get loading() {
24668
24698
  return this.loadingSubject.value || (this._children && this._children.findIndex(c => c.enabled && c.loading) !== -1) || false;
24669
24699
  }
24700
+ get touched() {
24701
+ return this.touchedSubject.value || (this._children && this._children.findIndex(c => c.enabled && c.touched) !== -1) || false;
24702
+ }
24703
+ get untouched() {
24704
+ return !this.touchedSubject.value && (!this._children || this._children.findIndex(c => c.enabled && c.touched) === -1) || false;
24705
+ }
24670
24706
  get enabled() {
24671
24707
  return this._enabled;
24672
24708
  }
@@ -24746,6 +24782,9 @@ class AppEditor {
24746
24782
  }
24747
24783
  markAsUntouched(opts) {
24748
24784
  var _a;
24785
+ if (this.touchedSubject.value !== false) {
24786
+ this.touchedSubject.next(false);
24787
+ }
24749
24788
  (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsUntouched());
24750
24789
  if (!this.loading && (!opts || opts.emitEvent !== false))
24751
24790
  this.markForCheck();
@@ -24756,12 +24795,18 @@ class AppEditor {
24756
24795
  */
24757
24796
  markAsTouched(opts) {
24758
24797
  var _a;
24798
+ if (!this.touchedSubject.value !== true) {
24799
+ this.touchedSubject.next(true);
24800
+ }
24759
24801
  (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAsTouched(opts));
24760
24802
  if (!this.loading && (!opts || opts.emitEvent !== false))
24761
24803
  this.markForCheck();
24762
24804
  }
24763
24805
  markAllAsTouched(opts) {
24764
24806
  var _a;
24807
+ if (this.touchedSubject.value !== true) {
24808
+ this.touchedSubject.next(true);
24809
+ }
24765
24810
  (_a = this._children) === null || _a === void 0 ? void 0 : _a.forEach(c => c.markAllAsTouched(opts));
24766
24811
  if (!this.loading && (!opts || opts.emitEvent !== false))
24767
24812
  this.markForCheck();