refactor sizesetting into unitsetting allowing more unit types with i18n support

This commit is contained in:
Henry Jameson 2024-04-24 15:58:26 +03:00
commit 6ff0a7f021
9 changed files with 38 additions and 36 deletions

View file

@ -0,0 +1,61 @@
<template>
<span
v-if="matchesExpertLevel"
class="UnitSetting"
>
<label
:for="path"
class="size-label"
>
<slot />
</label>
<input
:id="path"
class="number-input"
type="number"
step="1"
:disabled="disabled"
:min="min || 0"
:value="stateValue"
@change="updateValue"
>
<Select
:id="path"
:model-value="stateUnit"
:disabled="disabled"
class="unit-input unstyled"
@change="updateUnit"
>
<option
v-for="option in units"
:key="option"
:value="option"
>
{{ getUnitString(option) }}
</option>
</Select>
{{ ' ' }}
<ModifiedIndicator
:changed="isChanged"
:onclick="reset"
/>
</span>
</template>
<script src="./unit_setting.js"></script>
<style lang="scss">
.UnitSetting {
.number-input {
max-width: 6.5em;
text-align: right;
}
.unit-input,
.unit-input select {
min-width: 4em;
width: auto;
}
}
</style>