RC-90 | Add support for bar-input controls in item sheets
This commit is contained in:
parent
8d92040230
commit
5c78523791
12 changed files with 140 additions and 13 deletions
36
module/handlebarHelpers/inputs/barInput.mjs
Normal file
36
module/handlebarHelpers/inputs/barInput.mjs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
export function barInput(input, data) {
|
||||
const label = localizer(input.label);
|
||||
|
||||
// Trying to do limited bar info is... annoying to do.
|
||||
if (data.meta.limited && input.limited) {
|
||||
return ``;
|
||||
};
|
||||
|
||||
return `<div data-input-type="bar">
|
||||
<span class="label" aria-hidden="true">
|
||||
${label}
|
||||
</span>
|
||||
<div class="pill-bar">
|
||||
<input
|
||||
type="number"
|
||||
aria-label="${localizer(input.value.label)}"
|
||||
${data.meta.editable ? `` : `disabled`}
|
||||
name="${input.value.path}"
|
||||
value="${input.value.value}"
|
||||
min="${input.value.min ?? ``}"
|
||||
max="${input.value.max ?? ``}"
|
||||
>
|
||||
<input
|
||||
type="number"
|
||||
aria-label="${localizer(input.max.label)}"
|
||||
${data.meta.editable ? `` : `disabled`}
|
||||
name="${input.max.path}"
|
||||
value="${input.max.value}"
|
||||
min="${input.max.min ?? ``}"
|
||||
max="${input.max.max ?? ``}"
|
||||
>
|
||||
</div>
|
||||
</div>`;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue