canvas-editor-pdf
Version:
pdf exporter to canvas-editor
139 lines (137 loc) • 3.93 kB
TypeScript
import { LocationPosition } from '../dataset/enum/Common';
import { ControlType, ControlIndentation } from '../dataset/enum/Control';
import { EditorZone } from '../dataset/enum/Editor';
import { MoveDirection } from '../dataset/enum/Observer';
import { IDrawOption } from './Draw';
import { IElement } from './Element';
import { IPositionContext } from './Position';
import { IRange } from './Range';
export interface IValueSet {
value: string;
code: string;
}
export interface IControlSelect {
code: string | null;
valueSets: IValueSet[];
}
export interface IControlCheckbox {
code: string | null;
min?: number;
max?: number;
valueSets: IValueSet[];
}
export interface IControlRadio {
code: string | null;
valueSets: IValueSet[];
}
export interface IControlDate {
dateFormat?: string;
}
export interface IControlHighlightRule {
keyword: string;
alpha?: number;
backgroundColor?: string;
}
export interface IControlHighlight {
ruleList: IControlHighlightRule[];
id?: string;
conceptId?: string;
}
export interface IControlRule {
deletable?: boolean;
disabled?: boolean;
}
export interface IControlBasic {
type: ControlType;
value: IElement[] | null;
placeholder?: string;
conceptId?: string;
prefix?: string;
postfix?: string;
minWidth?: number;
underline?: boolean;
border?: boolean;
extension?: unknown;
indentation?: ControlIndentation;
}
export interface IControlStyle {
font?: string;
size?: number;
bold?: boolean;
highlight?: string;
italic?: boolean;
strikeout?: boolean;
}
export type IControl = IControlBasic & IControlRule & Partial<IControlStyle> & Partial<IControlSelect> & Partial<IControlCheckbox> & Partial<IControlRadio> & Partial<IControlDate>;
export interface IControlOption {
placeholderColor?: string;
bracketColor?: string;
prefix?: string;
postfix?: string;
borderWidth?: number;
borderColor?: string;
activeBackgroundColor?: string;
}
export interface IControlInitOption {
index: number;
isTable?: boolean;
trIndex?: number;
tdIndex?: number;
tdValueIndex?: number;
}
export interface IControlInitResult {
newIndex: number;
}
export interface IControlInstance {
setElement(element: IElement): void;
getElement(): IElement;
getValue(): IElement[];
setValue(data: IElement[], context?: IControlContext, options?: IControlRuleOption): number;
keydown(evt: KeyboardEvent): number | null;
cut(): number;
}
export interface IControlContext {
range?: IRange;
elementList?: IElement[];
}
export interface IControlRuleOption {
isIgnoreDisabledRule?: boolean;
isAddPlaceholder?: boolean;
}
export interface IGetControlValueOption {
id?: string;
conceptId?: string;
}
export type IGetControlValueResult = (Omit<IControl, 'value'> & {
value: string | null;
innerText: string | null;
zone: EditorZone;
elementList?: IElement[];
})[];
export interface ISetControlValueOption {
id?: string;
conceptId?: string;
value: string | IElement[];
}
export interface ISetControlExtensionOption {
id?: string;
conceptId?: string;
extension: unknown;
}
export type ISetControlHighlightOption = IControlHighlight[];
export type ISetControlProperties = {
id?: string;
conceptId?: string;
properties: Partial<Omit<IControl, 'value'>>;
};
export type IRepaintControlOption = Pick<IDrawOption, 'curIndex' | 'isCompute' | 'isSubmitHistory' | 'isSetCursor'>;
export interface INextControlContext {
positionContext: IPositionContext;
nextIndex: number;
}
export interface IInitNextControlOption {
direction?: MoveDirection;
}
export interface ILocationControlOption {
position: LocationPosition;
}