vuetify 3.3.6 → 3.3.7
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.
- package/dist/json/attributes.json +14 -10
- package/dist/json/importMap.json +76 -76
- package/dist/json/tags.json +1 -0
- package/dist/json/web-types.json +26 -24
- package/dist/vuetify-labs.css +127 -111
- package/dist/vuetify-labs.d.ts +178 -76
- package/dist/vuetify-labs.esm.js +486 -337
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +485 -336
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +36 -20
- package/dist/vuetify.d.ts +157 -93
- package/dist/vuetify.esm.js +469 -326
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +468 -325
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +688 -669
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.mjs +48 -35
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VBtn/VBtn.mjs +1 -1
- package/lib/components/VBtn/VBtn.mjs.map +1 -1
- package/lib/components/VCheckbox/index.d.mts +28 -16
- package/lib/components/VCombobox/VCombobox.mjs +48 -35
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VField/VField.css +17 -6
- package/lib/components/VField/VField.sass +17 -6
- package/lib/components/VField/_variables.scss +2 -2
- package/lib/components/VIcon/VIcon.css +1 -0
- package/lib/components/VIcon/VIcon.sass +1 -0
- package/lib/components/VImg/VImg.css +4 -2
- package/lib/components/VImg/VImg.mjs +4 -2
- package/lib/components/VImg/VImg.mjs.map +1 -1
- package/lib/components/VImg/VImg.sass +3 -4
- package/lib/components/VOverlay/VOverlay.css +2 -0
- package/lib/components/VOverlay/VOverlay.sass +3 -1
- package/lib/components/VOverlay/scrollStrategies.mjs +3 -1
- package/lib/components/VOverlay/scrollStrategies.mjs.map +1 -1
- package/lib/components/VRadio/index.d.mts +14 -8
- package/lib/components/VRadioGroup/index.d.mts +14 -8
- package/lib/components/VResponsive/VResponsive.css +6 -11
- package/lib/components/VResponsive/VResponsive.sass +5 -10
- package/lib/components/VSelect/VSelect.mjs +43 -31
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/useScrolling.mjs +69 -0
- package/lib/components/VSelect/useScrolling.mjs.map +1 -0
- package/lib/components/VSelectionControl/VSelectionControl.mjs +2 -2
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControl/index.d.mts +14 -8
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +4 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/index.d.mts +14 -8
- package/lib/components/VSwitch/index.d.mts +14 -8
- package/lib/components/VTextField/VTextField.css +5 -0
- package/lib/components/VTextField/VTextField.mjs +6 -2
- package/lib/components/VTextField/VTextField.mjs.map +1 -1
- package/lib/components/VTextField/VTextField.sass +5 -0
- package/lib/components/VTextField/_variables.scss +1 -0
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs +50 -24
- package/lib/components/VVirtualScroll/VVirtualScroll.mjs.map +1 -1
- package/lib/components/VVirtualScroll/VVirtualScrollItem.mjs +13 -23
- package/lib/components/VVirtualScroll/VVirtualScrollItem.mjs.map +1 -1
- package/lib/components/VVirtualScroll/index.d.mts +37 -15
- package/lib/components/index.d.mts +134 -70
- package/lib/composables/filter.mjs +9 -7
- package/lib/composables/filter.mjs.map +1 -1
- package/lib/composables/resizeObserver.mjs +6 -1
- package/lib/composables/resizeObserver.mjs.map +1 -1
- package/lib/composables/virtual.mjs +17 -17
- package/lib/composables/virtual.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/index.d.mts +23 -23
- package/lib/labs/VDataTable/VDataTableVirtual.mjs +12 -10
- package/lib/labs/VDataTable/VDataTableVirtual.mjs.map +1 -1
- package/lib/labs/VDataTable/composables/headers.mjs +6 -2
- package/lib/labs/VDataTable/composables/headers.mjs.map +1 -1
- package/lib/labs/VDataTable/index.d.mts +44 -6
- package/lib/labs/components.d.mts +44 -6
- package/lib/util/getScrollParent.mjs +7 -1
- package/lib/util/getScrollParent.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-labels */
|
|
3
3
|
|
|
4
4
|
// Utilities
|
|
5
|
-
import { computed, ref, unref, watchEffect } from 'vue';
|
|
5
|
+
import { computed, ref, toValue, unref, watchEffect } from 'vue';
|
|
6
6
|
import { getPropertyFromItem, propsFactory, wrapInArray } from "../util/index.mjs"; // Types
|
|
7
7
|
// Composables
|
|
8
8
|
export const defaultFilter = (value, query, item) => {
|
|
@@ -67,14 +67,12 @@ export function filterItems(items, query, options) {
|
|
|
67
67
|
return array;
|
|
68
68
|
}
|
|
69
69
|
export function useFilter(props, items, query, options) {
|
|
70
|
-
const strQuery = computed(() => typeof query?.value !== 'string' && typeof query?.value !== 'number' ? '' : String(query.value));
|
|
71
70
|
const filteredItems = ref([]);
|
|
72
71
|
const filteredMatches = ref(new Map());
|
|
73
72
|
const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items));
|
|
74
73
|
watchEffect(() => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const results = filterItems(transformedItems.value, strQuery.value, {
|
|
74
|
+
const strQuery = typeof toValue(query) !== 'string' && typeof toValue(query) !== 'number' ? '' : String(toValue(query));
|
|
75
|
+
const results = filterItems(transformedItems.value, strQuery, {
|
|
78
76
|
customKeyFilter: props.customKeyFilter,
|
|
79
77
|
default: props.customFilter,
|
|
80
78
|
filterKeys: props.filterKeys,
|
|
@@ -82,15 +80,19 @@ export function useFilter(props, items, query, options) {
|
|
|
82
80
|
noFilter: props.noFilter
|
|
83
81
|
});
|
|
84
82
|
const originalItems = unref(items);
|
|
83
|
+
const _filteredItems = [];
|
|
84
|
+
const _filteredMatches = new Map();
|
|
85
85
|
results.forEach(_ref => {
|
|
86
86
|
let {
|
|
87
87
|
index,
|
|
88
88
|
matches
|
|
89
89
|
} = _ref;
|
|
90
90
|
const item = originalItems[index];
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
_filteredItems.push(item);
|
|
92
|
+
_filteredMatches.set(item.value, matches);
|
|
93
93
|
});
|
|
94
|
+
filteredItems.value = _filteredItems;
|
|
95
|
+
filteredMatches.value = _filteredMatches;
|
|
94
96
|
});
|
|
95
97
|
function getMatches(item) {
|
|
96
98
|
return filteredMatches.value.get(item.value);
|
|
@@ -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","customMatches","defaultMatches","match","key","keyFilter","title","defaultMatchesLength","customMatchesLength","push","index","matches","useFilter","props","strQuery","filteredItems","filteredMatches","Map","transformedItems","transform","map","results","originalItems","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?: any) => 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\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: any[],\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 = items[i]\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(item)\n\n for (const key of filterKeys) {\n const value = getPropertyFromItem(item as any, key, item)\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 { value: unknown }> (\n props: FilterProps,\n items: MaybeRef<T[]>,\n query: Ref<string | undefined>,\n options?: {\n transform?: (item: T) => any\n }\n) {\n const strQuery = computed(() => (\n typeof query?.value !== 'string' &&\n typeof query?.value !== 'number'\n ) ? '' : String(query.value))\n\n const filteredItems: Ref<T[]> = ref([])\n const filteredMatches: Ref<Map<unknown, Record<string, FilterMatch>>> = ref(new Map())\n const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items))\n\n watchEffect(() => {\n filteredItems.value = []\n filteredMatches.value = new Map()\n\n const results = filterItems(\n transformedItems.value,\n strQuery.value,\n {\n customKeyFilter: props.customKeyFilter,\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 results.forEach(({ index, matches }) => {\n const item = originalItems[index]\n filteredItems.value.push(item)\n filteredMatches.value.set(item.value, matches)\n })\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;AAwBA;AACA,OAAO,MAAMC,aAA6B,GAAGA,CAACC,KAAK,EAAEC,KAAK,EAAEC,IAAI,KAAK;EACnE,IAAIF,KAAK,I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CO,OAAO,EAAEyB,KAAK,CAAClC,YAAY;MAC3BI,UAAU,EAAE8B,KAAK,CAAC9B,UAAU;MAC5BG,UAAU,EAAE2B,KAAK,CAAC3B,UAAU;MAC5BG,QAAQ,EAAEwB,KAAK,CAACxB;IAClB,CAAC,CACF;IAED,MAAMiC,aAAa,GAAGxD,KAAK,CAAC0B,KAAK,CAAC;IAElC6B,OAAO,CAACE,OAAO,CAACC,IAAA,IAAwB;MAAA,IAAvB;QAAEd,KAAK;QAAEC;MAAQ,CAAC,GAAAa,IAAA;MACjC,MAAMlD,IAAI,GAAGgD,aAAa,CAACZ,KAAK,CAAC;MACjCK,aAAa,CAAC3C,KAAK,CAACqC,IAAI,CAACnC,IAAI,CAAC;MAC9B0C,eAAe,CAAC5C,KAAK,CAACqD,GAAG,CAACnD,IAAI,CAACF,KAAK,EAAEuC,OAAO,CAAC;IAChD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,SAASe,UAAUA,CAAEpD,IAAO,EAAE;IAC5B,OAAO0C,eAAe,CAAC5C,KAAK,CAACuD,GAAG,CAACrD,IAAI,CAACF,KAAK,CAAC;EAC9C;EAEA,OAAO;IAAE2C,aAAa;IAAEC,eAAe;IAAEU;EAAW,CAAC;AACvD"}
|
|
1
|
+
{"version":3,"file":"filter.mjs","names":["computed","ref","toValue","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","customMatches","defaultMatches","match","key","keyFilter","title","defaultMatchesLength","customMatchesLength","push","index","matches","useFilter","props","filteredItems","filteredMatches","Map","transformedItems","transform","map","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, toValue, unref, watchEffect } from 'vue'\nimport { getPropertyFromItem, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { MaybeRefOrGetter, 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?: any) => 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\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: any[],\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 = items[i]\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(item)\n\n for (const key of filterKeys) {\n const value = getPropertyFromItem(item as any, key, item)\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 { value: unknown }> (\n props: FilterProps,\n items: MaybeRef<T[]>,\n query: MaybeRefOrGetter<string | undefined>,\n options?: {\n transform?: (item: T) => any\n }\n) {\n const filteredItems: Ref<T[]> = ref([])\n const filteredMatches: Ref<Map<unknown, Record<string, FilterMatch>>> = ref(new Map())\n const transformedItems = computed(() => options?.transform ? unref(items).map(options?.transform) : unref(items))\n\n watchEffect(() => {\n const strQuery = (\n typeof toValue(query) !== 'string' &&\n typeof toValue(query) !== 'number'\n ) ? '' : String(toValue(query))\n\n const results = filterItems(\n transformedItems.value,\n strQuery,\n {\n customKeyFilter: props.customKeyFilter,\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,OAAO,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SACvDC,mBAAmB,EAAEC,YAAY,EAAEC,WAAW,6BAEvD;AAwBA;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,EAAE,CAACC,iBAAiB,EAAE,CAACC,OAAO,CAACJ,KAAK,CAACE,QAAQ,EAAE,CAACC,iBAAiB,EAAE,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,EAAE;EACX,CAAC;EACDC,QAAQ,EAAEC;AACZ,CAAC,EAAE,QAAQ,CAAC;AAEZ,OAAO,SAASC,WAAWA,CACzBC,KAAY,EACZnB,KAAa,EACboB,OAMC,EACD;EACA,MAAMC,KAAgE,GAAG,EAAE;EAC3E;EACA,MAAMC,MAAM,GAAGF,OAAO,EAAEL,OAAO,IAAIjB,aAAa;EAChD,MAAMyB,IAAI,GAAGH,OAAO,EAAEV,UAAU,GAAGb,WAAW,CAACuB,OAAO,CAACV,UAAU,CAAC,GAAG,KAAK;EAC1E,MAAMc,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;IAAEa;EAAW,CAAC;AACvD"}
|
|
@@ -3,13 +3,18 @@ import { onBeforeUnmount, readonly, ref, watch } from 'vue';
|
|
|
3
3
|
import { refElement } from "../util/index.mjs";
|
|
4
4
|
import { IN_BROWSER } from "../util/globals.mjs"; // Types
|
|
5
5
|
export function useResizeObserver(callback) {
|
|
6
|
+
let box = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'content';
|
|
6
7
|
const resizeRef = ref();
|
|
7
8
|
const contentRect = ref();
|
|
8
9
|
if (IN_BROWSER) {
|
|
9
10
|
const observer = new ResizeObserver(entries => {
|
|
10
11
|
callback?.(entries, observer);
|
|
11
12
|
if (!entries.length) return;
|
|
12
|
-
|
|
13
|
+
if (box === 'content') {
|
|
14
|
+
contentRect.value = entries[0].contentRect;
|
|
15
|
+
} else {
|
|
16
|
+
contentRect.value = entries[0].target.getBoundingClientRect();
|
|
17
|
+
}
|
|
13
18
|
});
|
|
14
19
|
onBeforeUnmount(() => {
|
|
15
20
|
observer.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeObserver.mjs","names":["onBeforeUnmount","readonly","ref","watch","refElement","IN_BROWSER","useResizeObserver","callback","resizeRef","contentRect","observer","ResizeObserver","entries","
|
|
1
|
+
{"version":3,"file":"resizeObserver.mjs","names":["onBeforeUnmount","readonly","ref","watch","refElement","IN_BROWSER","useResizeObserver","callback","box","arguments","length","undefined","resizeRef","contentRect","observer","ResizeObserver","entries","value","target","getBoundingClientRect","disconnect","newValue","oldValue","unobserve","observe","flush"],"sources":["../../src/composables/resizeObserver.ts"],"sourcesContent":["// Utilities\nimport { onBeforeUnmount, readonly, ref, watch } from 'vue'\nimport { refElement } from '@/util'\nimport { IN_BROWSER } from '@/util/globals'\n\n// Types\nimport type { DeepReadonly, Ref } from 'vue'\n\ninterface ResizeState {\n resizeRef: Ref<HTMLElement | undefined>\n contentRect: DeepReadonly<Ref<DOMRectReadOnly | undefined>>\n}\n\nexport function useResizeObserver (callback?: ResizeObserverCallback, box: 'content' | 'border' = 'content'): ResizeState {\n const resizeRef = ref<HTMLElement>()\n const contentRect = ref<DOMRectReadOnly>()\n\n if (IN_BROWSER) {\n const observer = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n callback?.(entries, observer)\n\n if (!entries.length) return\n\n if (box === 'content') {\n contentRect.value = entries[0].contentRect\n } else {\n contentRect.value = entries[0].target.getBoundingClientRect()\n }\n })\n\n onBeforeUnmount(() => {\n observer.disconnect()\n })\n\n watch(resizeRef, (newValue, oldValue) => {\n if (oldValue) {\n observer.unobserve(refElement(oldValue))\n contentRect.value = undefined\n }\n\n if (newValue) observer.observe(refElement(newValue))\n }, {\n flush: 'post',\n })\n }\n\n return {\n resizeRef,\n contentRect: readonly(contentRect),\n }\n}\n"],"mappings":"AAAA;AACA,SAASA,eAAe,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAClDC,UAAU;AAAA,SACVC,UAAU,+BAEnB;AAQA,OAAO,SAASC,iBAAiBA,CAAEC,QAAiC,EAAsD;EAAA,IAApDC,GAAyB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,SAAS;EACzG,MAAMG,SAAS,GAAGV,GAAG,EAAe;EACpC,MAAMW,WAAW,GAAGX,GAAG,EAAmB;EAE1C,IAAIG,UAAU,EAAE;IACd,MAAMS,QAAQ,GAAG,IAAIC,cAAc,CAAEC,OAA8B,IAAK;MACtET,QAAQ,GAAGS,OAAO,EAAEF,QAAQ,CAAC;MAE7B,IAAI,CAACE,OAAO,CAACN,MAAM,EAAE;MAErB,IAAIF,GAAG,KAAK,SAAS,EAAE;QACrBK,WAAW,CAACI,KAAK,GAAGD,OAAO,CAAC,CAAC,CAAC,CAACH,WAAW;MAC5C,CAAC,MAAM;QACLA,WAAW,CAACI,KAAK,GAAGD,OAAO,CAAC,CAAC,CAAC,CAACE,MAAM,CAACC,qBAAqB,EAAE;MAC/D;IACF,CAAC,CAAC;IAEFnB,eAAe,CAAC,MAAM;MACpBc,QAAQ,CAACM,UAAU,EAAE;IACvB,CAAC,CAAC;IAEFjB,KAAK,CAACS,SAAS,EAAE,CAACS,QAAQ,EAAEC,QAAQ,KAAK;MACvC,IAAIA,QAAQ,EAAE;QACZR,QAAQ,CAACS,SAAS,CAACnB,UAAU,CAACkB,QAAQ,CAAC,CAAC;QACxCT,WAAW,CAACI,KAAK,GAAGN,SAAS;MAC/B;MAEA,IAAIU,QAAQ,EAAEP,QAAQ,CAACU,OAAO,CAACpB,UAAU,CAACiB,QAAQ,CAAC,CAAC;IACtD,CAAC,EAAE;MACDI,KAAK,EAAE;IACT,CAAC,CAAC;EACJ;EAEA,OAAO;IACLb,SAAS;IACTC,WAAW,EAAEZ,QAAQ,CAACY,WAAW;EACnC,CAAC;AACH"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// Composables
|
|
2
2
|
import { useDisplay } from "./display.mjs";
|
|
3
3
|
import { useResizeObserver } from "./resizeObserver.mjs"; // Utilities
|
|
4
|
-
import { computed,
|
|
4
|
+
import { computed, ref, shallowRef, watch, watchEffect } from 'vue';
|
|
5
5
|
import { clamp, createRange, propsFactory } from "../util/index.mjs"; // Types
|
|
6
6
|
const UP = -1;
|
|
7
7
|
const DOWN = 1;
|
|
8
8
|
export const makeVirtualProps = propsFactory({
|
|
9
|
-
itemHeight:
|
|
9
|
+
itemHeight: {
|
|
10
|
+
type: [Number, String],
|
|
11
|
+
default: 48
|
|
12
|
+
}
|
|
10
13
|
}, 'virtual');
|
|
11
14
|
export function useVirtual(props, items, offset) {
|
|
12
15
|
const first = shallowRef(0);
|
|
@@ -27,10 +30,12 @@ export function useVirtual(props, items, offset) {
|
|
|
27
30
|
});
|
|
28
31
|
const display = useDisplay();
|
|
29
32
|
const sizeMap = new Map();
|
|
30
|
-
let sizes =
|
|
33
|
+
let sizes = Array.from({
|
|
34
|
+
length: items.value.length
|
|
35
|
+
});
|
|
31
36
|
const visibleItems = computed(() => {
|
|
32
|
-
const height = (contentRect.value
|
|
33
|
-
return
|
|
37
|
+
const height = (!contentRect.value || containerRef.value === document.documentElement ? display.height.value : contentRect.value.height) - (offset?.value ?? 0);
|
|
38
|
+
return Math.ceil(height / itemHeight.value * 1.7 + 1);
|
|
34
39
|
});
|
|
35
40
|
function handleItemResize(index, height) {
|
|
36
41
|
itemHeight.value = Math.max(itemHeight.value, height);
|
|
@@ -38,7 +43,7 @@ export function useVirtual(props, items, offset) {
|
|
|
38
43
|
sizeMap.set(items.value[index], height);
|
|
39
44
|
}
|
|
40
45
|
function calculateOffset(index) {
|
|
41
|
-
return sizes.slice(0, index).reduce((
|
|
46
|
+
return sizes.slice(0, index).reduce((acc, val) => acc + (val || itemHeight.value), 0);
|
|
42
47
|
}
|
|
43
48
|
function calculateMidPointIndex(scrollTop) {
|
|
44
49
|
const end = items.value.length;
|
|
@@ -71,20 +76,15 @@ export function useVirtual(props, items, offset) {
|
|
|
71
76
|
const offset = calculateOffset(index);
|
|
72
77
|
containerRef.value.scrollTop = offset;
|
|
73
78
|
}
|
|
74
|
-
const allItems = computed(() => items.value.map((item, index) => ({
|
|
75
|
-
raw: item,
|
|
76
|
-
index
|
|
77
|
-
})));
|
|
78
79
|
const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value));
|
|
79
|
-
const computedItems = computed(() =>
|
|
80
|
+
const computedItems = computed(() => {
|
|
81
|
+
return items.value.slice(first.value, last.value).map((item, index) => ({
|
|
82
|
+
raw: item,
|
|
83
|
+
index: index + first.value
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
80
86
|
const paddingTop = computed(() => calculateOffset(first.value));
|
|
81
87
|
const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value));
|
|
82
|
-
onMounted(() => {
|
|
83
|
-
if (!itemHeight.value) {
|
|
84
|
-
// If itemHeight prop is not set, then calculate an estimated height from the average of inital items
|
|
85
|
-
itemHeight.value = sizes.slice(first.value, last.value).reduce((curr, height) => curr + height, 0) / visibleItems.value;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
88
|
watch(() => items.value.length, () => {
|
|
89
89
|
sizes = createRange(items.value.length).map(() => itemHeight.value);
|
|
90
90
|
sizeMap.forEach((height, item) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":["useDisplay","useResizeObserver","computed","onMounted","ref","shallowRef","watch","watchEffect","clamp","createRange","propsFactory","UP","DOWN","makeVirtualProps","itemHeight","Number","String","useVirtual","props","items","offset","first","baseItemHeight","get","parseInt","value","set","val","containerRef","resizeRef","contentRect","display","sizeMap","Map","sizes","length","map","visibleItems","height","Math","max","ceil","handleItemResize","index","calculateOffset","slice","reduce","curr","calculateMidPointIndex","scrollTop","end","middle","middleOffset","lastScrollTop","handleScroll","direction","midPointIndex","buffer","round","firstIndex","lastIndex","scrollToIndex","allItems","item","raw","last","min","computedItems","paddingTop","paddingBottom","forEach","indexOf","delete"],"sources":["../../src/composables/virtual.ts"],"sourcesContent":["// Composables\nimport { useDisplay } from '@/composables/display'\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport { computed, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n clamp,\n createRange,\n propsFactory,\n} from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nconst UP = -1\nconst DOWN = 1\n\ntype VirtualProps = {\n itemHeight?: number | string\n}\n\nexport const makeVirtualProps = propsFactory({\n itemHeight: [Number, String],\n}, 'virtual')\n\nexport function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>, offset?: Ref<number>) {\n const first = shallowRef(0)\n const baseItemHeight = shallowRef(props.itemHeight)\n const itemHeight = computed({\n get: () => parseInt(baseItemHeight.value ?? 0, 10),\n set (val) {\n baseItemHeight.value = val\n },\n })\n const containerRef = ref<HTMLDivElement>()\n const { resizeRef, contentRect } = useResizeObserver()\n watchEffect(() => {\n resizeRef.value = containerRef.value\n })\n const display = useDisplay()\n\n const sizeMap = new Map<any, number>()\n let sizes = createRange(items.value.length).map(() => itemHeight.value)\n const visibleItems = computed(() => {\n const height = (contentRect.value?.height ?? display.height.value) - (offset?.value ?? 0)\n return itemHeight.value\n ? Math.max(12,\n Math.ceil((height / itemHeight.value) * 1.7 + 1)\n )\n : 12\n })\n\n function handleItemResize (index: number, height: number) {\n itemHeight.value = Math.max(itemHeight.value, height)\n sizes[index] = height\n sizeMap.set(items.value[index], height)\n }\n\n function calculateOffset (index: number) {\n return sizes.slice(0, index).reduce((curr, value) => curr + (value || itemHeight.value), 0)\n }\n\n function calculateMidPointIndex (scrollTop: number) {\n const end = items.value.length\n\n let middle = 0\n let middleOffset = 0\n while (middleOffset < scrollTop && middle < end) {\n middleOffset += sizes[middle++] || itemHeight.value\n }\n\n return middle - 1\n }\n\n let lastScrollTop = 0\n function handleScroll () {\n if (!containerRef.value || !contentRect.value) return\n\n const height = contentRect.value.height - 56\n const scrollTop = containerRef.value.scrollTop\n const direction = scrollTop < lastScrollTop ? UP : DOWN\n\n const midPointIndex = calculateMidPointIndex(scrollTop + height / 2)\n const buffer = Math.round(visibleItems.value / 3)\n const firstIndex = midPointIndex - buffer\n const lastIndex = first.value + (buffer * 2) - 1\n if (direction === UP && midPointIndex <= lastIndex) {\n first.value = clamp(firstIndex, 0, items.value.length)\n } else if (direction === DOWN && midPointIndex >= lastIndex) {\n first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value)\n }\n\n lastScrollTop = scrollTop\n }\n\n function scrollToIndex (index: number) {\n if (!containerRef.value) return\n\n const offset = calculateOffset(index)\n containerRef.value.scrollTop = offset\n }\n\n const allItems = computed(() => items.value.map((item, index) => ({\n raw: item,\n index,\n })))\n const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value))\n const computedItems = computed(() => allItems.value.slice(first.value, last.value))\n const paddingTop = computed(() => calculateOffset(first.value))\n const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value))\n\n onMounted(() => {\n if (!itemHeight.value) {\n // If itemHeight prop is not set, then calculate an estimated height from the average of inital items\n itemHeight.value = sizes.slice(first.value, last.value).reduce((curr, height) => curr + height, 0) / (visibleItems.value)\n }\n })\n\n watch(() => items.value.length, () => {\n sizes = createRange(items.value.length).map(() => itemHeight.value)\n sizeMap.forEach((height, item) => {\n const index = items.value.indexOf(item)\n if (index === -1) {\n sizeMap.delete(item)\n } else {\n sizes[index] = height\n }\n })\n })\n\n return {\n containerRef,\n computedItems,\n itemHeight,\n paddingTop,\n paddingBottom,\n scrollToIndex,\n handleScroll,\n handleItemResize,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,UAAU;AAAA,SACVC,iBAAiB,gCAE1B;AACA,SAASC,QAAQ,EAAEC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SAE5EC,KAAK,EACLC,WAAW,EACXC,YAAY,6BAGd;AAGA,MAAMC,EAAE,GAAG,CAAC,CAAC;AACb,MAAMC,IAAI,GAAG,CAAC;AAMd,OAAO,MAAMC,gBAAgB,GAAGH,YAAY,CAAC;EAC3CI,UAAU,EAAE,CAACC,MAAM,EAAEC,MAAM;AAC7B,CAAC,EAAE,SAAS,CAAC;AAEb,OAAO,SAASC,UAAUA,CAAMC,KAAmB,EAAEC,KAAwB,EAAEC,MAAoB,EAAE;EACnG,MAAMC,KAAK,GAAGhB,UAAU,CAAC,CAAC,CAAC;EAC3B,MAAMiB,cAAc,GAAGjB,UAAU,CAACa,KAAK,CAACJ,UAAU,CAAC;EACnD,MAAMA,UAAU,GAAGZ,QAAQ,CAAC;IAC1BqB,GAAG,EAAEA,CAAA,KAAMC,QAAQ,CAACF,cAAc,CAACG,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC;IAClDC,GAAGA,CAAEC,GAAG,EAAE;MACRL,cAAc,CAACG,KAAK,GAAGE,GAAG;IAC5B;EACF,CAAC,CAAC;EACF,MAAMC,YAAY,GAAG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,SAAS,CAAC,MAAM;IACd,IAAI,CAACW,UAAU,CAACW,KAAK,EAAE;MACrB;MACAX,UAAU,CAACW,KAAK,GAAGS,KAAK,CAACW,KAAK,CAACxB,KAAK,CAACI,KAAK,EAAEwC,IAAI,CAACxC,KAAK,CAAC,CAACqB,MAAM,CAAC,CAACC,IAAI,EAAET,MAAM,KAAKS,IAAI,GAAGT,MAAM,EAAE,CAAC,CAAC,GAAID,YAAY,CAACZ,KAAM;IAC3H;EACF,CAAC,CAAC;EAEFnB,KAAK,CAAC,MAAMa,KAAK,CAACM,KAAK,CAACU,MAAM,EAAE,MAAM;IACpCD,KAAK,GAAGzB,WAAW,CAACU,KAAK,CAACM,KAAK,CAACU,MAAM,CAAC,CAACC,GAAG,CAAC,MAAMtB,UAAU,CAACW,KAAK,CAAC;IACnEO,OAAO,CAACsC,OAAO,CAAC,CAAChC,MAAM,EAAEyB,IAAI,KAAK;MAChC,MAAMpB,KAAK,GAAGxB,KAAK,CAACM,KAAK,CAAC8C,OAAO,CAACR,IAAI,CAAC;MACvC,IAAIpB,KAAK,KAAK,CAAC,CAAC,EAAE;QAChBX,OAAO,CAACwC,MAAM,CAACT,IAAI,CAAC;MACtB,CAAC,MAAM;QACL7B,KAAK,CAACS,KAAK,CAAC,GAAGL,MAAM;MACvB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLV,YAAY;IACZuC,aAAa;IACbrD,UAAU;IACVsD,UAAU;IACVC,aAAa;IACbR,aAAa;IACbP,YAAY;IACZZ;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"virtual.mjs","names":["useDisplay","useResizeObserver","computed","ref","shallowRef","watch","watchEffect","clamp","createRange","propsFactory","UP","DOWN","makeVirtualProps","itemHeight","type","Number","String","default","useVirtual","props","items","offset","first","baseItemHeight","get","parseInt","value","set","val","containerRef","resizeRef","contentRect","display","sizeMap","Map","sizes","Array","from","length","visibleItems","height","document","documentElement","Math","ceil","handleItemResize","index","max","calculateOffset","slice","reduce","acc","calculateMidPointIndex","scrollTop","end","middle","middleOffset","lastScrollTop","handleScroll","direction","midPointIndex","buffer","round","firstIndex","lastIndex","scrollToIndex","last","min","computedItems","map","item","raw","paddingTop","paddingBottom","forEach","indexOf","delete"],"sources":["../../src/composables/virtual.ts"],"sourcesContent":["// Composables\nimport { useDisplay } from '@/composables/display'\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport { computed, ref, shallowRef, watch, watchEffect } from 'vue'\nimport {\n clamp,\n createRange,\n propsFactory,\n} from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\n\nconst UP = -1\nconst DOWN = 1\n\ntype VirtualProps = {\n itemHeight?: number | string\n}\n\nexport const makeVirtualProps = propsFactory({\n itemHeight: {\n type: [Number, String],\n default: 48,\n },\n}, 'virtual')\n\nexport function useVirtual <T> (props: VirtualProps, items: Ref<readonly T[]>, offset?: Ref<number>) {\n const first = shallowRef(0)\n const baseItemHeight = shallowRef(props.itemHeight)\n const itemHeight = computed({\n get: () => parseInt(baseItemHeight.value ?? 0, 10),\n set (val) {\n baseItemHeight.value = val\n },\n })\n const containerRef = ref<HTMLElement>()\n const { resizeRef, contentRect } = useResizeObserver()\n watchEffect(() => {\n resizeRef.value = containerRef.value\n })\n const display = useDisplay()\n\n const sizeMap = new Map<any, number>()\n let sizes = Array.from<number | null>({ length: items.value.length })\n const visibleItems = computed(() => {\n const height = (\n !contentRect.value || containerRef.value === document.documentElement\n ? display.height.value\n : contentRect.value.height\n ) - (offset?.value ?? 0)\n return Math.ceil((height / itemHeight.value) * 1.7 + 1)\n })\n\n function handleItemResize (index: number, height: number) {\n itemHeight.value = Math.max(itemHeight.value, height)\n sizes[index] = height\n sizeMap.set(items.value[index], height)\n }\n\n function calculateOffset (index: number) {\n return sizes.slice(0, index)\n .reduce((acc, val) => acc! + (val || itemHeight.value), 0)!\n }\n\n function calculateMidPointIndex (scrollTop: number) {\n const end = items.value.length\n\n let middle = 0\n let middleOffset = 0\n while (middleOffset < scrollTop && middle < end) {\n middleOffset += sizes[middle++] || itemHeight.value\n }\n\n return middle - 1\n }\n\n let lastScrollTop = 0\n function handleScroll () {\n if (!containerRef.value || !contentRect.value) return\n\n const height = contentRect.value.height - 56\n const scrollTop = containerRef.value.scrollTop\n const direction = scrollTop < lastScrollTop ? UP : DOWN\n\n const midPointIndex = calculateMidPointIndex(scrollTop + height / 2)\n const buffer = Math.round(visibleItems.value / 3)\n const firstIndex = midPointIndex - buffer\n const lastIndex = first.value + (buffer * 2) - 1\n if (direction === UP && midPointIndex <= lastIndex) {\n first.value = clamp(firstIndex, 0, items.value.length)\n } else if (direction === DOWN && midPointIndex >= lastIndex) {\n first.value = clamp(firstIndex, 0, items.value.length - visibleItems.value)\n }\n\n lastScrollTop = scrollTop\n }\n\n function scrollToIndex (index: number) {\n if (!containerRef.value) return\n\n const offset = calculateOffset(index)\n containerRef.value.scrollTop = offset\n }\n\n const last = computed(() => Math.min(items.value.length, first.value + visibleItems.value))\n const computedItems = computed(() => {\n return items.value.slice(first.value, last.value).map((item, index) => ({\n raw: item,\n index: index + first.value,\n }))\n })\n const paddingTop = computed(() => calculateOffset(first.value))\n const paddingBottom = computed(() => calculateOffset(items.value.length) - calculateOffset(last.value))\n\n watch(() => items.value.length, () => {\n sizes = createRange(items.value.length).map(() => itemHeight.value)\n sizeMap.forEach((height, item) => {\n const index = items.value.indexOf(item)\n if (index === -1) {\n sizeMap.delete(item)\n } else {\n sizes[index] = height\n }\n })\n })\n\n return {\n containerRef,\n computedItems,\n itemHeight,\n paddingTop,\n paddingBottom,\n scrollToIndex,\n handleScroll,\n handleItemResize,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,UAAU;AAAA,SACVC,iBAAiB,gCAE1B;AACA,SAASC,QAAQ,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,WAAW,QAAQ,KAAK;AAAA,SAEjEC,KAAK,EACLC,WAAW,EACXC,YAAY,6BAGd;AAGA,MAAMC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AU;IACV2D,UAAU;IACVC,aAAa;IACbR,aAAa;IACbP,YAAY;IACZb;EACF,CAAC;AACH"}
|
package/lib/entry-bundler.mjs
CHANGED
package/lib/framework.mjs
CHANGED
package/lib/index.d.mts
CHANGED
|
@@ -361,50 +361,50 @@ declare module '@vue/runtime-core' {
|
|
|
361
361
|
|
|
362
362
|
export interface GlobalComponents {
|
|
363
363
|
VApp: typeof import('vuetify/components')['VApp']
|
|
364
|
+
VAlert: typeof import('vuetify/components')['VAlert']
|
|
365
|
+
VAlertTitle: typeof import('vuetify/components')['VAlertTitle']
|
|
364
366
|
VAppBar: typeof import('vuetify/components')['VAppBar']
|
|
365
367
|
VAppBarNavIcon: typeof import('vuetify/components')['VAppBarNavIcon']
|
|
366
368
|
VAppBarTitle: typeof import('vuetify/components')['VAppBarTitle']
|
|
367
|
-
VAlert: typeof import('vuetify/components')['VAlert']
|
|
368
|
-
VAlertTitle: typeof import('vuetify/components')['VAlertTitle']
|
|
369
369
|
VAutocomplete: typeof import('vuetify/components')['VAutocomplete']
|
|
370
|
-
VAvatar: typeof import('vuetify/components')['VAvatar']
|
|
371
370
|
VBadge: typeof import('vuetify/components')['VBadge']
|
|
371
|
+
VAvatar: typeof import('vuetify/components')['VAvatar']
|
|
372
|
+
VBottomNavigation: typeof import('vuetify/components')['VBottomNavigation']
|
|
372
373
|
VBanner: typeof import('vuetify/components')['VBanner']
|
|
373
374
|
VBannerActions: typeof import('vuetify/components')['VBannerActions']
|
|
374
375
|
VBannerText: typeof import('vuetify/components')['VBannerText']
|
|
375
|
-
VBottomNavigation: typeof import('vuetify/components')['VBottomNavigation']
|
|
376
376
|
VBreadcrumbs: typeof import('vuetify/components')['VBreadcrumbs']
|
|
377
377
|
VBreadcrumbsItem: typeof import('vuetify/components')['VBreadcrumbsItem']
|
|
378
378
|
VBreadcrumbsDivider: typeof import('vuetify/components')['VBreadcrumbsDivider']
|
|
379
|
-
VBtn: typeof import('vuetify/components')['VBtn']
|
|
380
|
-
VBtnGroup: typeof import('vuetify/components')['VBtnGroup']
|
|
381
379
|
VBtnToggle: typeof import('vuetify/components')['VBtnToggle']
|
|
380
|
+
VBtnGroup: typeof import('vuetify/components')['VBtnGroup']
|
|
381
|
+
VBtn: typeof import('vuetify/components')['VBtn']
|
|
382
|
+
VCheckbox: typeof import('vuetify/components')['VCheckbox']
|
|
383
|
+
VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
|
|
382
384
|
VCard: typeof import('vuetify/components')['VCard']
|
|
383
385
|
VCardActions: typeof import('vuetify/components')['VCardActions']
|
|
384
386
|
VCardItem: typeof import('vuetify/components')['VCardItem']
|
|
385
387
|
VCardSubtitle: typeof import('vuetify/components')['VCardSubtitle']
|
|
386
388
|
VCardText: typeof import('vuetify/components')['VCardText']
|
|
387
389
|
VCardTitle: typeof import('vuetify/components')['VCardTitle']
|
|
388
|
-
VCarousel: typeof import('vuetify/components')['VCarousel']
|
|
389
|
-
VCarouselItem: typeof import('vuetify/components')['VCarouselItem']
|
|
390
|
-
VCheckbox: typeof import('vuetify/components')['VCheckbox']
|
|
391
|
-
VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
|
|
392
390
|
VChip: typeof import('vuetify/components')['VChip']
|
|
393
391
|
VChipGroup: typeof import('vuetify/components')['VChipGroup']
|
|
392
|
+
VCarousel: typeof import('vuetify/components')['VCarousel']
|
|
393
|
+
VCarouselItem: typeof import('vuetify/components')['VCarouselItem']
|
|
394
394
|
VCode: typeof import('vuetify/components')['VCode']
|
|
395
|
-
VColorPicker: typeof import('vuetify/components')['VColorPicker']
|
|
396
395
|
VCombobox: typeof import('vuetify/components')['VCombobox']
|
|
397
|
-
|
|
396
|
+
VColorPicker: typeof import('vuetify/components')['VColorPicker']
|
|
398
397
|
VDialog: typeof import('vuetify/components')['VDialog']
|
|
399
|
-
|
|
398
|
+
VCounter: typeof import('vuetify/components')['VCounter']
|
|
400
399
|
VExpansionPanels: typeof import('vuetify/components')['VExpansionPanels']
|
|
401
400
|
VExpansionPanel: typeof import('vuetify/components')['VExpansionPanel']
|
|
402
401
|
VExpansionPanelText: typeof import('vuetify/components')['VExpansionPanelText']
|
|
403
402
|
VExpansionPanelTitle: typeof import('vuetify/components')['VExpansionPanelTitle']
|
|
403
|
+
VDivider: typeof import('vuetify/components')['VDivider']
|
|
404
404
|
VField: typeof import('vuetify/components')['VField']
|
|
405
405
|
VFieldLabel: typeof import('vuetify/components')['VFieldLabel']
|
|
406
|
-
VFileInput: typeof import('vuetify/components')['VFileInput']
|
|
407
406
|
VFooter: typeof import('vuetify/components')['VFooter']
|
|
407
|
+
VFileInput: typeof import('vuetify/components')['VFileInput']
|
|
408
408
|
VIcon: typeof import('vuetify/components')['VIcon']
|
|
409
409
|
VComponentIcon: typeof import('vuetify/components')['VComponentIcon']
|
|
410
410
|
VSvgIcon: typeof import('vuetify/components')['VSvgIcon']
|
|
@@ -414,8 +414,8 @@ declare module '@vue/runtime-core' {
|
|
|
414
414
|
VInput: typeof import('vuetify/components')['VInput']
|
|
415
415
|
VItemGroup: typeof import('vuetify/components')['VItemGroup']
|
|
416
416
|
VItem: typeof import('vuetify/components')['VItem']
|
|
417
|
-
VKbd: typeof import('vuetify/components')['VKbd']
|
|
418
417
|
VLabel: typeof import('vuetify/components')['VLabel']
|
|
418
|
+
VKbd: typeof import('vuetify/components')['VKbd']
|
|
419
419
|
VList: typeof import('vuetify/components')['VList']
|
|
420
420
|
VListGroup: typeof import('vuetify/components')['VListGroup']
|
|
421
421
|
VListImg: typeof import('vuetify/components')['VListImg']
|
|
@@ -433,17 +433,17 @@ declare module '@vue/runtime-core' {
|
|
|
433
433
|
VPagination: typeof import('vuetify/components')['VPagination']
|
|
434
434
|
VProgressCircular: typeof import('vuetify/components')['VProgressCircular']
|
|
435
435
|
VProgressLinear: typeof import('vuetify/components')['VProgressLinear']
|
|
436
|
-
VRadioGroup: typeof import('vuetify/components')['VRadioGroup']
|
|
437
436
|
VRating: typeof import('vuetify/components')['VRating']
|
|
437
|
+
VRadioGroup: typeof import('vuetify/components')['VRadioGroup']
|
|
438
438
|
VSelect: typeof import('vuetify/components')['VSelect']
|
|
439
439
|
VSelectionControl: typeof import('vuetify/components')['VSelectionControl']
|
|
440
440
|
VSelectionControlGroup: typeof import('vuetify/components')['VSelectionControlGroup']
|
|
441
441
|
VSheet: typeof import('vuetify/components')['VSheet']
|
|
442
|
+
VSlider: typeof import('vuetify/components')['VSlider']
|
|
442
443
|
VSlideGroup: typeof import('vuetify/components')['VSlideGroup']
|
|
443
444
|
VSlideGroupItem: typeof import('vuetify/components')['VSlideGroupItem']
|
|
444
|
-
VSlider: typeof import('vuetify/components')['VSlider']
|
|
445
|
-
VSnackbar: typeof import('vuetify/components')['VSnackbar']
|
|
446
445
|
VSwitch: typeof import('vuetify/components')['VSwitch']
|
|
446
|
+
VSnackbar: typeof import('vuetify/components')['VSnackbar']
|
|
447
447
|
VSystemBar: typeof import('vuetify/components')['VSystemBar']
|
|
448
448
|
VTabs: typeof import('vuetify/components')['VTabs']
|
|
449
449
|
VTab: typeof import('vuetify/components')['VTab']
|
|
@@ -458,25 +458,25 @@ declare module '@vue/runtime-core' {
|
|
|
458
458
|
VTooltip: typeof import('vuetify/components')['VTooltip']
|
|
459
459
|
VWindow: typeof import('vuetify/components')['VWindow']
|
|
460
460
|
VWindowItem: typeof import('vuetify/components')['VWindowItem']
|
|
461
|
-
|
|
462
|
-
VForm: typeof import('vuetify/components')['VForm']
|
|
461
|
+
VHover: typeof import('vuetify/components')['VHover']
|
|
463
462
|
VContainer: typeof import('vuetify/components')['VContainer']
|
|
464
463
|
VCol: typeof import('vuetify/components')['VCol']
|
|
465
464
|
VRow: typeof import('vuetify/components')['VRow']
|
|
466
465
|
VSpacer: typeof import('vuetify/components')['VSpacer']
|
|
467
|
-
|
|
466
|
+
VForm: typeof import('vuetify/components')['VForm']
|
|
467
|
+
VDefaultsProvider: typeof import('vuetify/components')['VDefaultsProvider']
|
|
468
468
|
VLayout: typeof import('vuetify/components')['VLayout']
|
|
469
469
|
VLayoutItem: typeof import('vuetify/components')['VLayoutItem']
|
|
470
470
|
VLazy: typeof import('vuetify/components')['VLazy']
|
|
471
471
|
VLocaleProvider: typeof import('vuetify/components')['VLocaleProvider']
|
|
472
472
|
VNoSsr: typeof import('vuetify/components')['VNoSsr']
|
|
473
473
|
VParallax: typeof import('vuetify/components')['VParallax']
|
|
474
|
-
VRadio: typeof import('vuetify/components')['VRadio']
|
|
475
474
|
VRangeSlider: typeof import('vuetify/components')['VRangeSlider']
|
|
475
|
+
VRadio: typeof import('vuetify/components')['VRadio']
|
|
476
476
|
VResponsive: typeof import('vuetify/components')['VResponsive']
|
|
477
|
-
VThemeProvider: typeof import('vuetify/components')['VThemeProvider']
|
|
478
477
|
VValidation: typeof import('vuetify/components')['VValidation']
|
|
479
478
|
VVirtualScroll: typeof import('vuetify/components')['VVirtualScroll']
|
|
479
|
+
VThemeProvider: typeof import('vuetify/components')['VThemeProvider']
|
|
480
480
|
VFabTransition: typeof import('vuetify/components')['VFabTransition']
|
|
481
481
|
VDialogBottomTransition: typeof import('vuetify/components')['VDialogBottomTransition']
|
|
482
482
|
VDialogTopTransition: typeof import('vuetify/components')['VDialogTopTransition']
|
|
@@ -184,19 +184,21 @@ export const VDataTableVirtual = genericComponent()({
|
|
|
184
184
|
...slots,
|
|
185
185
|
item: itemSlotProps => _createVNode(VVirtualScrollItem, {
|
|
186
186
|
"key": itemSlotProps.item.index,
|
|
187
|
-
"dynamicHeight": true,
|
|
188
187
|
"renderless": true,
|
|
189
188
|
"onUpdate:height": height => handleItemResize(itemSlotProps.item.index, height)
|
|
190
189
|
}, {
|
|
191
|
-
default:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
default: _ref2 => {
|
|
191
|
+
let {
|
|
192
|
+
itemRef
|
|
193
|
+
} = _ref2;
|
|
194
|
+
return slots.item?.({
|
|
195
|
+
...itemSlotProps,
|
|
196
|
+
itemRef
|
|
197
|
+
}) ?? _createVNode(VDataTableRow, _mergeProps(itemSlotProps.props, {
|
|
198
|
+
"ref": itemRef,
|
|
199
|
+
"key": itemSlotProps.item.index
|
|
200
|
+
}), slots);
|
|
201
|
+
}
|
|
200
202
|
})
|
|
201
203
|
}), _createVNode("tr", {
|
|
202
204
|
"style": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VDataTableVirtual.mjs","names":["makeDataTableProps","VDataTableHeaders","VDataTableRow","VDataTableRows","VTable","VVirtualScrollItem","provideExpanded","createGroupBy","makeDataTableGroupProps","provideGroupBy","useGroupedItems","createHeaders","useDataTableItems","useOptions","provideSelection","createSort","provideSort","useSortedItems","provideDefaults","makeFilterProps","useFilter","makeVirtualProps","useVirtual","computed","shallowRef","toRef","convertToUnit","genericComponent","propsFactory","useRender","makeVDataTableVirtualProps","VDataTableVirtual","name","props","emits","value","click:row","e","setup","_ref","emit","slots","groupBy","sortBy","multiSort","mustSort","columns","headers","showSelect","showExpand","items","search","filteredItems","transform","item","toggleSort","sortByWithGroups","opened","extractRows","isGroupOpen","toggleGroup","sortedItems","flatItems","allItems","isSelected","select","selectAll","toggleSelect","someSelected","allSelected","currentPage","isExpanded","toggleExpand","headerHeight","length","containerRef","paddingTop","paddingBottom","computedItems","handleItemResize","handleScroll","displayItems","map","raw","page","itemsPerPage","hideNoData","noDataText","loading","loadingText","slotProps","groupedItems","dataTableHeadersProps","filterProps","dataTableRowsProps","tableProps","_createVNode","_mergeProps","class","style","top","wrapper","height","fixedHeader","border","itemSlotProps","index","default","bottom"],"sources":["../../../src/labs/VDataTable/VDataTableVirtual.tsx"],"sourcesContent":["// Components\nimport { makeDataTableProps } from './VDataTable'\nimport { VDataTableHeaders } from './VDataTableHeaders'\nimport { VDataTableRow } from './VDataTableRow'\nimport { VDataTableRows } from './VDataTableRows'\nimport { VTable } from '@/components/VTable'\nimport { VVirtualScrollItem } from '@/components/VVirtualScroll/VVirtualScrollItem'\n\n// Composables\nimport { provideExpanded } from './composables/expand'\nimport { createGroupBy, makeDataTableGroupProps, provideGroupBy, useGroupedItems } from './composables/group'\nimport { createHeaders } from './composables/headers'\nimport { useDataTableItems } from './composables/items'\nimport { useOptions } from './composables/options'\nimport { provideSelection } from './composables/select'\nimport { createSort, provideSort, useSortedItems } from './composables/sort'\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeFilterProps, useFilter } from '@/composables/filter'\nimport { makeVirtualProps, useVirtual } from '@/composables/virtual'\n\n// Utilities\nimport { computed, shallowRef, toRef } from 'vue'\nimport { convertToUnit, genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { DataTableItem } from './types'\nimport type { VDataTableSlotProps } from './VDataTable'\nimport type { VDataTableHeadersSlots } from './VDataTableHeaders'\nimport type { VDataTableRowsSlots } from './VDataTableRows'\n\ntype VDataTableVirtualSlotProps = Omit<VDataTableSlotProps, 'setItemsPerPage' | 'page' | 'pageCount' | 'itemsPerPage'>\n\nexport type VDataTableVirtualSlots = VDataTableRowsSlots & VDataTableHeadersSlots & {\n top: VDataTableVirtualSlotProps\n headers: VDataTableHeadersSlots['headers']\n bottom: VDataTableVirtualSlotProps\n}\n\nexport const makeVDataTableVirtualProps = propsFactory({\n ...makeDataTableProps(),\n ...makeDataTableGroupProps(),\n ...makeVirtualProps(),\n ...makeFilterProps(),\n}, 'VDataTableVirtual')\n\nexport const VDataTableVirtual = genericComponent<VDataTableVirtualSlots>()({\n name: 'VDataTableVirtual',\n\n props: makeVDataTableVirtualProps(),\n\n emits: {\n 'update:modelValue': (value: any[]) => true,\n 'update:sortBy': (value: any) => true,\n 'update:options': (value: any) => true,\n 'update:groupBy': (value: any) => true,\n 'update:expanded': (value: any) => true,\n 'click:row': (e: Event, value: { item: DataTableItem }) => true,\n },\n\n setup (props, { emit, slots }) {\n const { groupBy } = createGroupBy(props)\n const { sortBy, multiSort, mustSort } = createSort(props)\n\n const { columns, headers } = createHeaders(props, {\n groupBy,\n showSelect: toRef(props, 'showSelect'),\n showExpand: toRef(props, 'showExpand'),\n })\n const { items } = useDataTableItems(props, columns)\n\n const search = toRef(props, 'search')\n const { filteredItems } = useFilter<DataTableItem>(props, items, search, { transform: item => item.columns })\n\n const { toggleSort } = provideSort({ sortBy, multiSort, mustSort })\n const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy })\n\n const { sortedItems } = useSortedItems(props, filteredItems, sortByWithGroups)\n const { flatItems } = useGroupedItems(sortedItems, groupBy, opened)\n\n const allItems = computed(() => extractRows(flatItems.value))\n\n const { isSelected, select, selectAll, toggleSelect, someSelected, allSelected } = provideSelection(props, {\n allItems,\n currentPage: allItems,\n })\n const { isExpanded, toggleExpand } = provideExpanded(props)\n\n const headerHeight = computed(() => headers.value.length * 56)\n\n const {\n containerRef,\n paddingTop,\n paddingBottom,\n computedItems,\n handleItemResize,\n handleScroll,\n } = useVirtual(props, flatItems, headerHeight)\n const displayItems = computed(() => computedItems.value.map(item => item.raw))\n\n useOptions({\n sortBy,\n page: shallowRef(1),\n itemsPerPage: shallowRef(-1),\n groupBy,\n search,\n })\n\n provideDefaults({\n VDataTableRows: {\n hideNoData: toRef(props, 'hideNoData'),\n noDataText: toRef(props, 'noDataText'),\n loading: toRef(props, 'loading'),\n loadingText: toRef(props, 'loadingText'),\n },\n })\n\n const slotProps = computed<VDataTableVirtualSlotProps>(() => ({\n sortBy: sortBy.value,\n toggleSort,\n someSelected: someSelected.value,\n allSelected: allSelected.value,\n isSelected,\n select,\n selectAll,\n toggleSelect,\n isExpanded,\n toggleExpand,\n isGroupOpen,\n toggleGroup,\n items: allItems.value,\n groupedItems: flatItems.value,\n columns: columns.value,\n headers: headers.value,\n }))\n\n useRender(() => {\n const [dataTableHeadersProps] = VDataTableHeaders.filterProps(props)\n const [dataTableRowsProps] = VDataTableRows.filterProps(props)\n const [tableProps] = VTable.filterProps(props)\n\n return (\n <VTable\n class={[\n 'v-data-table',\n {\n 'v-data-table--loading': props.loading,\n },\n props.class,\n ]}\n style={ props.style }\n { ...tableProps }\n >\n {{\n top: () => slots.top?.(slotProps.value),\n wrapper: () => (\n <div\n ref={ containerRef }\n onScroll={ handleScroll }\n class=\"v-table__wrapper\"\n style={{\n height: convertToUnit(props.height),\n }}\n >\n <table>\n <thead>\n <VDataTableHeaders\n { ...dataTableHeadersProps }\n sticky={ props.fixedHeader }\n v-slots={ slots }\n />\n </thead>\n <tbody>\n <tr style={{ height: convertToUnit(paddingTop.value), border: 0 }}>\n <td colspan={ columns.value.length } style={{ height: convertToUnit(paddingTop.value), border: 0 }}></td>\n </tr>\n\n <VDataTableRows\n { ...dataTableRowsProps }\n items={ displayItems.value }\n >\n {{\n ...slots,\n item: itemSlotProps => (\n <VVirtualScrollItem\n key={ itemSlotProps.item.index }\n dynamicHeight\n renderless\n onUpdate:height={ height => handleItemResize(itemSlotProps.item.index, height) }\n >\n { slotProps => (\n slots.item?.({ ...itemSlotProps, props: { ...itemSlotProps.props, ...slotProps?.props } }) ?? (\n <VDataTableRow\n { ...itemSlotProps.props }\n { ...slotProps?.props }\n key={ itemSlotProps.item.index }\n v-slots={ slots }\n />\n )\n )}\n </VVirtualScrollItem>\n ),\n }}\n </VDataTableRows>\n\n <tr style={{ height: convertToUnit(paddingBottom.value), border: 0 }}>\n <td colspan={ columns.value.length } style={{ height: convertToUnit(paddingBottom.value), border: 0 }}></td>\n </tr>\n </tbody>\n </table>\n </div>\n ),\n bottom: () => slots.bottom?.(slotProps.value),\n }}\n </VTable>\n )\n })\n },\n})\n\nexport type VDataTableVirtual = InstanceType<typeof VDataTableVirtual>\n"],"mappings":";AAAA;AAAA,SACSA,kBAAkB;AAAA,SAClBC,iBAAiB;AAAA,SACjBC,aAAa;AAAA,SACbC,cAAc;AAAA,SACdC,MAAM;AAAA,SACNC,kBAAkB,kEAE3B;AAAA,SACSC,eAAe;AAAA,SACfC,aAAa,EAAEC,uBAAuB,EAAEC,cAAc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ACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"VDataTableVirtual.mjs","names":["makeDataTableProps","VDataTableHeaders","VDataTableRow","VDataTableRows","VTable","VVirtualScrollItem","provideExpanded","createGroupBy","makeDataTableGroupProps","provideGroupBy","useGroupedItems","createHeaders","useDataTableItems","useOptions","provideSelection","createSort","provideSort","useSortedItems","provideDefaults","makeFilterProps","useFilter","makeVirtualProps","useVirtual","computed","shallowRef","toRef","convertToUnit","genericComponent","propsFactory","useRender","makeVDataTableVirtualProps","VDataTableVirtual","name","props","emits","value","click:row","e","setup","_ref","emit","slots","groupBy","sortBy","multiSort","mustSort","columns","headers","showSelect","showExpand","items","search","filteredItems","transform","item","toggleSort","sortByWithGroups","opened","extractRows","isGroupOpen","toggleGroup","sortedItems","flatItems","allItems","isSelected","select","selectAll","toggleSelect","someSelected","allSelected","currentPage","isExpanded","toggleExpand","headerHeight","length","containerRef","paddingTop","paddingBottom","computedItems","handleItemResize","handleScroll","displayItems","map","raw","page","itemsPerPage","hideNoData","noDataText","loading","loadingText","slotProps","groupedItems","dataTableHeadersProps","filterProps","dataTableRowsProps","tableProps","_createVNode","_mergeProps","class","style","top","wrapper","height","fixedHeader","border","itemSlotProps","index","default","_ref2","itemRef","bottom"],"sources":["../../../src/labs/VDataTable/VDataTableVirtual.tsx"],"sourcesContent":["// Components\nimport { makeDataTableProps } from './VDataTable'\nimport { VDataTableHeaders } from './VDataTableHeaders'\nimport { VDataTableRow } from './VDataTableRow'\nimport { VDataTableRows } from './VDataTableRows'\nimport { VTable } from '@/components/VTable'\nimport { VVirtualScrollItem } from '@/components/VVirtualScroll/VVirtualScrollItem'\n\n// Composables\nimport { provideExpanded } from './composables/expand'\nimport { createGroupBy, makeDataTableGroupProps, provideGroupBy, useGroupedItems } from './composables/group'\nimport { createHeaders } from './composables/headers'\nimport { useDataTableItems } from './composables/items'\nimport { useOptions } from './composables/options'\nimport { provideSelection } from './composables/select'\nimport { createSort, provideSort, useSortedItems } from './composables/sort'\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeFilterProps, useFilter } from '@/composables/filter'\nimport { makeVirtualProps, useVirtual } from '@/composables/virtual'\n\n// Utilities\nimport { computed, shallowRef, toRef } from 'vue'\nimport { convertToUnit, genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { Ref } from 'vue'\nimport type { DataTableItem } from './types'\nimport type { VDataTableSlotProps } from './VDataTable'\nimport type { VDataTableHeadersSlots } from './VDataTableHeaders'\nimport type { VDataTableRowsSlots } from './VDataTableRows'\n\ntype VDataTableVirtualSlotProps = Omit<VDataTableSlotProps, 'setItemsPerPage' | 'page' | 'pageCount' | 'itemsPerPage'>\n\nexport type VDataTableVirtualSlots = VDataTableRowsSlots & VDataTableHeadersSlots & {\n top: VDataTableVirtualSlotProps\n headers: VDataTableHeadersSlots['headers']\n bottom: VDataTableVirtualSlotProps\n item: {\n itemRef: Ref<HTMLElement | undefined>\n }\n}\n\nexport const makeVDataTableVirtualProps = propsFactory({\n ...makeDataTableProps(),\n ...makeDataTableGroupProps(),\n ...makeVirtualProps(),\n ...makeFilterProps(),\n}, 'VDataTableVirtual')\n\nexport const VDataTableVirtual = genericComponent<VDataTableVirtualSlots>()({\n name: 'VDataTableVirtual',\n\n props: makeVDataTableVirtualProps(),\n\n emits: {\n 'update:modelValue': (value: any[]) => true,\n 'update:sortBy': (value: any) => true,\n 'update:options': (value: any) => true,\n 'update:groupBy': (value: any) => true,\n 'update:expanded': (value: any) => true,\n 'click:row': (e: Event, value: { item: DataTableItem }) => true,\n },\n\n setup (props, { emit, slots }) {\n const { groupBy } = createGroupBy(props)\n const { sortBy, multiSort, mustSort } = createSort(props)\n\n const { columns, headers } = createHeaders(props, {\n groupBy,\n showSelect: toRef(props, 'showSelect'),\n showExpand: toRef(props, 'showExpand'),\n })\n const { items } = useDataTableItems(props, columns)\n\n const search = toRef(props, 'search')\n const { filteredItems } = useFilter<DataTableItem>(props, items, search, { transform: item => item.columns })\n\n const { toggleSort } = provideSort({ sortBy, multiSort, mustSort })\n const { sortByWithGroups, opened, extractRows, isGroupOpen, toggleGroup } = provideGroupBy({ groupBy, sortBy })\n\n const { sortedItems } = useSortedItems(props, filteredItems, sortByWithGroups)\n const { flatItems } = useGroupedItems(sortedItems, groupBy, opened)\n\n const allItems = computed(() => extractRows(flatItems.value))\n\n const { isSelected, select, selectAll, toggleSelect, someSelected, allSelected } = provideSelection(props, {\n allItems,\n currentPage: allItems,\n })\n const { isExpanded, toggleExpand } = provideExpanded(props)\n\n const headerHeight = computed(() => headers.value.length * 56)\n\n const {\n containerRef,\n paddingTop,\n paddingBottom,\n computedItems,\n handleItemResize,\n handleScroll,\n } = useVirtual(props, flatItems, headerHeight)\n const displayItems = computed(() => computedItems.value.map(item => item.raw))\n\n useOptions({\n sortBy,\n page: shallowRef(1),\n itemsPerPage: shallowRef(-1),\n groupBy,\n search,\n })\n\n provideDefaults({\n VDataTableRows: {\n hideNoData: toRef(props, 'hideNoData'),\n noDataText: toRef(props, 'noDataText'),\n loading: toRef(props, 'loading'),\n loadingText: toRef(props, 'loadingText'),\n },\n })\n\n const slotProps = computed<VDataTableVirtualSlotProps>(() => ({\n sortBy: sortBy.value,\n toggleSort,\n someSelected: someSelected.value,\n allSelected: allSelected.value,\n isSelected,\n select,\n selectAll,\n toggleSelect,\n isExpanded,\n toggleExpand,\n isGroupOpen,\n toggleGroup,\n items: allItems.value,\n groupedItems: flatItems.value,\n columns: columns.value,\n headers: headers.value,\n }))\n\n useRender(() => {\n const [dataTableHeadersProps] = VDataTableHeaders.filterProps(props)\n const [dataTableRowsProps] = VDataTableRows.filterProps(props)\n const [tableProps] = VTable.filterProps(props)\n\n return (\n <VTable\n class={[\n 'v-data-table',\n {\n 'v-data-table--loading': props.loading,\n },\n props.class,\n ]}\n style={ props.style }\n { ...tableProps }\n >\n {{\n top: () => slots.top?.(slotProps.value),\n wrapper: () => (\n <div\n ref={ containerRef }\n onScroll={ handleScroll }\n class=\"v-table__wrapper\"\n style={{\n height: convertToUnit(props.height),\n }}\n >\n <table>\n <thead>\n <VDataTableHeaders\n { ...dataTableHeadersProps }\n sticky={ props.fixedHeader }\n v-slots={ slots }\n />\n </thead>\n <tbody>\n <tr style={{ height: convertToUnit(paddingTop.value), border: 0 }}>\n <td colspan={ columns.value.length } style={{ height: convertToUnit(paddingTop.value), border: 0 }}></td>\n </tr>\n\n <VDataTableRows\n { ...dataTableRowsProps }\n items={ displayItems.value }\n >\n {{\n ...slots,\n item: itemSlotProps => (\n <VVirtualScrollItem\n key={ itemSlotProps.item.index }\n renderless\n onUpdate:height={ height => handleItemResize(itemSlotProps.item.index, height) }\n >\n { ({ itemRef }) => (\n slots.item?.({ ...itemSlotProps, itemRef }) ?? (\n <VDataTableRow\n { ...itemSlotProps.props }\n ref={ itemRef }\n key={ itemSlotProps.item.index }\n v-slots={ slots }\n />\n )\n )}\n </VVirtualScrollItem>\n ),\n }}\n </VDataTableRows>\n\n <tr style={{ height: convertToUnit(paddingBottom.value), border: 0 }}>\n <td colspan={ columns.value.length } style={{ height: convertToUnit(paddingBottom.value), border: 0 }}></td>\n </tr>\n </tbody>\n </table>\n </div>\n ),\n bottom: () => slots.bottom?.(slotProps.value),\n }}\n </VTable>\n )\n })\n },\n})\n\nexport type VDataTableVirtual = InstanceType<typeof VDataTableVirtual>\n"],"mappings":";AAAA;AAAA,SACSA,kBAAkB;AAAA,SAClBC,iBAAiB;AAAA,SACjBC,aAAa;AAAA,SACbC,cAAc;AAAA,SACdC,MAAM;AAAA,SACNC,kBAAkB,kEAE3B;AAAA,SACSC,eAAe;AAAA,SACfC,aAAa,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,eAAe;AAAA,SACvEC,aAAa;AAAA,SACbC,iBAAiB;AAAA,SACjBC,UAAU;AAAA,SACVC,gBAAgB;AAAA,SAChBC,UAAU,EAAEC,WAAW,EAAEC,cAAc;AAAA,SACvCC,eAAe;AAAA,SACfC,eAAe,EAAEC,SAAS;AAAA,SAC1BC,gBAAg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AY,CAAC9C;QAAK;UAGxB,GAAGM,KAAK;UACRa,IAAI,EAAEmD,aAAa,IAAAT,YAAA,CAAA3F,kBAAA;YAAA,OAEToG,aAAa,CAACnD,IAAI,CAACoD,KAAK;YAAA;YAAA,mBAEZJ,MAAM,IAAIvB,gBAAgB,CAAC0B,aAAa,CAACnD,IAAI,CAACoD,KAAK,EAAEJ,MAAM;UAAC;YAAAK,OAAA,EAE5EC,KAAA;cAAA,IAAC;gBAAEC;cAAQ,CAAC,GAAAD,KAAA;cAAA,OACZnE,KAAK,CAACa,IAAI,GAAG;gBAAE,GAAGmD,aAAa;gBAAEI;cAAQ,CAAC,CAAC,IAAAb,YAAA,CAAA9F,aAAA,EAAA+F,WAAA,CAElCQ,aAAa,CAACxE,KAAK;gBAAA,OAClB4E,OAAO;gBAAA,OACPJ,aAAa,CAACnD,IAAI,CAACoD;cAAK,IACpBjE,KAAK,CAElB;YAAA;UACF;QAEJ,IAAAuD,YAAA;UAAA,SAIM;YAAEM,MAAM,EAAE5E,aAAa,CAACmD,aAAa,CAAC1C,KAAK,CAAC;YAAEqE,MAAM,EAAE;UAAE;QAAC,IAAAR,YAAA;UAAA,WACpDlD,OAAO,CAACX,KAAK,CAACuC,MAAM;UAAA,SAAU;YAAE4B,MAAM,EAAE5E,aAAa,CAACmD,aAAa,CAAC1C,KAAK,CAAC;YAAEqE,MAAM,EAAE;UAAE;QAAC,gBAK9G;QACDM,MAAM,EAAEA,CAAA,KAAMrE,KAAK,CAACqE,MAAM,GAAGpB,SAAS,CAACvD,KAAK;MAAC;IAIrD,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Utilities
|
|
2
2
|
import { inject, provide, ref, watchEffect } from 'vue';
|
|
3
|
-
import { createRange, propsFactory } from "../../../util/index.mjs"; // Types
|
|
3
|
+
import { consoleWarn, createRange, propsFactory } from "../../../util/index.mjs"; // Types
|
|
4
4
|
export const makeDataTableHeaderProps = propsFactory({
|
|
5
5
|
headers: {
|
|
6
6
|
type: Array,
|
|
@@ -100,7 +100,11 @@ export function createHeaders(props, options) {
|
|
|
100
100
|
column,
|
|
101
101
|
row
|
|
102
102
|
} = _ref4;
|
|
103
|
-
|
|
103
|
+
let key = column.key;
|
|
104
|
+
if (key == null) {
|
|
105
|
+
consoleWarn('The header key value must not be null or undefined');
|
|
106
|
+
key = '';
|
|
107
|
+
}
|
|
104
108
|
for (let i = row; i <= row + (column.rowspan ?? 1) - 1; i++) {
|
|
105
109
|
fixedRows[i].push({
|
|
106
110
|
...column,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.mjs","names":["inject","provide","ref","watchEffect","createRange","propsFactory","makeDataTableHeaderProps","headers","type","Array","default","VDataTableHeadersSymbol","Symbol","for","createHeaders","props","options","columns","wrapped","length","isArray","flat","flatMap","row","index","map","column","rowCount","defaultHeader","title","sortable","defaultActionHeader","width","groupBy","value","findIndex","_ref","key","unshift","rowspan","splice","showSelect","_ref2","showExpand","_ref3","push","fixedRows","fixedOffsets","fill","forEach","_ref4","i","fixedOffset","Number","fixed","lastFixed","seen","Set","filtered","has","add","at","data","useHeaders","Error"],"sources":["../../../../src/labs/VDataTable/composables/headers.ts"],"sourcesContent":["// Utilities\nimport { inject, provide, ref, watchEffect } from 'vue'\nimport { createRange, propsFactory } from '@/util'\n\n// Types\nimport type { DeepReadonly, InjectionKey, PropType, Ref } from 'vue'\nimport type { SortItem } from './sort'\nimport type { DataTableHeader, InternalDataTableHeader } from '../types'\n\nexport const makeDataTableHeaderProps = propsFactory({\n headers: {\n type: Array as PropType<DeepReadonly<DataTableHeader[] | DataTableHeader[][]>>,\n default: () => ([]),\n },\n}, 'DataTable-header')\n\nexport const VDataTableHeadersSymbol: InjectionKey<{\n headers: Ref<InternalDataTableHeader[][]>\n columns: Ref<InternalDataTableHeader[]>\n}> = Symbol.for('vuetify:data-table-headers')\n\ntype HeaderProps = {\n headers: DeepReadonly<DataTableHeader[] | DataTableHeader[][]>\n}\n\nexport function createHeaders (\n props: HeaderProps,\n options?: {\n groupBy?: Ref<readonly SortItem[]>\n showSelect?: Ref<boolean>\n showExpand?: Ref<boolean>\n }\n) {\n const headers = ref<InternalDataTableHeader[][]>([])\n const columns = ref<InternalDataTableHeader[]>([])\n\n watchEffect(() => {\n const wrapped = !props.headers.length\n ? []\n : Array.isArray(props.headers[0])\n ? props.headers as DataTableHeader[][]\n : [props.headers as DataTableHeader[]]\n const flat = wrapped.flatMap((row, index) => row.map(column => ({ column, row: index })))\n\n const rowCount = wrapped.length\n const defaultHeader = { title: '', sortable: false }\n const defaultActionHeader = { ...defaultHeader, width: 48 }\n\n if (options?.groupBy?.value.length) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-group')\n if (index < 0) flat.unshift({ column: { ...defaultHeader, key: 'data-table-group', title: 'Group', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n if (options?.showSelect?.value) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-select')\n if (index < 0) flat.unshift({ column: { ...defaultActionHeader, key: 'data-table-select', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultActionHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n if (options?.showExpand?.value) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-expand')\n if (index < 0) flat.push({ column: { ...defaultActionHeader, key: 'data-table-expand', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultActionHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n const fixedRows: InternalDataTableHeader[][] = createRange(rowCount).map(() => [])\n const fixedOffsets = createRange(rowCount).fill(0)\n\n flat.forEach(({ column, row }) => {\n
|
|
1
|
+
{"version":3,"file":"headers.mjs","names":["inject","provide","ref","watchEffect","consoleWarn","createRange","propsFactory","makeDataTableHeaderProps","headers","type","Array","default","VDataTableHeadersSymbol","Symbol","for","createHeaders","props","options","columns","wrapped","length","isArray","flat","flatMap","row","index","map","column","rowCount","defaultHeader","title","sortable","defaultActionHeader","width","groupBy","value","findIndex","_ref","key","unshift","rowspan","splice","showSelect","_ref2","showExpand","_ref3","push","fixedRows","fixedOffsets","fill","forEach","_ref4","i","fixedOffset","Number","fixed","lastFixed","seen","Set","filtered","has","add","at","data","useHeaders","Error"],"sources":["../../../../src/labs/VDataTable/composables/headers.ts"],"sourcesContent":["// Utilities\nimport { inject, provide, ref, watchEffect } from 'vue'\nimport { consoleWarn, createRange, propsFactory } from '@/util'\n\n// Types\nimport type { DeepReadonly, InjectionKey, PropType, Ref } from 'vue'\nimport type { SortItem } from './sort'\nimport type { DataTableHeader, InternalDataTableHeader } from '../types'\n\nexport const makeDataTableHeaderProps = propsFactory({\n headers: {\n type: Array as PropType<DeepReadonly<DataTableHeader[] | DataTableHeader[][]>>,\n default: () => ([]),\n },\n}, 'DataTable-header')\n\nexport const VDataTableHeadersSymbol: InjectionKey<{\n headers: Ref<InternalDataTableHeader[][]>\n columns: Ref<InternalDataTableHeader[]>\n}> = Symbol.for('vuetify:data-table-headers')\n\ntype HeaderProps = {\n headers: DeepReadonly<DataTableHeader[] | DataTableHeader[][]>\n}\n\nexport function createHeaders (\n props: HeaderProps,\n options?: {\n groupBy?: Ref<readonly SortItem[]>\n showSelect?: Ref<boolean>\n showExpand?: Ref<boolean>\n }\n) {\n const headers = ref<InternalDataTableHeader[][]>([])\n const columns = ref<InternalDataTableHeader[]>([])\n\n watchEffect(() => {\n const wrapped = !props.headers.length\n ? []\n : Array.isArray(props.headers[0])\n ? props.headers as DataTableHeader[][]\n : [props.headers as DataTableHeader[]]\n const flat = wrapped.flatMap((row, index) => row.map(column => ({ column, row: index })))\n\n const rowCount = wrapped.length\n const defaultHeader = { title: '', sortable: false }\n const defaultActionHeader = { ...defaultHeader, width: 48 }\n\n if (options?.groupBy?.value.length) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-group')\n if (index < 0) flat.unshift({ column: { ...defaultHeader, key: 'data-table-group', title: 'Group', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n if (options?.showSelect?.value) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-select')\n if (index < 0) flat.unshift({ column: { ...defaultActionHeader, key: 'data-table-select', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultActionHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n if (options?.showExpand?.value) {\n const index = flat.findIndex(({ column }) => column.key === 'data-table-expand')\n if (index < 0) flat.push({ column: { ...defaultActionHeader, key: 'data-table-expand', rowspan: rowCount }, row: 0 })\n else flat.splice(index, 1, { column: { ...defaultActionHeader, ...flat[index].column }, row: flat[index].row })\n }\n\n const fixedRows: InternalDataTableHeader[][] = createRange(rowCount).map(() => [])\n const fixedOffsets = createRange(rowCount).fill(0)\n\n flat.forEach(({ column, row }) => {\n let key = column.key\n if (key == null) {\n consoleWarn('The header key value must not be null or undefined')\n key = ''\n }\n for (let i = row; i <= row + (column.rowspan ?? 1) - 1; i++) {\n fixedRows[i].push({\n ...column,\n key,\n fixedOffset: fixedOffsets[i],\n sortable: column.sortable ?? !!column.key,\n })\n\n fixedOffsets[i] += Number(column.width ?? 0)\n }\n })\n\n fixedRows.forEach(row => {\n for (let i = row.length; i--; i >= 0) {\n if (row[i].fixed) {\n row[i].lastFixed = true\n return\n }\n }\n })\n\n const seen = new Set()\n headers.value = fixedRows.map(row => {\n const filtered = []\n for (const column of row) {\n if (!seen.has(column.key)) {\n seen.add(column.key)\n filtered.push(column)\n }\n }\n\n return filtered\n })\n\n columns.value = fixedRows.at(-1) ?? []\n })\n\n const data = { headers, columns }\n\n provide(VDataTableHeadersSymbol, data)\n\n return data\n}\n\nexport function useHeaders () {\n const data = inject(VDataTableHeadersSymbol)\n\n if (!data) throw new Error('Missing headers!')\n\n return data\n}\n"],"mappings":"AAAA;AACA,SAASA,MAAM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