Skip to content

Commit

Permalink
Fix gearsets setting middle state crash designer problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Tnze committed Oct 12, 2024
1 parent ede41be commit c926a37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
20 changes: 12 additions & 8 deletions src/components/Gearset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function setInheritFromDefault(val: string | number | boolean) {
v.value.value = { ...store.default }
}
}
const displayValue = computed(() => v.value.value || store.default);
const isDefault = computed(() => v.value.value == null);
</script>

<template>
Expand All @@ -49,20 +53,20 @@ function setInheritFromDefault(val: string | number | boolean) {
@change="setInheritFromDefault" />
</el-form-item>
<el-form-item :label="$t('level')">
<el-input-number v-model="(v.value || store.default).level" :disabled="v.value == null" :min="0" :max="100"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="displayValue.level" :disabled="isDefault" :controls="!isDefault" :min="1"
:max="100" :step-strictly="true" :value-on-clear="0" @change="x => v.value!.level = x!" />
</el-form-item>
<el-form-item :label="$t('craftsmanship')">
<el-input-number v-model="(v.value || store.default).craftsmanship" :disabled="v.value == null" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="displayValue.craftsmanship" :disabled="isDefault" :controls="!isDefault"
:min="0" :step-strictly="true" :value-on-clear="0" @change="x => v.value!.craftsmanship = x!" />
</el-form-item>
<el-form-item :label="$t('control')">
<el-input-number v-model="(v.value || store.default).control" :disabled="v.value == null" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="displayValue.control" :disabled="isDefault" :controls="!isDefault" :min="0"
:step-strictly="true" :value-on-clear="0" @change="x => v.value!.control = x!" />
</el-form-item>
<el-form-item :label="$t('craft-point')">
<el-input-number v-model="(v.value || store.default).craft_points" :disabled="v.value == null" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="displayValue.craft_points" :disabled="isDefault" :controls="!isDefault"
:min="0" :step-strictly="true" :value-on-clear="0" @change="x => v.value!.craft_points = x!" />
</el-form-item>
</el-form>
</template>
Expand Down
16 changes: 8 additions & 8 deletions src/components/Gearsets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ const jobPage = ref('default')
<el-tab-pane name="default" :label="$t('default')">
<el-form label-position="right" label-width="auto" :model="store.default">
<el-form-item :label="$t('level')">
<el-input-number v-model="store.default.level" :min="1" :max="100"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="store.default.level" :min="1" :max="100"
:step-strictly="true" @change="x => store.default.level = x || 1" />
</el-form-item>
<el-form-item :label="$t('craftsmanship')">
<el-input-number v-model="store.default.craftsmanship" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="store.default.craftsmanship" :min="0"
:step-strictly="true" @change="x => store.default.craftsmanship = x || 0" />
</el-form-item>
<el-form-item :label="$t('control')">
<el-input-number v-model="store.default.control" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="store.default.control" :min="0"
:step-strictly="true" @change="x => store.default.control = x || 0" />
</el-form-item>
<el-form-item :label="$t('craft-point')">
<el-input-number v-model="store.default.craft_points" :min="0"
:step-strictly="true"></el-input-number>
<el-input-number :model-value="store.default.craft_points" :min="0"
:step-strictly="true" @change="x => store.default.craft_points = x || 0" />
</el-form-item>
</el-form>
</el-tab-pane>
Expand Down

0 comments on commit c926a37

Please sign in to comment.