@vuetify/nightly 3.6.7-master.2024-05-29 → 3.6.8-master.2024-05-31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +4 -11
  2. package/dist/json/attributes.json +5 -5
  3. package/dist/json/importMap-labs.json +34 -34
  4. package/dist/json/importMap.json +164 -164
  5. package/dist/json/web-types.json +36 -36
  6. package/dist/vuetify-labs.css +2940 -2939
  7. package/dist/vuetify-labs.d.ts +450 -1374
  8. package/dist/vuetify-labs.esm.js +128 -39
  9. package/dist/vuetify-labs.esm.js.map +1 -1
  10. package/dist/vuetify-labs.js +128 -39
  11. package/dist/vuetify-labs.min.css +2 -2
  12. package/dist/vuetify.css +706 -705
  13. package/dist/vuetify.d.ts +398 -1132
  14. package/dist/vuetify.esm.js +24 -8
  15. package/dist/vuetify.esm.js.map +1 -1
  16. package/dist/vuetify.js +24 -8
  17. package/dist/vuetify.js.map +1 -1
  18. package/dist/vuetify.min.css +2 -2
  19. package/dist/vuetify.min.js +11 -11
  20. package/dist/vuetify.min.js.map +1 -1
  21. package/lib/components/VAutocomplete/index.d.mts +102 -336
  22. package/lib/components/VBanner/VBanner.css +1 -0
  23. package/lib/components/VBanner/VBanner.sass +1 -0
  24. package/lib/components/VBanner/_variables.scss +1 -0
  25. package/lib/components/VCombobox/index.d.mts +102 -336
  26. package/lib/components/VDatePicker/VDatePickerMonth.mjs +3 -0
  27. package/lib/components/VDatePicker/VDatePickerMonth.mjs.map +1 -1
  28. package/lib/components/VEmptyState/VEmptyState.css +2 -2
  29. package/lib/components/VEmptyState/VEmptyState.mjs +1 -1
  30. package/lib/components/VEmptyState/VEmptyState.mjs.map +1 -1
  31. package/lib/components/VEmptyState/_variables.scss +2 -2
  32. package/lib/components/VList/VList.mjs +3 -1
  33. package/lib/components/VList/VList.mjs.map +1 -1
  34. package/lib/components/VList/VListGroup.mjs +1 -0
  35. package/lib/components/VList/VListGroup.mjs.map +1 -1
  36. package/lib/components/VList/VListItem.css +2 -2
  37. package/lib/components/VList/VListItem.mjs +2 -0
  38. package/lib/components/VList/VListItem.mjs.map +1 -1
  39. package/lib/components/VList/VListItem.sass +1 -1
  40. package/lib/components/VList/index.d.mts +52 -66
  41. package/lib/components/VSelect/index.d.mts +102 -336
  42. package/lib/components/VSelectionControl/VSelectionControl.mjs +9 -1
  43. package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
  44. package/lib/components/VTabs/VTabs.mjs +2 -2
  45. package/lib/components/VTabs/VTabs.mjs.map +1 -1
  46. package/lib/components/index.d.mts +340 -1074
  47. package/lib/composables/filter.mjs +1 -1
  48. package/lib/composables/filter.mjs.map +1 -1
  49. package/lib/entry-bundler.mjs +1 -1
  50. package/lib/framework.mjs +1 -1
  51. package/lib/index.d.mts +58 -58
  52. package/lib/labs/VTreeview/VTreeview.mjs +1 -1
  53. package/lib/labs/VTreeview/VTreeview.mjs.map +1 -1
  54. package/lib/labs/VTreeview/VTreeviewChildren.mjs +30 -25
  55. package/lib/labs/VTreeview/VTreeviewChildren.mjs.map +1 -1
  56. package/lib/labs/VTreeview/VTreeviewItem.mjs +81 -10
  57. package/lib/labs/VTreeview/VTreeviewItem.mjs.map +1 -1
  58. package/lib/labs/VTreeview/index.d.mts +110 -300
  59. package/lib/labs/components.d.mts +110 -300
  60. package/package.json +1 -1
@@ -37,7 +37,7 @@ export function filterItems(items, query, options) {
37
37
  const customMatches = {};
38
38
  const defaultMatches = {};
39
39
  let match = -1;
40
- if (query && !options?.noFilter) {
40
+ if ((query || customFiltersLength > 0) && !options?.noFilter) {
41
41
  if (typeof item === 'object') {
42
42
  const filterKeys = keys || Object.keys(transformed);
43
43
  for (const key of filterKeys) {
@@ -1 +1 @@
1
- {"version":3,"file":"filter.mjs","names":["computed","ref","unref","watchEffect","getPropertyFromItem","propsFactory","wrapInArray","defaultFilter","value","query","item","toString","toLocaleLowerCase","indexOf","makeFilterProps","customFilter","Function","customKeyFilter","Object","filterKeys","Array","String","filterMode","type","default","noFilter","Boolean","filterItems","items","options","array","filter","keys","customFiltersLength","length","loop","i","transformed","customMatches","defaultMatches","match","key","keyFilter","title","defaultMatchesLength","customMatchesLength","push","index","matches","useFilter","props","filteredItems","filteredMatches","Map","transformedItems","transform","map","_query","strQuery","results","originalItems","_filteredItems","_filteredMatches","forEach","_ref","set","getMatches","get"],"sources":["../../src/composables/filter.ts"],"sourcesContent":["/* eslint-disable max-statements */\n/* eslint-disable no-labels */\n\n// Utilities\nimport { computed, ref, unref, watchEffect } from 'vue'\nimport { getPropertyFromItem, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { MaybeRef } from '@/util'\n\n/**\n * - match without highlight\n * - single match (index), length already known\n * - single match (start, end)\n * - multiple matches (start, end), probably shouldn't overlap\n */\nexport type FilterMatch = boolean | number | [number, number] | [number, number][]\nexport type FilterFunction = (value: string, query: string, item?: InternalItem) => FilterMatch\nexport type FilterKeyFunctions = Record<string, FilterFunction>\nexport type FilterKeys = string | string[]\nexport type FilterMode = 'some' | 'every' | 'union' | 'intersection'\n\nexport interface FilterProps {\n customFilter?: FilterFunction\n customKeyFilter?: FilterKeyFunctions\n filterKeys?: FilterKeys\n filterMode?: FilterMode\n noFilter?: boolean\n}\n\nexport interface InternalItem<T = any> {\n value: any\n raw: T\n}\n\n// Composables\nexport const defaultFilter: FilterFunction = (value, query, item) => {\n if (value == null || query == null) return -1\n\n return value.toString().toLocaleLowerCase().indexOf(query.toString().toLocaleLowerCase())\n}\n\nexport const makeFilterProps = propsFactory({\n customFilter: Function as PropType<FilterFunction>,\n customKeyFilter: Object as PropType<FilterKeyFunctions>,\n filterKeys: [Array, String] as PropType<FilterKeys>,\n filterMode: {\n type: String as PropType<FilterMode>,\n default: 'intersection',\n },\n noFilter: Boolean,\n}, 'filter')\n\nexport function filterItems (\n items: readonly (readonly [item: InternalItem, transformed: {}])[] | readonly InternalItem[],\n query: string,\n options?: {\n customKeyFilter?: FilterKeyFunctions\n default?: FilterFunction\n filterKeys?: FilterKeys\n filterMode?: FilterMode\n noFilter?: boolean\n },\n) {\n const array: { index: number, matches: Record<string, FilterMatch> }[] = []\n // always ensure we fall back to a functioning filter\n const filter = options?.default ?? defaultFilter\n const keys = options?.filterKeys ? wrapInArray(options.filterKeys) : false\n const customFiltersLength = Object.keys(options?.customKeyFilter ?? {}).length\n\n if (!items?.length) return array\n\n loop:\n for (let i = 0; i < items.length; i++) {\n const [item, transformed = item] = wrapInArray(items[i]) as readonly [InternalItem, {}]\n const customMatches: Record<string, FilterMatch> = {}\n const defaultMatches: Record<string, FilterMatch> = {}\n let match: FilterMatch = -1\n\n if (query && !options?.noFilter) {\n if (typeof item === 'object') {\n const filterKeys = keys || Object.keys(transformed)\n\n for (const key of filterKeys) {\n const value = getPropertyFromItem(transformed, key)\n const keyFilter = options?.customKeyFilter?.[key]\n\n match = keyFilter\n ? keyFilter(value, query, item)\n : filter(value, query, item)\n\n if (match !== -1 && match !== false) {\n if (keyFilter) customMatches[key] = match\n else defaultMatches[key] = match\n } else if (options?.filterMode === 'every') {\n continue loop\n }\n }\n } else {\n match = filter(item, query, item)\n if (match !== -1 && match !== false) {\n defaultMatches.title = match\n }\n }\n\n const defaultMatchesLength = Object.keys(defaultMatches).length\n const customMatchesLength = Object.keys(customMatches).length\n\n if (!defaultMatchesLength && !customMatchesLength) continue\n\n if (\n options?.filterMode === 'union' &&\n customMatchesLength !== customFiltersLength &&\n !defaultMatchesLength\n ) continue\n\n if (\n options?.filterMode === 'intersection' &&\n (\n customMatchesLength !== customFiltersLength ||\n !defaultMatchesLength\n )\n ) continue\n }\n\n array.push({ index: i, matches: { ...defaultMatches, ...customMatches } })\n }\n\n return array\n}\n\nexport function useFilter <T extends InternalItem> (\n props: FilterProps,\n items: MaybeRef<T[]>,\n query: Ref<string | undefined> | (() => string | undefined),\n options?: {\n transform?: (item: T) => {}\n customKeyFilter?: MaybeRef<FilterKeyFunctions | undefined>\n }\n) {\n const filteredItems: Ref<T[]> = ref([])\n const filteredMatches: Ref<Map<unknown, Record<string, FilterMatch>>> = ref(new Map())\n const transformedItems = computed(() => (\n options?.transform\n ? unref(items).map(item => ([item, options.transform!(item)] as const))\n : unref(items)\n ))\n\n watchEffect(() => {\n const _query = typeof query === 'function' ? query() : unref(query)\n const strQuery = (\n typeof _query !== 'string' &&\n typeof _query !== 'number'\n ) ? '' : String(_query)\n\n const results = filterItems(\n transformedItems.value,\n strQuery,\n {\n customKeyFilter: {\n ...props.customKeyFilter,\n ...unref(options?.customKeyFilter),\n },\n default: props.customFilter,\n filterKeys: props.filterKeys,\n filterMode: props.filterMode,\n noFilter: props.noFilter,\n },\n )\n\n const originalItems = unref(items)\n\n const _filteredItems: typeof filteredItems['value'] = []\n const _filteredMatches: typeof filteredMatches['value'] = new Map()\n results.forEach(({ index, matches }) => {\n const item = originalItems[index]\n _filteredItems.push(item)\n _filteredMatches.set(item.value, matches)\n })\n filteredItems.value = _filteredItems\n filteredMatches.value = _filteredMatches\n })\n\n function getMatches (item: T) {\n return filteredMatches.value.get(item.value)\n }\n\n return { filteredItems, filteredMatches, getMatches }\n}\n"],"mappings":"AAAA;AACA;;AAEA;AACA,SAASA,QAAQ,EAAEC,GAAG,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SAC9CC,mBAAmB,EAAEC,YAAY,EAAEC,WAAW,6BAEvD;AAIA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA,OAAO,MAAMC,aAA6B,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAK;EACnE,IAAIF,KAAK,IAAI,IAAI,IAAIC,KAAK,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAE7C,OAAOD,KAAK,CAACG,QAAQ,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACC,OAAO,CAACJ,KAAK,CAACE,QAAQ,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,C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B,UAAU;MAC5BG,UAAU,EAAE4B,KAAK,CAAC5B,UAAU;MAC5BG,QAAQ,EAAEyB,KAAK,CAACzB;IAClB,CACF,CAAC;IAED,MAAMmC,aAAa,GAAG1D,KAAK,CAAC0B,KAAK,CAAC;IAElC,MAAMiC,cAA6C,GAAG,EAAE;IACxD,MAAMC,gBAAiD,GAAG,IAAIT,GAAG,CAAC,CAAC;IACnEM,OAAO,CAACI,OAAO,CAACC,IAAA,IAAwB;MAAA,IAAvB;QAAEjB,KAAK;QAAEC;MAAQ,CAAC,GAAAgB,IAAA;MACjC,MAAMtD,IAAI,GAAGkD,aAAa,CAACb,KAAK,CAAC;MACjCc,cAAc,CAACf,IAAI,CAACpC,IAAI,CAAC;MACzBoD,gBAAgB,CAACG,GAAG,CAACvD,IAAI,CAACF,KAAK,EAAEwC,OAAO,CAAC;IAC3C,CAAC,CAAC;IACFG,aAAa,CAAC3C,KAAK,GAAGqD,cAAc;IACpCT,eAAe,CAAC5C,KAAK,GAAGsD,gBAAgB;EAC1C,CAAC,CAAC;EAEF,SAASI,UAAUA,CAAExD,IAAO,EAAE;IAC5B,OAAO0C,eAAe,CAAC5C,KAAK,CAAC2D,GAAG,CAACzD,IAAI,CAACF,KAAK,CAAC;EAC9C;EAEA,OAAO;IAAE2C,aAAa;IAAEC,eAAe;IAAEc;EAAW,CAAC;AACvD","ignoreList":[]}
1
+ {"version":3,"file":"filter.mjs","names":["computed","ref","unref","watchEffect","getPropertyFromItem","propsFactory","wrapInArray","defaultFilter","value","query","item","toString","toLocaleLowerCase","indexOf","makeFilterProps","customFilter","Function","customKeyFilter","Object","filterKeys","Array","String","filterMode","type","default","noFilter","Boolean","filterItems","items","options","array","filter","keys","customFiltersLength","length","loop","i","transformed","customMatches","defaultMatches","match","key","keyFilter","title","defaultMatchesLength","customMatchesLength","push","index","matches","useFilter","props","filteredItems","filteredMatches","Map","transformedItems","transform","map","_query","strQuery","results","originalItems","_filteredItems","_filteredMatches","forEach","_ref","set","getMatches","get"],"sources":["../../src/composables/filter.ts"],"sourcesContent":["/* eslint-disable max-statements */\n/* eslint-disable no-labels */\n\n// Utilities\nimport { computed, ref, unref, watchEffect } from 'vue'\nimport { getPropertyFromItem, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { MaybeRef } from '@/util'\n\n/**\n * - match without highlight\n * - single match (index), length already known\n * - single match (start, end)\n * - multiple matches (start, end), probably shouldn't overlap\n */\nexport type FilterMatch = boolean | number | [number, number] | [number, number][]\nexport type FilterFunction = (value: string, query: string, item?: InternalItem) => FilterMatch\nexport type FilterKeyFunctions = Record<string, FilterFunction>\nexport type FilterKeys = string | string[]\nexport type FilterMode = 'some' | 'every' | 'union' | 'intersection'\n\nexport interface FilterProps {\n customFilter?: FilterFunction\n customKeyFilter?: FilterKeyFunctions\n filterKeys?: FilterKeys\n filterMode?: FilterMode\n noFilter?: boolean\n}\n\nexport interface InternalItem<T = any> {\n value: any\n raw: T\n}\n\n// Composables\nexport const defaultFilter: FilterFunction = (value, query, item) => {\n if (value == null || query == null) return -1\n\n return value.toString().toLocaleLowerCase().indexOf(query.toString().toLocaleLowerCase())\n}\n\nexport const makeFilterProps = propsFactory({\n customFilter: Function as PropType<FilterFunction>,\n customKeyFilter: Object as PropType<FilterKeyFunctions>,\n filterKeys: [Array, String] as PropType<FilterKeys>,\n filterMode: {\n type: String as PropType<FilterMode>,\n default: 'intersection',\n },\n noFilter: Boolean,\n}, 'filter')\n\nexport function filterItems (\n items: readonly (readonly [item: InternalItem, transformed: {}])[] | readonly InternalItem[],\n query: string,\n options?: {\n customKeyFilter?: FilterKeyFunctions\n default?: FilterFunction\n filterKeys?: FilterKeys\n filterMode?: FilterMode\n noFilter?: boolean\n },\n) {\n const array: { index: number, matches: Record<string, FilterMatch> }[] = []\n // always ensure we fall back to a functioning filter\n const filter = options?.default ?? defaultFilter\n const keys = options?.filterKeys ? wrapInArray(options.filterKeys) : false\n const customFiltersLength = Object.keys(options?.customKeyFilter ?? {}).length\n\n if (!items?.length) return array\n\n loop:\n for (let i = 0; i < items.length; i++) {\n const [item, transformed = item] = wrapInArray(items[i]) as readonly [InternalItem, {}]\n const customMatches: Record<string, FilterMatch> = {}\n const defaultMatches: Record<string, FilterMatch> = {}\n let match: FilterMatch = -1\n\n if ((query || customFiltersLength > 0) && !options?.noFilter) {\n if (typeof item === 'object') {\n const filterKeys = keys || Object.keys(transformed)\n\n for (const key of filterKeys) {\n const value = getPropertyFromItem(transformed, key)\n const keyFilter = options?.customKeyFilter?.[key]\n\n match = keyFilter\n ? keyFilter(value, query, item)\n : filter(value, query, item)\n\n if (match !== -1 && match !== false) {\n if (keyFilter) customMatches[key] = match\n else defaultMatches[key] = match\n } else if (options?.filterMode === 'every') {\n continue loop\n }\n }\n } else {\n match = filter(item, query, item)\n if (match !== -1 && match !== false) {\n defaultMatches.title = match\n }\n }\n\n const defaultMatchesLength = Object.keys(defaultMatches).length\n const customMatchesLength = Object.keys(customMatches).length\n\n if (!defaultMatchesLength && !customMatchesLength) continue\n\n if (\n options?.filterMode === 'union' &&\n customMatchesLength !== customFiltersLength &&\n !defaultMatchesLength\n ) continue\n\n if (\n options?.filterMode === 'intersection' &&\n (\n customMatchesLength !== customFiltersLength ||\n !defaultMatchesLength\n )\n ) continue\n }\n\n array.push({ index: i, matches: { ...defaultMatches, ...customMatches } })\n }\n\n return array\n}\n\nexport function useFilter <T extends InternalItem> (\n props: FilterProps,\n items: MaybeRef<T[]>,\n query: Ref<string | undefined> | (() => string | undefined),\n options?: {\n transform?: (item: T) => {}\n customKeyFilter?: MaybeRef<FilterKeyFunctions | undefined>\n }\n) {\n const filteredItems: Ref<T[]> = ref([])\n const filteredMatches: Ref<Map<unknown, Record<string, FilterMatch>>> = ref(new Map())\n const transformedItems = computed(() => (\n options?.transform\n ? unref(items).map(item => ([item, options.transform!(item)] as const))\n : unref(items)\n ))\n\n watchEffect(() => {\n const _query = typeof query === 'function' ? query() : unref(query)\n const strQuery = (\n typeof _query !== 'string' &&\n typeof _query !== 'number'\n ) ? '' : String(_query)\n\n const results = filterItems(\n transformedItems.value,\n strQuery,\n {\n customKeyFilter: {\n ...props.customKeyFilter,\n ...unref(options?.customKeyFilter),\n },\n default: props.customFilter,\n filterKeys: props.filterKeys,\n filterMode: props.filterMode,\n noFilter: props.noFilter,\n },\n )\n\n const originalItems = unref(items)\n\n const _filteredItems: typeof filteredItems['value'] = []\n const _filteredMatches: typeof filteredMatches['value'] = new Map()\n results.forEach(({ index, matches }) => {\n const item = originalItems[index]\n _filteredItems.push(item)\n _filteredMatches.set(item.value, matches)\n })\n filteredItems.value = _filteredItems\n filteredMatches.value = _filteredMatches\n })\n\n function getMatches (item: T) {\n return filteredMatches.value.get(item.value)\n }\n\n return { filteredItems, filteredMatches, getMatches }\n}\n"],"mappings":"AAAA;AACA;;AAEA;AACA,SAASA,QAAQ,EAAEC,GAAG,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SAC9CC,mBAAmB,EAAEC,YAAY,EAAEC,WAAW,6BAEvD;AAIA;AACA;AACA;AACA;AACA;AACA;AAoBA;AACA,OAAO,MAAMC,aAA6B,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAK;EACnE,IAAIF,KAAK,IAAI,IAAI,IAAIC,KAAK,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAE7C,OAAOD,KAAK,CAACG,QAAQ,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACC,OAAO,CAACJ,KAAK,CAACE,QAAQ,CAAC,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED,OAAO,MAAME,eAAe,GAAGT,YAAY,CAAC;EAC1CU,YAAY,EAAEC,QAAoC;EAClDC,eAAe,EAAEC,MAAsC;EACvDC,UAAU,EAAE,CAACC,KAAK,EAAEC,MAAM,CAAyB;EACnDC,UAAU,EAAE;IACVC,IAAI,EAAEF,MAA8B;IACpCG,OAAO,E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IACxD,MAAMC,gBAAiD,GAAG,IAAIT,GAAG,CAAC,CAAC;IACnEM,OAAO,CAACI,OAAO,CAACC,IAAA,IAAwB;MAAA,IAAvB;QAAEjB,KAAK;QAAEC;MAAQ,CAAC,GAAAgB,IAAA;MACjC,MAAMtD,IAAI,GAAGkD,aAAa,CAACb,KAAK,CAAC;MACjCc,cAAc,CAACf,IAAI,CAACpC,IAAI,CAAC;MACzBoD,gBAAgB,CAACG,GAAG,CAACvD,IAAI,CAACF,KAAK,EAAEwC,OAAO,CAAC;IAC3C,CAAC,CAAC;IACFG,aAAa,CAAC3C,KAAK,GAAGqD,cAAc;IACpCT,eAAe,CAAC5C,KAAK,GAAGsD,gBAAgB;EAC1C,CAAC,CAAC;EAEF,SAASI,UAAUA,CAAExD,IAAO,EAAE;IAC5B,OAAO0C,eAAe,CAAC5C,KAAK,CAAC2D,GAAG,CAACzD,IAAI,CAACF,KAAK,CAAC;EAC9C;EAEA,OAAO;IAAE2C,aAAa;IAAEC,eAAe;IAAEc;EAAW,CAAC;AACvD","ignoreList":[]}
@@ -16,7 +16,7 @@ export const createVuetify = function () {
16
16
  ...options
17
17
  });
18
18
  };
19
- export const version = "3.6.7-master.2024-05-29";
19
+ export const version = "3.6.8-master.2024-05-31";
20
20
  createVuetify.version = version;
21
21
  export { blueprints, components, directives };
22
22
  export * from "./composables/index.mjs";
package/lib/framework.mjs CHANGED
@@ -97,7 +97,7 @@ export function createVuetify() {
97
97
  goTo
98
98
  };
99
99
  }
100
- export const version = "3.6.7-master.2024-05-29";
100
+ export const version = "3.6.8-master.2024-05-31";
101
101
  createVuetify.version = version;
102
102
 
103
103
  // Vue's inject() can only be used in setup
package/lib/index.d.mts CHANGED
@@ -496,21 +496,21 @@ declare module '@vue/runtime-core' {
496
496
  VAppBar: typeof import('vuetify/components')['VAppBar']
497
497
  VAppBarNavIcon: typeof import('vuetify/components')['VAppBarNavIcon']
498
498
  VAppBarTitle: typeof import('vuetify/components')['VAppBarTitle']
499
+ VApp: typeof import('vuetify/components')['VApp']
500
+ VAvatar: typeof import('vuetify/components')['VAvatar']
499
501
  VAlert: typeof import('vuetify/components')['VAlert']
500
502
  VAlertTitle: typeof import('vuetify/components')['VAlertTitle']
501
- VAvatar: typeof import('vuetify/components')['VAvatar']
502
503
  VAutocomplete: typeof import('vuetify/components')['VAutocomplete']
504
+ VBadge: typeof import('vuetify/components')['VBadge']
503
505
  VBanner: typeof import('vuetify/components')['VBanner']
504
506
  VBannerActions: typeof import('vuetify/components')['VBannerActions']
505
507
  VBannerText: typeof import('vuetify/components')['VBannerText']
506
- VBadge: typeof import('vuetify/components')['VBadge']
508
+ VBottomSheet: typeof import('vuetify/components')['VBottomSheet']
509
+ VBtn: typeof import('vuetify/components')['VBtn']
507
510
  VBreadcrumbs: typeof import('vuetify/components')['VBreadcrumbs']
508
511
  VBreadcrumbsItem: typeof import('vuetify/components')['VBreadcrumbsItem']
509
512
  VBreadcrumbsDivider: typeof import('vuetify/components')['VBreadcrumbsDivider']
510
513
  VBottomNavigation: typeof import('vuetify/components')['VBottomNavigation']
511
- VBtnToggle: typeof import('vuetify/components')['VBtnToggle']
512
- VBottomSheet: typeof import('vuetify/components')['VBottomSheet']
513
- VBtn: typeof import('vuetify/components')['VBtn']
514
514
  VBtnGroup: typeof import('vuetify/components')['VBtnGroup']
515
515
  VCard: typeof import('vuetify/components')['VCard']
516
516
  VCardActions: typeof import('vuetify/components')['VCardActions']
@@ -518,15 +518,23 @@ declare module '@vue/runtime-core' {
518
518
  VCardSubtitle: typeof import('vuetify/components')['VCardSubtitle']
519
519
  VCardText: typeof import('vuetify/components')['VCardText']
520
520
  VCardTitle: typeof import('vuetify/components')['VCardTitle']
521
+ VBtnToggle: typeof import('vuetify/components')['VBtnToggle']
522
+ VCheckbox: typeof import('vuetify/components')['VCheckbox']
523
+ VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
524
+ VChipGroup: typeof import('vuetify/components')['VChipGroup']
525
+ VChip: typeof import('vuetify/components')['VChip']
521
526
  VCarousel: typeof import('vuetify/components')['VCarousel']
522
527
  VCarouselItem: typeof import('vuetify/components')['VCarouselItem']
523
- VChip: typeof import('vuetify/components')['VChip']
528
+ VCombobox: typeof import('vuetify/components')['VCombobox']
524
529
  VCode: typeof import('vuetify/components')['VCode']
525
- VChipGroup: typeof import('vuetify/components')['VChipGroup']
526
- VCheckbox: typeof import('vuetify/components')['VCheckbox']
527
- VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
528
530
  VCounter: typeof import('vuetify/components')['VCounter']
529
531
  VColorPicker: typeof import('vuetify/components')['VColorPicker']
532
+ VDatePicker: typeof import('vuetify/components')['VDatePicker']
533
+ VDatePickerControls: typeof import('vuetify/components')['VDatePickerControls']
534
+ VDatePickerHeader: typeof import('vuetify/components')['VDatePickerHeader']
535
+ VDatePickerMonth: typeof import('vuetify/components')['VDatePickerMonth']
536
+ VDatePickerMonths: typeof import('vuetify/components')['VDatePickerMonths']
537
+ VDatePickerYears: typeof import('vuetify/components')['VDatePickerYears']
530
538
  VDataTable: typeof import('vuetify/components')['VDataTable']
531
539
  VDataTableHeaders: typeof import('vuetify/components')['VDataTableHeaders']
532
540
  VDataTableFooter: typeof import('vuetify/components')['VDataTableFooter']
@@ -534,33 +542,32 @@ declare module '@vue/runtime-core' {
534
542
  VDataTableRow: typeof import('vuetify/components')['VDataTableRow']
535
543
  VDataTableVirtual: typeof import('vuetify/components')['VDataTableVirtual']
536
544
  VDataTableServer: typeof import('vuetify/components')['VDataTableServer']
537
- VDatePicker: typeof import('vuetify/components')['VDatePicker']
538
- VDatePickerControls: typeof import('vuetify/components')['VDatePickerControls']
539
- VDatePickerHeader: typeof import('vuetify/components')['VDatePickerHeader']
540
- VDatePickerMonth: typeof import('vuetify/components')['VDatePickerMonth']
541
- VDatePickerMonths: typeof import('vuetify/components')['VDatePickerMonths']
542
- VDatePickerYears: typeof import('vuetify/components')['VDatePickerYears']
543
545
  VDivider: typeof import('vuetify/components')['VDivider']
544
- VCombobox: typeof import('vuetify/components')['VCombobox']
545
546
  VEmptyState: typeof import('vuetify/components')['VEmptyState']
547
+ VFab: typeof import('vuetify/components')['VFab']
548
+ VField: typeof import('vuetify/components')['VField']
549
+ VFieldLabel: typeof import('vuetify/components')['VFieldLabel']
546
550
  VDialog: typeof import('vuetify/components')['VDialog']
547
551
  VFileInput: typeof import('vuetify/components')['VFileInput']
548
552
  VExpansionPanels: typeof import('vuetify/components')['VExpansionPanels']
549
553
  VExpansionPanel: typeof import('vuetify/components')['VExpansionPanel']
550
554
  VExpansionPanelText: typeof import('vuetify/components')['VExpansionPanelText']
551
555
  VExpansionPanelTitle: typeof import('vuetify/components')['VExpansionPanelTitle']
552
- VField: typeof import('vuetify/components')['VField']
553
- VFieldLabel: typeof import('vuetify/components')['VFieldLabel']
554
556
  VFooter: typeof import('vuetify/components')['VFooter']
555
- VFab: typeof import('vuetify/components')['VFab']
557
+ VImg: typeof import('vuetify/components')['VImg']
556
558
  VIcon: typeof import('vuetify/components')['VIcon']
557
559
  VComponentIcon: typeof import('vuetify/components')['VComponentIcon']
558
560
  VSvgIcon: typeof import('vuetify/components')['VSvgIcon']
559
561
  VLigatureIcon: typeof import('vuetify/components')['VLigatureIcon']
560
562
  VClassIcon: typeof import('vuetify/components')['VClassIcon']
561
- VInput: typeof import('vuetify/components')['VInput']
562
- VImg: typeof import('vuetify/components')['VImg']
563
563
  VInfiniteScroll: typeof import('vuetify/components')['VInfiniteScroll']
564
+ VInput: typeof import('vuetify/components')['VInput']
565
+ VLabel: typeof import('vuetify/components')['VLabel']
566
+ VItemGroup: typeof import('vuetify/components')['VItemGroup']
567
+ VItem: typeof import('vuetify/components')['VItem']
568
+ VKbd: typeof import('vuetify/components')['VKbd']
569
+ VMain: typeof import('vuetify/components')['VMain']
570
+ VMenu: typeof import('vuetify/components')['VMenu']
564
571
  VList: typeof import('vuetify/components')['VList']
565
572
  VListGroup: typeof import('vuetify/components')['VListGroup']
566
573
  VListImg: typeof import('vuetify/components')['VListImg']
@@ -570,77 +577,70 @@ declare module '@vue/runtime-core' {
570
577
  VListItemSubtitle: typeof import('vuetify/components')['VListItemSubtitle']
571
578
  VListItemTitle: typeof import('vuetify/components')['VListItemTitle']
572
579
  VListSubheader: typeof import('vuetify/components')['VListSubheader']
573
- VLabel: typeof import('vuetify/components')['VLabel']
574
- VItemGroup: typeof import('vuetify/components')['VItemGroup']
575
- VItem: typeof import('vuetify/components')['VItem']
576
- VKbd: typeof import('vuetify/components')['VKbd']
577
580
  VMessages: typeof import('vuetify/components')['VMessages']
578
- VMain: typeof import('vuetify/components')['VMain']
579
- VMenu: typeof import('vuetify/components')['VMenu']
580
581
  VOtpInput: typeof import('vuetify/components')['VOtpInput']
581
- VPagination: typeof import('vuetify/components')['VPagination']
582
- VOverlay: typeof import('vuetify/components')['VOverlay']
583
582
  VNavigationDrawer: typeof import('vuetify/components')['VNavigationDrawer']
583
+ VOverlay: typeof import('vuetify/components')['VOverlay']
584
584
  VProgressCircular: typeof import('vuetify/components')['VProgressCircular']
585
+ VPagination: typeof import('vuetify/components')['VPagination']
585
586
  VProgressLinear: typeof import('vuetify/components')['VProgressLinear']
586
587
  VRadioGroup: typeof import('vuetify/components')['VRadioGroup']
587
- VRating: typeof import('vuetify/components')['VRating']
588
588
  VSelect: typeof import('vuetify/components')['VSelect']
589
- VSheet: typeof import('vuetify/components')['VSheet']
589
+ VRating: typeof import('vuetify/components')['VRating']
590
590
  VSelectionControl: typeof import('vuetify/components')['VSelectionControl']
591
- VSkeletonLoader: typeof import('vuetify/components')['VSkeletonLoader']
592
591
  VSelectionControlGroup: typeof import('vuetify/components')['VSelectionControlGroup']
593
- VSlideGroup: typeof import('vuetify/components')['VSlideGroup']
594
- VSlideGroupItem: typeof import('vuetify/components')['VSlideGroupItem']
592
+ VSheet: typeof import('vuetify/components')['VSheet']
593
+ VSkeletonLoader: typeof import('vuetify/components')['VSkeletonLoader']
595
594
  VSlider: typeof import('vuetify/components')['VSlider']
596
595
  VSnackbar: typeof import('vuetify/components')['VSnackbar']
597
- VSystemBar: typeof import('vuetify/components')['VSystemBar']
598
- VSwitch: typeof import('vuetify/components')['VSwitch']
599
- VTab: typeof import('vuetify/components')['VTab']
600
- VTabs: typeof import('vuetify/components')['VTabs']
601
- VTabsWindow: typeof import('vuetify/components')['VTabsWindow']
602
- VTabsWindowItem: typeof import('vuetify/components')['VTabsWindowItem']
596
+ VSlideGroup: typeof import('vuetify/components')['VSlideGroup']
597
+ VSlideGroupItem: typeof import('vuetify/components')['VSlideGroupItem']
603
598
  VStepper: typeof import('vuetify/components')['VStepper']
604
599
  VStepperActions: typeof import('vuetify/components')['VStepperActions']
605
600
  VStepperHeader: typeof import('vuetify/components')['VStepperHeader']
606
601
  VStepperItem: typeof import('vuetify/components')['VStepperItem']
607
602
  VStepperWindow: typeof import('vuetify/components')['VStepperWindow']
608
603
  VStepperWindowItem: typeof import('vuetify/components')['VStepperWindowItem']
609
- VToolbar: typeof import('vuetify/components')['VToolbar']
610
- VToolbarTitle: typeof import('vuetify/components')['VToolbarTitle']
611
- VToolbarItems: typeof import('vuetify/components')['VToolbarItems']
604
+ VSystemBar: typeof import('vuetify/components')['VSystemBar']
612
605
  VTable: typeof import('vuetify/components')['VTable']
606
+ VTab: typeof import('vuetify/components')['VTab']
607
+ VTabs: typeof import('vuetify/components')['VTabs']
608
+ VTabsWindow: typeof import('vuetify/components')['VTabsWindow']
609
+ VTabsWindowItem: typeof import('vuetify/components')['VTabsWindowItem']
610
+ VTextarea: typeof import('vuetify/components')['VTextarea']
611
+ VSwitch: typeof import('vuetify/components')['VSwitch']
613
612
  VTextField: typeof import('vuetify/components')['VTextField']
614
613
  VTimeline: typeof import('vuetify/components')['VTimeline']
615
614
  VTimelineItem: typeof import('vuetify/components')['VTimelineItem']
616
- VTextarea: typeof import('vuetify/components')['VTextarea']
617
615
  VTooltip: typeof import('vuetify/components')['VTooltip']
618
616
  VWindow: typeof import('vuetify/components')['VWindow']
619
617
  VWindowItem: typeof import('vuetify/components')['VWindowItem']
620
- VApp: typeof import('vuetify/components')['VApp']
618
+ VToolbar: typeof import('vuetify/components')['VToolbar']
619
+ VToolbarTitle: typeof import('vuetify/components')['VToolbarTitle']
620
+ VToolbarItems: typeof import('vuetify/components')['VToolbarItems']
621
621
  VConfirmEdit: typeof import('vuetify/components')['VConfirmEdit']
622
622
  VDataIterator: typeof import('vuetify/components')['VDataIterator']
623
623
  VDefaultsProvider: typeof import('vuetify/components')['VDefaultsProvider']
624
+ VForm: typeof import('vuetify/components')['VForm']
624
625
  VContainer: typeof import('vuetify/components')['VContainer']
625
626
  VCol: typeof import('vuetify/components')['VCol']
626
627
  VRow: typeof import('vuetify/components')['VRow']
627
628
  VSpacer: typeof import('vuetify/components')['VSpacer']
628
- VForm: typeof import('vuetify/components')['VForm']
629
629
  VHover: typeof import('vuetify/components')['VHover']
630
- VLazy: typeof import('vuetify/components')['VLazy']
631
630
  VLayout: typeof import('vuetify/components')['VLayout']
632
631
  VLayoutItem: typeof import('vuetify/components')['VLayoutItem']
632
+ VLazy: typeof import('vuetify/components')['VLazy']
633
633
  VLocaleProvider: typeof import('vuetify/components')['VLocaleProvider']
634
634
  VNoSsr: typeof import('vuetify/components')['VNoSsr']
635
635
  VParallax: typeof import('vuetify/components')['VParallax']
636
636
  VRadio: typeof import('vuetify/components')['VRadio']
637
637
  VRangeSlider: typeof import('vuetify/components')['VRangeSlider']
638
638
  VResponsive: typeof import('vuetify/components')['VResponsive']
639
- VSparkline: typeof import('vuetify/components')['VSparkline']
640
639
  VSpeedDial: typeof import('vuetify/components')['VSpeedDial']
640
+ VSparkline: typeof import('vuetify/components')['VSparkline']
641
641
  VThemeProvider: typeof import('vuetify/components')['VThemeProvider']
642
- VValidation: typeof import('vuetify/components')['VValidation']
643
642
  VVirtualScroll: typeof import('vuetify/components')['VVirtualScroll']
643
+ VValidation: typeof import('vuetify/components')['VValidation']
644
644
  VFabTransition: typeof import('vuetify/components')['VFabTransition']
645
645
  VDialogBottomTransition: typeof import('vuetify/components')['VDialogBottomTransition']
646
646
  VDialogTopTransition: typeof import('vuetify/components')['VDialogTopTransition']
@@ -657,24 +657,24 @@ declare module '@vue/runtime-core' {
657
657
  VExpandTransition: typeof import('vuetify/components')['VExpandTransition']
658
658
  VExpandXTransition: typeof import('vuetify/components')['VExpandXTransition']
659
659
  VDialogTransition: typeof import('vuetify/components')['VDialogTransition']
660
+ VStepperVertical: typeof import('vuetify/labs/components')['VStepperVertical']
661
+ VStepperVerticalItem: typeof import('vuetify/labs/components')['VStepperVerticalItem']
662
+ VStepperVerticalActions: typeof import('vuetify/labs/components')['VStepperVerticalActions']
663
+ VPicker: typeof import('vuetify/labs/components')['VPicker']
664
+ VPickerTitle: typeof import('vuetify/labs/components')['VPickerTitle']
665
+ VNumberInput: typeof import('vuetify/labs/components')['VNumberInput']
660
666
  VCalendar: typeof import('vuetify/labs/components')['VCalendar']
661
667
  VCalendarDay: typeof import('vuetify/labs/components')['VCalendarDay']
662
668
  VCalendarHeader: typeof import('vuetify/labs/components')['VCalendarHeader']
663
669
  VCalendarInterval: typeof import('vuetify/labs/components')['VCalendarInterval']
664
670
  VCalendarIntervalEvent: typeof import('vuetify/labs/components')['VCalendarIntervalEvent']
665
671
  VCalendarMonthDay: typeof import('vuetify/labs/components')['VCalendarMonthDay']
666
- VNumberInput: typeof import('vuetify/labs/components')['VNumberInput']
667
- VTreeview: typeof import('vuetify/labs/components')['VTreeview']
668
- VTreeviewItem: typeof import('vuetify/labs/components')['VTreeviewItem']
669
- VTreeviewGroup: typeof import('vuetify/labs/components')['VTreeviewGroup']
670
- VStepperVertical: typeof import('vuetify/labs/components')['VStepperVertical']
671
- VStepperVerticalItem: typeof import('vuetify/labs/components')['VStepperVerticalItem']
672
- VStepperVerticalActions: typeof import('vuetify/labs/components')['VStepperVerticalActions']
673
- VPicker: typeof import('vuetify/labs/components')['VPicker']
674
- VPickerTitle: typeof import('vuetify/labs/components')['VPickerTitle']
675
672
  VTimePicker: typeof import('vuetify/labs/components')['VTimePicker']
676
673
  VTimePickerClock: typeof import('vuetify/labs/components')['VTimePickerClock']
677
674
  VTimePickerControls: typeof import('vuetify/labs/components')['VTimePickerControls']
675
+ VTreeview: typeof import('vuetify/labs/components')['VTreeview']
676
+ VTreeviewItem: typeof import('vuetify/labs/components')['VTreeviewItem']
677
+ VTreeviewGroup: typeof import('vuetify/labs/components')['VTreeviewGroup']
678
678
  VDateInput: typeof import('vuetify/labs/components')['VDateInput']
679
679
  VPullToRefresh: typeof import('vuetify/labs/components')['VPullToRefresh']
680
680
  VSnackbarQueue: typeof import('vuetify/labs/components')['VSnackbarQueue']
@@ -26,7 +26,7 @@ export const makeVTreeviewProps = propsFactory({
26
26
  ...omit(makeVListProps({
27
27
  collapseIcon: '$treeviewCollapse',
28
28
  expandIcon: '$treeviewExpand',
29
- selectStrategy: 'independent',
29
+ selectStrategy: 'classic',
30
30
  openStrategy: 'multiple',
31
31
  slim: true
32
32
  }), ['nav'])
@@ -1 +1 @@
1
- {"version":3,"file":"VTreeview.mjs","names":["makeVTreeviewChildrenProps","VTreeviewChildren","makeVListProps","useListItems","VList","provideDefaults","makeFilterProps","useFilter","useProxiedModel","computed","provide","ref","toRef","watch","genericComponent","omit","propsFactory","useRender","VTreeviewSymbol","flatten","items","flat","arguments","length","undefined","item","push","children","makeVTreeviewProps","openAll","Boolean","search","String","filterKeys","collapseIcon","expandIcon","selectStrategy","openStrategy","slim","VTreeview","name","props","emits","val","value","setup","_ref","slots","activeColor","baseColor","color","opened","activated","selected","vListRef","flatItems","filteredItems","visibleIds","Set","flatMap","getPath","getChildren","id","path","parent","unshift","parents","get","arr","queue","slice","child","shift","immediate","ids","i","concat","VTreeviewGroup","VTreeviewItem","activeClass","density","disabled","lines","variant","listProps","filterProps","treeviewChildrenProps","_createVNode","_mergeProps","class","style","$event","default","open"],"sources":["../../../src/labs/VTreeview/VTreeview.tsx"],"sourcesContent":["// Components\nimport { makeVTreeviewChildrenProps, VTreeviewChildren } from './VTreeviewChildren'\nimport { makeVListProps, useListItems, VList } from '@/components/VList/VList'\n\n// Composables\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeFilterProps, useFilter } from '@/composables/filter'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, provide, ref, toRef, watch } from 'vue'\nimport { genericComponent, omit, propsFactory, useRender } from '@/util'\n\n// Types\nimport { VTreeviewSymbol } from './shared'\nimport type { VListChildrenSlots } from '@/components/VList/VListChildren'\nimport type { ListItem } from '@/composables/list-items'\nimport type { GenericProps } from '@/util'\n\nfunction flatten (items: ListItem[], flat: ListItem[] = []) {\n for (const item of items) {\n flat.push(item)\n if (item.children) flatten(item.children, flat)\n }\n return flat\n}\n\nexport const makeVTreeviewProps = propsFactory({\n openAll: Boolean,\n search: String,\n\n ...makeFilterProps({ filterKeys: ['title'] }),\n ...makeVTreeviewChildrenProps(),\n ...omit(makeVListProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand',\n selectStrategy: 'independent' as const,\n openStrategy: 'multiple' as const,\n slim: true,\n }), ['nav']),\n}, 'VTreeview')\n\nexport const VTreeview = genericComponent<new <T>(\n props: {\n items?: T[]\n },\n slots: VListChildrenSlots<T>\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VTreeview',\n\n props: makeVTreeviewProps(),\n\n emits: {\n 'update:opened': (val: unknown) => true,\n 'update:activated': (val: unknown) => true,\n 'update:selected': (val: unknown) => true,\n 'click:open': (value: { id: unknown, value: boolean, path: unknown[] }) => true,\n 'click:select': (value: { id: unknown, value: boolean, path: unknown[] }) => true,\n },\n\n setup (props, { slots }) {\n const { items } = useListItems(props)\n const activeColor = toRef(props, 'activeColor')\n const baseColor = toRef(props, 'baseColor')\n const color = toRef(props, 'color')\n const opened = useProxiedModel(props, 'opened')\n const activated = useProxiedModel(props, 'activated')\n const selected = useProxiedModel(props, 'selected')\n\n const vListRef = ref<VList>()\n\n const flatItems = computed(() => flatten(items.value))\n const search = toRef(props, 'search')\n const { filteredItems } = useFilter(props, flatItems, search)\n const visibleIds = computed(() => {\n if (!search.value) {\n return null\n }\n return new Set(filteredItems.value.flatMap(item => {\n return [...getPath(item.props.value), ...getChildren(item.props.value)]\n }))\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n while (parent != null) {\n path.unshift(parent)\n parent = vListRef.value?.parents.get(parent)\n }\n return path\n }\n\n function getChildren (id: unknown) {\n const arr: unknown[] = []\n const queue = ((vListRef.value?.children.get(id) ?? []).slice())\n while (queue.length) {\n const child = queue.shift()\n if (!child) continue\n arr.push(child)\n queue.push(...((vListRef.value?.children.get(child) ?? []).slice()))\n }\n return arr\n }\n\n watch(() => props.openAll, val => {\n opened.value = val ? openAll(items.value) : []\n }, { immediate: true })\n\n function openAll (item: any) {\n let ids: number[] = []\n\n for (const i of item) {\n if (!i.children) continue\n\n ids.push(i.value)\n\n if (i.children) {\n ids = ids.concat(openAll(i.children))\n }\n }\n\n return ids\n }\n\n provide(VTreeviewSymbol, { visibleIds })\n\n provideDefaults({\n VTreeviewGroup: {\n activeColor,\n baseColor,\n color,\n collapseIcon: toRef(props, 'collapseIcon'),\n expandIcon: toRef(props, 'expandIcon'),\n },\n VTreeviewItem: {\n activeClass: toRef(props, 'activeClass'),\n activeColor,\n baseColor,\n color,\n density: toRef(props, 'density'),\n disabled: toRef(props, 'disabled'),\n lines: toRef(props, 'lines'),\n variant: toRef(props, 'variant'),\n },\n })\n\n useRender(() => {\n const listProps = VList.filterProps(props)\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props)\n\n return (\n <VList\n ref={ vListRef }\n { ...listProps }\n class={[\n 'v-treeview',\n props.class,\n ]}\n style={ props.style }\n v-model:opened={ opened.value }\n v-model:activated={ activated.value }\n v-model:selected={ selected.value }\n >\n <VTreeviewChildren\n { ...treeviewChildrenProps }\n items={ items.value }\n v-slots={ slots }\n ></VTreeviewChildren>\n </VList>\n )\n })\n\n return {\n open,\n }\n },\n})\n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EFxB,SAAS,CAAC,MAAM;MACd,MAAMmE,SAAS,GAAGhF,KAAK,CAACiF,WAAW,CAAC5C,KAAK,CAAC;MAC1C,MAAM6C,qBAAqB,GAAGrF,iBAAiB,CAACoF,WAAW,CAAC5C,KAAK,CAAC;MAElE,OAAA8C,YAAA,CAAAnF,KAAA,EAAAoF,WAAA;QAAA,OAEUlC;MAAQ,GACT8B,SAAS;QAAA,SACP,CACL,YAAY,EACZ3C,KAAK,CAACgD,KAAK,CACZ;QAAA,SACOhD,KAAK,CAACiD,KAAK;QAAA,UACFvC,MAAM,CAACP,KAAK;QAAA,mBAAA+C,MAAA,IAAZxC,MAAM,CAACP,KAAK,GAAA+C,MAAA;QAAA,aACTvC,SAAS,CAACR,KAAK;QAAA,sBAAA+C,MAAA,IAAfvC,SAAS,CAACR,KAAK,GAAA+C,MAAA;QAAA,YAChBtC,QAAQ,CAACT,KAAK;QAAA,qBAAA+C,MAAA,IAAdtC,QAAQ,CAACT,KAAK,GAAA+C;MAAA;QAAAC,OAAA,EAAAA,CAAA,MAAAL,YAAA,CAAAtF,iBAAA,EAAAuF,WAAA,CAG1BF,qBAAqB;UAAA,SAClBlE,KAAK,CAACwB;QAAK,IACTG,KAAK;MAAA;IAIvB,CAAC,CAAC;IAEF,OAAO;MACL8C;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VTreeview.mjs","names":["makeVTreeviewChildrenProps","VTreeviewChildren","makeVListProps","useListItems","VList","provideDefaults","makeFilterProps","useFilter","useProxiedModel","computed","provide","ref","toRef","watch","genericComponent","omit","propsFactory","useRender","VTreeviewSymbol","flatten","items","flat","arguments","length","undefined","item","push","children","makeVTreeviewProps","openAll","Boolean","search","String","filterKeys","collapseIcon","expandIcon","selectStrategy","openStrategy","slim","VTreeview","name","props","emits","val","value","setup","_ref","slots","activeColor","baseColor","color","opened","activated","selected","vListRef","flatItems","filteredItems","visibleIds","Set","flatMap","getPath","getChildren","id","path","parent","unshift","parents","get","arr","queue","slice","child","shift","immediate","ids","i","concat","VTreeviewGroup","VTreeviewItem","activeClass","density","disabled","lines","variant","listProps","filterProps","treeviewChildrenProps","_createVNode","_mergeProps","class","style","$event","default","open"],"sources":["../../../src/labs/VTreeview/VTreeview.tsx"],"sourcesContent":["// Components\nimport { makeVTreeviewChildrenProps, VTreeviewChildren } from './VTreeviewChildren'\nimport { makeVListProps, useListItems, VList } from '@/components/VList/VList'\n\n// Composables\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeFilterProps, useFilter } from '@/composables/filter'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, provide, ref, toRef, watch } from 'vue'\nimport { genericComponent, omit, propsFactory, useRender } from '@/util'\n\n// Types\nimport { VTreeviewSymbol } from './shared'\nimport type { VListChildrenSlots } from '@/components/VList/VListChildren'\nimport type { ListItem } from '@/composables/list-items'\nimport type { GenericProps } from '@/util'\n\nfunction flatten (items: ListItem[], flat: ListItem[] = []) {\n for (const item of items) {\n flat.push(item)\n if (item.children) flatten(item.children, flat)\n }\n return flat\n}\n\nexport const makeVTreeviewProps = propsFactory({\n openAll: Boolean,\n search: String,\n\n ...makeFilterProps({ filterKeys: ['title'] }),\n ...makeVTreeviewChildrenProps(),\n ...omit(makeVListProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand',\n selectStrategy: 'classic' as const,\n openStrategy: 'multiple' as const,\n slim: true,\n }), ['nav']),\n}, 'VTreeview')\n\nexport const VTreeview = genericComponent<new <T>(\n props: {\n items?: T[]\n },\n slots: VListChildrenSlots<T>\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VTreeview',\n\n props: makeVTreeviewProps(),\n\n emits: {\n 'update:opened': (val: unknown) => true,\n 'update:activated': (val: unknown) => true,\n 'update:selected': (val: unknown) => true,\n 'click:open': (value: { id: unknown, value: boolean, path: unknown[] }) => true,\n 'click:select': (value: { id: unknown, value: boolean, path: unknown[] }) => true,\n },\n\n setup (props, { slots }) {\n const { items } = useListItems(props)\n const activeColor = toRef(props, 'activeColor')\n const baseColor = toRef(props, 'baseColor')\n const color = toRef(props, 'color')\n const opened = useProxiedModel(props, 'opened')\n const activated = useProxiedModel(props, 'activated')\n const selected = useProxiedModel(props, 'selected')\n\n const vListRef = ref<VList>()\n\n const flatItems = computed(() => flatten(items.value))\n const search = toRef(props, 'search')\n const { filteredItems } = useFilter(props, flatItems, search)\n const visibleIds = computed(() => {\n if (!search.value) {\n return null\n }\n return new Set(filteredItems.value.flatMap(item => {\n return [...getPath(item.props.value), ...getChildren(item.props.value)]\n }))\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n while (parent != null) {\n path.unshift(parent)\n parent = vListRef.value?.parents.get(parent)\n }\n return path\n }\n\n function getChildren (id: unknown) {\n const arr: unknown[] = []\n const queue = ((vListRef.value?.children.get(id) ?? []).slice())\n while (queue.length) {\n const child = queue.shift()\n if (!child) continue\n arr.push(child)\n queue.push(...((vListRef.value?.children.get(child) ?? []).slice()))\n }\n return arr\n }\n\n watch(() => props.openAll, val => {\n opened.value = val ? openAll(items.value) : []\n }, { immediate: true })\n\n function openAll (item: any) {\n let ids: number[] = []\n\n for (const i of item) {\n if (!i.children) continue\n\n ids.push(i.value)\n\n if (i.children) {\n ids = ids.concat(openAll(i.children))\n }\n }\n\n return ids\n }\n\n provide(VTreeviewSymbol, { visibleIds })\n\n provideDefaults({\n VTreeviewGroup: {\n activeColor,\n baseColor,\n color,\n collapseIcon: toRef(props, 'collapseIcon'),\n expandIcon: toRef(props, 'expandIcon'),\n },\n VTreeviewItem: {\n activeClass: toRef(props, 'activeClass'),\n activeColor,\n baseColor,\n color,\n density: toRef(props, 'density'),\n disabled: toRef(props, 'disabled'),\n lines: toRef(props, 'lines'),\n variant: toRef(props, 'variant'),\n },\n })\n\n useRender(() => {\n const listProps = VList.filterProps(props)\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props)\n\n return (\n <VList\n ref={ vListRef }\n { ...listProps }\n class={[\n 'v-treeview',\n props.class,\n ]}\n style={ props.style }\n v-model:opened={ opened.value }\n v-model:activated={ activated.value }\n v-model:selected={ selected.value }\n >\n <VTreeviewChildren\n { ...treeviewChildrenProps }\n items={ items.value }\n v-slots={ slots }\n ></VTreeviewChildren>\n </VList>\n )\n })\n\n return {\n open,\n }\n },\n})\n\nexport type VTreeview = InstanceType<typeof VTreeview>\n"],"mappings":";AAAA;AAAA,SACSA,0BAA0B,EAAEC,iBAAiB;AAAA,SAC7CC,cAAc,EAAEC,YAAY,EAAEC,KAAK,4CAE5C;AAAA,SACSC,eAAe;AAAA,SACfC,eAAe,EAAEC,SAAS;AAAA,SAC1BC,eAAe,8CAExB;AACA,SAASC,QAAQ,EAAEC,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACjDC,gBAAgB,EAAEC,IAAI,EAAEC,YAAY,EAAEC,SAAS,gCAExD;AAAA,SACSC,eAAe;AAKxB,SAASC,OAAOA,CAAEC,KAAiB,EAAyB;EAAA,IAAvBC,IAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACxD,KAAK,MAAMG,IAAI,IAAIL,KAAK,EAAE;IACxBC,IAAI,CAACK,IAAI,CAACD,IAAI,CAAC;IACf,IAAIA,IAAI,CAACE,QAAQ,EAAER,OAAO,CAACM,IAAI,CAACE,QAAQ,EAAEN,IAAI,CAAC;EACjD;EACA,OAAOA,IAAI;AACb;AAEA,OAAO,MAAMO,kBAAkB,GAAGZ,YAAY,CAAC;EAC7Ca,OAAO,EAAEC,OAAO;EAChBC,MAAM,EAAEC,MAAM;EAEd,GAAG1B,eAAe,CAAC;IAAE2B,UAAU,EAAE,CAAC,OAAO;EAAE,CAAC,CAAC;EAC7C,GAAGjC,0BAA0B,CAAC,CAAC;EAC/B,GAAGe,IAAI,CAACb,cAAc,CAAC;IACrBgC,YAAY,E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AK,EAAE,SAAS,CAAC;QAChCwC,QAAQ,EAAErE,KAAK,CAAC6B,KAAK,EAAE,UAAU,CAAC;QAClCyC,KAAK,EAAEtE,KAAK,CAAC6B,KAAK,EAAE,OAAO,CAAC;QAC5B0C,OAAO,EAAEvE,KAAK,CAAC6B,KAAK,EAAE,SAAS;MACjC;IACF,CAAC,CAAC;IAEFxB,SAAS,CAAC,MAAM;MACd,MAAMmE,SAAS,GAAGhF,KAAK,CAACiF,WAAW,CAAC5C,KAAK,CAAC;MAC1C,MAAM6C,qBAAqB,GAAGrF,iBAAiB,CAACoF,WAAW,CAAC5C,KAAK,CAAC;MAElE,OAAA8C,YAAA,CAAAnF,KAAA,EAAAoF,WAAA;QAAA,OAEUlC;MAAQ,GACT8B,SAAS;QAAA,SACP,CACL,YAAY,EACZ3C,KAAK,CAACgD,KAAK,CACZ;QAAA,SACOhD,KAAK,CAACiD,KAAK;QAAA,UACFvC,MAAM,CAACP,KAAK;QAAA,mBAAA+C,MAAA,IAAZxC,MAAM,CAACP,KAAK,GAAA+C,MAAA;QAAA,aACTvC,SAAS,CAACR,KAAK;QAAA,sBAAA+C,MAAA,IAAfvC,SAAS,CAACR,KAAK,GAAA+C,MAAA;QAAA,YAChBtC,QAAQ,CAACT,KAAK;QAAA,qBAAA+C,MAAA,IAAdtC,QAAQ,CAACT,KAAK,GAAA+C;MAAA;QAAAC,OAAA,EAAAA,CAAA,MAAAL,YAAA,CAAAtF,iBAAA,EAAAuF,WAAA,CAG1BF,qBAAqB;UAAA,SAClBlE,KAAK,CAACwB;QAAK,IACTG,KAAK;MAAA;IAIvB,CAAC,CAAC;IAEF,OAAO;MACL8C;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { mergeProps as _mergeProps, resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue";
1
+ import { mergeProps as _mergeProps, resolveDirective as _resolveDirective, createVNode as _createVNode, Fragment as _Fragment } from "vue";
2
2
  // Components
3
3
  import { VTreeviewGroup } from "./VTreeviewGroup.mjs";
4
4
  import { VTreeviewItem } from "./VTreeviewItem.mjs";
5
5
  import { VCheckboxBtn } from "../../components/VCheckbox/index.mjs"; // Utilities
6
- import { shallowRef } from 'vue';
6
+ import { shallowRef, withModifiers } from 'vue';
7
7
  import { genericComponent, propsFactory } from "../../util/index.mjs"; // Types
8
8
  export const makeVTreeviewChildrenProps = propsFactory({
9
9
  loadChildren: Function,
@@ -12,7 +12,8 @@ export const makeVTreeviewChildrenProps = propsFactory({
12
12
  default: '$loading'
13
13
  },
14
14
  items: Array,
15
- selectable: Boolean
15
+ selectable: Boolean,
16
+ selectStrategy: [String, Function, Object]
16
17
  }, 'VTreeviewChildren');
17
18
  export const VTreeviewChildren = genericComponent()({
18
19
  name: 'VTreeviewChildren',
@@ -36,9 +37,10 @@ export const VTreeviewChildren = genericComponent()({
36
37
  isLoading.value = null;
37
38
  });
38
39
  }
39
- function onClick(e, item) {
40
- e.stopPropagation();
41
- checkChildren(item);
40
+ function selectItem(select, isSelected) {
41
+ if (props.selectable) {
42
+ select(!isSelected);
43
+ }
42
44
  }
43
45
  return () => slots.default?.() ?? props.items?.map(_ref2 => {
44
46
  let {
@@ -48,23 +50,21 @@ export const VTreeviewChildren = genericComponent()({
48
50
  } = _ref2;
49
51
  const loading = isLoading.value === item.value;
50
52
  const slotsWithItem = {
51
- prepend: slots.prepend ? slotProps => slots.prepend?.({
53
+ prepend: slotProps => _createVNode(_Fragment, null, [props.selectable && (!children || children && !['leaf', 'single-leaf'].includes(props.selectStrategy)) && _createVNode("div", null, [_createVNode(VCheckboxBtn, {
54
+ "key": item.value,
55
+ "modelValue": slotProps.isSelected,
56
+ "loading": loading,
57
+ "indeterminate": slotProps.isIndeterminate,
58
+ "onClick": withModifiers(() => selectItem(slotProps.select, slotProps.isSelected), ['stop']),
59
+ "onKeydown": e => {
60
+ if (!['Enter', 'Space'].includes(e.key)) return;
61
+ e.stopPropagation();
62
+ selectItem(slotProps.select, slotProps.isSelected);
63
+ }
64
+ }, null)]), slots.prepend?.({
52
65
  ...slotProps,
53
66
  item
54
- }) : props.selectable ? _ref3 => {
55
- let {
56
- isSelected,
57
- isIndeterminate
58
- } = _ref3;
59
- return _createVNode(VCheckboxBtn, {
60
- "key": item.value,
61
- "tabindex": "-1",
62
- "modelValue": isSelected,
63
- "loading": loading,
64
- "indeterminate": isIndeterminate,
65
- "onClick": e => onClick(e, item)
66
- }, null);
67
- } : undefined,
67
+ })]),
68
68
  append: slots.append ? slotProps => slots.append?.({
69
69
  ...slotProps,
70
70
  item
@@ -79,13 +79,18 @@ export const VTreeviewChildren = genericComponent()({
79
79
  return children ? _createVNode(VTreeviewGroup, _mergeProps({
80
80
  "value": itemProps?.value
81
81
  }, treeviewGroupProps), {
82
- activator: _ref4 => {
82
+ activator: _ref3 => {
83
83
  let {
84
84
  props: activatorProps
85
- } = _ref4;
86
- return _createVNode(VTreeviewItem, _mergeProps(itemProps, activatorProps, {
85
+ } = _ref3;
86
+ const listItemProps = {
87
+ ...itemProps,
88
+ ...activatorProps,
89
+ value: itemProps?.value
90
+ };
91
+ return _createVNode(VTreeviewItem, _mergeProps(listItemProps, {
87
92
  "loading": loading,
88
- "onClick": e => onClick(e, item)
93
+ "onClick": () => checkChildren(item)
89
94
  }), slotsWithItem);
90
95
  },
91
96
  default: () => _createVNode(VTreeviewChildren, _mergeProps(treeviewChildrenProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"VTreeviewChildren.mjs","names":["VTreeviewGroup","VTreeviewItem","VCheckboxBtn","shallowRef","genericComponent","propsFactory","makeVTreeviewChildrenProps","loadChildren","Function","loadingIcon","type","String","default","items","Array","selectable","Boolean","VTreeviewChildren","name","props","setup","_ref","emit","slots","isLoading","checkChildren","item","Promise","resolve","length","children","value","then","finally","onClick","e","stopPropagation","map","_ref2","itemProps","raw","loading","slotsWithItem","prepend","slotProps","_ref3","isSelected","isIndeterminate","_createVNode","undefined","append","title","treeviewGroupProps","filterProps","treeviewChildrenProps","_mergeProps","activator","_ref4","activatorProps"],"sources":["../../../src/labs/VTreeview/VTreeviewChildren.tsx"],"sourcesContent":["// Components\nimport { VTreeviewGroup } from './VTreeviewGroup'\nimport { VTreeviewItem } from './VTreeviewItem'\nimport { VCheckboxBtn } from '@/components/VCheckbox'\n\n// Utilities\nimport { shallowRef } from 'vue'\nimport { genericComponent, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { InternalListItem } from '@/components/VList/VList'\nimport type { VListItemSlots } from '@/components/VList/VListItem'\nimport type { GenericProps } from '@/util'\n\nexport type VTreeviewChildrenSlots<T> = {\n [K in keyof Omit<VListItemSlots, 'default'>]: VListItemSlots[K] & { item: T }\n} & {\n default: never\n item: { props: InternalListItem['props'] }\n}\n\nexport const makeVTreeviewChildrenProps = propsFactory({\n loadChildren: Function as PropType<(item: unknown) => Promise<void>>,\n loadingIcon: {\n type: String,\n default: '$loading',\n },\n items: Array as PropType<readonly InternalListItem[]>,\n selectable: Boolean,\n}, 'VTreeviewChildren')\n\nexport const VTreeviewChildren = genericComponent<new <T extends InternalListItem>(\n props: {\n items?: readonly T[]\n },\n slots: VTreeviewChildrenSlots<T>\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VTreeviewChildren',\n\n props: makeVTreeviewChildrenProps(),\n\n setup (props, { emit, slots }) {\n const isLoading = shallowRef(null)\n\n function checkChildren (item: any) {\n return new Promise<void>(resolve => {\n if (!props.items?.length || !props.loadChildren) return resolve()\n\n if (item?.children?.length === 0) {\n isLoading.value = item.value\n props.loadChildren(item).then(resolve)\n\n return\n }\n\n resolve()\n }).finally(() => {\n isLoading.value = null\n })\n }\n\n function onClick (e: MouseEvent | KeyboardEvent, item: any) {\n e.stopPropagation()\n\n checkChildren(item)\n }\n\n return () => slots.default?.() ?? props.items?.map(({ children, props: itemProps, raw: item }) => {\n const loading = isLoading.value === item.value\n const slotsWithItem = {\n prepend: slots.prepend\n ? slotProps => slots.prepend?.({ ...slotProps, item })\n : props.selectable\n ? ({ isSelected, isIndeterminate }) => (\n <VCheckboxBtn\n key={ item.value }\n tabindex=\"-1\"\n modelValue={ isSelected }\n loading={ loading }\n indeterminate={ isIndeterminate }\n onClick={ (e: MouseEvent) => onClick(e, item) }\n />\n )\n : undefined,\n append: slots.append ? slotProps => slots.append?.({ ...slotProps, item }) : undefined,\n title: slots.title ? slotProps => slots.title?.({ ...slotProps, item }) : undefined,\n } satisfies VTreeviewItem['$props']['$children']\n\n const treeviewGroupProps = VTreeviewGroup.filterProps(itemProps)\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props)\n\n return children ? (\n <VTreeviewGroup\n value={ itemProps?.value }\n { ...treeviewGroupProps }\n >\n {{\n activator: ({ props: activatorProps }) => (\n <VTreeviewItem\n { ...itemProps }\n { ...activatorProps }\n loading={ loading }\n v-slots={ slotsWithItem }\n onClick={ (e: MouseEvent | KeyboardEvent) => onClick(e, item) }\n />\n ),\n default: () => (\n <VTreeviewChildren\n { ...treeviewChildrenProps }\n items={ children }\n v-slots={ slots }\n />\n ),\n }}\n </VTreeviewGroup>\n ) : (\n slots.item?.({ props: itemProps }) ?? (\n <VTreeviewItem\n { ...itemProps }\n v-slots={ slotsWithItem }\n />\n ))\n })\n },\n})\n"],"mappings":";AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,aAAa;AAAA,SACbC,YAAY,gDAErB;AACA,SAASC,UAAU,QAAQ,KAAK;AAAA,SACvBC,gBAAgB,EAAEC,YAAY,gCAEvC;AAaA,OAAO,MAAMC,0BAA0B,GAAGD,YAAY,CAAC;EACrDE,YAAY,EAAEC,QAAsD;EACpEC,WAAW,EAAE;IACXC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEC,KAA8C;EACrDC,UAAU,EAAEC;AACd,CAAC,EAAE,mBAAmB,CAAC;AAEvB,OAAO,MAAMC,iBAAiB,GAAGb,gBAAgB,CAKF,CAAC,CAAC;EAC/Cc,IA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AG1B;QACD9B,OAAO,EAAEA,CAAA,KAAAoC,YAAA,CAAA/B,iBAAA,EAAAsC,WAAA,CAEAD,qBAAqB;UAAA,SAClBxB;QAAQ,IACNP,KAAK;MAElB,KAILA,KAAK,CAACG,IAAI,GAAG;QAAEP,KAAK,EAAEoB;MAAU,CAAC,CAAC,IAAAS,YAAA,CAAA/C,aAAA,EAEzBsC,SAAS,EACJG,aAAa,CAEzB;IACN,CAAC,CAAC;EACJ;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VTreeviewChildren.mjs","names":["VTreeviewGroup","VTreeviewItem","VCheckboxBtn","shallowRef","withModifiers","genericComponent","propsFactory","makeVTreeviewChildrenProps","loadChildren","Function","loadingIcon","type","String","default","items","Array","selectable","Boolean","selectStrategy","Object","VTreeviewChildren","name","props","setup","_ref","emit","slots","isLoading","checkChildren","item","Promise","resolve","length","children","value","then","finally","selectItem","select","isSelected","map","_ref2","itemProps","raw","loading","slotsWithItem","prepend","slotProps","_createVNode","_Fragment","includes","isIndeterminate","e","key","stopPropagation","append","undefined","title","treeviewGroupProps","filterProps","treeviewChildrenProps","_mergeProps","activator","_ref3","activatorProps","listItemProps","onClick"],"sources":["../../../src/labs/VTreeview/VTreeviewChildren.tsx"],"sourcesContent":["// Components\nimport { VTreeviewGroup } from './VTreeviewGroup'\nimport { VTreeviewItem } from './VTreeviewItem'\nimport { VCheckboxBtn } from '@/components/VCheckbox'\n\n// Utilities\nimport { shallowRef, withModifiers } from 'vue'\nimport { genericComponent, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { InternalListItem } from '@/components/VList/VList'\nimport type { VListItemSlots } from '@/components/VList/VListItem'\nimport type { SelectStrategyProp } from '@/composables/nested/nested'\nimport type { GenericProps } from '@/util'\n\nexport type VTreeviewChildrenSlots<T> = {\n [K in keyof Omit<VListItemSlots, 'default'>]: VListItemSlots[K] & { item: T }\n} & {\n default: never\n item: { props: InternalListItem['props'] }\n}\n\nexport const makeVTreeviewChildrenProps = propsFactory({\n loadChildren: Function as PropType<(item: unknown) => Promise<void>>,\n loadingIcon: {\n type: String,\n default: '$loading',\n },\n items: Array as PropType<readonly InternalListItem[]>,\n selectable: Boolean,\n selectStrategy: [String, Function, Object] as PropType<SelectStrategyProp>,\n}, 'VTreeviewChildren')\n\nexport const VTreeviewChildren = genericComponent<new <T extends InternalListItem>(\n props: {\n items?: readonly T[]\n },\n slots: VTreeviewChildrenSlots<T>\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VTreeviewChildren',\n\n props: makeVTreeviewChildrenProps(),\n\n setup (props, { emit, slots }) {\n const isLoading = shallowRef(null)\n\n function checkChildren (item: any) {\n return new Promise<void>(resolve => {\n if (!props.items?.length || !props.loadChildren) return resolve()\n\n if (item?.children?.length === 0) {\n isLoading.value = item.value\n props.loadChildren(item).then(resolve)\n\n return\n }\n\n resolve()\n }).finally(() => {\n isLoading.value = null\n })\n }\n\n function selectItem (select: (value: boolean) => void, isSelected: boolean) {\n if (props.selectable) {\n select(!isSelected)\n }\n }\n\n return () => slots.default?.() ?? props.items?.map(({ children, props: itemProps, raw: item }) => {\n const loading = isLoading.value === item.value\n const slotsWithItem = {\n prepend: slotProps => (\n <>\n { props.selectable && (!children || (children && !['leaf', 'single-leaf'].includes(props.selectStrategy as string))) && (\n <div>\n <VCheckboxBtn\n key={ item.value }\n modelValue={ slotProps.isSelected }\n loading={ loading }\n indeterminate={ slotProps.isIndeterminate }\n onClick={ withModifiers(() => selectItem(slotProps.select, slotProps.isSelected), ['stop']) }\n onKeydown={ (e: KeyboardEvent) => {\n if (!['Enter', 'Space'].includes(e.key)) return\n e.stopPropagation()\n selectItem(slotProps.select, slotProps.isSelected)\n }}\n />\n </div>\n )}\n\n { slots.prepend?.({ ...slotProps, item }) }\n </>\n ),\n append: slots.append ? slotProps => slots.append?.({ ...slotProps, item }) : undefined,\n title: slots.title ? slotProps => slots.title?.({ ...slotProps, item }) : undefined,\n } satisfies VTreeviewItem['$props']['$children']\n\n const treeviewGroupProps = VTreeviewGroup.filterProps(itemProps)\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props)\n\n return children ? (\n <VTreeviewGroup\n value={ itemProps?.value }\n { ...treeviewGroupProps }\n >\n {{\n activator: ({ props: activatorProps }) => {\n const listItemProps = {\n ...itemProps,\n ...activatorProps,\n value: itemProps?.value,\n }\n\n return (\n <VTreeviewItem\n { ...listItemProps }\n loading={ loading }\n v-slots={ slotsWithItem }\n onClick={ () => checkChildren(item) }\n />\n )\n },\n default: () => (\n <VTreeviewChildren\n { ...treeviewChildrenProps }\n items={ children }\n v-slots={ slots }\n />\n ),\n }}\n </VTreeviewGroup>\n ) : (\n slots.item?.({ props: itemProps }) ?? (\n <VTreeviewItem\n { ...itemProps }\n v-slots={ slotsWithItem }\n />\n ))\n })\n },\n})\n"],"mappings":";AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,aAAa;AAAA,SACbC,YAAY,gDAErB;AACA,SAASC,UAAU,EAAEC,aAAa,QAAQ,KAAK;AAAA,SACtCC,gBAAgB,EAAEC,YAAY,gCAEvC;AAcA,OAAO,MAAMC,0BAA0B,GAAGD,YAAY,CAAC;EACrDE,YAAY,EAAEC,QAAsD;EACpEC,WAAW,EAAE;IACXC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEC,KAA8C;EACrDC,UAAU,EAAEC,OAAO;EACnBC,cAAc,EAAE,CAACN,MAAM,EAAEH,QAAQ,EAAEU,MAAM;AAC3C,CAAC,EAAE,mBAAmB,CAAC;AAEvB,OAAO,MAAMC,iBAAiB,GAAGf,gBAAgB,CAKF,CAAC,CAAC;EAC/CgB,IAAI,EAAE,mBAAmB;EAEzBC,KAAK,EAAEf,0BAA0B,CAAC,CAAC;EAEnCgB,KAAKA,CAAED,KAAK,EAAAE,IAAA,EAAmB;IAAA,IAAjB;MAAEC,IAAI;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAC3B,MAAMG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