Lion Logo Lion Fundamentals Guides Components Blog Toggle darkmode

Fieldset: API Table

class: LionFieldset, lion-fieldset

Fields

NamePrivacyTypeDefaultDescriptionInherited From
_isFormOrFieldsetprotectedbooleantrueFlag that determines how ".formElements" should behave. For a regular fieldset (see LionFieldset) we expect ".formElements" to be accessible as an object. In case of a radio-group, a checkbox-group or a select/listbox, it should act like an array (see ChoiceGroupMixin). Usually, when false, we deal with a choice-group (radio-group, checkbox-group, (multi)select)FormRegistrarMixin
_repropagationRolepublic'child'|'choice-group'|'fieldset''fieldset'Based on the role, details of handling model-value-changed repropagation differ.FormControlMixin
_inputNodeprotectedThe host element with role group (or radio-group or form) containing necessary aria attributesFormControlMixin
modelValuepublicObject keyed by formElements names, containing formElements' modelValuesFormControlMixin
serializedValuepublicObject keyed by formElements names, containing formElements' serializedValuesFormGroupMixin
formattedValuepublicObject keyed by formElements names, containing formElements' formattedValuesFormGroupMixin
prefilledpublicbooleanTrue when all of the children are prefilled (see InteractionStateMixin for more details.)FormGroupMixin
_initialModelValueprotectedGathers initial model values of all children. Used when resetGroup() is called.FormGroupMixin
valuepublicstring''FormGroupMixin
disabledpublicbooleanfalseDisables all formElements in groupDisabledMixin
submittedpublicbooleanfalseTrue when parent form is submittedFormGroupMixin
dirtypublicbooleanfalseTrue when any of the children is dirty (see InteractionStateMixin for more details.)FormGroupMixin
touchedpublicbooleanfalseTrue when the group as a whole is blurred (see InteractionStateMixin for more details.)FormGroupMixin
focusedpublicbooleanfalseTrue when any of the children is focused.FormGroupMixin
defaultValidatorspublicValidator[][new FormElementsHaveNoError()]Used by Subclassers to add default Validators to a particular FormControl. A date input for instance, always needs the isDate validator.ValidateMixin
__descriptionElementsInParentChainprotectednew Set()FormGroupMixin
__pendingValuesprotected{modelValue?:{[key:string]: any}, serializedValue?:{[key:string]: any}}{ modelValue: {}, serializedValue: {} }FormGroupMixin
formElementspublicFormControlsCollectionnew FormControlsCollection()Closely mimics the natively supported HTMLFormControlsCollection. It can be accessed both like an array and an object (based on control/element names).FormRegistrarMixin
initCompletepublicPromise<any>new Promise((resolve, reject) => { this.__resolveInitComplete = resolve; this.__rejectInitComplete = reject; })initComplete resolves after all pending initialization logic (for instance `<form-group .serializedValue=$>`) is executedFormRegistrarMixin
registrationCompletepublicPromise<any> & {done?:boolean}new Promise((resolve, reject) => { this.__resolveRegistrationComplete = resolve; this.__rejectRegistrationComplete = reject; })registrationComplete waits for all children formElements to have registeredFormRegistrarMixin
donepublicbooleanfalseFormRegistrarMixin
labelpublicstring''The label text for the input node. When no value is defined, textContent of [slot=label] will be usedFormControlMixin
helpTextpublicstring''The helpt text for the input node. When no value is defined, textContent of [slot=help-text] will be usedFormControlMixin
fieldNamepublicstringWill be used in validation messages to refer to the current fieldFormControlMixin
_labelNodeprotectedElement where label will be rendered toFormControlMixin
_helpTextNodeprotectedElement where help text will be rendered toFormControlMixin
_feedbackNodeprotectedElement where validation feedback will be rendered toFormControlMixin
readOnlypublicbooleanfalseA Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input. The difference between disabled and readonly is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)FormControlMixin
labelSrOnlypublicbooleanfalseThe label will only be visible for srceen readers when trueFormControlMixin
_inputIdprotectedstringUnique id that can be used in all light domFormControlMixin
_ariaLabelledNodespublicHTMLElement[][]Contains all elements that should end up in aria-labelledby of `._inputNode`FormControlMixin
_ariaDescribedNodespublicHTMLElement[][]Contains all elements that should end up in aria-describedby of `._inputNode`FormControlMixin
_isRepropagationEndpointpublicbooleanfalseBy default, a field with _repropagationRole 'choice-group' will act as an 'endpoint'. This means it will be considered as an individual field: for a select, individual options will not be part of the formPath. They will. Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise' (from Application Developer perspective) need to be more like fields (think of an amount-input with a currency select box next to it), can set this to true to hide private internals in the formPath.FormControlMixin
operationModepublicOperationModeTypes of input interaction of the FormControl (for instance 'enter'|'select'|'upload')ValidateMixin
_allValidatorsprotectedValidator[]Combination of validators provided by Application Developer and the default validatorsValidateMixin
_feedbackConditionMetaprotectedAllows Subclassers to add meta info for feedbackConditionValidateMixin
hasFeedbackForpublicValidationType[][]As soon as validation happens (after modelValue/validators/validator param change), this array is updated with the active ValidationTypes ('error'|'warning'|'success'|'info' etc.). Notice the difference with `.showsFeedbackFor`, which filters `.hasFeedbackFor` based on `.feedbackCondition()`. For styling purposes, will be reflected to [has-feedback-for="error warning"]. This can be useful for subtle visual feedback on keyup, like a red/green border around an input.ValidateMixin
showsFeedbackForpublicValidationType[][]Based on outcome of feedbackCondition, this array decides what ValidationTypes should be shown in validationFeedback, based on meta data like interaction states. For styling purposes, it reflects it `[shows-feedback-for="error warning"]`ValidateMixin
validationStatespublicValidationStates{}The outcome of a validation 'round'. Keyed by ValidationType and Validator nameValidateMixin
isPendingpublicbooleanfalseFlag indicating whether async validation is pending. Creates attribute [is-pending] as a styling hookValidateMixin
validatorspublicValidator[][]Used by Application Developers to add Validators to a FormControl.ValidateMixin
_visibleMessagesAmountprotectednumber1The amount of feedback messages that will visible in LionValidationFeedbackValidateMixin
_requestedToBeDisabledprotectedbooleanfalseDisabledMixin

