From 2c6cd7d243a6eccbd9e484c42eebb55fcc1e9f78 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 16 May 2023 19:28:32 +0200 Subject: [PATCH] Created smart toggles for limited choice fields --- .../ui/components/global/SmartToggle.vue | 70 +++++++ .../ui/components/global/globalIndex.js | 2 + .../client/ui/properties/forms/ActionForm.vue | 14 +- .../ui/properties/forms/AdjustmentForm.vue | 71 ++----- .../ui/properties/forms/AttributeForm.vue | 187 ++++++++++-------- .../client/ui/properties/forms/BuffForm.vue | 21 +- .../properties/forms/shared/IconColorMenu.vue | 2 - .../viewers/shared/OutlinedInput.vue | 6 + 8 files changed, 216 insertions(+), 157 deletions(-) create mode 100644 app/imports/client/ui/components/global/SmartToggle.vue diff --git a/app/imports/client/ui/components/global/SmartToggle.vue b/app/imports/client/ui/components/global/SmartToggle.vue new file mode 100644 index 00000000..afbfff70 --- /dev/null +++ b/app/imports/client/ui/components/global/SmartToggle.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/imports/client/ui/components/global/globalIndex.js b/app/imports/client/ui/components/global/globalIndex.js index f7e48b3e..abcd848d 100644 --- a/app/imports/client/ui/components/global/globalIndex.js +++ b/app/imports/client/ui/components/global/globalIndex.js @@ -10,6 +10,7 @@ import SmartBtn from '/imports/client/ui/components/global/SmartBtn.vue'; import SmartCombobox from '/imports/client/ui/components/global/SmartCombobox.vue'; import SmartCheckbox from '/imports/client/ui/components/global/SmartCheckbox.vue'; import SmartSwitch from '/imports/client/ui/components/global/SmartSwitch.vue'; +import SmartToggle from '/imports/client/ui/components/global/SmartToggle.vue'; import SvgIcon from '/imports/client/ui/components/global/SvgIcon.vue'; import SmartSlider from '/imports/client/ui/components/global/SmartSlider.vue'; @@ -24,4 +25,5 @@ Vue.component('SmartCombobox', SmartCombobox); Vue.component('SmartCheckbox', SmartCheckbox); Vue.component('SmartSlider', SmartSlider); Vue.component('SmartSwitch', SmartSwitch); +Vue.component('SmartToggle', SmartToggle); Vue.component('SvgIcon', SvgIcon); diff --git a/app/imports/client/ui/properties/forms/ActionForm.vue b/app/imports/client/ui/properties/forms/ActionForm.vue index 63b316fe..33137670 100644 --- a/app/imports/client/ui/properties/forms/ActionForm.vue +++ b/app/imports/client/ui/properties/forms/ActionForm.vue @@ -63,19 +63,21 @@ /> - - @@ -47,14 +50,14 @@ cols="12" md="6" > - @@ -85,58 +88,10 @@ import propertyFormMixin from '/imports/client/ui/properties/forms/shared/proper export default { mixins: [propertyFormMixin, attributeListMixin], - props: { - parentTarget: { - type: String, - default: undefined, - }, - }, data() { return { - adjustmentOps: [ - { text: 'Damage', value: 'increment' }, - { text: 'Set', value: 'set' }, - ], - damageHint: 'The amount of damage to apply to the selected stat, can be a calculation or roll. Negative values will restore the selected from previous damage. If the operation is set, this is the final value of the stat instead.', - setHint: 'The value of the stat after applying this adjustment. The stat\'s value can\'t exceed its total', - } - }, - computed: { - targetOptions() { - if (this.parentTarget === 'singleTarget') { - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'every', - }, - ]; - } else { - return [ - { - text: 'Self', - value: 'self', - }, { - text: 'Target', - value: 'target', - }, - ]; - } - }, - targetOptionHint() { - let hints = { - self: 'The damage will be applied to the character\'s own attribute when taking the action', - target: 'The damage will be applied to the target of the action', - each: 'The damage will be rolled separately for each of the targets of the action', - every: 'The damage will be rolled once and applied to each of the targets of the action', - }; - if (this.parentTarget === 'singleTarget') { - hints.each = hints.target; - hints.every = hints.target; - } - return hints[this.model.target]; + damageHint: 'The amount of damage to apply, negative values will heal', + setHint: 'The value to set the stat to', } }, } diff --git a/app/imports/client/ui/properties/forms/AttributeForm.vue b/app/imports/client/ui/properties/forms/AttributeForm.vue index 238d097b..84829058 100644 --- a/app/imports/client/ui/properties/forms/AttributeForm.vue +++ b/app/imports/client/ui/properties/forms/AttributeForm.vue @@ -79,90 +79,115 @@ v-if="model.attributeType === 'healthBar'" name="Health Bar" > -
-
- Damaged Colors: +
+
+ Damaged Colors
- - - - - - + + + + + + +
- - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/app/imports/client/ui/properties/forms/BuffForm.vue b/app/imports/client/ui/properties/forms/BuffForm.vue index 87b30123..871c8dda 100644 --- a/app/imports/client/ui/properties/forms/BuffForm.vue +++ b/app/imports/client/ui/properties/forms/BuffForm.vue @@ -18,16 +18,17 @@ $emit('change', {path: ['duration', ...path], value, ack})" /> --> - - +