enhace feature sheet and apply new standard style to applications

fix unexpected missed padding

requested changes
This commit is contained in:
molilo 2025-05-26 10:45:59 -03:00
parent cf51153432
commit 3c948ca1b7
24 changed files with 1074 additions and 128 deletions

60
module/applications/sheets/feature.mjs Normal file → Executable file
View file

@ -12,7 +12,8 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) {
static DEFAULT_OPTIONS = {
tag: 'form',
classes: ['daggerheart', 'sheet', 'feature'],
id: 'daggerheart-feature',
classes: ['daggerheart', 'sheet', 'dh-style', 'feature'],
position: { width: 600, height: 600 },
window: { resizable: true },
actions: {
@ -30,17 +31,57 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) {
};
static PARTS = {
form: {
id: 'feature',
template: 'systems/daggerheart/templates/sheets/feature.hbs'
header: { template: 'systems/daggerheart/templates/sheets/items/feature/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
actions: {
template: 'systems/daggerheart/templates/sheets/items/feature/actions.hbs',
scrollable: ['.actions']
},
settings: {
template: 'systems/daggerheart/templates/sheets/items/feature/settings.hbs',
scrollable: ['.settings']
},
effects: {
template: 'systems/daggerheart/templates/sheets/items/feature/effects.hbs',
scrollable: ['.effects']
}
};
_getTabs() {
const tabs = {
features: { active: true, cssClass: '', group: 'primary', id: 'features', icon: null, label: 'Features' },
effects: { active: false, cssClass: '', group: 'primary', id: 'effects', icon: null, label: 'Effects' },
actions: { active: false, cssClass: '', group: 'primary', id: 'actions', icon: null, label: 'Actions' }
description: {
active: true,
cssClass: '',
group: 'primary',
id: 'description',
icon: null,
label: 'DAGGERHEART.Sheets.Feature.Tabs.Description'
},
actions: {
active: false,
cssClass: '',
group: 'primary',
id: 'actions',
icon: null,
label: 'DAGGERHEART.Sheets.Feature.Tabs.Actions'
},
settings: {
active: false,
cssClass: '',
group: 'primary',
id: 'settings',
icon: null,
label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings'
},
effects: {
active: false,
cssClass: '',
group: 'primary',
id: 'effects',
icon: null,
label: 'DAGGERHEART.Sheets.Feature.Tabs.Effects'
}
};
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] ? this.tabGroups[v.group] === v.id : v.active;
@ -58,7 +99,8 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) {
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.document = this.document;
(context.tabs = this._getTabs()), (context.generalConfig = SYSTEM.GENERAL);
context.tabs = this._getTabs();
context.generalConfig = SYSTEM.GENERAL;
context.itemConfig = SYSTEM.ITEM;
context.properties = SYSTEM.ACTOR.featureProperties;
context.dice = SYSTEM.GENERAL.diceTypes;
@ -98,7 +140,7 @@ export default class FeatureSheet extends DaggerheartSheet(ItemSheetV2) {
}
static async addAction() {
const action = await new DaggerheartAction({}, { parent: this.document });
const action = await new DaggerheartAction({ img: this.document.img }, { parent: this.document });
await this.document.update({ 'system.actions': [...this.document.system.actions, action] });
await new DaggerheartActionConfig(this.document.system.actions[this.document.system.actions.length - 1]).render(
true

View file

@ -285,19 +285,31 @@ export const weaponFeatures = {
export const featureTypes = {
ancestry: {
id: 'ancestry',
label: 'DAGGERHEART.Feature.Type.Ancestry'
label: 'DAGGERHEART.Feature.Type.ancestry'
},
community: {
id: 'community',
label: 'DAGGERHEART.Feature.Type.Community'
label: 'DAGGERHEART.Feature.Type.community'
},
class: {
id: 'class',
label: 'DAGGERHEART.Feature.Type.Class'
label: 'DAGGERHEART.Feature.Type.class'
},
subclass: {
id: 'subclass',
label: 'DAGGERHEART.Feature.Type.Subclass'
label: 'DAGGERHEART.Feature.Type.subclass'
},
classHope: {
id: 'classHope',
label: 'DAGGERHEART.Feature.Type.classHope'
},
domainCard: {
id: 'domainCard',
label: 'DAGGERHEART.Feature.Type.domainCard'
},
equipment: {
id: 'equipment',
label: 'DAGGERHEART.Feature.Type.equipment'
}
};

1
module/data/action.mjs Normal file → Executable file
View file

@ -4,6 +4,7 @@ export default class DaggerheartAction extends foundry.abstract.DataModel {
return {
id: new fields.StringField({}),
name: new fields.StringField({ initial: 'New Action' }),
img: new fields.StringField({ initial: '' }),
damage: new fields.SchemaField({
type: new fields.StringField({ choices: SYSTEM.GENERAL.damageTypes, nullable: true, initial: null }),
value: new fields.StringField({})