Index

Widget

MMO.elements · 1 symbol · generated 30 Sep 2026

mixin

Widget

Widget.js:22

Widget WARNING: It is a class mixin. Meaning you extend it with a parameter

class MMO.elements.Widget extends MMO.elements.CustomShadowElement(ClassElement)
Namespace
MMO.elements
Extends
CustomShadowElement(ClassElement)
A shadow custom element that loads a collection from the framework's repository API and exposes it to the view as two maps: - `data`: the fetched entities, indexed by uid - `fields`: one descriptor per schema property (title, order, hidden, readonly, width, ...), sorted with the schema's own property order. `MMO.elements.Widget#updateFields` NOTE: `MMO.elements.CustomAPIElement` covers the same ground with a plain MMO.core.APIRequester and is the one to reach for in new code. This mixin is kept for the field-descriptor machinery, which CustomAPIElement does not provide.
class T extends MMO.elements.Widget(HTMLElement) {..}

Index

url accessorPoint the widget at a collection; it loads as soon as the element becomes visible.
limit accessorNumber of entities to request per page.
meta readonly accessorMeta block of the last response ({data: {total, class}, page: {offset, index, total}}), or null when nothing has been loaded yet.
fields accessorOne descriptor per schema property: title, order, hidden, readonly, width, icon...
data accessorThe entities of the last load, indexed by uid.
readonly accessor
constructor()
setSchema(schema)Attach the schema describing the loaded entities, resolving an instanceOf schema to the concrete one, then rebuild the field descriptors.
load(url)Fetch a collection and publish it as data, rebuilding fields from the response schema.
reload()Re-fetch the url that was last loaded.
updateFields()Rebuild fields from the schema's properties, merging into the descriptors already there so a manual override survives a reload.
showAllFields()Un-hide every field.

Properties6

url

accessorWidget.js:33

Point the widget at a collection; it loads as soon as the element becomes visible.

get url() set url(value)

limit

accessorWidget.js:49

Number of entities to request per page.

get limit() set limit(value)
Type
number

meta

readonlyaccessorWidget.js:65

Meta block of the last response ({data: {total, class}, page: {offset, index, total}}), or null when nothing has been loaded yet.

get meta()
Type
?Object

fields

accessorWidget.js:73

One descriptor per schema property: title, order, hidden, readonly, width, icon...

get fields() set fields(value)
Type
MMO.core.Map

readonly

accessorWidget.js:210
get readonly() set readonly(value)
Type
boolean

Methods6

setSchema(schema)

Widget.js:105

Attach the schema describing the loaded entities, resolving an instanceOf schema to the concrete one, then rebuild the field descriptors.

setSchema(schema)
schemaMMO.schemas.Schema | Object | Promise
returnsPromise<MMO.schemas.Schema>

load(url)

Widget.js:123

Fetch a collection and publish it as data, rebuilding fields from the response schema.

load(url)
urlstringthe collection's url; pagination is appended unless already present
returnsPromise<void>

reload()

Widget.js:145

Re-fetch the url that was last loaded.

reload()
returnsPromise<void>

updateFields()

Widget.js:158

Rebuild fields from the schema's properties, merging into the descriptors already there so a manual override survives a reload. Dispatches schemaChange.

updateFields()
returnsPromise<MMO.schemas.Schema>