0.1.5 - added support by filtering via dead and minor switches

This commit is contained in:
Elvanos 2021-04-12 03:41:25 +02:00
parent e660cd59ad
commit 49df35eecf
7 changed files with 71 additions and 27 deletions

View file

@ -18,10 +18,6 @@
<q-checkbox dark color="primary" v-model="includeCategories" label="Include categories in the list?" /> <q-checkbox dark color="primary" v-model="includeCategories" label="Include categories in the list?" />
</div> </div>
<div class="q-mb-lg">
<q-checkbox dark color="primary" v-model="includeMinor" label="Include minor documents in the list?" />
</div>
<q-select <q-select
style="width: 400px;" style="width: 400px;"
ref="ref_existingDocument" ref="ref_existingDocument"
@ -322,11 +318,6 @@ export default class ExistingDocumentDialog extends DialogBase {
*/ */
includeCategories = true includeCategories = true
/**
* Model for pre-filtering via minor documents
*/
includeMinor = false
/** /**
* React to the category checkbox changes * React to the category checkbox changes
*/ */
@ -335,21 +326,12 @@ export default class ExistingDocumentDialog extends DialogBase {
this.preFilterDocuments() this.preFilterDocuments()
} }
/**
* React to the category checkbox changes
*/
@Watch("includeMinor")
reactToMinorCheckboxChange () {
this.preFilterDocuments()
}
/** /**
* Prefilter documents based on what is in the checkbox * Prefilter documents based on what is in the checkbox
*/ */
preFilterDocuments () { preFilterDocuments () {
this.existingObjectPrefilteredList = this.existingObjectsFullList this.existingObjectPrefilteredList = this.existingObjectsFullList
.filter(e => !((!this.includeCategories && e.isCategory))) .filter(e => !((!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) { filterExistingSelect (val: string, update: (e: () => void) => void) {
if (val === "") { if (val === "") {
update(() => { update(() => {
this.filteredExistingInput = this.existingObjectPrefilteredList this.filteredExistingInput = this.existingObjectPrefilteredList.filter((obj) => !obj.isMinor)
if (this.$refs.ref_existingDocument && this.filteredExistingInput.length > 0) { if (this.$refs.ref_existingDocument && this.filteredExistingInput.length > 0) {
this.refocusSelect().catch(e => console.log(e)) this.refocusSelect().catch(e => console.log(e))
} }

View file

@ -500,7 +500,7 @@ export default class Field_MultiRelationship extends FieldBase {
filterSelect (val: string, update: (e: () => void) => void) { filterSelect (val: string, update: (e: () => void) => void) {
if (val === "") { if (val === "") {
update(() => { update(() => {
this.filterList = this.allDocumentsWithoutCurrent this.filterList = this.allDocumentsWithoutCurrent.filter((obj) => !obj.isMinor)
if (this.$refs[`multiRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) { if (this.$refs[`multiRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) {
this.refocusSelect().catch(e => console.log(e)) this.refocusSelect().catch(e => console.log(e))
} }
@ -613,7 +613,6 @@ export default class Field_MultiRelationship extends FieldBase {
// Do a last set of filtering // Do a last set of filtering
this.allDocumentsWithoutCurrent = allObjectsWithoutCurrent this.allDocumentsWithoutCurrent = allObjectsWithoutCurrent
.filter((obj) => !obj.isCategory) .filter((obj) => !obj.isCategory)
.filter((obj) => !obj.isMinor)
// @ts-ignore // @ts-ignore
allObjectsWithoutCurrent = null allObjectsWithoutCurrent = null

View file

@ -504,7 +504,7 @@ export default class Field_SingleRelationship extends FieldBase {
filterSelect (val: string, update: (e: () => void) => void) { filterSelect (val: string, update: (e: () => void) => void) {
if (val === "") { if (val === "") {
update(() => { update(() => {
this.filterList = this.allDocumentsWithoutCurrent this.filterList = this.allDocumentsWithoutCurrent.filter((obj) => !obj.isMinor)
if (this.$refs[`singleRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) { if (this.$refs[`singleRelationshipField${this.inputDataBluePrint.id}`] && this.filterList.length > 0) {
this.refocusSelect().catch(e => console.log(e)) 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 isBelongsUnder = (this.inputDataBluePrint.id === "parentDoc")
const objectsWithoutCurrent: I_ShortenedDocument[] = (isBelongsUnder) const objectsWithoutCurrent: I_ShortenedDocument[] = (isBelongsUnder)
? allObjects.filter((obj) => obj._id !== this.currentId) ? 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 // Proceed only if the local input is properly set up
if (this.localInput._id) { if (this.localInput._id) {

View file

@ -52,6 +52,9 @@ Except for the advanced search functionality, Fantasia Archive also offers insta
- `$` - Symbol for document type search - `$` - Symbol for document type search
- `#` - Symbol for tag search - `#` - Symbol for tag search
- `>` - Symbol for hierarchical path 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 ## 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:** - **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 `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 `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 `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) - The `Belongs under` field (this one is covered by a much more advanced hierarchical path search)

View file

@ -27,8 +27,8 @@
### New features ### New features
- Added context menu support and multiple actions (right click) for top tabs and hierarchical tree - Added context menu support and multiple actions (right click) for top tabs, hierarchical tree and relationships across whole app
- New action for **Top Tabs** - New actions for **Top Tabs**
- Copy name - Copy name
- Copy text color - Copy text color
- Copy background color - Copy background color
@ -40,7 +40,7 @@
- Force close all tabs except for this - Force close all tabs except for this
- Force close all tabs - Force close all tabs
- Delete document - Delete document
- New action for **Hiearachical Tree** - New actions for **Hiearachical Tree**
- Add new document type: `DOCUMENT TYPE` - Add new document type: `DOCUMENT TYPE`
- Only available in the root-categories - Only available in the root-categories
- Expand all under this nodd - Expand all under this nodd
@ -53,7 +53,19 @@
- Create new document with this document as parent - Create new document with this document as parent
- Copy this document - Copy this document
- Delete 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 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! ^_^ - Added Fantasia mascot in the app! ^_^
- Different document tabs now keep scroll distance and resume wherever you left them at - Different document tabs now keep scroll distance and resume wherever you left them at
- Added support for default empty keybinds - Added support for default empty keybinds

View file

@ -43,12 +43,15 @@ export const advancedDocumentFilter = (inputString: string, currentDocumentList:
let categorySeach = false as unknown as string let categorySeach = false as unknown as string
let tagSearch = false as unknown as string let tagSearch = false as unknown as string
let typeSeach = 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 let fieldSearch = false as unknown as string
const categorySeachIndex = searchWordList.findIndex(w => w.charAt(0) === ">") const categorySeachIndex = searchWordList.findIndex(w => w.charAt(0) === ">")
const tagSearchIndex = searchWordList.findIndex(w => w.charAt(0) === "#") const tagSearchIndex = searchWordList.findIndex(w => w.charAt(0) === "#")
const typeSeachIndex = searchWordList.findIndex(w => w.charAt(0) === "$") const typeSeachIndex = searchWordList.findIndex(w => w.charAt(0) === "$")
const fieldSearchIndex = 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) { if (categorySeachIndex >= 0) {
categorySeach = searchWordList[categorySeachIndex].substring(1) categorySeach = searchWordList[categorySeachIndex].substring(1)
@ -63,6 +66,11 @@ export const advancedDocumentFilter = (inputString: string, currentDocumentList:
searchWordList[typeSeachIndex] = "" searchWordList[typeSeachIndex] = ""
} }
if (switchSeachIndex >= 0) {
switchSearch = searchWordList[switchSeachIndex].substring(1)
searchWordList[switchSeachIndex] = ""
}
if (fieldSearchIndex >= 0) { if (fieldSearchIndex >= 0) {
fieldSearch = searchWordList[fieldSearchIndex].substring(1) fieldSearch = searchWordList[fieldSearchIndex].substring(1)
searchWordList[fieldSearchIndex] = "" 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 // Return list without further lookup for actual text if none is present
/****************************************************************/ /****************************************************************/

View file

@ -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???) - Switch field: Template (sigh... maybe???)
- Mass tag rename - Mass tag rename