dsh-gallery 1.5.0 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +349 -2
- package/README.md +52 -7
- package/client.js +1226 -37
- package/host/constants.js +8 -0
- package/host/frames.js +26 -0
- package/host/groups.js +131 -33
- package/host/http.js +352 -16
- package/host/manifest.js +22 -1
- package/host/scan.js +234 -24
- package/host/session-index.js +170 -9
- package/host/settings.js +49 -0
- package/host/trash.js +324 -0
- package/index.js +10 -0
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -1046,6 +1046,23 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1046
1046
|
groupInput: '素材 {n}',
|
|
1047
1047
|
groupIntermediate: '过程稿 {n}',
|
|
1048
1048
|
groupUnknown: '未归类 {n}',
|
|
1049
|
+
// v1.6.4:跨对话共用 —— 同一个文件被多个对话引用(不合并、不去重,只标归属)
|
|
1050
|
+
groupShared: '共用 {n} 张',
|
|
1051
|
+
groupSharedTip: '这 {n} 张是同一个文件,{who} 也在用。在任一对话里删除或隐藏,两边会一起生效;同名但不同路径的两份文件互不影响。',
|
|
1052
|
+
sharedWithSome: '其他对话',
|
|
1053
|
+
sharedWithMany: '{first} 等 {n} 个对话',
|
|
1054
|
+
// ===== v1.6.5:卡片级共用标注 + 隐藏对话合集 =====
|
|
1055
|
+
cardSharedWith: '共用 {n} 个对话',
|
|
1056
|
+
cardSharedWithHint: '这张图是同一个文件(同一路径),同时被 {n} 个对话记录过。在任一处删除或隐藏,各对话里会一起生效;同名但不同路径的两份文件互不影响。',
|
|
1057
|
+
hiddenGroupTitle: '已隐藏对话',
|
|
1058
|
+
hiddenGroupHint: '这些是你收起来的对话,资产本身没动;默认沿用上次扫描结果,点开其中一个才刷新那一个。右键任意一行选「在全局列表显示」就能放回去。',
|
|
1059
|
+
archivedGroupTitle: '已归档对话',
|
|
1060
|
+
archivedGroupHint: '宿主已把这些对话归档;默认沿用上次扫描结果,点开其中一个才刷新那一个。资产与标注都没动,仍可「打开对话」尝试切回。',
|
|
1061
|
+
ctxHideSession: '隐藏当前对话',
|
|
1062
|
+
ctxShowSession: '在全局列表显示',
|
|
1063
|
+
hideSessionDone: '已收进「已隐藏对话」:{title}',
|
|
1064
|
+
showSessionDone: '已放回全局列表:{title}',
|
|
1065
|
+
hideSessionFailed: '操作失败:{message}',
|
|
1049
1066
|
groupTruncated: '仅显示最近 {shown} 个,共 {total} 个',
|
|
1050
1067
|
groupShowMore: '再显示 {step} 张 · 已显示 {shown} / 共 {total}',
|
|
1051
1068
|
groupHistoryTitle: '历史资产',
|
|
@@ -1124,9 +1141,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1124
1141
|
ctxCopy: '写进输入框',
|
|
1125
1142
|
ctxDelete: '删除文件',
|
|
1126
1143
|
ctxDeleteSelected: '删除选中的 {n} 个文件',
|
|
1127
|
-
ctxDeleteManyTitle: '
|
|
1144
|
+
ctxDeleteManyTitle: '把 {n} 个文件移到回收区?可撤销',
|
|
1128
1145
|
ctxDeleteManySummary: '共 {n} 个文件',
|
|
1129
|
-
ctxDeletePartial: '
|
|
1146
|
+
ctxDeletePartial: '已移到回收区 {n} 个,{fail} 个失败',
|
|
1130
1147
|
batchDeleteSelected: '删除所选',
|
|
1131
1148
|
batchDeleteHint: '删除选中的全部文件(会二次确认,不可恢复)',
|
|
1132
1149
|
// 2026-11-25 按标签圈选:把某一类下的文件一次选中,再交给批量动作
|
|
@@ -1140,8 +1157,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1140
1157
|
batchInvertHint: '选中当前列表里还没选中的文件',
|
|
1141
1158
|
ctxCopyFileSelected: '复制选中的 {n} 个文件',
|
|
1142
1159
|
labelEditSelected: '改这 {n} 张的标签',
|
|
1143
|
-
ctxDeleteConfirm: '
|
|
1144
|
-
ctxDeleteYes: '
|
|
1160
|
+
ctxDeleteConfirm: '移到回收区?可撤销(Ctrl+Z)',
|
|
1161
|
+
ctxDeleteYes: '移到回收区',
|
|
1145
1162
|
ctxDeleteNo: '取消',
|
|
1146
1163
|
// 批注删除按钮的 title 与卡片删除共用 t('delete')
|
|
1147
1164
|
delete: '删除',
|
|
@@ -1290,6 +1307,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1290
1307
|
thumbFailed: '无法加载',
|
|
1291
1308
|
dims: '{w} × {h}',
|
|
1292
1309
|
dimsUnknown: '尺寸未知',
|
|
1310
|
+
// v1.6.3:同一视图里的同名文件(不是重复,是两份不同目录的真文件)
|
|
1311
|
+
sameNameIn: '同名 {n} 份 · {dir}',
|
|
1312
|
+
rootDir: '根目录',
|
|
1293
1313
|
close: '关闭',
|
|
1294
1314
|
prev: '上一张',
|
|
1295
1315
|
next: '下一张',
|
|
@@ -1315,9 +1335,52 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1315
1335
|
// v1.5.0 导出交付清单:CSV 进 Excel、JSON 给下一轮,落在 ~/.dsh/gallery-exports/
|
|
1316
1336
|
batchExportManifest: '导出清单',
|
|
1317
1337
|
batchExportHint: '把选中的这批导出成交付清单(CSV 给 Excel 看、JSON 给下一轮读),存到 ~/.dsh/gallery-exports/;同名不覆盖',
|
|
1318
|
-
exportOk: '已导出 {n}
|
|
1338
|
+
exportOk: '已导出 {n} 条:{name}',
|
|
1319
1339
|
exportEmpty: '这批没有可导出的文件(可能还没打分类)',
|
|
1320
1340
|
exportFailed: '导出清单失败:{message}',
|
|
1341
|
+
// v1.6.0:清单落盘后给三个便捷出口(打开文件夹 / 复制路径 / 写进输入框)
|
|
1342
|
+
exportOpenDir: '打开文件夹',
|
|
1343
|
+
exportCopyPath: '复制路径',
|
|
1344
|
+
exportToComposer: '写进输入框',
|
|
1345
|
+
// v1.6.2:导出记录(常驻,事后照样能再引用一次)
|
|
1346
|
+
exportHistoryEntry: '导出记录',
|
|
1347
|
+
exportHistoryOpen: '导出记录',
|
|
1348
|
+
exportHistoryTitle: '导出记录',
|
|
1349
|
+
exportHistoryHint: '以前导出的交付清单都在这;点「写进输入框」就能把这批清单再递给助手',
|
|
1350
|
+
exportHistoryEmpty: '还没有导出过清单',
|
|
1351
|
+
exportHistoryLoading: '读取中…',
|
|
1352
|
+
exportHistoryFailed: '读不到导出记录:{message}',
|
|
1353
|
+
exportHistorySource: '来源',
|
|
1354
|
+
exportHistoryCount: '{n} 条',
|
|
1355
|
+
exportHistoryMissing: '文件已不在(可能被移走或删了)',
|
|
1356
|
+
exportHistoryRefresh: '刷新',
|
|
1357
|
+
exportHistoryLegacy: '早期导出',
|
|
1358
|
+
exportHistoryGlobal: '全局资产',
|
|
1359
|
+
exportHistoryUnknownSource: '未记录来源',
|
|
1360
|
+
exportPathCopied: '清单路径已复制到剪贴板',
|
|
1361
|
+
exportPathCopyFailed: '复制路径失败,请手动选中提示里的路径',
|
|
1362
|
+
exportOpenFailed: '打不开导出文件夹:{message}',
|
|
1363
|
+
exportDraftReady: '清单路径已写进输入框(只写不发)',
|
|
1364
|
+
exportDraftInClipboard: '写不进输入框,路径已放剪贴板',
|
|
1365
|
+
// v1.6.0 撤销(Ctrl+Z):删除移到回收区、隐藏取消隐藏,两类都能撤
|
|
1366
|
+
undoAction: '撤销 (Ctrl+Z)',
|
|
1367
|
+
undoNothing: '没有可撤销的操作',
|
|
1368
|
+
whereGlobal: '全局资产',
|
|
1369
|
+
whereSession: '当前对话',
|
|
1370
|
+
// v1.6.2:撤销提示要能看出「是哪个对话、哪一类」——
|
|
1371
|
+
// 老板切了几个对话后,只写「当前对话」等于没说。
|
|
1372
|
+
whereSessionNamed: '对话「{name}」',
|
|
1373
|
+
kindImage: '图片',
|
|
1374
|
+
kindFile: '文件',
|
|
1375
|
+
kindMedia: '音视频',
|
|
1376
|
+
undoOtherScope: '这里没有可撤销的操作;最近一批在「{where}」的{kind}里,切过去再按 Ctrl+Z',
|
|
1377
|
+
undoDeleteOk: '已移到回收区:{n} 个文件(按 Ctrl+Z 可撤回)',
|
|
1378
|
+
undoHideOk: '已隐藏 {n} 个文件(按 Ctrl+Z 可撤回)',
|
|
1379
|
+
undoDeleteDone: '已撤销:{n} 个文件回到原位({where} · {kind})',
|
|
1380
|
+
undoDeletePartial: '撤销完成 {n} 个;{fail} 个失败、{conflict} 个原位已有同名文件(未覆盖)',
|
|
1381
|
+
undoDeleteNone: '没能撤回来:这批可能已过保留期被清理',
|
|
1382
|
+
undoHideDone: '已撤销隐藏:{n} 个文件回到列表({where} · {kind})',
|
|
1383
|
+
undoFailed: '撤销失败:{message}',
|
|
1321
1384
|
copyOk: '已复制 {n} 个文件到剪贴板;切到目标对话后右键「粘贴」或按 Ctrl+V',
|
|
1322
1385
|
copyOkInternal: '已复制 {n} 个文件(系统剪贴板不可用,仅插件内粘贴有效)',
|
|
1323
1386
|
copyFailed: '复制失败:{message}',
|
|
@@ -1516,6 +1579,22 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1516
1579
|
groupInput: 'Source {n}',
|
|
1517
1580
|
groupIntermediate: 'WIP {n}',
|
|
1518
1581
|
groupUnknown: 'Unclassified {n}',
|
|
1582
|
+
// v1.6.4: assets referenced by more than one chat (kept in both, labelled)
|
|
1583
|
+
groupShared: 'Shared {n} files',
|
|
1584
|
+
groupSharedTip: '{n} of these are the same file(s) {who} also uses. Deleting or hiding in one place affects both; same-name files in different folders stay independent.',
|
|
1585
|
+
sharedWithSome: 'other chats',
|
|
1586
|
+
sharedWithMany: '{first} and {n} chats',
|
|
1587
|
+
cardSharedWith: 'shared by {n} chats',
|
|
1588
|
+
cardSharedWithHint: 'This is one file (same path) recorded by {n} chats. Deleting or hiding it anywhere affects them all; same-name files in different folders stay independent.',
|
|
1589
|
+
hiddenGroupTitle: 'Hidden chats',
|
|
1590
|
+
hiddenGroupHint: 'Chats you put away. They keep the last scan result until you expand one — only that chat refreshes. Right-click any row and pick "Show in global list" to bring it back; nothing on disk was moved.',
|
|
1591
|
+
archivedGroupTitle: 'Archived chats',
|
|
1592
|
+
archivedGroupHint: 'The host archived these chats. They keep the last scan result until you expand one — only that chat refreshes. Assets and labels are untouched; "Open chat" still works.',
|
|
1593
|
+
ctxHideSession: 'Hide this chat',
|
|
1594
|
+
ctxShowSession: 'Show in global list',
|
|
1595
|
+
hideSessionDone: 'Moved to "Hidden chats": {title}',
|
|
1596
|
+
showSessionDone: 'Back in the global list: {title}',
|
|
1597
|
+
hideSessionFailed: 'Failed: {message}',
|
|
1519
1598
|
groupTruncated: 'Showing latest {shown} of {total}',
|
|
1520
1599
|
groupShowMore: 'Show {step} more · {shown} of {total}',
|
|
1521
1600
|
groupHistoryTitle: 'Older assets',
|
|
@@ -1593,9 +1672,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1593
1672
|
ctxCopy: 'Write into chat input',
|
|
1594
1673
|
ctxDelete: 'Delete file',
|
|
1595
1674
|
ctxDeleteSelected: 'Delete {n} selected files',
|
|
1596
|
-
ctxDeleteManyTitle: '
|
|
1675
|
+
ctxDeleteManyTitle: 'Move {n} files to Trash? This can be undone',
|
|
1597
1676
|
ctxDeleteManySummary: '{n} files',
|
|
1598
|
-
ctxDeletePartial: '
|
|
1677
|
+
ctxDeletePartial: 'Moved {n} to Trash, {fail} failed',
|
|
1599
1678
|
batchDeleteSelected: 'Delete selected',
|
|
1600
1679
|
batchDeleteHint: 'Delete every selected file (asks for confirmation, cannot be undone)',
|
|
1601
1680
|
legendPick: 'Pick',
|
|
@@ -1608,8 +1687,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1608
1687
|
batchInvertHint: 'Select the files in the current list that are not selected yet',
|
|
1609
1688
|
ctxCopyFileSelected: 'Copy {n} selected files',
|
|
1610
1689
|
labelEditSelected: 'Re-label these {n} files',
|
|
1611
|
-
ctxDeleteConfirm: '
|
|
1612
|
-
ctxDeleteYes: '
|
|
1690
|
+
ctxDeleteConfirm: 'Move to Trash? You can undo with Ctrl+Z',
|
|
1691
|
+
ctxDeleteYes: 'Move to Trash',
|
|
1613
1692
|
ctxDeleteNo: 'Cancel',
|
|
1614
1693
|
delete: 'Delete',
|
|
1615
1694
|
ctxHiddenDone: 'Hidden. Restore it in settings later.',
|
|
@@ -1753,6 +1832,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1753
1832
|
thumbFailed: 'Cannot load',
|
|
1754
1833
|
dims: '{w} × {h}',
|
|
1755
1834
|
dimsUnknown: 'Size unknown',
|
|
1835
|
+
sameNameIn: '{n} with the same name · {dir}',
|
|
1836
|
+
rootDir: 'root folder',
|
|
1756
1837
|
close: 'Close',
|
|
1757
1838
|
prev: 'Previous',
|
|
1758
1839
|
next: 'Next',
|
|
@@ -1777,9 +1858,47 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1777
1858
|
batchCopyHint: 'Write the selected files to the system clipboard; paste them in another chat or Explorer',
|
|
1778
1859
|
batchExportManifest: 'Export list',
|
|
1779
1860
|
batchExportHint: 'Export the selection as a delivery list (CSV for Excel, JSON for the next round) into ~/.dsh/gallery-exports/; existing files are never overwritten',
|
|
1780
|
-
exportOk: 'Exported {n} items: {
|
|
1861
|
+
exportOk: 'Exported {n} items: {name}',
|
|
1781
1862
|
exportEmpty: 'Nothing exportable in this batch (maybe no category yet)',
|
|
1782
1863
|
exportFailed: 'Export failed: {message}',
|
|
1864
|
+
exportOpenDir: 'Open folder',
|
|
1865
|
+
exportCopyPath: 'Copy path',
|
|
1866
|
+
exportToComposer: 'Write to input',
|
|
1867
|
+
exportHistoryEntry: 'Export history',
|
|
1868
|
+
exportHistoryOpen: 'Export history',
|
|
1869
|
+
exportHistoryTitle: 'Export history',
|
|
1870
|
+
exportHistoryHint: 'Every delivery list you exported is listed here; "Write to input" hands the path to the assistant again',
|
|
1871
|
+
exportHistoryEmpty: 'No lists exported yet',
|
|
1872
|
+
exportHistoryLoading: 'Loading…',
|
|
1873
|
+
exportHistoryFailed: 'Could not read the export history: {message}',
|
|
1874
|
+
exportHistorySource: 'Source',
|
|
1875
|
+
exportHistoryCount: '{n} items',
|
|
1876
|
+
exportHistoryMissing: 'File is gone (moved or deleted)',
|
|
1877
|
+
exportHistoryRefresh: 'Refresh',
|
|
1878
|
+
exportHistoryLegacy: 'Earlier export',
|
|
1879
|
+
exportHistoryGlobal: 'All assets',
|
|
1880
|
+
exportHistoryUnknownSource: 'Source not recorded',
|
|
1881
|
+
exportPathCopied: 'List path copied to clipboard',
|
|
1882
|
+
exportPathCopyFailed: 'Copy failed — select the path in the notice manually',
|
|
1883
|
+
exportOpenFailed: 'Could not open the export folder: {message}',
|
|
1884
|
+
exportDraftReady: 'List path written to the input box (written, not sent)',
|
|
1885
|
+
exportDraftInClipboard: 'Could not write to the input box; path is on the clipboard',
|
|
1886
|
+
undoAction: 'Undo (Ctrl+Z)',
|
|
1887
|
+
undoNothing: 'Nothing to undo',
|
|
1888
|
+
whereGlobal: 'All assets',
|
|
1889
|
+
whereSession: 'This chat',
|
|
1890
|
+
whereSessionNamed: 'chat "{name}"',
|
|
1891
|
+
kindImage: 'images',
|
|
1892
|
+
kindFile: 'files',
|
|
1893
|
+
kindMedia: 'media',
|
|
1894
|
+
undoOtherScope: 'Nothing to undo here; the latest batch was in {kind} of "{where}" — switch there and press Ctrl+Z',
|
|
1895
|
+
undoDeleteOk: 'Moved {n} file(s) to Trash (press Ctrl+Z to undo)',
|
|
1896
|
+
undoHideOk: 'Hidden {n} file(s) (press Ctrl+Z to undo)',
|
|
1897
|
+
undoDeleteDone: 'Undone: {n} file(s) restored ({where} · {kind})',
|
|
1898
|
+
undoDeletePartial: 'Restored {n}; {fail} failed, {conflict} already exist at the original path (not overwritten)',
|
|
1899
|
+
undoDeleteNone: 'Nothing could be restored — this batch may have passed its retention window',
|
|
1900
|
+
undoHideDone: 'Undone: {n} file(s) shown again ({where} · {kind})',
|
|
1901
|
+
undoFailed: 'Undo failed: {message}',
|
|
1783
1902
|
copyOk: 'Copied {n} file(s) to the clipboard; right-click "Paste" or press Ctrl+V in the target chat',
|
|
1784
1903
|
copyOkInternal: 'Copied {n} file(s) (system clipboard unavailable; in-plugin paste only)',
|
|
1785
1904
|
copyFailed: 'Copy failed: {message}',
|
|
@@ -2703,6 +2822,58 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
2703
2822
|
white-space: nowrap;
|
|
2704
2823
|
}
|
|
2705
2824
|
.dg-groupChips { display: inline-flex; gap: 5px; flex: 0 0 auto; }
|
|
2825
|
+
/**
|
|
2826
|
+
* v1.6.5:组头共用标记默认折叠。
|
|
2827
|
+
* 1.6.4 常驻的「共用 136」在组多、数字大时很刺眼;现在只留一个琥珀小圆点,
|
|
2828
|
+
* 明细放到组头下方的正常流详情行里,悬停组头(或键盘聚焦)才展开。
|
|
2829
|
+
* 🔴 不能用向下浮出的绝对定位气泡:.dg-group 有 clip-path: inset(0 round 8px),
|
|
2830
|
+
* 超出组边界的内容会被直接裁掉;正常流撑高组则不受影响。
|
|
2831
|
+
*/
|
|
2832
|
+
.dg-groupShared {
|
|
2833
|
+
flex: 0 0 auto;
|
|
2834
|
+
display: inline-flex;
|
|
2835
|
+
align-items: center;
|
|
2836
|
+
justify-content: center;
|
|
2837
|
+
width: 16px;
|
|
2838
|
+
height: 16px;
|
|
2839
|
+
margin-left: 2px;
|
|
2840
|
+
border-radius: 50%;
|
|
2841
|
+
border: 1px dashed rgba(208, 139, 22, 0.55);
|
|
2842
|
+
background: transparent;
|
|
2843
|
+
color: #D08B16;
|
|
2844
|
+
cursor: help;
|
|
2845
|
+
outline: none;
|
|
2846
|
+
}
|
|
2847
|
+
.dg-sharedDot {
|
|
2848
|
+
width: 5px;
|
|
2849
|
+
height: 5px;
|
|
2850
|
+
border-radius: 50%;
|
|
2851
|
+
background: #D08B16;
|
|
2852
|
+
flex: 0 0 auto;
|
|
2853
|
+
}
|
|
2854
|
+
.dg-sharedDetail {
|
|
2855
|
+
display: none;
|
|
2856
|
+
padding: 6px 12px 8px;
|
|
2857
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
2858
|
+
border-bottom: 1px dashed var(--dsw-alias-border-l1);
|
|
2859
|
+
color: var(--dsw-alias-label-secondary);
|
|
2860
|
+
text-align: left;
|
|
2861
|
+
}
|
|
2862
|
+
.dg-groupHead:hover + .dg-sharedDetail,
|
|
2863
|
+
.dg-groupHead:focus-visible + .dg-sharedDetail,
|
|
2864
|
+
.dg-sharedDetail:hover { display: block; }
|
|
2865
|
+
.dg-sharedDetailTitle {
|
|
2866
|
+
display: block;
|
|
2867
|
+
font-size: 12px;
|
|
2868
|
+
font-weight: 600;
|
|
2869
|
+
color: #D08B16;
|
|
2870
|
+
margin-bottom: 2px;
|
|
2871
|
+
}
|
|
2872
|
+
.dg-sharedDetailBody {
|
|
2873
|
+
display: block;
|
|
2874
|
+
font-size: 11px;
|
|
2875
|
+
line-height: 1.5;
|
|
2876
|
+
}
|
|
2706
2877
|
.dg-chip {
|
|
2707
2878
|
padding: 1px 7px;
|
|
2708
2879
|
border-radius: 9px;
|
|
@@ -2760,6 +2931,15 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
2760
2931
|
.dg-meta { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
2761
2932
|
.dg-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2762
2933
|
.dg-dim { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2934
|
+
/* v1.6.3:同一视图里出现同名文件时的「同名 N 份 · 所在目录」提示。
|
|
2935
|
+
老板 11-25 截图:一组里并排两张「老人手部_GPT25_0.png」,看着像重复,
|
|
2936
|
+
实际一个是「漫剧手册分析/」、一个是他自己拷的「GPT25备用/」。
|
|
2937
|
+
只在重名时出现,其余卡片视觉零变化;颜色用琥珀色以示「这不是重复」。 */
|
|
2938
|
+
.dg-dir {
|
|
2939
|
+
font-size: 10px; line-height: 1.2;
|
|
2940
|
+
color: #d08b16;
|
|
2941
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
2942
|
+
}
|
|
2763
2943
|
.dg-more {
|
|
2764
2944
|
margin: 12px 0 4px;
|
|
2765
2945
|
padding: 8px 10px;
|
|
@@ -2774,6 +2954,31 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
2774
2954
|
/* 2026-11-24:分叉「继承」与主线「共享」是同一批文件的两侧视角——同款虚线框,只标来源、不降交互 */
|
|
2775
2955
|
.dg-cardWrap.dg-inheritedCard,
|
|
2776
2956
|
.dg-cardWrap.dg-sharedCard { outline: 1px dashed #9b8cf0; outline-offset: 1px; }
|
|
2957
|
+
|
|
2958
|
+
/* v1.6.5:卡片级「共用 N 个对话」。用紫色的字,和同名提示的琥珀色错开 ——
|
|
2959
|
+
两者讲的是完全不同的两件事:同名是「两份真文件」,共用是「同一个文件」。 */
|
|
2960
|
+
.dg-sharedWith {
|
|
2961
|
+
font-size: 10px; line-height: 1.2;
|
|
2962
|
+
color: #7b6bd6;
|
|
2963
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
/* v1.6.5:已隐藏对话合集 —— 列表底部一条折叠栏,展开后里面照常渲染分组 */
|
|
2967
|
+
.dg-hiddenWrap { margin-top: 12px; border-top: 1px dashed var(--dsw-alias-border-l1); padding-top: 10px; }
|
|
2968
|
+
.dg-hiddenHead {
|
|
2969
|
+
display: flex; align-items: center; gap: 8px;
|
|
2970
|
+
width: 100%; padding: 7px 10px;
|
|
2971
|
+
border-radius: 8px;
|
|
2972
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
2973
|
+
border: 1px solid var(--dsw-alias-border-l1);
|
|
2974
|
+
color: var(--dsw-alias-label-secondary);
|
|
2975
|
+
font-size: 12px; cursor: pointer; text-align: left;
|
|
2976
|
+
}
|
|
2977
|
+
.dg-hiddenHead:hover { border-color: var(--dsw-alias-border-l2); }
|
|
2978
|
+
.dg-hiddenArrow { display: inline-block; font-size: 10px; transition: transform .15s; }
|
|
2979
|
+
.dg-hiddenArrowOpen { transform: rotate(90deg); }
|
|
2980
|
+
.dg-hiddenCount { margin-left: auto; font-size: 11px; color: var(--dsw-alias-label-secondary); }
|
|
2981
|
+
.dg-hiddenHint { padding: 6px 2px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
|
|
2777
2982
|
.dg-inheritedBadge,
|
|
2778
2983
|
.dg-sharedBadge {
|
|
2779
2984
|
position: absolute;
|
|
@@ -3821,6 +4026,59 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
3821
4026
|
}
|
|
3822
4027
|
.dg-pasteOk { border-color: rgba(94,214,150,0.6); }
|
|
3823
4028
|
.dg-pasteFail { border-color: rgba(255,107,107,0.6); color: #ffd2d2; }
|
|
4029
|
+
/* v1.6.0 带按钮的提示(导出清单 / 撤销):有按钮就必须能点,所以这一档放开 pointer-events。 */
|
|
4030
|
+
/* v1.6.2 修「一字一行」:原来这条是 flex 横排,长路径 + word-break:break-all 被压到 1 字符宽,
|
|
4031
|
+
整条提示竖成一根柱子(老板截图)。改成上下两段:文字占一行(超长省略),按钮在下面一行。 */
|
|
4032
|
+
.dg-pasteNoticeAction {
|
|
4033
|
+
pointer-events: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
|
|
4034
|
+
max-width: 92%; word-break: normal;
|
|
4035
|
+
}
|
|
4036
|
+
.dg-pasteText { flex: 0 0 auto; min-width: 0; word-break: break-word; }
|
|
4037
|
+
.dg-pasteBtns { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: center; }
|
|
4038
|
+
.dg-pasteBtn {
|
|
4039
|
+
font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
|
|
4040
|
+
padding: 3px 9px; border-radius: 5px; color: #e8eaed;
|
|
4041
|
+
background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.22);
|
|
4042
|
+
}
|
|
4043
|
+
.dg-pasteBtn:hover { background: rgba(255,255,255,0.18); }
|
|
4044
|
+
.dg-pasteBtn:active { background: rgba(255,255,255,0.26); }
|
|
4045
|
+
|
|
4046
|
+
/* ===== 导出记录面板(v1.6.2) =====
|
|
4047
|
+
复用设置面板的遮罩与卡片骨架(.dg-settingsLayer / .dg-settings),
|
|
4048
|
+
这里只把它加宽一点,并把「文件名 / 来源时间条数 / 两个按钮」压成一行。 */
|
|
4049
|
+
.dg-exportPanel { max-width: 560px; }
|
|
4050
|
+
.dg-exportHint {
|
|
4051
|
+
padding: 8px 12px 0; font-size: 11px; line-height: 1.5; opacity: .78;
|
|
4052
|
+
}
|
|
4053
|
+
.dg-exportList {
|
|
4054
|
+
padding: 8px 12px; display: flex; flex-direction: column; gap: 6px;
|
|
4055
|
+
overflow: auto; flex: 1 1 auto; min-height: 0;
|
|
4056
|
+
}
|
|
4057
|
+
.dg-exportRow {
|
|
4058
|
+
display: flex; align-items: center; gap: 8px; padding: 7px 8px;
|
|
4059
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px;
|
|
4060
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
4061
|
+
}
|
|
4062
|
+
.dg-exportMain { flex: 1 1 auto; min-width: 0; }
|
|
4063
|
+
.dg-exportName {
|
|
4064
|
+
font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
4065
|
+
}
|
|
4066
|
+
.dg-exportMeta {
|
|
4067
|
+
font-size: 11px; opacity: .72; margin-top: 2px;
|
|
4068
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
4069
|
+
}
|
|
4070
|
+
.dg-exportMetaGone { color: #ff9b9b; opacity: 1; }
|
|
4071
|
+
.dg-exportActs { display: flex; gap: 6px; flex: 0 0 auto; }
|
|
4072
|
+
.dg-exportEmpty { padding: 20px 4px; text-align: center; font-size: 12px; opacity: .7; }
|
|
4073
|
+
.dg-exportFail { color: #ff9b9b; opacity: 1; }
|
|
4074
|
+
.dg-exportFoot {
|
|
4075
|
+
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
4076
|
+
border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2);
|
|
4077
|
+
}
|
|
4078
|
+
.dg-exportDir {
|
|
4079
|
+
flex: 1 1 auto; min-width: 0; font-size: 11px; opacity: .7;
|
|
4080
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
4081
|
+
}
|
|
3824
4082
|
|
|
3825
4083
|
/* v1.0.2 图片裁剪层:绿框 + 八向手柄 + 像素级取色放大镜(照老板给的参考图对齐)
|
|
3826
4084
|
坐标系说明:裁剪框/放大镜都用 getBoundingClientRect 的**视口坐标**定位,
|
|
@@ -5438,6 +5696,96 @@ function serializeFeedback(feedback) {
|
|
|
5438
5696
|
* ③ 可选「同时加入反馈篮」——默认勾上,可取消
|
|
5439
5697
|
* 弹窗绝不发送任何消息;反馈只进篮子,等人审核合并后再发。
|
|
5440
5698
|
*/
|
|
5699
|
+
/**
|
|
5700
|
+
* v1.6.5:对话组行的右键菜单。
|
|
5701
|
+
*
|
|
5702
|
+
* 两个入口并列:①「打开对话」—— 与展开组后的按钮同一套调用,不必先展开组;
|
|
5703
|
+
* ②「隐藏当前对话 / 在全局列表显示」—— 把对话收进合集或放回。
|
|
5704
|
+
* 刻意**不提供**删除/重命名对话 —— 画廊只管列表怎么摆,
|
|
5705
|
+
* 不碰会话本体,也不碰文件(隐藏≠删除,助手照旧能搜到这些资产)。
|
|
5706
|
+
*/
|
|
5707
|
+
function GroupMenu({ t, x, y, title, hidden, canOpen, onOpen, onToggle, onClose }) {
|
|
5708
|
+
const menuRef = React.useRef(null)
|
|
5709
|
+
const [pos, setPos] = React.useState({ left: x, top: y })
|
|
5710
|
+
|
|
5711
|
+
// 贴边内收,避免右键在屏幕右下角时菜单被切掉
|
|
5712
|
+
React.useLayoutEffect(() => {
|
|
5713
|
+
const node = menuRef.current
|
|
5714
|
+
if (node === null) return
|
|
5715
|
+
const rect = node.getBoundingClientRect()
|
|
5716
|
+
const pad = 8
|
|
5717
|
+
let left = x
|
|
5718
|
+
let top = y
|
|
5719
|
+
if (left + rect.width > window.innerWidth - pad) left = window.innerWidth - rect.width - pad
|
|
5720
|
+
if (top + rect.height > window.innerHeight - pad) top = window.innerHeight - rect.height - pad
|
|
5721
|
+
setPos({ left: Math.max(pad, left), top: Math.max(pad, top) })
|
|
5722
|
+
}, [x, y])
|
|
5723
|
+
|
|
5724
|
+
React.useEffect(() => {
|
|
5725
|
+
const onDown = (event) => {
|
|
5726
|
+
if (menuRef.current !== null && menuRef.current.contains(event.target)) return
|
|
5727
|
+
onClose()
|
|
5728
|
+
}
|
|
5729
|
+
const onKey = (event) => { if (event.key === 'Escape') onClose() }
|
|
5730
|
+
document.addEventListener('pointerdown', onDown, true)
|
|
5731
|
+
window.addEventListener('keydown', onKey)
|
|
5732
|
+
return () => {
|
|
5733
|
+
document.removeEventListener('pointerdown', onDown, true)
|
|
5734
|
+
window.removeEventListener('keydown', onKey)
|
|
5735
|
+
}
|
|
5736
|
+
}, [onClose])
|
|
5737
|
+
|
|
5738
|
+
return h('div', {
|
|
5739
|
+
className: 'dg-ctxLayer',
|
|
5740
|
+
key: 'groupMenuLayer',
|
|
5741
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
5742
|
+
onContextMenu: (event) => event.preventDefault(),
|
|
5743
|
+
}, h('div', {
|
|
5744
|
+
className: 'dg-ctxMenu',
|
|
5745
|
+
key: 'menu',
|
|
5746
|
+
ref: menuRef,
|
|
5747
|
+
role: 'menu',
|
|
5748
|
+
'data-gallery-groupmenu': '1',
|
|
5749
|
+
style: { left: `${pos.left}px`, top: `${pos.top}px` },
|
|
5750
|
+
}, [
|
|
5751
|
+
h('div', { className: 'dg-ctxHead', key: 'head' }, String(title ?? '')),
|
|
5752
|
+
// v1.6.5:不必先展开组就能「打开对话」。当前对话本来就在,不给这一项。
|
|
5753
|
+
canOpen
|
|
5754
|
+
? h('button', {
|
|
5755
|
+
type: 'button',
|
|
5756
|
+
key: 'open',
|
|
5757
|
+
className: 'dg-ctxItem',
|
|
5758
|
+
'data-gallery-ctx': 'open-session',
|
|
5759
|
+
title: format(t('groupOpenTip'), { title: String(title ?? '') }),
|
|
5760
|
+
onClick: (event) => {
|
|
5761
|
+
event.stopPropagation()
|
|
5762
|
+
event.preventDefault()
|
|
5763
|
+
onClose()
|
|
5764
|
+
onOpen?.()
|
|
5765
|
+
},
|
|
5766
|
+
}, [
|
|
5767
|
+
h('span', { className: 'dg-ctxIco', key: 'i' }, '↗'),
|
|
5768
|
+
h('span', { key: 'l' }, t('groupOpenSession')),
|
|
5769
|
+
])
|
|
5770
|
+
: null,
|
|
5771
|
+
h('button', {
|
|
5772
|
+
type: 'button',
|
|
5773
|
+
key: 'toggle',
|
|
5774
|
+
className: 'dg-ctxItem',
|
|
5775
|
+
'data-gallery-ctx': hidden ? 'show-session' : 'hide-session',
|
|
5776
|
+
onClick: (event) => {
|
|
5777
|
+
event.stopPropagation()
|
|
5778
|
+
event.preventDefault()
|
|
5779
|
+
onClose()
|
|
5780
|
+
onToggle()
|
|
5781
|
+
},
|
|
5782
|
+
}, [
|
|
5783
|
+
h('span', { className: 'dg-ctxIco', key: 'i' }, hidden ? '👁' : '🚫'),
|
|
5784
|
+
h('span', { key: 'l' }, hidden ? t('ctxShowSession') : t('ctxHideSession')),
|
|
5785
|
+
]),
|
|
5786
|
+
]))
|
|
5787
|
+
}
|
|
5788
|
+
|
|
5441
5789
|
function LabelDialog({ t, item, batchCount, currentCategory, isManual,
|
|
5442
5790
|
onCancel, onApply, onReset }) {
|
|
5443
5791
|
const [next, setNext] = React.useState(
|
|
@@ -6420,8 +6768,128 @@ ${absPath}
|
|
|
6420
6768
|
])
|
|
6421
6769
|
}
|
|
6422
6770
|
|
|
6771
|
+
/**
|
|
6772
|
+
* 同名文件判定(v1.6.3)。
|
|
6773
|
+
*
|
|
6774
|
+
* 老板 11-25 截图:一个对话组里并排两张 `老人手部_GPT25_0.png`,看着就像重复展示。
|
|
6775
|
+
* 实测是两份**真文件**:`漫剧手册分析/` 一份、`退订漫剧/图卡/GPT25备用/` 一份
|
|
6776
|
+
* (后者是他自己拷的备用件),尺寸相同、时间不同。
|
|
6777
|
+
* 卡片原先只显示文件名,两份并排自然分不出 → 这里给「同名 N 份」标出所在目录。
|
|
6778
|
+
*
|
|
6779
|
+
* 只统计**同一视图**内(同组 / 扁平列表)的同名,跨组不参与(跨组共用另有角标语义)。
|
|
6780
|
+
*/
|
|
6781
|
+
function countNamesOf(list) {
|
|
6782
|
+
const counts = new Map()
|
|
6783
|
+
for (const it of Array.isArray(list) ? list : []) {
|
|
6784
|
+
const n = it?.name ?? String(it?.relPath ?? '').split('/').pop()
|
|
6785
|
+
if (n === undefined || n === null || n === '') continue
|
|
6786
|
+
counts.set(n, (counts.get(n) ?? 0) + 1)
|
|
6787
|
+
}
|
|
6788
|
+
return counts
|
|
6789
|
+
}
|
|
6790
|
+
|
|
6791
|
+
/**
|
|
6792
|
+
* 跨对话共用索引(v1.6.4)。
|
|
6793
|
+
*
|
|
6794
|
+
* 老板 11-25 定的口径:两个对话引用同一张图是**事实**(两边的日志都精确引用过),
|
|
6795
|
+
* 既不合并、也不去重 —— 但要把「归属」标出来,让人一眼看出这不是重复数据,
|
|
6796
|
+
* 而是同一个文件同时属于两个对话。
|
|
6797
|
+
*
|
|
6798
|
+
* 顺带把删除/隐藏的边界讲清(这是老板拍板的前提):
|
|
6799
|
+
* · 同名但不同路径的两份真文件 → 各自独立,删一份不动另一份;
|
|
6800
|
+
* · 同一路径的共用件 → 本来就是同一个文件,删/隐必然两处一起生效。
|
|
6801
|
+
*
|
|
6802
|
+
* 按 `data` 引用缓存:面板每帧都会问一次,全库几千条重算会拖慢滚轮与拖动。
|
|
6803
|
+
*/
|
|
6804
|
+
const SHARE_INDEX_CACHE = new WeakMap()
|
|
6805
|
+
|
|
6806
|
+
function shareIndexOf(data) {
|
|
6807
|
+
const none = { byRel: new Map(), countByGroup: new WeakMap() }
|
|
6808
|
+
if (data === null || typeof data !== 'object') return none
|
|
6809
|
+
const cached = SHARE_INDEX_CACHE.get(data)
|
|
6810
|
+
if (cached !== undefined) return cached
|
|
6811
|
+
|
|
6812
|
+
const groups = Array.isArray(data.groups) ? data.groups : []
|
|
6813
|
+
const byRel = new Map()
|
|
6814
|
+
for (const g of groups) {
|
|
6815
|
+
// 「历史资产」池不是真的对话归属,算进来会把一大堆图误标成共用
|
|
6816
|
+
if (g?.isHistory === true) continue
|
|
6817
|
+
const title = String(g?.title ?? '')
|
|
6818
|
+
for (const f of Array.isArray(g?.files) ? g.files : []) {
|
|
6819
|
+
const rel = String(f?.relPath ?? '')
|
|
6820
|
+
if (rel === '') continue
|
|
6821
|
+
const owners = byRel.get(rel)
|
|
6822
|
+
if (owners === undefined) byRel.set(rel, [title])
|
|
6823
|
+
else if (!owners.includes(title)) owners.push(title)
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6827
|
+
const countByGroup = new WeakMap()
|
|
6828
|
+
for (const g of groups) {
|
|
6829
|
+
if (g?.isHistory === true) continue
|
|
6830
|
+
let n = 0
|
|
6831
|
+
for (const f of Array.isArray(g?.files) ? g.files : []) {
|
|
6832
|
+
const owners = byRel.get(String(f?.relPath ?? ''))
|
|
6833
|
+
if (Array.isArray(owners) && owners.length > 1) n += 1
|
|
6834
|
+
}
|
|
6835
|
+
if (n > 0) countByGroup.set(g, n)
|
|
6836
|
+
}
|
|
6837
|
+
|
|
6838
|
+
const built = { byRel, countByGroup }
|
|
6839
|
+
SHARE_INDEX_CACHE.set(data, built)
|
|
6840
|
+
return built
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6843
|
+
/** 兜底:后端没给 `sharedPeers` 时,按已加载的组内条目现算共用对象。 */
|
|
6844
|
+
function sharedPeersOf(group, shareInfo) {
|
|
6845
|
+
const selfTitle = String(group?.title ?? '')
|
|
6846
|
+
const out = []
|
|
6847
|
+
for (const f of Array.isArray(group?.files) ? group.files : []) {
|
|
6848
|
+
const owners = shareInfo.byRel.get(String(f?.relPath ?? ''))
|
|
6849
|
+
if (!Array.isArray(owners)) continue
|
|
6850
|
+
for (const title of owners) {
|
|
6851
|
+
if (title !== selfTitle && !out.includes(title)) out.push(title)
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
return out
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
/**
|
|
6858
|
+
* 组头「共用 N」的悬停说明。
|
|
6859
|
+
*
|
|
6860
|
+
* 共用对象可能一大串(实测有 85 张图牵扯 27 个对话),全塞进组头会撑爆,
|
|
6861
|
+
* 所以明细放悬停里,最多点 3 个名字,其余折成「等 N 个对话」。
|
|
6862
|
+
* 末尾必须把删除/隐藏的边界讲明 —— 这是老板拍板时问的那一句。
|
|
6863
|
+
*/
|
|
6864
|
+
function sharedTipOf(t, n, peers) {
|
|
6865
|
+
const names = (Array.isArray(peers) ? peers : [])
|
|
6866
|
+
.map((s) => String(s ?? '').trim())
|
|
6867
|
+
.filter((s) => s !== '')
|
|
6868
|
+
let who
|
|
6869
|
+
if (names.length === 0) {
|
|
6870
|
+
who = t('sharedWithSome')
|
|
6871
|
+
} else if (names.length <= 3) {
|
|
6872
|
+
who = names.map((s) => `「${s}」`).join('、')
|
|
6873
|
+
} else {
|
|
6874
|
+
who = format(t('sharedWithMany'), {
|
|
6875
|
+
n: names.length,
|
|
6876
|
+
first: names.slice(0, 3).map((s) => `「${s}」`).join('、'),
|
|
6877
|
+
})
|
|
6878
|
+
}
|
|
6879
|
+
return format(t('groupSharedTip'), { n, who })
|
|
6880
|
+
}
|
|
6881
|
+
|
|
6882
|
+
/** 相对路径的所在目录(取尾两段,足够区分同名文件;根目录返回空串)。 */
|
|
6883
|
+
function dirLabelOf(relPath) {
|
|
6884
|
+
const rel = String(relPath ?? '').replace(/\\/g, '/')
|
|
6885
|
+
const cut = rel.lastIndexOf('/')
|
|
6886
|
+
if (cut < 0) return ''
|
|
6887
|
+
const segs = rel.slice(0, cut).split('/').filter((s) => s !== '')
|
|
6888
|
+
return segs.slice(-2).join('/')
|
|
6889
|
+
}
|
|
6890
|
+
|
|
6423
6891
|
/** 单张缩略图卡片:独立加载、独立失败,互不影响。 */
|
|
6424
|
-
function Card({ item, t, onOpen, limiter, onContextMenu, onDoubleClick }) {
|
|
6892
|
+
function Card({ item, t, onOpen, limiter, onContextMenu, onDoubleClick, nameCounts }) {
|
|
6425
6893
|
const [state, setState] = React.useState({ status: 'pending' })
|
|
6426
6894
|
const [node, setNode] = React.useState(null)
|
|
6427
6895
|
// v0.17.0:单击延迟计时器(双击时取消,避免「闪一下大图」)
|
|
@@ -6507,6 +6975,15 @@ ${absPath}
|
|
|
6507
6975
|
? format(t('dims'), { w: item.width, h: item.height })
|
|
6508
6976
|
: t('dimsUnknown')
|
|
6509
6977
|
|
|
6978
|
+
// v1.6.3:同名文件 → 显示「同名 N 份 · 所在目录」,让两份真文件一眼可分
|
|
6979
|
+
const sameCount = nameCounts instanceof Map
|
|
6980
|
+
? (nameCounts.get(item.name) ?? 0)
|
|
6981
|
+
: 0
|
|
6982
|
+
const dirLabel = sameCount > 1 ? dirLabelOf(item.relPath) : ''
|
|
6983
|
+
// v1.6.5:这张图同时被几个对话记录着。后端在分组时就按全量打好(≥2 才有),
|
|
6984
|
+
// 前端只负责显示 —— 绝不能自己按已加载的 60 条数,那样大组会全部显示成 60。
|
|
6985
|
+
const sharedWith = Number(item.sharedWith) >= 2 ? Math.trunc(Number(item.sharedWith)) : 0
|
|
6986
|
+
|
|
6510
6987
|
return h('button', {
|
|
6511
6988
|
type: 'button',
|
|
6512
6989
|
ref: setNode,
|
|
@@ -6567,6 +7044,24 @@ ${absPath}
|
|
|
6567
7044
|
: t('loading')),
|
|
6568
7045
|
),
|
|
6569
7046
|
h('div', { className: 'dg-meta', key: 'meta' }, [
|
|
7047
|
+
// v1.6.3:同名提醒放在文件名上方,只在重名时出现;目录用琥珀色,
|
|
7048
|
+
// 与「分类角标」的绿/橙/灰错开,避免被误读成又一个分类。
|
|
7049
|
+
sameCount > 1
|
|
7050
|
+
? h('span', {
|
|
7051
|
+
className: 'dg-dir',
|
|
7052
|
+
key: 'dir',
|
|
7053
|
+
title: `${item.relPath}`,
|
|
7054
|
+
'data-gallery-same-name': String(sameCount),
|
|
7055
|
+
}, format(t('sameNameIn'), { n: sameCount, dir: dirLabel === '' ? t('rootDir') : dirLabel }))
|
|
7056
|
+
: null,
|
|
7057
|
+
sharedWith > 0
|
|
7058
|
+
? h('span', {
|
|
7059
|
+
className: 'dg-sharedWith',
|
|
7060
|
+
key: 'sharedWith',
|
|
7061
|
+
title: format(t('cardSharedWithHint'), { n: sharedWith }),
|
|
7062
|
+
'data-gallery-card-shared': String(sharedWith),
|
|
7063
|
+
}, format(t('cardSharedWith'), { n: sharedWith }))
|
|
7064
|
+
: null,
|
|
6570
7065
|
h('span', { className: 'dg-name', key: 'name' }, item.name),
|
|
6571
7066
|
h('span', { className: 'dg-dim', key: 'dim' }, dims),
|
|
6572
7067
|
h('span', { className: 'dg-dim', key: 'time' }, formatTime(item.mtime)),
|
|
@@ -9634,6 +10129,12 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
9634
10129
|
const [page, setPage] = React.useState(1)
|
|
9635
10130
|
// 设置面板开关(改产出根目录)
|
|
9636
10131
|
const [settingsOpen, setSettingsOpen] = React.useState(false)
|
|
10132
|
+
/**
|
|
10133
|
+
* 导出记录面板(v1.6.2)。
|
|
10134
|
+
* 老板的原话:导出完只有一条几秒就消失的提示,事后想再用这批清单,
|
|
10135
|
+
* 只能自己去 `~\.dsh\gallery-exports\` 里翻,而且多次导出的文件混在一起认不出。
|
|
10136
|
+
* 这里常驻一个入口,列历史清单(来源 / 时间 / 条数),点一下就「写进输入框」。 */
|
|
10137
|
+
const [exportHistoryOpen, setExportHistoryOpen] = React.useState(false)
|
|
9637
10138
|
// 全局分组:哪些组是展开的(键是 sessionId 或 '__history__')
|
|
9638
10139
|
const [openGroups, setOpenGroups] = React.useState(new Set())
|
|
9639
10140
|
// 每组额外取回来的明细(首次只有 60 张,点「再显示」再追加 60 张)。
|
|
@@ -9806,16 +10307,67 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
9806
10307
|
const selectMode = batchMode || selected.size > 0
|
|
9807
10308
|
/** 清废稿确认对话框:null=关闭;{ phase:'list'|'deleting', files, digest, count } */
|
|
9808
10309
|
const [discardDialog, setDiscardDialog] = React.useState(null)
|
|
10310
|
+
// v1.6.5:已归档 / 已隐藏 / 历史资产 三类组「默认继承上次扫描结果」。
|
|
10311
|
+
// 轮询不会为它们重取明细;只有点开其中一个时,才对那一个强制刷新一次。
|
|
10312
|
+
// 历史池(3000+ 张,比任何单个对话都多)也照此办理 —— 它没有 sessionId,
|
|
10313
|
+
// 统一用 '__history__' 这个键,后端 groupMore 的 keyOf 也是这么算的。
|
|
10314
|
+
// 🔴 ref 镜像(渲染体每帧回写),绝不在 setState 的 updater 里发副作用:
|
|
10315
|
+
// React 严格模式会把 updater 跑两遍,刷新就会发两次。
|
|
10316
|
+
const openGroupsRef = React.useRef(openGroups)
|
|
10317
|
+
openGroupsRef.current = openGroups
|
|
10318
|
+
const tuckedRef = React.useRef(new Set())
|
|
10319
|
+
const tuckedRefreshedRef = React.useRef(new Set())
|
|
10320
|
+
const forceRefreshTuckedGroup = React.useCallback((key) => {
|
|
10321
|
+
if (typeof key !== 'string' || key === '') return
|
|
10322
|
+
const isHistory = key === '__history__'
|
|
10323
|
+
// 历史池要用主列表同一把尺子扫(props.sessionId),别拿 '__history__' 当会话 id。
|
|
10324
|
+
const scanSid = isHistory ? sessionId : key
|
|
10325
|
+
void callHost('groupMore', {
|
|
10326
|
+
kind, scope: 'global', sessionId: scanSid, groupKey: key,
|
|
10327
|
+
offset: 0, limit: 5000, force: true,
|
|
10328
|
+
}).then((p) => {
|
|
10329
|
+
if (p?.ok !== true || !Array.isArray(p.files) || p.files.length === 0) return
|
|
10330
|
+
setView((prev) => {
|
|
10331
|
+
if (prev.status !== 'ready' || !Array.isArray(prev.data?.groups)) return prev
|
|
10332
|
+
const idx = prev.data.groups.findIndex(
|
|
10333
|
+
(g) => String(g?.sessionId ?? '__history__') === key)
|
|
10334
|
+
if (idx < 0) return prev
|
|
10335
|
+
const nextGroups = prev.data.groups.slice()
|
|
10336
|
+
nextGroups[idx] = {
|
|
10337
|
+
...nextGroups[idx],
|
|
10338
|
+
files: p.files,
|
|
10339
|
+
fileCount: typeof p.fileCount === 'number'
|
|
10340
|
+
? p.fileCount
|
|
10341
|
+
: (Number(p.total) || p.files.length),
|
|
10342
|
+
returnedCount: p.files.length,
|
|
10343
|
+
}
|
|
10344
|
+
return { ...prev, data: { ...prev.data, groups: nextGroups } }
|
|
10345
|
+
})
|
|
10346
|
+
}).catch(() => { /* 刷不到就继续用上次那一份,不抹掉已有卡片 */ })
|
|
10347
|
+
}, [callHost, kind, sessionId])
|
|
9809
10348
|
const toggleGroup = React.useCallback((key) => {
|
|
10349
|
+
const willOpen = !openGroupsRef.current.has(key)
|
|
10350
|
+
// 一次会话内同一个收起组只自动刷一次;想再刷新用顶部的「刷新」按钮(全量)。
|
|
10351
|
+
if (willOpen && tuckedRef.current.has(key) && !tuckedRefreshedRef.current.has(key)) {
|
|
10352
|
+
tuckedRefreshedRef.current.add(key)
|
|
10353
|
+
forceRefreshTuckedGroup(key)
|
|
10354
|
+
}
|
|
9810
10355
|
setOpenGroups((prev) => {
|
|
9811
10356
|
const next = new Set(prev)
|
|
9812
10357
|
if (next.has(key)) next.delete(key)
|
|
9813
10358
|
else next.add(key)
|
|
9814
10359
|
return next
|
|
9815
10360
|
})
|
|
9816
|
-
}, [])
|
|
10361
|
+
}, [forceRefreshTuckedGroup])
|
|
9817
10362
|
// 组内中间产物开关已并入顶部分类筛选(v0.14.3)。
|
|
9818
10363
|
// 右键菜单:{ item, absPath, x, y }
|
|
10364
|
+
// v1.6.5:全局资产的「已隐藏对话」/「已归档对话」合集。只记显示位置,不动文件、不动会话。
|
|
10365
|
+
const [hiddenSessionIds, setHiddenSessionIds] = React.useState(() => new Set())
|
|
10366
|
+
// 合集是否展开(默认收起:藏起来的东西不该继续占地方)
|
|
10367
|
+
const [hiddenOpen, setHiddenOpen] = React.useState(false)
|
|
10368
|
+
const [archivedOpen, setArchivedOpen] = React.useState(false)
|
|
10369
|
+
// 组行右键菜单:{ sessionId, title, hidden, x, y } | null
|
|
10370
|
+
const [groupMenu, setGroupMenu] = React.useState(null)
|
|
9819
10371
|
const [ctxMenu, setCtxMenu] = React.useState(null)
|
|
9820
10372
|
// v0.16.0:右键空白处(非卡片)弹出的「粘贴」菜单
|
|
9821
10373
|
const [pasteMenu, setPasteMenu] = React.useState(null)
|
|
@@ -10451,9 +11003,82 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10451
11003
|
})
|
|
10452
11004
|
}, [])
|
|
10453
11005
|
|
|
11006
|
+
/**
|
|
11007
|
+
* 粘贴/操作提示(成功/失败)。
|
|
11008
|
+
*
|
|
11009
|
+
* v1.6.0:支持带按钮 —— 导出清单后要能「打开文件夹 / 复制路径 / 写进输入框」,
|
|
11010
|
+
* 删除或隐藏后要能点「撤销」。带按钮时停留 6 秒(默认 3 秒),且允许鼠标点。
|
|
11011
|
+
*
|
|
11012
|
+
* 声明位置刻意早于 doHide / doDelete:useCallback 的依赖数组在**渲染时立即求值**,
|
|
11013
|
+
* 引用后面声明的 const 会直接 TDZ 白屏(v0.16.0 踩过)。
|
|
11014
|
+
*/
|
|
11015
|
+
const [pasteNotice, setPasteNotice] = React.useState(null)
|
|
11016
|
+
const showPasteNotice = React.useCallback((kindOf, text, actions) => {
|
|
11017
|
+
setPasteNotice({
|
|
11018
|
+
kind: kindOf,
|
|
11019
|
+
text,
|
|
11020
|
+
actions: Array.isArray(actions) && actions.length > 0 ? actions : null,
|
|
11021
|
+
})
|
|
11022
|
+
}, [])
|
|
11023
|
+
|
|
11024
|
+
/**
|
|
11025
|
+
* 撤销栈(Ctrl+Z):只记「还能撤的动作」,最多 10 步,先进后出。
|
|
11026
|
+
*
|
|
11027
|
+
* 用 ref 而不是 state:撤销是「按下快捷键那一刻取最新值」,
|
|
11028
|
+
* 不需要触发重渲染,也不该因为加一条记录就整面板重画。
|
|
11029
|
+
*/
|
|
11030
|
+
const undoStackRef = React.useRef([])
|
|
11031
|
+
// 提示条上的「撤销」按钮点下去要走同一个执行器;执行器在下面才声明,
|
|
11032
|
+
// 所以这里留一个 ref 由 effect 回填(别在提示按钮里直接引用后面声明的 const)。
|
|
11033
|
+
const undoRef = React.useRef(null)
|
|
11034
|
+
/**
|
|
11035
|
+
* 撤销「作用域」键:全局资产 / 某个对话 / 各类画廊(图片、文件、音视频)各算一个。
|
|
11036
|
+
*
|
|
11037
|
+
* 2026-11-25(老板报):原来撤销就是一个先进后出的栈,按删除倒序撤,
|
|
11038
|
+
* 跟「现在在看哪个对话」完全无关 —— 在 A 对话里点 Ctrl+Z,可能把 B 对话
|
|
11039
|
+
* 刚删的东西搬回来,看着莫名其妙。现在每批操作记下它发生在哪个视图,
|
|
11040
|
+
* Ctrl+Z 只撤**当前视图**里的那一批;当前视图没有就直说「最近一批在 XX 里」。
|
|
11041
|
+
*/
|
|
11042
|
+
const viewKeyOf = React.useCallback(
|
|
11043
|
+
() => `${kind}|${scope}|${scope === 'session' ? String(sessionId ?? '') : ''}`,
|
|
11044
|
+
[kind, scope, sessionId],
|
|
11045
|
+
)
|
|
11046
|
+
/**
|
|
11047
|
+
* 当前对话标题(v1.6.2)。
|
|
11048
|
+
* 老板的原话:撤销提示只写「当前对话」,看不出是哪一段 —— 切了几个对话之后
|
|
11049
|
+
* 根本不知道自己刚撤的是哪一批。这里从 scan 结果的 groups 里取 isCurrent 那组的
|
|
11050
|
+
* title(会话视图只有一个组,取不到 isCurrent 就退到第一个)。
|
|
11051
|
+
*/
|
|
11052
|
+
const currentSessionTitleOf = React.useCallback(() => {
|
|
11053
|
+
const groups = Array.isArray(view?.data?.groups) ? view.data.groups : []
|
|
11054
|
+
const hit = groups.find((g) => g?.isCurrent === true) ?? (scope === 'session' ? groups[0] : undefined)
|
|
11055
|
+
return String(hit?.title ?? '').trim()
|
|
11056
|
+
}, [view, scope])
|
|
11057
|
+
const whereOf = React.useCallback(() => {
|
|
11058
|
+
if (scope !== 'session') return t('whereGlobal')
|
|
11059
|
+
const title = currentSessionTitleOf()
|
|
11060
|
+
return title === '' ? t('whereSession') : format(t('whereSessionNamed'), { name: title })
|
|
11061
|
+
}, [scope, t, currentSessionTitleOf])
|
|
11062
|
+
const kindLabelOf = React.useCallback(
|
|
11063
|
+
() => (kind === 'file' ? t('kindFile') : kind === 'media' ? t('kindMedia') : t('kindImage')),
|
|
11064
|
+
[kind, t],
|
|
11065
|
+
)
|
|
11066
|
+
const pushUndo = React.useCallback((entry) => {
|
|
11067
|
+
const stack = undoStackRef.current
|
|
11068
|
+
stack.push({
|
|
11069
|
+
...entry,
|
|
11070
|
+
at: Date.now(),
|
|
11071
|
+
view: viewKeyOf(),
|
|
11072
|
+
where: whereOf(),
|
|
11073
|
+
kindLabel: kindLabelOf(),
|
|
11074
|
+
})
|
|
11075
|
+
while (stack.length > 20) stack.shift()
|
|
11076
|
+
}, [viewKeyOf, whereOf, kindLabelOf])
|
|
11077
|
+
|
|
10454
11078
|
/**
|
|
10455
11079
|
* 隐藏条目(只从列表移除,不动文件)。
|
|
10456
11080
|
* 2026-11-25:接受单个条目或 relPath 数组;批量隐藏一次写完。
|
|
11081
|
+
* v1.6.0:隐藏可撤销(写进撤销栈 + 提示条带「撤销」按钮)。
|
|
10457
11082
|
*/
|
|
10458
11083
|
const doHide = React.useCallback(async (target) => {
|
|
10459
11084
|
const rels = (Array.isArray(target) ? target : [target?.relPath ?? ''])
|
|
@@ -10465,11 +11090,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10465
11090
|
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('errorTitle'))
|
|
10466
11091
|
setSelected(new Set())
|
|
10467
11092
|
setBatchMode(false)
|
|
11093
|
+
pushUndo({ kind: 'hide', rels })
|
|
11094
|
+
showPasteNotice('ok', format(t('undoHideOk'), { n: rels.length }), [
|
|
11095
|
+
{ label: t('undoAction'), onClick: () => { void undoRef.current?.() } },
|
|
11096
|
+
])
|
|
10468
11097
|
await load(undefined, kind, scope, page).then((data) => setView({ status: 'ready', data })).catch(() => {})
|
|
10469
11098
|
} catch (error) {
|
|
10470
11099
|
console.error('dsh-gallery: 隐藏失败', error)
|
|
11100
|
+
showPasteNotice('fail', t('ctxHideFailed'))
|
|
10471
11101
|
}
|
|
10472
|
-
}, [load, kind, scope, page, t])
|
|
11102
|
+
}, [load, kind, scope, page, t, showPasteNotice, pushUndo])
|
|
10473
11103
|
|
|
10474
11104
|
/** 在资源管理器里定位。 */
|
|
10475
11105
|
const doReveal = React.useCallback(async (item) => {
|
|
@@ -10481,11 +11111,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10481
11111
|
}
|
|
10482
11112
|
}, [t])
|
|
10483
11113
|
|
|
10484
|
-
/**
|
|
10485
|
-
const [pasteNotice, setPasteNotice] = React.useState(null)
|
|
10486
|
-
const showPasteNotice = React.useCallback((kindOf, text) => {
|
|
10487
|
-
setPasteNotice({ kind: kindOf, text })
|
|
10488
|
-
}, [])
|
|
11114
|
+
/** 粘贴/操作提示(成功/失败)的声明已提前到 doHide 之前(带按钮 + 撤销栈)。 */
|
|
10489
11115
|
|
|
10490
11116
|
/**
|
|
10491
11117
|
* 执行删除(需二次确认)。
|
|
@@ -10502,10 +11128,20 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10502
11128
|
try {
|
|
10503
11129
|
const payload = await callHost('delete', { paths: rels, confirm: true })
|
|
10504
11130
|
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('errorTitle'))
|
|
11131
|
+
const deletedCount = Array.isArray(payload?.deletedPaths) ? payload.deletedPaths.length : 0
|
|
11132
|
+
const undoToken = String(payload?.undoToken ?? '')
|
|
10505
11133
|
const failed = (Array.isArray(payload?.failed) ? payload.failed.length : 0)
|
|
10506
11134
|
+ (Array.isArray(payload?.notFound) ? payload.notFound.length : 0)
|
|
11135
|
+
const undoActions = undoToken === ''
|
|
11136
|
+
? null
|
|
11137
|
+
: [{ label: t('undoAction'), onClick: () => { void undoRef.current?.() } }]
|
|
11138
|
+
if (deletedCount > 0 && undoToken !== '') {
|
|
11139
|
+
pushUndo({ kind: 'delete', token: undoToken, count: deletedCount })
|
|
11140
|
+
}
|
|
10507
11141
|
if (failed > 0) {
|
|
10508
|
-
showPasteNotice('fail', format(t('ctxDeletePartial'), { n:
|
|
11142
|
+
showPasteNotice('fail', format(t('ctxDeletePartial'), { n: deletedCount, fail: failed }), undoActions)
|
|
11143
|
+
} else if (deletedCount > 0) {
|
|
11144
|
+
showPasteNotice('ok', format(t('undoDeleteOk'), { n: deletedCount }), undoActions)
|
|
10509
11145
|
}
|
|
10510
11146
|
setDeleteTarget(null)
|
|
10511
11147
|
setSelected(new Set())
|
|
@@ -10517,7 +11153,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10517
11153
|
setDeleteTarget(null)
|
|
10518
11154
|
showPasteNotice('fail', t('ctxDeleteFailed'))
|
|
10519
11155
|
}
|
|
10520
|
-
}, [deleteTarget, load, kind, scope, page, t, showPasteNotice])
|
|
11156
|
+
}, [deleteTarget, load, kind, scope, page, t, showPasteNotice, pushUndo])
|
|
10521
11157
|
|
|
10522
11158
|
const refresh = React.useCallback(async () => {
|
|
10523
11159
|
setRefreshing(true)
|
|
@@ -10534,7 +11170,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10534
11170
|
// ---- v0.16.0 粘贴:剪贴板图片/文件作为「素材」落当前对话 ----
|
|
10535
11171
|
React.useEffect(() => {
|
|
10536
11172
|
if (pasteNotice === null) return undefined
|
|
10537
|
-
|
|
11173
|
+
// 带按钮的提示多留一会儿,够手点;纯文字提示 3 秒就够。
|
|
11174
|
+
const timer = setTimeout(() => setPasteNotice(null), pasteNotice.actions === null ? 3000 : 6000)
|
|
10538
11175
|
return () => clearTimeout(timer)
|
|
10539
11176
|
}, [pasteNotice])
|
|
10540
11177
|
|
|
@@ -10807,6 +11444,33 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10807
11444
|
}
|
|
10808
11445
|
}, [callHost, t, showPasteNotice])
|
|
10809
11446
|
|
|
11447
|
+
/**
|
|
11448
|
+
* 导出记录(v1.6.2)。
|
|
11449
|
+
*
|
|
11450
|
+
* 老板要的是「事后还能用」:一次导出只弹几秒提示,等于只有当场能引用;
|
|
11451
|
+
* 多次导出后文件名又认不出谁是谁。这里把 host 侧的登记读回来,
|
|
11452
|
+
* 列成一张常驻的表 —— 每条都能重新「写进输入框」,新开对话也能直接接上。
|
|
11453
|
+
*/
|
|
11454
|
+
const [exportHistory, setExportHistory] = React.useState({ status: 'idle', items: [], dir: '' })
|
|
11455
|
+
const loadExportHistory = React.useCallback(async () => {
|
|
11456
|
+
setExportHistory((prev) => ({ ...prev, status: 'loading' }))
|
|
11457
|
+
try {
|
|
11458
|
+
const payload = await callHost('exportList', {})
|
|
11459
|
+
if (payload?.ok !== true) throw new Error(payload?.error?.message ?? 'exportList failed')
|
|
11460
|
+
setExportHistory({
|
|
11461
|
+
status: 'ready',
|
|
11462
|
+
dir: String(payload?.dir ?? ''),
|
|
11463
|
+
items: Array.isArray(payload?.items) ? payload.items : [],
|
|
11464
|
+
})
|
|
11465
|
+
} catch (error) {
|
|
11466
|
+
setExportHistory({ status: 'failed', dir: '', items: [], message: String(error?.message ?? error) })
|
|
11467
|
+
}
|
|
11468
|
+
}, [callHost])
|
|
11469
|
+
const openExportHistory = React.useCallback(() => {
|
|
11470
|
+
setExportHistoryOpen(true)
|
|
11471
|
+
void loadExportHistory()
|
|
11472
|
+
}, [loadExportHistory])
|
|
11473
|
+
|
|
10810
11474
|
/**
|
|
10811
11475
|
* 导出交付清单(v1.5.0)。
|
|
10812
11476
|
*
|
|
@@ -10820,21 +11484,78 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10820
11484
|
.map((p) => String(p ?? '')).filter((p) => p !== ''))]
|
|
10821
11485
|
if (paths.length === 0) return false
|
|
10822
11486
|
try {
|
|
11487
|
+
// v1.6.2:把「这批是哪儿导的」一起交给 host ——
|
|
11488
|
+
// 文件名因此变成 `交付清单_<来源>_<时间>_<分类>_<N>张.csv`,导出记录里也有来源。
|
|
11489
|
+
const sourceLabel = scope === 'session'
|
|
11490
|
+
? (currentSessionTitleOf() || t('whereSession'))
|
|
11491
|
+
: t('whereGlobal')
|
|
10823
11492
|
const payload = await callHost('exportManifest', {
|
|
10824
11493
|
relPaths: paths,
|
|
10825
11494
|
format: 'both',
|
|
10826
11495
|
includeNotes: true,
|
|
11496
|
+
sourceLabel,
|
|
11497
|
+
sessionTitle: scope === 'session' ? currentSessionTitleOf() : '',
|
|
10827
11498
|
})
|
|
10828
11499
|
if (payload?.ok !== true) throw new Error(payload?.error?.message ?? 'exportManifest failed')
|
|
10829
11500
|
const files = Array.isArray(payload.files) ? payload.files : []
|
|
10830
|
-
|
|
10831
|
-
|
|
11501
|
+
// 主路径给 CSV(Excel 直接能开);JSON 落在同名 .json,路径只差扩展名。
|
|
11502
|
+
const csvFile = files.find((f) => String(f?.path ?? '').toLowerCase().endsWith('.csv')) ?? files[0]
|
|
11503
|
+
const head = String(csvFile?.path ?? '') || String(payload.dir ?? '')
|
|
11504
|
+
const count = Number(payload.count) || paths.length
|
|
11505
|
+
// v1.6.2:提示里只报文件名。以前整条绝对路径塞进去,窄面板下被压成一字一行。
|
|
11506
|
+
const baseName = String(payload?.base ?? '')
|
|
11507
|
+
const fileName = baseName !== ''
|
|
11508
|
+
? `${baseName}.csv`
|
|
11509
|
+
: (String(csvFile?.path ?? '').split(/[\\/]/).pop() ?? '')
|
|
11510
|
+
/**
|
|
11511
|
+
* v1.6.0:落盘地址不再只躺着给人看,三个按钮各管一件事 ——
|
|
11512
|
+
* · 打开文件夹:系统文件管理器打开导出目录(Host 只认这一个目录,不收任意路径);
|
|
11513
|
+
* · 复制路径:粘到别处 / 发给别人;
|
|
11514
|
+
* · 写进输入框:把路径递给助手,下一轮直接读这份清单。
|
|
11515
|
+
* v1.6.2:再加「导出记录」—— 提示几秒就消失,得留个能翻旧账的入口。
|
|
11516
|
+
*/
|
|
11517
|
+
showPasteNotice('ok', format(t('exportOk'), { n: count, name: fileName }), [
|
|
11518
|
+
{
|
|
11519
|
+
label: t('exportHistoryOpen'),
|
|
11520
|
+
onClick: () => { openExportHistory() },
|
|
11521
|
+
},
|
|
11522
|
+
{
|
|
11523
|
+
label: t('exportOpenDir'),
|
|
11524
|
+
onClick: () => {
|
|
11525
|
+
void callHost('openExportDir', {}).then((r) => {
|
|
11526
|
+
if (r?.ok === false) throw new Error(r?.error?.message ?? t('exportOpenFailed'))
|
|
11527
|
+
}).catch((error) => {
|
|
11528
|
+
showPasteNotice('fail', format(t('exportOpenFailed'), { message: String(error?.message ?? error) }))
|
|
11529
|
+
})
|
|
11530
|
+
},
|
|
11531
|
+
},
|
|
11532
|
+
{
|
|
11533
|
+
label: t('exportCopyPath'),
|
|
11534
|
+
onClick: () => {
|
|
11535
|
+
void copyText(head).then((ok) => {
|
|
11536
|
+
showPasteNotice(ok ? 'ok' : 'fail', ok ? t('exportPathCopied') : t('exportPathCopyFailed'))
|
|
11537
|
+
})
|
|
11538
|
+
},
|
|
11539
|
+
},
|
|
11540
|
+
{
|
|
11541
|
+
label: t('exportToComposer'),
|
|
11542
|
+
onClick: () => {
|
|
11543
|
+
void writeDraftToComposer(`交付清单(${count} 条):${head}`, sessionId).then((result) => {
|
|
11544
|
+
if (result?.ok === true) showPasteNotice('ok', t('exportDraftReady'))
|
|
11545
|
+
else { void copyText(head); showPasteNotice('fail', t('exportDraftInClipboard')) }
|
|
11546
|
+
}).catch(() => {
|
|
11547
|
+
void copyText(head)
|
|
11548
|
+
showPasteNotice('fail', t('exportDraftInClipboard'))
|
|
11549
|
+
})
|
|
11550
|
+
},
|
|
11551
|
+
},
|
|
11552
|
+
])
|
|
10832
11553
|
return true
|
|
10833
11554
|
} catch (error) {
|
|
10834
11555
|
showPasteNotice('fail', format(t('exportFailed'), { message: String(error?.message ?? error) }))
|
|
10835
11556
|
return false
|
|
10836
11557
|
}
|
|
10837
|
-
}, [callHost, t, showPasteNotice])
|
|
11558
|
+
}, [callHost, t, showPasteNotice, sessionId, scope, currentSessionTitleOf, openExportHistory])
|
|
10838
11559
|
|
|
10839
11560
|
React.useEffect(() => {
|
|
10840
11561
|
let alive = true
|
|
@@ -10882,8 +11603,23 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10882
11603
|
changesVersionRef.current = v
|
|
10883
11604
|
const changed = Array.isArray(r.changed) ? r.changed : []
|
|
10884
11605
|
|
|
11606
|
+
// v1.6.5:已归档 / 已隐藏 / 历史资产 三类组「默认继承上次扫描结果」。
|
|
11607
|
+
// 这些组的变动不触发 groupMore(缓存过期会引发一次全库扫描,是卡顿大头),
|
|
11608
|
+
// 也不触发整表 refresh;只把版本号 ack 掉,等用户点开对应组再刷那一个。
|
|
11609
|
+
// 无归属(sessionId 为空)的变动归到历史池 '__history__',一样被过滤。
|
|
11610
|
+
const tucked = tuckedRef.current
|
|
11611
|
+
const keyOfChange = (c) => {
|
|
11612
|
+
const sid = String(c?.sessionId ?? '')
|
|
11613
|
+
return sid === '' ? '__history__' : sid
|
|
11614
|
+
}
|
|
11615
|
+
const activeChanged = changed.filter((c) => !tucked.has(keyOfChange(c)))
|
|
11616
|
+
if (activeChanged.length === 0) {
|
|
11617
|
+
void callHost('changesAck', { since: v }).catch(() => {})
|
|
11618
|
+
return
|
|
11619
|
+
}
|
|
11620
|
+
|
|
10885
11621
|
// v1.3.0:记下这批新增的时间,供卡片高亮「刚产出的终稿」
|
|
10886
|
-
const addTimes =
|
|
11622
|
+
const addTimes = activeChanged
|
|
10887
11623
|
.filter((c) => Number(c?.added) > 0)
|
|
10888
11624
|
.map((c) => Number(c?.at) || 0)
|
|
10889
11625
|
.filter((t) => t > 0)
|
|
@@ -10896,20 +11632,36 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10896
11632
|
? cur.data.groups : null
|
|
10897
11633
|
const canPartial = groups !== null
|
|
10898
11634
|
&& scope !== 'session'
|
|
10899
|
-
&&
|
|
10900
|
-
&&
|
|
11635
|
+
&& activeChanged.length > 0
|
|
11636
|
+
&& activeChanged.every((c) => String(c?.sessionId ?? '') !== '')
|
|
10901
11637
|
|
|
10902
11638
|
if (!canPartial) { void refresh(); return }
|
|
10903
11639
|
|
|
10904
11640
|
// 逐个组重取明细
|
|
11641
|
+
//
|
|
11642
|
+
// 🔴 2026-11-25 修(老板实测「全局里其他对话资产显示不全」):
|
|
11643
|
+
// 旧调用只传了 { kind, scope, sessionId, page },**没传 groupKey**,
|
|
11644
|
+
// 服务端按 groupKey 找不到组,直接回 { ok:true, files:[] };
|
|
11645
|
+
// 前端拿到空数组后把整组 files 覆盖成空 —— 那一组就只剩几条纹丝不动的旧卡。
|
|
11646
|
+
// 同时 limit 被 clamp 到 60,大组重取也会被截断。
|
|
11647
|
+
// 现在:带 groupKey、要全量;空返回但声称有内容时不信它,整表重来。
|
|
10905
11648
|
const fresh = new Map()
|
|
10906
11649
|
let needFull = false
|
|
10907
|
-
for (const c of
|
|
11650
|
+
for (const c of activeChanged) {
|
|
10908
11651
|
const sid = String(c?.sessionId ?? '')
|
|
10909
11652
|
if (sid === '') { needFull = true; break }
|
|
10910
11653
|
try {
|
|
10911
|
-
const p = await callHost('groupMore', {
|
|
11654
|
+
const p = await callHost('groupMore', {
|
|
11655
|
+
kind,
|
|
11656
|
+
scope: 'global',
|
|
11657
|
+
sessionId: sid,
|
|
11658
|
+
groupKey: sid,
|
|
11659
|
+
offset: 0,
|
|
11660
|
+
limit: 5000,
|
|
11661
|
+
})
|
|
10912
11662
|
if (p?.ok === false) { needFull = true; break }
|
|
11663
|
+
const got = Array.isArray(p?.files) ? p.files : []
|
|
11664
|
+
if (got.length === 0 && Number(p?.total) > 0) { needFull = true; break }
|
|
10913
11665
|
fresh.set(sid, p)
|
|
10914
11666
|
} catch { needFull = true; break }
|
|
10915
11667
|
}
|
|
@@ -10928,10 +11680,20 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10928
11680
|
const files = Array.isArray(p?.files) ? p.files
|
|
10929
11681
|
: (Array.isArray(p?.items) ? p.items : null)
|
|
10930
11682
|
if (files === null) { sawUnknownGroup = true; continue }
|
|
11683
|
+
// 原本有内容却回空:不信它,整表重来。少画几张顶多刷新一下,
|
|
11684
|
+
// 把整组抹掉才是真事故(老板报过「其他对话资产显示不全」)。
|
|
11685
|
+
if (files.length === 0 && Number(nextGroups[idx].fileCount) > 0) {
|
|
11686
|
+
sawUnknownGroup = true
|
|
11687
|
+
continue
|
|
11688
|
+
}
|
|
10931
11689
|
nextGroups[idx] = {
|
|
10932
11690
|
...nextGroups[idx],
|
|
10933
11691
|
files,
|
|
10934
|
-
|
|
11692
|
+
// groupMore 回的是 total 而不是 fileCount,这里两个都认:
|
|
11693
|
+
// 只认 fileCount 会一直沿用旧值,「再显示」按钮的判据就飘了。
|
|
11694
|
+
fileCount: typeof p.fileCount === 'number'
|
|
11695
|
+
? p.fileCount
|
|
11696
|
+
: (Number(p.total) || files.length),
|
|
10935
11697
|
returnedCount: files.length,
|
|
10936
11698
|
counts: p.counts ?? nextGroups[idx].counts,
|
|
10937
11699
|
latestMtime: p.latestMtime ?? nextGroups[idx].latestMtime,
|
|
@@ -10965,6 +11727,92 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10965
11727
|
if (typeof fn === 'function') fn()
|
|
10966
11728
|
}, [])
|
|
10967
11729
|
|
|
11730
|
+
/**
|
|
11731
|
+
* 撤销最近一步(Ctrl+Z 与提示条上的「撤销」按钮共用这一条路)。
|
|
11732
|
+
*
|
|
11733
|
+
* 只认两类动作:删除(把这一批从回收区搬回原位)、隐藏(取消隐藏)。
|
|
11734
|
+
* 每撤一步就弹掉栈里一条;栈空时明确说一句「没有可撤销的操作」,
|
|
11735
|
+
* 不静默无反应 —— 否则人会以为快捷键没生效。
|
|
11736
|
+
*/
|
|
11737
|
+
const runUndo = React.useCallback(async () => {
|
|
11738
|
+
const stack = undoStackRef.current
|
|
11739
|
+
const key = viewKeyOf()
|
|
11740
|
+
// 只撤「当前视图」里的那一批;跨视图不撤,避免把人别处删的东西搬回来
|
|
11741
|
+
let idx = -1
|
|
11742
|
+
for (let i = stack.length - 1; i >= 0; i -= 1) {
|
|
11743
|
+
if (stack[i].view === key) { idx = i; break }
|
|
11744
|
+
}
|
|
11745
|
+
if (idx < 0) {
|
|
11746
|
+
const last = stack[stack.length - 1]
|
|
11747
|
+
if (last === undefined) {
|
|
11748
|
+
showPasteNotice('fail', t('undoNothing'))
|
|
11749
|
+
} else {
|
|
11750
|
+
showPasteNotice('fail', format(t('undoOtherScope'), {
|
|
11751
|
+
where: String(last.where ?? ''), kind: String(last.kindLabel ?? ''),
|
|
11752
|
+
}))
|
|
11753
|
+
}
|
|
11754
|
+
return
|
|
11755
|
+
}
|
|
11756
|
+
const [entry] = stack.splice(idx, 1)
|
|
11757
|
+
try {
|
|
11758
|
+
if (entry.kind === 'delete') {
|
|
11759
|
+
const payload = await callHost('undoDelete', { token: entry.token })
|
|
11760
|
+
if (payload?.ok === false && (payload?.restored ?? 0) === 0
|
|
11761
|
+
&& !Array.isArray(payload?.conflicts) && !Array.isArray(payload?.failed)) {
|
|
11762
|
+
throw new Error(payload?.error?.message ?? t('undoDeleteNone'))
|
|
11763
|
+
}
|
|
11764
|
+
const restored = Number(payload?.restored) || 0
|
|
11765
|
+
const conflicts = Array.isArray(payload?.conflicts) ? payload.conflicts.length : 0
|
|
11766
|
+
const failedCount = Array.isArray(payload?.failed) ? payload.failed.length : 0
|
|
11767
|
+
if (restored === 0) {
|
|
11768
|
+
showPasteNotice('fail', t('undoDeleteNone'))
|
|
11769
|
+
} else if (conflicts > 0 || failedCount > 0) {
|
|
11770
|
+
showPasteNotice('fail', format(t('undoDeletePartial'), {
|
|
11771
|
+
n: restored, fail: failedCount, conflict: conflicts,
|
|
11772
|
+
}))
|
|
11773
|
+
} else {
|
|
11774
|
+
showPasteNotice('ok', format(t('undoDeleteDone'), {
|
|
11775
|
+
n: restored, where: String(entry.where ?? ''), kind: String(entry.kindLabel ?? ''),
|
|
11776
|
+
}))
|
|
11777
|
+
}
|
|
11778
|
+
} else if (entry.kind === 'hide') {
|
|
11779
|
+
const rels = Array.isArray(entry.rels) ? entry.rels : []
|
|
11780
|
+
const payload = await callHost('unhide', { paths: rels })
|
|
11781
|
+
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('ctxHideFailed'))
|
|
11782
|
+
showPasteNotice('ok', format(t('undoHideDone'), {
|
|
11783
|
+
n: rels.length, where: String(entry.where ?? ''), kind: String(entry.kindLabel ?? ''),
|
|
11784
|
+
}))
|
|
11785
|
+
}
|
|
11786
|
+
kickChanges()
|
|
11787
|
+
await load(undefined, kind, scope, page)
|
|
11788
|
+
.then((data) => setView({ status: 'ready', data }))
|
|
11789
|
+
.catch(() => { /* 刷新失败保持当前列表,撤销本身已生效 */ })
|
|
11790
|
+
} catch (error) {
|
|
11791
|
+
showPasteNotice('fail', format(t('undoFailed'), { message: String(error?.message ?? error) }))
|
|
11792
|
+
}
|
|
11793
|
+
}, [callHost, load, kind, scope, page, t, showPasteNotice, kickChanges, viewKeyOf])
|
|
11794
|
+
|
|
11795
|
+
React.useEffect(() => { undoRef.current = runUndo }, [runUndo])
|
|
11796
|
+
|
|
11797
|
+
/**
|
|
11798
|
+
* Ctrl+Z / Cmd+Z:撤销最近一次删除或隐藏。
|
|
11799
|
+
*
|
|
11800
|
+
* 光标在输入框里一律放行 —— 那里要撤的是人自己打的字。
|
|
11801
|
+
* Ctrl+Shift+Z 也不拦(留给「重做」,本版没做,别占着坑还不干活)。
|
|
11802
|
+
*/
|
|
11803
|
+
React.useEffect(() => {
|
|
11804
|
+
const onKey = (event) => {
|
|
11805
|
+
if (!(event.ctrlKey || event.metaKey)) return
|
|
11806
|
+
if (event.shiftKey || event.altKey) return
|
|
11807
|
+
if (String(event.key).toLowerCase() !== 'z') return
|
|
11808
|
+
if (isTypingTarget(event.target)) return
|
|
11809
|
+
event.preventDefault()
|
|
11810
|
+
void runUndo()
|
|
11811
|
+
}
|
|
11812
|
+
window.addEventListener('keydown', onKey)
|
|
11813
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
11814
|
+
}, [runUndo])
|
|
11815
|
+
|
|
10968
11816
|
// 兜底自动刷新:轮询已覆盖绝大部分,这里放长周期防漏(外部程序写入 fs.watch 漏报时)
|
|
10969
11817
|
React.useEffect(() => {
|
|
10970
11818
|
if (viewer !== null) return undefined
|
|
@@ -10996,6 +11844,50 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10996
11844
|
}, [viewer])
|
|
10997
11845
|
|
|
10998
11846
|
const data = view.status === 'ready' ? view.data : null
|
|
11847
|
+
|
|
11848
|
+
// v1.6.5:隐藏对话清单只在「第一次拿到数据」时灌进本地状态,之后以本地为准。
|
|
11849
|
+
// 为什么不做成每次 data 变都覆盖:写盘是异步的,5 秒一次的自动刷新可能先到,
|
|
11850
|
+
// 一覆盖就会把刚藏起来的对话又弹回列表(看起来像点了没反应)。
|
|
11851
|
+
const hiddenSyncedRef = React.useRef(false)
|
|
11852
|
+
React.useEffect(() => {
|
|
11853
|
+
if (data === null || hiddenSyncedRef.current) return
|
|
11854
|
+
if (!Array.isArray(data.hiddenSessions)) return
|
|
11855
|
+
hiddenSyncedRef.current = true
|
|
11856
|
+
setHiddenSessionIds(new Set(data.hiddenSessions.map((s) => String(s))))
|
|
11857
|
+
}, [data])
|
|
11858
|
+
|
|
11859
|
+
/**
|
|
11860
|
+
* 隐藏 / 放回一个对话。
|
|
11861
|
+
*
|
|
11862
|
+
* 先改界面再写盘:点完立刻看到那一行移走,不用等一个来回。
|
|
11863
|
+
* 写盘失败就把界面退回去 —— 否则人以为存住了,刷新一下又全回来。
|
|
11864
|
+
*/
|
|
11865
|
+
const toggleSessionHidden = React.useCallback((sessionId, title, shouldHide) => {
|
|
11866
|
+
if (typeof sessionId !== 'string' || sessionId === '') return
|
|
11867
|
+
setHiddenSessionIds((prev) => {
|
|
11868
|
+
const next = new Set(prev)
|
|
11869
|
+
if (shouldHide) next.add(sessionId)
|
|
11870
|
+
else next.delete(sessionId)
|
|
11871
|
+
return next
|
|
11872
|
+
})
|
|
11873
|
+
void callHost('setHiddenSessions', shouldHide ? { add: [sessionId] } : { remove: [sessionId] })
|
|
11874
|
+
.then((payload) => {
|
|
11875
|
+
if (payload?.ok === false) throw new Error(payload?.error?.message ?? 'unknown')
|
|
11876
|
+
showPasteNotice('ok', format(
|
|
11877
|
+
shouldHide ? t('hideSessionDone') : t('showSessionDone'),
|
|
11878
|
+
{ title: String(title ?? '') },
|
|
11879
|
+
))
|
|
11880
|
+
})
|
|
11881
|
+
.catch((error) => {
|
|
11882
|
+
setHiddenSessionIds((prev) => {
|
|
11883
|
+
const next = new Set(prev)
|
|
11884
|
+
if (shouldHide) next.delete(sessionId)
|
|
11885
|
+
else next.add(sessionId)
|
|
11886
|
+
return next
|
|
11887
|
+
})
|
|
11888
|
+
showPasteNotice('fail', format(t('hideSessionFailed'), { message: String(error?.message ?? error) }))
|
|
11889
|
+
})
|
|
11890
|
+
}, [callHost, showPasteNotice, t])
|
|
10999
11891
|
// 拖图元信息索引:卡片容器只有 relPath,绝对路径与遮罩关联从这里查。
|
|
11000
11892
|
// 分组视图的条目在 groups[].files 里,扁平视图在 items 里,两边都收。
|
|
11001
11893
|
React.useEffect(() => {
|
|
@@ -11124,6 +12016,17 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11124
12016
|
onClick: () => setSettingsOpen(true),
|
|
11125
12017
|
}, '⚙')
|
|
11126
12018
|
|
|
12019
|
+
// 导出记录入口(v1.6.2):常驻在标题栏,不依赖「有没有选中」——
|
|
12020
|
+
// 老板要的就是隔天/换个对话还能把上次导的清单拎出来用。
|
|
12021
|
+
const exportHistoryBtn = h('button', {
|
|
12022
|
+
type: 'button',
|
|
12023
|
+
key: 'exportHistory',
|
|
12024
|
+
className: 'dg-btn dg-btnIcon',
|
|
12025
|
+
'data-gallery-export-history': true,
|
|
12026
|
+
title: t('exportHistoryHint'),
|
|
12027
|
+
onClick: () => { openExportHistory() },
|
|
12028
|
+
}, '\u{1F4C1}')
|
|
12029
|
+
|
|
11127
12030
|
const header = h('div', { className: 'dg-header', key: 'header' }, [
|
|
11128
12031
|
h('div', { className: 'dg-headerInfo', key: 'info' }, [
|
|
11129
12032
|
h('span', { className: 'dg-title', key: 'title' },
|
|
@@ -11172,6 +12075,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11172
12075
|
return !v
|
|
11173
12076
|
}),
|
|
11174
12077
|
}, batchMode ? t('batchModeExit') : t('batchModeEnter')),
|
|
12078
|
+
exportHistoryBtn,
|
|
11175
12079
|
settingsBtn,
|
|
11176
12080
|
h('button', {
|
|
11177
12081
|
type: 'button',
|
|
@@ -11840,13 +12744,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11840
12744
|
|
|
11841
12745
|
if (useGroups) {
|
|
11842
12746
|
|
|
11843
|
-
const cardFor = (item, groupKey, listForViewer, groupMeta) => {
|
|
12747
|
+
const cardFor = (item, groupKey, listForViewer, groupMeta, nameCounts) => {
|
|
11844
12748
|
// 分组里的文件也走同一套卡片组件
|
|
11845
12749
|
const enriched = {
|
|
11846
12750
|
...item,
|
|
11847
12751
|
name: item.name ?? item.relPath.split('/').pop(),
|
|
11848
12752
|
extension: item.extension ?? ('.' + (item.relPath.split('.').pop() || '')),
|
|
11849
12753
|
}
|
|
12754
|
+
// v1.6.3:同名统计由调用方算一次传进来(这里不再逐卡重算 O(n),
|
|
12755
|
+
// 「再显示」把一组堆到上千张时逐卡重算会明显卡顿)。
|
|
12756
|
+
const sameNames = nameCounts instanceof Map ? nameCounts : countNamesOf(listForViewer)
|
|
11850
12757
|
// 音视频分组视图:必须走 MediaCard,否则会被当成图片卡片渲染(v0.10.1)
|
|
11851
12758
|
if (kind === 'media') {
|
|
11852
12759
|
return wrapCard(h(MediaCard, {
|
|
@@ -11900,6 +12807,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11900
12807
|
item: enriched,
|
|
11901
12808
|
t,
|
|
11902
12809
|
limiter: limiter.current,
|
|
12810
|
+
nameCounts: sameNames,
|
|
11903
12811
|
onContextMenu: openContextMenu,
|
|
11904
12812
|
// v0.17.0:双击写进输入框
|
|
11905
12813
|
onDoubleClick: (target, event) => { handleCardDoubleClick(target, event) },
|
|
@@ -11922,7 +12830,33 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11922
12830
|
// 左侧会话列表快照只取一次:宿主渐进渲染,折叠行不在 DOM,
|
|
11923
12831
|
// 因此按「ID + 归一化标题」双重判定,而不是逐组查行是否存在。
|
|
11924
12832
|
const sidebarSnapshot = readSidebarSessions()
|
|
11925
|
-
|
|
12833
|
+
// v1.6.4:共用归属索引(整块只建一次;后端给了 sharedCount 时只作兜底)
|
|
12834
|
+
const shareInfo = shareIndexOf(data)
|
|
12835
|
+
// v1.6.5:三个区 —— 主列表 / 已归档对话合集 / 已隐藏对话合集。
|
|
12836
|
+
// 归档认宿主官方字段(sessionState='archived'),隐藏认用户右键收起来的记录。
|
|
12837
|
+
// 既归档又被隐藏的按「隐藏优先」只进隐藏合集,避免同一组出现两次。
|
|
12838
|
+
// 🔴 同时把「收起组」回写进 ref 供每秒增量轮询过滤:ref 每帧回写,
|
|
12839
|
+
// 轮询闭包读到的永远是最新的收起集合(不进依赖数组、不重建轮询器)。
|
|
12840
|
+
const visibleGroups = []
|
|
12841
|
+
const archivedGroups = []
|
|
12842
|
+
const hiddenGroups = []
|
|
12843
|
+
const tuckedNow = new Set()
|
|
12844
|
+
for (const g of data.groups) {
|
|
12845
|
+
const sid = g?.sessionId
|
|
12846
|
+
const realGroup = g?.isHistory !== true && typeof sid === 'string' && sid !== ''
|
|
12847
|
+
const isHiddenGroup = realGroup && hiddenSessionIds.has(sid)
|
|
12848
|
+
const isArchivedGroup = realGroup && g?.sessionState === 'archived'
|
|
12849
|
+
const isHistoryGroup = g?.isHistory === true
|
|
12850
|
+
if (isHiddenGroup) hiddenGroups.push(g)
|
|
12851
|
+
else if (isArchivedGroup) archivedGroups.push(g)
|
|
12852
|
+
else visibleGroups.push(g)
|
|
12853
|
+
// 历史池没有 sessionId,统一用 '__history__';它张数最多,更不该为它反复扫全库。
|
|
12854
|
+
if (isHiddenGroup || isArchivedGroup || isHistoryGroup) {
|
|
12855
|
+
tuckedNow.add(isHistoryGroup ? '__history__' : sid)
|
|
12856
|
+
}
|
|
12857
|
+
}
|
|
12858
|
+
tuckedRef.current = tuckedNow
|
|
12859
|
+
const renderGroupNode = (group, gi) => {
|
|
11926
12860
|
const groupKey = group.sessionId ?? '__history__'
|
|
11927
12861
|
const isOpen = openGroups.has(groupKey)
|
|
11928
12862
|
// v0.14.3:过程稿显隐只认顶部「过程稿」开关,组内不再第二套开关。
|
|
@@ -11933,6 +12867,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11933
12867
|
const allFiles = [...(Array.isArray(group.files) ? group.files : []), ...extra]
|
|
11934
12868
|
const visibleFiles = allFiles.filter(
|
|
11935
12869
|
(f) => categoryFilter[bucketOf(f)] !== false)
|
|
12870
|
+
// v1.6.3:本组同名表(每组算一次)
|
|
12871
|
+
const groupNameCounts = countNamesOf(visibleFiles)
|
|
12872
|
+
// v1.6.4:跨对话共用。后端按**全量**算好(前端每组只拿 60 条,自己数会偏小);
|
|
12873
|
+
// 旧版后端没有这个字段时,退回前端按已加载条目录算。
|
|
12874
|
+
const sharedCount = typeof group.sharedCount === 'number'
|
|
12875
|
+
? group.sharedCount
|
|
12876
|
+
: (shareInfo.countByGroup.get(group) ?? 0)
|
|
12877
|
+
const sharedPeers = Array.isArray(group.sharedPeers)
|
|
12878
|
+
? group.sharedPeers
|
|
12879
|
+
: sharedPeersOf(group, shareInfo)
|
|
11936
12880
|
|
|
11937
12881
|
const chips = []
|
|
11938
12882
|
if (group.counts.final > 0) {
|
|
@@ -11961,6 +12905,22 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11961
12905
|
'data-gallery-group': headKey,
|
|
11962
12906
|
'data-gallery-group-current': group.isCurrent === true ? '1' : '0',
|
|
11963
12907
|
'data-gallery-group-title': group.title ?? '',
|
|
12908
|
+
// v1.6.5:组行右键 —— 隐藏这个对话 / 在全局列表显示。
|
|
12909
|
+
// 历史资产池没有真实对话,不给这个入口(藏了也不知道藏的是谁)。
|
|
12910
|
+
onContextMenu: group.isHistory === true || !group.sessionId
|
|
12911
|
+
? undefined
|
|
12912
|
+
: (event) => {
|
|
12913
|
+
event.preventDefault()
|
|
12914
|
+
event.stopPropagation()
|
|
12915
|
+
setGroupMenu({
|
|
12916
|
+
sessionId: String(group.sessionId),
|
|
12917
|
+
title: String(group.title ?? ''),
|
|
12918
|
+
hidden: hiddenSessionIds.has(String(group.sessionId)),
|
|
12919
|
+
isCurrent: group.isCurrent === true,
|
|
12920
|
+
x: event.clientX,
|
|
12921
|
+
y: event.clientY,
|
|
12922
|
+
})
|
|
12923
|
+
},
|
|
11964
12924
|
/**
|
|
11965
12925
|
* v0.16.2:鼠标停在哪一组,粘贴/裁剪就落到那一组。
|
|
11966
12926
|
* 「未归类」池没有对应会话,置 null 退回当前对话(不能凭空造目录)。
|
|
@@ -11996,7 +12956,33 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11996
12956
|
h('span', { className: 'dg-groupDate', key: 'd' },
|
|
11997
12957
|
group.isHistory ? format(t('groupFiles'), { n: group.fileCount }) : formatTime(group.createdAt)),
|
|
11998
12958
|
h('span', { className: 'dg-groupChips', key: 'c' }, chips),
|
|
12959
|
+
// v1.6.5:共用归属默认折叠成一个小圆点,详情在组头下方悬停展开。
|
|
12960
|
+
// 只在真有共用件时出现,「历史资产」池不标。
|
|
12961
|
+
sharedCount > 0 && group.isHistory !== true
|
|
12962
|
+
? h('span', {
|
|
12963
|
+
className: 'dg-groupShared',
|
|
12964
|
+
key: 'sh',
|
|
12965
|
+
role: 'img',
|
|
12966
|
+
'data-gallery-group-shared': String(sharedCount),
|
|
12967
|
+
'aria-label': sharedTipOf(t, sharedCount, sharedPeers),
|
|
12968
|
+
// 小圆点在 button 里,点它不该顺手把整组折叠
|
|
12969
|
+
onClick: (e) => e.stopPropagation(),
|
|
12970
|
+
}, [
|
|
12971
|
+
h('span', { className: 'dg-sharedDot', key: 'dot' }),
|
|
12972
|
+
])
|
|
12973
|
+
: null,
|
|
11999
12974
|
]),
|
|
12975
|
+
// v1.6.5:悬停组头才展开的共用明细。正常流,避开 .dg-group 的 clip-path 裁剪。
|
|
12976
|
+
sharedCount > 0 && group.isHistory !== true
|
|
12977
|
+
? h('div', {
|
|
12978
|
+
className: 'dg-sharedDetail',
|
|
12979
|
+
key: 'sharedDetail',
|
|
12980
|
+
'data-gallery-shared-detail': String(sharedCount),
|
|
12981
|
+
}, [
|
|
12982
|
+
h('span', { className: 'dg-sharedDetailTitle', key: 't' }, format(t('groupShared'), { n: sharedCount })),
|
|
12983
|
+
h('span', { className: 'dg-sharedDetailBody', key: 'b' }, sharedTipOf(t, sharedCount, sharedPeers)),
|
|
12984
|
+
])
|
|
12985
|
+
: null,
|
|
12000
12986
|
isOpen
|
|
12001
12987
|
? [
|
|
12002
12988
|
group.isHistory
|
|
@@ -12016,7 +13002,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12016
13002
|
h('div', { className: 'dg-groupBody', key: 'body' }, [
|
|
12017
13003
|
visibleFiles.length > 0
|
|
12018
13004
|
? h('div', { className: `dg-grid${kind === 'file' ? ' dg-fileGrid' : ''}`, key: 'grid' },
|
|
12019
|
-
visibleFiles.map((f) => cardFor(f, headKey, visibleFiles, group)))
|
|
13005
|
+
visibleFiles.map((f) => cardFor(f, headKey, visibleFiles, group, groupNameCounts)))
|
|
12020
13006
|
: h('div', { className: 'dg-groupEmpty', key: 'empty' }, t('groupEmpty')),
|
|
12021
13007
|
allFiles.length < Number(group.fileCount ?? 0)
|
|
12022
13008
|
? h('button', {
|
|
@@ -12062,7 +13048,11 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12062
13048
|
]
|
|
12063
13049
|
: null,
|
|
12064
13050
|
])
|
|
12065
|
-
}
|
|
13051
|
+
}
|
|
13052
|
+
const visibleGroupNodes = visibleGroups.map((g, i) => renderGroupNode(g, i))
|
|
13053
|
+
const archivedGroupNodes = archivedGroups.map((g, i) => renderGroupNode(g, visibleGroups.length + i))
|
|
13054
|
+
const hiddenGroupNodes = hiddenGroups.map((g, i) =>
|
|
13055
|
+
renderGroupNode(g, visibleGroups.length + archivedGroups.length + i))
|
|
12066
13056
|
|
|
12067
13057
|
body = h('div', {
|
|
12068
13058
|
className: 'dg-bodyWrap',
|
|
@@ -12080,7 +13070,53 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12080
13070
|
onPaste: onBodyPaste,
|
|
12081
13071
|
onContextMenu: onBodyContextMenu,
|
|
12082
13072
|
}, [
|
|
12083
|
-
h('div', { className: 'dg-groups', key: 'groups' },
|
|
13073
|
+
h('div', { className: 'dg-groups', key: 'groups' }, [
|
|
13074
|
+
...visibleGroupNodes,
|
|
13075
|
+
archivedGroupNodes.length > 0
|
|
13076
|
+
? h('div', { className: 'dg-hiddenWrap', key: 'archivedWrap' }, [
|
|
13077
|
+
h('button', {
|
|
13078
|
+
type: 'button',
|
|
13079
|
+
className: 'dg-hiddenHead',
|
|
13080
|
+
key: 'archivedHead',
|
|
13081
|
+
'data-gallery-archived-toggle': '1',
|
|
13082
|
+
onClick: () => setArchivedOpen((v) => !v),
|
|
13083
|
+
title: t('archivedGroupHint'),
|
|
13084
|
+
}, [
|
|
13085
|
+
h('span', { className: `dg-hiddenArrow${archivedOpen ? ' dg-hiddenArrowOpen' : ''}`, key: 'a' }, '▶'),
|
|
13086
|
+
h('span', { key: 't' }, t('archivedGroupTitle')),
|
|
13087
|
+
h('span', { className: 'dg-hiddenCount', key: 'c' }, format(t('groupCount'), { count: archivedGroupNodes.length })),
|
|
13088
|
+
]),
|
|
13089
|
+
archivedOpen
|
|
13090
|
+
? h('div', { key: 'archivedBody' }, [
|
|
13091
|
+
h('div', { className: 'dg-hiddenHint', key: 'hi' }, t('archivedGroupHint')),
|
|
13092
|
+
...archivedGroupNodes,
|
|
13093
|
+
])
|
|
13094
|
+
: null,
|
|
13095
|
+
])
|
|
13096
|
+
: null,
|
|
13097
|
+
hiddenGroupNodes.length > 0
|
|
13098
|
+
? h('div', { className: 'dg-hiddenWrap', key: 'hiddenWrap' }, [
|
|
13099
|
+
h('button', {
|
|
13100
|
+
type: 'button',
|
|
13101
|
+
className: 'dg-hiddenHead',
|
|
13102
|
+
key: 'hiddenHead',
|
|
13103
|
+
'data-gallery-hidden-toggle': '1',
|
|
13104
|
+
onClick: () => setHiddenOpen((v) => !v),
|
|
13105
|
+
title: t('hiddenGroupHint'),
|
|
13106
|
+
}, [
|
|
13107
|
+
h('span', { className: `dg-hiddenArrow${hiddenOpen ? ' dg-hiddenArrowOpen' : ''}`, key: 'a' }, '▶'),
|
|
13108
|
+
h('span', { key: 't' }, t('hiddenGroupTitle')),
|
|
13109
|
+
h('span', { className: 'dg-hiddenCount', key: 'c' }, format(t('groupCount'), { count: hiddenGroupNodes.length })),
|
|
13110
|
+
]),
|
|
13111
|
+
hiddenOpen
|
|
13112
|
+
? h('div', { key: 'hiddenBody' }, [
|
|
13113
|
+
h('div', { className: 'dg-hiddenHint', key: 'hi' }, t('hiddenGroupHint')),
|
|
13114
|
+
...hiddenGroupNodes,
|
|
13115
|
+
])
|
|
13116
|
+
: null,
|
|
13117
|
+
])
|
|
13118
|
+
: null,
|
|
13119
|
+
]),
|
|
12084
13120
|
data.scan.capped
|
|
12085
13121
|
? h('div', { className: 'dg-more', key: 'capped' }, t('capped'))
|
|
12086
13122
|
: null,
|
|
@@ -12108,6 +13144,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12108
13144
|
onContextMenu: openContextMenu,
|
|
12109
13145
|
}), item, item.relPath))
|
|
12110
13146
|
|
|
13147
|
+
// v1.6.3:扁平视图(当前对话)也按同一份同名表标注目录,
|
|
13148
|
+
// 否则「图片」视图会与分组视图两套口径(分组有提示、扁平没有)。
|
|
13149
|
+
const flatNameCounts = countNamesOf(visibleItems)
|
|
12111
13150
|
const gridChildren = visibleItems.map((item) => wrapCard(kind === 'file'
|
|
12112
13151
|
? h(FileCard, {
|
|
12113
13152
|
key: item.relPath,
|
|
@@ -12138,6 +13177,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12138
13177
|
item,
|
|
12139
13178
|
t,
|
|
12140
13179
|
limiter: limiter.current,
|
|
13180
|
+
nameCounts: flatNameCounts,
|
|
12141
13181
|
onContextMenu: openContextMenu,
|
|
12142
13182
|
// v0.17.0:双击写进输入框(扁平视图)
|
|
12143
13183
|
onDoubleClick: (target, event) => { handleCardDoubleClick(target, event) },
|
|
@@ -12318,6 +13358,103 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12318
13358
|
})
|
|
12319
13359
|
: null
|
|
12320
13360
|
|
|
13361
|
+
/**
|
|
13362
|
+
* 导出记录面板(v1.6.2)。
|
|
13363
|
+
* 列表只做三件事:说清「这批是哪来的、什么时候、多少条」,并允许再引用一次。
|
|
13364
|
+
* 每条的「写进输入框」把 CSV 绝对路径递给助手 —— 这是老板要的「以后还能用」。
|
|
13365
|
+
*/
|
|
13366
|
+
const exportRowAction = (label, onClick, disabled) => h('button', {
|
|
13367
|
+
type: 'button',
|
|
13368
|
+
className: 'dg-btn dg-btnSmall',
|
|
13369
|
+
key: `act-${label}`,
|
|
13370
|
+
disabled: disabled === true,
|
|
13371
|
+
onClick,
|
|
13372
|
+
}, label)
|
|
13373
|
+
const exportRows = exportHistory.status === 'failed'
|
|
13374
|
+
? [h('div', { className: 'dg-exportEmpty dg-exportFail', key: 'failed' },
|
|
13375
|
+
format(t('exportHistoryFailed'), { message: String(exportHistory.message ?? '') }))]
|
|
13376
|
+
: exportHistory.items.length === 0
|
|
13377
|
+
? [h('div', { className: 'dg-exportEmpty', key: 'empty' },
|
|
13378
|
+
exportHistory.status === 'loading' ? t('exportHistoryLoading') : t('exportHistoryEmpty'))]
|
|
13379
|
+
: exportHistory.items.map((row, index) => {
|
|
13380
|
+
const file = String(row?.file ?? '')
|
|
13381
|
+
if (file === '') return null
|
|
13382
|
+
const full = exportHistory.dir === '' ? file : `${exportHistory.dir}\\${file}`
|
|
13383
|
+
const exists = row?.exists !== false
|
|
13384
|
+
const at = Number(row?.at) || 0
|
|
13385
|
+
const total = Number(row?.total)
|
|
13386
|
+
const src = String(row?.sessionTitle ?? '') !== ''
|
|
13387
|
+
? String(row.sessionTitle)
|
|
13388
|
+
: (row?.scope === 'global'
|
|
13389
|
+
? t('exportHistoryGlobal')
|
|
13390
|
+
: (row?.legacy === true ? t('exportHistoryLegacy') : t('exportHistoryUnknownSource')))
|
|
13391
|
+
const meta = [
|
|
13392
|
+
src,
|
|
13393
|
+
at > 0 ? formatTime(at) : '',
|
|
13394
|
+
Number.isFinite(total) && total > 0 ? format(t('exportHistoryCount'), { n: total }) : '',
|
|
13395
|
+
exists ? '' : t('exportHistoryMissing'),
|
|
13396
|
+
].filter((x) => x !== '').join(' · ')
|
|
13397
|
+
return h('div', { className: 'dg-exportRow', key: `export${index}`, 'data-gallery-export-row': index }, [
|
|
13398
|
+
h('div', { className: 'dg-exportMain', key: 'main' }, [
|
|
13399
|
+
h('div', { className: 'dg-exportName', key: 'name', title: file }, file),
|
|
13400
|
+
h('div', { className: `dg-exportMeta${exists ? '' : ' dg-exportMetaGone'}`, key: 'meta' }, meta),
|
|
13401
|
+
]),
|
|
13402
|
+
h('div', { className: 'dg-exportActs', key: 'acts' }, [
|
|
13403
|
+
exportRowAction(t('exportToComposer'), () => {
|
|
13404
|
+
void writeDraftToComposer(`交付清单${Number.isFinite(total) && total > 0 ? `(${total} 条)` : ''}:${full}`, sessionId)
|
|
13405
|
+
.then((result) => {
|
|
13406
|
+
if (result?.ok === true) showPasteNotice('ok', t('exportDraftReady'))
|
|
13407
|
+
else { void copyText(full); showPasteNotice('fail', t('exportDraftInClipboard')) }
|
|
13408
|
+
})
|
|
13409
|
+
.catch(() => {
|
|
13410
|
+
void copyText(full)
|
|
13411
|
+
showPasteNotice('fail', t('exportDraftInClipboard'))
|
|
13412
|
+
})
|
|
13413
|
+
}, !exists),
|
|
13414
|
+
exportRowAction(t('exportCopyPath'), () => {
|
|
13415
|
+
void copyText(full).then((ok) => {
|
|
13416
|
+
showPasteNotice(ok ? 'ok' : 'fail', ok ? t('exportPathCopied') : t('exportPathCopyFailed'))
|
|
13417
|
+
})
|
|
13418
|
+
}, !exists),
|
|
13419
|
+
]),
|
|
13420
|
+
])
|
|
13421
|
+
}).filter((node) => node !== null)
|
|
13422
|
+
|
|
13423
|
+
const exportHistoryLayer = exportHistoryOpen
|
|
13424
|
+
? h('div', { className: 'dg-settingsLayer', key: 'exportHistoryLayer' }, [
|
|
13425
|
+
h('div', { className: 'dg-settings dg-exportPanel', 'data-gallery-export-panel': true }, [
|
|
13426
|
+
h('div', { className: 'dg-settingsHead', key: 'head' }, [
|
|
13427
|
+
h('span', { className: 'dg-settingsTitle', key: 'title' }, t('exportHistoryTitle')),
|
|
13428
|
+
h('button', {
|
|
13429
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'refresh',
|
|
13430
|
+
'data-gallery-export-refresh': true,
|
|
13431
|
+
onClick: () => { void loadExportHistory() },
|
|
13432
|
+
}, t('exportHistoryRefresh')),
|
|
13433
|
+
h('button', {
|
|
13434
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'close',
|
|
13435
|
+
'data-gallery-export-close': true,
|
|
13436
|
+
onClick: () => setExportHistoryOpen(false),
|
|
13437
|
+
}, '✕'),
|
|
13438
|
+
]),
|
|
13439
|
+
h('div', { className: 'dg-exportHint', key: 'hint' }, t('exportHistoryHint')),
|
|
13440
|
+
h('div', { className: 'dg-exportList', key: 'list' }, exportRows),
|
|
13441
|
+
h('div', { className: 'dg-exportFoot', key: 'foot' }, [
|
|
13442
|
+
h('span', { className: 'dg-exportDir', key: 'dir', title: exportHistory.dir }, exportHistory.dir),
|
|
13443
|
+
h('button', {
|
|
13444
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'open',
|
|
13445
|
+
onClick: () => {
|
|
13446
|
+
void callHost('openExportDir', {}).then((r) => {
|
|
13447
|
+
if (r?.ok === false) throw new Error(r?.error?.message ?? t('exportOpenFailed'))
|
|
13448
|
+
}).catch((error) => {
|
|
13449
|
+
showPasteNotice('fail', format(t('exportOpenFailed'), { message: String(error?.message ?? error) }))
|
|
13450
|
+
})
|
|
13451
|
+
},
|
|
13452
|
+
}, t('exportOpenDir')),
|
|
13453
|
+
]),
|
|
13454
|
+
]),
|
|
13455
|
+
])
|
|
13456
|
+
: null
|
|
13457
|
+
|
|
12321
13458
|
// 反馈篮(S3-a):列出已标记条目 + 带批注的卡片(v0.14.3 批注并入反馈)
|
|
12322
13459
|
// 批注属于「反馈」这一侧:它不进 marks(不参与表态/筛选/落盘),
|
|
12323
13460
|
// 但只要有批注,这张卡就出现在反馈篮里,草稿会按 Annotation N 逐条带出说明与框选区域。
|
|
@@ -12507,6 +13644,37 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12507
13644
|
})
|
|
12508
13645
|
: null
|
|
12509
13646
|
|
|
13647
|
+
// v1.6.5:对话组行右键 —— 打开对话 / 收起 / 放回这个对话
|
|
13648
|
+
const groupMenuLayer = groupMenu !== null
|
|
13649
|
+
? h(GroupMenu, {
|
|
13650
|
+
key: 'groupMenu',
|
|
13651
|
+
t,
|
|
13652
|
+
x: groupMenu.x,
|
|
13653
|
+
y: groupMenu.y,
|
|
13654
|
+
title: groupMenu.title,
|
|
13655
|
+
hidden: groupMenu.hidden === true,
|
|
13656
|
+
canOpen: groupMenu.isCurrent !== true,
|
|
13657
|
+
onOpen: () => {
|
|
13658
|
+
// 先取出 id:onClose 会把 groupMenu 清空,别在异步里回头读它。
|
|
13659
|
+
const sid = groupMenu.sessionId
|
|
13660
|
+
void (async () => {
|
|
13661
|
+
const r = await openSessionById(sid)
|
|
13662
|
+
reportOpenResult(sid, r)
|
|
13663
|
+
if (r.ok) showToast('ok', t('groupOpenDone'))
|
|
13664
|
+
else if (r.reason === 'archived') showToast('failed', t('groupOpenArchived'))
|
|
13665
|
+
else {
|
|
13666
|
+
await copyText(sid)
|
|
13667
|
+
showToast('failed', t('groupOpenMissed'))
|
|
13668
|
+
}
|
|
13669
|
+
})()
|
|
13670
|
+
},
|
|
13671
|
+
onToggle: () => {
|
|
13672
|
+
toggleSessionHidden(groupMenu.sessionId, groupMenu.title, groupMenu.hidden !== true)
|
|
13673
|
+
},
|
|
13674
|
+
onClose: () => setGroupMenu(null),
|
|
13675
|
+
})
|
|
13676
|
+
: null
|
|
13677
|
+
|
|
12510
13678
|
// v0.16.0:右键空白处(非卡片)的「粘贴」菜单;只给粘贴一项
|
|
12511
13679
|
const pasteLayer = pasteMenu !== null
|
|
12512
13680
|
? h(ContextMenu, {
|
|
@@ -12568,7 +13736,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12568
13736
|
viewerLayer,
|
|
12569
13737
|
mediaLayer,
|
|
12570
13738
|
settingsLayer,
|
|
13739
|
+
exportHistoryLayer,
|
|
12571
13740
|
ctxLayer,
|
|
13741
|
+
groupMenuLayer,
|
|
12572
13742
|
pasteLayer,
|
|
12573
13743
|
confirmLayer,
|
|
12574
13744
|
feedbackLayer,
|
|
@@ -12578,10 +13748,29 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12578
13748
|
? null
|
|
12579
13749
|
: h('div', {
|
|
12580
13750
|
className: 'dg-pasteNotice'
|
|
12581
|
-
+ (pasteNotice.kind === 'ok' ? ' dg-pasteOk' : ' dg-pasteFail')
|
|
13751
|
+
+ (pasteNotice.kind === 'ok' ? ' dg-pasteOk' : ' dg-pasteFail')
|
|
13752
|
+
+ (pasteNotice.actions === null ? '' : ' dg-pasteNoticeAction'),
|
|
12582
13753
|
key: 'pasteNotice',
|
|
12583
13754
|
'data-gallery-paste-notice': pasteNotice.kind,
|
|
12584
|
-
},
|
|
13755
|
+
}, [
|
|
13756
|
+
h('span', { className: 'dg-pasteText', key: 'text' }, pasteNotice.text),
|
|
13757
|
+
pasteNotice.actions === null
|
|
13758
|
+
? null
|
|
13759
|
+
: h('span', { className: 'dg-pasteBtns', key: 'btns' },
|
|
13760
|
+
pasteNotice.actions.map((action, index) => h('button', {
|
|
13761
|
+
type: 'button',
|
|
13762
|
+
className: 'dg-pasteBtn',
|
|
13763
|
+
key: `a${index}`,
|
|
13764
|
+
'data-gallery-paste-action': index,
|
|
13765
|
+
// 按下就 preventDefault:别让按钮抢走焦点,也别触发网格的键盘处理
|
|
13766
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
13767
|
+
onClick: () => {
|
|
13768
|
+
// 先收掉提示,再执行;执行完自己会给新提示(或不需要)
|
|
13769
|
+
setPasteNotice(null)
|
|
13770
|
+
try { action.onClick?.() } catch (error) { console.warn('dsh-gallery: 提示按钮失败', error) }
|
|
13771
|
+
},
|
|
13772
|
+
}, action.label))),
|
|
13773
|
+
]),
|
|
12585
13774
|
])
|
|
12586
13775
|
}
|
|
12587
13776
|
|