@pienter/ui 0.16.0 → 0.17.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 +14 -0
- package/package.json +1 -1
- package/utils/cms/index.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.17.0 - 2026-09-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `splitFilterValues` and `joinFilterValues` in `@pienter/ui/utils/cms`, for
|
|
10
|
+
the multi-value filter convention the backend contract now documents: a
|
|
11
|
+
filter such as `filter[type]=1,2` carries its values as one comma-separated
|
|
12
|
+
string of identifiers or enum tokens, and a numeric range is two ordinary
|
|
13
|
+
allowlisted filters, `<name>_min` and `<name>_max`. Both stay one string per
|
|
14
|
+
`filter[name]`, so `decodeListQuery`, `encodeListQuery`, the URL sync and
|
|
15
|
+
the allowlist are unchanged. `splitFilterValues('')` is `[]` and
|
|
16
|
+
`joinFilterValues([])` is `undefined`, so clearing deletes the parameter
|
|
17
|
+
rather than sending an empty string. See ADR 0009.
|
|
18
|
+
|
|
5
19
|
## 0.16.0 - 2026-09-15
|
|
6
20
|
|
|
7
21
|
### Breaking
|
package/package.json
CHANGED
package/utils/cms/index.ts
CHANGED
|
@@ -205,6 +205,19 @@ export function encodeListQuery(query: ListQuery): URLSearchParams {
|
|
|
205
205
|
return params;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/** Values of a multi-value filter, from its comma-separated wire string. */
|
|
209
|
+
export function splitFilterValues(value: string | undefined): string[] {
|
|
210
|
+
return value ? value.split(',').filter(Boolean) : [];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** The wire string of a multi-value filter; `undefined` clears the parameter. */
|
|
214
|
+
export function joinFilterValues(
|
|
215
|
+
values: readonly string[],
|
|
216
|
+
): string | undefined {
|
|
217
|
+
const joined = values.filter(Boolean).join(',');
|
|
218
|
+
return joined || undefined;
|
|
219
|
+
}
|
|
220
|
+
|
|
208
221
|
export function cloneRecord<T>(record: T): T {
|
|
209
222
|
return JSON.parse(JSON.stringify(record)) as T;
|
|
210
223
|
}
|