@@ -204,10 +204,11 @@ export default class BrowserCell extends Component {
204
204
205
205
render ( ) {
206
206
let { type, value, hidden, width, current, onSelect, onEditChange, setCopyableValue, setRelation, onPointerClick, row, col, field, onEditSelectedRow } = this . props ;
207
- let content = value ;
207
+ let content = value ,
208
+ contentArray = [ ]
208
209
this . copyableValue = content ;
209
210
let classes = [ styles . cell , unselectable ] ;
210
- if ( hidden ) {
211
+ if ( hidden ) {
211
212
content = '(hidden)' ;
212
213
classes . push ( styles . empty ) ;
213
214
} else if ( value === undefined ) {
@@ -246,7 +247,59 @@ export default class BrowserCell extends Component {
246
247
this . copyableValue = content = dateStringUTC ( value ) ;
247
248
} else if ( type === 'Boolean' ) {
248
249
this . copyableValue = content = value ? 'True' : 'False' ;
249
- } else if ( type === 'Object' || type === 'Bytes' || type === 'Array' ) {
250
+ } else if ( type === 'Array' ) {
251
+
252
+
253
+ this . copyableValue = '' ;
254
+ contentArray . push ( '[' ) ;
255
+ for ( var i = 0 ; i < value . length ; i ++ ) {
256
+ let val = value [ i ] ;
257
+ if ( val === null ) {
258
+ this . copyableValue += content = '(undefined)' ;
259
+ classes . push ( styles . empty ) ;
260
+ } if ( val === '' ) {
261
+ contentArray . push ( < span > </ span > ) ;
262
+ classes . push ( styles . empty ) ;
263
+ } else if ( val && val . __type === 'Pointer' ) {
264
+ const object = new Parse . Object ( val . className ) ;
265
+ object . id = val . objectId ;
266
+ value [ i ] = object ;
267
+ val = object ;
268
+ contentArray . push ( onPointerClick ? (
269
+ < a href = 'javascript:;' onClick = { onPointerClick . bind ( undefined , val ) } >
270
+ < Pill value = { val . id } />
271
+ </ a >
272
+ ) : (
273
+ val . id
274
+ ) )
275
+ this . copyableValue += val . id ;
276
+ } else if ( val && val . __type === 'Date' || new Date ( val ) ) {
277
+ if ( typeof val === 'object' && val . __type ) {
278
+ value [ i ] = new Date ( val . iso ) ;
279
+ val = value [ i ] ;
280
+ } else if ( typeof val === 'string' && new Date ( val ) ) {
281
+ value [ i ] = new Date ( val ) ;
282
+ val = value [ i ] ;
283
+ }
284
+ this . copyableValue += dateStringUTC ( val ) ;
285
+ } else if ( val && val . __type === 'File' ) {
286
+ const fileName = val . _url ? getFileName ( val ) : 'Uploading\u2026' ;
287
+ contentArray . push ( < Pill value = { fileName } /> ) ;
288
+ this . copyableValue += fileName ;
289
+ } else if ( type === 'Boolean' ) {
290
+ this . copyableValue += val ;
291
+ } else {
292
+ contentArray . push ( JSON . stringify ( val ) ) ;
293
+ this . copyableValue += JSON . stringify ( val ) ;
294
+ }
295
+ if ( i + 1 != value . length ) {
296
+ contentArray . push ( ',' ) ;
297
+ }
298
+ }
299
+ contentArray . push ( ']' ) ;
300
+
301
+
302
+ } else if ( type === 'Object' || type === 'Bytes' ) {
250
303
this . copyableValue = content = JSON . stringify ( value ) ;
251
304
} else if ( type === 'File' ) {
252
305
const fileName = value . url ( ) ? getFileName ( value ) : 'Uploading\u2026' ;
@@ -287,7 +340,9 @@ export default class BrowserCell extends Component {
287
340
) ;
288
341
this . copyableValue = undefined ;
289
342
}
290
-
343
+ if ( contentArray . length == 0 ) {
344
+ contentArray = [ content ] ;
345
+ }
291
346
if ( current ) {
292
347
classes . push ( styles . current ) ;
293
348
}
@@ -319,7 +374,7 @@ export default class BrowserCell extends Component {
319
374
} }
320
375
onContextMenu = { this . onContextMenu . bind ( this ) }
321
376
>
322
- { content }
377
+ { contentArray . map ( ( val , index ) => < div style = { { display : 'inline-block' } } key = { index + val } > { val } </ div > ) }
323
378
</ span >
324
379
) ;
325
380
}
0 commit comments