任务文件全选复选框挪到 footer 左侧:去大圆按钮,改为方角 22×22 复选框,与行内 .file-check 风格统一但可区分
This commit is contained in:
@@ -370,30 +370,6 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
|
||||
.files-panel-header .files-panel-title {
|
||||
flex: 1; min-width: 0;
|
||||
}
|
||||
.files-panel-header-ops {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
}
|
||||
.files-panel-toggle {
|
||||
width: 32px; height: 32px; border-radius: 50%;
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
background: var(--surface); color: var(--gray);
|
||||
border: none; cursor: pointer; padding: 0;
|
||||
position: relative;
|
||||
transition: background .15s ease, color .15s ease, opacity .15s ease;
|
||||
}
|
||||
.files-panel-toggle:active:not([disabled]) { background: var(--active-soft); }
|
||||
.files-panel-toggle[disabled] { opacity: .5; cursor: not-allowed; }
|
||||
.files-panel-toggle svg {
|
||||
position: absolute;
|
||||
width: 18px; height: 18px;
|
||||
fill: none; stroke: currentColor;
|
||||
stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
|
||||
display: none;
|
||||
}
|
||||
/* 三个状态:none -> +,some -> −,all -> √ */
|
||||
.files-panel-toggle[data-state="none"] .ic-plus { display: block; color: var(--active); }
|
||||
.files-panel-toggle[data-state="some"] .ic-minus { display: block; color: var(--active); }
|
||||
.files-panel-toggle[data-state="all"] .ic-check { display: block; color: var(--active); }
|
||||
/* 上传总进度条(.files-panel-header 中间,上传中显示):[轨道 | 百分比] 横排,
|
||||
百分比走正常文档流,不再悬浮在 6px 高的轨道里,避免各种裁剪/像素取整导致文字显示不全 */
|
||||
.files-panel-progress {
|
||||
@@ -443,6 +419,9 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
|
||||
.files-panel-count {
|
||||
font-size: 13px; color: var(--gray);
|
||||
}
|
||||
.files-panel-footer-left {
|
||||
display: flex; align-items: center; gap: 10px; min-width: 0;
|
||||
}
|
||||
.files-panel-actions {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
}
|
||||
@@ -501,6 +480,23 @@ footer { flex: none; padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0
|
||||
}
|
||||
.files-panel .file-row.selected .file-check::after { opacity: 1; }
|
||||
|
||||
/* 底部"全选"复选框:复用 .file-check 的尺寸与对勾伪元素,但用方角、与行内圆区分开。
|
||||
状态由 data-state 决定(不进 .file-row);仅 .files-panel-check 选择器优先级高于 .file-check。 */
|
||||
.files-panel .files-panel-check {
|
||||
border-radius: 5px; /* 覆盖行内 50%,变方角 */
|
||||
margin-top: 0; /* 覆盖行内 2px 偏移 */
|
||||
transition: border-color .15s ease, background .15s ease, opacity .15s ease;
|
||||
}
|
||||
.files-panel-check[data-state="all"] {
|
||||
background: var(--active); border-color: var(--active);
|
||||
}
|
||||
.files-panel-check[data-state="all"]::after { opacity: 1; }
|
||||
.files-panel-check[data-state="some"] {
|
||||
background: var(--active); border-color: var(--active);
|
||||
}
|
||||
.files-panel-check[data-state="some"]::after { opacity: 1; } /* 部分选中:同一表现,避免误导 */
|
||||
.files-panel-check[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
|
||||
|
||||
/* 主区域:名称 + 副信息(图标 + 大小) */
|
||||
.files-panel .file-main {
|
||||
flex: 1; min-width: 0;
|
||||
|
||||
@@ -113,17 +113,10 @@
|
||||
<div class="files-panel" id="files-panel" aria-label="任务文件">
|
||||
<div class="files-panel-header">
|
||||
<span class="files-panel-title">任务文件</span>
|
||||
<div class="files-panel-header-ops">
|
||||
<button class="files-panel-toggle" id="files-toggle-all" title="全选" aria-label="全选" aria-pressed="false" disabled>
|
||||
<svg class="ic-check" viewBox="0 0 24 24"><polyline points="20 6 9 17 4 12"></polyline></svg>
|
||||
<svg class="ic-minus" viewBox="0 0 24 24"><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
||||
<svg class="ic-plus" viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
||||
</button>
|
||||
<label class="file-upload" title="上传文件" aria-label="上传文件">
|
||||
<input type="file" id="file-input" multiple hidden>
|
||||
<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
||||
</label>
|
||||
</div>
|
||||
<label class="file-upload" title="上传文件" aria-label="上传文件">
|
||||
<input type="file" id="file-input" multiple hidden>
|
||||
<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
||||
</label>
|
||||
</div>
|
||||
<div class="files-list" id="files-list"></div>
|
||||
<div class="files-panel-progress hidden" id="fp-progress" aria-live="polite">
|
||||
@@ -131,7 +124,10 @@
|
||||
<span class="pct" id="fp-progress-pct">0%</span>
|
||||
</div>
|
||||
<div class="files-panel-footer">
|
||||
<span class="files-panel-count" id="files-count">未选择文件</span>
|
||||
<div class="files-panel-footer-left">
|
||||
<span class="files-panel-check" id="files-toggle-all" role="checkbox" aria-checked="false" aria-label="全选" title="全选" tabindex="0"></span>
|
||||
<span class="files-panel-count" id="files-count">未选择文件</span>
|
||||
</div>
|
||||
<div class="files-panel-actions">
|
||||
<button class="files-fab" id="files-bulk-download" title="批量下载" aria-label="批量下载" disabled>
|
||||
<svg viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg>
|
||||
@@ -1321,12 +1317,15 @@
|
||||
if (delBtn) delBtn.disabled = n === 0;
|
||||
// 全选按钮:没有文件时禁用;全部选中=打勾态;部分选中=减号态;都未选=加号态
|
||||
if (togBtn) {
|
||||
togBtn.disabled = total === 0;
|
||||
// span 没有 disabled 属性,用 aria-disabled + tabindex 控制交互能力
|
||||
const disabled = total === 0;
|
||||
togBtn.setAttribute('aria-disabled', disabled ? 'true' : 'false');
|
||||
togBtn.tabIndex = disabled ? -1 : 0;
|
||||
let state = 'none';
|
||||
if (n === total && total > 0) state = 'all';
|
||||
else if (n > 0) state = 'some';
|
||||
togBtn.dataset.state = state;
|
||||
togBtn.setAttribute('aria-pressed', n > 0 ? 'true' : 'false');
|
||||
togBtn.setAttribute('aria-checked', n === total && total > 0 ? 'true' : (n > 0 ? 'mixed' : 'false'));
|
||||
togBtn.title = state === 'all' ? '取消全选' : '全选';
|
||||
togBtn.setAttribute('aria-label', state === 'all' ? '取消全选' : '全选');
|
||||
}
|
||||
@@ -1336,6 +1335,8 @@
|
||||
function toggleSelectAll() {
|
||||
const total = filesAllPaths.length;
|
||||
if (total === 0) return;
|
||||
const togBtn = $('files-toggle-all');
|
||||
if (togBtn && togBtn.getAttribute('aria-disabled') === 'true') return;
|
||||
if (fileSelected.size === total) {
|
||||
fileSelected.clear();
|
||||
} else {
|
||||
@@ -1512,7 +1513,11 @@
|
||||
}
|
||||
$('files-bulk-download').addEventListener('click', bulkDownload);
|
||||
$('files-bulk-delete').addEventListener('click', bulkDelete);
|
||||
$('files-toggle-all').addEventListener('click', toggleSelectAll);
|
||||
const togEl = $('files-toggle-all');
|
||||
togEl.addEventListener('click', toggleSelectAll);
|
||||
togEl.addEventListener('keydown', e => {
|
||||
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleSelectAll(); }
|
||||
});
|
||||
// ---------- 大图上传前压缩(同步 v1:阈值/参数由 /api/system/status 透出) ----------
|
||||
const DEFAULT_UPLOAD_CFG = { image_compress_threshold_kb: 1536, image_max_dim: 2000, image_quality: 0.85 };
|
||||
let uploadCfgCache = null;
|
||||
|
||||
Reference in New Issue
Block a user