clinical-template-editor-hzg
Version:
一个基于 React 和 TipTap 构建的临床模板编辑器组件,专为医疗行业设计
50 lines (49 loc) • 2.41 kB
TypeScript
import React from 'react';
import 'katex/dist/katex.min.css';
import { TemplateVariable } from './templateVariables';
export declare const tableRowResizeMinHeight = 5;
declare global {
interface Window {
updateTemplateVariables?: (variables: TemplateVariable[]) => void;
}
}
export interface ClinicalTemplateEditorRef {
getContent: (format?: 'html' | 'json' | 'markdown') => string;
setContent: (content: string, format?: 'html' | 'json' | 'markdown') => void;
getVariableValues: () => Record<string, string>;
setVariableValues: (values: Record<string, string>) => void;
getTemplateVariables: (templateName: string) => TemplateVariable[];
switchTemplate: (templateName: string) => void;
setReadOnly: (isReadOnly: boolean) => void;
exportAs: (format: 'html' | 'pdf' | 'word') => Promise<Blob>;
validate?: () => boolean;
getMetaObject?: (id?: string) => Record<string, any>;
setMetaObject?: (data: Record<string, any>, id?: string) => void;
setTableData?: (tableId: string, datalist: any[]) => void;
getRevision?: () => any[];
getFieldValueById: (id: string) => any;
getBindObject: (id?: string) => Record<string, any>;
setBindObject: (obj: any, id?: string) => void;
getFieldValue?: (field: HTMLElement) => any;
appendHtml?: (html: string, options?: {
pageBreak?: boolean;
}) => void;
getHtmlWithStyle?: () => string;
control?: {
insertField: (type: string, id?: string | null, attributes?: Record<string, any>) => void;
insertRadioGroup: (id: string, data: Record<string, string>, newline?: boolean) => void;
insertCheckboxGroup: (id: string, data: Record<string, string>, newline?: boolean) => void;
insertSignature: (data?: string | null, id?: string, attributes?: Record<string, any>) => void;
};
menstruation?: {
getBindData: (id: string) => any;
setBindData: (data: any, id: string) => void;
};
execCommand: (command: string, params?: any) => any;
calculate?: {
registerFunction: (name: string, fn: (...args: any[]) => any) => void;
runExpression: (expression: string, context?: Record<string, any>) => any;
};
}
declare const ClinicalTemplateEditor: React.ForwardRefExoticComponent<Omit<Record<string, any>, "ref"> & React.RefAttributes<ClinicalTemplateEditorRef>>;
export default ClinicalTemplateEditor;