feat(gallery): OR/exclude tag filtering — light chips + advanced builder (#6b/c/d)
Cluster A, milestone #97. Completes the frontend of the structured tag filter
(backend landed in 23fab98).
#6b store: gallery.filter gains tag_or (OR-groups) + tag_exclude; one model,
serialized via tag_or (repeated key) + tag_not across activeFilterParam/
filterToQuery/applyFilterFromQuery/cloneFilter/loadSimilar; _resolveLabels
resolves names for every referenced id. useApi now appends array param values
as a repeated key (tag_or=a&tag_or=b).
#6c light editor (GalleryFilterBar): autocomplete pick → include chip; click a
chip body to flip include↔exclude (exclude = red minus); ✕ removes. An
"N OR-groups" chip + an Advanced button open the builder.
#6d advanced editor (TagQueryBuilder.vue + common/TagPicker.vue): AND-of-OR
group builder + NOT list. Unifies includes+OR-groups into one groups view,
splits back to tag_ids/tag_or on Apply so the URL stays compact. Writes the
same model the light chips edit.
Store serialization round-trip tests added.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XCUHUGQLrBrkgyk1t49kpX
This commit is contained in:
@@ -15,7 +15,16 @@ async function request(method, url, { body, params, signal } = {}) {
|
||||
if (params) {
|
||||
const search = new URLSearchParams()
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
if (v !== undefined && v !== null) search.set(k, String(v))
|
||||
if (v === undefined || v === null) continue
|
||||
// Array values serialize as a REPEATED key (k=a&k=b) — e.g. the
|
||||
// gallery's tag_or OR-groups, read server-side via request.args.getlist.
|
||||
if (Array.isArray(v)) {
|
||||
for (const item of v) {
|
||||
if (item !== undefined && item !== null) search.append(k, String(item))
|
||||
}
|
||||
} else {
|
||||
search.set(k, String(v))
|
||||
}
|
||||
}
|
||||
const qs = search.toString()
|
||||
if (qs) fullUrl += (url.includes('?') ? '&' : '?') + qs
|
||||
|
||||
Reference in New Issue
Block a user