Choice branch UI working!
This commit is contained in:
@@ -14,19 +14,16 @@
|
|||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
<div class="action-dialog-content">
|
<div class="action-dialog-content">
|
||||||
<div class="layout d-flex">
|
<div class="action-dialog-layout d-flex">
|
||||||
<div
|
<component
|
||||||
class="input d-flex justify-center align-center"
|
:is="activeInput"
|
||||||
>
|
v-if="activeInput"
|
||||||
<component
|
v-model="userInput"
|
||||||
:is="activeInput"
|
class="action-input"
|
||||||
v-if="activeInput"
|
v-bind="activeInputParams"
|
||||||
v-model="userInput"
|
@continue="continueAction"
|
||||||
v-bind="activeInputParams"
|
@set-input-ready="setInputReady"
|
||||||
@continue="continueAction"
|
/>
|
||||||
@set-input-ready="setInputReady"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
class="log-preview card-raised-background d-flex flex-column align-end justify-end"
|
class="log-preview card-raised-background d-flex flex-column align-end justify-end"
|
||||||
style="flex-basis: 256px;"
|
style="flex-basis: 256px;"
|
||||||
@@ -80,22 +77,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
import DialogBase from '/imports/client/ui/dialogStack/DialogBase.vue';
|
|
||||||
import EngineActions from '/imports/api/engine/action/EngineActions';
|
|
||||||
import applyAction from '/imports/api/engine/action/functions/applyAction';
|
import applyAction from '/imports/api/engine/action/functions/applyAction';
|
||||||
|
import getDeterministicDiceRoller from '/imports/api/engine/action/functions/userInput/getDeterministicDiceRoller';
|
||||||
|
|
||||||
import AdvantageInput from '/imports/client/ui/creature/actions/input/AdvantageInput.vue';
|
import AdvantageInput from '/imports/client/ui/creature/actions/input/AdvantageInput.vue';
|
||||||
import CheckInput from '/imports/client/ui/creature/actions/input/CheckInput.vue';
|
import CheckInput from '/imports/client/ui/creature/actions/input/CheckInput.vue';
|
||||||
import RollInput from '/imports/client/ui/creature/actions/input/RollInput.vue';
|
import ChoiceInput from '/imports/client/ui/creature/actions/input/ChoiceInput.vue';
|
||||||
import getDeterministicDiceRoller from '/imports/api/engine/action/functions/userInput/getDeterministicDiceRoller';
|
import DialogBase from '/imports/client/ui/dialogStack/DialogBase.vue';
|
||||||
|
import EngineActions from '/imports/api/engine/action/EngineActions';
|
||||||
import LogContent from '/imports/client/ui/log/LogContent.vue';
|
import LogContent from '/imports/client/ui/log/LogContent.vue';
|
||||||
|
import RollInput from '/imports/client/ui/creature/actions/input/RollInput.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DialogBase,
|
|
||||||
AdvantageInput,
|
AdvantageInput,
|
||||||
CheckInput,
|
CheckInput,
|
||||||
RollInput,
|
ChoiceInput,
|
||||||
|
DialogBase,
|
||||||
LogContent,
|
LogContent,
|
||||||
|
RollInput,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
actionId: {
|
actionId: {
|
||||||
@@ -218,6 +218,12 @@ export default {
|
|||||||
return this.promiseInput();
|
return this.promiseInput();
|
||||||
},
|
},
|
||||||
async choose(choices, quantity) {
|
async choose(choices, quantity) {
|
||||||
|
this.userInput = [];
|
||||||
|
this.activeInputParams = {
|
||||||
|
choices,
|
||||||
|
quantity
|
||||||
|
};
|
||||||
|
this.activeInput = 'choice-input'
|
||||||
return this.promiseInput();
|
return this.promiseInput();
|
||||||
},
|
},
|
||||||
async advantage(suggestedAdvantage) {
|
async advantage(suggestedAdvantage) {
|
||||||
@@ -247,11 +253,11 @@ export default {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-dialog-content, .layout {
|
.action-dialog-content, .action-dialog-layout {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.action-input {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
@@ -264,10 +270,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@container (max-width: 600px) {
|
@container (max-width: 600px) {
|
||||||
.layout {
|
.action-dialog-layout {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
.input {
|
.action-input {
|
||||||
height: unset;
|
height: unset;
|
||||||
}
|
}
|
||||||
.log-preview {
|
.log-preview {
|
||||||
|
|||||||
87
app/imports/client/ui/creature/actions/input/ChoiceInput.vue
Normal file
87
app/imports/client/ui/creature/actions/input/ChoiceInput.vue
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<div class="choice-input">
|
||||||
|
<v-expansion-panels
|
||||||
|
accordion
|
||||||
|
tile
|
||||||
|
multiple
|
||||||
|
hover
|
||||||
|
>
|
||||||
|
<v-expansion-panel
|
||||||
|
v-for="prop in choices"
|
||||||
|
:key="prop._id"
|
||||||
|
:model="prop"
|
||||||
|
:data-id="prop._id"
|
||||||
|
>
|
||||||
|
<v-expansion-panel-header>
|
||||||
|
<template #default="{ open }">
|
||||||
|
<v-checkbox
|
||||||
|
v-model="selectedItems"
|
||||||
|
class="my-0 py-0 mr-2 flex-grow-0"
|
||||||
|
hide-details
|
||||||
|
:value="prop._id"
|
||||||
|
:disabled="!selectedItems.includes(prop._id) && selectedItems.length >= quantity.max"
|
||||||
|
@click.stop
|
||||||
|
/>
|
||||||
|
<tree-node-view :model="prop" />
|
||||||
|
<template v-if="open">
|
||||||
|
<v-spacer />
|
||||||
|
<v-btn
|
||||||
|
icon
|
||||||
|
class="flex-grow-0"
|
||||||
|
@click.stop="openPropertyDetails(prop._id)"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-window-restore</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</v-expansion-panel-header>
|
||||||
|
<v-expansion-panel-content class="py-4">
|
||||||
|
<property-viewer :model="prop" />
|
||||||
|
</v-expansion-panel-content>
|
||||||
|
</v-expansion-panel>
|
||||||
|
</v-expansion-panels>
|
||||||
|
<v-btn
|
||||||
|
:disabled="!canContinue"
|
||||||
|
@click="$emit('continue');"
|
||||||
|
>
|
||||||
|
Done
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="js">
|
||||||
|
import TreeNodeView from '/imports/client/ui/properties/treeNodeViews/TreeNodeView.vue';
|
||||||
|
import PropertyViewer from '/imports/client/ui/properties/shared/PropertyViewer.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
TreeNodeView,
|
||||||
|
PropertyViewer,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
choices: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
quantity: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({min: 0, max: 1}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectedItems: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
canContinue() {
|
||||||
|
return this.selectedItems.length >= this.quantity.min;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectedItems(val) {
|
||||||
|
this.$emit('input', val)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<template lang="html">
|
<template lang="html">
|
||||||
<tree-node-list
|
<tree-node-list
|
||||||
v-if="model"
|
v-if="model && model.root"
|
||||||
:children="children"
|
:children="children"
|
||||||
:group="group"
|
:group="group"
|
||||||
:organize="organize"
|
:organize="organize"
|
||||||
@@ -41,6 +41,7 @@ export default {
|
|||||||
},
|
},
|
||||||
meteor: {
|
meteor: {
|
||||||
children() {
|
children() {
|
||||||
|
if (!this.model?.root) return [];
|
||||||
const collection = getCollectionByName(this.collection);
|
const collection = getCollectionByName(this.collection);
|
||||||
const docs = collection.find({
|
const docs = collection.find({
|
||||||
removed: { $ne: true },
|
removed: { $ne: true },
|
||||||
|
|||||||
Reference in New Issue
Block a user