-
Notifications
You must be signed in to change notification settings - Fork 137
Platform: Select Component Technical Design
The Select component is an input element, where the user can select a value from a list.
<fdp-select
[id]="'myid'"
[btnType]='default|noborder|regular'
[glyph]='filter'
[compact]='true|false'
[(ngModel)]="selectedvalue"
[disabled]='true|false'
[maxHeight]="'250px'"
[placeholder]="'Placeholder'"
[options]="options">
</fdp-select>
<fdp-select>
<fdp-option [value]="'apple'">Apple</fdp-option>
<fdp-option [value]="'banana'">Banana</fdp-option>
<fdp-option [value]="'orange'">Orange</fdp-option>
</fdp-select>The Select component requires a list of options for the user to choose from. The options can either be provided via property binding to the list property, or via content projection using the fdp-option component.
The ID for the element.
The "btnType" property allows the user to set the type of select button from the 3 options available.
The "glyph" property accepts a strings as input, and uses these values to populate the type of icon which is dynamically defined.
The "compact" property accepts a boolean as input, property set the select box to compact size.
List of strings or SelectItem objects to populate the options displayed for select. See https://github.com/SAP/fundamental-ngx/wiki/Platform:-CheckboxGroup-Technical-Design#1-render-selection-based-on-data-list
The "maxHeight" property sets the vertical height of the search input component. The size. can be configured according to the user preference.
This is an optional field. when in default it takes 250px as height.
The "disabled" property is an bolean which are used to disable or enable the select dropdown for selection.
If the "disabled" property is set, then the select button and dropdown menu will be disabled by default the select box will be enabled.
The "isOpenChangeHandle" event binding emits an event with a Select payload, whenever the user clicks on the select dropwon isopen value is changed to true and reset the value after the option is clicked.
Options for the Select component can be provided by inserting a series of fdp-option components. See https://github.com/SAP/fundamental-ngx/wiki/Platform:-CheckboxGroup-Technical-Design#2-selection-based-on-custom-option
Link to general support for i18n: Supporting internationalization in ngx/platform
Special Usecase: Yes
noSelectionString is being used in the platform implementation which can have a default value(although not present now). This default value needs to be translated as part of lib.
-
placeholdercan be supported with string binding:
<fdp-select
[id]="'myid'"
[btnType]='default|noborder|regular'
[glyph]='filter'
[compact]='true|false'
[(ngModel)]="selectedvalue"
[disabled]='true|false'
[maxHeight]="'250px'"
i18n-placeholder="@@placeholderText"
placeholder="Placeholder"
[options]="options">
</fdp-select>Redesign Required: Yes
fdp-option handles action items and overflow declaratively, so no changes are needed as per spec. But, it seems from platform existing implementation, fdp-option is not used/present. If it is not present or was decided to not have it, then redesign is needed as we need fdp-option to support i18n.
As this is an input control it needs to implement the FormFieldControl as described in the FormGroup Layout or extend existing BaseInputComponent
Frank:
-
What is button Type binding?
-
Since the
ngForwith option items will be hidden inside we need to emit selection event -
Dropdown (selects) usually needs to support no-option support, where you either have only list of option to pick from or also some
--empty value -
Select usually represent single selection of a few options, what about multiselection? How are we going to handle those ?
-
I would support event emitting not only on selection but also on opening/closing
-
Also support programatic approach like
coremake sure we have the methods close/open - simple toggle -
Why do we need to set
maxHeightheigh must stay- we should have a
scrollHeightthat tells how the overlay is high when you should scrolling
- we should have a
-
You should not call
isOpenChangeHandle- thehandleis usually the one who is handling this event- For this you want more
openedChange: EventEmitter<boolean>
- For this you want more
-
just like with the other controls we dont need to say
[compact]='true|falseas this does not scale for hte future as we have only 2 sizes, let's have bindingsizewith two sizes -
Let's think about
zIndexsometimes we show inputs fields inside some context where has already hight zIndex and shown overlay might be hidden