Search

Find components, guides, and documentation

Input Amount Dropdown: API Table

class: LionInputAmountDropdown, lion-input-amount-dropdown

Fields

NamePrivacyTypeDefaultDescriptionInherited From
allowedCurrenciespublicCurrencyCode[][]Regions that are allowed to be selected in the dropdown.
currencypublicstring | undefinedundefinedLionInputAmount
currencyLabelpublicstring''LionInputAmount
defaultValidatorspublicarray[new CurrencyAndAmount()]
deserializerpublicdeserializer
formatterpublicformatAmountLionInputAmount
localepublicstring | undefinedundefinedLionInputAmount
modelValuepublicobjectFor a FormControl to function properly, its modelValue, serializedValue and viewValue/formattedValue should always translate in two directions. This is expected by `_callParser` method. It guards for empty viewValues. As the viewValue (`.value`) only concerns the amount part and not the currency part in InputAmountDropdown, this contract is broken. Below, we compensate for this.LionInputAmount
parserpublicparseAmountLionInputAmount
placeholderpublicstring''LionInput
preferredCurrenciespublicCurrencyCode[][]Regions that will be shown on top of the dropdown
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)LionInput
refspublicobject{ /** @type {DropdownRef} */ dropdown: /** @type {DropdownRef} */ (createRef()), }
serializerpublicserializer
slotspublicLionInput
typepublicstring'text'LionInput
_allCurrenciesLabelprotectedstring''Group label for all countries, when preferredCountries are shown
_allowedOrAllCurrenciesprotectedCurrencyCode[]Used for rendering the region/currency list
_currencyDisplayNodeSlotprotectedstring'after'The slot to put the currency display node in. Can be ‘prefix’, ‘suffix’, ‘before’ and ‘after’. Default will be ‘after’.LionInputAmount
_currencyUtilprotectedcurrencyUtil
_dropdownSlotprotected
_feedbackConditionMetaprotectedLionField
_focusableNodeprotectedLionField
_inputNodeprotectedHTMLInputElementLionInput
_langIsoprotectedRegionCode | undefinedundefined
_preferredCurrenciesLabelprotectedstring''Group label for preferred countries, when preferredCountries are shown
_templateDataDropdownprotectedTemplateDataForDropdownInputAmountThis method provides a TemplateData object to be fed to pure template functions, a.k.a. Pure Templates™. The goal is to totally decouple presentation from logic here, so that Subclassers can override all content without having to loose private info contained within the template function that was overridden. Subclassers would need to make sure all the contents of the TemplateData object are implemented by making sure they are coupled to the right ‘ref’ ([data-ref=dropdown] in this example), with the help of lit’s spread operator directive. To enhance this process, the TemplateData object is completely typed. Ideally, this would be enhanced by providing linters that make sure all of their required members are implemented by a Subclasser. When a Subclasser wants to add more data, this can be done via:

Methods

NamePrivacyDescriptionParametersReturnInherited From
clearpublicClears modelValue. Interaction states are not cleared (use resetInteractionState for this)LionField
onLocaleChangedpublicnewLocale: string, oldLocale: stringLionInputAmount
onLocaleUpdatedpublic
resetpublicResets modelValue to initial value. Interaction states are clearedLionField
resetInteractionStatepublicLionField
_connectSlotMixinprotectedUpon connecting slot mixin, we should check if the required slot was created by the slot mixin, and if so, we should execute the currency changed flow which evaluates whether the slot node should be removed for invalid currenciesLionInputAmount
_initModelValueBasedOnDropdownprotected
_isEmptyprotectedUsed for Required validation and computation of interaction states. We only consider the amount part for emptiness checks. Missing, null, empty-string or NaN amount is considered empty.modelValueboolean
_onChangeprotectedDispatches custom bubble eventev: Event=LionField
_onCurrencyChangedprotected{ currency }, opts: @param {string?} opts.currency * LionInputAmount
_onDropdownValueChangeprotectedevent: OnDropdownChangeEvent
_reflectBackOnprotectedLionInputAmount
_repropagationConditionprotectedUsually, we don’t use composition in regular LionFields (non choice-groups). Here we use a LionSelect(Rich) inside. We don’t want to repropagate any children, since an Application Developer is not concerned with these internals (see repropate logic in FormControlMixin) Also, we don’t want to give (wrong) info to InteractionStateMixin, that will set the wrong interaction states based on child info. TODO: Make “this._repropagationRole !== ‘child’” the default for FormControlMixin (so that FormControls used within are never repropagated for LionFields)

Events

NameTypeDescriptionInherited From
user-input-changedEventLionField

Attributes

NameFieldInherited From
preferredCurrenciespreferredCurrencies
allowedCurrenciesallowedCurrencies
__dropdownSlot__dropdownSlot
currencycurrencyLionInputAmount
currency-labelcurrencyLabelLionInputAmount
modelValuemodelValueLionInputAmount
readonlyreadOnlyLionInput
typetypeLionInput
placeholderplaceholderLionInput