Form overhaul: Class Level Form

This commit is contained in:
Stefan Zermatten
2023-05-16 20:26:44 +02:00
parent 57ca3ecb01
commit 0dbd5903b3
2 changed files with 32 additions and 61 deletions

View File

@@ -26,12 +26,6 @@ const ClassLevelSchema = createPropertySchema({
defaultValue: 1,
max: STORAGE_LIMITS.levelMax,
},
// Filters out of UI if condition isn't met, but isn't otherwise enforced
slotFillerCondition: {
type: String,
optional: true,
max: STORAGE_LIMITS.calculation,
},
});
const ComputedOnlyClassLevelSchema = createPropertySchema({

View File

@@ -1,41 +1,33 @@
<template lang="html">
<div class="class-form">
<div class="layout column align-center">
<text-field
label="Level"
type="number"
class="base-value-field text-center large-format no-flex"
:value="model.level"
:error-messages="errors.level"
@change="change('level', ...arguments)"
/>
</div>
<div class="layout wrap">
<text-field
ref="focusFirst"
label="Name"
:value="model.name"
:error-messages="errors.name"
@change="change('name', ...arguments)"
/>
<text-field
label="Class variable name"
:value="model.variableName"
style="flex-basis: 300px;"
hint="This should be the same for each level in a class, use `variablName.level` to reference the highest class level for a given class variable name in calculations"
:error-messages="errors.variableName"
@change="change('variableName', ...arguments)"
/>
</div>
<text-field
v-if="context.isLibraryForm"
label="Condition"
hint="A caclulation to determine if this can be added to the character"
placeholder="Always active"
:value="model.slotFillerCondition"
:error-messages="errors.slotFillerCondition"
@change="change('slotFillerCondition', ...arguments)"
/>
<v-row dense>
<v-col
cols="12"
md="6"
>
<text-field
label="Class variable name"
:value="model.variableName"
style="flex-basis: 300px;"
hint="This should be the same as the class's variable name"
:error-messages="errors.variableName"
@change="change('variableName', ...arguments)"
/>
</v-col>
<v-col
cols="12"
md="6"
>
<text-field
label="Level"
type="number"
class="base-value-field text-center large-format no-flex"
:value="model.level"
:error-messages="errors.level"
@change="change('level', ...arguments)"
/>
</v-col>
</v-row>
<inline-computation-field
label="Description"
@@ -45,23 +37,11 @@
@change="({path, value, ack}) =>
$emit('change', {path: ['description', ...path], value, ack})"
/>
<smart-combobox
label="Tags"
multiple
chips
deletable-chips
hint="Used to let slots find this property in a library"
:value="model.tags"
:error-messages="errors.tags"
@change="change('tags', ...arguments)"
/>
<form-section
v-if="$slots.children"
name="Children"
standalone
<form-sections
v-if="$slots.default"
>
<slot name="children" />
</form-section>
<slot />
</form-sections>
</div>
</template>
@@ -70,9 +50,6 @@ import propertyFormMixin from '/imports/client/ui/properties/forms/shared/proper
export default {
mixins: [propertyFormMixin],
inject: {
context: { default: {} }
},
};
</script>