@kiva/kv-components 8.9.0 → 8.10.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/SKILLS.md +31 -0
- package/dist/index.js +160 -158
- package/dist/utils/pieChartColors.d.ts +4 -0
- package/dist/utils/pieChartColors.js +42 -0
- package/dist/utils/useCountUp.d.ts +5 -0
- package/dist/utils/useCountUp.js +7 -0
- package/dist/vue/KvPieChartV2.css +1 -0
- package/dist/vue/KvPieChartV2.js +143 -0
- package/dist/vue/KvPieChartV2.vue.d.ts +202 -0
- package/dist/vue/KvPieChartV22.js +232 -0
- package/dist/vue/KvProgressCircle.vue.d.ts +1 -1
- package/dist/vue/KvTabPanel.js +11 -11
- package/dist/vue/KvTabs.js +16 -16
- package/dist/vue/KvTabs.vue.d.ts +16 -5
- package/dist/vue/KvTabs2.js +44 -34
- package/dist/vue/index.d.ts +1 -0
- package/docs/make-to-vue.md +264 -0
- package/package.json +2 -2
- package/dist/vue/KvWwwHeader/KvHeaderLinkBar.vue.d.ts +0 -1082
- package/dist/vue/KvWwwHeader/LendMenu/KvLendListMenu.vue.d.ts +0 -319
- package/dist/vue/KvWwwHeader/LendMenu/KvLendMenu.vue.d.ts +0 -506
- package/dist/vue/KvWwwHeader.vue.d.ts +0 -4441
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
export interface KvPieChartV2Item {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
}
|
|
7
|
+
export type PieChartUnit = 'percent' | 'amount' | 'count';
|
|
8
|
+
interface ComputedSegment {
|
|
9
|
+
label: string;
|
|
10
|
+
value: number;
|
|
11
|
+
percent: number;
|
|
12
|
+
color: string;
|
|
13
|
+
dashLength: number;
|
|
14
|
+
startDeg: number;
|
|
15
|
+
delay: number;
|
|
16
|
+
isVisible: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
19
|
+
values: {
|
|
20
|
+
type: PropType<KvPieChartV2Item[]>;
|
|
21
|
+
default: () => any[];
|
|
22
|
+
};
|
|
23
|
+
unit: {
|
|
24
|
+
type: PropType<PieChartUnit>;
|
|
25
|
+
default: string;
|
|
26
|
+
validator: (value: string) => boolean;
|
|
27
|
+
};
|
|
28
|
+
loading: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
shownSegments: {
|
|
33
|
+
type: NumberConstructor;
|
|
34
|
+
default: number;
|
|
35
|
+
};
|
|
36
|
+
strokeWidth: {
|
|
37
|
+
type: NumberConstructor;
|
|
38
|
+
default: number;
|
|
39
|
+
};
|
|
40
|
+
segmentGap: {
|
|
41
|
+
type: NumberConstructor;
|
|
42
|
+
default: number;
|
|
43
|
+
};
|
|
44
|
+
initialDelay: {
|
|
45
|
+
type: NumberConstructor;
|
|
46
|
+
default: number;
|
|
47
|
+
};
|
|
48
|
+
animateOut: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
}>, {
|
|
53
|
+
CX: number;
|
|
54
|
+
CY: number;
|
|
55
|
+
radius: import('vue').ComputedRef<number>;
|
|
56
|
+
circumference: import('vue').ComputedRef<number>;
|
|
57
|
+
LOADING_BG_COLOR: string;
|
|
58
|
+
OTHER_SEGMENT_BG_COLOR: string;
|
|
59
|
+
showOtherLightbox: import('vue').Ref<boolean, boolean>;
|
|
60
|
+
animatedIn: import('vue').Ref<boolean, boolean>;
|
|
61
|
+
displayValues: import('vue').Ref<number[], number[]>;
|
|
62
|
+
hasData: import('vue').ComputedRef<boolean>;
|
|
63
|
+
visibleSegments: import('vue').ComputedRef<ComputedSegment[]>;
|
|
64
|
+
otherSegment: import('vue').ComputedRef<ComputedSegment>;
|
|
65
|
+
otherItems: import('vue').ComputedRef<{
|
|
66
|
+
color: string;
|
|
67
|
+
label: string;
|
|
68
|
+
value: number;
|
|
69
|
+
}[]>;
|
|
70
|
+
allItemsWithColors: import('vue').ComputedRef<{
|
|
71
|
+
color: string;
|
|
72
|
+
label: string;
|
|
73
|
+
value: number;
|
|
74
|
+
}[]>;
|
|
75
|
+
valueMinWidth: import('vue').ComputedRef<string>;
|
|
76
|
+
formatDisplayValue: (index: number) => string;
|
|
77
|
+
formatItemValue: (item: {
|
|
78
|
+
value: number;
|
|
79
|
+
}) => string;
|
|
80
|
+
formatOtherDisplayValue: () => string;
|
|
81
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
82
|
+
values: {
|
|
83
|
+
type: PropType<KvPieChartV2Item[]>;
|
|
84
|
+
default: () => any[];
|
|
85
|
+
};
|
|
86
|
+
unit: {
|
|
87
|
+
type: PropType<PieChartUnit>;
|
|
88
|
+
default: string;
|
|
89
|
+
validator: (value: string) => boolean;
|
|
90
|
+
};
|
|
91
|
+
loading: {
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
default: boolean;
|
|
94
|
+
};
|
|
95
|
+
shownSegments: {
|
|
96
|
+
type: NumberConstructor;
|
|
97
|
+
default: number;
|
|
98
|
+
};
|
|
99
|
+
strokeWidth: {
|
|
100
|
+
type: NumberConstructor;
|
|
101
|
+
default: number;
|
|
102
|
+
};
|
|
103
|
+
segmentGap: {
|
|
104
|
+
type: NumberConstructor;
|
|
105
|
+
default: number;
|
|
106
|
+
};
|
|
107
|
+
initialDelay: {
|
|
108
|
+
type: NumberConstructor;
|
|
109
|
+
default: number;
|
|
110
|
+
};
|
|
111
|
+
animateOut: {
|
|
112
|
+
type: BooleanConstructor;
|
|
113
|
+
default: boolean;
|
|
114
|
+
};
|
|
115
|
+
}>> & Readonly<{}>, {
|
|
116
|
+
values: KvPieChartV2Item[];
|
|
117
|
+
loading: boolean;
|
|
118
|
+
unit: PieChartUnit;
|
|
119
|
+
shownSegments: number;
|
|
120
|
+
strokeWidth: number;
|
|
121
|
+
segmentGap: number;
|
|
122
|
+
initialDelay: number;
|
|
123
|
+
animateOut: boolean;
|
|
124
|
+
}, {}, {
|
|
125
|
+
KvLightbox: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
126
|
+
blurBackground: {
|
|
127
|
+
type: BooleanConstructor;
|
|
128
|
+
default: boolean;
|
|
129
|
+
};
|
|
130
|
+
visible: {
|
|
131
|
+
type: BooleanConstructor;
|
|
132
|
+
default: boolean;
|
|
133
|
+
};
|
|
134
|
+
variant: {
|
|
135
|
+
type: StringConstructor;
|
|
136
|
+
default: string;
|
|
137
|
+
validator(value: string): boolean;
|
|
138
|
+
};
|
|
139
|
+
title: {
|
|
140
|
+
type: StringConstructor;
|
|
141
|
+
required: true;
|
|
142
|
+
};
|
|
143
|
+
preventClose: {
|
|
144
|
+
type: BooleanConstructor;
|
|
145
|
+
default: boolean;
|
|
146
|
+
};
|
|
147
|
+
}>, {
|
|
148
|
+
mdiClose: string;
|
|
149
|
+
role: import('vue').ComputedRef<"alertdialog" | "dialog">;
|
|
150
|
+
kvLightbox: import('vue').Ref<any, any>;
|
|
151
|
+
kvLightboxBody: import('vue').Ref<any, any>;
|
|
152
|
+
onKeyUp: any;
|
|
153
|
+
onScreenClick: () => void;
|
|
154
|
+
hide: (closedBy?: string) => void;
|
|
155
|
+
show: () => void;
|
|
156
|
+
controlsRef: import('vue').Ref<any, any>;
|
|
157
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "lightbox-closed"[], "lightbox-closed", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
158
|
+
blurBackground: {
|
|
159
|
+
type: BooleanConstructor;
|
|
160
|
+
default: boolean;
|
|
161
|
+
};
|
|
162
|
+
visible: {
|
|
163
|
+
type: BooleanConstructor;
|
|
164
|
+
default: boolean;
|
|
165
|
+
};
|
|
166
|
+
variant: {
|
|
167
|
+
type: StringConstructor;
|
|
168
|
+
default: string;
|
|
169
|
+
validator(value: string): boolean;
|
|
170
|
+
};
|
|
171
|
+
title: {
|
|
172
|
+
type: StringConstructor;
|
|
173
|
+
required: true;
|
|
174
|
+
};
|
|
175
|
+
preventClose: {
|
|
176
|
+
type: BooleanConstructor;
|
|
177
|
+
default: boolean;
|
|
178
|
+
};
|
|
179
|
+
}>> & Readonly<{
|
|
180
|
+
"onLightbox-closed"?: (...args: any[]) => any;
|
|
181
|
+
}>, {
|
|
182
|
+
variant: string;
|
|
183
|
+
visible: boolean;
|
|
184
|
+
preventClose: boolean;
|
|
185
|
+
blurBackground: boolean;
|
|
186
|
+
}, {}, {
|
|
187
|
+
KvMaterialIcon: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
188
|
+
icon: {
|
|
189
|
+
type: StringConstructor;
|
|
190
|
+
default: string;
|
|
191
|
+
};
|
|
192
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
193
|
+
icon: {
|
|
194
|
+
type: StringConstructor;
|
|
195
|
+
default: string;
|
|
196
|
+
};
|
|
197
|
+
}>> & Readonly<{}>, {
|
|
198
|
+
icon: string;
|
|
199
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
200
|
+
}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
201
|
+
}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
202
|
+
export default _default;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { toRefs as z, ref as I, computed as u, onMounted as J, watch as U, onUnmounted as Q } from "vue";
|
|
2
|
+
import { getPieChartColor as $, LOADING_BG_COLOR as Z, OTHER_SEGMENT_BG_COLOR as ee } from "../utils/pieChartColors.js";
|
|
3
|
+
import { easeInOutCubic as te } from "../utils/useCountUp.js";
|
|
4
|
+
import ae from "./KvLightbox.js";
|
|
5
|
+
const E = 262, le = E / 2, ne = E / 2, W = 500, ue = 500, ve = {
|
|
6
|
+
name: "KvPieChartV2",
|
|
7
|
+
components: {
|
|
8
|
+
KvLightbox: ae
|
|
9
|
+
},
|
|
10
|
+
props: {
|
|
11
|
+
/**
|
|
12
|
+
* Chart data items. Each must have a label and numeric value.
|
|
13
|
+
*/
|
|
14
|
+
values: {
|
|
15
|
+
type: Array,
|
|
16
|
+
default: () => []
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* How values are displayed in legend pills.
|
|
20
|
+
* @values percent, amount, count
|
|
21
|
+
*/
|
|
22
|
+
unit: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "percent",
|
|
25
|
+
validator: (g) => ["percent", "amount", "count"].includes(g)
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Shows a skeleton donut ring when true.
|
|
29
|
+
*/
|
|
30
|
+
loading: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Maximum number of visible segments before remaining items collapse into "Other".
|
|
36
|
+
*/
|
|
37
|
+
shownSegments: {
|
|
38
|
+
type: Number,
|
|
39
|
+
default: 5
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Donut ring thickness in SVG user units (viewBox is 262x262). The radius
|
|
43
|
+
* shrinks as this grows, so the outer edge always fits within the viewBox.
|
|
44
|
+
*/
|
|
45
|
+
strokeWidth: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 56
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Visual gap between adjacent segments, in SVG user units along the ring's
|
|
51
|
+
* circumference. Set to 0 for no gap.
|
|
52
|
+
*/
|
|
53
|
+
segmentGap: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 2
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Delay in milliseconds before the first segment starts animating in.
|
|
59
|
+
* Subsequent segments stagger from this baseline.
|
|
60
|
+
*/
|
|
61
|
+
initialDelay: {
|
|
62
|
+
type: Number,
|
|
63
|
+
default: 1e3
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* When changed from false to true, plays the reverse sweep-out animation.
|
|
67
|
+
*/
|
|
68
|
+
animateOut: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
setup(g) {
|
|
74
|
+
const {
|
|
75
|
+
values: A,
|
|
76
|
+
unit: m,
|
|
77
|
+
loading: M,
|
|
78
|
+
shownSegments: d,
|
|
79
|
+
strokeWidth: B,
|
|
80
|
+
segmentGap: T,
|
|
81
|
+
initialDelay: D,
|
|
82
|
+
animateOut: y
|
|
83
|
+
} = z(g), k = I(!1), c = I(!1), G = u(() => Math.max((E - B.value) / 2, 1)), b = u(() => 2 * Math.PI * G.value), h = u(() => [...A.value].sort((e, t) => t.value - e.value)), o = u(() => h.value.reduce((e, t) => e + t.value, 0)), O = u(() => A.value.length > 0), S = u(() => h.value.slice(0, d.value)), C = u(() => h.value.slice(d.value).map((t, n) => ({
|
|
84
|
+
...t,
|
|
85
|
+
color: $(d.value + n, t.color)
|
|
86
|
+
}))), q = u(() => h.value.map((e, t) => ({
|
|
87
|
+
...e,
|
|
88
|
+
color: $(t, e.color)
|
|
89
|
+
}))), w = u(() => C.value.reduce((e, t) => e + t.value, 0)), R = u(() => o.value > 0 ? w.value / o.value : 0), f = u(() => {
|
|
90
|
+
let e = 0;
|
|
91
|
+
return S.value.map((t, n) => {
|
|
92
|
+
const a = o.value > 0 ? t.value / o.value : 0, l = Math.max(a * b.value - T.value, 0), s = e * 360 - 90;
|
|
93
|
+
return e += a, {
|
|
94
|
+
label: t.label,
|
|
95
|
+
value: t.value,
|
|
96
|
+
percent: a,
|
|
97
|
+
color: $(n, t.color),
|
|
98
|
+
dashLength: l,
|
|
99
|
+
startDeg: s,
|
|
100
|
+
delay: D.value + n * W,
|
|
101
|
+
isVisible: c.value && !y.value
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}), v = u(() => {
|
|
105
|
+
if (C.value.length === 0) return null;
|
|
106
|
+
let e = 0;
|
|
107
|
+
S.value.forEach((l) => {
|
|
108
|
+
e += o.value > 0 ? l.value / o.value : 0;
|
|
109
|
+
});
|
|
110
|
+
const t = Math.max(R.value * b.value - T.value, 0), n = e * 360 - 90, a = S.value.length;
|
|
111
|
+
return {
|
|
112
|
+
label: "Other",
|
|
113
|
+
value: w.value,
|
|
114
|
+
percent: R.value,
|
|
115
|
+
color: "#C4C4C4",
|
|
116
|
+
dashLength: t,
|
|
117
|
+
startDeg: n,
|
|
118
|
+
delay: D.value + a * W,
|
|
119
|
+
isVisible: c.value && !y.value
|
|
120
|
+
};
|
|
121
|
+
}), r = I([]), p = [], i = [], V = (e) => m.value === "percent" ? Math.round(e.percent * 100) : e.value, _ = (e, t, n) => {
|
|
122
|
+
let a = null;
|
|
123
|
+
function l(s) {
|
|
124
|
+
a === null && (a = s);
|
|
125
|
+
const L = s - a, P = Math.min(L / ue, 1), Y = te(P), j = Math.round(t + (n - t) * Y);
|
|
126
|
+
r.value[e] = j, P < 1 && (i[e] = requestAnimationFrame(l));
|
|
127
|
+
}
|
|
128
|
+
i[e] = requestAnimationFrame(l);
|
|
129
|
+
}, x = (e = !1) => {
|
|
130
|
+
p.forEach(clearTimeout), p.length = 0, i.forEach(cancelAnimationFrame), i.length = 0;
|
|
131
|
+
const t = [
|
|
132
|
+
...f.value,
|
|
133
|
+
...v.value ? [v.value] : []
|
|
134
|
+
];
|
|
135
|
+
for (; r.value.length < t.length; )
|
|
136
|
+
r.value.push(0);
|
|
137
|
+
t.forEach((n, a) => {
|
|
138
|
+
const l = V(n), { delay: s } = n, L = setTimeout(() => {
|
|
139
|
+
e ? _(a, r.value[a], 0) : _(a, 0, l);
|
|
140
|
+
}, s);
|
|
141
|
+
p.push(L);
|
|
142
|
+
});
|
|
143
|
+
}, N = (e) => {
|
|
144
|
+
const t = r.value[e] ?? 0;
|
|
145
|
+
switch (m.value) {
|
|
146
|
+
case "percent":
|
|
147
|
+
return `${t}%`;
|
|
148
|
+
case "amount":
|
|
149
|
+
return `$${t.toLocaleString()}`;
|
|
150
|
+
case "count":
|
|
151
|
+
default:
|
|
152
|
+
return `${t.toLocaleString()}`;
|
|
153
|
+
}
|
|
154
|
+
}, K = (e) => {
|
|
155
|
+
const t = o.value > 0 ? e.value / o.value : 0;
|
|
156
|
+
switch (m.value) {
|
|
157
|
+
case "percent":
|
|
158
|
+
return `${Math.round(t * 100)}%`;
|
|
159
|
+
case "amount":
|
|
160
|
+
return `$${e.value.toLocaleString()}`;
|
|
161
|
+
case "count":
|
|
162
|
+
default:
|
|
163
|
+
return `${e.value.toLocaleString()}`;
|
|
164
|
+
}
|
|
165
|
+
}, X = () => {
|
|
166
|
+
const e = f.value.length;
|
|
167
|
+
return N(e);
|
|
168
|
+
}, H = u(() => {
|
|
169
|
+
const e = [
|
|
170
|
+
...f.value,
|
|
171
|
+
...v.value ? [v.value] : []
|
|
172
|
+
];
|
|
173
|
+
let t = 0;
|
|
174
|
+
return e.forEach((n) => {
|
|
175
|
+
const a = V(n);
|
|
176
|
+
let l;
|
|
177
|
+
switch (m.value) {
|
|
178
|
+
case "percent":
|
|
179
|
+
l = `${a}%`;
|
|
180
|
+
break;
|
|
181
|
+
case "amount":
|
|
182
|
+
l = `$${a.toLocaleString()}`;
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
l = `${a.toLocaleString()}`;
|
|
186
|
+
}
|
|
187
|
+
l.length > t && (t = l.length);
|
|
188
|
+
}), `${t}ch`;
|
|
189
|
+
}), F = () => {
|
|
190
|
+
requestAnimationFrame(() => {
|
|
191
|
+
requestAnimationFrame(() => {
|
|
192
|
+
c.value = !0, x(!1);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
return J(() => {
|
|
197
|
+
!M.value && O.value && F();
|
|
198
|
+
}), U(M, (e) => {
|
|
199
|
+
!e && O.value && F();
|
|
200
|
+
}), U(y, (e) => {
|
|
201
|
+
e && (c.value = !1, x(!0));
|
|
202
|
+
}), Q(() => {
|
|
203
|
+
p.forEach(clearTimeout), i.forEach(cancelAnimationFrame);
|
|
204
|
+
}), {
|
|
205
|
+
// Constants
|
|
206
|
+
CX: le,
|
|
207
|
+
CY: ne,
|
|
208
|
+
radius: G,
|
|
209
|
+
circumference: b,
|
|
210
|
+
LOADING_BG_COLOR: Z,
|
|
211
|
+
OTHER_SEGMENT_BG_COLOR: ee,
|
|
212
|
+
// State
|
|
213
|
+
showOtherLightbox: k,
|
|
214
|
+
animatedIn: c,
|
|
215
|
+
displayValues: r,
|
|
216
|
+
// Computed
|
|
217
|
+
hasData: O,
|
|
218
|
+
visibleSegments: f,
|
|
219
|
+
otherSegment: v,
|
|
220
|
+
otherItems: C,
|
|
221
|
+
allItemsWithColors: q,
|
|
222
|
+
valueMinWidth: H,
|
|
223
|
+
// Methods
|
|
224
|
+
formatDisplayValue: N,
|
|
225
|
+
formatItemValue: K,
|
|
226
|
+
formatOtherDisplayValue: X
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
export {
|
|
231
|
+
ve as default
|
|
232
|
+
};
|
|
@@ -64,9 +64,9 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
64
64
|
};
|
|
65
65
|
}>> & Readonly<{}>, {
|
|
66
66
|
color: string;
|
|
67
|
+
strokeWidth: number;
|
|
67
68
|
arcScale: number;
|
|
68
69
|
rotate: number;
|
|
69
|
-
strokeWidth: number;
|
|
70
70
|
showNumber: boolean;
|
|
71
71
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
72
72
|
export default _default;
|
package/dist/vue/KvTabPanel.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as a, createBlock as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return a(),
|
|
1
|
+
import o from "./KvTabPanel2.js";
|
|
2
|
+
import { openBlock as a, createBlock as l, Transition as r, withCtx as c, withDirectives as n, createElementBlock as s, renderSlot as d, vShow as v } from "vue";
|
|
3
|
+
import f from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const b = ["id", "aria-hidden", "aria-labelledby"];
|
|
5
|
+
function w(i, p, t, e, m, _) {
|
|
6
|
+
return a(), l(r, {
|
|
7
7
|
"enter-active-class": "tw-transition-opacity tw-duration-700",
|
|
8
8
|
"leave-active-class": "",
|
|
9
|
-
"enter-class": "tw-opacity-0 tw-absolute tw-top-0",
|
|
9
|
+
"enter-from-class": "tw-opacity-0 tw-absolute tw-top-0",
|
|
10
10
|
"enter-to-class": "tw-opacity-full",
|
|
11
|
-
"leave-class": "",
|
|
11
|
+
"leave-from-class": "",
|
|
12
12
|
"leave-to-class": "tw-opacity-0 tw-absolute tw-top-0"
|
|
13
13
|
}, {
|
|
14
|
-
default:
|
|
14
|
+
default: c(() => [
|
|
15
15
|
n((a(), s("div", {
|
|
16
16
|
id: `kv-tab-panel-${t.id}`,
|
|
17
17
|
key: `kv-tab-panel-${t.id}`,
|
|
@@ -21,14 +21,14 @@ function f(i, p, t, e, _, m) {
|
|
|
21
21
|
tabindex: "0"
|
|
22
22
|
}, [
|
|
23
23
|
d(i.$slots, "default")
|
|
24
|
-
], 8,
|
|
24
|
+
], 8, b)), [
|
|
25
25
|
[v, e.isActive]
|
|
26
26
|
])
|
|
27
27
|
]),
|
|
28
28
|
_: 3
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
const y = /* @__PURE__ */
|
|
31
|
+
const y = /* @__PURE__ */ f(o, [["render", w]]);
|
|
32
32
|
export {
|
|
33
33
|
y as default
|
|
34
34
|
};
|
package/dist/vue/KvTabs.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as
|
|
3
|
-
import
|
|
1
|
+
import w from "./KvTabs2.js";
|
|
2
|
+
import { openBlock as d, createElementBlock as s, normalizeClass as l, createElementVNode as o, renderSlot as i, normalizeStyle as m } from "vue";
|
|
3
|
+
import c from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
const f = { class: "tw-relative" };
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function v(a, r, e, t, b, g) {
|
|
6
|
+
return d(), s("div", {
|
|
7
7
|
class: l(e.vertical ? "md:tw-flex" : "")
|
|
8
8
|
}, [
|
|
9
|
-
|
|
9
|
+
o("div", {
|
|
10
10
|
role: "tablist",
|
|
11
11
|
class: l(["tw-flex tw-overflow-auto tw-relative tw-gap-x-2.5 md:tw-gap-x-5 lg:tw-gap-x-6 tw-mb-3 lg:tw-mb-4", { "md:tw-flex-col md:tw-mr-3": e.vertical }]),
|
|
12
12
|
onKeydown: r[0] || (r[0] = (n) => t.handleKeyDown(n))
|
|
13
13
|
}, [
|
|
14
|
-
i(
|
|
15
|
-
|
|
14
|
+
i(a.$slots, "tabNav"),
|
|
15
|
+
o("div", {
|
|
16
16
|
class: l(["tw-absolute tw-bottom-0 tw-h-0.5 tw-left-0 tw-bg-primary-inverse tw-rounded-full tw-origin-left tw-transition-all tw-duration-300", { "tw-hidden md:tw-block tw-top-0 md:tw-bg-action": e.vertical }]),
|
|
17
|
-
style:
|
|
18
|
-
width: ${t.
|
|
19
|
-
height: ${t.
|
|
20
|
-
transform: ${t.
|
|
17
|
+
style: m(`
|
|
18
|
+
width: ${t.indicatorStyle.width}px;
|
|
19
|
+
height: ${t.indicatorStyle.height};
|
|
20
|
+
transform: ${t.indicatorStyle.transform};
|
|
21
21
|
`)
|
|
22
22
|
}, null, 6)
|
|
23
23
|
], 34),
|
|
24
|
-
|
|
25
|
-
i(
|
|
24
|
+
o("div", f, [
|
|
25
|
+
i(a.$slots, "tabPanels")
|
|
26
26
|
])
|
|
27
27
|
], 2);
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const p = /* @__PURE__ */ c(w, [["render", v]]);
|
|
30
30
|
export {
|
|
31
|
-
|
|
31
|
+
p as default
|
|
32
32
|
};
|
package/dist/vue/KvTabs.vue.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { ComponentPublicInstance } from 'vue';
|
|
2
|
+
interface TabNavItem extends ComponentPublicInstance {
|
|
3
|
+
forPanel?: string;
|
|
4
|
+
isActive?: boolean;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface TabContext {
|
|
8
|
+
selectedIndex: number;
|
|
9
|
+
setTab: ((index: number) => void) | null;
|
|
10
|
+
navItems: TabNavItem[];
|
|
11
|
+
}
|
|
1
12
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
13
|
vertical: {
|
|
3
14
|
type: BooleanConstructor;
|
|
@@ -5,12 +16,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
5
16
|
};
|
|
6
17
|
}>, {
|
|
7
18
|
handleKeyDown: (event: any) => void;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
navItems: any[];
|
|
19
|
+
indicatorStyle: {
|
|
20
|
+
width: number;
|
|
21
|
+
height: string;
|
|
22
|
+
transform: string;
|
|
13
23
|
};
|
|
24
|
+
tabContext: TabContext;
|
|
14
25
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
15
26
|
vertical: {
|
|
16
27
|
type: BooleanConstructor;
|
package/dist/vue/KvTabs2.js
CHANGED
|
@@ -1,60 +1,70 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
const
|
|
1
|
+
import { reactive as h, ref as x, computed as I, provide as T, watch as g, nextTick as y, onMounted as k, onBeforeUnmount as $ } from "vue";
|
|
2
|
+
const E = {
|
|
3
3
|
props: {
|
|
4
4
|
vertical: {
|
|
5
5
|
type: Boolean,
|
|
6
6
|
default: !1
|
|
7
7
|
}
|
|
8
8
|
},
|
|
9
|
-
setup(
|
|
10
|
-
const t =
|
|
9
|
+
setup(p, { emit: b }) {
|
|
10
|
+
const t = h({
|
|
11
11
|
selectedIndex: 0,
|
|
12
12
|
setTab: null,
|
|
13
13
|
navItems: []
|
|
14
|
-
}),
|
|
15
|
-
var
|
|
14
|
+
}), i = x(null), r = I(() => {
|
|
15
|
+
var l;
|
|
16
16
|
const { navItems: e, selectedIndex: o } = t;
|
|
17
|
-
return ((
|
|
18
|
-
}),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
return ((l = e[o]) == null ? void 0 : l.$el) ?? null;
|
|
18
|
+
}), n = h({
|
|
19
|
+
width: 3,
|
|
20
|
+
height: "0.25rem",
|
|
21
|
+
transform: ""
|
|
22
|
+
}), c = () => {
|
|
23
|
+
const e = r.value;
|
|
24
|
+
e && (p.vertical ? (n.width = 3, n.height = `${e.clientHeight}px`, n.transform = `translateY(${e.offsetTop}px)`) : (n.width = e.clientWidth, n.height = "0.25rem", n.transform = `translateX(${e.offsetLeft}px)`));
|
|
25
|
+
}, s = (e) => {
|
|
26
|
+
t.selectedIndex = e, r.value.scrollIntoView({ behavior: "smooth", block: "nearest" }), b("tab-changed", e);
|
|
23
27
|
};
|
|
24
|
-
t.setTab =
|
|
25
|
-
const
|
|
26
|
-
const { navItems: o, selectedIndex:
|
|
27
|
-
var
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
},
|
|
28
|
+
t.setTab = s, T("$KvTabContext", t);
|
|
29
|
+
const m = (e) => {
|
|
30
|
+
const { navItems: o, selectedIndex: l } = t, d = () => {
|
|
31
|
+
var v;
|
|
32
|
+
const a = o.find((w) => w.isActive);
|
|
33
|
+
a && ((v = a.$el) == null || v.focus());
|
|
34
|
+
}, f = o.length;
|
|
31
35
|
if (e.key === "ArrowRight") {
|
|
32
36
|
e.preventDefault();
|
|
33
|
-
const
|
|
34
|
-
|
|
37
|
+
const a = (l + 1) % f;
|
|
38
|
+
s(a), d();
|
|
35
39
|
}
|
|
36
40
|
if (e.key === "ArrowLeft") {
|
|
37
41
|
e.preventDefault();
|
|
38
|
-
const
|
|
39
|
-
|
|
42
|
+
const a = (l - 1 + f) % f;
|
|
43
|
+
s(a), d();
|
|
40
44
|
}
|
|
41
|
-
e.key === "Home" && (e.preventDefault(),
|
|
45
|
+
e.key === "Home" && (e.preventDefault(), s(0), d()), e.key === "End" && (e.preventDefault(), s(f - 1), d());
|
|
46
|
+
}, u = () => {
|
|
47
|
+
var e;
|
|
48
|
+
(e = i.value) == null || e.disconnect(), r.value && (i.value = new ResizeObserver(() => {
|
|
49
|
+
c();
|
|
50
|
+
}), i.value.observe(r.value));
|
|
42
51
|
};
|
|
43
|
-
return
|
|
52
|
+
return g(r, () => {
|
|
53
|
+
u(), y(c);
|
|
54
|
+
}), k(() => {
|
|
44
55
|
t.navItems.forEach((e, o) => {
|
|
45
|
-
e.selected &&
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
l.value.disconnect();
|
|
56
|
+
e.selected && s(o);
|
|
57
|
+
}), c(), u(), window.addEventListener("resize", c);
|
|
58
|
+
}), $(() => {
|
|
59
|
+
var e;
|
|
60
|
+
(e = i.value) == null || e.disconnect(), window.removeEventListener("resize", c);
|
|
51
61
|
}), {
|
|
52
|
-
handleKeyDown:
|
|
53
|
-
|
|
62
|
+
handleKeyDown: m,
|
|
63
|
+
indicatorStyle: n,
|
|
54
64
|
tabContext: t
|
|
55
65
|
};
|
|
56
66
|
}
|
|
57
67
|
};
|
|
58
68
|
export {
|
|
59
|
-
|
|
69
|
+
E as default
|
|
60
70
|
};
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export { default as KvMaterialIcon } from './KvMaterialIcon.vue';
|
|
|
58
58
|
export { default as KvPageContainer } from './KvPageContainer.vue';
|
|
59
59
|
export { default as KvPagination } from './KvPagination.vue';
|
|
60
60
|
export { default as KvPieChart } from './KvPieChart.vue';
|
|
61
|
+
export { default as KvPieChartV2 } from './KvPieChartV2.vue';
|
|
61
62
|
export { default as KvPill } from './KvPill.vue';
|
|
62
63
|
export { default as KvPopper } from './KvPopper.vue';
|
|
63
64
|
export { default as KvProgressBar } from './KvProgressBar.vue';
|