corpus index filtering ok #1801

This commit is contained in:
2023-03-01 22:00:43 +01:00
parent 249d7fdb02
commit f903424ddb
6 changed files with 79 additions and 15 deletions
+5
View File
@@ -880,6 +880,7 @@ section[role="main-content"]{
.toc-title{ .toc-title{
@include title4grey; @include title4grey;
color: $grismoyen;
&.active, &.active,
&:hover{ &:hover{
color:$grisfonce; color:$grisfonce;
@@ -891,6 +892,10 @@ section[role="main-content"]{
&.notitle{ &.notitle{
color: red; color: red;
} }
&.disabled{
color: $grisclair;
pointer-events: none;
}
} }
h2.toc-title{font-size: 1.1em;} h2.toc-title{font-size: 1.1em;}
h3.toc-title{font-size: 1em;} h3.toc-title{font-size: 1em;}
+2 -1
View File
@@ -1,7 +1,8 @@
$bleuroi: rgb(61,82,102); $bleuroi: rgb(61,82,102);
$bleuroilight: lighten(rgb(61,82,102), 30%); $bleuroilight: lighten(rgb(61,82,102), 30%);
$gris: rgb(200,204,204);
$grisclair: rgb(230,234,234); $grisclair: rgb(230,234,234);
$gris: rgb(190,194,194);
$grismoyen: rgb(150,150,160);
$grisfonce: rgb(57,57,64); $grisfonce: rgb(57,57,64);
$or: rgb(179,161,125); $or: rgb(179,161,125);
$rouge: rgb(204,61,82); $rouge: rgb(204,61,82);
+25 -10
View File
@@ -12,6 +12,7 @@
:calculate-position="dropDownMenuPos" :calculate-position="dropDownMenuPos"
:options="opts" :options="opts"
:clearable="true" :clearable="true"
:value="getSeletedValue(key)"
@input="onClickIndexItem" @input="onClickIndexItem"
> >
<template v-slot:option="option"> <template v-slot:option="option">
@@ -33,29 +34,32 @@ export default {
}, },
data: () => ({ data: () => ({
options: {}, options: {},
persons_selected: '', indexes_keys: [],
objects_selected: '', persons_selected: null,
places_selected: '' objects_selected: null,
places_selected: null
}), }),
created () { created () {
this.parseIndexesToOptions() this.parseIndexesToOptions()
}, },
// watch: { watch: {
// loadedtextsuuids (n, o) { persons_selected (n, o) {
// console.log('EdToc watch loadedtxtsuuids', o, n) console.log('EdIndexes watch persons_selected', o, n)
// } }
// }, },
methods: { methods: {
parseIndexesToOptions () { parseIndexesToOptions () {
console.log('EdIndexes parseIndexesToOptions', this.indexes) console.log('EdIndexes parseIndexesToOptions', this.indexes)
Object.keys(this.indexes).forEach(key => { Object.keys(this.indexes).forEach(key => {
// console.log('OPTION', key) // console.log('OPTION', key)
this.indexes_keys.push(key)
this.options[key] = [] this.options[key] = []
Object.keys(this.indexes[key]).forEach(uuid => { Object.keys(this.indexes[key]).forEach(uuid => {
// console.log('OPTIONS ITEM', key, uuid) // console.log('OPTIONS ITEM', key, uuid)
this.options[key].push({ this.options[key].push({
code: uuid, code: uuid,
label: `${this.indexes[key][uuid].title} [${this.indexes[key][uuid].quantity}]` label: `${this.indexes[key][uuid].title} [${this.indexes[key][uuid].quantity}]`,
index: key
}) })
}) })
if (!this.options[key].length) { if (!this.options[key].length) {
@@ -105,9 +109,20 @@ export default {
*/ */
return () => popper.destroy() return () => popper.destroy()
}, },
getSeletedValue (key) {
return this[`${key}_selected`]
},
onClickIndexItem (o) { onClickIndexItem (o) {
console.log('onClickIndexItem', o)
this.indexes_keys.forEach(key => {
if (o && key === o.index) {
this[`${key}_selected`] = o
} else {
this[`${key}_selected`] = null
}
})
// this.page_selected = o // this.page_selected = o
// this.$emit('onClickPaginationItem', o) this.$emit('onClickIndexItem', o)
} }
} }
} }
+3 -1
View File
@@ -10,6 +10,7 @@
:level="1" :level="1"
:editionid="$route.params.id" :editionid="$route.params.id"
:loadedtextsuuids="loadedtextsuuids" :loadedtextsuuids="loadedtextsuuids"
:selectedindex="selectedindex"
@onClickTocItem="onClickTocItem" @onClickTocItem="onClickTocItem"
@onScrollToRef="onScrollToRef" @onScrollToRef="onScrollToRef"
/> />
@@ -29,7 +30,8 @@ export default {
}, },
props: { props: {
toc: Array, toc: Array,
loadedtextsuuids: Array loadedtextsuuids: Array,
selectedindex: Object
}, },
// watch: { // watch: {
// reftoscrollto: function (newref, oldref) { // reftoscrollto: function (newref, oldref) {
+38 -3
View File
@@ -4,14 +4,28 @@
:level="level" :level="level"
:type="item.type" :type="item.type"
class="tocitem" class="tocitem"
:class="{active: isActive, loaded: isLoaded, notitle: noTitle, init_opened: isInitOpened, opened: isOpened}" :class="{
active: isActive,
loaded: isLoaded,
notitle: noTitle,
init_opened: isInitOpened,
opened: isOpened,
disabled: isDisabled
}"
> >
<component <component
:is="titlelevel" :is="titlelevel"
v-if="title" v-if="title"
class="toc-title" class="toc-title"
:uuid="item.uuid" :uuid="item.uuid"
:class="{active: isActive, loaded: isLoaded, notitle: noTitle, init_opened: isInitOpened, opened: isOpened}" :class="{
active: isActive,
loaded: isLoaded,
notitle: noTitle,
init_opened: isInitOpened,
opened: isOpened,
disabled: isDisabled
}"
> >
<a <a
:href="'/texts/'+editionid+'/'+item.uuid" :href="'/texts/'+editionid+'/'+item.uuid"
@@ -35,6 +49,7 @@
:level="nextLevel" :level="nextLevel"
:editionid="editionid" :editionid="editionid"
:loadedtextsuuids="loadedtextsuuids" :loadedtextsuuids="loadedtextsuuids"
:selectedindex="selectedindex"
@onClickTocItem="onClickTocItem" @onClickTocItem="onClickTocItem"
@onScrollToRef="onScrollToRef" @onScrollToRef="onScrollToRef"
/> />
@@ -58,7 +73,8 @@ export default {
item: Object, item: Object,
level: Number, level: Number,
editionid: String, editionid: String,
loadedtextsuuids: Array loadedtextsuuids: Array,
selectedindex: Object
}, },
data: () => ({ data: () => ({
isInitOpened: false, isInitOpened: false,
@@ -108,6 +124,16 @@ export default {
// but not for isOpened (had to use a watcher + beforeMount) // but not for isOpened (had to use a watcher + beforeMount)
// don't now why ? // don't now why ?
return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1 return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1
},
isDisabled () {
let disabled = false
if (this.selectedindex &&
(!this.flat_indexes.length || this.flat_indexes.indexOf(this.selectedindex.code) === -1)
) {
// console.log('tocitem disabled ?', this.selectedindex.code)
disabled = true
}
return disabled
} }
}, },
watch: { watch: {
@@ -123,6 +149,15 @@ export default {
} }
} }
}, },
created () {
this.flat_indexes = []
Object.keys(this.item.indexes[0]).forEach(index => {
this.item.indexes[0][index].forEach(element => {
this.flat_indexes.push(element.uuid)
})
})
console.log('tocItem created flat_indexes', this.flat_indexes)
},
beforeMount () { beforeMount () {
if (typeof this.$route.params.textid !== 'undefined') { if (typeof this.$route.params.textid !== 'undefined') {
this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0 this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0
+6
View File
@@ -107,12 +107,14 @@
id="toc" id="toc"
:toc="toc" :toc="toc"
:loadedtextsuuids="textsuuids" :loadedtextsuuids="textsuuids"
:selectedindex="selectedindex"
@onClickTocItem="onClickTocItem" @onClickTocItem="onClickTocItem"
/> />
<EdIndexes <EdIndexes
v-if="indexes" v-if="indexes"
id="indexes-filters" id="indexes-filters"
:indexes="indexes" :indexes="indexes"
@onClickIndexItem="onClickIndexItem"
/> />
<EdPagination <EdPagination
v-if="pagination" v-if="pagination"
@@ -181,6 +183,7 @@ export default {
flattoc: null, flattoc: null,
// //
indexes: null, indexes: null,
selectedindex: null,
// //
pagination: null, pagination: null,
// //
@@ -431,6 +434,9 @@ export default {
}) })
} }
}, },
onClickIndexItem (o) {
this.selectedindex = o
},
onClickPaginationItem (o) { onClickPaginationItem (o) {
console.log('onClickPaginationItem', o) console.log('onClickPaginationItem', o)
if (this.textsuuids.indexOf(o.uuid) !== -1) { if (this.textsuuids.indexOf(o.uuid) !== -1) {