@cal.macconnachie/web-components 1.2.0 → 1.2.1
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/dist/index.js +14 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5845,13 +5845,15 @@ let Z = class extends U {
|
|
|
5845
5845
|
queryAndRegisterTabs() {
|
|
5846
5846
|
const e = this.querySelectorAll("base-tab"), t = [];
|
|
5847
5847
|
e.forEach((r) => {
|
|
5848
|
-
|
|
5848
|
+
if (r.parentElement?.closest("base-tabs") !== this)
|
|
5849
|
+
return;
|
|
5850
|
+
const i = {
|
|
5849
5851
|
id: r.id,
|
|
5850
5852
|
label: r.getAttribute("label") || "",
|
|
5851
5853
|
badge: r.hasAttribute("badge") ? Number(r.getAttribute("badge")) : void 0,
|
|
5852
5854
|
icon: r.getAttribute("icon") || void 0
|
|
5853
5855
|
};
|
|
5854
|
-
|
|
5856
|
+
i.id && !this.tabs.find((s) => s.id === i.id) && t.push(i);
|
|
5855
5857
|
}), t.length > 0 && (this.tabs = [...this.tabs, ...t]);
|
|
5856
5858
|
}
|
|
5857
5859
|
willUpdate(e) {
|
|
@@ -5868,20 +5870,24 @@ let Z = class extends U {
|
|
|
5868
5870
|
super.updated(e), e.has("activeTab") && this.updateChildTabs();
|
|
5869
5871
|
}
|
|
5870
5872
|
handleTabRegister(e) {
|
|
5873
|
+
if (e.target.parentElement?.closest("base-tabs") !== this)
|
|
5874
|
+
return;
|
|
5871
5875
|
e.stopPropagation();
|
|
5872
|
-
const
|
|
5873
|
-
this.tabs.find((
|
|
5876
|
+
const o = e.detail;
|
|
5877
|
+
this.tabs.find((i) => i.id === o.id) || (this.tabs = [...this.tabs, o]);
|
|
5874
5878
|
}
|
|
5875
5879
|
handleTabBadgeUpdate(e) {
|
|
5880
|
+
if (e.target.parentElement?.closest("base-tabs") !== this)
|
|
5881
|
+
return;
|
|
5876
5882
|
e.stopPropagation();
|
|
5877
|
-
const { id:
|
|
5878
|
-
|
|
5879
|
-
(
|
|
5883
|
+
const { id: o, badge: i } = e.detail, s = this.tabs.findIndex((a) => a.id === o);
|
|
5884
|
+
s !== -1 && (this.tabs = this.tabs.map(
|
|
5885
|
+
(a, n) => n === s ? { ...a, badge: i } : a
|
|
5880
5886
|
));
|
|
5881
5887
|
}
|
|
5882
5888
|
updateChildTabs() {
|
|
5883
5889
|
this.querySelectorAll("base-tab").forEach((t) => {
|
|
5884
|
-
t.active = t.id === this.activeTab;
|
|
5890
|
+
t.parentElement?.closest("base-tabs") === this && (t.active = t.id === this.activeTab);
|
|
5885
5891
|
});
|
|
5886
5892
|
}
|
|
5887
5893
|
handleHashChange() {
|