From b65b4b4497a47c0f7afe8afada3b72cf3d1eff13 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 16 May 2023 20:53:36 +0200 Subject: [PATCH] Form overhaul: Effect Form --- .../client/ui/properties/forms/EffectForm.vue | 293 ++++++------------ 1 file changed, 98 insertions(+), 195 deletions(-) diff --git a/app/imports/client/ui/properties/forms/EffectForm.vue b/app/imports/client/ui/properties/forms/EffectForm.vue index 1d386bf8..ef70df47 100644 --- a/app/imports/client/ui/properties/forms/EffectForm.vue +++ b/app/imports/client/ui/properties/forms/EffectForm.vue @@ -1,181 +1,103 @@ @@ -184,20 +106,18 @@ import getEffectIcon from '/imports/client/ui/utility/getEffectIcon.js'; import propertyFormMixin from '/imports/client/ui/properties/forms/shared/propertyFormMixin.js'; import attributeListMixin from '/imports/client/ui/properties/forms/shared/lists/attributeListMixin.js'; -import { EffectSchema } from '/imports/api/properties/Effects.js'; -import FormSection from '/imports/client/ui/properties/forms/shared/FormSection.vue'; +import TagTargeting from '/imports/client/ui/properties/forms/shared/TagTargeting.vue'; const ICON_SPIN_DURATION = 300; export default { components: { - FormSection, + TagTargeting, }, mixins: [propertyFormMixin, attributeListMixin], data() { return { displayedIcon: 'add', iconClass: '', - addExtraTagsLoading: false, oldOperation: undefined, operations: [ { value: 'base', text: 'Base Value' }, @@ -218,11 +138,6 @@ export default { radioGroup() { return this.model.targetByTags ? 'tags' : 'stats'; }, - extraTagsFull() { - if (!this.model.extraTags) return false; - let maxCount = EffectSchema.get('extraTags', 'maxCount'); - return this.model.extraTags.length >= maxCount; - }, needsValue() { switch (this.model.operation) { case 'base': return true; @@ -242,7 +157,7 @@ export default { operationHint() { switch (this.model.operation) { case 'base': return 'Stats take their largest base value, and then apply all other effects'; - case 'add': return 'Add this vaulue to the stat'; + case 'add': return 'Add this value to the stat'; case 'mul': return 'Multiply the stat by this value'; case 'min': return 'The stat will be at least this value'; case 'max': return 'The stat will not exceed this value'; @@ -279,32 +194,20 @@ export default { }, methods: { getEffectIcon, - changeTargetByTags(value) { + changeTargetByTags(value, ack) { if (value === 'stats') { - this.$emit('change', { path: ['targetByTags'], value: undefined }); + this.$emit('change', { path: ['targetByTags'], value: undefined, ack }); if (this.oldOperation && this.oldOperation !== this.model.operation) { this.$emit('change', { path: ['operation'], value: this.oldOperation }); } } else if (value === 'tags') { - this.$emit('change', { path: ['targetByTags'], value: true }); + this.$emit('change', { path: ['targetByTags'], value: true, ack }); if (this.model.operation !== 'add') { this.oldOperation = this.model.operation; this.$emit('change', { path: ['operation'], value: 'add' }); } } }, - addExtraTags() { - this.addExtraTagsLoading = true; - this.$emit('push', { - path: ['extraTags'], - value: { - _id: Random.id(), - operation: 'OR', - tags: [], - }, - ack: () => this.addExtraTagsLoading = false, - }); - }, } };