Make it so we don't need to re-render the sheet on collapse toggle
This commit is contained in:
parent
34eae97b47
commit
97af3801c4
5 changed files with 63 additions and 51 deletions
|
|
@ -114,19 +114,19 @@ export class GenericActorSheet extends ActorSheet {
|
||||||
};
|
};
|
||||||
|
|
||||||
async _handleSummaryToggle($e) {
|
async _handleSummaryToggle($e) {
|
||||||
|
$e.stopPropagation();
|
||||||
let target = $e.currentTarget;
|
let target = $e.currentTarget;
|
||||||
let parent = target.parentElement;
|
let parent = target.closest(`.collapse`);
|
||||||
let data = target.dataset;
|
let data = target.dataset;
|
||||||
console.debug(`.dungeon | Collapse ID: ${data.collapseId}`);
|
console.debug(`.dungeon | Collapse ID: ${data.collapseId}`);
|
||||||
|
|
||||||
if (!this._expanded.has(data.collapseId)) {
|
if (!this._expanded.has(data.collapseId)) {
|
||||||
this._expanded.add(data.collapseId);
|
this._expanded.add(data.collapseId);
|
||||||
|
parent.setAttribute(`open`, ``);
|
||||||
} else {
|
} else {
|
||||||
this._expanded.delete(data.collapseId);
|
this._expanded.delete(data.collapseId);
|
||||||
|
parent.removeAttribute(`open`, ``);
|
||||||
};
|
};
|
||||||
if (parent.nodeName !== "DETAILS") {
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async openEmbeddedSheet($event) {
|
async openEmbeddedSheet($event) {
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,38 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.collapse {
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
&__toggle {
|
||||||
|
color: var(--inventory-material-color);
|
||||||
|
transition: transform 200ms ease-in-out;
|
||||||
|
&:focus-visible {
|
||||||
|
box-shadow: 0 0 10px var(--color-shadow-highlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__content { display: none; visibility: hidden; }
|
||||||
|
&[open] .collapse{
|
||||||
|
&__toggle {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
&__content {
|
||||||
|
display: unset;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.material {
|
.material {
|
||||||
@include material.elevate(1);
|
@include material.elevate(1);
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
@ -192,23 +224,6 @@
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: var(--inventory-material-color);
|
color: var(--inventory-material-color);
|
||||||
|
|
||||||
&__header {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
color: var(--inventory-material-color);
|
|
||||||
&:focus-visible {
|
|
||||||
box-shadow: 0 0 10px var(--color-shadow-highlight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&__name {
|
&__name {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
<section class="aspect">
|
<section
|
||||||
|
class="aspect collapse"
|
||||||
|
{{dd-expanded meta.expanded item.uuid}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="aspect__header"
|
class="collapse__header"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="equal-padding reduced-padding"
|
class="collapse__toggle equal-padding reduced-padding"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
||||||
>
|
>
|
||||||
<div aria-hidden="true" class="icon icon--12">
|
<div aria-hidden="true" class="icon icon--12">
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
|
||||||
{{{ icons.caret-down }}}
|
|
||||||
{{else}}
|
|
||||||
{{{ icons.caret-right }}}
|
{{{ icons.caret-right }}}
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="aspect__name">
|
<h3 class="aspect__name">
|
||||||
{{item.name}}
|
{{item.name}}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
<div class="collapse__content">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="aspect__content">
|
<div class="aspect__content">
|
||||||
<div class="aspect__field editable">
|
<div class="aspect__field editable">
|
||||||
|
|
@ -95,5 +94,5 @@
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,20 @@
|
||||||
<section class="untyped">
|
<section
|
||||||
|
class="untyped collapse"
|
||||||
|
{{dd-expanded meta.expanded item.uuid}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="untyped__header"
|
class="collapse__header"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="equal-padding reduced-padding"
|
class="collapse__toggle equal-padding reduced-padding"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
||||||
>
|
>
|
||||||
<div aria-hidden="true" class="icon icon--12">
|
<div aria-hidden="true" class="icon icon--12">
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
|
||||||
{{{ icons.caret-down }}}
|
|
||||||
{{else}}
|
|
||||||
{{{ icons.caret-right }}}
|
{{{ icons.caret-right }}}
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="untyped__name">
|
<h3 class="untyped__name">
|
||||||
|
|
@ -25,7 +24,7 @@
|
||||||
(x {{item.system.quantity}})
|
(x {{item.system.quantity}})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
<div class="collapse__content">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="untyped__content">
|
<div class="untyped__content">
|
||||||
<div class="untyped__field editable">
|
<div class="untyped__field editable">
|
||||||
|
|
@ -98,5 +97,5 @@
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,20 @@
|
||||||
<section class="weapon">
|
<section
|
||||||
|
class="weapon collapse"
|
||||||
|
{{dd-expanded meta.expanded item.uuid}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="weapon__header"
|
class="collapse__header"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="equal-padding reduced-padding"
|
class="collapse__toggle equal-padding reduced-padding"
|
||||||
data-collapse-id="{{item.uuid}}"
|
data-collapse-id="{{item.uuid}}"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
aria-label="{{dd-i18n 'dotdungeon.sheet.actor.v2.toggle-item-information' item}}"
|
||||||
>
|
>
|
||||||
<div aria-hidden="true" class="icon icon--12">
|
<div aria-hidden="true" class="icon icon--12">
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
|
||||||
{{{ icons.caret-down }}}
|
|
||||||
{{else}}
|
|
||||||
{{{ icons.caret-right }}}
|
{{{ icons.caret-right }}}
|
||||||
{{/if}}
|
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="weapon__name">
|
<h3 class="weapon__name">
|
||||||
|
|
@ -25,7 +24,7 @@
|
||||||
(x {{item.system.quantity}})
|
(x {{item.system.quantity}})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if (dd-set-has meta.expanded item.uuid)}}
|
<div class="collapse__content">
|
||||||
<hr>
|
<hr>
|
||||||
<div class="weapon__content">
|
<div class="weapon__content">
|
||||||
<div class="weapon__field editable">
|
<div class="weapon__field editable">
|
||||||
|
|
@ -113,5 +112,5 @@
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue