@hailin-zheng/editor-core 1.1.6 → 1.1.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/index-cjs.js +49 -28
- package/index-cjs.js.map +1 -1
- package/index.js +49 -28
- package/index.js.map +1 -1
- package/med_editor/framework/element-serialize.d.ts +5 -0
- package/med_editor/texteditor.d.ts +12 -0
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -4201,15 +4201,10 @@ class TableUtil {
|
|
4201
4201
|
const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4202
4202
|
if (vMergeEndIndex > rowIndex) {
|
4203
4203
|
const nextRow = tb.getChild(rowIndex + 1);
|
4204
|
-
nextRow.getChild(i).props.vMerge = vMergeEndIndex - rowIndex >
|
4204
|
+
nextRow.getChild(i).props.vMerge = vMergeEndIndex - rowIndex > 1 ? 'restart' : null;
|
4205
4205
|
}
|
4206
4206
|
}
|
4207
4207
|
else if (cell.props.vMerge === 'continue') {
|
4208
|
-
// const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4209
|
-
// if (vMergeEndIndex > rowIndex) {
|
4210
|
-
// const nextRow = tb.getChild<TableRowElement>(rowIndex + 1);
|
4211
|
-
// nextRow.getChild<TableCellElement>(i).cellProps.vMerge = 'continue';
|
4212
|
-
// }
|
4213
4208
|
const vMergeStartIndex = this.getVMergeStartIndex(tb, rowIndex, i);
|
4214
4209
|
const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4215
4210
|
//当前单元格处于合并行的最后一行,并且合并的行数为2行
|
@@ -5196,6 +5191,11 @@ class TextGroupFactory extends ElementFactory {
|
|
5196
5191
|
}
|
5197
5192
|
|
5198
5193
|
class ElementSerialize {
|
5194
|
+
/**
|
5195
|
+
* 将当前文档对象构建并输出到标准的JSON对象
|
5196
|
+
* @param element
|
5197
|
+
* @param viewOptions
|
5198
|
+
*/
|
5199
5199
|
static serialize(element, viewOptions) {
|
5200
5200
|
if (element instanceof BranchElement) {
|
5201
5201
|
const result = element.serialize(viewOptions);
|
@@ -7996,7 +7996,7 @@ class DataElementDate extends DataElementInlineGroup {
|
|
7996
7996
|
return res;
|
7997
7997
|
}
|
7998
7998
|
const format = this.props.format ?? 'YYYY-MM-DD';
|
7999
|
-
const date = moment__default["default"](this.getValue(), format);
|
7999
|
+
const date = moment__default["default"](this.getValue(), format, true);
|
8000
8000
|
if (!date.isValid()) {
|
8001
8001
|
return '日期格式不正确';
|
8002
8002
|
}
|
@@ -13711,24 +13711,6 @@ class DocumentEvent {
|
|
13711
13711
|
this.editor.addEventListener('contextmenu', evt => {
|
13712
13712
|
this.contextMenu.next(evt.sourceEvt);
|
13713
13713
|
});
|
13714
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mousedown').subscribe((evt) => {
|
13715
|
-
// this.mousedown(evt);
|
13716
|
-
// }));
|
13717
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mouseup').subscribe((evt) => {
|
13718
|
-
// this.mouseup(evt);
|
13719
|
-
// }));
|
13720
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'click').subscribe((evt) => {
|
13721
|
-
// this.mouseClickHandle(evt);
|
13722
|
-
// }));
|
13723
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'contextmenu').subscribe((evt) => {
|
13724
|
-
// this.contextMenu.next(evt);
|
13725
|
-
// }));
|
13726
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mousemove').subscribe((evt) => {
|
13727
|
-
// this.mousemove(evt);
|
13728
|
-
// }));
|
13729
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'dblclick').subscribe((evt) => {
|
13730
|
-
// this.mouseDblClickHandle(evt);
|
13731
|
-
// }));
|
13732
13714
|
this.documentInput.onLeftEvent.subscribe(() => {
|
13733
13715
|
this.moveCursorToLeft();
|
13734
13716
|
});
|
@@ -14472,17 +14454,27 @@ class DocumentEvent {
|
|
14472
14454
|
const moveDistanceX = this.currentPos.x - mousedownPos.x;
|
14473
14455
|
const moveDistanceY = this.currentPos.y - mousedownPos.y;
|
14474
14456
|
const row = cellElement.parent;
|
14457
|
+
const minColWidth = 20;
|
14475
14458
|
const table = row?.parent;
|
14476
14459
|
if (!row || !table) {
|
14477
14460
|
throw new Error('row | table is null');
|
14478
14461
|
}
|
14479
14462
|
const cellIndex = row.getChildIndex(cellElement);
|
14480
14463
|
let cellWidth = table.getCellWidth(cellIndex);
|
14481
|
-
table.getColsCount();
|
14482
14464
|
if (['left', 'right'].includes(border)) {
|
14483
14465
|
if (cellIndex === 0 && border === 'left') {
|
14484
14466
|
return;
|
14485
14467
|
}
|
14468
|
+
//当前操作的是表格的最后一列
|
14469
|
+
if (cellIndex === table.getColsCount() - 1 && border === 'right') {
|
14470
|
+
cellWidth += moveDistanceX;
|
14471
|
+
if (cellWidth < minColWidth) {
|
14472
|
+
return;
|
14473
|
+
}
|
14474
|
+
table.setCellWidth(cellIndex, cellWidth);
|
14475
|
+
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
14476
|
+
return;
|
14477
|
+
}
|
14486
14478
|
let resizeColWidth = 0;
|
14487
14479
|
let resizeColIndex = 0;
|
14488
14480
|
if (border === 'left') {
|
@@ -14500,14 +14492,13 @@ class DocumentEvent {
|
|
14500
14492
|
}
|
14501
14493
|
cellWidth += moveDistanceX;
|
14502
14494
|
}
|
14503
|
-
if (resizeColWidth <
|
14495
|
+
if (resizeColWidth < minColWidth || cellWidth < minColWidth) {
|
14504
14496
|
return;
|
14505
14497
|
}
|
14506
14498
|
console.log(resizeColWidth, cellWidth);
|
14507
14499
|
table.setCellWidth(resizeColIndex, resizeColWidth);
|
14508
14500
|
table.setCellWidth(cellIndex, cellWidth);
|
14509
14501
|
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
14510
|
-
table.pubOnChange('self');
|
14511
14502
|
}
|
14512
14503
|
else if (['bottom', 'top'].includes(border)) {
|
14513
14504
|
let rowIndex = row.getIndex();
|
@@ -21171,6 +21162,36 @@ class CanvasTextEditor extends AbsolutePanel {
|
|
21171
21162
|
appCtx.root.setInputPosition(caretPos);
|
21172
21163
|
}
|
21173
21164
|
}
|
21165
|
+
generatorDoc(data) {
|
21166
|
+
//根据传入的参数,动态生成病情信息的结构化报告
|
21167
|
+
const para = new ParagraphElement();
|
21168
|
+
//创建患者姓名文本标签
|
21169
|
+
const patNameLabel = new TextGroupElement();
|
21170
|
+
patNameLabel.text = "患者姓名:";
|
21171
|
+
//添加到段落中
|
21172
|
+
para.addChild(patNameLabel);
|
21173
|
+
//创建患者姓名数据元
|
21174
|
+
const patNameDataEle = new DataElementText();
|
21175
|
+
patNameDataEle.props.valueTextProps = new TextProps();
|
21176
|
+
patNameDataEle.props.valueTextProps.fontName = '宋体';
|
21177
|
+
patNameDataEle.props.valueTextProps.fontSize = 16;
|
21178
|
+
//数据元赋值
|
21179
|
+
patNameDataEle.setValue(data.patName);
|
21180
|
+
//添加到段落中
|
21181
|
+
para.addChild(patNameDataEle);
|
21182
|
+
//添加到正文中
|
21183
|
+
this.docCtx.document.bodyElement.addChild(para);
|
21184
|
+
}
|
21185
|
+
/**
|
21186
|
+
* 设置关键字
|
21187
|
+
* 匹配用户输入的关键字,回调到应用业务中处理
|
21188
|
+
*/
|
21189
|
+
setKeywords(keys, cb) {
|
21190
|
+
}
|
21191
|
+
/**
|
21192
|
+
* 注册编辑器格式读取器
|
21193
|
+
*/
|
21194
|
+
registerReaderFactory(handler) { }
|
21174
21195
|
}
|
21175
21196
|
|
21176
21197
|
/**
|