furo-hateoas-state

furo-hateoas-state #

@furo/data v2.18.0
import '@furo/data/src/furo-hateoas-state.js';
exports FuroHateoasState js
exports <furo-hateoas-state> custom-element-definition
superclass LitElement
mixes FieldNodeAdapter

summary disables or hide nodes based on hts

furo-hateoas-state is an invisible component with a binding of type furo.Link or injection of a link array.

It disables / enables or hides / shows components according to the injected HATEOAS links. furo-hateoas-state only sets or remove the attributes hidden and disabled on the nodes.

All nodes inside the same parent are taken in to control.

Elements inside a shadow root are not selected.

Set the attribute data-rel=“list” on any element you want to control with furo-hateoas-state.

Set the attribute hide-no-rel if you want to hide the node instead of being disabled.

1
2
3
4
5
6
<div>
  <button data-rel='list'>list</button>
  <button hide-no-rel data-rel='list'>hide no rel</button>
  <button data-rel='add'>add</button>
  <furo-hateoas-state fn-bind-hts='--collection(*.links)'></furo-hateoas-state>
</div>

all elements with a data-rel=“something” attribute inside the div are controlled

Attributes and Properties #

Methods #

enable #

enable() ⟹ void

*fn-enable

Enable or show all nodes.



disable #

disable() ⟹ void

*fn-disable

Disable or hide all nodes.



bindData #

bindData(fieldNode `` ) ⟹ boolean

`` fn-bind-data

Binds a fieldNode. Make sure the type of your field is accepted by the implemented component.

  • fieldNode

bindHts #

bindHts(Links `` ) ⟹ void

`` fn-bind-hts

Bind a RepeaterNode of type furo.Link.

  • Links

injectHts #

injectHts(value [json] ) ⟹ void

[json] fn-inject-hts

Inject a link array directly.

1
2
3
4
5
6
7
8
9
[
  {
    "href": "/mockdata/persons/list",
    "method": "GET",
    "rel": "list",
    "type": "person.PersonCollection",
    "service": "PersonService"
  }
]
  • value Array with raw furo.Link like