This commit is contained in:
iqudoo
2026-06-14 03:59:45 +08:00
parent 833eda5621
commit 1e03b7750a
23 changed files with 1499 additions and 153 deletions

View File

@@ -11,7 +11,15 @@ export const TEXT_EXTRACT_MODE_LABELS: Record<TextExtractMode, string> = {
suffix: '后 N 位',
};
export type ElementVisibilityMode = 'always' | 'conditional';
export type VisibilityOperator = 'empty' | 'not_empty' | 'gt' | 'lt' | 'eq' | 'neq';
export type VisibilityOperator =
| 'empty'
| 'not_empty'
| 'gt'
| 'lt'
| 'eq'
| 'neq'
| 'contains'
| 'not_contains';
/** 显示条件判断对象:变量值 或 本元素解析后的内容值 */
export type VisibilityRuleTarget = 'variable' | 'content';
@@ -20,8 +28,10 @@ export interface VisibilityRule {
target?: VisibilityRuleTarget;
variable: string;
operator: VisibilityOperator;
/** gt / lt / eq / neq 时的比较目标值 */
/** gt / lt / eq / neq / contains / not_contains 时的比较目标值 */
value?: string;
/** 为 false 时跳过该条件;默认启用 */
enabled?: boolean;
}
export const VISIBILITY_RULE_TARGET_LABELS: Record<VisibilityRuleTarget, string> = {
@@ -36,6 +46,8 @@ export const VISIBILITY_OPERATOR_LABELS: Record<VisibilityOperator, string> = {
lt: '小于',
eq: '等于',
neq: '不等于',
contains: '包含',
not_contains: '不包含',
};
export type ElementSide = 'top' | 'right' | 'bottom' | 'left';
export type ElementCorner = 'tl' | 'tr' | 'br' | 'bl';
@@ -210,12 +222,14 @@ export interface CutLineConfig {
color: string;
}
export type ExportRangeMode = 'all' | 'odd' | 'even' | 'custom';
export type ExportRangeMode = 'all' | 'odd' | 'even' | 'custom' | 'conditional';
export interface ExportRangeConfig {
mode: ExportRangeMode;
/** 自定义范围1-based 序号,如 "1,3,5-10" */
custom?: string;
/** mode=conditional 时,全部满足才纳入排版/导出范围 */
filterRules?: VisibilityRule[];
}
export interface LabelTemplate {
@@ -232,6 +246,20 @@ export interface LabelTemplate {
paper?: PaperConfig;
/** PDF 裁切参考线配置 */
cutLine?: CutLineConfig;
/** 设计画布预览参考背景URL / data URI */
previewReferenceBackground?: string;
/** 预览参考背景不透明度 0100默认 100 */
previewReferenceBackgroundOpacity?: number;
/** 预览参考背景适应方式,默认 cover */
previewReferenceBackgroundFit?: 'contain' | 'cover' | 'fill';
/** 生成 PDF / 打印 / 排版预览输出时是否绘制参考背景,默认 false */
includeReferenceBackgroundInOutput?: boolean;
/** 批量导出图片时的文件名模板,支持 {#SEQ}、{#INDEX}、{变量名};留空则按序号补零命名 */
exportImageFileNamePattern?: string;
/** 批量导出图片all=全部导出conditional=按条件过滤 */
exportImageFilterMode?: ElementVisibilityMode;
/** 批量导出图片过滤条件;全部满足时才导出该枚标签 */
exportImageFilterRules?: VisibilityRule[];
}
export type PaperType = 'A4' | 'A5' | 'A6' | 'custom';