Container - guiled/LRE GitHub Wiki

Container

Introduction

When you get a container with sheet.get() you will have a Container object that have few improvements

hide

In Let's Role, doing this code sheet.get("container").hide() or sheet.get("container").addClass("d-none") don't work., You always have to handle the class d-flex that prevent d-none to work by coding things like sheet.get("container").addClass("d-none").removeClass("d-flex").

LRE will do it for you. sheet.get("container").addClass("d-none") can simply work.

concept to know : children

Let's role doesn't provide any method to list the children of a component. As soon as you use container.find() or container.value(data) LRE will register the found components as children.

find

container.find(id:string): Component | null

Like the vanilla method, this method searches for a component based on its id but can return null if there is no child with this it. Every found component is added to the container children list.

value

container.value(): ContainerData container.value(newValues: ContainerData): void

If called with no parameters, this method returns an object of the known children data. If the value() method is called with a parameter, the given values will be assigned to the corresponding component. Any new children is added to the container children list.

ContainerData is an object which keys are children id and values are the children value.