@hailin-zheng/editor-core 2.2.29 → 2.2.30
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
@@ -4258,12 +4258,15 @@ class DataElementInlineGroup extends InlineGroupInputElement {
|
|
4258
4258
|
const depEleMap = new Map();
|
4259
4259
|
let compliedCode = parser(this.props.expression, depIdItems);
|
4260
4260
|
compliedCode = addReturn(compliedCode);
|
4261
|
+
const executeCtx = execute.setExecuteCtx(this);
|
4261
4262
|
this.parserExpress = {
|
4262
4263
|
compliedCode,
|
4263
4264
|
func: new Function(`with(this){ ${compliedCode} }`),
|
4264
|
-
depItems: depEleMap
|
4265
|
+
depItems: depEleMap,
|
4266
|
+
executeCtx
|
4265
4267
|
};
|
4266
4268
|
if (depIdItems.length) {
|
4269
|
+
//设置执行上下文,doc或者doc-part
|
4267
4270
|
depIdItems.forEach(dep => {
|
4268
4271
|
const refCtx = execute.getObject(dep);
|
4269
4272
|
if (refCtx.ref) {
|
@@ -4287,6 +4290,8 @@ class DataElementInlineGroup extends InlineGroupInputElement {
|
|
4287
4290
|
return;
|
4288
4291
|
}
|
4289
4292
|
const tempExecuter = execute.create();
|
4293
|
+
//设置执行上下文,doc或者doc-part
|
4294
|
+
tempExecuter.setExecuteCtx(this.parserExpress.executeCtx);
|
4290
4295
|
tempExecuter.setCurrentCtx(this, this.parserExpress.depItems);
|
4291
4296
|
const fn = func.bind(tempExecuter);
|
4292
4297
|
fn();
|
@@ -14177,6 +14182,15 @@ class DynamicExecute {
|
|
14177
14182
|
create() {
|
14178
14183
|
return new DynamicExecute(this.doc, this.ss);
|
14179
14184
|
}
|
14185
|
+
/**
|
14186
|
+
* 设置当前执行上下文
|
14187
|
+
* 一般情况下为document,但是如果为病程录文档,需要设置为当前病程录part
|
14188
|
+
*/
|
14189
|
+
setExecuteCtx(parseEle) {
|
14190
|
+
const parentCtx = ElementUtil.getParent(parseEle, (item) => item.type === 'doc' || item.type === 'body-part');
|
14191
|
+
this.doc = parentCtx;
|
14192
|
+
return this.doc;
|
14193
|
+
}
|
14180
14194
|
setCurrentCtx(ele, depItems) {
|
14181
14195
|
this.current = ele;
|
14182
14196
|
this.depItems = depItems;
|
@@ -14870,6 +14884,8 @@ class ParagraphMeasure {
|
|
14870
14884
|
const depEleMap = new Map();
|
14871
14885
|
let compliedCode = parser(ele.attribute?.visibleExpr, depIdItems);
|
14872
14886
|
compliedCode = addReturn(compliedCode);
|
14887
|
+
//设置执行上下文,doc或者doc-part
|
14888
|
+
const executeCtx = execute.setExecuteCtx(ele);
|
14873
14889
|
if (depIdItems.length) {
|
14874
14890
|
depIdItems.forEach(dep => {
|
14875
14891
|
const refCtx = execute.getObject(dep);
|
@@ -14891,7 +14907,7 @@ class ParagraphMeasure {
|
|
14891
14907
|
}
|
14892
14908
|
});
|
14893
14909
|
}
|
14894
|
-
ele.visibleExpr = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap };
|
14910
|
+
ele.visibleExpr = { compliedCode, func: new Function(`with(this){ ${compliedCode} }`), depItems: depEleMap, executeCtx };
|
14895
14911
|
}
|
14896
14912
|
catch (e) {
|
14897
14913
|
console.error('解析表达式出错', ele.attribute?.visibleExpr);
|
@@ -14962,6 +14978,8 @@ class ParagraphMeasure {
|
|
14962
14978
|
evalVisibleExpr(ele, executeCtx) {
|
14963
14979
|
if (ele.visibleExpr && ele.visibleExpr.func) {
|
14964
14980
|
try {
|
14981
|
+
//设置执行上下文,doc或者doc-part
|
14982
|
+
executeCtx.setExecuteCtx(ele.visibleExpr.executeCtx);
|
14965
14983
|
executeCtx.setCurrentCtx(ele, ele.visibleExpr.depItems);
|
14966
14984
|
const func = ele.visibleExpr.func.bind(executeCtx);
|
14967
14985
|
return func() === true;
|
@@ -23170,7 +23188,7 @@ class DocEditor {
|
|
23170
23188
|
rule.setRuleOptions({ width: this.viewOptions.docPageSettings.width, pagePL, pagePR, docLeft });
|
23171
23189
|
}
|
23172
23190
|
version() {
|
23173
|
-
return "2.2.
|
23191
|
+
return "2.2.30";
|
23174
23192
|
}
|
23175
23193
|
switchPageHeaderEditor() {
|
23176
23194
|
this.docCtx.document.switchPageHeaderEditor(this.selectionState, null);
|