mirror of
https://github.com/Elvanos/fantasia-archive.git
synced 2024-06-02 10:24:54 +12:00
0.1.6-DEV-2
This commit is contained in:
parent
3d93792c80
commit
5e3cecf484
|
@ -550,6 +550,9 @@ export default class DocumentControl extends BaseClass {
|
|||
|
||||
const currentDoc = this.findRequestedOrActiveDocument()
|
||||
|
||||
// @ts-ignore
|
||||
const isNew = currentDoc.isNew
|
||||
|
||||
const allDocuments = this.SGET_allOpenedDocuments
|
||||
|
||||
this.documentsCopy = extend(true, [], allDocuments.docs)
|
||||
|
@ -564,8 +567,17 @@ export default class DocumentControl extends BaseClass {
|
|||
// Update the opened document
|
||||
const dataPass = { doc: savedDocument.documentCopy, treeAction: true }
|
||||
this.SSET_updateOpenedDocument(dataPass)
|
||||
// @ts-ignore
|
||||
this.SSET_updateDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
|
||||
// Update document
|
||||
if (!isNew) {
|
||||
// @ts-ignore
|
||||
this.SSET_updateDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
}
|
||||
// Add new document
|
||||
else {
|
||||
// @ts-ignore
|
||||
this.SSET_addDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
}
|
||||
|
||||
// Update all others
|
||||
for (const doc of savedDocument.allOpenedDocuments) {
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
no-connectors
|
||||
ref="tree"
|
||||
dark
|
||||
:duration="0"
|
||||
:duration="200"
|
||||
:filter="treeFilter"
|
||||
:selected.sync="selectedTreeNode"
|
||||
:expanded.sync="expandedTreeNodes"
|
||||
|
@ -566,8 +566,11 @@ export default class ObjectTree extends BaseClass {
|
|||
* Builds a brand new sparkling hearchy tree out of available data
|
||||
*/
|
||||
buildCurrentObjectTree () {
|
||||
this.hierarchicalTree = []
|
||||
|
||||
const allBlueprings = this.SGET_allBlueprints
|
||||
let treeObject: any[] = []
|
||||
|
||||
let allTreeDocuments: I_ShortenedDocument[] = []
|
||||
|
||||
// Process all documents, build hieararchy out of the and sort them via name and custom order
|
||||
|
@ -734,9 +737,9 @@ export default class ObjectTree extends BaseClass {
|
|||
}
|
||||
|
||||
// Assign the finished object to the render model
|
||||
treeObject.forEach(cat => this.recursivelyFreezeChildren(cat.children))
|
||||
// treeObject.forEach(cat => this.recursivelyFreezeChildren(cat.children))
|
||||
// @ts-ignore
|
||||
this.hierarchicalTree = Object.freeze(treeObject)
|
||||
this.hierarchicalTree = treeObject
|
||||
}
|
||||
|
||||
recursivelyFreezeChildren (children: {children: []}) {
|
||||
|
|
|
@ -62,7 +62,6 @@ export default class DeleteDocumentCheckDialog extends DialogBase {
|
|||
this.dialogModel = true
|
||||
|
||||
const documentID = (this.documentId.length > 0) ? this.documentId : this.$route.params.id
|
||||
|
||||
this.currentDocument = this.SGET_document(documentID)
|
||||
}
|
||||
}
|
||||
|
@ -88,9 +87,14 @@ export default class DeleteDocumentCheckDialog extends DialogBase {
|
|||
* Delete the document
|
||||
*/
|
||||
async deleteDocument () {
|
||||
const documentID = (this.documentId.length > 0) ? this.documentId : this.$route.params.id
|
||||
|
||||
const documentType = (this.documentType.length > 0) ? this.documentType : this.$route.params.type
|
||||
window.FA_dbs[documentType] = new PouchDB(documentType)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
this.currentDocument = await window.FA_dbs[documentType].get(documentID)
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
await window.FA_dbs[documentType].remove(this.currentDocument)
|
||||
|
||||
|
@ -99,10 +103,12 @@ export default class DeleteDocumentCheckDialog extends DialogBase {
|
|||
this.dialogModel = false
|
||||
this.SSET_setDialogState(false)
|
||||
|
||||
this.currentDocument = this.SGET_document(documentID)
|
||||
|
||||
// @ts-ignore
|
||||
this.SSET_removeOpenedDocument(dataPass)
|
||||
// @ts-ignore
|
||||
this.SSET_removeDocument({ doc: this.mapShortDocument(this.currentDocument, this.SGET_allDocumentsByType(this.currentDocument.type)) })
|
||||
this.SSET_removeDocument({ doc: this.currentDocument })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -465,8 +465,6 @@ export default class ExistingDocumentDialog extends DialogBase {
|
|||
|
||||
const retrievedObject = (this.SGET_openedDocument(e._id)) || this.SGET_document(e._id)
|
||||
|
||||
console.log(retrievedObject)
|
||||
|
||||
const dataPass = {
|
||||
doc: retrievedObject,
|
||||
treeAction: false
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
:filled="isDarkMode"
|
||||
use-chips
|
||||
multiple
|
||||
option-value="_id"
|
||||
input-debounce="200"
|
||||
v-model="localInput"
|
||||
@filter="filterSelect"
|
||||
|
@ -699,6 +700,7 @@ export default class Field_MultiRelationship extends FieldBase {
|
|||
value: this.localInput.map(e => {
|
||||
return {
|
||||
_id: e._id,
|
||||
id: e._id,
|
||||
type: e.type,
|
||||
url: e.url,
|
||||
pairedField: (this.inputDataBluePrint?.relationshipSettings?.connectedField) || ""
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
:outlined="!isDarkMode"
|
||||
:filled="isDarkMode"
|
||||
input-debounce="200"
|
||||
option-value="_id"
|
||||
v-model="localInput"
|
||||
@filter="filterSelect"
|
||||
@input="processSelectInteraction"
|
||||
|
@ -646,6 +647,7 @@ export default class Field_SingleRelationship extends FieldBase {
|
|||
const exportValue = (this.localInput && this.localInput._id)
|
||||
? {
|
||||
_id: this.localInput._id,
|
||||
id: this.localInput._id,
|
||||
type: this.localInput.type,
|
||||
url: this.localInput.url,
|
||||
pairedField: (this.inputDataBluePrint?.relationshipSettings?.connectedField) || ""
|
||||
|
|
|
@ -920,6 +920,9 @@ export default class PageDocumentDisplay extends BaseClass {
|
|||
|
||||
const currentDoc = this.findRequestedOrActiveDocument()
|
||||
|
||||
// @ts-ignore
|
||||
const isNew = currentDoc.isNew
|
||||
|
||||
const allDocuments = this.SGET_allOpenedDocuments
|
||||
|
||||
const openedDocumentsCopy: I_OpenedDocument[] = extend(true, [], allDocuments.docs)
|
||||
|
@ -934,8 +937,17 @@ export default class PageDocumentDisplay extends BaseClass {
|
|||
// Update the opened document
|
||||
const dataPass = { doc: savedDocument.documentCopy, treeAction: true }
|
||||
this.SSET_updateOpenedDocument(dataPass)
|
||||
// @ts-ignore
|
||||
this.SSET_updateDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
|
||||
// Update document
|
||||
if (!isNew) {
|
||||
// @ts-ignore
|
||||
this.SSET_updateDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
}
|
||||
// Add new document
|
||||
else {
|
||||
// @ts-ignore
|
||||
this.SSET_addDocument({ doc: this.mapShortDocument(savedDocument.documentCopy, this.SGET_allDocumentsByType(savedDocument.documentCopy.type).docs) })
|
||||
}
|
||||
|
||||
// Update all others
|
||||
for (const doc of savedDocument.allOpenedDocuments) {
|
||||
|
|
|
@ -24,7 +24,7 @@ export const saveDocument = async (
|
|||
currentDocument = await CurrentObjectDB.get(document._id)
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error)
|
||||
// console.log("Creating new document")
|
||||
}
|
||||
|
||||
let documentCopy = {} as unknown as I_OpenedDocument
|
||||
|
|
|
@ -187,9 +187,6 @@ export const many_addRelationshipToAnotherObject = async (
|
|||
|
||||
let targetPairedField = pairedDocument.extraFields[pairedFieldIndex]
|
||||
|
||||
console.log(currentValue)
|
||||
console.log(pairedField)
|
||||
|
||||
// Fix non-existant fields
|
||||
if (!targetPairedField) {
|
||||
await addFieldToDocument(pairedDocument._id, pairedField, typeToFind)
|
||||
|
|
|
@ -17,14 +17,14 @@ const mutation: MutationTree<AllDocumentsStateInterface> = {
|
|||
|
||||
// Docs
|
||||
const toAddIndexDocs = state.docs.docs.findIndex(doc => doc.type === input.doc.type && doc._id === input.doc._id)
|
||||
if (!toAddIndexDocs) {
|
||||
if (toAddIndexDocs < 0) {
|
||||
state.docs.docs.push(input.doc)
|
||||
state.docs.timestamp = timestamp
|
||||
}
|
||||
|
||||
// Docs, no cat
|
||||
const toAddIndexDocsWithoutCategory = state.docsWithoutCategories.docs.findIndex(doc => doc.type === input.doc.type && doc._id === input.doc._id)
|
||||
if (!toAddIndexDocsWithoutCategory) {
|
||||
if (toAddIndexDocsWithoutCategory < 0) {
|
||||
state.docsWithoutCategories.docs.push(input.doc)
|
||||
state.docsWithoutCategories.timestamp = timestamp
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ const mutation: MutationTree<AllDocumentsStateInterface> = {
|
|||
// Docs each cat
|
||||
const typeIndex = state.docByType.findIndex(type => type.id === input.doc.type)
|
||||
const toAddTypeIndexDocs = state.docByType[typeIndex].docs.findIndex(doc => doc._id === input.doc._id)
|
||||
if (!toAddTypeIndexDocs) {
|
||||
if (toAddTypeIndexDocs < 0) {
|
||||
state.docByType[typeIndex].docs.push(input.doc)
|
||||
state.docByType[typeIndex].timestamp = timestamp
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ const mutation: MutationTree<AllDocumentsStateInterface> = {
|
|||
// Docs each cat, no cat
|
||||
const typeIndexWithoutCats = state.docbyTypeWithoutCategories.findIndex(type => type.id === input.doc.type)
|
||||
const toAddTypeIndexDocsWithoutCats = state.docbyTypeWithoutCategories[typeIndexWithoutCats].docs.findIndex(doc => doc._id === input.doc._id)
|
||||
if (!toAddTypeIndexDocsWithoutCats) {
|
||||
if (toAddTypeIndexDocsWithoutCats < 0) {
|
||||
state.docbyTypeWithoutCategories[typeIndexWithoutCats].docs.push(input.doc)
|
||||
state.docbyTypeWithoutCategories[typeIndex].timestamp = timestamp
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- Floating notes corkboard
|
||||
- Add hover/on-demand document preview to relationships
|
||||
|
||||
- Export for MD/PDF
|
||||
- Export for MD/PDF/ODT/DOCX
|
||||
- Selective export per field basis
|
||||
- Templates for exports
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
|||
- Add description tabs
|
||||
- Add category for materials/resources OR adapt Items category
|
||||
- Add category for diseases/curses/etc
|
||||
- Add button to pull the left tree in and out
|
||||
- Add support for individual document order hiding inside the hierarchical tree for each document
|
||||
|
||||
### Project settings
|
||||
|
|
Loading…
Reference in a new issue