mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 06:26:13 +01:00
Added select and autocomplete
This commit is contained in:
parent
eea1b6e6b8
commit
7943477faa
2 changed files with 35 additions and 1 deletions
|
|
@ -192,6 +192,10 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
...conditional,
|
||||
...game.system.api.data.activeEffects.EffectConditional.getConditionalFieldUseage(conditional.type)
|
||||
}));
|
||||
partContext.statusChoices = Object.values(CONFIG.statusEffects).map(x => ({
|
||||
id: x.id,
|
||||
label: x.name
|
||||
}));
|
||||
break;
|
||||
case 'changes':
|
||||
const fields = this.document.system.schema.fields.changes.element.fields;
|
||||
|
|
@ -267,6 +271,19 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
|
|||
event.target.name.endsWith('type')
|
||||
) {
|
||||
const container = event.target.closest('.conditional-container');
|
||||
|
||||
const statusSelect = container.querySelector('.form-group.status-select');
|
||||
const attributeAuto = container.querySelector('.form-group.attribute-auto');
|
||||
if (event.target.value === CONFIG.DH.GENERAL.activeEffectConditionalType.status.id) {
|
||||
statusSelect.classList.remove('not-visible');
|
||||
attributeAuto.classList.add('not-visible');
|
||||
} else {
|
||||
statusSelect.classList.add('not-visible');
|
||||
attributeAuto.classList.remove('not-visible');
|
||||
}
|
||||
statusSelect.querySelector('select').selectedIndex = '-1';
|
||||
attributeAuto.querySelector('input').value = '';
|
||||
|
||||
const { usesValue, usesComparator } =
|
||||
game.system.api.data.activeEffects.EffectConditional.getConditionalFieldUseage(event.target.value);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,24 @@
|
|||
<div class="conditional-container">
|
||||
{{!-- {{formGroup ../systemFields.conditionals.element.fields.target value=conditional.target name=(concat "system.conditionals." index ".target") localize=true }} --}}
|
||||
{{formGroup ../systemFields.conditionals.element.fields.type value=conditional.type name=(concat "system.conditionals." index ".type") localize=true }}
|
||||
{{formGroup ../systemFields.conditionals.element.fields.key value=conditional.key name=(concat "system.conditionals." index ".key") localize=true }}
|
||||
|
||||
<div class="form-group status-select {{#unless (eq conditional.type 'status')}}not-visible{{/unless}}">
|
||||
<label>{{localize "EFFECT.FIELDS.changes.element.key.label"}}</label>
|
||||
|
||||
<div class="form-fields">
|
||||
<select name="{{concat "system.conditionals." index ".key"}}">
|
||||
{{selectOptions ../statusChoices selected=conditional.key labelAttr="label" valueAttr="id" blank="" localize=true}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group attribute-auto {{#unless (eq conditional.type 'attribute')}}not-visible{{/unless}}">
|
||||
<label>{{localize "EFFECT.FIELDS.changes.element.key.label"}}</label>
|
||||
|
||||
<div class="form-fields">
|
||||
<input type="text" class="effect-change-input" name="{{concat "system.conditionals." index ".key"}}" value="{{conditional.key}}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group value {{#unless conditional.usesValue}}not-visible{{/unless}}">
|
||||
<label>{{localize "EFFECT.FIELDS.changes.element.value.label"}}</label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue