fix(ui) : remove legacy edit pages and history composables, unify create/edit forms

Consolidate create and edit pages into single create pages with edit mode support.
Remove obsolete catalog pages, history composables, and fix remaining code review issues.
Include migration to relink orphaned custom fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 11:19:50 +02:00
parent cfaf234419
commit 201485552a
29 changed files with 875 additions and 2748 deletions

View File

@@ -5,6 +5,13 @@
* copy of extractCollection (parsing hydra:member / member / data / array).
*/
export function extractTotal(payload: unknown, fallbackLength: number): number {
const p = payload as Record<string, unknown> | null
if (typeof p?.totalItems === 'number') return p.totalItems
if (typeof p?.['hydra:totalItems'] === 'number') return p['hydra:totalItems']
return fallbackLength
}
export function extractCollection<T = any>(payload: unknown): T[] {
if (Array.isArray(payload)) return payload as T[]
const p = payload as Record<string, unknown> | null

View File

@@ -285,12 +285,14 @@ export function fieldKey(field: CustomFieldInput, index: number): string {
/** Whether a field should be persisted (non-empty value) */
export function shouldPersist(field: CustomFieldInput): boolean {
if (field.type === 'boolean') return field.value === 'true' || field.value === 'false'
if (typeof field.value === 'number') return !Number.isNaN(field.value)
return typeof field.value === 'string' && field.value.trim() !== ''
}
/** Format value for save (trim, boolean coercion) */
export function formatValueForSave(field: CustomFieldInput): string {
if (field.type === 'boolean') return field.value === 'true' ? 'true' : 'false'
if (typeof field.value === 'number') return String(field.value)
return typeof field.value === 'string' ? field.value.trim() : ''
}