@cedx/base 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ReadMe.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Belin.io Base
|
|
2
|
-
   
|
|
3
3
|
|
|
4
4
|
Base library by [Cédric Belin](https://belin.io), full stack developer,
|
|
5
5
|
implemented in [C#](https://learn.microsoft.com/en-us/dotnet/csharp) and [TypeScript](https://www.typescriptlang.org).
|
|
@@ -15,7 +15,7 @@ export class TabActivator extends HTMLElement {
|
|
|
15
15
|
*/
|
|
16
16
|
get activeTabIndex() {
|
|
17
17
|
const index = Number(this.storage.getItem(this.storageKey) ?? "1");
|
|
18
|
-
return Math.max(0, Math.min(this.tabs.length, Number.isNaN(index) ? 0 : index - 1));
|
|
18
|
+
return Math.max(0, Math.min(this.tabs.length - 1, Number.isNaN(index) ? 0 : index - 1));
|
|
19
19
|
}
|
|
20
20
|
set activeTabIndex(value) {
|
|
21
21
|
this.storage.setItem(this.storageKey, (value + 1).toString());
|
|
@@ -57,7 +57,7 @@ export class TabActivator extends HTMLElement {
|
|
|
57
57
|
*/
|
|
58
58
|
connectedCallback() {
|
|
59
59
|
const { activeTabIndex, tabs } = this;
|
|
60
|
-
for (let index = 0; index < tabs.length
|
|
60
|
+
for (let index = 0; index < tabs.length; index++) {
|
|
61
61
|
const tab = tabs.item(index);
|
|
62
62
|
tab.addEventListener("click", () => this.activeTabIndex = index);
|
|
63
63
|
if (index == activeTabIndex)
|
|
@@ -123,7 +123,7 @@ export class Toaster extends HTMLElement {
|
|
|
123
123
|
show(toast) {
|
|
124
124
|
const item = document.createElement("toaster-item");
|
|
125
125
|
item.addEventListener("hidden.bs.toast", () => item.remove());
|
|
126
|
-
item.appendChild(this.#toastTemplate.cloneNode(true).
|
|
126
|
+
item.appendChild(this.#toastTemplate.cloneNode(true).querySelector(".toast"));
|
|
127
127
|
item.animation = toast.animation ?? this.animation;
|
|
128
128
|
item.autoHide = toast.autoHide ?? this.autoHide;
|
|
129
129
|
item.caption = toast.caption;
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ export class TabActivator extends HTMLElement {
|
|
|
18
18
|
*/
|
|
19
19
|
get activeTabIndex(): number {
|
|
20
20
|
const index = Number(this.storage.getItem(this.storageKey) ?? "1");
|
|
21
|
-
return Math.max(0, Math.min(this.tabs.length, Number.isNaN(index) ? 0 : index - 1));
|
|
21
|
+
return Math.max(0, Math.min(this.tabs.length - 1, Number.isNaN(index) ? 0 : index - 1));
|
|
22
22
|
}
|
|
23
23
|
set activeTabIndex(value: number) {
|
|
24
24
|
this.storage.setItem(this.storageKey, (value + 1).toString());
|
|
@@ -65,7 +65,7 @@ export class TabActivator extends HTMLElement {
|
|
|
65
65
|
*/
|
|
66
66
|
connectedCallback(): void {
|
|
67
67
|
const {activeTabIndex, tabs} = this;
|
|
68
|
-
for (let index = 0; index < tabs.length
|
|
68
|
+
for (let index = 0; index < tabs.length; index++) {
|
|
69
69
|
const tab = tabs.item(index);
|
|
70
70
|
tab.addEventListener("click", () => this.activeTabIndex = index);
|
|
71
71
|
if (index == activeTabIndex) Tab.getOrCreateInstance(tab).show();
|
|
@@ -178,7 +178,7 @@ export class Toaster extends HTMLElement {
|
|
|
178
178
|
show(toast: IToast): void {
|
|
179
179
|
const item = document.createElement("toaster-item");
|
|
180
180
|
item.addEventListener("hidden.bs.toast", () => item.remove());
|
|
181
|
-
item.appendChild((this.#toastTemplate.cloneNode(true) as DocumentFragment).
|
|
181
|
+
item.appendChild((this.#toastTemplate.cloneNode(true) as DocumentFragment).querySelector(".toast")!);
|
|
182
182
|
|
|
183
183
|
item.animation = toast.animation ?? this.animation;
|
|
184
184
|
item.autoHide = toast.autoHide ?? this.autoHide;
|