Skip to content

Commit 3ee77b5

Browse files
committed
virtual list fix and some prettier updates
1 parent 42293a5 commit 3ee77b5

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

.prettierrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
}
1111
}
1212
],
13-
"svelteSortOrder": "scripts-styles-markup"
13+
"svelteSortOrder": "scripts-styles-markup",
14+
"svelteBracketNewLine": false
1415
}

src/List.svelte

+6-13
Original file line numberDiff line numberDiff line change
@@ -271,30 +271,25 @@
271271
<div
272272
class="listContainer virtualList"
273273
bind:this={container}
274-
style={listStyle}
275-
>
276-
>
274+
style={listStyle}>
277275
<svelte:component
278276
this={VirtualList}
279277
{items}
280278
{itemHeight}
281279
let:item
282-
let:i
283-
>
280+
let:i>
284281
<div
285282
on:mouseover={() => handleHover(i)}
286283
on:click={(event) => handleClick({ item, i, event })}
287-
class="listItem"
288-
>
284+
class="listItem">
289285
<svelte:component
290286
this={Item}
291287
{item}
292288
{filterText}
293289
{getOptionLabel}
294290
isFirst={isItemFirst(i)}
295291
isActive={isItemActive(item, value, optionIdentifier)}
296-
isHover={isItemHover(hoverItemIndex, item, i, items)}
297-
/>
292+
isHover={isItemHover(hoverItemIndex, item, i, items)} />
298293
</div>
299294
</svelte:component>
300295
</div>
@@ -309,17 +304,15 @@
309304
<div
310305
on:mouseover={() => handleHover(i)}
311306
on:click={(event) => handleClick({ item, i, event })}
312-
class="listItem"
313-
>
307+
class="listItem">
314308
<svelte:component
315309
this={Item}
316310
{item}
317311
{filterText}
318312
{getOptionLabel}
319313
isFirst={isItemFirst(i)}
320314
isActive={isItemActive(item, value, optionIdentifier)}
321-
isHover={isItemHover(hoverItemIndex, item, i, items)}
322-
/>
315+
isHover={isItemHover(hoverItemIndex, item, i, items)} />
323316
</div>
324317
{/if}
325318
{:else}

src/VirtualList.svelte

+3-7
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,13 @@
145145
bind:this={viewport}
146146
bind:offsetHeight={viewport_height}
147147
on:scroll={handle_scroll}
148-
style="height: {height};"
149-
>
148+
style="height: {height};">
150149
<svelte-virtual-list-contents
151150
bind:this={contents}
152-
style="padding-top: {top}px; padding-bottom: {bottom}px;"
153-
>
151+
style="padding-top: {top}px; padding-bottom: {bottom}px;">
154152
{#each visible as row (row.index)}
155153
<svelte-virtual-list-row>
156-
<slot item={row.data} i={row.index} {hoverItemIndex}
157-
>Missing template</slot
158-
>
154+
<slot item={row.data} i={row.index} {hoverItemIndex}>Missing template</slot>
159155
</svelte-virtual-list-row>
160156
{/each}
161157
</svelte-virtual-list-contents>

0 commit comments

Comments
 (0)