@dimailn/vuetify 2.7.2-alpha49 → 2.7.2-alpha50

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, resolveComponent } from 'vue'
1
+ import { defineComponent, h, resolveComponent, Comment } from 'vue'
2
2
  import type { VNode, VNodeDirective } from '../types/vue-internal'
3
3
  import { VuetifyIcon } from 'vuetify/types/services/icons'
4
4
  import { DataTableCompareFunction, SelectItemKey, ItemGroup } from 'vuetify/types'
@@ -441,6 +441,22 @@ export function getSlot (vm: Vue, name = 'default', data?: object | (() => objec
441
441
  return undefined
442
442
  }
443
443
 
444
+ export function flattenSlotContent (content: VNode | VNode[] | null | undefined): VNode[] {
445
+ if (content == null) return []
446
+
447
+ const items = Array.isArray(content) ? content : [content]
448
+
449
+ return items.flatMap((item) => {
450
+ if (item == null || item.type === Comment) return []
451
+ if (Array.isArray(item)) return flattenSlotContent(item)
452
+ return [item]
453
+ })
454
+ }
455
+
456
+ export function hasSlotContent (content: VNode | VNode[] | null | undefined): boolean {
457
+ return flattenSlotContent(content).length > 0
458
+ }
459
+
444
460
  export function clamp (value: number, min = 0, max = 1) {
445
461
  return Math.max(min, Math.min(max, value))
446
462
  }