Methods

NamePrivacyDescriptionParametersReturnInherited From
__initInteractionStatesprotectedFormGroupMixin
_triggerInitialModelValueChangedEventprotectedFormControlMixin
__setupOutsideClickHandlingprotectedFormGroupMixin
_checkForOutsideClickprotectedevent: EventFormGroupMixin
__requestChildrenToBeDisabledprotectedFormGroupMixin
__retractRequestChildrenToBeDisabledprotectedFormGroupMixin
_inputGroupTemplateprotectedTemplateResultFormControlMixin
submitGrouppublicHandles interaction state 'submitted'. This allows children to enable visibility of validation feedbackFormGroupMixin
resetGrouppublicResets to initial/prefilled values and interaction states of all FormControls in group,FormGroupMixin
clearGrouppublicClears all values and resets all interaction states of all FormControls in group,FormGroupMixin
resetInteractionStatepublicResets all interaction states for all formElementsFormGroupMixin
_getFromAllFormElementsFilterprotectedA filter function which will exclude a form field when returning false By default, exclude form fields which are disabled The type is be passed as well for more fine grained control, e.g. distinguish the filter when fetching modelValue versus serializedValueel: FormControl, type: stringbooleanFormGroupMixin
_getFromAllFormElementsprotectedGets a keyed be name object for requested property (like modelValue/serializedValue)property: string, filterFn: (el: FormControl, property?: string) => boolean{[name:string]: any}FormGroupMixin
_setValueForAllFormElementsprotectedSets the same value for requested property in all formElementsproperty: string | number, value: anyFormGroupMixin
_setValueMapForAllFormElementsprotectedAllows to set formElements values via a keyed object structureproperty: string, values: { [x: string]: any; }FormGroupMixin
_anyFormElementHasprotectedReturns true when one of the formElements has requestedproperty: stringFormGroupMixin
_anyFormElementHasFeedbackForprotectedstate: stringFormGroupMixin
_everyFormElementHasprotectedReturns true when all of the formElements have requested propertyproperty: stringFormGroupMixin
__onChildValidatePerformedprotectedGets triggered by event 'validate-performed' which enabled us to handle 2 different situations - react on modelValue change, which says something about the validity as a whole (at least two checkboxes for instance) and nothing about the children's values - children validity states have changed, so fieldset needs to update itself based on thatev: EventFormGroupMixin
_syncFocusedprotectedFormGroupMixin
_onFocusOutprotectedev: EventFormGroupMixin
_syncDirtyprotectedFormGroupMixin
__storeAllDescriptionElementsInParentChainprotectedTraverses the _parentFormGroup tree, and gathers all aria description elements (feedback) that should be provided to children. In the example below, when the input for 'street' has focus, a screenreader user would hear the #group-error. In case one of the inputs was in error state as well, the SR user would first hear the local error, followed by #group-errorFormGroupMixin
__linkParentMessagesprotectedchild: FormControlFormGroupMixin
__unlinkParentMessagesprotectedchild: FormControlFormGroupMixin
addFormElementpublicchild: FormControl & {serializedValue:string|object}, indexToInsertAt: numberFormRegistrarMixin
removeFormElementpublicel: FormRegisteringHost & FormControlFormRegistrarMixin
_isEmptyprotectedUsed for Required validation and computation of interaction statesmodelValue: anybooleanFormControlMixin
_completeRegistrationprotectedResolves the registrationComplete promise. Subclassers can delay if neededFormRegistrarMixin
isRegisteredFormElementpublicel: ElementWithParentFormGroupFormRegistrarMixin
_onRequestToAddFormElementprotectedHook for Subclassers to perform logic before an element is addedev: CustomEventFormRegistrarMixin
_onRequestToChangeFormElementNameprotectedev: CustomEventFormRegistrarMixin
_onRequestToRemoveFormElementprotectedev: CustomEventFormRegistrarMixin
_enhanceLightDomClassesprotectedFormControlMixin
_enhanceLightDomA11yprotectedFormControlMixin
_enhanceLightDomA11yForAdditionalSlotsprotectedEnhances additional slots(prefix, suffix, before, after) defined by developer. When boolean attribute data-label or data-description is found, the slot element will be connected to the input via aria-labelledby or aria-describedbyadditionalSlots: string[]FormControlMixin
__reflectAriaAttrprotectedWill handle help text, validation feedback and character counter, prefix/suffix/before/after (if they contain data-description flag attr). Also, contents of id references that will be put in the <lion-field>._ariaDescribedby property from an external context, will be read by a screen reader.attrName: string, nodes: Element[], reorder: boolean|undefinedFormControlMixin
_groupOneTemplateprotectedTemplateResultFormControlMixin
_groupTwoTemplateprotectedTemplateResultFormControlMixin
_labelTemplateprotectedTemplateResultFormControlMixin
_helpTextTemplateprotectedTemplateResultFormControlMixin
_inputGroupBeforeTemplateprotectedTemplateResultFormControlMixin
_inputGroupPrefixTemplateprotectedTemplateResult | nothingFormControlMixin
_inputGroupInputTemplateprotectedTemplateResultFormControlMixin
_inputGroupSuffixTemplateprotectedTemplateResult | nothingFormControlMixin
_inputGroupAfterTemplateprotectedTemplateResultFormControlMixin
_feedbackTemplateprotectedTemplateResultFormControlMixin
_getAriaDescriptionElementsprotectedThis function exposes descripion elements that a FormGroup should expose to its children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()Array.<HTMLElement>FormControlMixin
addToAriaLabelledBypublicAllows to add extra element references to aria-labelledby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}FormControlMixin
removeFromAriaLabelledBypublicAllows to remove element references from aria-labelledby attribute.element: HTMLElementFormControlMixin
addToAriaDescribedBypublicAllows to add element references to aria-describedby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}FormControlMixin
removeFromAriaDescribedBypublicAllows to remove element references from aria-describedby attribute.element: HTMLElementFormControlMixin
__getDirectSlotChildprotectedslotName: stringHTMLElement | undefinedFormControlMixin
_dispatchInitialModelValueChangedEventprotectedFormControlMixin
_onBeforeRepropagateChildrenValuesprotectedHook for Subclassers to add logic before repropagationev: CustomEventFormControlMixin
__repropagateChildrenValuesprotectedev: CustomEventFormControlMixin
_repropagationConditionprotectedBased on provided target, this condition determines whether received model-value-changed event should be repropagatedtarget: FormControlHostFormControlMixin
_onLabelClickprotectedFormControlMixin
updateSyncpublicname: string, oldValue: ?ValidateMixin
validatepublicTriggered by: - modelValue change - change in the 'validators' array - change in the config of an individual Validator Three situations are handled: - a1) the FormControl is empty: further execution is halted. When the Required Validator (being mutually exclusive to the other Validators) is applied, it will end up in the validation result (as the only Validator, since further execution was halted). - a2) there are synchronous Validators: this is the most common flow. When modelValue hasn't changed since last async results were generated, 'sync results' are merged with the 'async results'. - a3) there are asynchronous Validators: for instance when server side evaluation is needed. Executions are scheduled and awaited and the 'async results' are merged with the 'sync results'. - b) there are MetaValidators. After steps a1, a2, or a3 are finished, the holistic MetaValidators (evaluating the total result of the 'regular' (a1, a2 and a3) validators) will be run... Situations a2 and a3 are not mutually exclusive and can be triggered within one `validate()` call. Situation b will occur after every call.{ clearCurrentResult = false }, opts: { clearCurrentResult?: boolean }ValidateMixin
__executeValidatorsprotectedValidateMixin
_onValidatorUpdatedprotectede: Event|CustomEventValidateMixin
_updateFeedbackComponentprotectedResponsible for retrieving messages from Validators and (delegation of) rendering them. For `._feedbackNode` (extension of LionValidationFeedback): - retrieve messages from highest prio Validators - provide the result to custom feedback node and let the custom node decide on their renderings In both cases: - we compute the 'show' flag (like 'hasErrorVisible') for all types - we set the customValidity message of the highest prio Validator - we set aria-invalid="true" in case hasErrorVisible is trueValidateMixin
_showFeedbackConditionForprotectedDefault feedbackCondition condition, used by Subclassers, that will be used when `feedbackCondition()` is not overridden by Application Developer. Show the validity feedback when returning true, don't show when falsetype: string, meta: objectValidateMixin
feedbackConditionpublicAllows the Application Developer to specify when a feedback message should be showntype: string, meta: object, currentCondition: ((type: string, meta: object) => boolean)booleanValidateMixin
_hasFeedbackVisibleForprotectedUsed to translate `.hasFeedbackFor` and `.shouldShowFeedbackFor` to `.showsFeedbackFor`type: stringValidateMixin
_updateShouldShowFeedbackForprotectedValidateMixin
_prioritizeAndFilterFeedbackprotectedOrders all active validators in this.__validationResult. Can also filter out occurrences (based on interaction states){ validationResult }, opts: { validationResult: Validator[] }Validator[]ValidateMixin
makeRequestToBeDisabledpublicDisabledMixin
retractRequestToBeDisabledpublicDisabledMixin

Events

NameTypeDescriptionInherited From
form-element-name-changedCustomEventFormControlMixin
model-value-changedCustomEventFormControlMixin
showsFeedbackForChangedEventValidateMixin
EventValidateMixin
shouldShowFeedbackForChangedEventValidateMixin
validate-performedEventprivate event that should be listened to by LionFieldSetValidateMixin

Attributes

NameFieldInherited From
submittedsubmittedFormGroupMixin
focusedfocusedFormGroupMixin
dirtydirtyFormGroupMixin
touchedtouchedFormGroupMixin
prefilledprefilledFormGroupMixin
_isFormOrFieldset_isFormOrFieldsetFormRegistrarMixin
readonlyreadOnlyFormControlMixin
labellabelFormControlMixin
label-sr-onlylabelSrOnlyFormControlMixin
help-texthelpTextFormControlMixin
shows-feedback-forshowsFeedbackForValidateMixin
is-pendingisPendingValidateMixin
disableddisabledDisabledMixin