Add silent property to skip animation triggering through submit actions.

This commit is contained in:
trading_peter 2023-03-05 22:50:20 +01:00
parent 837b3abeb2
commit c88aa759ba
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@tp/tp-button",
"version": "1.0.2",
"version": "1.1.0",
"description": "",
"main": "tp-button.js",
"scripts": {

View File

@ -140,6 +140,7 @@ class TpButton extends EventHelpers(LitElement) {
return {
submit: { type: Boolean },
extended: { type: Boolean },
slient: { type: Boolean },
locked: { type: Boolean, reflect: true },
};
}
@ -338,13 +339,18 @@ class TpButton extends EventHelpers(LitElement) {
}
_onFormSubmit() {
if (!this.slient) {
this.showSpinner();
}
}
_onFormSuccess() {
this.isSubmitting(false);
if (!this.slient) {
this.showSuccess();
}
}
_onFormFailed(e) {
// Only react if this button instance was the actual pressed button.
@ -357,9 +363,12 @@ class TpButton extends EventHelpers(LitElement) {
}
this.isSubmitting = false;
if (!this.slient) {
this.showError();
}
}
}
_findSubmitTarget() {
let target;