import type { StoryFn } from '@storybook/vue3'; import type { ComponentInstance } from 'vue'; import N8nRecycleScroller from './RecycleScroller.vue'; export default { title: 'Atoms/RecycleScroller', component: N8nRecycleScroller, argTypes: {}, }; const Template: StoryFn = (args) => ({ setup: () => ({ args }), components: { N8nRecycleScroller, }, data() { return { items: Array.from(Array(256).keys()).map((i) => ({ id: i })) as Array<{ id: number; height: number; }>, }; }, methods: { resizeItem(item: { id: string; height: string }, fn: (item: { id: string }) => void) { const itemRef = (this as ComponentInstance).$refs[ `item-${item.id}` ] as HTMLElement; item.height = '200px'; itemRef.style.height = '200px'; fn(item); }, getItemStyle(item: { id: string; height?: string }) { return { height: item.height || '100px', width: '100%', backgroundColor: `hsl(${parseInt(item.id, 10) * 1.4}, 100%, 50%)`, cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', }; }, }, template: `
`, }); export const RecycleScroller = Template.bind({});