Include the 'checked' property in snapshots and state resets.
This commit is contained in:
parent
8f0d9524ba
commit
7ca87b7bdd
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/tp-form",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "",
|
||||
"main": "tp-form.js",
|
||||
"scripts": {
|
||||
|
@ -250,6 +250,7 @@ class TpForm extends LitElement {
|
||||
for (let i = 0, li = this._origValues.length; i < li; ++i) {
|
||||
const item = this._origValues[i];
|
||||
item.control.value = this._copyValue(item.value || null, item.control);
|
||||
item.control.checked = this._copyValue(item.checked || null, item.control);
|
||||
if (typeof item.control.reset === 'function') {
|
||||
item.control.reset();
|
||||
}
|
||||
@ -279,6 +280,7 @@ class TpForm extends LitElement {
|
||||
for (let i = 0, li = this._origValues.length; i < li; ++i) {
|
||||
const item = this._origValues[i];
|
||||
item.value = item.control.value;
|
||||
item.checked = item.control.checked;
|
||||
}
|
||||
|
||||
this._snapshot = JSON.stringify(this.serialize());
|
||||
@ -295,7 +297,7 @@ class TpForm extends LitElement {
|
||||
}
|
||||
|
||||
// Store copy of original value in case we want to reset the form.
|
||||
this._origValues.push({ control: target, value: this._copyValue(target.value, target) });
|
||||
this._origValues.push({ control: target, value: this._copyValue(target.value, target), checked: this._copyValue(target.checked, target) });
|
||||
|
||||
// Stop propagation of the registration event.
|
||||
// This allows for nested forms.
|
||||
|
Loading…
Reference in New Issue
Block a user