furo-ui5-select-labeled

furo-ui5-select-labeled #

@furo/ui5 v1.18.0
import '@furo/ui5/src/furo-ui5-select-labeled.js';
exports FuroUi5SelectLabeled js
exports <furo-ui5-select-labeled> custom-element-definition
superclass LitElement
mixes FBP

Summary: labeled select

Description #

furo-ui5-select-labeled The furo-ui5-select-labeled is a composition to easily use a complete data select with label according to the design specification of SAP Fiori Design System.

Example with options from specs #

A simple way to use the segmented button is, uising it with specified options for a string type.

Defining a type with the options may look like a big overhead, but it let you switch the UI implementation by just changing the tag name.

The labels in the demo are not translated for better readability.

Markup #

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<furo-ui5-select-labeled
  label="Use with select"
  value-state="Success"
  fn-bind-data="--daoPerson(*.sex)"></furo-ui5-select-labeled>
<furo-ui5-select-labeled
  label="Use with select"
  value-state="Success"
  fn-bind-data="--daoPerson(*.sex)"></furo-ui5-select-labeled>
<furo-ui5-text-input-labeled
  label="use with text-input"
  value-state="Success" fn-bind-data="--daoPerson(*.sex)"></furo-ui5-text-input-labeled>

Type definition #

look at fields.sex.meta.options.list

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Person
type: Person
description: Person message type
lifecycle: null
__proto:
  package: person
  targetfile: person.proto
  imports:
    - google/protobuf/field_mask.proto
  options:
    go_package: github.com/eclipse/eclipsefuro-web/furo-specs/dist/pb/person;personpb
    java_multiple_files: "true"
    java_outer_classname: PersonProto
    java_package: com.example.tutorial.person
fields:
  sex:
    type: string
    description: sex
    __proto:
      number: 8
    __ui: null
    meta:
      default: female
      placeholder: ""
      hint: ""
      label: sex
      options:
        flags: []
        list: # set the default options
          - '@type': type.googleapis.com/furo.Optionitem
            display_name: person.type.sex.unknown.label
            id: unknown
            selected: false
          - '@type': type.googleapis.com/furo.Optionitem
            display_name: person.type.sex.female.label
            id: female
            selected: true
          - '@type': type.googleapis.com/furo.Optionitem
            display_name: person.type.sex.male.label
            id: male
            selected: false
      readonly: false
      repeated: false
      typespecific: null
    constraints: {}
    

Example with bindOptions #

Set the id of the selected optioin to a value which is not in the list and press load options again.

Markup #

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<furo-ui5-select-labeled
  label="by display_name"
  value-field-path="data.id"
  id-field-path="data.id"
  display-field-path="data.display_name"
  fn-bind-options="--collection(*.entities)"
  fn-bind-data="--entity(*.owner.id)"></furo-ui5-select-labeled>
<furo-ui5-select-labeled
  label="by first_name"
  value-field-path="data.id"
  id-field-path="data.id"
  display-field-path="data.first_name"
  fn-bind-options="--collection(*.entities)"
  fn-bind-data="--entity(*.owner.id)"></furo-ui5-select-labeled>
<furo-ui5-select-labeled
  label="by phone_nr"
  value-field-path="data.id"
  id-field-path="data.id"
  display-field-path="data.phone_nr"
  fn-bind-options="--collection(*.entities)"
  fn-bind-data="--entity(*.owner.id)"></furo-ui5-select-labeled>
<furo-ui5-number-input-labeled
  label="Selected option"
  fn-bind-data="--entity(*.owner.id)"></furo-ui5-number-input-labeled>
</furo-form-layouter>
<!-- this data object contains the list -->
<furo-data-object
  type="person.PersonCollection"
  @-object-ready="--collection"
  fn-inject-raw="--response"></furo-data-object>
<!-- this data object contains the field, you want to update -->
<furo-data-object
  type="task.Task"
  @-object-ready="--entity"></furo-data-object>

Attributes and Properties #

label #

label string default: ''

the label for the data-number-input

idFieldPath #

id-field-path string default: 'id'

Defines the field path that is used from the injected RepeaterNode to identify the option items. Point-separated path to the field E.g. data.partner.ulid

valueFieldPath #

value-field-path string default: 'id'

Defines the field path that is used to update the bound component if the user has selected an option. Point-separated path to the field Must be set if a data binding is specified.

displayFieldPath #

display-field-path string default: 'display_name'

Defines the field path that is used from the injected RepeaterNode to display the option items. Point-separated path to the field E.g. data.partner.display_name

full #

full boolean

This is only used to forward the state to the form-field-container

required #

required Boolean

A Boolean attribute which, if present, means this field is required and marked with *.

disabled #

disabled Boolean

A Boolean attribute which, if present, means this field cannot be edited by the user and appears in disabled state.

readonly #

readonly Boolean

A Boolean attribute which, if present, means this field is readonly.

Events #

furo-value-changed #

at-furo-value-changedString

Fires the field value when it changes.

Methods #

focus #

focus(options Object ) ⟹ void

Object fn-focus

Focuses the underlying ui5 input element

setOptions #

setOptions(arr *rawJson* ) ⟹ boolean

fn-set-options

inject raw data as options

  • arr
  • rawJson raw data array with a id, display_name signature

bindData #

bindData(fieldNode FieldNode ) ⟹ void

FieldNode fn-bind-data

Orchestrates the data field connection to the inside

  • fieldNode

bindOptions #

bindOptions(repeaterNode `` ) ⟹ void

`` fn-bind-options

Binds a repeaterNode to the furo-ui5-select component

  • repeaterNode

Slots #

valueStateMessage #

Type: HTMLElement

defines the value state message that will be displayed as pop up under the input element.