mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-09-23 10:21:40 +00:00
build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I25e0cf131c7d2ea53d362f4836a451b68cd31366
This commit is contained in:
parent
7f7d5c4ae5
commit
bf494b89fd
2731
package-lock.json
generated
2731
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -35,7 +35,7 @@
|
|||
"@wikimedia/wvui": "0.3.5",
|
||||
"babel-loader": "8.0.6",
|
||||
"commander": "9.1.0",
|
||||
"eslint-config-wikimedia": "0.20.0",
|
||||
"eslint-config-wikimedia": "0.22.1",
|
||||
"grunt-banana-checker": "0.9.0",
|
||||
"jest": "26.4.2",
|
||||
"jest-fetch-mock": "3.0.3",
|
||||
|
|
|
@ -153,7 +153,7 @@ function initSearchLoader( document ) {
|
|||
/**
|
||||
* 1. If we are in a browser that doesn't support ES6 fall back to non-JS version.
|
||||
* 2. Disable on Wikidata per T281318 until the REST API is ready.
|
||||
**/
|
||||
*/
|
||||
if ( isWikidata || mw.loader.getState( 'skins.vector.search' ) === null ) {
|
||||
document.body.classList.remove(
|
||||
'skin-vector-search-vue'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<template>
|
||||
<!-- eslint-disable-next-line vue/no-undef-components -->
|
||||
<wvui-typeahead-search
|
||||
:id="id"
|
||||
ref="searchForm"
|
||||
|
@ -25,15 +26,18 @@
|
|||
@submit="onSubmit"
|
||||
>
|
||||
<template #default>
|
||||
<input type="hidden"
|
||||
<input
|
||||
type="hidden"
|
||||
name="title"
|
||||
:value="searchPageTitle"
|
||||
>
|
||||
<input type="hidden"
|
||||
<input
|
||||
type="hidden"
|
||||
name="wprov"
|
||||
:value="wprov"
|
||||
>
|
||||
</template>
|
||||
<!-- eslint-disable-next-line vue/no-template-shadow -->
|
||||
<template #search-footer-text="{ searchQuery }">
|
||||
<span v-i18n-html:vector-searchsuggest-containing="[ searchQuery ]"></span>
|
||||
</template>
|
||||
|
@ -46,20 +50,82 @@ const wvui = require( 'wvui-search' ),
|
|||
client = require( './restSearchClient.js' ),
|
||||
instrumentation = require( './instrumentation.js' );
|
||||
|
||||
// @vue/component
|
||||
module.exports = {
|
||||
name: 'App',
|
||||
components: wvui,
|
||||
mounted() {
|
||||
// access the element associated with the wvui-typeahead-search component
|
||||
// eslint-disable-next-line no-jquery/variable-pattern
|
||||
const wvuiSearchForm = this.$refs.searchForm.$el;
|
||||
|
||||
if ( this.autofocusInput ) {
|
||||
// TODO: The wvui-typeahead-search component does not accept an autofocus parameter
|
||||
// or directive. This can be removed when its does.
|
||||
wvuiSearchForm.querySelector( 'input' ).focus();
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
searchPageTitle: {
|
||||
type: String,
|
||||
default: 'Special:Search'
|
||||
},
|
||||
autofocusInput: {
|
||||
type: Boolean,
|
||||
// eslint-disable-next-line vue/no-boolean-default
|
||||
default: false
|
||||
},
|
||||
action: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
/** The keyboard shortcut to focus search. */
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
searchAccessKey: {
|
||||
type: String
|
||||
},
|
||||
/** The access key informational tip for search. */
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
searchTitle: {
|
||||
type: String
|
||||
},
|
||||
/** The ghost text shown when no search query is entered. */
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
searchPlaceholder: {
|
||||
type: String
|
||||
},
|
||||
/**
|
||||
* The search query string taken from the server-side rendered input immediately before
|
||||
* client render.
|
||||
*/
|
||||
// eslint-disable-next-line vue/require-default-prop
|
||||
searchQuery: {
|
||||
type: String
|
||||
},
|
||||
showThumbnail: {
|
||||
type: Boolean,
|
||||
// eslint-disable-next-line vue/no-boolean-default
|
||||
default: true
|
||||
},
|
||||
showDescription: {
|
||||
type: Boolean,
|
||||
// eslint-disable-next-line vue/no-boolean-default
|
||||
default: true
|
||||
},
|
||||
highlightQuery: {
|
||||
type: Boolean,
|
||||
// eslint-disable-next-line vue/no-boolean-default
|
||||
default: true
|
||||
},
|
||||
autoExpandWidth: {
|
||||
type: Boolean,
|
||||
// eslint-disable-next-line vue/no-boolean-default
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// -1 here is the default "active suggestion index" defined in the
|
||||
// `wvui-typeahead-search` component (see
|
||||
// https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/c7af5d6d091ffb3beb4fd2723fdf50dc6bb2789b/src/components/typeahead-search/TypeaheadSearch.vue#167).
|
||||
wprov: instrumentation.getWprovFromResultIndex( -1 ),
|
||||
|
||||
instrumentation: instrumentation.listeners
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
/**
|
||||
* @return {string}
|
||||
|
@ -81,69 +147,6 @@ module.exports = {
|
|||
return mw.config.get( 'wgVectorSearchHost', location.host );
|
||||
}
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
searchPageTitle: {
|
||||
type: String,
|
||||
default: 'Special:Search'
|
||||
},
|
||||
autofocusInput: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
action: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
/** The keyboard shortcut to focus search. */
|
||||
searchAccessKey: {
|
||||
type: String
|
||||
},
|
||||
/** The access key informational tip for search. */
|
||||
searchTitle: {
|
||||
type: String
|
||||
},
|
||||
/** The ghost text shown when no search query is entered. */
|
||||
searchPlaceholder: {
|
||||
type: String
|
||||
},
|
||||
/**
|
||||
* The search query string taken from the server-side rendered input immediately before
|
||||
* client render.
|
||||
*/
|
||||
searchQuery: {
|
||||
type: String
|
||||
},
|
||||
showThumbnail: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showDescription: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
highlightQuery: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
autoExpandWidth: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// -1 here is the default "active suggestion index" defined in the
|
||||
// `wvui-typeahead-search` component (see
|
||||
// https://gerrit.wikimedia.org/r/plugins/gitiles/wvui/+/c7af5d6d091ffb3beb4fd2723fdf50dc6bb2789b/src/components/typeahead-search/TypeaheadSearch.vue#167).
|
||||
wprov: instrumentation.getWprovFromResultIndex( -1 ),
|
||||
|
||||
instrumentation: instrumentation.listeners
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* @param {SubmitEvent} event
|
||||
|
@ -153,6 +156,17 @@ module.exports = {
|
|||
|
||||
instrumentation.listeners.onSubmit( event );
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// access the element associated with the wvui-typeahead-search component
|
||||
// eslint-disable-next-line no-jquery/variable-pattern
|
||||
const wvuiSearchForm = this.$refs.searchForm.$el;
|
||||
|
||||
if ( this.autofocusInput ) {
|
||||
// TODO: The wvui-typeahead-search component does not accept an autofocus parameter
|
||||
// or directive. This can be removed when its does.
|
||||
wvuiSearchForm.querySelector( 'input' ).focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* @property {ResourceLoaderSkinModuleLogos} data-logos as configured,
|
||||
* the return value of ResourceLoaderSkinModule::getAvailableLogos.
|
||||
* @property {string} msg-sitetitle alternate text for wordmark
|
||||
href the url to navigate to on click.
|
||||
* href the url to navigate to on click.
|
||||
* @property {string} msg-sitesubtitle alternate text for tagline.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue