@zambon-dev/framework 1.3.1 → 1.4.0

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.
package/CHANGELOG.md CHANGED
@@ -23,6 +23,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
23
 
24
24
  ### ⚠ Breaking Changes / Migration
25
25
 
26
+ ## [1.4.0] - 2026-09-16
27
+
28
+ ### Changed
29
+
30
+ - **`framework-button-filters` no longer submits the labels of catalog selections.** A filters
31
+ form reads its values straight off the form, so the display control `lib-catalog-select` adds
32
+ for its own use went to the backend beside the real filters — a request filtering by employee
33
+ carried `employeeName: "753 - ADEMILSON LOPES MAGALHAES"` next to `employeeID: 125`.
34
+
35
+ They were ignored, being filters no service declares, but the day one does filter by a name it
36
+ would receive the formatted label rather than the stored value and quietly match nothing.
37
+
38
+ The labels are still **kept** for the modal: reopening it patches them back into the form, and a
39
+ catalog select backed by a `searchEndpoint` cannot recover its text from the identifier alone —
40
+ it only resolves a display out of a local entries list. Dropping them from what is stored would
41
+ have left the field showing a selection with nothing written in it.
42
+
43
+ ### ⚠ Breaking Changes / Migration
44
+
45
+ - **Upgrade `@zambon-dev/library` together with this release.** The peer range moved from
46
+ `^1.0.0` to `^1.6.0`, because `framework-button-filters` now imports `DisplayControls` from it.
47
+ On an older library that export does not exist, and the filters button fails — at build time if
48
+ the bundler checks exports, otherwise the first time a filter is submitted. The old range would
49
+ have let npm resolve that combination without a word of warning.
50
+
51
+ - **A backend no longer receives the label of a catalog selection.** If one of your services
52
+ filters by a key that a `lib-catalog-select` uses as its `displayControlName` — the `xxxName`
53
+ that comes paired with an `xxxID` — that filter now arrives empty and the query stops narrowing,
54
+ silently returning more rows than before rather than failing.
55
+
56
+ To check, take each filters form and, for every `lib-catalog-select` in it, note the
57
+ `displayControlName`. Then look for a `TryFilter` on that name in the service behind the list.
58
+ Any hit has to move to the identifier instead: the label was never the stored value — it is what
59
+ the catalog chose to display, so filtering by it was already matching on formatting.
60
+
26
61
  ## [1.3.1] - 2026-09-10
27
62
 
28
63
  ### Fixed
@@ -142,7 +177,8 @@ None.
142
177
  available via [GitHub Releases](https://github.com/RicardoZambon/ZLibraries/releases) and the
143
178
  `framework-v*` tags.
144
179
 
145
- [Unreleased]: https://github.com/RicardoZambon/ZLibraries/compare/framework-v1.3.1...HEAD
180
+ [Unreleased]: https://github.com/RicardoZambon/ZLibraries/compare/framework-v1.4.0...HEAD
181
+ [1.4.0]: https://github.com/RicardoZambon/ZLibraries/releases/tag/framework-v1.4.0
146
182
  [1.3.1]: https://github.com/RicardoZambon/ZLibraries/releases/tag/framework-v1.3.1
147
183
  [1.3.0]: https://github.com/RicardoZambon/ZLibraries/releases/tag/framework-v1.3.0
148
184
  [1.2.1]: https://github.com/RicardoZambon/ZLibraries/releases/tag/framework-v1.2.1
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, ApplicationRef, Inject, Injectable, Component, ViewChild, Input, EventEmitter, Output, NgModule, forwardRef, ChangeDetectorRef, InjectionToken } from '@angular/core';
3
3
  import * as i1$2 from '@zambon-dev/library';
4
- import { RibbonGroupChild, RibbonButtonComponent, DataProviderService, FormService, ModalComponent, DataGridDataset, MultiSelectResultDataset, RouterFormatter, MultiEditorComponent, MultiEditorDataset, MultiSelectComponent, RibbonComponent, GroupContainerComponent, RibbonGroupComponent, DataGridConfigsProvider } from '@zambon-dev/library';
4
+ import { RibbonGroupChild, RibbonButtonComponent, DataProviderService, FormService, ModalComponent, DataGridDataset, DisplayControls, MultiSelectResultDataset, RouterFormatter, MultiEditorComponent, MultiEditorDataset, MultiSelectComponent, RibbonComponent, GroupContainerComponent, RibbonGroupComponent, DataGridConfigsProvider } from '@zambon-dev/library';
5
5
  export { DateValidators } from '@zambon-dev/library';
6
6
  import { ReplaySubject, take, map, switchMap, of, Subject, takeUntil, filter, skip, tap, throwError } from 'rxjs';
7
7
  import { __decorate } from 'tslib';
@@ -1463,14 +1463,35 @@ class ButtonFiltersComponent extends BaseButton {
1463
1463
  //#endregion
1464
1464
  //#region Public methods
1465
1465
  setFilters(filters) {
1466
+ // Kept whole, because reopening the modal patches this straight back into the form and a
1467
+ // catalog select backed by a search endpoint cannot recover its label from the identifier --
1468
+ // it only resolves a display from a local entries list. Dropping the labels here would leave
1469
+ // the field showing a selection with no text.
1466
1470
  this.filters = filters;
1467
1471
  if (this.hasFiltersApplied) {
1468
- this.gridDataset.setFilters(filters);
1472
+ this.gridDataset.setFilters(this.withoutDisplayControls(filters));
1469
1473
  }
1470
1474
  else {
1471
1475
  this.gridDataset.setFilters();
1472
1476
  }
1473
1477
  }
1478
+ //#endregion
1479
+ //#region Private methods
1480
+ /**
1481
+ * Drops the controls that only hold a catalog selection's label.
1482
+ *
1483
+ * They are half of how `lib-catalog-select` works and are created by it, so a screen never asked
1484
+ * for them and a backend has no filter behind them. Sent anyway they are dead weight, and worse:
1485
+ * the day a service does filter by a name, it would receive the formatted label rather than the
1486
+ * stored value and quietly match nothing.
1487
+ *
1488
+ * @param filters The filters as submitted.
1489
+ * @returns The filters a backend should receive.
1490
+ */
1491
+ withoutDisplayControls(filters) {
1492
+ return Object.fromEntries(Object.entries(filters)
1493
+ .filter(([key]) => !DisplayControls.isDisplayControl(this.formGroup.form.get(key))));
1494
+ }
1474
1495
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: ButtonFiltersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1475
1496
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.6", type: ButtonFiltersComponent, isStandalone: true, selector: "framework-button-filters", inputs: { modalSize: "modalSize", modalTitle: "modalTitle", validateFormFunction: "validateFormFunction" }, providers: [
1476
1497
  FormService,