Files
foundryvtt-reve-de-dragon/module/dialog-select.js
T
fabres 81cb3bb6bd fix: DialogV2 - formes imbriquees, boutons, styles et positionnement
- retire les <form> dans les templates DialogV2 (absorbe par V2)
- ajoute window: {frame, positioned} et enleve height:fit-content (bloquait deplacement vertical)
- ajoute buttons: [Fermer] sur tous les DialogV2 qui en manquaient
- style des dialogs chronologie, calendar-editor, stress
- corrige duplication des boutons calendrier a chaque re-render
- HandlebarsApplicationMixin sur FenetreRechercheTirage
- corrige selecteurs :input→input,select,textarea (jQuery→natif)
- ajoute banniere ASCII console au demarrage
2026-07-22 01:10:24 +02:00

42 lines
1.3 KiB
JavaScript

import { renderTemplate } from "./constants.js";
export class DialogSelect extends foundry.applications.api.DialogV2 {
static extractIdNameImg(it) { return { id: it.id, name: it.name, img: it.img } }
static async select(selectionData, onSelectChoice) {
const content = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select.hbs", selectionData)
const dialog = new DialogSelect({
title: selectionData.title ?? selectionData.label,
content,
selectionData,
onSelectChoice
})
dialog.render({ force: true })
}
constructor({ title, content, selectionData, onSelectChoice }) {
super({
title,
content,
classes: ["rdd-dialog-select"],
position: { width: 'fit-content' },
buttons: [{ action: "close", label: "Fermer", icon: "fa-solid fa-xmark", callback: () => this.close() }]
})
this.selectionData = selectionData
this.onSelectChoice = onSelectChoice
}
_onRender(context) {
super._onRender(context)
this.element.querySelectorAll("li.select-choice").forEach(li => {
li.addEventListener("click", () => this.choiceSelected(li.dataset.id))
})
}
choiceSelected(selectedId) {
const selected = this.selectionData.list.find(it => it.id == selectedId)
this.close()
if (selected) this.onSelectChoice(selected)
}
}