Compare commits
3 Commits
1ec658dfef
...
master
Author | SHA1 | Date | |
---|---|---|---|
7878a60bf8 | |||
d4e9235deb | |||
3f1c74b951 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/tp-button",
|
"name": "@tp/tp-button",
|
||||||
"version": "1.2.0",
|
"version": "1.3.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-button.js",
|
"main": "tp-button.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
18
tp-button.js
18
tp-button.js
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
@license
|
@license
|
||||||
Copyright (c) 2022 trading_peter
|
Copyright (c) 2025 trading_peter
|
||||||
This program is available under Apache License Version 2.0
|
This program is available under Apache License Version 2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -123,8 +123,8 @@ class TpButton extends EventHelpers(LitElement) {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return html`
|
return html`
|
||||||
<div class="wrap">
|
<div class="wrap" part="wrap">
|
||||||
<div class="label">
|
<div class="label" part="label">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
${this.extended ? html`
|
${this.extended ? html`
|
||||||
@ -200,6 +200,10 @@ class TpButton extends EventHelpers(LitElement) {
|
|||||||
this.unlisten(this, 'keypress', '_keyPressed');
|
this.unlisten(this, 'keypress', '_keyPressed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
this.listen(this, 'keypress', '_keyPressed');
|
||||||
|
}
|
||||||
|
|
||||||
shouldUpdate(changes) {
|
shouldUpdate(changes) {
|
||||||
if (changes.has('submit') && this.submit) {
|
if (changes.has('submit') && this.submit) {
|
||||||
this.extended = true;
|
this.extended = true;
|
||||||
@ -230,6 +234,8 @@ class TpButton extends EventHelpers(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.updateComplete;
|
||||||
|
|
||||||
if (this._isAnimating) {
|
if (this._isAnimating) {
|
||||||
this._queue.push('showSuccess');
|
this._queue.push('showSuccess');
|
||||||
return;
|
return;
|
||||||
@ -249,6 +255,8 @@ class TpButton extends EventHelpers(LitElement) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.updateComplete;
|
||||||
|
|
||||||
if (this._isAnimating) {
|
if (this._isAnimating) {
|
||||||
this._queue.push('showError');
|
this._queue.push('showError');
|
||||||
return;
|
return;
|
||||||
@ -262,12 +270,14 @@ class TpButton extends EventHelpers(LitElement) {
|
|||||||
this.locked = false;
|
this.locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
showSpinner() {
|
async showSpinner() {
|
||||||
if (!this.extended) {
|
if (!this.extended) {
|
||||||
console.warn(this.tagName + ': Is not in extended mode!');
|
console.warn(this.tagName + ': Is not in extended mode!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.updateComplete;
|
||||||
|
|
||||||
if (this._isAnimating) {
|
if (this._isAnimating) {
|
||||||
this._queue.push('showSpinner');
|
this._queue.push('showSpinner');
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user