完美
This commit is contained in:
30
src/types.ts
30
src/types.ts
@@ -1,16 +1,34 @@
|
||||
export type TextFormat = 'text' | 'number' | 'percent' | 'currency';
|
||||
/** 数值格式下的显示部分:完整 / 仅整数 / 仅小数(含小数点) */
|
||||
export type NumberPartDisplay = 'full' | 'integer' | 'fraction';
|
||||
/** 文本变量值提取方式 */
|
||||
export type TextExtractMode = 'none' | 'split' | 'prefix' | 'suffix';
|
||||
|
||||
export const TEXT_EXTRACT_MODE_LABELS: Record<TextExtractMode, string> = {
|
||||
none: '无',
|
||||
split: '按分隔符',
|
||||
prefix: '前 N 位',
|
||||
suffix: '后 N 位',
|
||||
};
|
||||
export type ElementVisibilityMode = 'always' | 'conditional';
|
||||
export type VisibilityOperator = 'empty' | 'not_empty' | 'gt' | 'lt' | 'eq' | 'neq';
|
||||
/** 显示条件判断对象:变量值 或 本元素解析后的内容值 */
|
||||
export type VisibilityRuleTarget = 'variable' | 'content';
|
||||
|
||||
export interface VisibilityRule {
|
||||
/** 条件对象,默认 variable */
|
||||
target?: VisibilityRuleTarget;
|
||||
variable: string;
|
||||
operator: VisibilityOperator;
|
||||
/** gt / lt / eq / neq 时的比较目标值 */
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export const VISIBILITY_RULE_TARGET_LABELS: Record<VisibilityRuleTarget, string> = {
|
||||
variable: '变量',
|
||||
content: '内容值',
|
||||
};
|
||||
|
||||
export const VISIBILITY_OPERATOR_LABELS: Record<VisibilityOperator, string> = {
|
||||
empty: '为空',
|
||||
not_empty: '不为空',
|
||||
@@ -86,6 +104,18 @@ export interface TemplateElement {
|
||||
decimalPlaces?: number;
|
||||
/** 数值格式下显示整数或小数部分,仅 type=text 且 textFormat≠text */
|
||||
numberPartDisplay?: NumberPartDisplay;
|
||||
/** 变量值提取方式(文本/条码/二维码/图片内容均有效) */
|
||||
textExtractMode?: TextExtractMode;
|
||||
/** 按分隔符拆分时使用的分隔符 */
|
||||
textSplitDelimiter?: string;
|
||||
/** 分隔后显示第几位(从 1 开始),段数不足时显示为空 */
|
||||
textSplitIndex?: number;
|
||||
/** 前 N / 后 N 位提取时的位数 */
|
||||
textExtractLength?: number;
|
||||
/** 提取后在显示文本前追加的前缀字符,仅 type=text;不参与内容值条件 */
|
||||
textDisplayPrefix?: string;
|
||||
/** 提取后在显示文本后追加的后缀字符,仅 type=text;不参与内容值条件 */
|
||||
textDisplaySuffix?: string;
|
||||
/** 边框宽度 (mm),0 为无边框;各边留空时沿用此值 */
|
||||
borderWidth?: number;
|
||||
borderColor?: string;
|
||||
|
||||
Reference in New Issue
Block a user