Make it so that item sheet rerenders maintain focus on what you were editing
This commit is contained in:
parent
db5dfc3234
commit
afc8278ffc
6 changed files with 16 additions and 13 deletions
|
|
@ -48,6 +48,7 @@ export class ArmourData extends foundry.abstract.TypeDataModel {
|
|||
getFormFields(ctx) {
|
||||
const fields = [
|
||||
{
|
||||
id: `location`,
|
||||
type: `string-set`,
|
||||
label: `RipCrypt.common.location`,
|
||||
placeholder: `RipCrypt.Apps.location-placeholder`,
|
||||
|
|
@ -55,6 +56,7 @@ export class ArmourData extends foundry.abstract.TypeDataModel {
|
|||
value: this.locationString,
|
||||
},
|
||||
{
|
||||
id: `protection`,
|
||||
type: `integer`,
|
||||
label: `RipCrypt.common.protection`,
|
||||
value: this.protection,
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
getFormFields(ctx) {
|
||||
const fields = [
|
||||
{
|
||||
id: `traits`,
|
||||
type: `string-set`,
|
||||
label: `RipCrypt.common.traits`,
|
||||
placeholder: `RipCrypt.Apps.traits-placeholder`,
|
||||
|
|
@ -67,6 +68,7 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
value: this.traitString,
|
||||
},
|
||||
{
|
||||
id: `short-range`,
|
||||
type: `integer`,
|
||||
label: `RipCrypt.Apps.short-range`,
|
||||
path: `system.range.short`,
|
||||
|
|
@ -74,6 +76,7 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
min: 0,
|
||||
},
|
||||
{
|
||||
id: `long-range`,
|
||||
type: `integer`,
|
||||
label: `RipCrypt.Apps.long-range`,
|
||||
path: `system.range.long`,
|
||||
|
|
@ -81,6 +84,7 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
min: 0,
|
||||
},
|
||||
{
|
||||
id: `damage`,
|
||||
type: `integer`,
|
||||
label: `RipCrypt.common.damage`,
|
||||
path: `system.damage`,
|
||||
|
|
@ -104,6 +108,7 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
},
|
||||
},
|
||||
{
|
||||
id: `access`,
|
||||
type: `dropdown`,
|
||||
label: `Access`,
|
||||
path: `system.access`,
|
||||
|
|
@ -123,7 +128,11 @@ export class WeaponData extends foundry.abstract.TypeDataModel {
|
|||
];
|
||||
|
||||
if (this.parent.isEmbedded) {
|
||||
fields.push({ type: `boolean`, label: `Equipped` });
|
||||
fields.push({
|
||||
id: `equipped`,
|
||||
type: `boolean`,
|
||||
label: `Equipped`,
|
||||
});
|
||||
};
|
||||
|
||||
return fields;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
const { randomID } = foundry.utils;
|
||||
|
||||
export function booleanInput(input, data) {
|
||||
const label = localizer(input.label);
|
||||
const id = `${data.meta.idp}-${randomID(10)}`;
|
||||
const id = `${data.meta.idp}-${input.id}`;
|
||||
|
||||
if (data.meta.limited) {
|
||||
return `<div data-input-type="boolean">
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
import { options } from "../options.mjs";
|
||||
|
||||
const { randomID } = foundry.utils;
|
||||
|
||||
export function dropdownInput(input, data) {
|
||||
const label = localizer(input.label);
|
||||
const id = `${data.meta.idp}-${randomID(10)}`;
|
||||
const id = `${data.meta.idp}-${input.id}`;
|
||||
|
||||
if (!data.meta.editable) {
|
||||
return `<div data-input-type="dropdown">
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
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)}`;
|
||||
const id = `${data.meta.idp}-${input.id}`;
|
||||
|
||||
if (!data.meta.editable) {
|
||||
return `<div data-input-type="integer">
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
const { randomID } = foundry.utils;
|
||||
|
||||
export function stringSet(input, data) {
|
||||
const label = localizer(input.label);
|
||||
const placeholder = localizer(input.placeholder ?? ``);
|
||||
const id = `${data.meta.idp}-${randomID(10)}`;
|
||||
const id = `${data.meta.idp}-${input.id}`;
|
||||
|
||||
if (!data.meta.editable) {
|
||||
const tagList = input.value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue