Merged with development

This commit is contained in:
WBHarry 2025-08-23 18:17:32 +02:00
commit bd76e22e8d
1096 changed files with 11080 additions and 5102 deletions

View file

@ -124,11 +124,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
_attachPartListeners(partId, htmlElement, options) {
super._attachPartListeners(partId, htmlElement, options);
htmlElement
.querySelectorAll('[data-action="selectFolder"]')
.forEach(element => element.addEventListener("contextmenu", (event) => {
htmlElement.querySelectorAll('[data-action="selectFolder"]').forEach(element =>
element.addEventListener('contextmenu', event => {
event.target.classList.toggle('expanded');
}))
})
);
}
/* -------------------------------------------- */
@ -154,7 +154,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
Object.values(config).forEach(c => {
const folder = {
id: c.id,
label: c.label,
label: game.i18n.localize(c.label),
selected: (!parent || parent.selected) && this.selectedMenu.path[depth] === c.id
};
folder.folders = c.folders
@ -173,11 +173,16 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
folderPath = `${compendium}.folders.${folderId}`,
folderData = foundry.utils.getProperty(config, folderPath);
const columns = ItemBrowser.getFolderConfig(folderData).map(col => ({
...col,
label: game.i18n.localize(col.label)
}));
this.selectedMenu = {
path: folderPath.split('.'),
data: {
...folderData,
columns: ItemBrowser.getFolderConfig(folderData)
columns: columns
}
};
@ -190,8 +195,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
this.items = ItemBrowser.sortBy(items, 'name');
if(target) {
target.closest('.compendium-sidebar').querySelectorAll('[data-action="selectFolder"]').forEach(element => element.classList.remove("is-selected"))
if (target) {
target
.closest('.compendium-sidebar')
.querySelectorAll('[data-action="selectFolder"]')
.forEach(element => element.classList.remove('is-selected'));
target.classList.add('is-selected');
}
@ -199,7 +207,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
}
_replaceHTML(result, content, options) {
if(!options.isFirstRender) delete result.sidebar;
if (!options.isFirstRender) delete result.sidebar;
super._replaceHTML(result, content, options);
}
@ -237,6 +245,12 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
else if (typeof f.choices === 'function') {
f.choices = f.choices();
}
// Clear field label so template uses our custom label parameter
if (f.field && f.label) {
f.field.label = undefined;
}
f.name ??= f.key;
f.value = this.presets?.filter?.[f.name]?.value ?? null;
});