feat(gallery): 图库头部重排为 标题/操作/设定 三行,补齐批量插入 v3.25.39
- 标题独占一行;操作行 全选/反选/下载/插入/删除;设定行 插入尺寸/显示大小/时间筛选 - 去掉语义重复的「清除」与底部「自动清理」文案(连带删除 retentionText 死代码) - 批量插入走 refSrcOf + 压缩档 + 引用化,与单图插入同一入口 - 下拉带 2 字标签并限宽 48-72px;头部抽到 src/ui-gallery-head.js(app.js 8947→8936) - 边界快照同步新增模块与耦合面(IWBUIGalleryHead / ui-gallery-head.js)
This commit is contained in:
1 parent
cbafd38780
commit
7b34a1c0f6
11 files changed
+110
-45
No files matched your search
@@ -14,6 +14,15 @@
|
||||
> 3. 核验正式地址版本 → 之后才移动 `stable` / `stable-verified-<日期>` 标签、更新本 CHANGELOG、写 GitHub Release(`gh release create`)。
|
||||
> 测试发现问题 → 改 → 再 `deploy:test`,正式环境不受影响。回滚点 `git reset --hard stable`。
|
||||
|
||||
## v3.25.39(2026-11-20)图库头部重排:标题独占一行 + 操作行 + 设定行
|
||||
|
||||
- 图库头部改三行:**标题行**(图库 + 计数 + 已选数)、**操作行**(全选 / 反选 / 下载 / 插入 / 删除)、**设定行**(插入尺寸 / 显示大小 / 时间筛选),不再把按钮和下拉挤在标题同一行。
|
||||
- 补齐图库「插入」按钮:批量把选中图片按「插入」档压缩后插入画布(与单图插入同一入口 `refSrcOf` + 引用化)。
|
||||
- 下载 / 插入 / 删除改为常驻(未选中时半透明提示「先在图库里选中图片」),去掉语义重复的「清除」。
|
||||
- 去掉底部「自动清理:…」文案与不再使用的 `retentionText`。
|
||||
- 三个下拉各带 2 字标签并限制宽度(48–72px),窄面板换行不挤压。
|
||||
- 头部独立成组件 `src/ui-gallery-head.js`(app.js 只做装配,行数从 8947 → 8936)。
|
||||
|
||||
## v3.25.38(2026-11-20)图库自适应重做、左右栏快捷键与面板层级修正
|
||||
|
||||
- **图库图片尺寸重做**:列数改为 `floor((面板宽+8)/(图幅+8))`,图幅固定 ⇒ 同一图幅下列宽稳定(不再忽大忽小),只靠增减列数适应面板宽度;新增「图幅」选择(小 110 / 中 130 / 大 170 / 特大 220,默认中,本地持久化)。
|
||||
|
||||
@@ -4070,15 +4070,6 @@
|
||||
el.style.height = 'auto'
|
||||
el.style.height = Math.max(56, el.scrollHeight) + 'px'
|
||||
}
|
||||
// 出图清理策略文案(v2 §2.6)
|
||||
function retentionText(info) {
|
||||
const r = (info && info.retention) || null
|
||||
if (!r || r.enabled === false) return '未启用'
|
||||
const parts = []
|
||||
if (Number(r.maxDays) > 0) parts.push('保留 ' + r.maxDays + ' 天')
|
||||
if (Number(r.maxFiles) > 0) parts.push('最多 ' + r.maxFiles + ' 张')
|
||||
return parts.length ? parts.join(' / ') : '已启用'
|
||||
}
|
||||
|
||||
// ---------- result image ----------
|
||||
// 外部 UI 模块优先;单文件模式保留等价 fallback。
|
||||
@@ -5466,6 +5457,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
// 组件已收编到 src/ui-lib-sidebar.js(P2-9 组件抽取);宿主注入应用层助手
|
||||
const LibSidebar = (props) => window.IWBUILibSidebar(Object.assign({ I, api, uid, useTextDialog, TextDialog, promptGroupsOf, PluginHost, wPluginPanels }, props))
|
||||
const DockArea = (typeof window !== 'undefined') ? window.IWBDockArea : null
|
||||
const GalleryHead = (typeof window !== 'undefined') ? window.IWBUIGalleryHead : null
|
||||
// 画布标签条(阶段一组件化 2026-11-07):纯展示组件,回调与快照值经 props 注入
|
||||
const WorkspaceTabs = (props) => window.IWBUIWorkspaceTabs(Object.assign({ I }, props))
|
||||
// 应用外壳 UI(阶段一组件化):画布顶栏 / 产品导航,纯展示
|
||||
@@ -6301,6 +6293,22 @@ const tbCenterSeed = (type, refs) => {
|
||||
const addRefFromUrl = (...a) => wbCmd().addRefFromUrl(...a)
|
||||
const refreshOutputs = (...a) => wbCmd().refreshOutputs(...a); IWWorkbenchHooks.useOutputsSync(OUT_KEY, 'iwb_outputs_sync', () => refreshOutputs(histLimit))
|
||||
const deleteOutputs = (...a) => wbCmd().deleteOutputs(...a)
|
||||
// 批量插入:把图库里选中的图片按「插入尺寸」档压缩后,作为参考图节点加到画布(与单图插入同一入口)
|
||||
const insertHistorySelected = async () => {
|
||||
const list = (outputs || []).filter((f) => histSel.includes(f.name))
|
||||
if (!list.length) { showToast('先在图库里选中图片', 'err'); return }
|
||||
const added = []
|
||||
for (const f of list) {
|
||||
let src0 = await wbCmd().refSrcOf(await wResolveOutputSrc(f), (msg) => showToast(msg, 'err'))
|
||||
if (typeof src0 === 'string' && src0.indexOf('data:') === 0) src0 = await shrinkForInsert(src0)
|
||||
const ref0 = (typeof src0 === 'string' && src0.indexOf('data:') === 0) ? await wImgRefWrite(src0) : null
|
||||
const spot = findSpot('ref')
|
||||
added.push({ id: uid('n'), type: 'ref', x: spot.x, y: spot.y, data: { url: ref0 || src0 || '', data: null, name: f.name, localName: null } })
|
||||
}
|
||||
commitCanvas(refs.nodes.concat(added), undefined, undefined)
|
||||
setSel(added.map((n) => n.id))
|
||||
showToast('已插入 ' + added.length + ' 张到画布')
|
||||
}
|
||||
const loadDemo = (...a) => wbCmd().loadDemo(...a)
|
||||
const doFit = (...a) => wbCmd().doFit(...a)
|
||||
// 节点数据规范化(含旧版迁移)—— 纯逻辑,已收编到 src/canvas-normalize.js(P2-9 第一片)
|
||||
@@ -8057,30 +8065,14 @@ const tbCenterSeed = (type, refs) => {
|
||||
onInsertPrompt: (text, name) => { const id = uid('n'); const spot = findSpot('prompt'); commitCanvas(refs.nodes.concat([{ id, type: 'prompt', x: spot.x, y: spot.y, data: { text, title: name || '' } }]), undefined, undefined); setSel([id]); setNotice({ type: 'ok', text: '已插入提示词:' + (name || '') }) },
|
||||
onFlash: (t, ty) => { setNotice({ type: ty === 'err' ? 'err' : 'ok', text: t }); showToast(t, ty) } })
|
||||
const dockGalleryEl = el('div', { className: 'iwb-history-embedded' },
|
||||
el('div', { className: 'iwb-row iwb-history-head' },
|
||||
el('span', { className: 'iwb-toolbar-title' }, '图库'),
|
||||
el('span', { className: 'iwb-hint' }, histFiltered.length + ' / ' + outputs.length + ' 张'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '全选当前图库图片', onClick: selectAllHistory }, '全选'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '反选当前图库图片', onClick: invertHistorySelection }, '反选'),
|
||||
histSel.length ? el('span', { className: 'iwb-history-manage-tools' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm iwb-btn-danger', title: '删除选中的图片', onClick: () => { deleteOutputs(histSel); setHistSel([]) } }, '删除'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '下载选中的图片到本地', onClick: downloadHistorySelected }, '下载'),
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', title: '清除选择', onClick: () => setHistSel([]) }, '清除'),
|
||||
) : null,
|
||||
// 紧凑版(v3.25.19):只显示档位值,前缀「插入」放进 title 与标签里,省横向空间
|
||||
// v3.25.38:三个下拉收成一组(.iwb-history-tools),窄面板换行时整组下移,不会单个掉队
|
||||
el('span', { className: 'iwb-history-tools' },
|
||||
el('select', { className: 'iwb-input iwb-select-compact', value: insertK, onChange: (e) => setInsertKPersist(e.target.value), title: '插入画布时的图片尺寸:原图最清晰但最大;2K/1K/0.5K 会等比压到对应边长' },
|
||||
[['orig', '原图'], ['2k', '2K'], ['1k', '1K'], ['0.5k', '0.5K']].map(([v, l]) => el('option', { key: v, value: v }, l)),
|
||||
),
|
||||
el('select', { className: 'iwb-input iwb-select-compact', value: histRange, onChange: (e) => setHistRange(e.target.value), title: '按时间筛选图库' },
|
||||
[['', '全部'], ['today', '今天'], ['7d', '7 天'], ['30d', '30 天']].map(([v, l]) => el('option', { key: v, value: v }, l)),
|
||||
),
|
||||
el('select', { className: 'iwb-input iwb-select-compact', value: String(histTile), onChange: (e) => setHistTilePersist(e.target.value), title: '图库图片显示宽度:面板变宽只增加列数,图片大小不变' },
|
||||
[[110, '小'], [130, '中'], [170, '大'], [220, '特大']].map(([v, l]) => el('option', { key: v, value: String(v) }, l)),
|
||||
),
|
||||
),
|
||||
),
|
||||
GalleryHead ? el(GalleryHead, {
|
||||
count: histFiltered.length, total: outputs.length, sel: histSel.length,
|
||||
onAll: selectAllHistory, onInvert: invertHistorySelection,
|
||||
onDownload: () => { if (!histSel.length) { showToast('先在图库里选中图片', 'err'); return } downloadHistorySelected() }, onInsert: insertHistorySelected,
|
||||
onDelete: () => { if (!histSel.length) return; deleteOutputs(histSel); setHistSel([]) },
|
||||
insertK, onInsertK: setInsertKPersist, tile: histTile, onTile: setHistTilePersist,
|
||||
range: histRange, onRange: setHistRange,
|
||||
}) : null,
|
||||
el('div', { className: 'iwb-history-grid', ref: (el0) => { histGridRef.el = el0 } },
|
||||
histCols.buckets.map((col, ci) => el('div', { key: 'c' + ci, className: 'iwb-history-col' },
|
||||
col.map((f) => el('div', { key: f.name, className: 'iwb-history-item' + (histSel.length ? ' iwb-history-managed' : '') + (histSel.includes(f.name) ? ' iwb-history-selected' : '') },
|
||||
@@ -8107,9 +8099,6 @@ const tbCenterSeed = (type, refs) => {
|
||||
histFiltered.length > histLimit ? el('div', { className: 'iwb-history-more' },
|
||||
el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => setHistLimit((n) => n + 100) }, '显示更多(' + (histFiltered.length - histLimit) + ' 张)'),
|
||||
) : null,
|
||||
el('div', { className: 'iwb-history-foot' },
|
||||
el('span', { className: 'iwb-hint' }, '自动清理:' + retentionText(outputsInfo)),
|
||||
),
|
||||
)
|
||||
const dockPanels = {
|
||||
groups: { title: '节点组', icon: 'group', node: dockGroupsEl },
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-workbench-web",
|
||||
"private": true,
|
||||
"version": "3.25.38",
|
||||
"version": "3.25.39",
|
||||
"description": "Browser-based node canvas image workbench",
|
||||
"scripts": {
|
||||
"build": "node scripts/build.js && node scripts/copy-plugins.js",
|
||||
|
||||
@@ -95,6 +95,7 @@ const sourceModules = [
|
||||
'runtime-download-auto.js',
|
||||
'ui-workspace-tabs.js',
|
||||
'ui-app-chrome.js',
|
||||
'ui-gallery-head.js',
|
||||
'ui-workbench-hooks.js',
|
||||
'storage-autobackup.js',
|
||||
'canvas-history-store.js',
|
||||
|
||||
Generated
+1
-1
@@ -1983,7 +1983,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "image-workbench"
|
||||
version = "3.25.38"
|
||||
version = "3.25.39"
|
||||
dependencies = [
|
||||
"arboard",
|
||||
"base64 0.22.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "image-workbench"
|
||||
version = "3.25.38"
|
||||
version = "3.25.39"
|
||||
description = "无限画布 · 生图工作台桌面版"
|
||||
authors = ["malongan"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "image-workbench",
|
||||
"version": "3.25.38",
|
||||
"version": "3.25.39",
|
||||
"identifier": "com.malongan.imageworkbench",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* 图库面板头部(v3.25.39)
|
||||
*
|
||||
* 结构(对齐用户 2026-11-20 的定稿):
|
||||
* 第 1 行:标题 + 计数(标题单独一行,不与按钮并排)
|
||||
* 第 2 行:全选 / 反选 / 下载 / 插入 / 删除(后三个需要先选中)
|
||||
* 第 3 行:插入尺寸 · 显示大小 · 时间筛选(三个窄下拉,各带 2 字标签)
|
||||
*
|
||||
* 纪律:纯展示组件,只接收已算好的值与回调;不读 Workbench 内部状态。
|
||||
*/
|
||||
;(function (global) {
|
||||
'use strict'
|
||||
const React = global.React || {}
|
||||
const el = (type, prop, ...children) => React.createElement(type, prop, ...children)
|
||||
|
||||
function optPairs (list) {
|
||||
return (list || []).map(([v, l]) => el('option', { key: String(v), value: String(v) }, l))
|
||||
}
|
||||
|
||||
function IWBUIGalleryHead (props) {
|
||||
const sel = Number(props.sel) || 0
|
||||
const act = (label, title, onClick, opts) => {
|
||||
const o = opts || {}
|
||||
const blocked = !!o.needSel && !sel
|
||||
return el('button', {
|
||||
className: 'iwb-btn iwb-btn-sm' + (o.danger ? ' iwb-btn-danger' : '') + (blocked ? ' iwb-gal-off' : ''),
|
||||
title: blocked ? '先在图库里选中图片' : title,
|
||||
onClick: onClick,
|
||||
}, label)
|
||||
}
|
||||
const field = (label, value, onChange, pairs, title) => el('label', { className: 'iwb-gal-opt', title },
|
||||
el('span', { className: 'iwb-gal-opt-label' }, label),
|
||||
el('select', { className: 'iwb-input iwb-select-compact', value: String(value), onChange: (e) => onChange(e.target.value) }, optPairs(pairs)),
|
||||
)
|
||||
return el('div', { className: 'iwb-gal-head' },
|
||||
el('div', { className: 'iwb-gal-title' },
|
||||
el('span', { className: 'iwb-toolbar-title' }, '图库'),
|
||||
el('span', { className: 'iwb-hint' }, (Number(props.count) || 0) + ' / ' + (Number(props.total) || 0) + ' 张'),
|
||||
sel ? el('span', { className: 'iwb-gal-sel' }, '已选 ' + sel) : null,
|
||||
),
|
||||
el('div', { className: 'iwb-gal-actions' },
|
||||
act('全选', '全选当前筛选结果', props.onAll),
|
||||
act('反选', '反选当前筛选结果', props.onInvert),
|
||||
act('下载', '下载选中的图片到本地(多张会依次触发)', props.onDownload, { needSel: true }),
|
||||
act('插入', '把选中图片插入画布(参考图节点,压缩档位见下方「插入」)', props.onInsert, { needSel: true }),
|
||||
act('删除', '删除选中的图片(缩略图 + 原图 + 索引一并移除,不可恢复)', props.onDelete, { needSel: true, danger: true }),
|
||||
),
|
||||
el('div', { className: 'iwb-gal-opts' },
|
||||
field('插入', props.insertK, props.onInsertK, [['orig', '原图'], ['2k', '2K'], ['1k', '1K'], ['0.5k', '0.5K']], '插入画布时的图片尺寸:原图最清晰但最大;2K/1K/0.5K 会等比压到对应边长'),
|
||||
field('显示', props.tile, props.onTile, [[110, '小'], [130, '中'], [170, '大'], [220, '特大']], '图库图片显示宽度:面板变宽只增加列数,图片大小不变'),
|
||||
field('时间', props.range, props.onRange, [['', '全部'], ['today', '今天'], ['7d', '7 天'], ['30d', '30 天']], '按生成时间筛选图库'),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
global.IWBUIGalleryHead = IWBUIGalleryHead
|
||||
})(typeof window !== 'undefined' ? window : globalThis)
|
||||
@@ -397,7 +397,6 @@ button { font-family: inherit; }
|
||||
.iwb-ref-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
|
||||
.iwb-ref-single { width: 100%; min-height: 60px; max-height: 340px; object-fit: contain; object-position: center; border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: move; }
|
||||
.iwb-history { position: absolute; left: 12px; right: 12px; bottom: 46px; background: var(--iwb-panel); border: 1px solid var(--iwb-border); border-radius: 12px; z-index: 30; box-shadow: 0 8px 30px rgba(0,0,0,0.25); padding: 8px 12px; max-height: 180px; display: flex; flex-direction: column; }
|
||||
.iwb-history-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--iwb-border); }
|
||||
.iwb-history-grid { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; flex: 1; }
|
||||
.iwb-history-item { position: relative; flex: 0 0 110px; }
|
||||
.iwb-history-item img { width: 110px; height: 82px; object-fit: contain; border-radius: 6px; border: 1px solid var(--iwb-border); background: var(--iwb-layer2); cursor: pointer; }
|
||||
@@ -432,7 +431,6 @@ button { font-family: inherit; }
|
||||
.iwb-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--iwb-text); }
|
||||
.iwb-num { width: 76px; flex: none; }
|
||||
.iwb-hdrbox { min-height: 54px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; resize: vertical; }
|
||||
.iwb-history-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px solid var(--iwb-border); margin-top: 6px; }
|
||||
|
||||
/* ---- v2 P3:4-Tab 设置 ---- */
|
||||
.iwb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--iwb-border); padding: 8px 12px 0; }
|
||||
@@ -2112,9 +2110,19 @@ html { scrollbar-width: thin; scrollbar-color: var(--iwb-border2) color-mix(in s
|
||||
font-size: var(--fs-sm);
|
||||
background-position: right 2px center;
|
||||
}
|
||||
.iwb-history-head { flex-wrap: wrap; gap: 6px; row-gap: 4px; align-items: center; }
|
||||
.iwb-history-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
|
||||
.iwb-history-head .iwb-toolbar-title { flex: 0 0 auto; }
|
||||
/* ===== 图库头部(v3.25.39):标题独占一行 → 操作行 → 设定行 =====
|
||||
* 窄面板下操作行/设定行各自换行,按钮与下拉都保持自然宽度,不被挤压。
|
||||
*/
|
||||
.iwb-gal-head { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--iwb-border); }
|
||||
.iwb-gal-title { display: flex; align-items: baseline; gap: 8px; }
|
||||
.iwb-gal-sel { font-size: 11px; color: var(--iwb-brand); }
|
||||
.iwb-gal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.iwb-gal-actions .iwb-btn { flex: 0 0 auto; }
|
||||
.iwb-gal-actions .iwb-btn.iwb-gal-off { opacity: .45; }
|
||||
.iwb-gal-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
|
||||
.iwb-gal-opt { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.iwb-gal-opt-label { font-size: 11px; color: var(--iwb-text2); white-space: nowrap; }
|
||||
.iwb-gal-opt select { width: auto; min-width: 48px; max-width: 72px; height: 24px; padding: 0 4px; font-size: 12px; }
|
||||
.iwb-history-grid { overscroll-behavior: contain; }
|
||||
.iwb-history-head .iwb-btn-sm { padding-left: 6px; padding-right: 6px; }
|
||||
|
||||
|
||||
+1
@@ -62,6 +62,7 @@
|
||||
"IWBUICanvasView",
|
||||
"IWBUIConfirm",
|
||||
"IWBUIConnectMenu",
|
||||
"IWBUIGalleryHead",
|
||||
"IWBUIGenConfigPanel",
|
||||
"IWBUIGroupsSidebar",
|
||||
"IWBUILibSidebar",
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
"runtime-download-auto.js",
|
||||
"ui-workspace-tabs.js",
|
||||
"ui-app-chrome.js",
|
||||
"ui-gallery-head.js",
|
||||
"ui-workbench-hooks.js",
|
||||
"storage-autobackup.js",
|
||||
"canvas-history-store.js",
|
||||
|
||||
Reference in new issue
Block a user