@hailin-zheng/editor-core 2.1.4 → 2.1.6
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
CHANGED
@@ -2492,6 +2492,7 @@ class DataEleDateProps extends DataEleBaseTextProps {
|
|
2492
2492
|
minValue;
|
2493
2493
|
maxValue;
|
2494
2494
|
format;
|
2495
|
+
value;
|
2495
2496
|
clone(dest) {
|
2496
2497
|
const clone = dest ?? new DataEleDateProps();
|
2497
2498
|
super.clone(clone);
|
@@ -2504,7 +2505,8 @@ class DataEleDateProps extends DataEleBaseTextProps {
|
|
2504
2505
|
const props = {
|
2505
2506
|
minValue: this.minValue,
|
2506
2507
|
maxValue: this.maxValue,
|
2507
|
-
format: this.format
|
2508
|
+
format: this.format,
|
2509
|
+
value: this.value
|
2508
2510
|
};
|
2509
2511
|
this.getBaseProps(props, options);
|
2510
2512
|
return props;
|
@@ -8640,6 +8642,7 @@ class DataElementDate extends DataElementInlineGroup {
|
|
8640
8642
|
setValue(val) {
|
8641
8643
|
if (val === null) {
|
8642
8644
|
this.clearInnerItems();
|
8645
|
+
this.props.value = '';
|
8643
8646
|
return;
|
8644
8647
|
}
|
8645
8648
|
const format = this.props.format ?? 'YYYY-MM-DD';
|
@@ -8653,18 +8656,24 @@ class DataElementDate extends DataElementInlineGroup {
|
|
8653
8656
|
}
|
8654
8657
|
this.pubOnChange('self');
|
8655
8658
|
this.clearInnerItems();
|
8659
|
+
this.props.value = date.format('YYYY-MM-DD HH:mm:ss');
|
8656
8660
|
const valueText = new TextGroupElement();
|
8657
8661
|
this.props.valueTextProps.clone(valueText.props);
|
8658
8662
|
valueText.text = formatStr;
|
8659
8663
|
this.addChild(valueText, this.length - 1);
|
8660
8664
|
this.onChangedValidate();
|
8661
8665
|
}
|
8662
|
-
isValid(val) {
|
8663
|
-
|
8666
|
+
isValid(val, format) {
|
8667
|
+
if (!format) {
|
8668
|
+
format = this.props.format ?? 'YYYY-MM-DD';
|
8669
|
+
}
|
8664
8670
|
const date = moment__default["default"](val, format);
|
8665
8671
|
return date.isValid();
|
8666
8672
|
}
|
8667
8673
|
getValue() {
|
8674
|
+
if (this.props.value) {
|
8675
|
+
return this.props.value;
|
8676
|
+
}
|
8668
8677
|
return ElementSerialize.serializeString(this);
|
8669
8678
|
}
|
8670
8679
|
validate() {
|
@@ -8711,6 +8720,7 @@ class DataElementDateFactory extends DataElementBaseFactory {
|
|
8711
8720
|
dataEleProps.minValue = props.minValue;
|
8712
8721
|
dataEleProps.maxValue = props.maxValue;
|
8713
8722
|
dataEleProps.format = props.format;
|
8723
|
+
dataEleProps.value = props.value ?? '';
|
8714
8724
|
//dataEleProps.caption = props.caption;
|
8715
8725
|
//dataEleProps.type = props.type;
|
8716
8726
|
dataEleProps.nullText = props.nullText;
|
@@ -28107,10 +28117,15 @@ class DocEditor {
|
|
28107
28117
|
const index = docRender.getIndex();
|
28108
28118
|
const cursorPos = DocumentCursor.getElementCursorPos(ele, 0, region, index);
|
28109
28119
|
//this.selectionState.resetRange(element, 0);
|
28120
|
+
this.documentEvent.mousedownPos = cursorPos.rect;
|
28110
28121
|
this.scrollToPosition(cursorPos.rect);
|
28111
28122
|
}
|
28112
28123
|
}
|
28113
28124
|
scrollToPosition(pos) {
|
28125
|
+
const scale = this.viewOptions.scale;
|
28126
|
+
//处理缩放
|
28127
|
+
pos.x = pos.x * scale;
|
28128
|
+
pos.y = pos.y * scale;
|
28114
28129
|
if (pos.y - this.viewOptions.pageOffset.y > 0 && pos.y - this.viewOptions.pageOffset.y < this.viewOptions.viewSettings.height) {
|
28115
28130
|
return;
|
28116
28131
|
}
|
@@ -28587,10 +28602,10 @@ class DocEditor {
|
|
28587
28602
|
if (dataEle && dataEle instanceof DataElementDate && dataEle.props.editable) {
|
28588
28603
|
const position = editor.getDataElementPosition(dataEle.startDecorate);
|
28589
28604
|
let currVal = dataEle.getValue();
|
28590
|
-
if (!dataEle.isValid(currVal)) {
|
28605
|
+
if (!dataEle.isValid(currVal, 'YYYY-MM-DD HH:mm:ss')) {
|
28591
28606
|
currVal = '';
|
28592
28607
|
}
|
28593
|
-
return calendar.render(position, currVal
|
28608
|
+
return calendar.render(position, currVal);
|
28594
28609
|
}
|
28595
28610
|
calendar.reset();
|
28596
28611
|
return null;
|
@@ -28654,7 +28669,7 @@ class DocEditor {
|
|
28654
28669
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
28655
28670
|
}
|
28656
28671
|
version() {
|
28657
|
-
return "2.1.
|
28672
|
+
return "2.1.6";
|
28658
28673
|
}
|
28659
28674
|
}
|
28660
28675
|
|