ht-emr 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas-editor.js +3036 -3056
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-editor.umd.cjs +50 -50
- package/dist/canvas-editor.umd.cjs.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +1 -3
- package/dist/src/editor/core/command/CommandAdapt.d.ts +9 -9
- package/dist/src/editor/core/draw/Draw.d.ts +3 -1
- package/dist/src/editor/dataset/constant/Element.d.ts +0 -1
- package/dist/src/editor/index.d.ts +2 -2
- package/dist/src/editor/interface/Element.d.ts +16 -40
- package/dist/src/editor/utils/templateCondition.d.ts +12 -0
- package/package.json +1 -1
- package/dist/src/editor/utils/logicTemplate.d.ts +0 -14
|
@@ -159,10 +159,8 @@ export declare class Command {
|
|
|
159
159
|
setMacroValueList: CommandAdapt['setMacroValueList'];
|
|
160
160
|
updateMacroProperties: CommandAdapt['updateMacroProperties'];
|
|
161
161
|
locationMacro: CommandAdapt['locationMacro'];
|
|
162
|
-
insertLogicTemplate: CommandAdapt['insertLogicTemplate'];
|
|
163
|
-
updateLogicTemplate: CommandAdapt['updateLogicTemplate'];
|
|
164
|
-
getLogicTemplateList: CommandAdapt['getLogicTemplateList'];
|
|
165
162
|
insertSubTemplate: CommandAdapt['insertSubTemplate'];
|
|
163
|
+
updateSubTemplate: CommandAdapt['updateSubTemplate'];
|
|
166
164
|
expandSubTemplate: CommandAdapt['expandSubTemplate'];
|
|
167
165
|
collapseSubTemplate: CommandAdapt['collapseSubTemplate'];
|
|
168
166
|
toggleSubTemplate: CommandAdapt['toggleSubTemplate'];
|
|
@@ -13,7 +13,7 @@ import { DeepRequired } from '../../interface/Common';
|
|
|
13
13
|
import { IGetControlValueOption, IGetControlValueResult, ILocationControlOption, IRemoveControlOption, ISetControlExtensionOption, ISetControlHighlightOption, ISetControlProperties, ISetControlValueOption } from '../../interface/Control';
|
|
14
14
|
import { IAppendElementListOption, IDrawImagePayload, IForceUpdateOption, IGetImageOption, IGetValueOption, IPainterOption } from '../../interface/Draw';
|
|
15
15
|
import { IEditorData, IEditorHTML, IEditorOption, IFormModeTraceOption, IEditorResult, IEditorText, IFocusOption, ISetValueOption, IUpdateOption } from '../../interface/Editor';
|
|
16
|
-
import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption,
|
|
16
|
+
import { IDeleteElementByIdOption, IElement, IElementPosition, IGetElementByIdOption, IGetMacroValueOption, IImageCaption, IImageCrop, IInsertElementListOption, IMacroValueResult, ISetMacroValueOption, IUpdateElementByIdOption, IUpdateMacroPropertiesOption, IUpdateSubTemplateOption } from '../../interface/Element';
|
|
17
17
|
import { ICopyOption, IPasteOption, IPositionContextByEventOption, IPositionContextByEventResult } from '../../interface/Event';
|
|
18
18
|
import { IMargin } from '../../interface/Margin';
|
|
19
19
|
import { IRange, RangeContext } from '../../interface/Range';
|
|
@@ -250,13 +250,6 @@ export declare class CommandAdapt {
|
|
|
250
250
|
* Location macro element
|
|
251
251
|
*/
|
|
252
252
|
locationMacro(payload: IGetMacroValueOption): void;
|
|
253
|
-
/**
|
|
254
|
-
* 插入逻辑模板内容
|
|
255
|
-
* Insert logic template content
|
|
256
|
-
*/
|
|
257
|
-
insertLogicTemplate(payload: IInsertLogicTemplateOption): void;
|
|
258
|
-
updateLogicTemplate(payload: IUpdateLogicTemplateOption): void;
|
|
259
|
-
getLogicTemplateList(): ILogicTemplateConfig[];
|
|
260
253
|
/**
|
|
261
254
|
* 插入子模板元素
|
|
262
255
|
* Insert sub template element
|
|
@@ -266,9 +259,16 @@ export declare class CommandAdapt {
|
|
|
266
259
|
label: string;
|
|
267
260
|
/** 子模板ID(引用的模板ID) */
|
|
268
261
|
templateId: string;
|
|
262
|
+
/** 子模板内容 */
|
|
263
|
+
content?: IElement[];
|
|
264
|
+
/** 匹配条件 */
|
|
265
|
+
conditions?: IElement['subTemplateConditions'];
|
|
266
|
+
/** 条件关系 */
|
|
267
|
+
relation?: IElement['subTemplateRelation'];
|
|
269
268
|
/** 是否提交历史 */
|
|
270
269
|
isSubmitHistory?: boolean;
|
|
271
270
|
}): void;
|
|
271
|
+
updateSubTemplate(payload: IUpdateSubTemplateOption): void;
|
|
272
272
|
/**
|
|
273
273
|
* 展开子模板
|
|
274
274
|
* Expand sub template
|
|
@@ -278,7 +278,7 @@ export declare class CommandAdapt {
|
|
|
278
278
|
/** 子模板元素ID */
|
|
279
279
|
id?: string;
|
|
280
280
|
/** 子模板内容 */
|
|
281
|
-
content
|
|
281
|
+
content?: IElement[];
|
|
282
282
|
/** 是否提交历史 */
|
|
283
283
|
isSubmitHistory?: boolean;
|
|
284
284
|
}): void;
|
|
@@ -291,7 +291,9 @@ export declare class Draw {
|
|
|
291
291
|
* @private
|
|
292
292
|
*/
|
|
293
293
|
private hideTextFieldWhitespace;
|
|
294
|
-
private
|
|
294
|
+
private getSubTemplateRuntimeEndIndex;
|
|
295
|
+
private syncSubTemplateExpandedState;
|
|
296
|
+
private applySubTemplateRuntimeState;
|
|
295
297
|
/**
|
|
296
298
|
* 更新TextField占位符和前后缀的可见性
|
|
297
299
|
*
|
|
@@ -13,7 +13,6 @@ export declare const LIST_CONTEXT_ATTR: Array<keyof IElement>;
|
|
|
13
13
|
export declare const CONTROL_CONTEXT_ATTR: Array<keyof IElement>;
|
|
14
14
|
export declare const CONTROL_STYLE_ATTR: Array<keyof IControlStyle>;
|
|
15
15
|
export declare const AREA_CONTEXT_ATTR: Array<keyof IElement>;
|
|
16
|
-
export declare const LOGIC_TEMPLATE_CONTEXT_ATTR: Array<keyof IElement>;
|
|
17
16
|
export declare const EDITOR_ELEMENT_CONTEXT_ATTR: Array<keyof IElement>;
|
|
18
17
|
export declare const TEXTLIKE_ELEMENT_TYPE: ElementType[];
|
|
19
18
|
export declare const IMAGE_ELEMENT_TYPE: ElementType[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './assets/css/index.css';
|
|
2
2
|
import { IEditorData, IEditorOption, IEditorResult, IFormModeTraceOption } from './interface/Editor';
|
|
3
|
-
import { IElement,
|
|
3
|
+
import { IElement, IMacroConfig, IMacroElement, IGetMacroValueOption, ITemplateCondition, ITemplateConditionRelation, ITemplateConditionSource, IMacroValueResult, ISetMacroValueOption, IUpdateMacroPropertiesOption, ISubTemplateElement, IUpdateSubTemplateOption } from './interface/Element';
|
|
4
4
|
import { Command } from './core/command/Command';
|
|
5
5
|
import { Listener } from './core/listener/Listener';
|
|
6
6
|
import { RowFlex } from './dataset/enum/Row';
|
|
@@ -118,4 +118,4 @@ export default class Editor {
|
|
|
118
118
|
export { splitText, createDomFromElementList, getElementListByHTML, getTextFromElementList };
|
|
119
119
|
export { EDITOR_COMPONENT, LETTER_CLASS, INTERNAL_CONTEXT_MENU_KEY, INTERNAL_SHORTCUT_KEY, EDITOR_CLIPBOARD };
|
|
120
120
|
export { Editor, RowFlex, VerticalAlign, EditorZone, EditorMode, ElementType, ControlType, EditorComponent, PageMode, RenderMode, ImageDisplay, Command, KeyMap, BlockType, PaperDirection, TableBorder, TdBorder, TdSlash, MaxHeightRatio, NumberType, TitleLevel, ListType, ListStyle, WordBreak, ControlIndentation, ControlComponent, BackgroundRepeat, BackgroundSize, TextDecorationStyle, LineNumberType, LocationPosition, AreaMode, ControlState, FlexDirection, WatermarkType };
|
|
121
|
-
export type { IElement, IEditorData, IEditorOption, IEditorResult, IFormModeTraceOption, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, IBadge, IGetElementListByHTMLOption, IMacroConfig, IMacroElement, IGetMacroValueOption, IMacroValueResult, ISetMacroValueOption, IUpdateMacroPropertiesOption,
|
|
121
|
+
export type { IElement, IEditorData, IEditorOption, IEditorResult, IFormModeTraceOption, IContextMenuContext, IRegisterContextMenu, IWatermark, INavigateInfo, IBlock, ILang, ICatalog, ICatalogItem, IRange, IRangeStyle, IBadge, IGetElementListByHTMLOption, IMacroConfig, IMacroElement, IGetMacroValueOption, IMacroValueResult, ISetMacroValueOption, IUpdateMacroPropertiesOption, ITemplateCondition, ITemplateConditionRelation, ITemplateConditionSource, ISubTemplateElement, IUpdateSubTemplateOption };
|
|
@@ -256,33 +256,15 @@ export interface IReusableItemElement {
|
|
|
256
256
|
/** 复用项目配置 */
|
|
257
257
|
reusableItemConfig?: IReusableItemConfig;
|
|
258
258
|
}
|
|
259
|
-
export type
|
|
260
|
-
export type
|
|
261
|
-
export interface
|
|
259
|
+
export type ITemplateConditionSource = 'all' | 'control' | 'macro';
|
|
260
|
+
export type ITemplateConditionRelation = 'and' | 'or';
|
|
261
|
+
export interface ITemplateCondition {
|
|
262
262
|
/** 匹配字段标签 */
|
|
263
263
|
label: string;
|
|
264
264
|
/** 正则表达式 */
|
|
265
265
|
regex: string;
|
|
266
266
|
/** 字段来源,默认 all */
|
|
267
|
-
source?:
|
|
268
|
-
}
|
|
269
|
-
export interface ILogicTemplateConfig {
|
|
270
|
-
/** 逻辑模板组 ID */
|
|
271
|
-
id?: string;
|
|
272
|
-
/** 逻辑模板名称 */
|
|
273
|
-
label?: string;
|
|
274
|
-
/** 逻辑模板引用模板 ID */
|
|
275
|
-
templateId?: string;
|
|
276
|
-
/** 条件关系,默认 and */
|
|
277
|
-
relation?: ILogicTemplateRelation;
|
|
278
|
-
/** 显示条件列表 */
|
|
279
|
-
conditions?: ILogicTemplateCondition[];
|
|
280
|
-
}
|
|
281
|
-
export interface ILogicTemplateElement {
|
|
282
|
-
/** 逻辑模板配置 */
|
|
283
|
-
logicTemplate?: ILogicTemplateConfig;
|
|
284
|
-
/** 运行时隐藏状态,不参与导出 */
|
|
285
|
-
logicTemplateHidden?: boolean;
|
|
267
|
+
source?: ITemplateConditionSource;
|
|
286
268
|
}
|
|
287
269
|
/**
|
|
288
270
|
* 子模板元素属性接口
|
|
@@ -293,10 +275,18 @@ export interface ISubTemplateElement {
|
|
|
293
275
|
label?: string;
|
|
294
276
|
/** 子模板ID(引用的模板ID) */
|
|
295
277
|
templateId?: string;
|
|
278
|
+
/** 子模板内容快照,用于表单/打印模式自动展开 */
|
|
279
|
+
subTemplateContent?: IElement[];
|
|
280
|
+
/** 子模板条件关系,默认 and */
|
|
281
|
+
subTemplateRelation?: ITemplateConditionRelation;
|
|
282
|
+
/** 子模板匹配条件 */
|
|
283
|
+
subTemplateConditions?: ITemplateCondition[];
|
|
296
284
|
/** 子模板是否展开(表单模式下使用) */
|
|
297
285
|
subTemplateExpanded?: boolean;
|
|
286
|
+
/** 子模板运行时父节点ID,不参与导出 */
|
|
287
|
+
subTemplateParentId?: string;
|
|
298
288
|
}
|
|
299
|
-
export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement & IMenstrualHistoryElement & IFetalHeartPositionElement & IToothPositionElement & IMacroElement & IReusableItemElement &
|
|
289
|
+
export type IElement = IElementBasic & IElementStyle & IElementRule & IElementGroup & ITable & IHyperlinkElement & ISuperscriptSubscript & ISeparator & IControlElement & ICheckboxElement & IRadioElement & ILaTexElement & IDateElement & IImageElement & IBlockElement & ITitleElement & IListElement & IAreaElement & ILabelElement & IMenstrualHistoryElement & IFetalHeartPositionElement & IToothPositionElement & IMacroElement & IReusableItemElement & ISubTemplateElement;
|
|
300
290
|
export interface IElementMetrics {
|
|
301
291
|
width: number;
|
|
302
292
|
height: number;
|
|
@@ -428,25 +418,11 @@ export interface IUpdateMacroPropertiesOption {
|
|
|
428
418
|
/** 是否提交历史 */
|
|
429
419
|
isSubmitHistory?: boolean;
|
|
430
420
|
}
|
|
431
|
-
export interface
|
|
432
|
-
/**
|
|
433
|
-
label: string;
|
|
434
|
-
/** 引用模板 ID */
|
|
435
|
-
templateId?: string;
|
|
436
|
-
/** 逻辑模板内容 */
|
|
437
|
-
content: IElement[];
|
|
438
|
-
/** 显示条件 */
|
|
439
|
-
conditions: ILogicTemplateCondition[];
|
|
440
|
-
/** 条件关系,默认 and */
|
|
441
|
-
relation?: ILogicTemplateRelation;
|
|
442
|
-
/** 是否提交历史 */
|
|
443
|
-
isSubmitHistory?: boolean;
|
|
444
|
-
}
|
|
445
|
-
export interface IUpdateLogicTemplateOption {
|
|
446
|
-
/** 逻辑模板 ID */
|
|
421
|
+
export interface IUpdateSubTemplateOption {
|
|
422
|
+
/** 子模板元素 ID */
|
|
447
423
|
id: string;
|
|
448
424
|
/** 要更新的属性 */
|
|
449
|
-
properties: Partial<Omit<
|
|
425
|
+
properties: Partial<Omit<ISubTemplateElement, 'subTemplateParentId'>>;
|
|
450
426
|
/** 是否提交历史 */
|
|
451
427
|
isSubmitHistory?: boolean;
|
|
452
428
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IElement, ITemplateCondition, ITemplateConditionRelation, ITemplateConditionSource } from '../interface/Element';
|
|
2
|
+
type ITemplateFieldSource = Exclude<ITemplateConditionSource, 'all'>;
|
|
3
|
+
export interface ITemplateFieldValue {
|
|
4
|
+
label: string;
|
|
5
|
+
source: ITemplateFieldSource;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
export type ITemplateFieldMap = Map<string, ITemplateFieldValue[]>;
|
|
9
|
+
export declare function walkNestedElements(elementList: IElement[], visitor: (element: IElement) => void): void;
|
|
10
|
+
export declare function collectTemplateFieldMap(elementList: IElement[]): ITemplateFieldMap;
|
|
11
|
+
export declare function getTemplateConditionVisible(conditions: ITemplateCondition[] | undefined, fieldMap: ITemplateFieldMap, relation?: ITemplateConditionRelation): boolean;
|
|
12
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IElement, ILogicTemplateConditionSource, ILogicTemplateConfig } from '../interface/Element';
|
|
2
|
-
type ILogicTemplateFieldSource = Exclude<ILogicTemplateConditionSource, 'all'>;
|
|
3
|
-
export interface ILogicTemplateFieldValue {
|
|
4
|
-
label: string;
|
|
5
|
-
source: ILogicTemplateFieldSource;
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
export type ILogicTemplateFieldMap = Map<string, ILogicTemplateFieldValue[]>;
|
|
9
|
-
export declare function walkLogicTemplateElements(elementList: IElement[], visitor: (element: IElement) => void): void;
|
|
10
|
-
export declare function bindLogicTemplate(elementList: IElement[], logicTemplate: ILogicTemplateConfig): void;
|
|
11
|
-
export declare function collectLogicTemplateList(elementList: IElement[]): ILogicTemplateConfig[];
|
|
12
|
-
export declare function collectLogicTemplateFieldMap(elementList: IElement[]): ILogicTemplateFieldMap;
|
|
13
|
-
export declare function getLogicTemplateVisible(logicTemplate: ILogicTemplateConfig | undefined, fieldMap: ILogicTemplateFieldMap): boolean;
|
|
14
|
-
export {};
|