@c8y/ngx-components 1024.15.7 → 1024.15.13

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.
@@ -613,6 +613,28 @@ class DefaultAssetTableGridColumn extends CustomColumnExtended {
613
613
  this.cellRendererComponent = DefaultCellRendererComponent;
614
614
  this.filterable = true;
615
615
  this.sortable = true;
616
+ // The inherited value entries are optional, so blank ones stay valid on their own. Adding or
617
+ // removing an entry marks the form as dirty, which would enable "Apply" for a filter that has
618
+ // nothing to filter by. Wrapping the inherited fields in a key-less group keeps the model flat
619
+ // while letting a group validator require at least one actual value.
620
+ this.filteringConfig = {
621
+ ...this.filteringConfig,
622
+ fields: [
623
+ {
624
+ fieldGroup: this.filteringConfig.fields,
625
+ validators: {
626
+ atLeastOneFilled: {
627
+ expression: (formGroup) => !!formGroup.get('exists')?.value || this.hasValueEntry(formGroup),
628
+ message: gettext('Specify at least one value.')
629
+ }
630
+ }
631
+ }
632
+ ]
633
+ };
634
+ }
635
+ hasValueEntry(formGroup) {
636
+ const entries = formGroup.get('equals')?.value ?? [];
637
+ return entries.some(entry => (typeof entry === 'string' ? entry.trim() !== '' : entry != null));
616
638
  }
617
639
  }
618
640