-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from mgreminger/no-auto-hz
Default Unit Updates
- Loading branch information
Showing
19 changed files
with
902 additions
and
159 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<script lang="ts"> | ||
import { ComboBox, ButtonSet, Button } from "carbon-components-svelte"; | ||
import CheckmarkOutline from "carbon-icons-svelte/lib/CheckmarkOutline.svelte"; | ||
import { mathCellChanged } from "./stores"; | ||
import { type CustomBaseUnits, baseUnitSystems, baseUnitChoices, | ||
getDefaultBaseUnits, isDefaultBaseUnits } from "./sheet/Sheet"; | ||
export let baseUnits: CustomBaseUnits; | ||
export function resetDefaults() { | ||
baseUnits = getDefaultBaseUnits(); | ||
} | ||
function update() { | ||
$mathCellChanged = true; | ||
} | ||
</script> | ||
|
||
<style> | ||
div.container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 20px; | ||
} | ||
div.combo-input { | ||
max-width: 250px; | ||
} | ||
</style> | ||
|
||
|
||
<div class="container"> | ||
<div> | ||
<div class="bx--label">Unit System Shortcuts</div> | ||
<ButtonSet> | ||
{#each baseUnitSystems.keys() as name} | ||
<Button | ||
kind="tertiary" | ||
on:click={() => baseUnits = getDefaultBaseUnits(name)} | ||
icon={isDefaultBaseUnits(baseUnits, name) ? CheckmarkOutline : null} | ||
> | ||
{name} | ||
</Button> | ||
{/each} | ||
</ButtonSet> | ||
</div> | ||
|
||
{#each baseUnitChoices as dimension (dimension.name)} | ||
<div class="combo-input"> | ||
<ComboBox | ||
titleText={dimension.label} | ||
placeholder="Select default unit method" | ||
bind:selectedId={baseUnits[dimension.name]} | ||
items={dimension.choices.map(value => ({id: value, text: value}))} | ||
on:select={update} | ||
/> | ||
</div> | ||
{/each} | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.