import { fabric } from 'fabric';
|
|
export const TemplateParamObjectName = 'template-param';
|
|
export const TemplateParamExtensionKey = [
|
'templateParamType',
|
'recorder',
|
'userType',
|
'label',
|
'name',
|
'required',
|
'templateDataParamId',
|
'pageNum',
|
];
|
|
export class TemplateParam extends fabric.IText {
|
type = TemplateParamObjectName;
|
|
constructor(text: string, options: TemplateParamOptions) {
|
super(text, options);
|
}
|
|
toObject(propertiesToInclude) {
|
//@ts-ignore
|
return this.callSuper('toObject', TemplateParamExtensionKey.concat(propertiesToInclude));
|
}
|
}
|
|
//@ts-ignore
|
fabric.TemplateParam = TemplateParam;
|
fabric.Object._fromObject[TemplateParamObjectName] = function (text, objectOptions) {
|
console.log('objectOptions: ', objectOptions);
|
return new TemplateParam(text, objectOptions);
|
};
|
|
export interface TemplateParamOptions extends fabric.ITextOptions {
|
templateDataParamId: string;
|
pageNum?: number;
|
|
templateParamType?: EnumContractTemplateValueType;
|
recorder?: EnumContractTemplateValueRecorder;
|
userType?: EnumUserType;
|
/** 变量名称 */
|
label?: string;
|
/** 变量代码 */
|
name?: string;
|
/** 是否必填 */
|
required?: boolean;
|
}
|
|
export interface TemplateParamExtraData {
|
dataParamNameFieldName?: string;
|
templateParamFieldName?: string;
|
pageNum?: number;
|
}
|