Reset native elements if reset() is called.
This commit is contained in:
parent
7ca87b7bdd
commit
a821354288
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/tp-form",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"description": "",
|
||||
"main": "tp-form.js",
|
||||
"scripts": {
|
||||
|
13
tp-form.js
13
tp-form.js
@ -168,7 +168,7 @@ class TpForm extends LitElement {
|
||||
// Also go through the form's native elements.
|
||||
for (let i = 0, li = this._nativeElements.length; i < li; i++) {
|
||||
const el = this._nativeElements[i];
|
||||
// Skip native controls that are wrapped by custom elements already registerd (e.g. <era-input><input></era-input>)
|
||||
// Skip native controls that are wrapped by custom elements already registered (e.g. <tp-input><input></tp-input>)
|
||||
if (!this._useValue(el) ||
|
||||
(this._isWrapped(el) && json[el.name])) {
|
||||
continue;
|
||||
@ -255,6 +255,17 @@ class TpForm extends LitElement {
|
||||
item.control.reset();
|
||||
}
|
||||
}
|
||||
|
||||
// Also go through the form's native elements.
|
||||
for (let i = 0, li = this._nativeElements.length; i < li; i++) {
|
||||
const el = this._nativeElements[i];
|
||||
// Skip native controls that are wrapped by custom elements already registered (e.g. <tp-input><input></tp-input>)
|
||||
if (this._isWrapped(el)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
el.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
focusFirstControl() {
|
||||
|
Loading…
Reference in New Issue
Block a user