@@ -77,15 +77,31 @@ const props = defineProps({
7777 result: {type: Object , required: true }
7878});
7979
80- function componentToColumnName (component ) {
80+ function componentToColumnName (component , schema ) {
81+ let result;
8182 if (component[0 ] !== " (" ) {
8283 // Not a pair
83- return explorer .shortenEntity (component);
84+ result = explorer .shortenEntity (component);
8485 } else {
8586 let pair = component .slice (1 , - 1 ).split (" ," );
86- return " (" + explorer .shortenEntity (pair[0 ]) + " , " +
87+ result = " (" + explorer .shortenEntity (pair[0 ]) + " , " +
8788 explorer .shortenEntity (pair[1 ]) + " )" ;
8889 }
90+
91+ // If value is an object with a single member, add the unit symbol to the
92+ // column name if the schema has one.
93+ const keys = Object .keys (schema);
94+ if (keys .length == 1 ) {
95+ const first = schema[keys[0 ]];
96+ if (first .length > 1 ) {
97+ const symbol = first[1 ].symbol ;
98+ if (symbol) {
99+ result += ` (${ symbol} )` ;
100+ }
101+ }
102+ }
103+
104+ return result;
89105}
90106
91107const tableHeaders = computed (() => {
@@ -136,7 +152,7 @@ const tableHeaders = computed(() => {
136152 const field = fields[i];
137153 if (field .schema ) {
138154 columns .push ({
139- name: componentToColumnName (field .id ),
155+ name: componentToColumnName (field .id , field . schema ),
140156 schema: field .schema ,
141157 index: index++ ,
142158 get : (result ) => {
0 commit comments