mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Update compenidum browser subclass class filter
This commit is contained in:
parent
11607e2221
commit
fd890120f7
4 changed files with 17 additions and 14 deletions
|
|
@ -440,8 +440,9 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
|
|
||||||
if (type === 'subclasses')
|
if (type === 'subclasses')
|
||||||
presets.filter = {
|
presets.filter = {
|
||||||
'system.linkedClass': { key: 'system.linkedClass', value: this.setup.class?.uuid }
|
'system.linkedClass.uuid': { key: 'system.linkedClass.uuid', value: this.setup.class?.uuid }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (equipment.includes(type))
|
if (equipment.includes(type))
|
||||||
presets.filter = {
|
presets.filter = {
|
||||||
'system.tier': { key: 'system.tier', value: 1 },
|
'system.tier': { key: 'system.tier', value: 1 },
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
filters.forEach(f => {
|
filters.forEach(f => {
|
||||||
if (typeof f.field === 'string') f.field = foundry.utils.getProperty(game, f.field);
|
if (typeof f.field === 'string') f.field = foundry.utils.getProperty(game, f.field);
|
||||||
else if (typeof f.choices === 'function') {
|
else if (typeof f.choices === 'function') {
|
||||||
f.choices = f.choices();
|
f.choices = f.choices(this.items);
|
||||||
}
|
}
|
||||||
f.name ??= f.key;
|
f.name ??= f.key;
|
||||||
f.value = this.presets?.filter?.[f.name]?.value ?? null;
|
f.value = this.presets?.filter?.[f.name]?.value ?? null;
|
||||||
|
|
@ -248,11 +248,8 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and initialize search filter instances for the inventory and loadout sections.
|
* Create and initialize search filter instance.
|
||||||
*
|
*
|
||||||
* Sets up two {@link foundry.applications.ux.SearchFilter} instances:
|
|
||||||
* - One for the inventory, which filters items in the inventory grid.
|
|
||||||
* - One for the loadout, which filters items in the loadout/card grid.
|
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_createSearchFilter() {
|
_createSearchFilter() {
|
||||||
|
|
|
||||||
|
|
@ -265,12 +265,9 @@ export const typeConfig = {
|
||||||
subclasses: {
|
subclasses: {
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'system.linkedClass',
|
||||||
label: 'Class',
|
label: 'Class',
|
||||||
format: id => {
|
format: linkedClass => linkedClass.name
|
||||||
console.log(id);
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'system.spellcastingTrait',
|
key: 'system.spellcastingTrait',
|
||||||
|
|
@ -279,9 +276,15 @@ export const typeConfig = {
|
||||||
],
|
],
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
key: 'system.linkedClass',
|
key: 'system.linkedClass.uuid',
|
||||||
label: 'Class',
|
label: 'Class',
|
||||||
field: 'system.api.models.items.DHSubclass.schema.fields.linkedClass'
|
choices: (items) => {
|
||||||
|
const list = items.map(item => ({ value: item.system.linkedClass.uuid, label: item.system.linkedClass.name }));
|
||||||
|
return list.reduce((a,c) => {
|
||||||
|
if(!(a.find(i => i.value === c.value))) a.push(c);
|
||||||
|
return a;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -356,6 +356,8 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 0fr;
|
grid-template-rows: 0fr;
|
||||||
transition: all 0.3s ease-in-out;
|
transition: all 0.3s ease-in-out;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue