mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-10-01 09:38:04 +13:00
0.1.5 - added context menus to document relationships
This commit is contained in:
parent
1c563a5511
commit
e660cd59ad
6 changed files with 696 additions and 29 deletions
|
@ -80,16 +80,16 @@
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
dark
|
dark
|
||||||
color="primary"
|
color="accent"
|
||||||
class="z-1 q-ml-md"
|
class="z-1 q-ml-sm self-center"
|
||||||
icon="mdi-file-tree"
|
icon="mdi-pencil"
|
||||||
size="md"
|
size="sm"
|
||||||
@click.stop.prevent="addNewItemUnderSelected(opt)"
|
@click.stop.prevent="editExistingInput(opt)"
|
||||||
>
|
>
|
||||||
<q-tooltip
|
<q-tooltip
|
||||||
:delay="300"
|
:delay="300"
|
||||||
>
|
>
|
||||||
Add a new document belonging under {{ stripTags(opt.label) }}
|
Edit {{ stripTags(opt.label) }}
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
@ -98,18 +98,99 @@
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
dark
|
dark
|
||||||
color="accent"
|
color="primary"
|
||||||
class="z-1 q-ml-sm"
|
class="z-1 q-ml-sm self-center"
|
||||||
icon="mdi-content-copy"
|
icon="mdi-content-copy"
|
||||||
size="md"
|
size="sm"
|
||||||
@click.stop.prevent="copyTargetDocument(opt)"
|
@click.stop.prevent="copyTargetDocument(opt)"
|
||||||
>
|
>
|
||||||
<q-tooltip
|
<q-tooltip
|
||||||
:delay="300"
|
:delay="300"
|
||||||
>
|
>
|
||||||
Make a copy of {{ stripTags(opt.label) }}
|
Make a copy of {{ stripTags(opt.label) }}
|
||||||
|
<br>
|
||||||
|
This action will always close the popup.
|
||||||
|
</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn
|
||||||
|
tabindex="-1"
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
dark
|
||||||
|
color="primary"
|
||||||
|
class="z-1 q-ml-sm self-center"
|
||||||
|
icon="mdi-file-tree"
|
||||||
|
size="sm"
|
||||||
|
@click.stop.prevent="addNewUnderParent(opt)"
|
||||||
|
>
|
||||||
|
<q-tooltip
|
||||||
|
:delay="300"
|
||||||
|
>
|
||||||
|
Add a new document belonging under {{ stripTags(opt.label) }}
|
||||||
|
<br>
|
||||||
|
This action will always close the popup.
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(opt)">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(opt)">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(opt)">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(opt)">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(opt)">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(opt)">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(opt)">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
|
@ -132,6 +213,9 @@ import { I_OpenedDocument, I_ShortenedDocument } from "src/interfaces/I_OpenedDo
|
||||||
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
||||||
import { extend } from "quasar"
|
import { extend } from "quasar"
|
||||||
import PouchDB from "pouchdb"
|
import PouchDB from "pouchdb"
|
||||||
|
|
||||||
|
import { createNewWithParent } from "src/scripts/documentActions/createNewWithParent"
|
||||||
|
import { copyDocumentName, copyDocumentTextColor, copyDocumentBackgroundColor } from "src/scripts/documentActions/uniqueFieldCopy"
|
||||||
import { copyDocument } from "src/scripts/documentActions/copyDocument"
|
import { copyDocument } from "src/scripts/documentActions/copyDocument"
|
||||||
|
|
||||||
import DialogBase from "src/components/dialogs/_DialogBase"
|
import DialogBase from "src/components/dialogs/_DialogBase"
|
||||||
|
@ -369,12 +453,14 @@ export default class ExistingDocumentDialog extends DialogBase {
|
||||||
* Either as a focus with closure of the dialog.
|
* Either as a focus with closure of the dialog.
|
||||||
* Or as a background tab without closing of the dialog.
|
* Or as a background tab without closing of the dialog.
|
||||||
*/
|
*/
|
||||||
async openExistingInput (e: I_ShortenedDocument[]) {
|
async openExistingInput (e: I_ShortenedDocument) {
|
||||||
|
// @ts-ignore
|
||||||
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
// Open document and close dialog
|
// Open document and close dialog
|
||||||
if (!this.disableCloseAftertSelectQuickSearch) {
|
if (!this.disableCloseAftertSelectQuickSearch) {
|
||||||
this.dialogModel = false
|
this.dialogModel = false
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.openExistingDocumentRoute(e[0])
|
this.openExistingDocumentRoute(e)
|
||||||
this.existingDocumentModel = []
|
this.existingDocumentModel = []
|
||||||
}
|
}
|
||||||
// Open document and DO NOT close the dialog
|
// Open document and DO NOT close the dialog
|
||||||
|
@ -382,9 +468,9 @@ export default class ExistingDocumentDialog extends DialogBase {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.existingDocumentModel = []
|
this.existingDocumentModel = []
|
||||||
|
|
||||||
const CurrentObjectDB = new PouchDB(e[0].type)
|
const CurrentObjectDB = new PouchDB(e.type)
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const retrievedObject = await CurrentObjectDB.get(e[0].id)
|
const retrievedObject = await CurrentObjectDB.get(e.id)
|
||||||
|
|
||||||
const dataPass = {
|
const dataPass = {
|
||||||
doc: retrievedObject,
|
doc: retrievedObject,
|
||||||
|
@ -398,19 +484,75 @@ export default class ExistingDocumentDialog extends DialogBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new item under whatever document this was called from
|
* Opened the existing input in two modes
|
||||||
|
* Either as a focus with closure of the dialog.
|
||||||
|
* Or as a background tab without closing of the dialog.
|
||||||
*/
|
*/
|
||||||
addNewItemUnderSelected (parent: any) {
|
async editExistingInput (e: I_ShortenedDocument) {
|
||||||
const routeObject = {
|
|
||||||
_id: parent.type,
|
|
||||||
parent: parent.id
|
|
||||||
}
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.addNewObjectRoute(routeObject)
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
|
// Open document and close dialog
|
||||||
|
if (!this.disableCloseAftertSelectQuickSearch) {
|
||||||
|
this.dialogModel = false
|
||||||
|
// @ts-ignore
|
||||||
|
this.openExistingDocumentRouteWithEdit(e)
|
||||||
|
this.existingDocumentModel = []
|
||||||
|
}
|
||||||
|
// Open document and DO NOT close the dialog
|
||||||
|
else {
|
||||||
|
// @ts-ignore
|
||||||
|
this.existingDocumentModel = []
|
||||||
|
|
||||||
|
const CurrentObjectDB = new PouchDB(e.type)
|
||||||
|
// @ts-ignore
|
||||||
|
const retrievedObject = await CurrentObjectDB.get(e.id)
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
retrievedObject.hasEdits = true
|
||||||
|
|
||||||
|
const dataPass = {
|
||||||
|
doc: retrievedObject,
|
||||||
|
treeAction: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
this.SSET_addOpenedDocument(dataPass)
|
||||||
|
await CurrentObjectDB.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
documentPass = null as unknown as I_OpenedDocument
|
documentPass = null as unknown as I_OpenedDocument
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Add new document under parent
|
||||||
|
/****************************************************************/
|
||||||
|
addNewUnderParent (currentDoc: I_OpenedDocument) {
|
||||||
|
createNewWithParent(currentDoc, this)
|
||||||
|
this.dialogModel = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Document field copying
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
copyName (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentName(currentDoc)
|
||||||
|
|
||||||
|
this.dialogModel = false
|
||||||
|
}
|
||||||
|
|
||||||
|
copyTextColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentTextColor(currentDoc)
|
||||||
|
|
||||||
|
this.dialogModel = false
|
||||||
|
}
|
||||||
|
|
||||||
|
copyBackgroundColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentBackgroundColor(currentDoc)
|
||||||
|
|
||||||
|
this.dialogModel = false
|
||||||
|
}
|
||||||
|
|
||||||
copyTargetDocument (currentDoc: I_OpenedDocument) {
|
copyTargetDocument (currentDoc: I_OpenedDocument) {
|
||||||
this.documentPass = extend(true, {}, currentDoc)
|
this.documentPass = extend(true, {}, currentDoc)
|
||||||
|
|
||||||
|
@ -432,6 +574,8 @@ export default class ExistingDocumentDialog extends DialogBase {
|
||||||
}
|
}
|
||||||
console.log(e)
|
console.log(e)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.dialogModel = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -73,6 +73,63 @@
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(fixGetCorrectDocument(single))">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
|
|
||||||
|
@ -114,7 +171,7 @@
|
||||||
round
|
round
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
class="z-max"
|
class="z-max relationshipChipNewTab"
|
||||||
style="color: #000 !important;"
|
style="color: #000 !important;"
|
||||||
size="sm"
|
size="sm"
|
||||||
icon="mdi-open-in-new"
|
icon="mdi-open-in-new"
|
||||||
|
@ -124,6 +181,63 @@
|
||||||
Open in new tab without leaving this one
|
Open in new tab without leaving this one
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-chip>
|
</q-chip>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:option="{ itemProps, itemEvents, opt }">
|
<template v-slot:option="{ itemProps, itemEvents, opt }">
|
||||||
|
@ -166,6 +280,64 @@
|
||||||
<q-tooltip v-if='opt.disable'>
|
<q-tooltip v-if='opt.disable'>
|
||||||
This option is unavailable for selection as it is already paired to another.
|
This option is unavailable for selection as it is already paired to another.
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(opt)">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(opt)">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(opt)">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(opt)">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(opt)">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(opt)">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(opt)">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
|
@ -209,8 +381,11 @@ import FieldBase from "src/components/fields/_FieldBase"
|
||||||
import PouchDB from "pouchdb"
|
import PouchDB from "pouchdb"
|
||||||
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
||||||
import { extend } from "quasar"
|
import { extend } from "quasar"
|
||||||
import { I_ShortenedDocument } from "src/interfaces/I_OpenedDocument"
|
import { I_ShortenedDocument, I_OpenedDocument } from "src/interfaces/I_OpenedDocument"
|
||||||
import { I_FieldRelationship, I_RelationshipPair } from "src/interfaces/I_FieldRelationship"
|
import { I_FieldRelationship, I_RelationshipPair } from "src/interfaces/I_FieldRelationship"
|
||||||
|
import { createNewWithParent } from "src/scripts/documentActions/createNewWithParent"
|
||||||
|
import { copyDocumentName, copyDocumentTextColor, copyDocumentBackgroundColor } from "src/scripts/documentActions/uniqueFieldCopy"
|
||||||
|
import { copyDocument } from "src/scripts/documentActions/copyDocument"
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: { }
|
components: { }
|
||||||
|
@ -494,6 +669,86 @@ export default class Field_MultiRelationship extends FieldBase {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// TRIGGER ACTIONS
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
docToFind = null as unknown as I_OpenedDocument
|
||||||
|
|
||||||
|
fixGetCorrectDocument (e: I_OpenedDocument | I_FieldRelationship) {
|
||||||
|
this.docToFind = (this.allDocumentsWithoutCurrent.find(doc => doc._id === e._id)) as unknown as I_OpenedDocument
|
||||||
|
return this.docToFind
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opened the existing input
|
||||||
|
*/
|
||||||
|
openExistingInput (e: I_OpenedDocument) {
|
||||||
|
// @ts-ignore
|
||||||
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
|
this.openExistingDocumentRoute(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opened the existing input in two modes
|
||||||
|
* Either as a focus with closure of the dialog.
|
||||||
|
* Or as a background tab without closing of the dialog.
|
||||||
|
*/
|
||||||
|
editExistingInput (e: I_OpenedDocument) {
|
||||||
|
// @ts-ignore
|
||||||
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
|
this.openExistingDocumentRouteWithEdit(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
documentPass = null as unknown as I_OpenedDocument
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Add new document under parent
|
||||||
|
/****************************************************************/
|
||||||
|
addNewUnderParent (currentDoc: I_OpenedDocument) {
|
||||||
|
createNewWithParent(currentDoc, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Document field copying
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
copyName (currentDoc: I_OpenedDocument) {
|
||||||
|
console.log(currentDoc)
|
||||||
|
copyDocumentName(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyTextColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentTextColor(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyBackgroundColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentBackgroundColor(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyTargetDocument (currentDoc: I_OpenedDocument) {
|
||||||
|
this.documentPass = extend(true, {}, currentDoc)
|
||||||
|
|
||||||
|
const newDocument = copyDocument(this.documentPass, this.generateUID())
|
||||||
|
|
||||||
|
const dataPass = {
|
||||||
|
doc: newDocument,
|
||||||
|
treeAction: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
this.SSET_addOpenedDocument(dataPass)
|
||||||
|
this.$router.push({
|
||||||
|
path: newDocument.url
|
||||||
|
}).catch((e: {name: string}) => {
|
||||||
|
const errorName : string = e.name
|
||||||
|
if (errorName === "NavigationDuplicated") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,63 @@
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(fixGetCorrectDocument(localInput))">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
</q-list>
|
</q-list>
|
||||||
|
|
||||||
|
@ -111,7 +168,7 @@
|
||||||
round
|
round
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
class="z-max"
|
class="z-max relationshipChipNewTab"
|
||||||
style="color: #000 !important;"
|
style="color: #000 !important;"
|
||||||
size="sm"
|
size="sm"
|
||||||
icon="mdi-open-in-new"
|
icon="mdi-open-in-new"
|
||||||
|
@ -121,6 +178,63 @@
|
||||||
Open in new tab without leaving this one
|
Open in new tab without leaving this one
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(fixGetCorrectDocument(scope.opt))">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-chip>
|
</q-chip>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -164,6 +278,65 @@
|
||||||
<q-tooltip v-if='opt.disable'>
|
<q-tooltip v-if='opt.disable'>
|
||||||
This option is unavailable for selection as it is already paired to another.
|
This option is unavailable for selection as it is already paired to another.
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
|
|
||||||
|
<q-menu
|
||||||
|
touch-position
|
||||||
|
context-menu
|
||||||
|
auto-close
|
||||||
|
separate-close-popup
|
||||||
|
>
|
||||||
|
|
||||||
|
<q-list class="bg-gunmetal-light">
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<q-item clickable @click="copyName(opt)">
|
||||||
|
<q-item-section>Copy name</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-text-recognition" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTextColor(opt)">
|
||||||
|
<q-item-section>Copy text color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-eyedropper" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyBackgroundColor(opt)">
|
||||||
|
<q-item-section>Copy background color</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-format-color-fill" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-separator />
|
||||||
|
<q-item clickable @click="openExistingInput(opt)">
|
||||||
|
<q-item-section>Open document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-book-open-page-variant-outline" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="editExistingInput(opt)">
|
||||||
|
<q-item-section>Edit document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon name="mdi-pencil" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="addNewUnderParent(opt)">
|
||||||
|
<q-item-section>Create new document with this document as parent</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-file-tree" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
<q-item clickable @click="copyTargetDocument(opt)">
|
||||||
|
<q-item-section>Copy this document</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<q-icon color="primary" name="mdi-content-copy" />
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</q-list>
|
||||||
|
|
||||||
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
|
@ -207,8 +380,11 @@ import PouchDB from "pouchdb"
|
||||||
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
import { advancedDocumentFilter } from "src/scripts/utilities/advancedDocumentFilter"
|
||||||
import { extend } from "quasar"
|
import { extend } from "quasar"
|
||||||
|
|
||||||
import { I_ShortenedDocument } from "src/interfaces/I_OpenedDocument"
|
import { I_OpenedDocument, I_ShortenedDocument } from "src/interfaces/I_OpenedDocument"
|
||||||
import { I_FieldRelationship, I_RelationshipPairSingle } from "src/interfaces/I_FieldRelationship"
|
import { I_FieldRelationship, I_RelationshipPairSingle } from "src/interfaces/I_FieldRelationship"
|
||||||
|
import { createNewWithParent } from "src/scripts/documentActions/createNewWithParent"
|
||||||
|
import { copyDocumentName, copyDocumentTextColor, copyDocumentBackgroundColor } from "src/scripts/documentActions/uniqueFieldCopy"
|
||||||
|
import { copyDocument } from "src/scripts/documentActions/copyDocument"
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: { }
|
components: { }
|
||||||
|
@ -470,6 +646,86 @@ export default class Field_SingleRelationship extends FieldBase {
|
||||||
skipSave: (skipSave)
|
skipSave: (skipSave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// TRIGGER ACTIONS
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
docToFind = null as unknown as I_OpenedDocument
|
||||||
|
|
||||||
|
fixGetCorrectDocument (e: I_OpenedDocument | I_FieldRelationship) {
|
||||||
|
this.docToFind = (this.allDocumentsWithoutCurrent.find(doc => doc._id === e._id)) as unknown as I_OpenedDocument
|
||||||
|
return this.docToFind
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opened the existing input
|
||||||
|
*/
|
||||||
|
openExistingInput (e: I_OpenedDocument) {
|
||||||
|
// @ts-ignore
|
||||||
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
|
this.openExistingDocumentRoute(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opened the existing input in two modes
|
||||||
|
* Either as a focus with closure of the dialog.
|
||||||
|
* Or as a background tab without closing of the dialog.
|
||||||
|
*/
|
||||||
|
editExistingInput (e: I_OpenedDocument) {
|
||||||
|
// @ts-ignore
|
||||||
|
e = (Array.isArray(e)) ? e[0] : e
|
||||||
|
this.openExistingDocumentRouteWithEdit(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
documentPass = null as unknown as I_OpenedDocument
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Add new document under parent
|
||||||
|
/****************************************************************/
|
||||||
|
addNewUnderParent (currentDoc: I_OpenedDocument) {
|
||||||
|
createNewWithParent(currentDoc, this)
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
// Document field copying
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
copyName (currentDoc: I_OpenedDocument) {
|
||||||
|
console.log(currentDoc)
|
||||||
|
copyDocumentName(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyTextColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentTextColor(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyBackgroundColor (currentDoc: I_OpenedDocument) {
|
||||||
|
copyDocumentBackgroundColor(currentDoc)
|
||||||
|
}
|
||||||
|
|
||||||
|
copyTargetDocument (currentDoc: I_OpenedDocument) {
|
||||||
|
this.documentPass = extend(true, {}, currentDoc)
|
||||||
|
|
||||||
|
const newDocument = copyDocument(this.documentPass, this.generateUID())
|
||||||
|
|
||||||
|
const dataPass = {
|
||||||
|
doc: newDocument,
|
||||||
|
treeAction: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
this.SSET_addOpenedDocument(dataPass)
|
||||||
|
this.$router.push({
|
||||||
|
path: newDocument.url
|
||||||
|
}).catch((e: {name: string}) => {
|
||||||
|
const errorName : string = e.name
|
||||||
|
if (errorName === "NavigationDuplicated") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1013,11 +1013,13 @@ body.body--dark {
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.relationshipChipNewTab,
|
||||||
.q-field__input,
|
.q-field__input,
|
||||||
.q-icon,
|
.q-icon,
|
||||||
.q-field__native span {
|
.q-field__native span {
|
||||||
color: $darkModeText !important;
|
color: $darkModeText !important;
|
||||||
|
|
||||||
|
.q-icon,
|
||||||
&.q-chip__icon--remove {
|
&.q-chip__icon--remove {
|
||||||
color: #000 !important;
|
color: #000 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ export const createNewWithParent = (currentDoc: I_OpenedDocument, callingCompone
|
||||||
if (currentDoc) {
|
if (currentDoc) {
|
||||||
const routeObject = {
|
const routeObject = {
|
||||||
_id: currentDoc.type,
|
_id: currentDoc.type,
|
||||||
parent: currentDoc._id
|
// @ts-ignore
|
||||||
|
parent: (currentDoc._id) || currentDoc.id
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
callingComponent.addNewObjectRoute(routeObject)
|
callingComponent.addNewObjectRoute(routeObject)
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
- Switch field: Template (sigh... maybe???)
|
- Switch field: Template (sigh... maybe???)
|
||||||
|
|
||||||
- Mass tag rename
|
- Mass tag rename
|
||||||
|
- Add category for diseases/curses/etc
|
||||||
|
|
||||||
|
## THE GM BATCH
|
||||||
|
|
||||||
- Add "Related notes"
|
- Add "Related notes"
|
||||||
|
- Floating notes corkboard
|
||||||
|
- Add hover/on-demand document preview to relationships
|
||||||
|
|
||||||
|
- Export for MD/PDF
|
||||||
|
- Selective export per field basis
|
||||||
|
- Export templates
|
||||||
|
- DM only fields
|
||||||
|
|
||||||
|
## THE GM BATCH END
|
||||||
|
|
||||||
- Add "Predecessors", "Successors", "Date of start", "Date of end" and "How long it lasted" fields to locations and all other groups
|
- Add "Predecessors", "Successors", "Date of start", "Date of end" and "How long it lasted" fields to locations and all other groups
|
||||||
|
|
||||||
- Add advanced search capabilities to the hierarchical tree
|
- Add advanced search capabilities to the hierarchical tree
|
||||||
|
|
||||||
- "Save all" keybind and "Save all and exit" option on the exiting
|
- "Save all" keybind and "Save all and exit" option on the exiting
|
||||||
|
|
||||||
- Add hover/on-demand document preview to relationships
|
|
||||||
- Floating notes corkboard
|
|
||||||
- Export for MD/PDF
|
|
||||||
|
|
||||||
- Add intelligent responsive design to the left tree and document body (maybe button to pull the left bar in and out?)
|
- Add intelligent responsive design to the left tree and document body (maybe button to pull the left bar in and out?)
|
||||||
|
|
||||||
- Add "Open all search matches" button in the Quick-search that opens a new page with a list of items
|
- Add "Open all search matches" button in the Quick-search that opens a new page with a list of items
|
||||||
|
|
Loading…
Reference in a new issue