Added some translations stuff.
Better migration check and now triggering. Minors refactors.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user