lkt-tabs 2.0.1 → 2.0.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/dist/build.js +33 -33
- package/package.json +1 -1
- package/src/lib-components/LktTabs.vue +2 -2
package/dist/build.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as E, ref as O, computed as k, watch as v, createElementBlock as m, createCommentVNode as P, openBlock as d, unref as B, normalizeClass as y, renderSlot as
|
|
1
|
+
import { defineComponent as E, ref as O, computed as k, watch as v, createElementBlock as m, createCommentVNode as P, openBlock as d, unref as B, normalizeClass as y, renderSlot as _, Fragment as V, renderList as A, createBlock as $, resolveDynamicComponent as R, mergeProps as h, mergeDefaults as K, onMounted as I, resolveComponent as N, createVNode as M, createElementVNode as U, withDirectives as F, withCtx as G, vShow as z } from "vue";
|
|
2
2
|
import { TabType as w, MenuEntryType as S, ButtonType as j, MenuType as q, getDefaultValues as H, Tabs as J } from "lkt-vue-kernel";
|
|
3
3
|
import { generateRandomString as L, trim as C } from "lkt-string-tools";
|
|
4
4
|
import { secondsToMilliseconds as Y } from "lkt-date-tools";
|
|
@@ -11,21 +11,21 @@ const Q = ["id"], W = /* @__PURE__ */ E({
|
|
|
11
11
|
},
|
|
12
12
|
setup(e) {
|
|
13
13
|
const t = e, o = L(8), r = O(t.isActive), l = k(() => t.tab.type === w.Always ? !0 : t.tab.type === w.Lazy ? r.value : t.isActive);
|
|
14
|
-
return v(() => t.isActive, (
|
|
15
|
-
|
|
16
|
-
}), (
|
|
14
|
+
return v(() => t.isActive, (a) => {
|
|
15
|
+
a && (r.value = !0);
|
|
16
|
+
}), (a, u) => l.value ? (d(), m("section", {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: y(["lkt-tab--content", e.tab.containerClass]),
|
|
19
19
|
role: "tabpanel",
|
|
20
20
|
id: `lkt-tabs-${B(o)}-${e.tab.key}`
|
|
21
21
|
}, [
|
|
22
|
-
(d(!0), m(
|
|
22
|
+
(d(!0), m(V, null, A(e.tab.content, (i) => (d(), $(R(i.tag), h({
|
|
23
23
|
class: i.class
|
|
24
24
|
}, { ref_for: !0 }, i.props, {
|
|
25
25
|
modelValue: i.vModels.modelValue,
|
|
26
|
-
"onUpdate:modelValue": (
|
|
26
|
+
"onUpdate:modelValue": (n) => i.vModels.modelValue = n
|
|
27
27
|
}), null, 16, ["class", "modelValue", "onUpdate:modelValue"]))), 256)),
|
|
28
|
-
|
|
28
|
+
_(a.$slots, "default")
|
|
29
29
|
], 10, Q)) : P("", !0);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
@@ -45,12 +45,12 @@ c.COOKIE_FALLBACK = new X();
|
|
|
45
45
|
const Z = (e, t, o) => {
|
|
46
46
|
const r = /* @__PURE__ */ new Date(), l = r.getTime() + Y(o);
|
|
47
47
|
r.setTime(l);
|
|
48
|
-
const
|
|
49
|
-
document.cookie = `${e}=${t}, ${
|
|
48
|
+
const a = `expires=${r.toUTCString()}`;
|
|
49
|
+
document.cookie = `${e}=${t}, ${a}`;
|
|
50
50
|
}, ee = (e) => {
|
|
51
51
|
const t = `${e}=`, o = document.cookie.split(","), r = document.cookie.split("expires="), l = C(r[1]);
|
|
52
|
-
let
|
|
53
|
-
if (l && (
|
|
52
|
+
let a = new Date(l);
|
|
53
|
+
if (l && (a = new Date(l)) && a < /* @__PURE__ */ new Date()) {
|
|
54
54
|
x(e);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
@@ -103,30 +103,30 @@ const Z = (e, t, o) => {
|
|
|
103
103
|
"update:modelValue"
|
|
104
104
|
],
|
|
105
105
|
setup(e, { emit: t }) {
|
|
106
|
-
const o = e, r = t, l = L(8),
|
|
106
|
+
const o = e, r = t, l = L(8), a = O("");
|
|
107
107
|
if (o.useSession) {
|
|
108
108
|
o.id || console.warn("[LKT Tabs] You're trying to use session provided tabs without the required id. Please, add id attr");
|
|
109
|
-
let
|
|
110
|
-
|
|
109
|
+
let n = ne(o.id);
|
|
110
|
+
n && (a.value = n);
|
|
111
111
|
}
|
|
112
|
-
v(() => o.modelValue, (
|
|
113
|
-
typeof
|
|
114
|
-
}), v(
|
|
115
|
-
r("update:modelValue");
|
|
112
|
+
v(() => o.modelValue, (n, p) => {
|
|
113
|
+
typeof n == "string" && (a.value = n);
|
|
114
|
+
}), v(a, (n, p) => {
|
|
115
|
+
r("update:modelValue", n);
|
|
116
116
|
});
|
|
117
117
|
const u = k(() => {
|
|
118
|
-
let
|
|
119
|
-
return o.class &&
|
|
118
|
+
let n = [];
|
|
119
|
+
return o.class && n.push(o.class), n.join(" ");
|
|
120
120
|
}), i = k(() => {
|
|
121
121
|
var p, f;
|
|
122
|
-
let
|
|
122
|
+
let n = [];
|
|
123
123
|
return (p = o.navStartButtons) == null || p.forEach((s) => {
|
|
124
|
-
|
|
124
|
+
n.push({
|
|
125
125
|
type: S.Button,
|
|
126
126
|
button: s
|
|
127
127
|
});
|
|
128
128
|
}), o.tabs.map((s) => {
|
|
129
|
-
const b =
|
|
129
|
+
const b = a.value === s.key;
|
|
130
130
|
return {
|
|
131
131
|
key: s.key,
|
|
132
132
|
type: S.Button,
|
|
@@ -145,25 +145,25 @@ const Z = (e, t, o) => {
|
|
|
145
145
|
events: {
|
|
146
146
|
click: (D) => {
|
|
147
147
|
var g, T;
|
|
148
|
-
typeof ((g = s.button.events) == null ? void 0 : g.click) == "function" && ((T = s.button.events) == null || T.click(D)),
|
|
148
|
+
typeof ((g = s.button.events) == null ? void 0 : g.click) == "function" && ((T = s.button.events) == null || T.click(D)), a.value = s.key;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
}).forEach((s) =>
|
|
154
|
-
|
|
153
|
+
}).forEach((s) => n.push(s)), (f = o.navEndButtons) == null || f.forEach((s) => {
|
|
154
|
+
n.push({
|
|
155
155
|
type: S.Button,
|
|
156
156
|
button: s
|
|
157
157
|
});
|
|
158
158
|
}), {
|
|
159
159
|
menuKey: `tabs-menu-${o.id}`,
|
|
160
160
|
type: q.TabList,
|
|
161
|
-
modelValue:
|
|
161
|
+
modelValue: n
|
|
162
162
|
};
|
|
163
163
|
});
|
|
164
164
|
return I(() => {
|
|
165
|
-
!
|
|
166
|
-
}), (
|
|
165
|
+
!a.value && o.tabs.length > 0 && (a.value = o.tabs[0].key);
|
|
166
|
+
}), (n, p) => {
|
|
167
167
|
const f = N("lkt-menu");
|
|
168
168
|
return d(), m("div", {
|
|
169
169
|
class: y(["lkt-tabs", u.value])
|
|
@@ -172,17 +172,17 @@ const Z = (e, t, o) => {
|
|
|
172
172
|
U("div", {
|
|
173
173
|
class: y(["lkt-tabs--content", e.contentClass])
|
|
174
174
|
}, [
|
|
175
|
-
(d(!0), m(
|
|
175
|
+
(d(!0), m(V, null, A(e.tabs, (s) => F((d(), $(W, h({ ref_for: !0 }, {
|
|
176
176
|
tab: s,
|
|
177
|
-
isActive:
|
|
177
|
+
isActive: a.value === s.key,
|
|
178
178
|
identifier: B(l)
|
|
179
179
|
}), {
|
|
180
180
|
default: G(() => [
|
|
181
|
-
|
|
181
|
+
_(n.$slots, "tab-" + s.key)
|
|
182
182
|
]),
|
|
183
183
|
_: 2
|
|
184
184
|
}, 1040)), [
|
|
185
|
-
[z,
|
|
185
|
+
[z, a.value === s.key]
|
|
186
186
|
])), 256))
|
|
187
187
|
], 2)
|
|
188
188
|
], 2);
|
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ watch(() => props.modelValue, (newVal, oldVal) => {
|
|
|
43
43
|
})
|
|
44
44
|
|
|
45
45
|
watch(Value, (newVal, oldVal) => {
|
|
46
|
-
emit('update:modelValue');
|
|
46
|
+
emit('update:modelValue', newVal);
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
const classes = computed(() => {
|
|
@@ -86,7 +86,7 @@ const computedMenuConfig = computed(() => {
|
|
|
86
86
|
tab.button.events?.click(args);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
Value.value = tab.key
|
|
89
|
+
Value.value = tab.key;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|