{#snippet sample(style: { bg?: string; text?: string; bold?: boolean; italic?: boolean })} Aa {/snippet} {#snippet presets(onPick: (preset: (typeof RULE_PRESETS)[number]) => void)}
{#each RULE_PRESETS as preset, i (i)} {/each}
{/snippet}
Format {column} Only changes how values show in this view.
Unit
({ label: String(i), value: i })) ]} bind:value={ () => format?.decimals ?? AUTO_DECIMALS, (v) => update({ decimals: v === AUTO_DECIMALS ? undefined : v }) } /> format?.notation ?? 'plain', (v) => update({ notation: v === 'plain' ? undefined : (v as 'thousands' | 'compact') }) } > {#snippet children({ item })} {/snippet}
1234567.891 shows as {formatValue(1234567.891, format) ?? '1234567.891'}
Alignment format?.align ?? 'auto', (v) => update({ align: v === 'auto' ? undefined : (v as 'left' | 'right') }) } > {#snippet children({ item })} {/snippet}
Color rules {#each rules as rule, i (i)}
{ if (dragFrom === undefined) return e.preventDefault() const r = e.currentTarget.getBoundingClientRect() dropAt = { index: i, side: e.clientY < r.top + r.height / 2 ? 'above' : 'below' } }} ondrop={(e) => { e.preventDefault() dropRule() }} > {#if dropAt?.index === i && dragFrom !== undefined}
{/if}
{ dragFrom = i const row = e.currentTarget.parentElement if (row) e.dataTransfer?.setDragImage(row, 8, row.offsetHeight / 2) }} ondragend={() => { dragFrom = undefined dropAt = undefined }} >
= 4, =paid' }} bind:value={() => rule.condition, (v) => setRule(i, { condition: v })} />
setRule(i, { bg: e.currentTarget.value })} /> setRule(i, { text: e.currentTarget.value })} />
{/each}
{#snippet trigger()} {/snippet} {#snippet content()} {@render presets((preset) => { update({ rules: [...rules, { condition: '', ...preset }] }) addRuleOpen = false })} {/snippet}
Conditions use the search bar's syntax: text contains, =value is exact, numbers take >, >=, <, <= and !=. An empty condition matches every cell. Every matching rule applies, a later one overriding an earlier one.