@hailin-zheng/editor-core 2.0.28 → 2.0.29
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 +65 -14
- package/index-cjs.js.map +1 -1
- package/index.js +65 -14
- package/index.js.map +1 -1
- package/med_editor/doc-editor.d.ts +1 -5
- package/med_editor/framework/common-util.d.ts +1 -0
- package/med_editor/framework/editor-calendar-vnode.d.ts +2 -2
- package/package.json +1 -1
package/index-cjs.js
CHANGED
@@ -673,6 +673,15 @@ class CommonUtil {
|
|
673
673
|
ele.removeChild(ele.firstChild);
|
674
674
|
}
|
675
675
|
}
|
676
|
+
static findParent(curr, predicate) {
|
677
|
+
if (!curr) {
|
678
|
+
return null;
|
679
|
+
}
|
680
|
+
if (predicate(curr)) {
|
681
|
+
return curr;
|
682
|
+
}
|
683
|
+
return this.findParent(curr.parentElement, predicate);
|
684
|
+
}
|
676
685
|
}
|
677
686
|
|
678
687
|
const docOpsMap = new Map();
|
@@ -8477,17 +8486,17 @@ class DataElementCheckRenderObject extends LeafRenderObject {
|
|
8477
8486
|
const style = props.style;
|
8478
8487
|
if (props.multiSelect) {
|
8479
8488
|
style === 'RadioButton' ? this.drawCircleCheckbox(t, width, height, props.checked)
|
8480
|
-
: this.drawRectCheckbox(t, width, height, props.size, props.checked);
|
8489
|
+
: this.drawRectCheckbox(t, width, height, props.size, props.checked, props.border);
|
8481
8490
|
}
|
8482
8491
|
else {
|
8483
|
-
style === 'CheckBox' ? this.drawRectCheckbox(t, width, height, props.size, props.checked)
|
8492
|
+
style === 'CheckBox' ? this.drawRectCheckbox(t, width, height, props.size, props.checked, props.border)
|
8484
8493
|
: this.drawCircleCheckbox(t, width, height, props.checked);
|
8485
8494
|
}
|
8486
8495
|
}
|
8487
8496
|
return t;
|
8488
8497
|
}
|
8489
|
-
drawRectCheckbox(t, width, height, size, checked) {
|
8490
|
-
t.children.push({
|
8498
|
+
drawRectCheckbox(t, width, height, size, checked, border) {
|
8499
|
+
border && t.children.push({
|
8491
8500
|
sel: 'rect',
|
8492
8501
|
data: {
|
8493
8502
|
ns: "http://www.w3.org/2000/svg",
|
@@ -20001,11 +20010,10 @@ function createPrintTemplate({ width, height, orient }) {
|
|
20001
20010
|
@page {
|
20002
20011
|
size: ${orient};
|
20003
20012
|
margin: 0;
|
20004
|
-
padding: 0;
|
20005
20013
|
}
|
20006
20014
|
div {
|
20007
20015
|
width: ${width}mm;
|
20008
|
-
height: ${height}mm;
|
20016
|
+
min-height: ${height}mm;
|
20009
20017
|
font-size: 0;
|
20010
20018
|
}
|
20011
20019
|
@media print {
|
@@ -20013,7 +20021,6 @@ function createPrintTemplate({ width, height, orient }) {
|
|
20013
20021
|
body {
|
20014
20022
|
width: ${width}mm;
|
20015
20023
|
height: ${height}mm;
|
20016
|
-
margin: 0;
|
20017
20024
|
}
|
20018
20025
|
div {
|
20019
20026
|
width: initial;
|
@@ -26164,14 +26171,36 @@ class EditorCalendarVNode {
|
|
26164
26171
|
style: {
|
26165
26172
|
position: 'absolute',
|
26166
26173
|
left: (position.x - 10) + 'px',
|
26167
|
-
top: position.y + 'px',
|
26174
|
+
top: position.y + 5 + position.height + 'px',
|
26168
26175
|
'min-width': '100px',
|
26169
26176
|
'background-color': 'white',
|
26170
26177
|
'z-index': '1000',
|
26171
26178
|
'border-radius': '5px',
|
26172
26179
|
'box-shadow': '0 0 5px 0 rgba(0,0,0,0.2)',
|
26173
26180
|
'user-select': 'none',
|
26174
|
-
}
|
26181
|
+
},
|
26182
|
+
hook: {
|
26183
|
+
insert: (vnode) => {
|
26184
|
+
const elm = vnode.elm;
|
26185
|
+
const parent = CommonUtil.findParent(elm, (item) => item.className === 'scroll-container');
|
26186
|
+
if (parent) {
|
26187
|
+
const parentRect = parent.getBoundingClientRect();
|
26188
|
+
const elmRect = elm.getBoundingClientRect();
|
26189
|
+
if (elmRect.top < parentRect.top) {
|
26190
|
+
elm.style.top = (position.y - elmRect.height) + 'px';
|
26191
|
+
}
|
26192
|
+
if (elmRect.left < parentRect.left) {
|
26193
|
+
elm.style.left = (position.x - 10) + 'px';
|
26194
|
+
}
|
26195
|
+
if (elmRect.right > parentRect.right) {
|
26196
|
+
elm.style.left = (position.x - elmRect.width + 10) + 'px';
|
26197
|
+
}
|
26198
|
+
if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
|
26199
|
+
elm.style.top = (position.y - position.height - elmRect.height) + 'px';
|
26200
|
+
}
|
26201
|
+
}
|
26202
|
+
}
|
26203
|
+
},
|
26175
26204
|
},
|
26176
26205
|
children: []
|
26177
26206
|
};
|
@@ -27344,14 +27373,14 @@ class DocEditor {
|
|
27344
27373
|
const startDecorateRender = element.paintRenders[0];
|
27345
27374
|
if (!startDecorateRender) {
|
27346
27375
|
console.error('未找到数据元开始渲染元素');
|
27347
|
-
return;
|
27376
|
+
return null;
|
27348
27377
|
}
|
27349
27378
|
const { x, height, y, width } = startDecorateRender.rect;
|
27350
27379
|
const pos = ElementUtil.getRenderAbsolutePaintPos(startDecorateRender);
|
27351
27380
|
return {
|
27352
27381
|
x: pos.x + width,
|
27353
|
-
y: pos.y
|
27354
|
-
|
27382
|
+
y: pos.y,
|
27383
|
+
height
|
27355
27384
|
};
|
27356
27385
|
}
|
27357
27386
|
/**
|
@@ -28113,14 +28142,36 @@ class DocEditor {
|
|
28113
28142
|
style: {
|
28114
28143
|
position: 'absolute',
|
28115
28144
|
left: (position.x - 10) + 'px',
|
28116
|
-
top: position.y + 'px',
|
28145
|
+
top: position.y + 5 + position.height + 'px',
|
28117
28146
|
'min-width': '100px',
|
28118
28147
|
'background-color': 'white',
|
28119
28148
|
'z-index': '1000',
|
28120
28149
|
'border-radius': '5px',
|
28121
28150
|
'box-shadow': '0 0 5px 0 rgba(0,0,0,0.2)',
|
28122
28151
|
'user-select': 'none',
|
28123
|
-
}
|
28152
|
+
},
|
28153
|
+
hook: {
|
28154
|
+
insert: (vnode) => {
|
28155
|
+
const elm = vnode.elm;
|
28156
|
+
const parent = CommonUtil.findParent(elm, (item) => item.className === 'scroll-container');
|
28157
|
+
if (parent) {
|
28158
|
+
const parentRect = parent.getBoundingClientRect();
|
28159
|
+
const elmRect = elm.getBoundingClientRect();
|
28160
|
+
if (elmRect.top < parentRect.top) {
|
28161
|
+
elm.style.top = (position.y - elmRect.height) + 'px';
|
28162
|
+
}
|
28163
|
+
if (elmRect.left < parentRect.left) {
|
28164
|
+
elm.style.left = (position.x - 10) + 'px';
|
28165
|
+
}
|
28166
|
+
if (elmRect.right > parentRect.right) {
|
28167
|
+
elm.style.left = (position.x - elmRect.width + 10) + 'px';
|
28168
|
+
}
|
28169
|
+
if (elmRect.top + elmRect.height > parentRect.top + parentRect.height) {
|
28170
|
+
elm.style.top = (position.y - position.height - elmRect.height) + 'px';
|
28171
|
+
}
|
28172
|
+
}
|
28173
|
+
}
|
28174
|
+
},
|
28124
28175
|
},
|
28125
28176
|
children: [
|
28126
28177
|
{
|