Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@dreamworld/dw-form
Advanced tools
Readme
A form element which is used to get serialized data and to perform validation of it's local elements.
npm install --save @dreamworld/dw-form
@import `@dreamworld/dw-form/dw-form`;
serialize()
Used to get key/value data of it's children form elements as JSON Object.validate()
Used to validate child elements
validate()
method on each form element if it's defined/available.true
if all elements validate
has returned true
. <dw-form>
<dw-input name="name" label="Name" required></dw-input>
<dw-checkbox name="isChecked" label="This is checkbox"></>
</dw-form>
A Mixin used to create custom form element.
npm install --save @dreamworld/dw-form
@import `@dreamworld/dw-form/dw-form-element`;
register-dw-form-element
when attached (from connectedCallback
). dw-form
uses this event to register
this element as custom form element.unregister-dw-form-element
when detached (from disconnectedCallback
). dw-form
on this event removes
this element from the custom elements registry it has.register-dw-form-element
event from child elements (from local dom or light dom). It allows to
create composite form elements. Only most souter form element is registered with dw-form
. class CustomElement extends DwFormElement(LitElement) {
...
}
** NOTE: Do not forget to call super.connectedCallback()
and super.disconnectedCallback()
in your element **
It's used to show label for checkbox & radio buttons. Used by dw-checkbox
and dw-radio-button
.
And allows user to select by clicking on the label too.
It also activates a ripple effect upon interacting with the label. For more detail visit
https://github.com/material-components/material-web/tree/master/packages/formfield.
npm install --save @dreamworld/dw-form-field
@import '@dreamworld/dw-form-field'
<dw-form-field label="Name" disabled>
<my-form-element></my-form-element>
</dw-form-field>
// Slotted Label
<dw-form-field>
<my-form-element></my-form-element>
<div slot="label" style="background-color:powderblue; color: red; font-size: 24px;">Hello Slotted Label</div>
</dw-form-field>
mwc-formfield
Earlier (in 1.x version) this element was an extension of
mwc-formfield
but it's no longer uses it. But, it implements all the behaviours of it with additional behaviours as described below.
disabled
property
true
, text will be rendered in --dw-theme-disabled-text-color
alignTop
property.Name | Default | Description |
---|---|---|
--dw-theme-text-primary-on-background | rgba(0, 0, 0, 0.87) | Color of the label text. |
--dw-theme-disabled-text-color | rgba(0, 0, 0, 0.38) | Text color of a disabled form-field |
--dw-form-field-label-min-height | auto | Minimum height to label |
--dw-form-field-label-padding | 0 | Padding of the label (Note: won't work if label is not available) |
dw-form-field {
--dw-theme-text-primary-on-background: blue;
--dw-form-field-label-min-height: 40px;
font-size: 18px;
}
value
property is Object
. Object's key represents name of the inner form-element & value represents value of that inner form element.validate()
of this element is called, it invokes validate()
of all the inner form elements.value-changed
event when it's value is changed. (OR in other word, value
of any inner form element is changed). npm install --save @dreamworld/dw-form
@import '@dreamworld/dw-form/dw-composite-form-element'
<dw-composite-form-element>
<dw-input></dw-input>
</dw-composite-form-element>
DwCompositeFormElement
and in the render()
template render all the children elements.FAQs
A form element which is used to get serialized data and to perform validation of it's local elements.
The npm package @dreamworld/dw-form receives a total of 202 weekly downloads. As such, @dreamworld/dw-form popularity was classified as not popular.
We found that @dreamworld/dw-form demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.