diff --git a/docs/.vuepress/components/Sponsors.vue b/docs/.vuepress/components/Sponsors.vue index 310eb6c..08a3876 100644 --- a/docs/.vuepress/components/Sponsors.vue +++ b/docs/.vuepress/components/Sponsors.vue @@ -16,11 +16,11 @@ import { format } from "date-fns"; export default { data: () => ({ - sponsors: SPONSORS.map(({ createdAt, sponsor }) => ({ + sponsors: SPONSORS.map(({ createdAt, sponsorEntity }) => ({ createdAt: format(new Date(createdAt), "LLL yyyy"), - ...sponsor + ...sponsorEntity })) - }) + }), }; diff --git a/docs/.vuepress/github/clientDynamicModules.js b/docs/.vuepress/github/clientDynamicModules.js index 0335d3e..e4a76f5 100644 --- a/docs/.vuepress/github/clientDynamicModules.js +++ b/docs/.vuepress/github/clientDynamicModules.js @@ -28,20 +28,28 @@ async function getContributors() { */ async function getSponsors() { const query = ` - { - user(login: "sagalbot") { - sponsorshipsAsMaintainer(first: 100) { - nodes { - createdAt - sponsor { - login - avatarUrl - } + { + user(login: "sagalbot") { + sponsorshipsAsMaintainer(first: 100) { + nodes { + sponsorEntity { + ... on User { + id + avatarUrl + login + } + ... on Organization { + id + avatarUrl + login } } + createdAt } } - `; + } + } + `; try { const { user } = await graphql(query, { diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index 7b22cee..c60a619 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -1,17 +1,13 @@ diff --git a/docs/api/events.md b/docs/api/events.md index 4866fef..a314206 100644 --- a/docs/api/events.md +++ b/docs/api/events.md @@ -4,11 +4,27 @@ Triggered when the selected value changes. Used internally for `v-model`. ```js /** - * @param val {Object|String}` - selected option. + * @param {Object|String} val - selected option. */ this.$emit("input", val); ``` +## `open` + +Triggered when the dropdown is open. + +```js +this.$emit("open"); +``` + +## `close` + +Triggered when the dropdown is closed. + +```js +this.$emit("close"); +``` + ## `option:selecting` Triggered after an option has been selected, before updating internal state. @@ -47,11 +63,40 @@ Triggered when `taggable` is `true` and a new option has been created. ```js /** - * @param newOption {Object} - created option + * @param {Object} newOption - created option */ this.$emit("option:created", newOption); ``` +## `search` + +Anytime the search string changes, emit the +'search' event. The event is passed with two +parameters: the search string, and a function +that accepts a boolean parameter to toggle the +loading state. + +See the [AJAX Guide](/guide/ajax.html#loading-options-with-ajax) +for a complete example. + +```js +/** + * @param {String} searchString - the search string + * @param {Function} toggleLoading - function to toggle loading state, accepts true or false boolean + */ +this.$emit('search', this.search, this.toggleLoading); +``` + +```vue + + +``` + ## `search:blur` Triggered when the text input loses focus. The dropdown will close immediately before this @@ -69,3 +114,21 @@ event is triggered. ```js this.$emit("search:focus"); ``` + +## `search` + +Triggered when the search text changes. + +```js +/** + * Anytime the search string changes, emit the + * 'search' event. The event is passed with two + * parameters: the search string, and a function + * that accepts a boolean parameter to toggle the + * loading state. + * + * @emits search + */ +this.$emit('search', newSearchString, toggleLoading); +``` + diff --git a/docs/api/props.md b/docs/api/props.md index 999e935..cfe3aca 100644 --- a/docs/api/props.md +++ b/docs/api/props.md @@ -187,6 +187,21 @@ disabled: { }, ``` +## dropdownShouldOpen + +Determines whether the dropdown should open. Used +for overriding the default dropdown behaviour. Receives +the vue-select instance as the single argument to the function. + +```js +dropdownShouldOpen: { + type: Function, + default({noDrop, open, mutableLoading}) { + return noDrop ? false : open && !mutableLoading; + } +} +``` + ## filter diff --git a/docs/guide/components.md b/docs/guide/components.md index b26b551..e5436f4 100644 --- a/docs/guide/components.md +++ b/docs/guide/components.md @@ -58,7 +58,7 @@ export default { ## Setting Globally at Registration -If you want to all instances of Vue Select to use your custom components throughout your app, while +If you want all instances of Vue Select to use your custom components throughout your app, while only having to set the implementation once, you can do so when registering Vue Select as a component. ```js diff --git a/package.json b/package.json index 36cf2c5..43d8805 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-select", - "version": "3.11.2", + "version": "3.12.0", "description": "Everything you wish the HTML