UNPKG

vamp-utils

Version:
118 lines (117 loc) 3.12 kB
export type TextAlign = 'left' | 'center' | 'right'; export type BarcodeType = string; export interface Position { top: number; left: number; } export interface Edge extends Partial<Position> { bottom?: number; right?: number; } export interface TextStyle { fontSize?: number; align?: TextAlign; font?: string; bold?: boolean; lineHeight?: number; } interface Size { height: number; width: number; } export interface LabelStyle extends Size { textColor?: string; backgroundColor?: string; padding?: Edge; border?: Edge; } export interface LabelComponent extends Size { id: string | number; type: string; position: Position; } export interface DynamicLabel extends LabelComponent { property: string; } export interface TextLabel extends DynamicLabel, LabelStyle { type: 'text'; showTitle?: boolean; title?: string; blockTitle?: boolean; titleStyle?: TextStyle; contentStyle?: TextStyle; } export interface CustomTextLabel extends LabelComponent, LabelStyle { type: 'custom-text'; withCheckbox?: boolean; checked?: boolean; text?: string; contentStyle?: TextStyle; } export interface BarcodeLabel extends DynamicLabel { type: 'barcode'; showText?: boolean; align?: TextAlign; bold?: boolean; category?: BarcodeType; prefix?: string; suffix?: string; size?: number; } export interface QrcodeLabel extends DynamicLabel { type: 'qrcode'; } export interface Parallelogram extends LabelComponent { type: 'parallelogram'; } export type BorderType = 'solid' | 'dotted' | 'dashed' | 'double'; export interface Rectangle extends LabelComponent, LabelStyle { borderType?: BorderType; borderWidth?: number; } export type LineDirection = 'vertical' | 'horizontal'; export interface Line extends LabelComponent { lineType?: BorderType; size: number; length: number; direction: LineDirection; } export interface Circle extends LabelComponent { type: 'circle'; text?: string; style?: Pick<TextStyle, 'font' | 'fontSize' | 'bold'>; borderWidth?: number; } export interface ImageComponent extends LabelComponent, LabelStyle { type: 'image'; property?: string; url?: string; } export interface Copies extends LabelComponent { type: 'copies'; fontSize: number; bold?: boolean; showTotal?: boolean; showBorder?: boolean; } interface CreateLabelOptions { type: string; position?: Edge; property?: string; [OPT: string]: any; } declare function crateLabelComponent({ type, position, property, ...rest }: CreateLabelOptions): LabelComponent; export interface LineCreateOptions { direction?: LineDirection; length?: number; width?: number; } declare function createLineComponent(position: Edge, options?: Partial<Line>): Line; export { createLineComponent }; interface HasValue<V = any> { value?: V; } export interface PrintableLabelComponent<V = any> extends LabelComponent, HasValue<V> { } export declare const boxCodeProperty = "@@boxCode"; export default crateLabelComponent;