diff --git a/src/components/dialogs/ExistingDocument.vue b/src/components/dialogs/ExistingDocument.vue index 7306f7d..1a12e96 100644 --- a/src/components/dialogs/ExistingDocument.vue +++ b/src/components/dialogs/ExistingDocument.vue @@ -18,10 +18,6 @@ -
- -
- !((!this.includeCategories && e.isCategory))) - .filter(e => !((!this.includeMinor && e.isMinor))) } /****************************************************************/ @@ -425,7 +407,7 @@ export default class ExistingDocumentDialog extends DialogBase { filterExistingSelect (val: string, update: (e: () => void) => void) { if (val === "") { update(() => { - this.filteredExistingInput = this.existingObjectPrefilteredList + this.filteredExistingInput = this.existingObjectPrefilteredList.filter((obj) => !obj.isMinor) if (this.$refs.ref_existingDocument && this.filteredExistingInput.length > 0) { this.refocusSelect().catch(e => console.log(e)) } diff --git a/src/components/fields/Field_MultiRelationship.vue b/src/components/fields/Field_MultiRelationship.vue index dc4f720..0ee6b43 100644 --- a/src/components/fields/Field_MultiRelationship.vue +++ b/src/components/fields/Field_MultiRelationship.vue @@ -500,7 +500,7 @@ export default class Field_MultiRelationship extends FieldBase { filterSelect (val: string, update: (e: () => void) => void) { if (val === "") { update(() => { - this.filterList = this.allDocumentsWithoutCurrent + this.filterList = this.allDocumentsWithoutCurrent.filter((obj) => !obj.isMinor) if (this.$refs[`multiRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) { this.refocusSelect().catch(e => console.log(e)) } @@ -613,7 +613,6 @@ export default class Field_MultiRelationship extends FieldBase { // Do a last set of filtering this.allDocumentsWithoutCurrent = allObjectsWithoutCurrent .filter((obj) => !obj.isCategory) - .filter((obj) => !obj.isMinor) // @ts-ignore allObjectsWithoutCurrent = null diff --git a/src/components/fields/Field_SingleRelationship.vue b/src/components/fields/Field_SingleRelationship.vue index 7ca5548..1f54697 100644 --- a/src/components/fields/Field_SingleRelationship.vue +++ b/src/components/fields/Field_SingleRelationship.vue @@ -504,7 +504,7 @@ export default class Field_SingleRelationship extends FieldBase { filterSelect (val: string, update: (e: () => void) => void) { if (val === "") { update(() => { - this.filterList = this.allDocumentsWithoutCurrent + this.filterList = this.allDocumentsWithoutCurrent.filter((obj) => !obj.isMinor) if (this.$refs[`singleRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) { this.refocusSelect().catch(e => console.log(e)) @@ -577,7 +577,7 @@ export default class Field_SingleRelationship extends FieldBase { const isBelongsUnder = (this.inputDataBluePrint.id === "parentDoc") const objectsWithoutCurrent: I_ShortenedDocument[] = (isBelongsUnder) ? allObjects.filter((obj) => obj._id !== this.currentId) - : allObjects.filter((obj) => obj._id !== this.currentId).filter((obj) => !obj.isCategory).filter((obj) => !obj.isMinor) + : allObjects.filter((obj) => obj._id !== this.currentId).filter((obj) => !obj.isCategory) // Proceed only if the local input is properly set up if (this.localInput._id) { diff --git a/src/documents/advancedSearchGuide.md b/src/documents/advancedSearchGuide.md index 87b4732..7f07d78 100644 --- a/src/documents/advancedSearchGuide.md +++ b/src/documents/advancedSearchGuide.md @@ -52,6 +52,9 @@ Except for the advanced search functionality, Fantasia Archive also offers insta - `$` - Symbol for document type search - `#` - Symbol for tag search - `>` - Symbol for hierarchical path search + - `^` - Symbol for switch search (limited values below) + - `^d` - Displays only documents with `Is Dead/Gone/Destroyed` ticked on + - `^m` - Displays only documents with `Is a minor document` ticked on that are normally invisible and filtered out ## Full-search filtering @@ -79,6 +82,6 @@ This feature is meant mostly for those in need of full-scale search that can cra - **A list of fields/field types the full-search doesn't work with:** - The `Break` field type (these are the big titles present throughout the document) - The `Tags` field type (this one is covered with a more sophisticated tag filter) - - The `Switch` field type (this one doesn't contain any text values to even filter) + - The `Switch` field type (this one doesn't contain any text values to even filter and is partially covered by the switch search option) - The `Name` field (this one is the main concern of the search and the normal search is far more advanced for searching through this one) - The `Belongs under` field (this one is covered by a much more advanced hierarchical path search) diff --git a/src/documents/changeLog.md b/src/documents/changeLog.md index b0fc792..536b8eb 100644 --- a/src/documents/changeLog.md +++ b/src/documents/changeLog.md @@ -27,8 +27,8 @@ ### New features -- Added context menu support and multiple actions (right click) for top tabs and hierarchical tree - - New action for **Top Tabs** +- Added context menu support and multiple actions (right click) for top tabs, hierarchical tree and relationships across whole app + - New actions for **Top Tabs** - Copy name - Copy text color - Copy background color @@ -40,7 +40,7 @@ - Force close all tabs except for this - Force close all tabs - Delete document - - New action for **Hiearachical Tree** + - New actions for **Hiearachical Tree** - Add new document type: `DOCUMENT TYPE` - Only available in the root-categories - Expand all under this nodd @@ -53,7 +53,19 @@ - Create new document with this document as parent - Copy this document - Delete document + - New actions for **Relationships** + - Copy name + - Copy text color + - Copy background color + - Open document + - Edit document + - Create new document with this document as parent + - Copy this document - Added a special description field for categories that become visible only when the document is switches to the category mode +- Added filtering via switch value for `Is a minor document` and `Is Dead/Gone/Destroyed` switch + - Dead is visible in the lists by default, but can be used to narrow down the search + - Minor is NOT visible in the lists by default, but can be inluded using this option + - Instructions on how to trigger by this additions can be found in the `Advanced Search Guide` help menu - Added Fantasia mascot in the app! ^_^ - Different document tabs now keep scroll distance and resume wherever you left them at - Added support for default empty keybinds diff --git a/src/scripts/utilities/advancedDocumentFilter.ts b/src/scripts/utilities/advancedDocumentFilter.ts index 43149e2..3c4c5f2 100644 --- a/src/scripts/utilities/advancedDocumentFilter.ts +++ b/src/scripts/utilities/advancedDocumentFilter.ts @@ -43,12 +43,15 @@ export const advancedDocumentFilter = (inputString: string, currentDocumentList: let categorySeach = false as unknown as string let tagSearch = false as unknown as string let typeSeach = false as unknown as string + let switchSearch = false as unknown as string + let fieldSearch = false as unknown as string const categorySeachIndex = searchWordList.findIndex(w => w.charAt(0) === ">") const tagSearchIndex = searchWordList.findIndex(w => w.charAt(0) === "#") const typeSeachIndex = searchWordList.findIndex(w => w.charAt(0) === "$") const fieldSearchIndex = searchWordList.findIndex(w => w.charAt(0) === "%") + const switchSeachIndex = searchWordList.findIndex(w => w.charAt(0) === "^") if (categorySeachIndex >= 0) { categorySeach = searchWordList[categorySeachIndex].substring(1) @@ -63,6 +66,11 @@ export const advancedDocumentFilter = (inputString: string, currentDocumentList: searchWordList[typeSeachIndex] = "" } + if (switchSeachIndex >= 0) { + switchSearch = searchWordList[switchSeachIndex].substring(1) + searchWordList[switchSeachIndex] = "" + } + if (fieldSearchIndex >= 0) { fieldSearch = searchWordList[fieldSearchIndex].substring(1) searchWordList[fieldSearchIndex] = "" @@ -267,6 +275,44 @@ export const advancedDocumentFilter = (inputString: string, currentDocumentList: }) } + /****************************************************************/ + // Switch filter + /****************************************************************/ + + if (switchSearch) { + currentDocumentList = currentDocumentList.filter(doc => { + let foundSwitch = false + + if (switchSearch === "d") { + const field = doc.extraFields.find(e => e.id === "deadSwitch") + if (field && field.value === true) { + foundSwitch = true + } + } + + if (switchSearch === "m") { + const field = doc.extraFields.find(e => e.id === "minorSwitch") + if (field && field.value === true) { + foundSwitch = true + } + } + + return foundSwitch + }) + } + // Automatically filter out minor documents otherwise + else { + currentDocumentList = currentDocumentList.filter(doc => { + let isntMinor = true + const field = doc.extraFields.find(e => e.id === "minorSwitch") + if (field && field.value === true) { + isntMinor = false + } + + return isntMinor + }) + } + /****************************************************************/ // Return list without further lookup for actual text if none is present /****************************************************************/ diff --git a/suggestionList.md b/suggestionList.md index b15e305..517c726 100644 --- a/suggestionList.md +++ b/suggestionList.md @@ -1,3 +1,5 @@ + +- Add advanced search cheat sheet to existing docs popup and in relationship searches in some way - Switch field: Template (sigh... maybe???) - Mass tag rename