UI 重设计(P1-P5): - 主题从靛蓝 accent 切换为近黑白单色(#111318),品牌感靠排版与财务语义色 - 暗色模式适配 OLED 纯黑,财务色整体提亮一档保证对比度 - 圆角体系新增 xl(24),卡片/弹窗统一大圆角 - 移除 Caveat/Quicksand 自定义字体,切换为系统字体 - 新增 display(34/800) 字阶用于净资产等大数字展示 - 分类/标签/渠道颜色统一到 palette.ts 色板(12 色循环 + FNV 哈希) 记一笔 NumpadSheet(P3 录入闭环): - 全新计算器风格录入面板:方向 chip → 大金额 → 账户 chip → 分类快捷行 → 数字键盘 - 支持表达式输入(20+15-5.5)与字符串十进制求值,避免浮点精度问题 - 高级模式保留多行分录编辑器,简单模式自动推断双腿 - postingLegs.ts 实现 buildPostings 的逆操作(编辑/草稿预填) - 未保存守卫:整页 beforeRemove + modal 脏状态上报 - 全局弹层(NumpadSheetHost)由+按钮唤起,可通过设置开关 Tab 栏重构: - AppTabBar 替换默认 tab bar,中央+按钮唤起全局记账面板 - Tab 从 5 个精简为 4 个(首页/交易/报表/设置),+按钮独立 管理页模板 ManagementScreen: - 统一「列表 + 新增 + 点按编辑 + 长按删除 + FormModal」模式 - 预算/分类/标签/信用卡等管理页消除手写样板 其他: - OCR 模型从 PP-OCRv5 升级到 v6(det/rec/dict 全部替换) - GBK 解码器 import 修复(text-encoding-gbk ESM 兼容) - 批量确认失败数计算修正(用 failedPayees.length 替代 store 快照差值) - 新增 diagnostics 诊断页、TodoStrip 首页待办条、SwipeableTransactionCard 左滑操作 - periodNav.ts 报表周期导航(anchor+period 统一状态管理,本地时区运算) - 测试覆盖 numpadExpression/postingLegs/periodNav/palette/search/transactionGroups/categoryIcons/dateGrid
96 lines
3.5 KiB
TypeScript
96 lines
3.5 KiB
TypeScript
/**
|
||
* 高级筛选底部弹层(spec §6):账户 / 日期范围 / 金额区间。
|
||
* 受控组件:值由父级持有,「完成」回调应用,「重置」清空。
|
||
*/
|
||
import React from 'react';
|
||
import { StyleSheet, Text, TextInput, View } from 'react-native';
|
||
import { useTheme, createCommonStyles } from '../theme';
|
||
import { useT } from '../i18n';
|
||
import { BottomSheet } from './BottomSheet';
|
||
import { DatePickerField } from './DatePickerField';
|
||
import { Button } from './Button';
|
||
|
||
export interface AdvancedFilterValues {
|
||
account: string;
|
||
dateFrom: string;
|
||
dateTo: string;
|
||
amountMin: string;
|
||
amountMax: string;
|
||
}
|
||
|
||
interface FilterSheetProps {
|
||
visible: boolean;
|
||
onClose: () => void;
|
||
values: AdvancedFilterValues;
|
||
onChange: (values: AdvancedFilterValues) => void;
|
||
onReset: () => void;
|
||
}
|
||
|
||
export function FilterSheet({ visible, onClose, values, onChange, onReset }: FilterSheetProps) {
|
||
const { theme } = useTheme();
|
||
const commonStyles = createCommonStyles(theme);
|
||
const t = useT();
|
||
const set = (patch: Partial<AdvancedFilterValues>) => onChange({ ...values, ...patch });
|
||
|
||
return (
|
||
<BottomSheet visible={visible} onClose={onClose} title={t('filter.title')} scrollable>
|
||
<Text style={[theme.typography.caption, styles.label, { color: theme.colors.fgSecondary }]}>
|
||
{t('transactions.accountFilterPlaceholder')}
|
||
</Text>
|
||
<TextInput
|
||
value={values.account}
|
||
onChangeText={v => set({ account: v })}
|
||
placeholder={t('transactions.accountFilterPlaceholder')}
|
||
placeholderTextColor={theme.colors.fgSecondary}
|
||
style={commonStyles.input}
|
||
/>
|
||
|
||
<Text style={[theme.typography.caption, styles.label, { color: theme.colors.fgSecondary }]}>
|
||
{t('transactions.dateFrom')} ~ {t('transactions.dateTo')}
|
||
</Text>
|
||
<View style={styles.row}>
|
||
<View style={styles.flex1}><DatePickerField value={values.dateFrom} onChange={v => set({ dateFrom: v })} placeholder={t('transactions.dateFrom')} /></View>
|
||
<View style={styles.flex1}><DatePickerField value={values.dateTo} onChange={v => set({ dateTo: v })} placeholder={t('transactions.dateTo')} /></View>
|
||
</View>
|
||
|
||
<Text style={[theme.typography.caption, styles.label, { color: theme.colors.fgSecondary }]}>
|
||
{t('transactions.amountMin')} ~ {t('transactions.amountMax')}
|
||
</Text>
|
||
<View style={styles.row}>
|
||
<TextInput
|
||
value={values.amountMin}
|
||
onChangeText={v => set({ amountMin: v })}
|
||
placeholder={t('transactions.amountMin')}
|
||
placeholderTextColor={theme.colors.fgSecondary}
|
||
keyboardType="decimal-pad"
|
||
style={[commonStyles.input, styles.flex1]}
|
||
/>
|
||
<TextInput
|
||
value={values.amountMax}
|
||
onChangeText={v => set({ amountMax: v })}
|
||
placeholder={t('transactions.amountMax')}
|
||
placeholderTextColor={theme.colors.fgSecondary}
|
||
keyboardType="decimal-pad"
|
||
style={[commonStyles.input, styles.flex1]}
|
||
/>
|
||
</View>
|
||
|
||
<View style={[styles.row, styles.actions]}>
|
||
<View style={styles.flex1}>
|
||
<Button label={t('filter.reset')} variant="secondary" onPress={onReset} />
|
||
</View>
|
||
<View style={styles.flex1}>
|
||
<Button label={t('filter.apply')} onPress={onClose} />
|
||
</View>
|
||
</View>
|
||
</BottomSheet>
|
||
);
|
||
}
|
||
|
||
const styles = StyleSheet.create({
|
||
label: { marginTop: 10, marginBottom: 4 },
|
||
row: { flexDirection: 'row', gap: 8 },
|
||
flex1: { flex: 1 },
|
||
actions: { marginTop: 16 },
|
||
});
|