Arbre de conteneurs et recherche améliorée #546
@ -37,8 +37,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async getData() {
|
async getData() {
|
||||||
const objectData = Misc.data(this.object);
|
const objectData = Misc.data(this.object);
|
||||||
|
this.timerRecherche = undefined;
|
||||||
//this.actor.checkMonnaiePresence(this.actor.data.items); // Always check
|
|
||||||
|
|
||||||
let formData = {
|
let formData = {
|
||||||
title: this.title,
|
title: this.title,
|
||||||
@ -78,8 +77,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
};
|
};
|
||||||
|
|
||||||
formData.competences.forEach(item => {
|
formData.competences.forEach(item => {
|
||||||
item.visible = this.options.cherchercompetence
|
item.visible = this.options.recherche
|
||||||
? RdDItemCompetence.nomContientTexte(item, this.options.cherchercompetence)
|
? RdDItemCompetence.nomContientTexte(item, this.options.recherche.text)
|
||||||
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
|
: (!this.options.showCompNiveauBase || !RdDItemCompetence.isNiveauBase(item));
|
||||||
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
|
RdDItemCompetence.levelUp(item, formData.data.compteurs.experience.value);
|
||||||
});
|
});
|
||||||
@ -424,12 +423,28 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
this.options.editCaracComp = !this.options.editCaracComp;
|
this.options.editCaracComp = !this.options.editCaracComp;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
html.find('.cherchercompetence').change(async event => {
|
|
||||||
this.options.cherchercompetence = event.currentTarget.value;
|
html.find('.recherche')
|
||||||
|
.each((index, field) => {
|
||||||
|
if (this.options.recherche) {
|
||||||
|
field.focus();
|
||||||
|
field.setSelectionRange(this.options.recherche.start, this.options.recherche.end);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.keyup(async event => {
|
||||||
|
this.options.recherche = this._optionRecherche(event.currentTarget)
|
||||||
|
if (this.timerRecherche) {
|
||||||
|
clearTimeout(this.timerRecherche);
|
||||||
|
}
|
||||||
|
this.timerRecherche = setTimeout(() => {
|
||||||
|
this.timerRecherche = undefined;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
}, 500);
|
||||||
|
})
|
||||||
|
.change(async event =>
|
||||||
|
this.options.recherche = this._optionRecherche(event.currentTarget)
|
||||||
|
);
|
||||||
html.find('.vue-detaillee').click(async event => {
|
html.find('.vue-detaillee').click(async event => {
|
||||||
console.log("CONTROLS", this.options.vueDetaillee)
|
|
||||||
this.options.vueDetaillee = !this.options.vueDetaillee;
|
this.options.vueDetaillee = !this.options.vueDetaillee;
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
@ -515,6 +530,17 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_optionRecherche(target) {
|
||||||
|
if (!target.value?.length){
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
text: target.value,
|
||||||
|
start: target.selectionStart,
|
||||||
|
end: target.selectionEnd,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
_getEventArmeCombat(event) {
|
_getEventArmeCombat(event) {
|
||||||
const li = $(event.currentTarget)?.parents(".item");
|
const li = $(event.currentTarget)?.parents(".item");
|
||||||
let armeName = li.data("arme-name");
|
let armeName = li.data("arme-name");
|
||||||
|
@ -217,7 +217,7 @@
|
|||||||
{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span>
|
{{#if options.editCaracComp}}Verrouiller{{else}}Déverrouiller{{/if}}</a></span>
|
||||||
<span class="flexrow">
|
<span class="flexrow">
|
||||||
<i class="fas fa-search"></i>
|
<i class="fas fa-search"></i>
|
||||||
<input class="cherchercompetence" type="text" value="{{options.cherchercompetence}}" name="cherchercompetence"
|
<input class="recherche" type="text" value="{{options.recherche.text}}" name="recherche"
|
||||||
size="8" data-dtype="String" placeholder="chercher"/>
|
size="8" data-dtype="String" placeholder="chercher"/>
|
||||||
<span></span>
|
<span></span>
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user