Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | <!--
WikiLambda Vue component for Z6003/Wikidata Statement.
@copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
@license MIT
-->
<template>
<div
class="ext-wikilambda-app-wikidata-statement"
data-testid="wikidata-statement">
<!-- Collapsed summary view -->
<div class="ext-wikilambda-app-wikidata-statement__read">
<wl-z-object-to-string
v-if="subjectValue"
:key-path="`${ keyPath }.${ subjectKey }`"
:object-value="subjectValue"
:edit="edit"
></wl-z-object-to-string>
<span
v-if="subjectValue && ( predicateValue || valueValue )"
class="ext-wikilambda-app-wikidata-statement__separator"> - </span>
<wl-z-object-to-string
v-if="predicateValue"
:key-path="`${ keyPath }.${ predicateKey }`"
:object-value="predicateValue"
:edit="edit"
></wl-z-object-to-string>
<span
v-if="predicateValue && valueValue"
class="ext-wikilambda-app-wikidata-statement__separator"> - </span>
<wl-z-object-to-string
v-if="valueValue"
:key-path="`${ keyPath }.${ valueKey }`"
:object-value="valueValue"
:edit="edit"
></wl-z-object-to-string>
</div>
</div>
</template>
<script>
const { defineComponent, computed } = require( 'vue' );
const Constants = require( '../../../Constants.js' );
const ZObjectToString = require( '../ZObjectToString.vue' );
module.exports = exports = defineComponent( {
name: 'wl-wikidata-statement',
components: {
'wl-z-object-to-string': ZObjectToString
},
props: {
keyPath: {
type: String,
required: true
},
objectValue: {
type: Object,
required: true
},
edit: {
type: Boolean,
required: true
},
// Type prop is required by parent component interface but not used here
// eslint-disable-next-line vue/no-unused-properties
type: {
type: String,
required: true
},
// Expanded prop is required by parent component interface but not used here
// eslint-disable-next-line vue/no-unused-properties
expanded: {
type: Boolean,
required: true
}
},
setup( props ) {
// Constants
const subjectKey = Constants.Z_WIKIDATA_STATEMENT_SUBJECT;
const predicateKey = Constants.Z_WIKIDATA_STATEMENT_PREDICATE;
const valueKey = Constants.Z_WIKIDATA_STATEMENT_VALUE;
// Statement values
/**
* Get subject value (Z6003K1)
*/
const subjectValue = computed( () => props.objectValue && props.objectValue[ subjectKey ] );
/**
* Get predicate value (Z6003K2)
*/
const predicateValue = computed( () => props.objectValue && props.objectValue[ predicateKey ] );
/**
* Get value value (Z6003K3)
*/
const valueValue = computed( () => props.objectValue && props.objectValue[ valueKey ] );
return {
subjectValue,
predicateValue,
valueValue,
subjectKey,
predicateKey,
valueKey
};
},
beforeCreate: function () {
// Need to delay require of ZObjectKeyValue to avoid loop
this.$options.components[ 'wl-z-object-key-value' ] = require( '../ZObjectKeyValue.vue' );
}
} );
</script>
<style lang="less">
@import '../../../ext.wikilambda.app.variables.less';
.ext-wikilambda-app-wikidata-statement {
--line-height-current: calc( var( --line-height-content ) * 1em );
.ext-wikilambda-app-wikidata-statement__read {
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
min-height: @min-size-interactive-pointer;
padding-top: calc( calc( @min-size-interactive-pointer - var( --line-height-current ) ) / 2 );
word-break: normal;
overflow-wrap: anywhere;
}
.ext-wikilambda-app-wikidata-statement__separator {
margin: 0 @spacing-25;
color: @color-subtle;
}
// Stack on mobile
@media screen and ( max-width: @max-width-breakpoint-mobile ) {
.ext-wikilambda-app-wikidata-statement__read {
flex-direction: column;
align-items: flex-start;
}
.ext-wikilambda-app-wikidata-statement__separator {
display: none;
}
}
// Stack when inside a small column
.ext-wikilambda-app-col-6 & {
.ext-wikilambda-app-wikidata-statement__read {
flex-direction: column;
align-items: flex-start;
}
.ext-wikilambda-app-wikidata-statement__separator {
display: none;
}
}
}
</style>
|