Skip to content

Commit

Permalink
chore(#639): update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Decipher committed Jul 3, 2023
1 parent 53ede24 commit 13908af
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/druxt/src/stores/druxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ const DruxtStore = ({ store }) => {
*
* @example @lang js
* // Flush all resources.
* this.$store.commit('druxt/flushResources', {})
* this.$store.commit('druxt/flushResource', {})
*
* // Flush target resource.
* this.$store.commit('druxt/flushResources', { id, type, prefix, hash })
* this.$store.commit('druxt/flushResource', { id, type, prefix, hash })
*/
flushResource (state, { type, id, prefix }) {
if (!type) Vue.set(state, 'resources', {})
Expand Down
7 changes: 5 additions & 2 deletions packages/entity/src/components/DruxtEntity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ export default {
* property.
*
* @typedef {object} ModuleSettings
* @param {object} query - Entity Query settings:
* @param {object} query - Entity query settings:
* @param {(boolean|function)} query.bypassCache - Whether to pull the data from the Vuex store or from the JSON:API.
* @param {(string[]|array[])} query.fields - An array or arrays of fields to filter from the JSON:API Resources.
* @param {string[]} query.include - An array of relationships to include alongside the JSON:API Resource.
* @param {boolean} query.schema - Whether to automatically detect fields to filter, per the Display mode.
Expand All @@ -521,11 +522,12 @@ export default {
* export default {
* druxt: {
* query: {
* bypassCache: ({ $store }) => $store.$auth.loggedIn,
* fields: [['title'], ['user--user', ['display_name']]],
* include: ['uid']
* schema: true,
* },
* }
* },
* }
*
* @example <caption>DruxtEntity component with settings</caption> @lang vue
Expand All @@ -535,6 +537,7 @@ export default {
* :uuid="uuid"
* :settings="{
* query: {
* bypassCache: true,
* fields: [['title'], ['user--user', ['display_name']]],
* include: ['uid']
* schema: true,
Expand Down
38 changes: 25 additions & 13 deletions packages/views/src/components/DruxtView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -735,28 +735,40 @@ export default {
* or the Wrapper component `druxt` object.
*
* @typedef {object} ModuleSettings
* @param {boolean} bundleFilter - Whether to automatically detect Resource types to filter, based on the View `bundle` filter.
* @param {string[]} fields - An array of fields to filter from the JSON:API Views Resource types.
* @param {string[]} resourceTypes - An array of Resource types to be used by the Fields filter.
* @param {object} query - View results query settings:
* @param {(boolean|function)} query.bypassCache - Whether to pull the data from the Vuex store or from the JSON:API.
* @param {boolean} query.bundleFilter - Whether to automatically detect Resource types to filter, based on the View `bundle` filter.
* @param {string[]} query.fields - An array of fields to filter from the JSON:API Views Resource types.
* @param {string[]} query.resourceTypes - An array of Resource types to be used by the Fields filter.
*
* @example @lang js
* {
* bundleFilter: false,
* fields: [],
* resourceTypes: []
* }
*
* @example @lang vue
* @example <caption>DruxtView Wrapper component</caption> @lang vue
* <script>
* export default {
* druxt: {
* query: {
* bypassCache: ({ $store }) => $store.$auth.loggedIn,
* bundleFilter: false,
* fields: ['title']
* fields: [],
* resourceTypes: ['node--article'],
* },
* }
* },
* }
*
* @example <caption>DruxtView component with settings</caption> @lang vue
* <template>
* <DruxtView
* display-id="block_1"
* view-id="promoted_items
* :settings="{
* query: {
* bypassCache: true,
* bundleFilter: false,
* fields: ['title']
* resourceTypes: [],
* }
* }"
* />
* </template>
*/
/**
Expand Down

0 comments on commit 13908af

Please sign in to comment.