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, defaultValue: 1,
max: STORAGE_LIMITS.levelMax, 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({ const ComputedOnlyClassLevelSchema = createPropertySchema({

View File

@@ -1,41 +1,33 @@
<template lang="html"> <template lang="html">
<div class="class-form"> <div class="class-form">
<div class="layout column align-center"> <v-row dense>
<text-field <v-col
label="Level" cols="12"
type="number" md="6"
class="base-value-field text-center large-format no-flex" >
:value="model.level" <text-field
:error-messages="errors.level" label="Class variable name"
@change="change('level', ...arguments)" :value="model.variableName"
/> style="flex-basis: 300px;"
</div> hint="This should be the same as the class's variable name"
<div class="layout wrap"> :error-messages="errors.variableName"
<text-field @change="change('variableName', ...arguments)"
ref="focusFirst" />
label="Name" </v-col>
:value="model.name" <v-col
:error-messages="errors.name" cols="12"
@change="change('name', ...arguments)" md="6"
/> >
<text-field <text-field
label="Class variable name" label="Level"
:value="model.variableName" type="number"
style="flex-basis: 300px;" class="base-value-field text-center large-format no-flex"
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" :value="model.level"
:error-messages="errors.variableName" :error-messages="errors.level"
@change="change('variableName', ...arguments)" @change="change('level', ...arguments)"
/> />
</div> </v-col>
<text-field </v-row>
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)"
/>
<inline-computation-field <inline-computation-field
label="Description" label="Description"
@@ -45,23 +37,11 @@
@change="({path, value, ack}) => @change="({path, value, ack}) =>
$emit('change', {path: ['description', ...path], value, ack})" $emit('change', {path: ['description', ...path], value, ack})"
/> />
<smart-combobox <form-sections
label="Tags" v-if="$slots.default"
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
> >
<slot name="children" /> <slot />
</form-section> </form-sections>
</div> </div>
</template> </template>
@@ -70,9 +50,6 @@ import propertyFormMixin from '/imports/client/ui/properties/forms/shared/proper
export default { export default {
mixins: [propertyFormMixin], mixins: [propertyFormMixin],
inject: {
context: { default: {} }
},
}; };
</script> </script>