|
|
@ -14643,20 +14643,21 @@ BI.FormulaEditor = BI.inherit(BI.Single, { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 添加字段 |
|
|
|
* 添加字段 |
|
|
|
* @param field |
|
|
|
* @param fieldName |
|
|
|
|
|
|
|
* @param fieldId |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
insertField: function (field) { |
|
|
|
insertField: function (fieldName, fieldId) { |
|
|
|
var value = this.options.fieldTextValueMap[field]; |
|
|
|
var value = this.options.fieldTextValueMap[fieldName] || fieldId; |
|
|
|
var fieldId = this.options.paramFormatter(field); |
|
|
|
var fieldFormattedName = this.options.paramFormatter(fieldName); |
|
|
|
var from = this.editor.getCursor(); |
|
|
|
var from = this.editor.getCursor(); |
|
|
|
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
|
|
|
|
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
|
|
|
|
var showName = fieldId.replaceAll(/^<!.*!>$/, function (str) { |
|
|
|
var showName = BI.isNull(fieldFormattedName) ? "undefined" : fieldFormattedName.replaceAll(/^<!.*!>$/, function (str) { |
|
|
|
return str.substring(2, str.length - 2); |
|
|
|
return str.substring(2, str.length - 2); |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.editor.replaceSelection("\u200b" + showName + "\u200b"); |
|
|
|
this.editor.replaceSelection("\u200b" + showName + "\u200b"); |
|
|
|
var to = this.editor.getCursor(); |
|
|
|
var to = this.editor.getCursor(); |
|
|
|
var className = "fieldName"; |
|
|
|
var className = "fieldName"; |
|
|
|
if (BI.isNotNull(fieldId.match(/^<!.*!>$/))) { |
|
|
|
if (BI.isNotNull(fieldFormattedName.match(/^<!.*!>$/))) { |
|
|
|
className = "error-field"; |
|
|
|
className = "error-field"; |
|
|
|
} |
|
|
|
} |
|
|
|
this.editor.markText(from, to, {className: className, atomic: true, startStyle: "start", endStyle: "end", value: value}); |
|
|
|
this.editor.markText(from, to, {className: className, atomic: true, startStyle: "start", endStyle: "end", value: value}); |
|
|
|