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,13 +339,18 @@ class TpButton extends EventHelpers(LitElement) {
} }
_onFormSubmit() { _onFormSubmit() {
if (!this.slient) {
this.showSpinner(); this.showSpinner();
} }
}
_onFormSuccess() { _onFormSuccess() {
this.isSubmitting(false); this.isSubmitting(false);
if (!this.slient) {
this.showSuccess(); this.showSuccess();
} }
}
_onFormFailed(e) { _onFormFailed(e) {
// Only react if this button instance was the actual pressed button. // Only react if this button instance was the actual pressed button.
@ -357,9 +363,12 @@ class TpButton extends EventHelpers(LitElement) {
} }
this.isSubmitting = false; this.isSubmitting = false;
if (!this.slient) {
this.showError(); this.showError();
} }
} }
}
_findSubmitTarget() { _findSubmitTarget() {
let target; let target;