Recherche par nom
Dans la fenêtre de recherche, possibilité de chercher sur le nom des objets en plus des autres critères
This commit is contained in:
@ -202,7 +202,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-periode.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
|
||||
// Partials
|
||||
'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/common/timestamp.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/common/periodicite.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/common/enum-duree.hbs',
|
||||
|
@ -3,6 +3,7 @@ import { HtmlUtility } from '../html-utility.js';
|
||||
import { Misc } from "../misc.js";
|
||||
import { CompendiumTableHelpers } from '../settings/system-compendiums.js';
|
||||
import { RdDRaretes } from '../item/raretes.js';
|
||||
import { Grammar } from '../grammar.js';
|
||||
|
||||
const FILTER_GROUPS = [
|
||||
{ group: 'type', label: "Type d'objet" },
|
||||
@ -188,6 +189,30 @@ export class FenetreRechercheTirage extends Application {
|
||||
const row = await CompendiumTableHelpers.getRandom(table, 'Item')
|
||||
await CompendiumTableHelpers.tableRowToChatMessage(row, 'Item');
|
||||
})
|
||||
|
||||
// this.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 => {
|
||||
// const nouvelleRecherche = this._optionRecherche(event.currentTarget);
|
||||
// if (this.options.recherche?.text != nouvelleRecherche?.text) {
|
||||
// this.options.recherche = nouvelleRecherche;
|
||||
// if (this.timerRecherche) {
|
||||
// clearTimeout(this.timerRecherche);
|
||||
// }
|
||||
// this.timerRecherche = setTimeout(() => {
|
||||
// this.timerRecherche = undefined;
|
||||
// this.render(true);
|
||||
// }, 500);
|
||||
// }
|
||||
// })
|
||||
// .change(async event =>
|
||||
// this.options.recherche = this._optionRecherche(event.currentTarget)
|
||||
// );
|
||||
}
|
||||
|
||||
showFilterGroup(groupDiv, show) {
|
||||
@ -200,14 +225,14 @@ export class FenetreRechercheTirage extends Application {
|
||||
|
||||
supprimerFiltres() {
|
||||
this.html.find('input:is(.activate-filter-group,.activate-filter-milieu)').prop("checked", false);
|
||||
this.html.find('div.liste-resultats').html('');
|
||||
this.changeListeFiltresActifs();
|
||||
this.html.find('div.liste-resultats-recherche').html('');
|
||||
this.html.find('.section-filters-text input.recherche').val('');
|
||||
}
|
||||
|
||||
async recherche() {
|
||||
const table = await this.buildTable();
|
||||
const htmlResultats = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats.hbs`, { resultats: table });
|
||||
this.html.find('div.liste-resultats').html(htmlResultats);
|
||||
const htmlResultats = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs`, { resultats: table });
|
||||
this.html.find('div.liste-resultats-recherche').html(htmlResultats);
|
||||
this._dragDrop.forEach(dragDropHandler => dragDropHandler.bind(this.element[0]))
|
||||
}
|
||||
|
||||
@ -225,13 +250,19 @@ export class FenetreRechercheTirage extends Application {
|
||||
}
|
||||
return (it, mi) => true;
|
||||
}
|
||||
buildFilterRechercheName() {
|
||||
const recherche = this.html.find('.section-filters-text input.recherche').val();
|
||||
if (recherche) {
|
||||
return (it, mi) => Grammar.includesLowerCaseNoAccent(it.name, recherche);
|
||||
}
|
||||
return (it, mi) => true;
|
||||
}
|
||||
|
||||
buildCheckedGroupFilter(milieux) {
|
||||
const filtersList = this.getGroupCheckedFilters()
|
||||
.map(gf => this.buildOrFilter(gf.filters.map(f => f.check)));
|
||||
if (milieux) {
|
||||
filtersList.push(this.buildMilieuxFilter(milieux));
|
||||
}
|
||||
filtersList.push(this.buildMilieuxFilter(milieux));
|
||||
filtersList.push(this.buildFilterRechercheName());
|
||||
return this.buildAndFilter(filtersList)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user