From 855cdcdc1bc29c6ff20622bfad52966ae5731495 Mon Sep 17 00:00:00 2001 From: Matheus Clemente Date: Sun, 31 Mar 2024 19:16:45 -0300 Subject: [PATCH] Ability Score filters + restyling --- src/module/applications/compendium-browser.js | 33 +--- src/styles/compendium-browser.less | 146 ++++++++------- .../CompendiumBrowserCreatures.vue | 168 ++++++++++-------- 3 files changed, 185 insertions(+), 162 deletions(-) diff --git a/src/module/applications/compendium-browser.js b/src/module/applications/compendium-browser.js index ce097d3..a8191b1 100644 --- a/src/module/applications/compendium-browser.js +++ b/src/module/applications/compendium-browser.js @@ -92,7 +92,7 @@ export class CompendiumBrowserVueApplication extends Application { // Reactivate the listeners if we need to. if (!this.vueListenersActive) { setTimeout(() => { - this.activateVueListeners($(this.form), true); + this.activateVueListeners(true); }, 150); } return; @@ -112,7 +112,7 @@ export class CompendiumBrowserVueApplication extends Application { this.vueRoot = this.vueApp.mount(`[data-appid="${this.appId}"] .compendium-browser-mount`); // @todo Find a better solution than a timeout. setTimeout(() => { - this.activateVueListeners($(this.form), false); + this.activateVueListeners(); }, 150); } @@ -142,37 +142,14 @@ export class CompendiumBrowserVueApplication extends Application { /** * Activate additional listeners on the rendered Vue app. - * @param {jQuery} html */ - activateVueListeners(html, repeat = false) { - if (!this.options.editable) { - html.find("input,select,textarea").attr("disabled", true); - return; - } - - if (html.find(".archmage-v2-vue").length > 0) { - this.vueListenersActive = true; - } + activateVueListeners(repeat = false) { + this.vueListenersActive = true; // Place one-time executions after this line. if (repeat) return; // Input listeners. - let inputs = '.section input[type="text"], .section input[type="number"]'; - html.on("focus", inputs, (event) => this._onFocus(event)); - } - - /** - * Handle focus events. - * - * @param {*} event - */ - _onFocus(event) { - let target = event.currentTarget; - setTimeout(function () { - if (target == document.activeElement) { - $(target).trigger("select"); - } - }, 100); + this.element.find(".filtercontainer h3").click(async (ev) => await $(ev.target.nextElementSibling).toggle(100)); } } diff --git a/src/styles/compendium-browser.less b/src/styles/compendium-browser.less index 078fde6..b986c6b 100644 --- a/src/styles/compendium-browser.less +++ b/src/styles/compendium-browser.less @@ -60,10 +60,69 @@ } } .control-area { - position: sticky; height: 100%; - overflow: auto; flex: 2; + .controls { + overflow: hidden auto; + .filtercontainer { + border: 1px solid #bbb; + border-radius: 5px; + margin-top: 5px; + padding: 2px; + h3 { + margin: 0; + cursor: pointer; + } + dl { + margin: 5px 0; + } + div { + margin: 5px 0; + } + dt { + display: inline-block; + width: 40%; + padding-left: 5px; + } + dd { + display: inline-block; + width: 58%; + margin-left: 0; + select { + width: 100%; + } + } + .multiselect { + border: 1px solid #bbb; + border-radius: 3px; + vertical-align: middle; + line-height: 32px; + margin: 2px 0; + label { + padding: 5px; + } + input { + vertical-align: middle; + } + } + .small-input { + width: calc(100% - 44px); + height: 27px; + background: rgba(0, 0, 0, 0.05); + border: 1px solid #444; + border-radius: 3px; + padding: 0 3px; + text-overflow: ellipsis; + } + .small-select { + width: 40px; + } + } + } + footer { + flex: 0; + padding: 1rem 0 3px; + } button { background: rgba(0, 0, 0, 0.05); border: 1px solid #bbb; @@ -71,60 +130,6 @@ margin-top: 5px; padding: 2px; } - .filtercontainer { - border: 1px solid #bbb; - border-radius: 5px; - margin-top: 5px; - padding: 2px; - h3 { - margin: 0; - cursor: pointer; - } - dl { - margin: 5px 0; - } - div { - margin: 5px 0; - } - dt { - display: inline-block; - width: 40%; - padding-left: 5px; - } - dd { - display: inline-block; - width: 58%; - margin-left: 0; - select { - width: 100%; - } - } - .multiselect { - border: 1px solid #bbb; - border-radius: 3px; - vertical-align: middle; - line-height: 32px; - margin: 2px 0; - label { - padding: 5px; - } - input { - vertical-align: middle; - } - } - .small-input { - width: calc(100% - 44px); - height: 27px; - background: rgba(0, 0, 0, 0.05); - border: 1px solid #444; - border-radius: 3px; - padding: 0 3px; - text-overflow: ellipsis; - } - .small-select { - width: 40px; - } - } } .list-area { position: sticky; @@ -134,17 +139,11 @@ flex: 0; text-align: center; } - } - .browser { - height: 100%; - overflow-y: hidden !important; - .window-content { - overflow-y: hidden !important; - } + ul { float: right; display: block; - min-width: 335px; + // min-width: 335px; margin: 0; height: 100%; overflow: auto; @@ -153,6 +152,10 @@ display: none; } li { + &:hover { + cursor: pointer; + } + span { white-space: nowrap; overflow: hidden; @@ -178,6 +181,13 @@ } } } + } + .browser { + height: 100%; + overflow-y: hidden !important; + .window-content { + overflow-y: hidden !important; + } .spacer { display: inline-block; min-width: 5px; @@ -328,6 +338,14 @@ } } } + + &:hover { + .npc-line { + .npc-name { + text-shadow: 0 0 8px var(--color-shadow-primary); + } + } + } } } .settings { diff --git a/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue b/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue index e090551..7b87886 100644 --- a/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue +++ b/src/vue/components/dialogs/compendium-browser/CompendiumBrowserCreatures.vue @@ -1,79 +1,98 @@