Replace custom file-upload-queue.js with FilePond

- Delete file-upload-queue.js (495 lines of custom queue logic)
- Delete sortable.min.js dependency
- Add file-upload-filepond.js: thin wrapper that upgrades .tfe-file-picker
  inputs to FilePond instances with storeAsFile:true for native multipart
  form submission (no form-submit interception needed)
- Update fichiers-fragment.php: replace queue container <ul> elements
  and empty-state <p> with bare <input> elements that FilePond upgrades;
  change name attributes to queue_file[tfe][] etc. for PHP compatibility
- Update add.php, edit.php, partage/index.php: swap JS/CSS refs
- Clean up form.css: remove .fq-* and .tfe-file-queue custom styles,
  add FilePond theme overrides matching xamxam design tokens
- Update dead-code fieldset-files.php for consistency

Server-side stays unchanged: PHP receives ['queue_file']['tfe'][]
exactly as before through native multipart submission.
This commit is contained in:
Pontoporeia
2026-05-10 20:10:15 +02:00
parent 223a15b397
commit 1aff5ff46d
12 changed files with 299 additions and 659 deletions

View File

@@ -532,7 +532,7 @@
color: var(--danger, #c1121f);
}
/* ── TFE file upload queue (.tfe-file-queue) ────────────────────────────── */
/* ── TFE file upload (FilePond) ────────────────────────────────────────── */
.admin-files-fieldgroup {
display: flex;
@@ -540,124 +540,46 @@
gap: var(--space-3xs);
}
.tfe-file-picker {
font-size: var(--step--1);
background: transparent;
/* FilePond overrides to match xamxam theme */
.filepond--root {
font-family: var(--font-body, inherit);
margin-bottom: 0;
}
.filepond--panel-root {
background: var(--bg-secondary);
border: 1px dashed var(--border-primary);
padding: var(--space-3xs) var(--space-2xs);
border-radius: var(--radius);
cursor: pointer;
font-family: inherit;
width: 100%;
}
.tfe-file-picker:hover {
border-color: var(--accent-primary);
.filepond--drop-label {
color: var(--text-secondary);
font-size: var(--step--1);
}
/* New-file queue items */
.tfe-file-queue {
list-style: none;
margin: var(--space-2xs) 0 0;
padding: 0;
display: flex;
flex-direction: column;
gap: var(--space-2xs);
min-width: 0;
.filepond--label-action {
color: var(--accent-primary);
text-decoration: underline;
}
.tfe-queue-empty {
font-size: var(--step--2);
color: var(--text-tertiary);
margin: var(--space-3xs) 0 0;
}
.tfe-file-queue:not(:empty) + .tfe-queue-empty {
display: none;
}
.fq-item {
display: flex;
align-items: center;
gap: var(--space-xs);
padding: var(--space-3xs) var(--space-xs);
.filepond--item-panel {
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius);
min-width: 0;
}
.fq-icon {
font-size: 1.3rem;
line-height: 1;
flex-shrink: 0;
width: 2rem;
text-align: center;
}
.fq-info {
display: flex;
flex-direction: column;
gap: var(--space-3xs);
flex: 1;
min-width: 0;
}
.fq-name {
font-size: var(--step--1);
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 0;
min-width: 100%;
}
.fq-size {
font-size: var(--step--2);
color: var(--text-tertiary);
}
.fq-label,
.admin-file-label-input {
font-size: var(--step--2);
font-family: inherit;
background: transparent;
border: none;
border-bottom: 1px solid var(--border-primary);
padding: 2px 0;
width: 100%;
.filepond--file-info-main {
color: var(--text-primary);
border-radius: 0;
}
.fq-label:focus,
.admin-file-label-input:focus {
outline: none;
border-bottom-color: var(--accent-primary);
}
.fq-remove {
flex-shrink: 0;
}
.fq-drag-handle {
flex-shrink: 0;
cursor: grab;
.filepond--file-info-sub {
color: var(--text-tertiary);
font-size: 1.1rem;
line-height: 1;
padding: 0 var(--space-3xs);
user-select: none;
touch-action: none;
}
.fq-drag-handle:active {
cursor: grabbing;
.filepond--file-action-button {
color: var(--text-secondary);
}
.fq-container {
/* wrapper div emitted by renderQueueFragment */
.filepond--file-action-button:hover {
color: var(--error);
}
/* ── Existing-files list (edit form) ─────────────────────────────────────── */