Skip to content

Commit

Permalink
fix: update calc type label
Browse files Browse the repository at this point in the history
  • Loading branch information
devmiguelangel committed Jul 10, 2024
1 parent b3c48aa commit f4c40f6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/components/computed-properties.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ export default {
{
label: this.$t("Type"),
key: "type",
cb: (value) => {
switch (value) {
case 'expression':
return 'Formula';
case 'javascript':
return 'JavaScript';
default:
return value;
}
},
},
],
monacoOptions: {
Expand Down
10 changes: 7 additions & 3 deletions src/components/sortable/sortableList/SortableList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@keydown.esc.stop="onCancel(item)"
@focus="onFocus(item)"
/>
<span v-else>{{ getItemValue(item, field.key) }}</span>
<span v-else>{{ getItemValue(item, field.key, field.cb) }}</span>
</div>

<div class="sortable-list-td">
Expand Down Expand Up @@ -121,11 +121,15 @@ export default {
/** Get the value of a nested field in an object
* @param {Object} item - The object to get the value from
* @param {String} fieldKey - The key of the field to get the value from
* @param {Function} cb - Callback function to apply to the value
*
* @returns {String} The value of the field
*/
getItemValue(item, fieldKey) {
return fieldKey.split('.').reduce((obj, key) => obj[key] || '', item);
getItemValue(item, fieldKey, cb = null) {
return fieldKey.split('.').reduce((obj, key) => {
if (!obj[key]) return '';
return cb instanceof Function ? cb(obj[key]) : obj[key];
}, item);
},
validateState(name, item) {
const isEmpty = !name?.trim();
Expand Down

0 comments on commit f4c40f6

Please sign in to comment.