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", "name": "@tp/tp-button",
"version": "1.0.2", "version": "1.1.0",
"description": "", "description": "",
"main": "tp-button.js", "main": "tp-button.js",
"scripts": { "scripts": {

View File

@ -140,6 +140,7 @@ class TpButton extends EventHelpers(LitElement) {
return { return {
submit: { type: Boolean }, submit: { type: Boolean },
extended: { type: Boolean }, extended: { type: Boolean },
slient: { type: Boolean },
locked: { type: Boolean, reflect: true }, locked: { type: Boolean, reflect: true },
}; };
} }
@ -338,12 +339,17 @@ class TpButton extends EventHelpers(LitElement) {
} }
_onFormSubmit() { _onFormSubmit() {
this.showSpinner(); if (!this.slient) {
this.showSpinner();
}
} }
_onFormSuccess() { _onFormSuccess() {
this.isSubmitting(false); this.isSubmitting(false);
this.showSuccess();
if (!this.slient) {
this.showSuccess();
}
} }
_onFormFailed(e) { _onFormFailed(e) {
@ -357,7 +363,10 @@ class TpButton extends EventHelpers(LitElement) {
} }
this.isSubmitting = false; this.isSubmitting = false;
this.showError();
if (!this.slient) {
this.showError();
}
} }
} }