mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
feat(export): split defaults modal layout
This commit is contained in:
@@ -227,4 +227,72 @@
|
|||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.layout-split {
|
||||||
|
.form-group {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
|
||||||
|
gap: 18px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 14px 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group:first-child {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-copy {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-hint {
|
||||||
|
margin-bottom: 0;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-field,
|
||||||
|
.settings-time-range-field {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 360px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-toggle-line {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 360px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 760px) {
|
||||||
|
.export-defaults-settings-form.layout-split {
|
||||||
|
.form-group {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-field,
|
||||||
|
.settings-time-range-field,
|
||||||
|
.log-toggle-line {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface ExportDefaultsSettingsPatch {
|
|||||||
interface ExportDefaultsSettingsFormProps {
|
interface ExportDefaultsSettingsFormProps {
|
||||||
onNotify?: (text: string, success: boolean) => void
|
onNotify?: (text: string, success: boolean) => void
|
||||||
onDefaultsChanged?: (patch: ExportDefaultsSettingsPatch) => void
|
onDefaultsChanged?: (patch: ExportDefaultsSettingsPatch) => void
|
||||||
|
layout?: 'stacked' | 'split'
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportFormatOptions = [
|
const exportFormatOptions = [
|
||||||
@@ -50,7 +51,8 @@ const getOptionLabel = (options: ReadonlyArray<{ value: string; label: string }>
|
|||||||
|
|
||||||
export function ExportDefaultsSettingsForm({
|
export function ExportDefaultsSettingsForm({
|
||||||
onNotify,
|
onNotify,
|
||||||
onDefaultsChanged
|
onDefaultsChanged,
|
||||||
|
layout = 'stacked'
|
||||||
}: ExportDefaultsSettingsFormProps) {
|
}: ExportDefaultsSettingsFormProps) {
|
||||||
const [showExportFormatSelect, setShowExportFormatSelect] = useState(false)
|
const [showExportFormatSelect, setShowExportFormatSelect] = useState(false)
|
||||||
const [showExportExcelColumnsSelect, setShowExportExcelColumnsSelect] = useState(false)
|
const [showExportExcelColumnsSelect, setShowExportExcelColumnsSelect] = useState(false)
|
||||||
@@ -123,65 +125,73 @@ export function ExportDefaultsSettingsForm({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="export-defaults-settings-form">
|
<div className={`export-defaults-settings-form ${layout === 'split' ? 'layout-split' : 'layout-stacked'}`}>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>默认导出格式</label>
|
<div className="form-copy">
|
||||||
<span className="form-hint">导出页面默认选中的格式</span>
|
<label>默认导出格式</label>
|
||||||
<div className="select-field" ref={exportFormatDropdownRef}>
|
<span className="form-hint">导出页面默认选中的格式</span>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
<div className="form-control">
|
||||||
className={`select-trigger ${showExportFormatSelect ? 'open' : ''}`}
|
<div className="select-field" ref={exportFormatDropdownRef}>
|
||||||
onClick={() => {
|
<button
|
||||||
setShowExportFormatSelect(!showExportFormatSelect)
|
type="button"
|
||||||
setIsExportDateRangeDialogOpen(false)
|
className={`select-trigger ${showExportFormatSelect ? 'open' : ''}`}
|
||||||
setShowExportExcelColumnsSelect(false)
|
onClick={() => {
|
||||||
setShowExportConcurrencySelect(false)
|
setShowExportFormatSelect(!showExportFormatSelect)
|
||||||
}}
|
setIsExportDateRangeDialogOpen(false)
|
||||||
>
|
setShowExportExcelColumnsSelect(false)
|
||||||
<span className="select-value">{exportFormatLabel}</span>
|
setShowExportConcurrencySelect(false)
|
||||||
<ChevronDown size={16} />
|
}}
|
||||||
</button>
|
>
|
||||||
{showExportFormatSelect && (
|
<span className="select-value">{exportFormatLabel}</span>
|
||||||
<div className="select-dropdown">
|
<ChevronDown size={16} />
|
||||||
{exportFormatOptions.map((option) => (
|
</button>
|
||||||
<button
|
{showExportFormatSelect && (
|
||||||
key={option.value}
|
<div className="select-dropdown">
|
||||||
type="button"
|
{exportFormatOptions.map((option) => (
|
||||||
className={`select-option ${exportDefaultFormat === option.value ? 'active' : ''}`}
|
<button
|
||||||
onClick={async () => {
|
key={option.value}
|
||||||
setExportDefaultFormat(option.value)
|
type="button"
|
||||||
await configService.setExportDefaultFormat(option.value)
|
className={`select-option ${exportDefaultFormat === option.value ? 'active' : ''}`}
|
||||||
onDefaultsChanged?.({ format: option.value })
|
onClick={async () => {
|
||||||
notify('已更新导出格式默认值', true)
|
setExportDefaultFormat(option.value)
|
||||||
setShowExportFormatSelect(false)
|
await configService.setExportDefaultFormat(option.value)
|
||||||
}}
|
onDefaultsChanged?.({ format: option.value })
|
||||||
>
|
notify('已更新导出格式默认值', true)
|
||||||
<span className="option-label">{option.label}</span>
|
setShowExportFormatSelect(false)
|
||||||
<span className="option-desc">{option.desc}</span>
|
}}
|
||||||
</button>
|
>
|
||||||
))}
|
<span className="option-label">{option.label}</span>
|
||||||
</div>
|
<span className="option-desc">{option.desc}</span>
|
||||||
)}
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>默认导出时间范围</label>
|
<div className="form-copy">
|
||||||
<span className="form-hint">控制导出页面的默认时间选择</span>
|
<label>默认导出时间范围</label>
|
||||||
<div className="settings-time-range-field">
|
<span className="form-hint">控制导出页面的默认时间选择</span>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
<div className="form-control">
|
||||||
className={`settings-time-range-trigger ${isExportDateRangeDialogOpen ? 'open' : ''}`}
|
<div className="settings-time-range-field">
|
||||||
onClick={() => {
|
<button
|
||||||
setShowExportFormatSelect(false)
|
type="button"
|
||||||
setShowExportExcelColumnsSelect(false)
|
className={`settings-time-range-trigger ${isExportDateRangeDialogOpen ? 'open' : ''}`}
|
||||||
setShowExportConcurrencySelect(false)
|
onClick={() => {
|
||||||
setIsExportDateRangeDialogOpen(true)
|
setShowExportFormatSelect(false)
|
||||||
}}
|
setShowExportExcelColumnsSelect(false)
|
||||||
>
|
setShowExportConcurrencySelect(false)
|
||||||
<span className="settings-time-range-value">{exportDateRangeLabel}</span>
|
setIsExportDateRangeDialogOpen(true)
|
||||||
<span className="settings-time-range-arrow">></span>
|
}}
|
||||||
</button>
|
>
|
||||||
|
<span className="settings-time-range-value">{exportDateRangeLabel}</span>
|
||||||
|
<span className="settings-time-range-arrow">></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -199,132 +209,148 @@ export function ExportDefaultsSettingsForm({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>默认导出媒体文件</label>
|
<div className="form-copy">
|
||||||
<span className="form-hint">控制图片/语音/表情的默认导出开关</span>
|
<label>默认导出媒体文件</label>
|
||||||
<div className="log-toggle-line">
|
<span className="form-hint">控制图片/语音/表情的默认导出开关</span>
|
||||||
<span className="log-status">{exportDefaultMedia ? '已开启' : '已关闭'}</span>
|
</div>
|
||||||
<label className="switch" htmlFor="shared-export-default-media">
|
<div className="form-control">
|
||||||
<input
|
<div className="log-toggle-line">
|
||||||
id="shared-export-default-media"
|
<span className="log-status">{exportDefaultMedia ? '已开启' : '已关闭'}</span>
|
||||||
className="switch-input"
|
<label className="switch" htmlFor="shared-export-default-media">
|
||||||
type="checkbox"
|
<input
|
||||||
checked={exportDefaultMedia}
|
id="shared-export-default-media"
|
||||||
onChange={async (e) => {
|
className="switch-input"
|
||||||
const enabled = e.target.checked
|
type="checkbox"
|
||||||
setExportDefaultMedia(enabled)
|
checked={exportDefaultMedia}
|
||||||
await configService.setExportDefaultMedia(enabled)
|
onChange={async (e) => {
|
||||||
onDefaultsChanged?.({ media: enabled })
|
const enabled = e.target.checked
|
||||||
notify(enabled ? '已开启默认媒体导出' : '已关闭默认媒体导出', true)
|
setExportDefaultMedia(enabled)
|
||||||
|
await configService.setExportDefaultMedia(enabled)
|
||||||
|
onDefaultsChanged?.({ media: enabled })
|
||||||
|
notify(enabled ? '已开启默认媒体导出' : '已关闭默认媒体导出', true)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="switch-slider" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="form-copy">
|
||||||
|
<label>默认语音转文字</label>
|
||||||
|
<span className="form-hint">导出时默认将语音转写为文字</span>
|
||||||
|
</div>
|
||||||
|
<div className="form-control">
|
||||||
|
<div className="log-toggle-line">
|
||||||
|
<span className="log-status">{exportDefaultVoiceAsText ? '已开启' : '已关闭'}</span>
|
||||||
|
<label className="switch" htmlFor="shared-export-default-voice-as-text">
|
||||||
|
<input
|
||||||
|
id="shared-export-default-voice-as-text"
|
||||||
|
className="switch-input"
|
||||||
|
type="checkbox"
|
||||||
|
checked={exportDefaultVoiceAsText}
|
||||||
|
onChange={async (e) => {
|
||||||
|
const enabled = e.target.checked
|
||||||
|
setExportDefaultVoiceAsText(enabled)
|
||||||
|
await configService.setExportDefaultVoiceAsText(enabled)
|
||||||
|
onDefaultsChanged?.({ voiceAsText: enabled })
|
||||||
|
notify(enabled ? '已开启默认语音转文字' : '已关闭默认语音转文字', true)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="switch-slider" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="form-copy">
|
||||||
|
<label>Excel 列显示</label>
|
||||||
|
<span className="form-hint">控制 Excel 导出的列字段</span>
|
||||||
|
</div>
|
||||||
|
<div className="form-control">
|
||||||
|
<div className="select-field" ref={exportExcelColumnsDropdownRef}>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className={`select-trigger ${showExportExcelColumnsSelect ? 'open' : ''}`}
|
||||||
|
onClick={() => {
|
||||||
|
setShowExportExcelColumnsSelect(!showExportExcelColumnsSelect)
|
||||||
|
setShowExportFormatSelect(false)
|
||||||
|
setIsExportDateRangeDialogOpen(false)
|
||||||
|
setShowExportConcurrencySelect(false)
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
<span className="switch-slider" />
|
<span className="select-value">{exportExcelColumnsLabel}</span>
|
||||||
</label>
|
<ChevronDown size={16} />
|
||||||
|
</button>
|
||||||
|
{showExportExcelColumnsSelect && (
|
||||||
|
<div className="select-dropdown">
|
||||||
|
{exportExcelColumnOptions.map((option) => (
|
||||||
|
<button
|
||||||
|
key={option.value}
|
||||||
|
type="button"
|
||||||
|
className={`select-option ${exportExcelColumnsValue === option.value ? 'active' : ''}`}
|
||||||
|
onClick={async () => {
|
||||||
|
const compact = option.value === 'compact'
|
||||||
|
setExportDefaultExcelCompactColumns(compact)
|
||||||
|
await configService.setExportDefaultExcelCompactColumns(compact)
|
||||||
|
onDefaultsChanged?.({ excelCompactColumns: compact })
|
||||||
|
notify(compact ? '已启用精简列' : '已启用完整列', true)
|
||||||
|
setShowExportExcelColumnsSelect(false)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="option-label">{option.label}</span>
|
||||||
|
<span className="option-desc">{option.desc}</span>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>默认语音转文字</label>
|
<div className="form-copy">
|
||||||
<span className="form-hint">导出时默认将语音转写为文字</span>
|
<label>导出并发数</label>
|
||||||
<div className="log-toggle-line">
|
<span className="form-hint">导出多个会话时的最大并发(1~6)</span>
|
||||||
<span className="log-status">{exportDefaultVoiceAsText ? '已开启' : '已关闭'}</span>
|
</div>
|
||||||
<label className="switch" htmlFor="shared-export-default-voice-as-text">
|
<div className="form-control">
|
||||||
<input
|
<div className="select-field" ref={exportConcurrencyDropdownRef}>
|
||||||
id="shared-export-default-voice-as-text"
|
<button
|
||||||
className="switch-input"
|
type="button"
|
||||||
type="checkbox"
|
className={`select-trigger ${showExportConcurrencySelect ? 'open' : ''}`}
|
||||||
checked={exportDefaultVoiceAsText}
|
onClick={() => {
|
||||||
onChange={async (e) => {
|
setShowExportConcurrencySelect(!showExportConcurrencySelect)
|
||||||
const enabled = e.target.checked
|
setShowExportFormatSelect(false)
|
||||||
setExportDefaultVoiceAsText(enabled)
|
setIsExportDateRangeDialogOpen(false)
|
||||||
await configService.setExportDefaultVoiceAsText(enabled)
|
setShowExportExcelColumnsSelect(false)
|
||||||
onDefaultsChanged?.({ voiceAsText: enabled })
|
|
||||||
notify(enabled ? '已开启默认语音转文字' : '已关闭默认语音转文字', true)
|
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
<span className="switch-slider" />
|
<span className="select-value">{exportConcurrencyLabel}</span>
|
||||||
</label>
|
<ChevronDown size={16} />
|
||||||
</div>
|
</button>
|
||||||
</div>
|
{showExportConcurrencySelect && (
|
||||||
|
<div className="select-dropdown">
|
||||||
<div className="form-group">
|
{exportConcurrencyOptions.map((option) => (
|
||||||
<label>Excel 列显示</label>
|
<button
|
||||||
<span className="form-hint">控制 Excel 导出的列字段</span>
|
key={option}
|
||||||
<div className="select-field" ref={exportExcelColumnsDropdownRef}>
|
type="button"
|
||||||
<button
|
className={`select-option ${exportDefaultConcurrency === option ? 'active' : ''}`}
|
||||||
type="button"
|
onClick={async () => {
|
||||||
className={`select-trigger ${showExportExcelColumnsSelect ? 'open' : ''}`}
|
setExportDefaultConcurrency(option)
|
||||||
onClick={() => {
|
await configService.setExportDefaultConcurrency(option)
|
||||||
setShowExportExcelColumnsSelect(!showExportExcelColumnsSelect)
|
onDefaultsChanged?.({ concurrency: option })
|
||||||
setShowExportFormatSelect(false)
|
notify(`已将导出并发数设为 ${option}`, true)
|
||||||
setIsExportDateRangeDialogOpen(false)
|
setShowExportConcurrencySelect(false)
|
||||||
setShowExportConcurrencySelect(false)
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<span className="option-label">{option}</span>
|
||||||
<span className="select-value">{exportExcelColumnsLabel}</span>
|
</button>
|
||||||
<ChevronDown size={16} />
|
))}
|
||||||
</button>
|
</div>
|
||||||
{showExportExcelColumnsSelect && (
|
)}
|
||||||
<div className="select-dropdown">
|
</div>
|
||||||
{exportExcelColumnOptions.map((option) => (
|
|
||||||
<button
|
|
||||||
key={option.value}
|
|
||||||
type="button"
|
|
||||||
className={`select-option ${exportExcelColumnsValue === option.value ? 'active' : ''}`}
|
|
||||||
onClick={async () => {
|
|
||||||
const compact = option.value === 'compact'
|
|
||||||
setExportDefaultExcelCompactColumns(compact)
|
|
||||||
await configService.setExportDefaultExcelCompactColumns(compact)
|
|
||||||
onDefaultsChanged?.({ excelCompactColumns: compact })
|
|
||||||
notify(compact ? '已启用精简列' : '已启用完整列', true)
|
|
||||||
setShowExportExcelColumnsSelect(false)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="option-label">{option.label}</span>
|
|
||||||
<span className="option-desc">{option.desc}</span>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="form-group">
|
|
||||||
<label>导出并发数</label>
|
|
||||||
<span className="form-hint">导出多个会话时的最大并发(1~6)</span>
|
|
||||||
<div className="select-field" ref={exportConcurrencyDropdownRef}>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className={`select-trigger ${showExportConcurrencySelect ? 'open' : ''}`}
|
|
||||||
onClick={() => {
|
|
||||||
setShowExportConcurrencySelect(!showExportConcurrencySelect)
|
|
||||||
setShowExportFormatSelect(false)
|
|
||||||
setIsExportDateRangeDialogOpen(false)
|
|
||||||
setShowExportExcelColumnsSelect(false)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="select-value">{exportConcurrencyLabel}</span>
|
|
||||||
<ChevronDown size={16} />
|
|
||||||
</button>
|
|
||||||
{showExportConcurrencySelect && (
|
|
||||||
<div className="select-dropdown">
|
|
||||||
{exportConcurrencyOptions.map((option) => (
|
|
||||||
<button
|
|
||||||
key={option}
|
|
||||||
type="button"
|
|
||||||
className={`select-option ${exportDefaultConcurrency === option ? 'active' : ''}`}
|
|
||||||
onClick={async () => {
|
|
||||||
setExportDefaultConcurrency(option)
|
|
||||||
await configService.setExportDefaultConcurrency(option)
|
|
||||||
onDefaultsChanged?.({ concurrency: option })
|
|
||||||
notify(`已将导出并发数设为 ${option}`, true)
|
|
||||||
setShowExportConcurrencySelect(false)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span className="option-label">{option}</span>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5294,7 +5294,7 @@ function ExportPage() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="export-defaults-modal-body">
|
<div className="export-defaults-modal-body">
|
||||||
<ExportDefaultsSettingsForm onDefaultsChanged={handleExportDefaultsChanged} />
|
<ExportDefaultsSettingsForm layout="split" onDefaultsChanged={handleExportDefaultsChanged} />
|
||||||
</div>
|
</div>
|
||||||
<div className="export-defaults-modal-actions">
|
<div className="export-defaults-modal-actions">
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in New Issue
Block a user