{"version":3,"file":"items.mjs","names":["computed","getPropertyFromItem","propsFactory","makeDataIteratorItemsProps","items","type","Array","default","itemValue","String","Function","itemSelectable","returnObject","Boolean","transformItem","props","item","value","selectable","raw","transformItems","array","push","useDataIteratorItems"],"sources":["../../../../src/components/VDataIterator/composables/items.ts"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { getPropertyFromItem, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { GroupableItem } from '@/components/VDataTable/composables/group'\nimport type { SelectableItem } from '@/components/VDataTable/composables/select'\nimport type { SelectItemKey } from '@/util'\n\nexport interface DataIteratorItemProps {\n items: any[]\n itemValue: SelectItemKey\n itemSelectable: SelectItemKey\n returnObject: boolean\n}\n\nexport interface DataIteratorItem extends GroupableItem, SelectableItem {\n value: unknown\n}\n\n// Composables\nexport const makeDataIteratorItemsProps = propsFactory({\n items: {\n type: Array as PropType,\n default: () => ([]),\n },\n itemValue: {\n type: [String, Array, Function] as PropType,\n default: 'id',\n },\n itemSelectable: {\n type: [String, Array, Function] as PropType,\n default: null,\n },\n returnObject: Boolean,\n}, 'DataIterator-items')\n\nexport function transformItem (\n props: Omit,\n item: any\n): DataIteratorItem {\n const value = props.returnObject ? item : getPropertyFromItem(item, props.itemValue)\n const selectable = getPropertyFromItem(item, props.itemSelectable, true)\n\n return {\n type: 'item',\n value,\n selectable,\n raw: item,\n }\n}\n\nexport function transformItems (\n props: Omit,\n items: DataIteratorItemProps['items']\n) {\n const array: DataIteratorItem[] = []\n\n for (const item of items) {\n array.push(transformItem(props, item))\n }\n\n return array\n}\n\nexport function useDataIteratorItems (props: DataIteratorItemProps) {\n const items = computed(() => transformItems(props, props.items))\n\n return { items }\n}\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,KAAK;AAAA,SACrBC,mBAAmB,EAAEC,YAAY,mCAE1C;AAiBA;AACA,OAAO,MAAMC,0BAA0B,GAAGD,YAAY,CAAC;EACrDE,KAAK,EAAE;IACL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