@hailin-zheng/editor-core 2.2.9 → 2.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/index-cjs.js +63 -20
- package/index-cjs.js.map +1 -1
- package/index.js +63 -21
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +1 -1
- package/med_editor/framework/document-change.d.ts +1 -1
- package/med_editor/framework/impl/data-element/data-element-group-impl.d.ts +9 -3
- package/med_editor/framework/util/element-util.d.ts +7 -0
- package/package.json +2 -2
package/index.js
CHANGED
@@ -8672,7 +8672,7 @@ class BreakFactory extends ElementFactory {
|
|
8672
8672
|
}
|
8673
8673
|
}
|
8674
8674
|
|
8675
|
-
class DataElementGroupElement extends
|
8675
|
+
class DataElementGroupElement extends InlineGroupInputElement {
|
8676
8676
|
constructor() {
|
8677
8677
|
super('data-group');
|
8678
8678
|
this.props = new DataElementGroupProps();
|
@@ -8712,7 +8712,6 @@ class DataElementGroupElement extends DataElementInlineGroup {
|
|
8712
8712
|
});
|
8713
8713
|
}
|
8714
8714
|
}
|
8715
|
-
this.onChangedValidate();
|
8716
8715
|
}
|
8717
8716
|
getValue() {
|
8718
8717
|
return ElementSerialize.serializeString(this, { all: false });
|
@@ -8764,6 +8763,21 @@ class DataElementGroupFactory extends DataElementBaseFactory {
|
|
8764
8763
|
dataEleProps.dataType = props.dataType;
|
8765
8764
|
return dataEleProps;
|
8766
8765
|
}
|
8766
|
+
}
|
8767
|
+
/**
|
8768
|
+
* 是否在数据组内部
|
8769
|
+
* @param control
|
8770
|
+
* @param offset
|
8771
|
+
*/
|
8772
|
+
function IsInSideDataGroup(control, offset) {
|
8773
|
+
const mathEle = ElementUtil.getParent(control, (item) => item instanceof DataElementGroupElement);
|
8774
|
+
if (mathEle) {
|
8775
|
+
if ((control === mathEle.startDecorate && offset === 0) || (control === mathEle.endDecorate && offset === 1)) {
|
8776
|
+
return false;
|
8777
|
+
}
|
8778
|
+
return true;
|
8779
|
+
}
|
8780
|
+
return false;
|
8767
8781
|
}
|
8768
8782
|
|
8769
8783
|
class DataElementImage extends DataElementLeaf {
|
@@ -12496,6 +12510,14 @@ class ElementUtil {
|
|
12496
12510
|
static getDataElement(ele) {
|
12497
12511
|
return this.getParent(ele, item => item instanceof DataElementInlineGroup);
|
12498
12512
|
}
|
12513
|
+
/**
|
12514
|
+
* 向上查找类型为数据元的父级
|
12515
|
+
* @param ele
|
12516
|
+
* @returns
|
12517
|
+
*/
|
12518
|
+
static getDataGroupElement(ele) {
|
12519
|
+
return this.getParent(ele, item => item instanceof DataElementGroupElement);
|
12520
|
+
}
|
12499
12521
|
static getOSPlatform() {
|
12500
12522
|
const userAgent = navigator.userAgent;
|
12501
12523
|
if (userAgent.indexOf('Windows') > -1) {
|
@@ -12644,23 +12666,35 @@ class ElementUtil {
|
|
12644
12666
|
if (startControl.paintRenders.length === 0) {
|
12645
12667
|
return false;
|
12646
12668
|
}
|
12669
|
+
if (!ElementUtil.verifyHitable(startControl)) {
|
12670
|
+
return false;
|
12671
|
+
}
|
12647
12672
|
if (viewOptions.docMode === DocMode.Design) {
|
12648
12673
|
return true;
|
12649
12674
|
}
|
12650
|
-
|
12675
|
+
//表单模式下
|
12651
12676
|
if (viewOptions.docMode === DocMode.FormEdit) {
|
12652
|
-
|
12653
|
-
|
12677
|
+
//如果光标在数据元素中,判断是否可编辑
|
12678
|
+
if (IsInSideDataElement(startControl, startOffset)) {
|
12679
|
+
const dataEle = ElementUtil.getDataElement(startControl);
|
12680
|
+
//数据元不可编辑
|
12681
|
+
if (dataEle && !dataEle.props.editable) {
|
12682
|
+
return false;
|
12683
|
+
}
|
12684
|
+
return true;
|
12654
12685
|
}
|
12655
|
-
|
12656
|
-
|
12657
|
-
|
12658
|
-
|
12659
|
-
|
12660
|
-
|
12661
|
-
|
12662
|
-
|
12663
|
-
|
12686
|
+
else {
|
12687
|
+
//不在数据元中,需要判断是否在数据组中
|
12688
|
+
if (IsInSideDataGroup(startControl, startOffset)) {
|
12689
|
+
const dataGroup = ElementUtil.getDataGroupElement(startControl);
|
12690
|
+
//数据元不可编辑
|
12691
|
+
if (dataGroup && !dataGroup.props.editable) {
|
12692
|
+
return false;
|
12693
|
+
}
|
12694
|
+
}
|
12695
|
+
else {
|
12696
|
+
return false;
|
12697
|
+
}
|
12664
12698
|
}
|
12665
12699
|
}
|
12666
12700
|
return true;
|
@@ -17502,8 +17536,12 @@ class DocumentChange {
|
|
17502
17536
|
* @private
|
17503
17537
|
*/
|
17504
17538
|
canDeleteInlineGroup(dataEle) {
|
17539
|
+
//当前编辑模式为表单模式,单独的数据元不可删除
|
17540
|
+
//存在于数据组内的数据元可以删除
|
17505
17541
|
if (this.viewOptions.docMode === DocMode.FormEdit) {
|
17506
|
-
|
17542
|
+
if (dataEle.parent.type !== 'data-group') {
|
17543
|
+
return false;
|
17544
|
+
}
|
17507
17545
|
}
|
17508
17546
|
return dataEle.length === 2;
|
17509
17547
|
}
|
@@ -18433,9 +18471,13 @@ class DocumentChange {
|
|
18433
18471
|
}
|
18434
18472
|
getCursorElementByDeleteAction(control) {
|
18435
18473
|
if (this.viewOptions.docMode === DocMode.FormEdit) {
|
18436
|
-
|
18474
|
+
//是否属于数据元或者数据组区域
|
18475
|
+
const isInDataAre = (ele) => {
|
18476
|
+
return ele.parent instanceof DataElementInlineGroup || ele.parent instanceof DataElementGroupElement;
|
18477
|
+
};
|
18478
|
+
if (isInDataAre(control)) {
|
18437
18479
|
const prevLeafElementInPara = ElementUtil.getRecursionPrevSiblingElement(control, true, true, this.viewOptions);
|
18438
|
-
if (prevLeafElementInPara &&
|
18480
|
+
if (prevLeafElementInPara && isInDataAre(prevLeafElementInPara)) {
|
18439
18481
|
return {
|
18440
18482
|
ele: prevLeafElementInPara,
|
18441
18483
|
offset: ElementUtil.getElementEndOffset(prevLeafElementInPara)
|
@@ -18443,7 +18485,7 @@ class DocumentChange {
|
|
18443
18485
|
}
|
18444
18486
|
else {
|
18445
18487
|
return {
|
18446
|
-
ele: control.parent.startDecorate,
|
18488
|
+
ele: (control.parent).startDecorate,
|
18447
18489
|
offset: 1
|
18448
18490
|
};
|
18449
18491
|
}
|
@@ -20916,7 +20958,7 @@ class DocEditor {
|
|
20916
20958
|
this.onDblClickEvent.next(evt);
|
20917
20959
|
}
|
20918
20960
|
/**
|
20919
|
-
*
|
20961
|
+
* 获取当前光标所在的数据元或者数据组
|
20920
20962
|
* @returns
|
20921
20963
|
*/
|
20922
20964
|
getCurrentDataElement() {
|
@@ -21955,7 +21997,7 @@ class DocEditor {
|
|
21955
21997
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
21956
21998
|
}
|
21957
21999
|
version() {
|
21958
|
-
return "2.2.
|
22000
|
+
return "2.2.10";
|
21959
22001
|
}
|
21960
22002
|
switchPageHeaderEditor() {
|
21961
22003
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|
@@ -27674,5 +27716,5 @@ function removeDuplicatesEvent(events) {
|
|
27674
27716
|
return arr;
|
27675
27717
|
}
|
27676
27718
|
|
27677
|
-
export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag, MouseElementEvent, MousedownElementEvent, MultiBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PermanentTeethElement, PermanentTeethFactory, PermanentTeethProps, PermanentTeethRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, removeEle, removeText, renderErrorTip, renderUnderWavyLine, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
|
27719
|
+
export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, CopyElementEvent, DOMEventSource, DOMSubscription, DataContainerElement, DataContainerFactory, DataContainerProps, DataContainerRenderObject, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocEditor, DocInputSuggestions, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentInput, DocumentPaginator, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementReader, ElementSerialize, ElementUtil, EventBus, EventMap, EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, InputElementEvent, IsInSideDataElement, IsInSideDataGroup, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag, MouseElementEvent, MousedownElementEvent, MultiBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageBreakElement, PageBreakFactory, PageBreakRenderObject, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PasteElementEvent, PermanentTeethElement, PermanentTeethFactory, PermanentTeethProps, PermanentTeethRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RowMinHeight, RunElementFactory, SVGElement, SVGFactory, SVGProps, SVGRenderObject, SelectionOverlays, SelectionRange, SelectionState, Subject, SubjectSubscription, Subscription, TEXT_HEIGHT_FACTOR, TabElement, TabFactory, TabRenderObject, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TextUnitsHolder, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, addReturn, clearChildrenRenderCache, clearTraces, cloneChildren, cloneElementBase, defaultParaHanging, deleteCurrentParagraph, docOpsMap, elementTypeEventHandler, exportDecoratorHTML, falseChar, fontMapFunc, formatEle, fromEvent, generatePatch, getCalleeName, getFocusTextSegment, inputText, insertEle, invokeTypeHandler, isDate, logUpdateEleProps, objectToString$4 as objectToString, onTableContextmenu, onceTask, parser, reactiveMap, removeEle, removeText, renderErrorTip, renderUnderWavyLine, runTextLineRender, setChildrenModifyFlag, setNotifyChangedCallback, setTraceTrackingFlag, suppressTracking, targetMaps, textLineRenderMode, toRawType, toTypeString, trueChar, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
|
27678
27720
|
//# sourceMappingURL=index.js.map
|