diff --git a/changelog.md b/changelog.md index 00ed703..98e3511 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,21 @@ # Changelog +## 0.1.3 + +### Bugfixes + +- Fixed the "Name" field disappearing upon full deletion of text + +### New features + +### QoL adjustments + +- Added a hierarchical path to Quick opening existing document and single/multi relationship fields +- Added color support to single/multi relationship fields +- Added filtering to include or exclude documents that are considered categories in the Quick opening existing document dialog +- Improved performance by reducing the amount of time the side-tree re-renders +- Added automatic opening of hierarchical tree branches upon adding/moving documents under/among them + ## 0.1.2 ### Bugfixes diff --git a/src/BaseClass.ts b/src/BaseClass.ts index 63bc982..efa814d 100644 --- a/src/BaseClass.ts +++ b/src/BaseClass.ts @@ -163,13 +163,26 @@ export default class BaseClass extends Vue { // Open documents management /****************************************************************/ - @OpenedDocuments.Getter("getAllDocuments") SGET_allOpenedDocuments !: {timestamp: string, docs: I_OpenedDocument[]} + @OpenedDocuments.Getter("getAllDocuments") SGET_allOpenedDocuments !: {treeAction: boolean, timestamp: string, docs: I_OpenedDocument[]} @OpenedDocuments.Getter("getDocument") SGET_openedDocument!: (id: string) => I_OpenedDocument - @OpenedDocuments.Mutation("addDocument") SSET_addOpenedDocument!: (input: I_OpenedDocument) => void - @OpenedDocuments.Mutation("updateDocument") SSET_updateOpenedDocument!: (input: I_OpenedDocument) => void - @OpenedDocuments.Mutation("removeDocument") SSET_removeOpenedDocument!: (input: I_OpenedDocument) => void - @OpenedDocuments.Mutation("resetDocuments") SSET_resetDocuments!: () => void + @OpenedDocuments.Action("addDocument") SSET_addOpenedDocument!: (input: { + doc: I_OpenedDocument, + treeAction: boolean + }) => void + + @OpenedDocuments.Action("updateDocument") SSET_updateOpenedDocument!: (input: { + doc: I_OpenedDocument, + treeAction: boolean + }) => void + + @OpenedDocuments.Action("removeDocument") SSET_removeOpenedDocument!: (input: { + doc: I_OpenedDocument, + treeAction: boolean + }) => void + + @OpenedDocuments.Action("triggerTreeAction") SSET_triggerTreeAction!: () => void + @OpenedDocuments.Action("resetDocuments") SSET_resetDocuments!: () => void /** * Retrieves value of requested field. If the field doesn't exist, returns false instead @@ -243,4 +256,34 @@ export default class BaseClass extends Vue { ) } } + + /****************************************************************/ + // Document list management + /****************************************************************/ + getDocumentHieararchicalPath (document: I_OpenedDocument, list: I_OpenedDocument[]): string { + let hierarchiString = "" + + // @ts-ignore + const parentDoc = (this.retrieveFieldValue(document, "parentDoc"))?.value + if (!parentDoc) { + const singleBlueprintName = this.SGET_allBlueprints.find(e => e._id === document.type)?.nameSingular + hierarchiString += singleBlueprintName + return hierarchiString + } + const matchingDoc = list.find((doc:I_OpenedDocument) => { + // @ts-ignore + return doc.id === parentDoc._id + }) as I_OpenedDocument + + // @ts-ignore + hierarchiString += this.retrieveFieldValue(matchingDoc.doc, "name") + + // @ts-ignore + const connectedReturn = this.getDocumentHieararchicalPath(matchingDoc.doc, list) + if (connectedReturn) { + hierarchiString = `${connectedReturn} > ${hierarchiString}` + } + + return hierarchiString + } } diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 3b0caa9..c1bd9c1 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -2,7 +2,7 @@
@@ -39,10 +39,15 @@ export default class AppHeader extends BaseClass { diff --git a/src/components/appHeader/AppWindowButtons.vue b/src/components/appHeader/AppWindowButtons.vue index 098455b..2a7805b 100644 --- a/src/components/appHeader/AppWindowButtons.vue +++ b/src/components/appHeader/AppWindowButtons.vue @@ -2,7 +2,7 @@ .appWindowButtons { + border-radius: 0; position: fixed; right: 0; top: 0; height: 40px; z-index: 99999999; color: #fff; + -webkit-app-region: no-drag; } diff --git a/src/components/appHeader/TopTabs.vue b/src/components/appHeader/TopTabs.vue index bbbe3b5..b9169a5 100644 --- a/src/components/appHeader/TopTabs.vue +++ b/src/components/appHeader/TopTabs.vue @@ -105,7 +105,8 @@ export default class TopTabs extends BaseClass { } closeDocument (input: I_OpenedDocument) { - this.SSET_removeOpenedDocument(input) + const dataPass = { doc: input, treeAction: false } + this.SSET_removeOpenedDocument(dataPass) this.documentCloseDialogConfirm = false setTimeout(() => { this.refreshRoute() @@ -222,6 +223,8 @@ export default class TopTabs extends BaseClass { diff --git a/src/components/fields/Field_SingleRelationship.vue b/src/components/fields/Field_SingleRelationship.vue index 3b36472..46ac4b4 100644 --- a/src/components/fields/Field_SingleRelationship.vue +++ b/src/components/fields/Field_SingleRelationship.vue @@ -39,6 +39,10 @@
- + + {{opt.hierarchicalPath}} This option is unavailable for selection as it is already paired to another. @@ -187,7 +194,9 @@ export default class Field_SingleRelationship extends BaseClass { if (this.inputDataBluePrint?.relationshipSettings && this.currentId.length > 0) { const CurrentObjectDB = new PouchDB(this.inputDataBluePrint.relationshipSettings.connectedObjectType) - const allObjects = (await CurrentObjectDB.allDocs({ include_docs: true })).rows.map((doc) => { + const allDbObjects = (await CurrentObjectDB.allDocs({ include_docs: true })).rows + + const allObjects = allDbObjects.map((doc) => { const objectDoc = doc.doc as unknown as I_ShortenedDocument const pairedField = (this.inputDataBluePrint?.relationshipSettings?.connectedField) || "" @@ -210,8 +219,11 @@ export default class Field_SingleRelationship extends BaseClass { disable: isDisabled, url: `/project/display-content/${objectDoc.type}/${objectDoc._id}`, label: objectDoc.extraFields.find(e => e.id === "name")?.value, + color: objectDoc.extraFields.find(e => e.id === "documentColor")?.value, isCategory: objectDoc.extraFields.find(e => e.id === "categorySwitch")?.value, - pairedField: pairedField + pairedField: pairedField, + // @ts-ignore + hierarchicalPath: this.getDocumentHieararchicalPath(objectDoc, allDbObjects) } }) as unknown as I_FieldRelationship[] diff --git a/src/css/app.scss b/src/css/app.scss index 327a414..d946d15 100644 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -60,3 +60,19 @@ body { .q-toggle__inner--truthy .q-toggle__thumb { left: calc(100% - 30px); } + +.singleRelashionshipSelect, +.multiRelashionshipSelect { + &.q-field--dark .q-field__control::before { + border: 1px solid rgba(0, 0, 0, 0.24); + } + + .q-field__input, + .q-field__native span { + color: #000 !important; + } +} + +.q-menu .q-item { + transition: none !important; +} diff --git a/src/interfaces/I_OpenedDocument.ts b/src/interfaces/I_OpenedDocument.ts index 3f0b7b1..f2fb3a1 100644 --- a/src/interfaces/I_OpenedDocument.ts +++ b/src/interfaces/I_OpenedDocument.ts @@ -23,6 +23,7 @@ export interface I_ShortenedDocument{ url: string expandable?: boolean _id: string + isCategory?: boolean parentDoc: string | false children: I_ShortenedDocument[] extraFields: I_ExtraDocumentFields[] diff --git a/src/pages/DocumentDisplay.vue b/src/pages/DocumentDisplay.vue index 6c9dd7f..26aafe8 100644 --- a/src/pages/DocumentDisplay.vue +++ b/src/pages/DocumentDisplay.vue @@ -69,7 +69,7 @@ = { - // someAction (context) { - // } + addDocument (state, input) { + state.commit("addDocument", input) + + setTimeout(() => { + state.commit("resetTreeAction") + }, 200) + }, + + updateDocument (state, input) { + state.commit("updateDocument", input) + + setTimeout(() => { + state.commit("resetTreeAction") + }, 200) + }, + + removeDocument (state, input) { + state.commit("removeDocument", input) + + setTimeout(() => { + state.commit("resetTreeAction") + }, 200) + }, + + resetDocuments (state) { + state.commit("resetDocuments") + + setTimeout(() => { + state.commit("resetTreeAction") + }, 200) + }, + + triggerTreeAction (state) { + state.commit("triggerTreeAction") + + setTimeout(() => { + state.commit("resetTreeAction") + }, 200) + } } export default actions diff --git a/src/store/module-openedDocuments/mutations.ts b/src/store/module-openedDocuments/mutations.ts index 6267200..020706e 100644 --- a/src/store/module-openedDocuments/mutations.ts +++ b/src/store/module-openedDocuments/mutations.ts @@ -5,31 +5,56 @@ import { I_OpenedDocument } from "./../../interfaces/I_OpenedDocument" import { uid } from "quasar" const mutation: MutationTree = { - addDocument (state: OpenDocumentsStateInterface, input: I_OpenedDocument) { + addDocument (state: OpenDocumentsStateInterface, input: { + doc: I_OpenedDocument, + treeAction: boolean + }) { if (!state.documents.docs.find(doc => { - return doc.type === input.type && doc._id === input._id + return doc.type === input.doc.type && doc._id === input.doc._id })) { - state.documents.docs.push(input) + state.documents.docs.push(input.doc) + state.documents.treeAction = input.treeAction state.documents.timestamp = uid() } }, - updateDocument (state: OpenDocumentsStateInterface, input: I_OpenedDocument) { - const toUpdateDocIndex = state.documents.docs.findIndex(doc => doc.type === input.type && doc._id === input._id) + updateDocument (state: OpenDocumentsStateInterface, input: { + doc: I_OpenedDocument, + treeAction: boolean + }) { + const toUpdateDocIndex = state.documents.docs.findIndex(doc => doc.type === input.doc.type && doc._id === input.doc._id) - state.documents.docs[toUpdateDocIndex] = input + state.documents.docs[toUpdateDocIndex] = input.doc + state.documents.treeAction = input.treeAction state.documents.timestamp = uid() }, - removeDocument (state: OpenDocumentsStateInterface, input: I_OpenedDocument) { - const toRemoveIndex = state.documents.docs.findIndex(doc => doc.type === input.type && doc._id === input._id) + removeDocument (state: OpenDocumentsStateInterface, input: { + doc: I_OpenedDocument, + treeAction: boolean + }) { + const toRemoveIndex = state.documents.docs.findIndex(doc => doc.type === input.doc.type && doc._id === input.doc._id) state.documents.docs.splice(toRemoveIndex, 1) + state.documents.treeAction = input.treeAction state.documents.timestamp = uid() }, + resetTreeAction (state: OpenDocumentsStateInterface) { + state.documents.treeAction = false + }, + + triggerTreeAction (state: OpenDocumentsStateInterface) { + state.documents.treeAction = true + }, + resetDocuments (state: OpenDocumentsStateInterface) { state.documents.docs = [] + state.documents.treeAction = true state.documents.timestamp = uid() + + setTimeout(() => { + state.documents.treeAction = false + }, 200) } } diff --git a/src/store/module-openedDocuments/state.ts b/src/store/module-openedDocuments/state.ts index 12c0e0a..87d9420 100644 --- a/src/store/module-openedDocuments/state.ts +++ b/src/store/module-openedDocuments/state.ts @@ -3,6 +3,7 @@ import { I_OpenedDocument } from "./../../interfaces/I_OpenedDocument" export interface OpenDocumentsStateInterface { documents: { timestamp: string, + treeAction: boolean, docs: I_OpenedDocument[] } } @@ -11,6 +12,7 @@ function state (): OpenDocumentsStateInterface { return { documents: { timestamp: "", + treeAction: false, docs: [] } }