Some fixes :

- Autocomplete behavior fix on unlisted text.
- School tag autocomplete fix.
- Npc techniques are now collapsible.
This commit is contained in:
Vlyan
2022-03-27 16:21:50 +02:00
parent d9ba4569c7
commit fffe8d661a
6 changed files with 37 additions and 12 deletions

View File

@@ -3,7 +3,8 @@
## 1.7.0 - DiceRoller for Techniques & Npc Generator ## 1.7.0 - DiceRoller for Techniques & Npc Generator
- NPC Sheet : - NPC Sheet :
- Added a random generator feature (Demeanor, Clan and Families names courteously authorized by Edge). - Added a random generator feature (Demeanor, Clan and Families names courteously authorized by Edge).
- This is random by design, don't expect clan logic in values. - This is random by design, don't expect clan/school logic in values.
- Added collapsible techniques groupes.
- PC sheet : - PC sheet :
- Added collapsible skill/techniques groupes. - Added collapsible skill/techniques groupes.
- Army sheet : - Army sheet :

View File

@@ -180,6 +180,19 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
* @param formData * @param formData
*/ */
_updateObject(event, formData) { _updateObject(event, formData) {
// Clan tag trim if autocomplete in school name
if (
formData["autoCompleteListName"] === "data.identity.school" &&
formData["autoCompleteListSelectedIndex"] >= 0 &&
!!formData["data.identity.clan"] &&
formData["data.identity.school"].indexOf(` [${formData["data.identity.clan"]}]`) !== -1
) {
formData["data.identity.school"] = formData["data.identity.school"].replace(
` [${formData["data.identity.clan"]}]`,
""
);
}
// Store money in Zeni // Store money in Zeni
if (formData["data.money.koku"] || formData["data.money.bu"] || formData["data.money.zeni"]) { if (formData["data.money.koku"] || formData["data.money.bu"] || formData["data.money.zeni"]) {
formData["data.zeni"] = this._moneyToZeni( formData["data.zeni"] = this._moneyToZeni(

View File

@@ -768,7 +768,7 @@ export class HelpersL5r5e {
inp.parentNode.classList.add("autocomplete-wrapper"); inp.parentNode.classList.add("autocomplete-wrapper");
const closeAllLists = (elmnt = null) => { const closeAllLists = (elmnt = null) => {
const collection = document.getElementsByClassName("autocomplete-items"); const collection = document.getElementsByClassName("autocomplete-list");
for (let item of collection) { for (let item of collection) {
if (!elmnt || (elmnt !== item && elmnt !== inp)) { if (!elmnt || (elmnt !== item && elmnt !== inp)) {
item.parentNode.removeChild(item); item.parentNode.removeChild(item);
@@ -819,7 +819,7 @@ export class HelpersL5r5e {
// create a DIV element that will contain the items (values) // create a DIV element that will contain the items (values)
const listDiv = document.createElement("DIV"); const listDiv = document.createElement("DIV");
listDiv.setAttribute("id", inputEvent.target.id + "autocomplete-list"); listDiv.setAttribute("id", inputEvent.target.id + "autocomplete-list");
listDiv.setAttribute("class", "autocomplete-items"); listDiv.setAttribute("class", "autocomplete-list");
// append the DIV element as a child of the autocomplete container // append the DIV element as a child of the autocomplete container
inputEvent.target.parentNode.appendChild(listDiv); inputEvent.target.parentNode.appendChild(listDiv);
@@ -851,8 +851,8 @@ export class HelpersL5r5e {
}); });
// execute a function presses a key on the keyboard // execute a function presses a key on the keyboard
inp.addEventListener("keydown", function (e) { inp.addEventListener("keydown", (e) => {
const collection = document.getElementById(this.id + "autocomplete-list")?.getElementsByTagName("div"); const collection = document.getElementById(e.target.id + "autocomplete-list")?.getElementsByTagName("div");
if (!collection) { if (!collection) {
return; return;
} }
@@ -891,7 +891,16 @@ export class HelpersL5r5e {
// Close all list when click in the document (1st autocomplete only) // Close all list when click in the document (1st autocomplete only)
if (html.find(".autocomplete").length <= 1) { if (html.find(".autocomplete").length <= 1) {
html[0].addEventListener("click", (e) => { html[0].addEventListener("click", (e) => {
closeAllLists(e.target); const collection = document
.getElementById(e.target.id + "autocomplete-list")
?.getElementsByTagName("div");
if (collection !== undefined) {
const changeEvt = new Event("change");
changeEvt.doSubmit = true;
inp.dispatchEvent(changeEvt);
} else {
closeAllLists(e.target);
}
}); });
} }
} }

File diff suppressed because one or more lines are too long

View File

@@ -922,7 +922,7 @@ button {
position: relative; position: relative;
display: inline-block; display: inline-block;
.autocomplete-items { .autocomplete-list {
position: absolute; position: absolute;
border: 1px solid #6e7e6b; border: 1px solid #6e7e6b;
border-bottom: none; border-bottom: none;
@@ -932,14 +932,14 @@ button {
left: 0; left: 0;
right: 0; right: 0;
} }
.autocomplete-items div { .autocomplete-list div {
padding: 10px; padding: 10px;
cursor: pointer; cursor: pointer;
background-color: #fff; background-color: #fff;
border-bottom: 1px solid #6e7e6b; border-bottom: 1px solid #6e7e6b;
text-align: left; text-align: left;
} }
.autocomplete-items div:hover { .autocomplete-list div:hover {
background-color: #e9e9e9; background-color: #e9e9e9;
} }
.autocomplete-active { .autocomplete-active {

View File

@@ -16,12 +16,14 @@
{{#each data.splitTechniquesList as |list technique|}} {{#each data.splitTechniquesList as |list technique|}}
<fieldset class="section-header flexrow"> <fieldset class="section-header flexrow">
<legend class="technique-controls"> <legend class="technique-controls">
{{localize (localize 'l5r5e.techniques.{technique}' technique=technique)}} <span class="technique-controls toggle-on-click" data-toggle="toggle-technique-category-{{technique}}">
{{localize (localize 'l5r5e.techniques.{technique}' technique=technique)}}
</span>
{{#ifCond ../data.editable_not_soft_locked '&&' (lookup ../data.data.techniques technique)}} {{#ifCond ../data.editable_not_soft_locked '&&' (lookup ../data.data.techniques technique)}}
<a data-item-type="technique" class="technique-control item-add" data-tech-type="{{technique}}" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a> <a data-item-type="technique" class="technique-control item-add" data-tech-type="{{technique}}" title="{{localize 'l5r5e.global.add'}}"><i class="fas fa-plus"></i></a>
{{/ifCond}} {{/ifCond}}
</legend> </legend>
<ul class="item-list"> <ul class="item-list toggle-technique-category-{{technique}} {{#ifCond ../data.storeInfos 'includes' (concat 'toggle-technique-category-' technique)}}toggle-hidden{{/ifCond}}">
{{#each list as |item id|}} {{#each list as |item id|}}
{{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item editable=../../data.editable_not_soft_locked}} {{> 'systems/l5r5e/templates/items/technique/technique-entry.html' technique=item editable=../../data.editable_not_soft_locked}}
{{/each}} {{/each}}