0.1.7-DEV-4:first test build

This commit is contained in:
Elvanos 2021-05-08 00:01:35 +02:00
parent f57f5f147b
commit 83bc250af2
6 changed files with 340 additions and 34 deletions

View file

@ -0,0 +1,268 @@
<template>
<q-tooltip
content-class="documentPreviewWrapper"
:delay="1000"
max-width="600px"
max-height="500px"
@show="openDocumentPreview"
@before-hide="consitentDocumentPreviewSwitch"
v-model="documentPreviewSwitch"
transition-show="scale"
transition-hide="scale"
>
<div
v-if="localBlueprint"
class="documentPreviewContent"
@mouseenter="clearCloseTimer"
@mouseleave="setCloseTimer"
>
<div
v-for="field in localBlueprint.extraFields"
:key="`${field.id}`"
class="col-12 q-mb-md"
>
<Field_Break
class="inputWrapper break"
v-if="field.type === 'break' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
/>
<Field_Text
class="inputWrapper"
v-if="field.type === 'text' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_Number
class="inputWrapper"
v-if="field.type === 'number' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_Switch
class="inputWrapper"
v-if="field.type === 'switch' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_ColorPicker
class="inputWrapper"
v-if="field.type === 'colorPicker' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_List
class="inputWrapper"
v-if="field.type === 'list' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_SingleSelect
class="inputWrapper"
v-if="field.type === 'singleSelect' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_MultiSelect
class="inputWrapper"
v-if="field.type === 'multiSelect' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
<Field_SingleRelationship
class="inputWrapper"
v-if="(field.type === 'singleToNoneRelationship' || field.type === 'singleToSingleRelationship' || field.type === 'singleToManyRelationship') && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
:current-id="localDocument._id"
:recursive="true"
/>
<Field_MultiRelationship
class="inputWrapper"
v-if="(field.type === 'manyToNoneRelationship' || field.type ===
'manyToSingleRelationship' || field.type === 'manyToManyRelationship') && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
:current-id="localDocument._id"
:recursive="true"
/>
<Field_Wysiwyg
class="inputWrapper"
v-if="field.type === 'wysiwyg' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="(retrieveFieldValue(localDocument, field.id)) ? retrieveFieldValue(localDocument, field.id) : ''"
:isNew="false"
:editMode="false"
:current-id="localDocument._id"
/>
<Field_Tags
class="inputWrapper"
v-if="field.type === 'tags' && categoryFieldFilter(field.id)"
:inputDataBluePrint="field"
:inputDataValue="retrieveFieldValue(localDocument, field.id)"
:isNew="false"
:editMode="false"
/>
</div>
</div>
</q-tooltip>
</template>
<script lang="ts">
import { Component, Prop, Watch } from "vue-property-decorator"
import BaseClass from "src/BaseClass"
import { I_ShortenedDocument } from "src/interfaces/I_OpenedDocument"
import { I_Blueprint } from "src/interfaces/I_Blueprint"
import Field_Break from "src/components/fields/Field_Break.vue"
import Field_Text from "src/components/fields/Field_Text.vue"
import Field_Number from "src/components/fields/Field_Number.vue"
import Field_Switch from "src/components/fields/Field_Switch.vue"
import Field_ColorPicker from "src/components/fields/Field_ColorPicker.vue"
import Field_List from "src/components/fields/Field_List.vue"
import Field_SingleSelect from "src/components/fields/Field_SingleSelect.vue"
import Field_MultiSelect from "src/components/fields/Field_MultiSelect.vue"
import Field_Wysiwyg from "src/components/fields/Field_Wysiwyg.vue"
import Field_Tags from "src/components/fields/Field_Tags.vue"
@Component({
components: {
Field_Break,
Field_Text,
Field_Number,
Field_Switch,
Field_ColorPicker,
Field_List,
Field_SingleSelect,
Field_MultiSelect,
Field_SingleRelationship: () => import("src/components/fields/Field_SingleRelationship.vue"),
Field_MultiRelationship: () => import("src/components/fields/Field_MultiRelationship.vue"),
Field_Wysiwyg,
Field_Tags
}
})
export default class DocumentPreview extends BaseClass {
/**
* Retrieved document ID
*/
@Prop() readonly documentId!: string
@Watch("documentId", { immediate: true })
reactToDocumentIDChange () {
if (this.documentId) {
this.localDocument = this.SGET_document(this.documentId)
this.localBlueprint = this.SGET_blueprint(this.localDocument.type)
console.log(this.localBlueprint)
}
}
localDocument = false as unknown as I_ShortenedDocument
localBlueprint = false as unknown as I_Blueprint
/**
* Check if field should be showing if the category setting is turned on
*/
categoryFieldFilter (currentFieldID: string) {
const isCategory = this.retrieveFieldValue(this.localDocument, "categorySwitch")
const ignoredList = ["breakDocumentSettings", "name", "documentColor", "documentBackgroundColor", "parentDoc", "order", "categorySwitch", "minorSwitch", "deadSwitch", "finishedSwitch", "tags", "otherNames"]
return (
(
(!isCategory && currentFieldID !== "categoryDescription") ||
ignoredList.includes(currentFieldID)
) || (isCategory && currentFieldID === "categoryDescription")
)
}
/**
* Variable string for closing of the popup due to external influences
*/
@Prop({ default: "" }) readonly externalCloseTrigger!: string
@Watch("externalCloseTrigger")
reactToExternalClose () {
this.setCloseTimer()
}
consitentDocumentPreviewSwitch () {
if (this.documentPreviewLock) {
this.documentPreviewSwitch = true
}
}
documentPreviewClose () {
this.documentPreviewLock = false
this.documentPreviewSwitch = false
}
documentPreviewLock = false
documentPreviewSwitch = false
openDocumentPreview () {
this.documentPreviewLock = true
}
clearCloseTimer () {
clearTimeout(this.closeTimer)
}
setCloseTimer () {
this.closeTimer = setTimeout(() => {
this.documentPreviewClose()
}, 500)
}
/**
* Debounce timer for nice user experience
*/
closeTimer = null as any
}
</script>
<style lang="scss">
.documentPreviewWrapper.no-pointer-events {
pointer-events: all !important;
padding: 0 !important;
}
.documentPreviewContent {
padding: 20px;
width: 600px;
}
</style>

View file

@ -40,7 +40,13 @@
:key="single._id"
clickable
class="text-primary"
@mouseleave="setDocumentPreviewClose"
>
<documentPreview
v-if="!recursive"
:document-id="single._id"
:external-close-trigger="documentPreviewClose"
/>
<q-item-section
@click.left="openExistingDocumentRoute(single)"
@click.middle="openNewTab(single)"
@ -73,7 +79,7 @@
</q-tooltip>
</q-btn>
</q-item-section>
<q-menu
<q-menu
touch-position
context-menu
auto-close
@ -129,7 +135,8 @@
</template>
</q-list>
</q-menu>
</q-menu>
</q-item>
</q-list>
@ -451,13 +458,20 @@ import { copyDocumentName, copyDocumentTextColor, copyDocumentBackgroundColor }
import { copyDocument } from "src/scripts/documentActions/copyDocument"
@Component({
components: { }
components: {
documentPreview: () => import("src/components/DocumentPreview.vue")
}
})
export default class Field_MultiRelationship extends FieldBase {
/****************************************************************/
// BASIC FIELD DATA
/****************************************************************/
/**
* Prevent document preview in already existing previews
*/
@Prop({ default: false }) readonly recursive!: true
/**
* Already existing value in the input field (IF one is there right now)
*/
@ -928,6 +942,12 @@ export default class Field_MultiRelationship extends FieldBase {
this.processInput()
}
setDocumentPreviewClose () {
this.documentPreviewClose = uid()
}
documentPreviewClose = ""
}
</script>

View file

@ -37,6 +37,7 @@
<q-item
clickable
class="text-primary"
@mouseleave="setDocumentPreviewClose"
>
<q-item-section
@click.left="openExistingDocumentRoute(localInput)"
@ -70,7 +71,7 @@
</q-tooltip>
</q-btn>
</q-item-section>
<q-menu
<q-menu
touch-position
context-menu
auto-close
@ -126,7 +127,12 @@
</template>
</q-list>
</q-menu>
</q-menu>
<documentPreview
v-if="!recursive"
:document-id="localInput._id"
:external-close-trigger="documentPreviewClose"
/>
</q-item>
</q-list>
@ -405,13 +411,20 @@ import { copyDocumentName, copyDocumentTextColor, copyDocumentBackgroundColor }
import { copyDocument } from "src/scripts/documentActions/copyDocument"
@Component({
components: { }
components: {
documentPreview: () => import("src/components/DocumentPreview.vue")
}
})
export default class Field_SingleRelationship extends FieldBase {
/****************************************************************/
// BASIC FIELD DATA
/****************************************************************/
/**
* Prevent document preview in already existing previews
*/
@Prop({ default: false }) readonly recursive!: true
/**
* Already existing value in the input field (IF one is there right now)
*/
@ -862,6 +875,12 @@ export default class Field_SingleRelationship extends FieldBase {
this.processInput()
}
setDocumentPreviewClose () {
this.documentPreviewClose = uid()
}
documentPreviewClose = ""
}
</script>

View file

@ -195,18 +195,6 @@ export const charactersBlueprint: I_Blueprint = {
icon: "mdi-weight",
sizing: 3
},
{
id: "statsList",
name: "Stats/Attributes",
type: "list",
icon: "mdi-sword-cross",
sizing: 12,
predefinedListExtras: {
reverse: true,
affix: "Stat/Attribute",
extraSelectValueList: RPGSystemsStats
}
},
{
id: "pairedOriginLocation",
name: "Place of origin",
@ -307,10 +295,22 @@ export const charactersBlueprint: I_Blueprint = {
},
{
id: "breakSkills",
name: "Skills & Other features",
name: "Skills, Stats & Other features",
type: "break",
sizing: 12
},
{
id: "statsList",
name: "Stats/Attributes",
type: "list",
icon: "mdi-sword-cross",
sizing: 12,
predefinedListExtras: {
reverse: true,
affix: "Stat/Attribute",
extraSelectValueList: RPGSystemsStats
}
},
{
id: "personalityTraits",
name: "Traits & Characteristics",

View file

@ -153,18 +153,6 @@ export const itemsBlueprint: I_Blueprint = {
type: "break",
sizing: 12
},
{
id: "features",
name: "Prominent features",
type: "list",
icon: "mdi-sword-cross",
sizing: 12,
predefinedListExtras: {
affix: "Note",
extraSelectValueList: [
]
}
},
{
id: "statsList",
name: "Stats/Attributes",
@ -177,6 +165,18 @@ export const itemsBlueprint: I_Blueprint = {
extraSelectValueList: RPGSystemsStats
}
},
{
id: "features",
name: "Prominent features",
type: "list",
icon: "mdi-sword-cross",
sizing: 12,
predefinedListExtras: {
affix: "Note",
extraSelectValueList: [
]
}
},
{
id: "pairedItems",
name: "Connected to other Items",

View file

@ -1,8 +1,5 @@
## THE GM BATCH
- Add more stat systems (missing 2 #meta atm)
- Add automatic-stats fixer to the repair tool from older versions
- Add hover/on-demand document preview to relationships
- Export for MD/PDF/ODT/DOCX
@ -32,6 +29,8 @@
- Add option for project graph to filter out categories or show them separately
- Add "Predecessors", "Successors", "Date of start", "Date of end" and "How long it lasted" fields to locations and all other groups
- Add category for skill/spells, edit magic and tech category
- Add category for materials/resources OR adapt Items category
- Add category for diseases/curses/etc
- Add category for classes/jobs