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