Drag depuis la fenêtre de recherche
This commit is contained in:
		| @@ -59,6 +59,7 @@ export class FenetreRechercheTirage extends Application { | |||||||
|       width: 600, |       width: 600, | ||||||
|       height: 600, |       height: 600, | ||||||
|       popOut: true, |       popOut: true, | ||||||
|  |       dragDrop: [{ dragSelector: "a.content-link" }], | ||||||
|       resizable: true |       resizable: true | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
| @@ -83,13 +84,13 @@ export class FenetreRechercheTirage extends Application { | |||||||
|   } |   } | ||||||
|   static $typeToFilter(type) { return { group: 'type', code: type, label: Misc.typeName('Item', type), check: item => item.type == type }; } |   static $typeToFilter(type) { return { group: 'type', code: type, label: Misc.typeName('Item', type), check: item => item.type == type }; } | ||||||
|  |  | ||||||
|   static async create(tirage = {}) { |   static async create(options) { | ||||||
|     new FenetreRechercheTirage(tirage).render(true); |     new FenetreRechercheTirage(options).render(true); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   constructor(tirage) { |   constructor(options) { | ||||||
|     super(); |     super(options); | ||||||
|     this.tirage = tirage; |     this.tirage = {}; | ||||||
|     this.compendiums = [ |     this.compendiums = [ | ||||||
|       SystemCompendiums.getCompendium('faune-flore-mineraux'), |       SystemCompendiums.getCompendium('faune-flore-mineraux'), | ||||||
|       SystemCompendiums.getCompendium('equipement') |       SystemCompendiums.getCompendium('equipement') | ||||||
| @@ -131,6 +132,12 @@ export class FenetreRechercheTirage extends Application { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   _canDragStart() { | ||||||
|  |     return true; | ||||||
|  |   } | ||||||
|  |   _onDragStart(event) { | ||||||
|  |     console.log('_onDragStart', event) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   activateListeners(html) { |   activateListeners(html) { | ||||||
|     super.activateListeners(html); |     super.activateListeners(html); | ||||||
| @@ -150,10 +157,7 @@ export class FenetreRechercheTirage extends Application { | |||||||
|  |  | ||||||
|     this.html.find("a.supprimer-filtres").click(async event => this.html.find('input.activate-filter:checked').prop("checked", false)) |     this.html.find("a.supprimer-filtres").click(async event => this.html.find('input.activate-filter:checked').prop("checked", false)) | ||||||
|  |  | ||||||
|     this.html.find("a.recherche-filtres").click(async event => { |     this.html.find("a.recherche-filtres").click(async event => await this.recherche()) | ||||||
|       const table = await this.buildTable(); |  | ||||||
|       this.html.find('div.liste-resultats').html(await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats.hbs`, { resultats: table })); |  | ||||||
|     }) |  | ||||||
|  |  | ||||||
|     this.html.find("a.tirage-filtres").click(async event => { |     this.html.find("a.tirage-filtres").click(async event => { | ||||||
|       const table = await this.buildTable(); |       const table = await this.buildTable(); | ||||||
| @@ -162,6 +166,13 @@ export class FenetreRechercheTirage extends Application { | |||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   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); | ||||||
|  |     this._dragDrop.forEach(dragDropHandler => dragDropHandler.bind(this.element[0])) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   async buildTable() { |   async buildTable() { | ||||||
|     const filter = this.getSelectedItemsFilter(); |     const filter = this.getSelectedItemsFilter(); | ||||||
|     const equipementCompendiumTable = new CompendiumTable('equipement', 'Item'); |     const equipementCompendiumTable = new CompendiumTable('equipement', 'Item'); | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  |   <span draggable="true"> | ||||||
|   {{#if pack}} |   {{#if pack}} | ||||||
|   {{!-- draggable="true"  --}} |   {{!-- draggable="true"  --}} | ||||||
|   <a class="content-link" |   <a class="content-link" | ||||||
| @@ -18,3 +19,4 @@ | |||||||
|   <i class="fas fa-suitcase"></i> |   <i class="fas fa-suitcase"></i> | ||||||
|   {{/if}} |   {{/if}} | ||||||
|   {{name}}</a> |   {{name}}</a> | ||||||
|  | </span> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user