fix(export): add fileNamingMode support to fix date-range naming mode not working
The 'Date Range' option in Export Global Settings -> File Naming Mode was not taking effect because fileNamingMode was missing from the frontend ExportOptions type, default options, config loading, and the settings-change propagation callback. - types.ts: add fileNamingMode field to ExportOptions interface - constants.ts: add fileNamingMode default value - useExportConfig.ts: load fileNamingMode on init, persist on update - ExportPage.tsx: propagate fileNamingMode in handleExportDefaultsChanged also fix incorrect format key (defaultFormat -> format)
This commit is contained in:
1 parent
82bce9f784
commit
99273ccd2c
4 files changed
+14
-5
No files matched your search
@@ -26,7 +26,7 @@ import { useAutomationRunner, useAutomationStore } from './hooks/useAutomation'
|
|||||||
import { AutomationModal } from './components/Automation/AutomationModal'
|
import { AutomationModal } from './components/Automation/AutomationModal'
|
||||||
import { AutomationTaskForm } from './components/Automation/AutomationTaskForm'
|
import { AutomationTaskForm } from './components/Automation/AutomationTaskForm'
|
||||||
|
|
||||||
import type { SessionRow } from './types'
|
import type { SessionRow, TextExportFormat } from './types'
|
||||||
import { getSelectionScopeFromRows, resolveScopeDisplayNames } from './utils/session'
|
import { getSelectionScopeFromRows, resolveScopeDisplayNames } from './utils/session'
|
||||||
import {
|
import {
|
||||||
emitSingleExportDialogStatus,
|
emitSingleExportDialogStatus,
|
||||||
@@ -134,8 +134,9 @@ function ExportPage() {
|
|||||||
|
|
||||||
const handleExportDefaultsChanged = useCallback((patch: ExportDefaultsSettingsPatch) => {
|
const handleExportDefaultsChanged = useCallback((patch: ExportDefaultsSettingsPatch) => {
|
||||||
updateOptions({
|
updateOptions({
|
||||||
...(patch.format ? { defaultFormat: patch.format as any } : {}),
|
...(patch.format ? { format: patch.format as TextExportFormat } : {}),
|
||||||
...(patch.avatars !== undefined ? { exportAvatars: patch.avatars } : {}),
|
...(patch.avatars !== undefined ? { exportAvatars: patch.avatars } : {}),
|
||||||
|
...(patch.fileNamingMode !== undefined ? { fileNamingMode: patch.fileNamingMode } : {}),
|
||||||
})
|
})
|
||||||
}, [updateOptions])
|
}, [updateOptions])
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ export const createDefaultExportOptions = (): import('./types').ExportOptions =>
|
|||||||
excelCompactColumns: true,
|
excelCompactColumns: true,
|
||||||
txtColumns: defaultTxtColumns,
|
txtColumns: defaultTxtColumns,
|
||||||
displayNamePreference: 'remark',
|
displayNamePreference: 'remark',
|
||||||
exportConcurrency: 2
|
exportConcurrency: 2,
|
||||||
|
fileNamingMode: 'classic'
|
||||||
})
|
})
|
||||||
|
|
||||||
// ─── Empty progress factory ──────────────────────────────────
|
// ─── Empty progress factory ──────────────────────────────────
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ export function useExportConfig(): ExportConfigResult {
|
|||||||
pathStyle,
|
pathStyle,
|
||||||
excelCompact,
|
excelCompact,
|
||||||
txtCols,
|
txtCols,
|
||||||
concurrency
|
concurrency,
|
||||||
|
fileNamingMode
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
configService.getExportPath(),
|
configService.getExportPath(),
|
||||||
configService.getExportWriteLayout(),
|
configService.getExportWriteLayout(),
|
||||||
@@ -74,7 +75,8 @@ export function useExportConfig(): ExportConfigResult {
|
|||||||
configService.getExportDefaultPathStyle(),
|
configService.getExportDefaultPathStyle(),
|
||||||
configService.getExportDefaultExcelCompactColumns(),
|
configService.getExportDefaultExcelCompactColumns(),
|
||||||
configService.getExportDefaultTxtColumns(),
|
configService.getExportDefaultTxtColumns(),
|
||||||
configService.getExportDefaultConcurrency()
|
configService.getExportDefaultConcurrency(),
|
||||||
|
configService.getExportDefaultFileNamingMode()
|
||||||
])
|
])
|
||||||
|
|
||||||
if (!isMounted) return
|
if (!isMounted) return
|
||||||
@@ -118,6 +120,7 @@ export function useExportConfig(): ExportConfigResult {
|
|||||||
if (typeof excelCompact === 'boolean') newOptions.excelCompactColumns = excelCompact
|
if (typeof excelCompact === 'boolean') newOptions.excelCompactColumns = excelCompact
|
||||||
if (Array.isArray(txtCols)) newOptions.txtColumns = txtCols
|
if (Array.isArray(txtCols)) newOptions.txtColumns = txtCols
|
||||||
if (typeof concurrency === 'number' && concurrency > 0) newOptions.exportConcurrency = concurrency
|
if (typeof concurrency === 'number' && concurrency > 0) newOptions.exportConcurrency = concurrency
|
||||||
|
if (fileNamingMode === 'classic' || fileNamingMode === 'date-range') newOptions.fileNamingMode = fileNamingMode
|
||||||
|
|
||||||
// Date range
|
// Date range
|
||||||
setRawDateRangeConfigState(dateRange)
|
setRawDateRangeConfigState(dateRange)
|
||||||
@@ -192,6 +195,9 @@ export function useExportConfig(): ExportConfigResult {
|
|||||||
if (patch.exportConcurrency !== undefined) {
|
if (patch.exportConcurrency !== undefined) {
|
||||||
void configService.setExportDefaultConcurrency(patch.exportConcurrency)
|
void configService.setExportDefaultConcurrency(patch.exportConcurrency)
|
||||||
}
|
}
|
||||||
|
if (patch.fileNamingMode !== undefined) {
|
||||||
|
void configService.setExportDefaultFileNamingMode(patch.fileNamingMode)
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-derive exportMedia
|
// Auto-derive exportMedia
|
||||||
next.exportMedia = (
|
next.exportMedia = (
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export interface ExportOptions {
|
|||||||
txtColumns: string[]
|
txtColumns: string[]
|
||||||
displayNamePreference: DisplayNamePreference
|
displayNamePreference: DisplayNamePreference
|
||||||
exportConcurrency: number
|
exportConcurrency: number
|
||||||
|
fileNamingMode: 'classic' | 'date-range'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Session ─────────────────────────────────────────────────
|
// ─── Session ─────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in new issue
Block a user