framework/element: Add element's SELECTED, MULTIPLE, REQUIRED attributes handling
... just like CHECKED and DISABLED
Consider adding SingleSelection component example based on <select> .
take on a job
@f3d0t thank you. Just please wait for a while. I gonna fix other issues. Will let you know when you are all green for this
@f3d0t we're all green to go.
Updated 2021-05-19 08:54 EEST
Please do the following:
- Work on styled-checkbox branch
- Create a demo component based on
selecttag. The component will receive the following props:
-
Minimal (sufficient to test item 3):
-
isMultiple: optional, boolean, default is false; ; shouldn't be rendered if false -
isRequired: optional, boolean, default is false; shouldn't be rendered if null -
options: array, where index is used as an option id (optionvalueattribute) and array element itself as an option UI representation visible to a user; -
selectedOption: option value (string), default is null -
onChange: optional, function that expects selected option id (value) as an argument
-
-
Extended:
-
label: optional, string, default is null; should not be rendered if null -
name: optional, string, default is null; shouldn't be rendered if null -
size: optional, number, default is 0
-
-
Advanced:
-
optionsis an array of option objects (see advanced option object spec below)
-
- Patch
createElementto handleSELECTEDandMULTIPLEattributes properly
Items 2 & 3 must be individual commits, so that item 3 could be cherry-picked elsewhere
Advanced Option Object Spec
Each option object has the following properties:
-
value: string; used as text iflabelproperty is not defined or falsy, or as optgroup label if object hasoptionsproperty defined -
label: optional, string; if not defined or null or undefined thenvalueis used as an option UI representation visible to a user; ignored when the object represents an optgroup -
options: optional, array of option objects; if defined then current object is used to render an optgroup
Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select
Let me know if you want to take on the minimal, extended or advanced implementation. Those can be done at the next iterations or skipped completely.
Feel free asking anything
Resolving by pull request #41 Add handling of 'disabled' attribute to Select option object