From 8b09bcaa1499b81575e99d26290a6b8cf09d26e4 Mon Sep 17 00:00:00 2001 From: iqudoo Date: Sat, 13 Jun 2026 12:56:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 10 +- src/components/DataImporter.tsx | 5 +- src/components/DataRangeFields.tsx | 5 +- src/components/ExportSidebar.tsx | 5 +- src/components/MobileExportLayoutPanel.tsx | 5 +- src/components/PreviewGrid.tsx | 9 +- src/components/PropSidebar.tsx | 25 +-- src/components/PsSelect.tsx | 237 +++++++++++++++++++++ src/components/ValueExtractFields.tsx | 5 +- src/components/VariableMappingPanel.tsx | 16 +- src/components/VisibilityRuleForm.tsx | 13 +- src/index.css | 92 ++++++++ src/utils.ts | 15 +- 13 files changed, 400 insertions(+), 42 deletions(-) create mode 100644 src/components/PsSelect.tsx diff --git a/src/App.tsx b/src/App.tsx index 01a3409..b7d58c3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -498,12 +498,13 @@ export default function App() { const mappedRows = useMemo( () => - activeRows.map((row) => + activeRows.map((row, rowIndex) => applyRowVariableMapping( row, variableColumnMapping, templateVariables, - workingTemplate.variableDefaults + workingTemplate.variableDefaults, + rowIndex ) ), [activeRows, variableColumnMapping, templateVariables, workingTemplate.variableDefaults] @@ -530,12 +531,13 @@ export default function App() { const appliedMappedRows = useMemo(() => { if (!appliedExportData) return []; - return appliedExportData.rows.map((row) => + return appliedExportData.rows.map((row, rowIndex) => applyRowVariableMapping( row, appliedExportData.mapping, templateVariables, - workingTemplate.variableDefaults + workingTemplate.variableDefaults, + rowIndex ) ); }, [appliedExportData, templateVariables, workingTemplate.variableDefaults]); diff --git a/src/components/DataImporter.tsx b/src/components/DataImporter.tsx index 169de38..56fca7a 100644 --- a/src/components/DataImporter.tsx +++ b/src/components/DataImporter.tsx @@ -3,6 +3,7 @@ import * as XLSX from 'xlsx'; import { ImportData, RecordRow } from '../types'; import { FileSpreadsheet, Upload, Download, Trash2 } from 'lucide-react'; import { useAppDialog } from './AppDialog'; +import { FieldSelect } from './PsSelect'; export function downloadDataTemplate(templateName: string, templateVariables: string[]) { const columns = templateVariables.length > 0 ? templateVariables : ['数据']; @@ -331,7 +332,7 @@ export const DataImporter: React.FC = ({ > 工作表 - + {sheetLoading && (

切换中… diff --git a/src/components/DataRangeFields.tsx b/src/components/DataRangeFields.tsx index cd284cf..b220c61 100644 --- a/src/components/DataRangeFields.tsx +++ b/src/components/DataRangeFields.tsx @@ -3,6 +3,7 @@ import { Filter } from 'lucide-react'; import { ExportRangeConfig, LabelTemplate, PaperConfig, RecordRow } from '../types'; import { buildPrintablePages } from '../utils'; import { PageInput } from './PreviewGrid'; +import { FieldSelect } from './PsSelect'; interface DataRangeFieldsProps { variant?: 'ps' | 'mobile'; @@ -36,7 +37,7 @@ export const DataRangeFields: React.FC = ({

{isMobile && } {/* {!isMobile && } */} - +
{exportRange.mode === 'custom' && (
diff --git a/src/components/ExportSidebar.tsx b/src/components/ExportSidebar.tsx index 990b4f4..5569202 100644 --- a/src/components/ExportSidebar.tsx +++ b/src/components/ExportSidebar.tsx @@ -6,6 +6,7 @@ import { VariableMappingPanel } from './VariableMappingPanel'; import { PaperSettingsPanel, PageInput } from './PreviewGrid'; import { CollapsiblePanelSection } from './CollapsiblePanelSection'; import { DataRangeFields } from './DataRangeFields'; +import { FieldSelect } from './PsSelect'; interface ExportSidebarProps { importData: ImportData | null; @@ -220,7 +221,7 @@ export const ExportSidebar: React.FC = ({ >
- +
diff --git a/src/components/MobileExportLayoutPanel.tsx b/src/components/MobileExportLayoutPanel.tsx index c09ea65..6d89839 100644 --- a/src/components/MobileExportLayoutPanel.tsx +++ b/src/components/MobileExportLayoutPanel.tsx @@ -8,6 +8,7 @@ import { RecordRow, } from '../types'; import { PaperSettingsPanel, PageInput } from './PreviewGrid'; +import { FieldSelect } from './PsSelect'; interface MobileExportLayoutPanelProps { template: LabelTemplate; @@ -59,7 +60,7 @@ export const MobileExportLayoutPanel: React.FC = ( >
- +
diff --git a/src/components/PreviewGrid.tsx b/src/components/PreviewGrid.tsx index b569610..30e45e2 100644 --- a/src/components/PreviewGrid.tsx +++ b/src/components/PreviewGrid.tsx @@ -17,6 +17,7 @@ import { import { CanvasLabelImage } from './CanvasLabelImage'; import { CommitInput } from './CommitInput'; import { useAppDialog } from './AppDialog'; +import { FieldSelect } from './PsSelect'; import { FileDown, RefreshCcw, X } from 'lucide-react'; interface PageInputProps extends Omit, 'onChange'> { @@ -316,7 +317,7 @@ export const PaperSettingsPanel: React.FC = ({

纸张

- +
{draftPaper.type === 'custom' && ( @@ -499,14 +500,14 @@ export const PaperSettingsPanel: React.FC = ({
- +
diff --git a/src/components/PropSidebar.tsx b/src/components/PropSidebar.tsx index bd39dbe..9c1b7f8 100644 --- a/src/components/PropSidebar.tsx +++ b/src/components/PropSidebar.tsx @@ -20,6 +20,7 @@ import { type AlignMode, } from '../elementAlign'; import { CollapsiblePanelSection } from './CollapsiblePanelSection'; +import { FieldSelect } from './PsSelect'; import { CommitInput } from './CommitInput'; import { useAppDialog } from './AppDialog'; import { useIsNarrowScreen } from '../hooks/useIsMobile'; @@ -682,7 +683,7 @@ export const PropSidebar: React.FC = ({
显示控制
- +
{isConditionalVisibility(selectedElem) && (() => { const rules = resolveVisibilityRules(selectedElem); @@ -962,7 +963,7 @@ export const PropSidebar: React.FC = ({
- +
{(selectedElem.textFormat === 'number' || selectedElem.textFormat === 'percent' || @@ -1004,7 +1005,7 @@ export const PropSidebar: React.FC = ({
- +

可将价格拆成两个文本元素分别设置字号,如「19」与「.9」

@@ -1045,7 +1046,7 @@ export const PropSidebar: React.FC = ({
- +
@@ -1303,7 +1304,7 @@ export const PropSidebar: React.FC = ({
- +