Finishes scrollTo implementation on hierarchical checkboxes lists.

This commit is contained in:
mateuswetah 2022-01-25 10:37:39 -03:00
parent aa65436be9
commit 8508764f17
1 changed files with 22 additions and 23 deletions

View File

@ -461,6 +461,7 @@
} }
} else if (this.metadatum_type === 'Tainacan\\Metadata_Types\\Relationship' && selected.length) { } else if (this.metadatum_type === 'Tainacan\\Metadata_Types\\Relationship' && selected.length) {
this.isSelectedTermsLoading = true; this.isSelectedTermsLoading = true;
axios.get(`/items/?${qs.stringify({ fetch_only: 'title', postin: selected})}`) axios.get(`/items/?${qs.stringify({ fetch_only: 'title', postin: selected})}`)
@ -687,31 +688,30 @@
if (first != undefined) if (first != undefined)
this.finderColumns.splice(first, 1, { label: label, children: children, lastTerm: res.data.last_term.es_term }); this.finderColumns.splice(first, 1, { label: label, children: children, lastTerm: res.data.last_term.es_term });
else { else
this.finderColumns.push({ label: label, children: children, lastTerm: res.data.last_term.es_term }); this.finderColumns.push({ label: label, children: children, lastTerm: res.data.last_term.es_term });
setTimeout(() => { this.$nextTick(() => {
if ( setTimeout(() => {
this.$refs && if (
this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`] && this.$refs &&
this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0] && this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`] &&
this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el && this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0] &&
this.$refs['tainacan-finder-scrolling-container'] && this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el &&
this.$refs['tainacan-finder-scrolling-container'].$el) { this.$refs['tainacan-finder-scrolling-container'] &&
this.$refs['tainacan-finder-scrolling-container'].$el) {
// Scroll Into does not solve as it would scroll vertically as well... // Scroll Into does not solve as it would scroll vertically as well...
//this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el.scrollIntoView({ behavior: "smooth", inline: "start" }); //this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el.scrollIntoView({ behavior: "smooth", inline: "start" });
this.$refs['tainacan-finder-scrolling-container'].$el.scrollTo({ this.$refs['tainacan-finder-scrolling-container'].$el.scrollTo({
top: 0, top: 0,
left: first != undefined ? 0 : this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el.offsetLeft, left: first != undefined ? 0 : this.$refs[`${column + 1}.0-tainacan-li-checkbox-model`][0].$el.offsetLeft,
behavior: 'smooth' behavior: 'smooth'
}); });
} }
}, 500); }, 500);
});
}
}, },
appendMore(options, key, lastTerm) { appendMore(options, key, lastTerm) {
for (let option of options) for (let option of options)
@ -883,7 +883,7 @@
.tainacan-li-checkbox-modal { .tainacan-li-checkbox-modal {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: stretch;
padding: 0; padding: 0;
-webkit-break-inside: avoid; -webkit-break-inside: avoid;
break-inside: avoid; break-inside: avoid;
@ -1271,7 +1271,6 @@
width: 3.5em; width: 3.5em;
border-left: 1px solid var(--tainacan-gray1); border-left: 1px solid var(--tainacan-gray1);
border-bottom: 1px solid var(--tainacan-gray1); border-bottom: 1px solid var(--tainacan-gray1);
height: 3em;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;