@@ -114,7 +114,10 @@ function query_table(
114
114
} ,
115
115
) {
116
116
let fields = opts ?. fields
117
- if ( ! rows || rows . length === 0 || ( fields && fields . length === 0 ) )
117
+ if ( fields && fields . length === 0 )
118
+ fields = undefined
119
+
120
+ if ( ! rows || rows . length === 0 )
118
121
return html `
119
122
< div class ="custom-query ">
120
123
< div class ="text-sm mt-2 opacity-90 "> No matched result</ div >
@@ -140,11 +143,13 @@ function query_table(
140
143
fields = Array ( first . length ) . fill ( 'column ' ) . map ( ( x , i ) => x + ( i + 1 ) )
141
144
else if ( first instanceof PageContext ) {
142
145
const propNames = Object . keys ( first . props ! )
146
+ . filter ( p => p !== 'title' )
143
147
fields = [ 'page' , ...propNames ]
144
148
}
145
149
else if ( typeof first === 'object' && typeof first [ 'original-name' ] === 'string' ) {
146
150
// assume this is PageEntity
147
151
const propNames = Object . keys ( first [ 'properties-text-values' ] ! )
152
+ . filter ( p => p !== 'title' )
148
153
fields = [ 'page' , ...propNames ]
149
154
}
150
155
else
@@ -186,6 +191,9 @@ function query_table(
186
191
if ( orderByNonField )
187
192
extendedFields = extendedFields . concat ( meta . order . by ! )
188
193
194
+ // @ts -expect-error
195
+ const listProps = context . config . _settings [ 'property/separated-by-commas' ] ?? [ ]
196
+
189
197
if ( typeof first !== 'object' )
190
198
rows = rows . map ( o => [ o ] )
191
199
else {
@@ -197,9 +205,12 @@ function query_table(
197
205
if ( f === 'page' )
198
206
return ref ( p . name )
199
207
if ( propNames . includes ( f ) ) {
200
- // @ts -expect-error
201
- if ( ( context . config . _settings [ 'property/separated-by-commas' ] ?? [ ] ) . includes ( f ) )
202
- return p . propsRefs [ f ] . map ( r => ref ( r ) ) . join ( ', ' )
208
+ if ( listProps . includes ( f ) ) {
209
+ const value = p . propsRefs [ f ]
210
+ return value
211
+ ? value . map ( r => ref ( r ) ) . join ( ', ' )
212
+ : value
213
+ }
203
214
return p . props [ f ]
204
215
}
205
216
return dev_get ( context , f , p )
@@ -216,9 +227,12 @@ function query_table(
216
227
if ( f === 'page' )
217
228
return ref ( p [ 'original-name' ] )
218
229
if ( propNames . includes ( f ) ) {
219
- // @ts -expect-error
220
- if ( ( context . config . _settings [ 'property/separated-by-commas' ] ?? [ ] ) . includes ( f ) )
221
- return p [ 'properties' ] [ f ] . map ( r => ref ( r ) ) . join ( ', ' )
230
+ if ( listProps . includes ( f ) ) {
231
+ const value = p [ 'properties' ] [ f ]
232
+ return value
233
+ ? value . map ( r => ref ( r ) ) . join ( ', ' )
234
+ : value
235
+ }
222
236
return p [ 'properties-text-values' ] [ f ]
223
237
}
224
238
return dev_get ( context , f , p )
0 commit comments