Added some translations stuff.

Better migration check and now triggering.
Minors refactors.
This commit is contained in:
Vlyan
2025-02-16 17:52:15 +01:00
parent 4b6a60d7d6
commit f49919b588
44 changed files with 1412 additions and 1357 deletions

View File

@@ -1,9 +1,9 @@
import { HTML_l5r5e_MultiSelectElement } from "../misc/l5r5e-multiselect.js";
import { L5r5eHtmlMultiSelectElement } from "../misc/l5r5e-multiselect.js";
/**
* A subclass of [ArrayField]{@link ArrayField} which supports a set of contained elements.
* Elements in this set are treated as fungible and may be represented in any order or discarded if invalid.
*/
export class l5r5e_SetField extends foundry.data.fields.SetField {
export class L5r5eSetField extends foundry.data.fields.SetField {
// We don't get the options we expect when we convert this to input,
// So store them here
@@ -13,30 +13,30 @@ export class l5r5e_SetField extends foundry.data.fields.SetField {
super(new foundry.data.fields.StringField({
choices: options.options.map((option) => option.value)
}), options, context);
this.#savedOptions = options;
}
/** @override */
initialize(value, model, options={}) {
if ( !value ) return value;
return new Set(super.initialize(value, model, options));
}
/** @override */
toObject(value) {
if ( !value ) return value;
return Array.from(value).map(v => this.element.toObject(v));
}
/* -------------------------------------------- */
/* Form Field Integration */
/* -------------------------------------------- */
/** @override */
_toInput(config) {
const e = this.element;
return HTML_l5r5e_MultiSelectElement.create({
return L5r5eHtmlMultiSelectElement.create({
name: config.name,
options: this.#savedOptions.options,
groups: this.#savedOptions.groups,