Skip to content

Commit 4303b58

Browse files
author
Guillaume Chau
committed
New abstract API for custom field
1 parent 8a28523 commit 4303b58

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/backend/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ export function getCustomInstanceDetails (instance) {
377377
type: 'component',
378378
id: instance.__VUE_DEVTOOLS_UID__,
379379
display: getInstanceName(instance),
380-
state: reduceStateList(state)
380+
state: reduceStateList(state),
381+
abstract: true
381382
}
382383
}
383384
}

src/devtools/components/DataField.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@keyup.enter="submitEdit()"
2828
>
2929
</span>
30-
<span v-else class="key" :class="{ special: field.noDisplay }">{{ field.key }}</span><span class="colon" v-if="!field.noDisplay">:</span>
30+
<span v-else class="key" :class="{ abstract: field.abstractField }">{{ field.key }}</span><span class="colon" v-if="!field.abstractField">:</span>
3131

3232
<span
3333
v-if="editing"
@@ -272,7 +272,7 @@ export default {
272272
},
273273
isEditable () {
274274
return this.editable &&
275-
!this.field.noDisplay &&
275+
!this.field.abstractField &&
276276
(
277277
typeof this.field.key !== 'string' ||
278278
this.field.key.charAt(0) !== '$'
@@ -294,7 +294,7 @@ export default {
294294
},
295295
formattedValue () {
296296
const value = this.field.value
297-
if (this.field.noDisplay) {
297+
if (this.field.abstractField) {
298298
return ''
299299
} else if (value === null) {
300300
return 'null'
@@ -334,13 +334,15 @@ export default {
334334
}))
335335
} else if (typeof value === 'object') {
336336
const isCustom = this.valueType === 'custom'
337+
let abstractField = false
337338
if (isCustom) {
339+
abstractField = !!value._custom.abstract
338340
value = value._custom.state
339341
}
340342
value = sortByKey(Object.keys(value).map(key => ({
341343
key,
342344
value: value[key],
343-
noDisplay: isCustom
345+
abstractField
344346
})))
345347
}
346348
return value
@@ -588,7 +590,7 @@ export default {
588590
color #881391
589591
.dark &
590592
color: #e36eec
591-
&.special
593+
&.abstract
592594
color $blueishGrey
593595
.value
594596
display inline-block

0 commit comments

Comments
 (0)