add custom field "stringtemplate"

This commit is contained in:
tod31 2021-04-07 16:11:19 +02:00
parent 769bb7a55d
commit b8dc7ff18e
8 changed files with 104 additions and 2 deletions

View file

@ -21,6 +21,23 @@ BlazeComponent.extendComponent({
}).format(customFieldTrueValue);
},
formattedStringtemplateCustomFieldValue(definition) {
const customField = this.data()
.customFieldsWD()
.find(f => f._id === definition._id);
if(customField && customField.trueValue) {
lines = customField.trueValue.replace(/\r\n|\n\r|\n|\r/g, '\n').split('\n');
lines = lines.map(line =>
definition.settings.stringtemplateFormat.replace(/%\{value\}/gi, line)
);
return lines.join(' ');
} else {
return '';
}
},
events() {
return [
{