wave-ui 1.65.2 → 1.66.0
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/wave-ui.es.js
CHANGED
|
@@ -113,8 +113,8 @@ const _NotificationManager$1 = class {
|
|
|
113
113
|
if (~~notification.timeout !== 0)
|
|
114
114
|
setTimeout(() => this.dismiss(notification._uid), notification.timeout);
|
|
115
115
|
}
|
|
116
|
-
dismiss(
|
|
117
|
-
this.notifications = this.notifications.filter((item) => item._uid !==
|
|
116
|
+
dismiss(uid2) {
|
|
117
|
+
this.notifications = this.notifications.filter((item) => item._uid !== uid2);
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
let NotificationManager$1 = _NotificationManager$1;
|
|
@@ -5493,10 +5493,13 @@ var render$g = function() {
|
|
|
5493
5493
|
var _vm = this;
|
|
5494
5494
|
var _h = _vm.$createElement;
|
|
5495
5495
|
var _c = _vm._self._c || _h;
|
|
5496
|
-
return _c("div", { staticClass: "w-tabs__content" }, [_vm._t("default")], 2);
|
|
5496
|
+
return _c("div", { staticClass: "w-tabs__content" }, [_vm._t("default", null, { "item": _vm.item })], 2);
|
|
5497
5497
|
};
|
|
5498
5498
|
var staticRenderFns$g = [];
|
|
5499
|
-
const __vue2_script$g = {
|
|
5499
|
+
const __vue2_script$g = {
|
|
5500
|
+
name: "tab-content",
|
|
5501
|
+
props: { item: Object }
|
|
5502
|
+
};
|
|
5500
5503
|
const __cssModules$g = {};
|
|
5501
5504
|
var __component__$g = /* @__PURE__ */ normalizeComponent(
|
|
5502
5505
|
__vue2_script$g,
|
|
@@ -5520,25 +5523,33 @@ var render$f = function() {
|
|
|
5520
5523
|
var _vm = this;
|
|
5521
5524
|
var _h = _vm.$createElement;
|
|
5522
5525
|
var _c = _vm._self._c || _h;
|
|
5523
|
-
return _c("div", { staticClass: "w-tabs", class: _vm.tabsClasses }, [_c("div", { ref: "tabs-bar", staticClass: "w-tabs__bar", class: _vm.tabsBarClasses }, [_vm._l(_vm.
|
|
5524
|
-
return _c("div", { key: i, staticClass: "w-tabs__bar-item", class: _vm.barItemClasses(
|
|
5525
|
-
!
|
|
5526
|
+
return _c("div", { staticClass: "w-tabs", class: _vm.tabsClasses }, [_c("div", { ref: "tabs-bar", staticClass: "w-tabs__bar", class: _vm.tabsBarClasses }, [_vm._l(_vm.tabs, function(tab, i) {
|
|
5527
|
+
return _c("div", { key: i, staticClass: "w-tabs__bar-item", class: _vm.barItemClasses(tab), attrs: { "tabindex": !tab._disabled && 0, "aria-selected": tab._uid === _vm.activeTabUid ? "true" : "false", "role": "tab" }, on: { "click": function($event) {
|
|
5528
|
+
!tab._disabled && tab._uid !== _vm.activeTabUid && _vm.openTab(tab._uid);
|
|
5526
5529
|
}, "focus": function($event) {
|
|
5527
|
-
_vm.$emit("focus", _vm.getOriginalItem(
|
|
5530
|
+
_vm.$emit("focus", _vm.getOriginalItem(tab));
|
|
5528
5531
|
}, "keypress": function($event) {
|
|
5529
5532
|
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
|
|
5530
5533
|
return null;
|
|
5531
5534
|
}
|
|
5532
|
-
!
|
|
5533
|
-
} } }, [_vm.$scopedSlots["item-title." + (
|
|
5534
|
-
return [_c("div", { domProps: { "innerHTML": _vm._s(
|
|
5535
|
-
}, { "item": _vm.getOriginalItem(
|
|
5536
|
-
}), _vm.$scopedSlots["tabs-bar-extra"] ? _c("div", { staticClass: "w-tabs__bar-extra" }, [_vm._t("tabs-bar-extra")], 2) : _vm._e(), !_vm.noSlider && !_vm.card ? _c("div", { staticClass: "w-tabs__slider", class: _vm.sliderColor, style: _vm.sliderStyles }) : _vm._e()], 2), _vm.
|
|
5537
|
-
return
|
|
5538
|
-
|
|
5535
|
+
!tab._disabled && _vm.openTab(tab._uid);
|
|
5536
|
+
} } }, [_vm.$scopedSlots["item-title." + (tab.id || i + 1)] ? _vm._t("item-title." + (tab.id || i + 1), null, { "item": _vm.getOriginalItem(tab), "index": i + 1, "active": tab._uid === _vm.activeTabUid }) : _vm._t("item-title", function() {
|
|
5537
|
+
return [_c("div", { domProps: { "innerHTML": _vm._s(tab[_vm.itemTitleKey]) } })];
|
|
5538
|
+
}, { "item": _vm.getOriginalItem(tab), "index": i + 1, "active": tab._uid === _vm.activeTabUid })], 2);
|
|
5539
|
+
}), _vm.$scopedSlots["tabs-bar-extra"] ? _c("div", { staticClass: "w-tabs__bar-extra" }, [_vm._t("tabs-bar-extra")], 2) : _vm._e(), !_vm.noSlider && !_vm.card ? _c("div", { staticClass: "w-tabs__slider", class: _vm.sliderColor, style: _vm.sliderStyles }) : _vm._e()], 2), _vm.tabs.length ? _c("div", { staticClass: "w-tabs__content-wrap" }, [_vm.keepInDom ? _c("transition-group", { attrs: { "name": _vm.transitionName } }, _vm._l(_vm.tabs, function(tab, i) {
|
|
5540
|
+
return _c("tab-content", { directives: [{ name: "show", rawName: "v-show", value: tab._uid === _vm.activeTab._uid, expression: "tab._uid === activeTab._uid" }], key: tab._uid, class: _vm.contentClass, attrs: { "item": tab } }, [_vm.$scopedSlots["item-content." + (tab._index + 1)] ? _vm._t("item-content." + (tab._index + 1), null, { "item": _vm.getOriginalItem(tab), "index": tab._index + 1, "active": tab._index === _vm.activeTab._index }) : _vm._t("item-content", function() {
|
|
5541
|
+
return [tab[_vm.itemContentKey] ? _c("div", { domProps: { "innerHTML": _vm._s(tab[_vm.itemContentKey]) } }) : _vm._e()];
|
|
5542
|
+
}, { "item": _vm.getOriginalItem(tab), "index": tab._index + 1, "active": tab._index === _vm.activeTab._index })], 2);
|
|
5543
|
+
}), 1) : _c("transition", { attrs: { "name": _vm.transitionName, "mode": _vm.transitionMode } }, [_c("keep-alive", { attrs: { "exclude": _vm.keepAlive ? "" : "tab-content" } }, [_c("tab-content", { key: _vm.activeTabUid, class: _vm.contentClass, attrs: { "item": _vm.activeTab }, scopedSlots: _vm._u([{ key: "default", fn: function(ref) {
|
|
5544
|
+
var item = ref.item;
|
|
5545
|
+
return [item ? [_vm.$scopedSlots["item-content." + (item._index + 1)] ? _vm._t("item-content." + (item._index + 1), null, { "item": _vm.getOriginalItem(item), "index": item._index + 1, "active": item._uid === _vm.activeTabUid }) : _vm._t("item-content", function() {
|
|
5546
|
+
return [item[_vm.itemContentKey] ? _c("div", { domProps: { "innerHTML": _vm._s(item[_vm.itemContentKey]) } }) : _vm._e()];
|
|
5547
|
+
}, { "item": _vm.getOriginalItem(item), "index": item._index + 1, "active": item._uid === _vm.activeTabUid })] : _vm._e()];
|
|
5548
|
+
} }], null, true) })], 1)], 1)], 1) : _vm._e()]);
|
|
5539
5549
|
};
|
|
5540
5550
|
var staticRenderFns$f = [];
|
|
5541
5551
|
var index_vue_vue_type_style_index_0_lang = "";
|
|
5552
|
+
let uid = 0;
|
|
5542
5553
|
const __vue2_script$f = {
|
|
5543
5554
|
name: "w-tabs",
|
|
5544
5555
|
props: {
|
|
@@ -5546,6 +5557,7 @@ const __vue2_script$f = {
|
|
|
5546
5557
|
color: { type: String },
|
|
5547
5558
|
bgColor: { type: String },
|
|
5548
5559
|
items: { type: [Array, Number] },
|
|
5560
|
+
itemIdKey: { type: String, default: "id" },
|
|
5549
5561
|
itemTitleKey: { type: String, default: "title" },
|
|
5550
5562
|
itemContentKey: { type: String, default: "content" },
|
|
5551
5563
|
titleClass: { type: String },
|
|
@@ -5558,12 +5570,16 @@ const __vue2_script$f = {
|
|
|
5558
5570
|
fillBar: { type: Boolean },
|
|
5559
5571
|
center: { type: Boolean },
|
|
5560
5572
|
right: { type: Boolean },
|
|
5561
|
-
card: { type: Boolean }
|
|
5573
|
+
card: { type: Boolean },
|
|
5574
|
+
keepAlive: { type: Boolean, default: true },
|
|
5575
|
+
keepInDom: { type: Boolean, default: false }
|
|
5562
5576
|
},
|
|
5563
5577
|
components: { TabContent },
|
|
5564
5578
|
emits: ["input", "update:modelValue", "focus"],
|
|
5565
5579
|
data: () => ({
|
|
5580
|
+
tabs: [],
|
|
5566
5581
|
activeTabEl: null,
|
|
5582
|
+
activeTabUid: null,
|
|
5567
5583
|
activeTabIndex: 0,
|
|
5568
5584
|
prevTabIndex: -1,
|
|
5569
5585
|
slider: {
|
|
@@ -5584,16 +5600,11 @@ const __vue2_script$f = {
|
|
|
5584
5600
|
direction() {
|
|
5585
5601
|
return this.activeTab._index < this.prevTabIndex ? "right" : "left";
|
|
5586
5602
|
},
|
|
5587
|
-
tabsItems() {
|
|
5588
|
-
const items = typeof this.items === "number" ? Array(this.items).fill({}) : this.items;
|
|
5589
|
-
return items.map((item, _index) => new Vue.observable({
|
|
5590
|
-
...item,
|
|
5591
|
-
_index,
|
|
5592
|
-
_disabled: !!item.disabled
|
|
5593
|
-
}));
|
|
5594
|
-
},
|
|
5595
5603
|
activeTab() {
|
|
5596
|
-
return this.
|
|
5604
|
+
return this.tabsByUid[this.activeTabUid] || this.tabs[0] || {};
|
|
5605
|
+
},
|
|
5606
|
+
tabsByUid() {
|
|
5607
|
+
return this.tabs.reduce((obj, tab) => (obj[tab._uid] = tab) && obj, {});
|
|
5597
5608
|
},
|
|
5598
5609
|
tabsClasses() {
|
|
5599
5610
|
return {
|
|
@@ -5618,6 +5629,45 @@ const __vue2_script$f = {
|
|
|
5618
5629
|
}
|
|
5619
5630
|
},
|
|
5620
5631
|
methods: {
|
|
5632
|
+
addTab(item) {
|
|
5633
|
+
var _a, _b, _c;
|
|
5634
|
+
if (!((_b = (_a = item[this.itemIdKey]) != null ? _a : item._uid) != null ? _b : false))
|
|
5635
|
+
item._uid = +`${this._uid}${++uid}`;
|
|
5636
|
+
this.tabs.push({
|
|
5637
|
+
_uid: (_c = item[this.itemIdKey]) != null ? _c : item._uid,
|
|
5638
|
+
_index: this.tabs.length,
|
|
5639
|
+
...item,
|
|
5640
|
+
_disabled: !!item.disabled
|
|
5641
|
+
});
|
|
5642
|
+
},
|
|
5643
|
+
refreshTabs() {
|
|
5644
|
+
let items = this.items;
|
|
5645
|
+
if (typeof items === "number")
|
|
5646
|
+
items = Array(items).fill().map((_, i) => this.tabs[i] || {});
|
|
5647
|
+
this.tabs = items.map((item, _index) => {
|
|
5648
|
+
var _a, _b, _c;
|
|
5649
|
+
if (!((_b = (_a = item[this.itemIdKey]) != null ? _a : item._uid) != null ? _b : false))
|
|
5650
|
+
item._uid = +`${this._uid}${++uid}`;
|
|
5651
|
+
return {
|
|
5652
|
+
...item,
|
|
5653
|
+
_uid: (_c = item[this.itemIdKey]) != null ? _c : item._uid,
|
|
5654
|
+
_index,
|
|
5655
|
+
_disabled: !!item.disabled
|
|
5656
|
+
};
|
|
5657
|
+
});
|
|
5658
|
+
},
|
|
5659
|
+
reopenTheActiveTab() {
|
|
5660
|
+
var _a, _b, _c;
|
|
5661
|
+
if (this.tabs.length === 1)
|
|
5662
|
+
return this.openTab(this.tabs[0]._uid);
|
|
5663
|
+
let uid2 = (_a = this.tabsByUid[this.activeTabUid]) == null ? void 0 : _a._uid;
|
|
5664
|
+
if (!uid2)
|
|
5665
|
+
uid2 = (_b = this.tabs[this.activeTabIndex]) == null ? void 0 : _b._uid;
|
|
5666
|
+
if (!uid2)
|
|
5667
|
+
uid2 = (_c = this.tabs[Math.max(this.activeTabIndex - 1, this.tabs.length - 1)]) == null ? void 0 : _c._uid;
|
|
5668
|
+
if (uid2)
|
|
5669
|
+
this.openTab(uid2);
|
|
5670
|
+
},
|
|
5621
5671
|
onResize() {
|
|
5622
5672
|
this.updateSlider(false);
|
|
5623
5673
|
},
|
|
@@ -5631,17 +5681,20 @@ const __vue2_script$f = {
|
|
|
5631
5681
|
[this.titleClass]: this.titleClass
|
|
5632
5682
|
};
|
|
5633
5683
|
},
|
|
5634
|
-
openTab(
|
|
5684
|
+
openTab(uid2) {
|
|
5635
5685
|
this.prevTabIndex = this.activeTabIndex;
|
|
5636
|
-
|
|
5637
|
-
this
|
|
5638
|
-
this
|
|
5686
|
+
const tab = this.tabsByUid[uid2];
|
|
5687
|
+
this.activeTabIndex = tab._index;
|
|
5688
|
+
this.activeTabUid = tab._uid;
|
|
5689
|
+
this.$emit("update:modelValue", tab._index);
|
|
5690
|
+
this.$emit("input", tab._index);
|
|
5639
5691
|
if (!this.noSlider)
|
|
5640
5692
|
this.$nextTick(this.updateSlider);
|
|
5641
5693
|
},
|
|
5642
5694
|
updateSlider(domLookup = true) {
|
|
5643
5695
|
if (domLookup) {
|
|
5644
|
-
|
|
5696
|
+
const ref = this.$refs["tabs-bar"];
|
|
5697
|
+
this.activeTabEl = ref && ref.querySelector(".w-tabs__bar-item--active");
|
|
5645
5698
|
}
|
|
5646
5699
|
if (!this.fillBar && this.activeTabEl) {
|
|
5647
5700
|
const { left, width } = this.activeTabEl.getBoundingClientRect();
|
|
@@ -5651,8 +5704,8 @@ const __vue2_script$f = {
|
|
|
5651
5704
|
this.slider.left = `${left - parentLeft - parseInt(borderLeftWidth) + tabsBar.scrollLeft}px`;
|
|
5652
5705
|
this.slider.width = `${width}px`;
|
|
5653
5706
|
} else {
|
|
5654
|
-
this.slider.left = `${this.activeTab._index * 100 / this.
|
|
5655
|
-
this.slider.width = `${100 / this.
|
|
5707
|
+
this.slider.left = `${this.activeTab._index * 100 / this.tabs.length}%`;
|
|
5708
|
+
this.slider.width = `${100 / this.tabs.length}%`;
|
|
5656
5709
|
}
|
|
5657
5710
|
},
|
|
5658
5711
|
updateActiveTab(index2) {
|
|
@@ -5660,7 +5713,7 @@ const __vue2_script$f = {
|
|
|
5660
5713
|
index2 = ~~index2;
|
|
5661
5714
|
else if (isNaN(index2) || index2 < 0)
|
|
5662
5715
|
index2 = 0;
|
|
5663
|
-
this.
|
|
5716
|
+
this.openTab(this.tabs[index2]._uid);
|
|
5664
5717
|
this.$nextTick(() => {
|
|
5665
5718
|
const ref = this.$refs["tabs-bar"];
|
|
5666
5719
|
this.activeTabEl = ref && ref.querySelector(`.w-tabs__bar-item:nth-child(${index2 + 1})`);
|
|
@@ -5670,10 +5723,13 @@ const __vue2_script$f = {
|
|
|
5670
5723
|
});
|
|
5671
5724
|
},
|
|
5672
5725
|
getOriginalItem(item) {
|
|
5673
|
-
return this.items[item._index];
|
|
5726
|
+
return this.items[item._index] || {};
|
|
5674
5727
|
}
|
|
5675
5728
|
},
|
|
5676
5729
|
beforeMount() {
|
|
5730
|
+
this.tabs = [];
|
|
5731
|
+
const items = typeof this.items === "number" ? Array(this.items).fill().map(Object) : this.items;
|
|
5732
|
+
items.forEach(this.addTab);
|
|
5677
5733
|
this.updateActiveTab(this.value);
|
|
5678
5734
|
this.$nextTick(() => {
|
|
5679
5735
|
this.updateSlider();
|
|
@@ -5687,13 +5743,18 @@ const __vue2_script$f = {
|
|
|
5687
5743
|
},
|
|
5688
5744
|
watch: {
|
|
5689
5745
|
value(index2) {
|
|
5690
|
-
this.
|
|
5746
|
+
if (index2 !== this.activeTabIndex)
|
|
5747
|
+
this.updateActiveTab(index2);
|
|
5691
5748
|
},
|
|
5692
|
-
items
|
|
5693
|
-
|
|
5694
|
-
this.
|
|
5695
|
-
|
|
5696
|
-
|
|
5749
|
+
items: {
|
|
5750
|
+
handler() {
|
|
5751
|
+
this.refreshTabs();
|
|
5752
|
+
if (this.tabs.length)
|
|
5753
|
+
this.reopenTheActiveTab();
|
|
5754
|
+
if (!this.noSlider)
|
|
5755
|
+
this.$nextTick(this.updateSlider);
|
|
5756
|
+
},
|
|
5757
|
+
deep: true
|
|
5697
5758
|
},
|
|
5698
5759
|
fillBar() {
|
|
5699
5760
|
if (!this.noSlider)
|
|
@@ -5898,10 +5959,10 @@ const __vue2_script$e = {
|
|
|
5898
5959
|
return this.headers.find((header) => header.sticky);
|
|
5899
5960
|
},
|
|
5900
5961
|
selectedRowsByUid() {
|
|
5901
|
-
return this.selectedRowsInternal.reduce((obj,
|
|
5962
|
+
return this.selectedRowsInternal.reduce((obj, uid2) => (obj[uid2] = true) && obj, {});
|
|
5902
5963
|
},
|
|
5903
5964
|
expandedRowsByUid() {
|
|
5904
|
-
return this.expandedRowsInternal.reduce((obj,
|
|
5965
|
+
return this.expandedRowsInternal.reduce((obj, uid2) => (obj[uid2] = true) && obj, {});
|
|
5905
5966
|
}
|
|
5906
5967
|
},
|
|
5907
5968
|
methods: {
|
|
@@ -5943,14 +6004,14 @@ const __vue2_script$e = {
|
|
|
5943
6004
|
else
|
|
5944
6005
|
this.expandedRowsInternal.push(item._uid);
|
|
5945
6006
|
} else
|
|
5946
|
-
this.expandedRowsInternal = this.expandedRowsInternal.filter((
|
|
6007
|
+
this.expandedRowsInternal = this.expandedRowsInternal.filter((uid2) => uid2 !== item._uid);
|
|
5947
6008
|
this.$emit(
|
|
5948
6009
|
"row-expand",
|
|
5949
6010
|
{
|
|
5950
6011
|
item,
|
|
5951
6012
|
index: index2,
|
|
5952
6013
|
expanded: isExpanding,
|
|
5953
|
-
expandedRows: this.expandedRowsInternal.map((
|
|
6014
|
+
expandedRows: this.expandedRowsInternal.map((uid2) => this.filteredItems[uid2])
|
|
5954
6015
|
}
|
|
5955
6016
|
);
|
|
5956
6017
|
this.$emit("update:expanded-rows", this.expandedRowsInternal);
|
|
@@ -5964,7 +6025,7 @@ const __vue2_script$e = {
|
|
|
5964
6025
|
this.selectedRowsInternal.push(item._uid);
|
|
5965
6026
|
updated = true;
|
|
5966
6027
|
} else if (!this.forceSelection || this.selectedRowsInternal.length > 1) {
|
|
5967
|
-
this.selectedRowsInternal = this.selectedRowsInternal.filter((
|
|
6028
|
+
this.selectedRowsInternal = this.selectedRowsInternal.filter((uid2) => uid2 !== item._uid);
|
|
5968
6029
|
updated = true;
|
|
5969
6030
|
}
|
|
5970
6031
|
if (updated) {
|
|
@@ -5974,7 +6035,7 @@ const __vue2_script$e = {
|
|
|
5974
6035
|
item,
|
|
5975
6036
|
index: index2,
|
|
5976
6037
|
selected: isSelecting,
|
|
5977
|
-
selectedRows: this.selectedRowsInternal.map((
|
|
6038
|
+
selectedRows: this.selectedRowsInternal.map((uid2) => this.filteredItems[uid2])
|
|
5978
6039
|
}
|
|
5979
6040
|
);
|
|
5980
6041
|
this.$emit("update:selected-rows", this.selectedRowsInternal);
|