Add number inputs into the supported structures, and redesign the sheet to make it actually look good
This commit is contained in:
parent
5aee7e4a29
commit
fb52e1b58d
11 changed files with 161 additions and 48 deletions
35
module/handlebarHelpers/inputs/numberInput.mjs
Normal file
35
module/handlebarHelpers/inputs/numberInput.mjs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
const { randomID } = foundry.utils;
|
||||
|
||||
export function numberInput(input, data) {
|
||||
const label = localizer(input.label);
|
||||
const id = `${data.meta.idp}-${randomID(10)}`;
|
||||
|
||||
if (!data.meta.editable) {
|
||||
return `<div data-input-type="integer">
|
||||
<span class="label">${label}</span>
|
||||
<span class="value">${data.meta.limited ? `???` : input.value}</span>
|
||||
</div>`;
|
||||
};
|
||||
|
||||
let attrs = ``;
|
||||
if (input.min) { attrs += ` min="${input.min}"` };
|
||||
if (input.max) { attrs += ` max="${input.max}"` };
|
||||
if (input.step) { attrs += `step="${input.step}"` };
|
||||
|
||||
return `<div data-input-type="integer">
|
||||
<label
|
||||
for="${id}"
|
||||
>
|
||||
${label}
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
id="${id}"
|
||||
value="${input.value}"
|
||||
name="${input.path}"
|
||||
${attrs}
|
||||
/>
|
||||
</div>`;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue