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 | 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 1x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 12x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | <!--
WikiLambda Vue component for setting the output of a ZFunction in the Function editor.
@copyright 2020– Abstract Wikipedia team; see AUTHORS.txt
@license MIT
-->
<template>
<wl-function-editor-field
class="ext-wikilambda-app-function-editor-output"
:tooltip-message="tooltipMessage"
:tooltip-icon="tooltipIcon"
:show-tooltip="tooltipMessage && !canEdit">
<template #label>
<label id="ext-wikilambda-app-function-editor-output__label-id">
{{ i18n( 'wikilambda-function-definition-output-label' ).text() }}
</label>
</template>
<template #description>
{{ i18n( 'wikilambda-function-definition-output-description' ).text() }}
<a :href="listObjectsUrl" target="_blank">
{{ i18n( 'wikilambda-function-definition-output-types' ).text() }}
</a>
</template>
<template #body>
<wl-type-selector
v-if="!!outputType"
class="ext-wikilambda-app-function-editor-output__field"
data-testid="function-editor-output-type"
:key-path="outputTypeKeyPath"
:object-value="outputType"
aria-labelledby="ext-wikilambda-app-function-editor-output__label-id"
:disabled="!canEdit"
:label-data="outputTypeLabel"
:placeholder="i18n( 'wikilambda-function-definition-output-selector' ).text()"
></wl-type-selector>
</template>
</wl-function-editor-field>
</template>
<script>
const { computed, defineComponent, inject } = require( 'vue' );
const Constants = require( '../../../Constants.js' );
const FunctionEditorField = require( './FunctionEditorField.vue' );
const LabelData = require( '../../../store/classes/LabelData.js' );
const TypeSelector = require( '../../base/TypeSelector.vue' );
const useMainStore = require( '../../../store/index.js' );
module.exports = exports = defineComponent( {
name: 'wl-function-editor-output',
components: {
'wl-type-selector': TypeSelector,
'wl-function-editor-field': FunctionEditorField
},
props: {
/**
* if a user has permission to edit a function
*/
canEdit: {
type: Boolean,
default: false
},
/**
* icon that will display a tooltip
*/
tooltipIcon: {
type: [ String, Object ],
default: null,
required: false
},
/**
* message the tooltip displays
*/
tooltipMessage: {
type: String,
default: null
}
},
setup() {
const i18n = inject( 'i18n' );
const store = useMainStore();
// Constants
const outputTypeKeyPath = [
Constants.STORED_OBJECTS.MAIN,
Constants.Z_PERSISTENTOBJECT_VALUE,
Constants.Z_FUNCTION_RETURN_TYPE
].join( '.' );
// Output type data
/**
* Returns the output type of the function
*
* @return {Object}
*/
const outputType = computed( () => store.getZFunctionOutput );
/**
* Returns the title of the "Type" column for the output field
*
* @return {LabelData}
*/
const outputTypeLabel = computed( () => LabelData.fromString(
i18n( 'wikilambda-function-definition-output-type-label' ).text()
) );
/**
* Returns the URL to the Special page List Object by Type
*
* @return {string}
*/
const listObjectsUrl = computed( () => new mw.Title( Constants.PATHS.LIST_OBJECTS_BY_TYPE_TYPE )
.getUrl( { uselang: store.getUserLangCode } ) );
return {
listObjectsUrl,
i18n,
outputType,
outputTypeKeyPath,
outputTypeLabel
};
}
} );
</script>
<style lang="less">
@import '../../../ext.wikilambda.app.variables.less';
.ext-wikilambda-app-function-editor-output {
.ext-wikilambda-app-function-editor-output__field {
border-radius: @border-radius-base;
border: @border-subtle;
padding: @spacing-75;
.cdx-label__label__text {
font-weight: @font-weight-normal;
}
}
}
</style>
|