mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
[Fix] Item Browser Corrections (#1290)
* Fixed so lists do not fail to show items when search is empty * Fixed so that the clear button loads in the items * . * .
This commit is contained in:
parent
fcb9c032ef
commit
7df43d71e0
3 changed files with 11 additions and 7 deletions
|
|
@ -2570,6 +2570,7 @@
|
||||||
"evasionMin": "Evasion (Min)",
|
"evasionMin": "Evasion (Min)",
|
||||||
"evasionMax": "Evasion (Max)",
|
"evasionMax": "Evasion (Max)",
|
||||||
"subtype": "Subtype",
|
"subtype": "Subtype",
|
||||||
|
"missing": "<i>Missing</i>",
|
||||||
"folders": {
|
"folders": {
|
||||||
"characters": "Characters",
|
"characters": "Characters",
|
||||||
"adversaries": "Adversaries",
|
"adversaries": "Adversaries",
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
const property = foundry.utils.getProperty(item, field.key);
|
const property = foundry.utils.getProperty(item, field.key);
|
||||||
if (Array.isArray(property)) property.join(', ');
|
if (Array.isArray(property)) property.join(', ');
|
||||||
if (typeof field.format !== 'function') return property ?? '-';
|
if (typeof field.format !== 'function') return property ?? '-';
|
||||||
return field.format(property);
|
return game.i18n.localize(field.format(property));
|
||||||
}
|
}
|
||||||
|
|
||||||
formatChoices(data) {
|
formatChoices(data) {
|
||||||
|
|
@ -430,7 +430,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
if (matchesMenu) this.#filteredItems.browser.input.add(item.id);
|
if (matchesMenu) this.#filteredItems.browser.input.add(item.id);
|
||||||
|
|
||||||
const { search } = this.#filteredItems.browser;
|
const { search } = this.#filteredItems.browser;
|
||||||
li.hidden = !(search.has(item.id) && matchesMenu);
|
li.hidden = !((this.#search.browser.query.length === 0 || search.has(item.id)) && matchesMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -469,6 +469,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
|
||||||
static resetFilters() {
|
static resetFilters() {
|
||||||
this.render({ force: true });
|
this.render({ force: true });
|
||||||
|
this.loadItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
static getFolderConfig(folder, property = 'columns') {
|
static getFolderConfig(folder, property = 'columns') {
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ export const typeConfig = {
|
||||||
{
|
{
|
||||||
key: 'system.linkedClass',
|
key: 'system.linkedClass',
|
||||||
label: 'Class',
|
label: 'Class',
|
||||||
format: linkedClass => linkedClass.name
|
format: linkedClass => linkedClass?.name ?? 'DAGGERHEART.UI.ItemBrowser.missing'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'system.spellcastingTrait',
|
key: 'system.spellcastingTrait',
|
||||||
|
|
@ -375,7 +375,9 @@ export const typeConfig = {
|
||||||
key: 'system.linkedClass.uuid',
|
key: 'system.linkedClass.uuid',
|
||||||
label: 'Class',
|
label: 'Class',
|
||||||
choices: items => {
|
choices: items => {
|
||||||
const list = items.map(item => ({
|
const list = items
|
||||||
|
.filter(item => item.system.linkedClass)
|
||||||
|
.map(item => ({
|
||||||
value: item.system.linkedClass.uuid,
|
value: item.system.linkedClass.uuid,
|
||||||
label: item.system.linkedClass.name
|
label: item.system.linkedClass.name
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue