Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.labs.VTreeview.VTreeviewItem.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"VTreeviewItem.mjs","names":["VBtn","VListItemAction","VListItemSubtitle","VListItemTitle","makeVListItemProps","VListItem","VProgressCircular","useDensity","IconValue","useNestedItem","useLink","genOverlays","computed","inject","ref","genericComponent","propsFactory","useRender","VTreeviewSymbol","makeVTreeviewItemProps","loading","Boolean","toggleIcon","slim","VTreeviewItem","name","props","setup","_ref","attrs","slots","emit","link","rawId","value","undefined","href","vListItemRef","activate","isActivated","select","isSelected","isIndeterminate","isGroupActivator","root","id","isActivatableGroupActivator","activatable","densityClasses","slotProps","isActive","isClickable","disabled","list","activateItem","e","onKeyDown","key","preventDefault","visibleIds","hasTitle","title","hasSubtitle","subtitle","listItemProps","filterProps","hasPrepend","prepend","_withDirectives","_createVNode","has","class","_Fragment","default","onClick","loader","_resolveDirective","ripple","_mergeProps"],"sources":["../../../src/labs/VTreeview/VTreeviewItem.tsx"],"sourcesContent":["// Styles\nimport './VTreeviewItem.sass'\n\n// Components\nimport { VBtn } from '@/components/VBtn'\nimport { VListItemAction, VListItemSubtitle, VListItemTitle } from '@/components/VList'\nimport { makeVListItemProps, VListItem } from '@/components/VList/VListItem'\nimport { VProgressCircular } from '@/components/VProgressCircular'\n\n// Composables\nimport { useDensity } from '@/composables/density'\nimport { IconValue } from '@/composables/icons'\nimport { useNestedItem } from '@/composables/nested/nested'\nimport { useLink } from '@/composables/router'\nimport { genOverlays } from '@/composables/variant'\n\n// Utilities\nimport { computed, inject, ref } from 'vue'\nimport { genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport { VTreeviewSymbol } from './shared'\nimport type { ListItemSlot, VListItemSlots } from '@/components/VList/VListItem'\n\nexport const makeVTreeviewItemProps = propsFactory({\n loading: Boolean,\n toggleIcon: IconValue,\n\n ...makeVListItemProps({ slim: true }),\n}, 'VTreeviewItem')\n\nexport const VTreeviewItem = genericComponent()({\n name: 'VTreeviewItem',\n\n props: makeVTreeviewItemProps(),\n\n setup (props, { attrs, slots, emit }) {\n const link = useLink(props, attrs)\n const rawId = computed(() => props.value === undefined ? link.href.value : props.value)\n const vListItemRef = ref()\n\n const {\n activate,\n isActivated,\n select,\n isSelected,\n isIndeterminate,\n isGroupActivator,\n root,\n id,\n } = useNestedItem(rawId, false)\n\n const isActivatableGroupActivator = computed(() =>\n (root.activatable.value) &&\n isGroupActivator\n )\n\n const { densityClasses } = useDensity(props, 'v-list-item')\n\n const slotProps = computed(() => ({\n isActive: isActivated.value,\n select,\n isSelected: isSelected.value,\n isIndeterminate: isIndeterminate.value,\n } satisfies ListItemSlot))\n\n const isClickable = computed(() =>\n !props.disabled &&\n props.link !== false &&\n (props.link || link.isClickable.value || (props.value != null && !!vListItemRef.value?.list))\n )\n\n function activateItem (e: MouseEvent | KeyboardEvent) {\n if (\n !isClickable.value ||\n (!isActivatableGroupActivator.value && isGroupActivator)\n ) return\n\n if (root.activatable.value) {\n if (isActivatableGroupActivator.value) {\n activate(!isActivated.value, e)\n } else {\n vListItemRef.value?.activate(!vListItemRef.value?.isActivated, e)\n }\n }\n }\n\n function onKeyDown (e: KeyboardEvent) {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n activateItem(e)\n }\n }\n\n const visibleIds = inject(VTreeviewSymbol, { visibleIds: ref() }).visibleIds\n\n useRender(() => {\n const hasTitle = (slots.title || props.title != null)\n const hasSubtitle = (slots.subtitle || props.subtitle != null)\n const listItemProps = VListItem.filterProps(props)\n const hasPrepend = slots.prepend || props.toggleIcon\n\n return isActivatableGroupActivator.value\n ? (\n \n <>\n { genOverlays(isActivated.value || isSelected.value, 'v-list-item') }\n { props.toggleIcon && (\n
\n \n {{\n loader () {\n return (\n \n )\n },\n }}\n \n \n )}\n\n >\n\n
\n { hasTitle && (\n \n { slots.title?.({ title: props.title }) ?? props.title }\n \n )}\n\n { hasSubtitle && (\n \n { slots.subtitle?.({ subtitle: props.subtitle }) ?? props.subtitle }\n \n )}\n\n { slots.default?.(slotProps.value) }\n
\n
\n ) : (\n \n {{\n ...slots,\n prepend: hasPrepend ? slotProps => {\n return (\n <>\n { props.toggleIcon && (\n \n \n {{\n loader () {\n return (\n \n )\n },\n }}\n \n \n )}\n\n { slots.prepend?.(slotProps) }\n >\n )\n } : undefined,\n }}\n \n )\n })\n\n return {}\n },\n})\n\nexport type VTreeviewItem = InstanceType\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI;AAAA,SACJC,eAAe,EAAEC,iBAAiB,EAAEC,cAAc;AAAA,SAClDC,kBAAkB,EAAEC,SAAS;AAAA,SAC7BC,iBAAiB,wDAE1B;AAAA,SACSC,UAAU;AAAA,SACVC,SAAS;AAAA,SACTC,aAAa;AAAA,SACbC,OAAO;AAAA,SACPC,WAAW,yCAEpB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,GAAG,QAAQ,KAAK;AAAA,SAClCC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,gCAElD;AAAA,SACSC,eAAe;AAGxB,OAAO,MAAMC,sBAAsB,GAAGH,YAAY,CAAC;EACjDI,OAAO,EAAEC,OAAO;EAChBC,UAAU,EAAEd,SAAS;EAErB,GAAGJ,kBAAkB,CAAC;IAAEmB,IAAI,EAAE;EAAK,CAAC;AACtC,CAAC,EAAE,eAAe,CAAC;AAEnB,OAAO,MAAMC,aAAa,GAAGT,gBAAgB,CAAiB,CAAC,CAAC;EAC9DU,IAAI,EAAE,eAAe;EAErBC,KAAK,EAAEP,sBAAsB,CAAC,CAAC;EAE/BQ,KAAKA,CAAED,KAAK,EAAAE,IAAA,EAA0B;IAAA,IAAxB;MAAEC,KAAK;MAAEC,KAAK;MAAEC;IAAK,CAAC,GAAAH,IAAA;IAClC,MAAMI,IAAI,GAAGtB,OAAO,CAACgB,KAAK,EAAEG,KAAK,CAAC;IA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