@nova-kits/components 1.0.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/LICENSE +21 -0
- package/dist/Layout/Layout.vue.d.ts +39 -0
- package/dist/Layout/LayoutContent.vue.d.ts +35 -0
- package/dist/Layout/LayoutPortal.vue.d.ts +16 -0
- package/dist/Layout/LayoutTabs.vue.d.ts +49 -0
- package/dist/Layout/composables/useLayoutContext.d.ts +12 -0
- package/dist/Layout/index.d.ts +12 -0
- package/dist/constants.d.ts +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +301 -0
- package/dist/index.umd.cjs +1 -0
- package/dist/style.css +1 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 floral-rice
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ClassValue, type StyleValue } from 'vue';
|
|
2
|
+
export interface LayoutProps {
|
|
3
|
+
defaultSidebarWidth?: number;
|
|
4
|
+
collapsed?: boolean;
|
|
5
|
+
activeKey?: string;
|
|
6
|
+
class?: ClassValue;
|
|
7
|
+
style?: StyleValue;
|
|
8
|
+
}
|
|
9
|
+
declare var __VLS_1: {}, __VLS_13: {}, __VLS_15: {}, __VLS_17: {};
|
|
10
|
+
type __VLS_Slots = {} & {
|
|
11
|
+
header?: (props: typeof __VLS_1) => any;
|
|
12
|
+
} & {
|
|
13
|
+
left?: (props: typeof __VLS_13) => any;
|
|
14
|
+
} & {
|
|
15
|
+
default?: (props: typeof __VLS_15) => any;
|
|
16
|
+
} & {
|
|
17
|
+
footer?: (props: typeof __VLS_17) => any;
|
|
18
|
+
};
|
|
19
|
+
declare const __VLS_base: import("vue").DefineComponent<LayoutProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
+
"update:collapsed": (value: boolean) => any;
|
|
21
|
+
collapse: (value: boolean) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<LayoutProps> & Readonly<{
|
|
23
|
+
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
onCollapse?: ((value: boolean) => any) | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
defaultSidebarWidth: number;
|
|
27
|
+
collapsed: boolean;
|
|
28
|
+
style: string | false | import("vue").CSSProperties | StyleValue[] | null;
|
|
29
|
+
class: string | false | Record<string, any> | ClassValue[] | null;
|
|
30
|
+
activeKey: string;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import 'splitpanes/dist/splitpanes.css';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
defaultSidebarWidth?: number;
|
|
4
|
+
collapsed?: boolean;
|
|
5
|
+
containerWidth?: number;
|
|
6
|
+
};
|
|
7
|
+
declare var __VLS_15: {}, __VLS_23: {}, __VLS_25: {};
|
|
8
|
+
type __VLS_Slots = {} & {
|
|
9
|
+
left?: (props: typeof __VLS_15) => any;
|
|
10
|
+
} & {
|
|
11
|
+
default?: (props: typeof __VLS_23) => any;
|
|
12
|
+
} & {
|
|
13
|
+
default?: (props: typeof __VLS_25) => any;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
"update:sidebarWidth": (value: number) => any;
|
|
17
|
+
"update:collapsed": (value: boolean) => any;
|
|
18
|
+
collapse: (value: boolean) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
"onUpdate:sidebarWidth"?: ((value: number) => any) | undefined;
|
|
21
|
+
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
22
|
+
onCollapse?: ((value: boolean) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
defaultSidebarWidth: number;
|
|
25
|
+
collapsed: boolean;
|
|
26
|
+
containerWidth: number;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
to: 'header' | 'footer';
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_7: {};
|
|
5
|
+
type __VLS_Slots = {} & {
|
|
6
|
+
default?: (props: typeof __VLS_7) => any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ClassValue, type StyleValue } from 'vue';
|
|
2
|
+
export interface Tab {
|
|
3
|
+
label?: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LayoutTabsProps {
|
|
7
|
+
tabs?: Tab[];
|
|
8
|
+
activeKey?: string;
|
|
9
|
+
defaultSidebarWidth?: number;
|
|
10
|
+
collapsed?: boolean;
|
|
11
|
+
class?: ClassValue;
|
|
12
|
+
style?: StyleValue;
|
|
13
|
+
}
|
|
14
|
+
declare var __VLS_1: {}, __VLS_27: {}, __VLS_30: string, __VLS_31: {}, __VLS_33: {};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
[K in NonNullable<typeof __VLS_30>]?: (props: typeof __VLS_31) => any;
|
|
17
|
+
} & {
|
|
18
|
+
header?: (props: typeof __VLS_1) => any;
|
|
19
|
+
} & {
|
|
20
|
+
left?: (props: typeof __VLS_27) => any;
|
|
21
|
+
} & {
|
|
22
|
+
footer?: (props: typeof __VLS_33) => any;
|
|
23
|
+
};
|
|
24
|
+
declare const __VLS_base: import("vue").DefineComponent<LayoutTabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
"update:collapsed": (value: boolean) => any;
|
|
26
|
+
collapse: (value: boolean) => any;
|
|
27
|
+
"update:activeKey": (value: string) => any;
|
|
28
|
+
"tab-click": (key: string) => any;
|
|
29
|
+
}, string, import("vue").PublicProps, Readonly<LayoutTabsProps> & Readonly<{
|
|
30
|
+
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
31
|
+
onCollapse?: ((value: boolean) => any) | undefined;
|
|
32
|
+
"onUpdate:activeKey"?: ((value: string) => any) | undefined;
|
|
33
|
+
"onTab-click"?: ((key: string) => any) | undefined;
|
|
34
|
+
}>, {
|
|
35
|
+
defaultSidebarWidth: number;
|
|
36
|
+
collapsed: boolean;
|
|
37
|
+
style: string | false | import("vue").CSSProperties | StyleValue[] | null;
|
|
38
|
+
class: string | false | Record<string, any> | ClassValue[] | null;
|
|
39
|
+
activeKey: string;
|
|
40
|
+
tabs: Tab[];
|
|
41
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
|
+
declare const _default: typeof __VLS_export;
|
|
44
|
+
export default _default;
|
|
45
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
+
new (): {
|
|
47
|
+
$slots: S;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue';
|
|
2
|
+
export interface LayoutContext {
|
|
3
|
+
teleportIds: {
|
|
4
|
+
header: string;
|
|
5
|
+
footer: string;
|
|
6
|
+
};
|
|
7
|
+
activeKey: Ref<string | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export declare const LAYOUT_CONTEXT_KEY: InjectionKey<LayoutContext>;
|
|
10
|
+
export declare function useLayoutContext(): LayoutContext | null;
|
|
11
|
+
export declare function provideLayoutContext(context: LayoutContext): void;
|
|
12
|
+
export declare function useTabFocus(key: string): import("vue").ComputedRef<boolean>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as NLayout } from './Layout.vue';
|
|
2
|
+
export { default as NLayoutTabs } from './LayoutTabs.vue';
|
|
3
|
+
export { default as NLayoutPortal } from './LayoutPortal.vue';
|
|
4
|
+
export { default as NLayoutContent } from './LayoutContent.vue';
|
|
5
|
+
export { useTabFocus } from './composables/useLayoutContext';
|
|
6
|
+
import _NLayout from './Layout.vue';
|
|
7
|
+
import _NLayoutTabs from './LayoutTabs.vue';
|
|
8
|
+
import _NLayoutPortal from './LayoutPortal.vue';
|
|
9
|
+
export declare const NLayoutWithSub: typeof _NLayout & {
|
|
10
|
+
Tabs: typeof _NLayoutTabs;
|
|
11
|
+
Portal: typeof _NLayoutPortal;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PREFIX_CLS = "nova";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
export * from 'element-plus';
|
|
3
|
+
import 'element-plus/dist/index.css';
|
|
4
|
+
import './styles/scrollbar.scss';
|
|
5
|
+
export { NLayoutWithSub as NLayout, NLayoutTabs, NLayoutPortal, useTabFocus } from './Layout/index';
|
|
6
|
+
export declare function install(app: App): void;
|
|
7
|
+
declare const _default: {
|
|
8
|
+
install: typeof install;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import V, { ElTabs as M, ElTabPane as U } from "element-plus";
|
|
2
|
+
export * from "element-plus";
|
|
3
|
+
import { defineComponent as S, ref as F, computed as h, openBlock as i, createElementBlock as y, normalizeClass as n, unref as l, createBlock as N, withCtx as m, createVNode as L, createElementVNode as f, renderSlot as c, createCommentVNode as $, provide as R, inject as X, useId as w, normalizeStyle as I, createSlots as B, Fragment as Y, renderList as q, Teleport as D } from "vue";
|
|
4
|
+
import { Splitpanes as G, Pane as T } from "splitpanes";
|
|
5
|
+
const H = "nova";
|
|
6
|
+
function W(e) {
|
|
7
|
+
return (a) => `${H}-${e}` + (a ? `-${a}` : "");
|
|
8
|
+
}
|
|
9
|
+
const J = /* @__PURE__ */ S({
|
|
10
|
+
__name: "LayoutContent",
|
|
11
|
+
props: {
|
|
12
|
+
defaultSidebarWidth: { default: 242 },
|
|
13
|
+
collapsed: { type: Boolean, default: !1 },
|
|
14
|
+
containerWidth: { default: 1e3 }
|
|
15
|
+
},
|
|
16
|
+
emits: ["update:sidebarWidth", "update:collapsed", "collapse"],
|
|
17
|
+
setup(e, { emit: a }) {
|
|
18
|
+
const t = W("layout"), s = e, r = a, d = F(s.defaultSidebarWidth), v = h(() => Math.min(50, Math.max(10, d.value / s.containerWidth * 100)));
|
|
19
|
+
function b(o) {
|
|
20
|
+
if (s.collapsed) return;
|
|
21
|
+
const u = o.panes[0].size, p = Math.round(u / 100 * s.containerWidth);
|
|
22
|
+
d.value = p, r("update:sidebarWidth", p);
|
|
23
|
+
}
|
|
24
|
+
function k() {
|
|
25
|
+
const o = !s.collapsed;
|
|
26
|
+
r("update:collapsed", o), r("collapse", o);
|
|
27
|
+
}
|
|
28
|
+
return (o, u) => (i(), y("div", {
|
|
29
|
+
class: n([l(t)("content-wrapper")])
|
|
30
|
+
}, [
|
|
31
|
+
o.$slots.left ? (i(), N(l(G), {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: n(["default-theme", [l(t)("splitpanes")]]),
|
|
34
|
+
onResize: b
|
|
35
|
+
}, {
|
|
36
|
+
default: m(() => [
|
|
37
|
+
L(l(T), {
|
|
38
|
+
size: e.collapsed ? 0 : v.value,
|
|
39
|
+
"min-size": e.collapsed ? 0 : 10,
|
|
40
|
+
"max-size": e.collapsed ? 0 : 50,
|
|
41
|
+
class: n([l(t)("left"), { [l(t)("left-collapsed")]: e.collapsed }])
|
|
42
|
+
}, {
|
|
43
|
+
default: m(() => [
|
|
44
|
+
f("div", {
|
|
45
|
+
class: n([l(t)("left-body")])
|
|
46
|
+
}, [
|
|
47
|
+
c(o.$slots, "left", {}, void 0, !0)
|
|
48
|
+
], 2)
|
|
49
|
+
]),
|
|
50
|
+
_: 3
|
|
51
|
+
}, 8, ["size", "min-size", "max-size", "class"]),
|
|
52
|
+
L(l(T), {
|
|
53
|
+
size: e.collapsed ? 100 : 100 - v.value
|
|
54
|
+
}, {
|
|
55
|
+
default: m(() => [
|
|
56
|
+
f("div", {
|
|
57
|
+
class: n([l(t)("content")])
|
|
58
|
+
}, [
|
|
59
|
+
f("div", {
|
|
60
|
+
class: n([l(t)("content-scroll")])
|
|
61
|
+
}, [
|
|
62
|
+
c(o.$slots, "default", {}, void 0, !0)
|
|
63
|
+
], 2)
|
|
64
|
+
], 2)
|
|
65
|
+
]),
|
|
66
|
+
_: 3
|
|
67
|
+
}, 8, ["size"])
|
|
68
|
+
]),
|
|
69
|
+
_: 3
|
|
70
|
+
}, 8, ["class"])) : (i(), y("div", {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: n([l(t)("content")])
|
|
73
|
+
}, [
|
|
74
|
+
f("div", {
|
|
75
|
+
class: n([l(t)("content-scroll")])
|
|
76
|
+
}, [
|
|
77
|
+
c(o.$slots, "default", {}, void 0, !0)
|
|
78
|
+
], 2)
|
|
79
|
+
], 2)),
|
|
80
|
+
o.$slots.left ? (i(), y("div", {
|
|
81
|
+
key: 2,
|
|
82
|
+
class: n([l(t)("left-collapse-btn"), { [l(t)("left-collapse-btn-collapsed")]: e.collapsed }]),
|
|
83
|
+
onClick: k
|
|
84
|
+
}, [...u[0] || (u[0] = [
|
|
85
|
+
f("svg", {
|
|
86
|
+
width: "12",
|
|
87
|
+
height: "12",
|
|
88
|
+
viewBox: "0 0 12 12",
|
|
89
|
+
fill: "none"
|
|
90
|
+
}, [
|
|
91
|
+
f("path", {
|
|
92
|
+
d: "M8 1L4 6L8 11",
|
|
93
|
+
stroke: "currentColor",
|
|
94
|
+
"stroke-width": "1.5",
|
|
95
|
+
"stroke-linecap": "round",
|
|
96
|
+
"stroke-linejoin": "round"
|
|
97
|
+
})
|
|
98
|
+
], -1)
|
|
99
|
+
])], 2)) : $("", !0)
|
|
100
|
+
], 2));
|
|
101
|
+
}
|
|
102
|
+
}), g = (e, a) => {
|
|
103
|
+
const t = e.__vccOpts || e;
|
|
104
|
+
for (const [s, r] of a)
|
|
105
|
+
t[s] = r;
|
|
106
|
+
return t;
|
|
107
|
+
}, K = /* @__PURE__ */ g(J, [["__scopeId", "data-v-a8a5b082"]]), P = /* @__PURE__ */ Symbol("layout-context");
|
|
108
|
+
function E() {
|
|
109
|
+
return X(P, null);
|
|
110
|
+
}
|
|
111
|
+
function O(e) {
|
|
112
|
+
R(P, e);
|
|
113
|
+
}
|
|
114
|
+
function ne(e) {
|
|
115
|
+
const a = E();
|
|
116
|
+
return a ? h(() => a.activeKey.value === e) : h(() => !0);
|
|
117
|
+
}
|
|
118
|
+
const Q = ["id"], Z = ["id"], x = /* @__PURE__ */ S({
|
|
119
|
+
__name: "Layout",
|
|
120
|
+
props: {
|
|
121
|
+
defaultSidebarWidth: { default: 242 },
|
|
122
|
+
collapsed: { type: Boolean, default: !1 },
|
|
123
|
+
activeKey: { default: void 0 },
|
|
124
|
+
class: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
125
|
+
style: { type: [Boolean, null, String, Object, Array], default: void 0 }
|
|
126
|
+
},
|
|
127
|
+
emits: ["update:collapsed", "collapse"],
|
|
128
|
+
setup(e) {
|
|
129
|
+
const a = W("layout"), t = e, s = w(), r = {
|
|
130
|
+
header: `nova-layout-header-${s}`,
|
|
131
|
+
footer: `nova-layout-footer-${s}`
|
|
132
|
+
};
|
|
133
|
+
return O({
|
|
134
|
+
teleportIds: r,
|
|
135
|
+
activeKey: h(() => t.activeKey)
|
|
136
|
+
}), (d, v) => (i(), y("div", {
|
|
137
|
+
class: n([l(a)(), t.class]),
|
|
138
|
+
style: I(e.style)
|
|
139
|
+
}, [
|
|
140
|
+
d.$slots.header ? (i(), y("div", {
|
|
141
|
+
key: 0,
|
|
142
|
+
class: n([l(a)("header")])
|
|
143
|
+
}, [
|
|
144
|
+
c(d.$slots, "header", {}, void 0, !0),
|
|
145
|
+
f("div", {
|
|
146
|
+
id: r.header
|
|
147
|
+
}, null, 8, Q)
|
|
148
|
+
], 2)) : $("", !0),
|
|
149
|
+
L(K, {
|
|
150
|
+
"default-sidebar-width": e.defaultSidebarWidth,
|
|
151
|
+
collapsed: e.collapsed,
|
|
152
|
+
"onUpdate:collapsed": v[0] || (v[0] = (b) => d.$emit("update:collapsed", b)),
|
|
153
|
+
onCollapse: v[1] || (v[1] = (b) => d.$emit("collapse", b))
|
|
154
|
+
}, B({
|
|
155
|
+
default: m(() => [
|
|
156
|
+
c(d.$slots, "default", {}, void 0, !0)
|
|
157
|
+
]),
|
|
158
|
+
_: 2
|
|
159
|
+
}, [
|
|
160
|
+
d.$slots.left ? {
|
|
161
|
+
name: "left",
|
|
162
|
+
fn: m(() => [
|
|
163
|
+
c(d.$slots, "left", {}, void 0, !0)
|
|
164
|
+
]),
|
|
165
|
+
key: "0"
|
|
166
|
+
} : void 0
|
|
167
|
+
]), 1032, ["default-sidebar-width", "collapsed"]),
|
|
168
|
+
d.$slots.footer ? (i(), y("div", {
|
|
169
|
+
key: 1,
|
|
170
|
+
class: n([l(a)("footer")])
|
|
171
|
+
}, [
|
|
172
|
+
c(d.$slots, "footer", {}, void 0, !0),
|
|
173
|
+
f("div", {
|
|
174
|
+
id: r.footer
|
|
175
|
+
}, null, 8, Z)
|
|
176
|
+
], 2)) : $("", !0)
|
|
177
|
+
], 6));
|
|
178
|
+
}
|
|
179
|
+
}), _ = /* @__PURE__ */ g(x, [["__scopeId", "data-v-c90dad87"]]), ee = ["id"], te = ["id"], oe = /* @__PURE__ */ S({
|
|
180
|
+
__name: "LayoutTabs",
|
|
181
|
+
props: {
|
|
182
|
+
tabs: { default: () => [] },
|
|
183
|
+
activeKey: { default: void 0 },
|
|
184
|
+
defaultSidebarWidth: { default: 242 },
|
|
185
|
+
collapsed: { type: Boolean, default: !1 },
|
|
186
|
+
class: { type: [Boolean, null, String, Object, Array], default: void 0 },
|
|
187
|
+
style: { type: [Boolean, null, String, Object, Array], default: void 0 }
|
|
188
|
+
},
|
|
189
|
+
emits: ["update:activeKey", "update:collapsed", "tab-click", "collapse"],
|
|
190
|
+
setup(e, { emit: a }) {
|
|
191
|
+
const t = W("layout"), s = e, r = a, d = h({
|
|
192
|
+
get: () => s.activeKey ?? s.tabs[0]?.key,
|
|
193
|
+
set: (o) => r("update:activeKey", o)
|
|
194
|
+
});
|
|
195
|
+
function v(o, u) {
|
|
196
|
+
r("tab-click", String(o.paneName ?? ""));
|
|
197
|
+
}
|
|
198
|
+
const b = w(), k = {
|
|
199
|
+
header: `nova-layout-header-${b}`,
|
|
200
|
+
footer: `nova-layout-footer-${b}`
|
|
201
|
+
};
|
|
202
|
+
return O({
|
|
203
|
+
teleportIds: k,
|
|
204
|
+
activeKey: d
|
|
205
|
+
}), (o, u) => (i(), y("div", {
|
|
206
|
+
class: n([l(t)("tabs-layout"), s.class]),
|
|
207
|
+
style: I(e.style)
|
|
208
|
+
}, [
|
|
209
|
+
o.$slots.header ? (i(), y("div", {
|
|
210
|
+
key: 0,
|
|
211
|
+
class: n([l(t)("header")])
|
|
212
|
+
}, [
|
|
213
|
+
c(o.$slots, "header", {}, void 0, !0),
|
|
214
|
+
f("div", {
|
|
215
|
+
id: k.header
|
|
216
|
+
}, null, 8, ee)
|
|
217
|
+
], 2)) : $("", !0),
|
|
218
|
+
f("div", {
|
|
219
|
+
class: n([l(t)("tabs-wrapper")])
|
|
220
|
+
}, [
|
|
221
|
+
L(l(M), {
|
|
222
|
+
modelValue: d.value,
|
|
223
|
+
"onUpdate:modelValue": u[2] || (u[2] = (p) => d.value = p),
|
|
224
|
+
class: n(l(t)("tabs")),
|
|
225
|
+
onTabClick: v
|
|
226
|
+
}, {
|
|
227
|
+
default: m(() => [
|
|
228
|
+
(i(!0), y(Y, null, q(e.tabs, (p) => (i(), N(l(U), {
|
|
229
|
+
key: p.key,
|
|
230
|
+
label: p.label || p.key,
|
|
231
|
+
name: p.key
|
|
232
|
+
}, {
|
|
233
|
+
default: m(() => [
|
|
234
|
+
L(K, {
|
|
235
|
+
"default-sidebar-width": e.defaultSidebarWidth,
|
|
236
|
+
collapsed: e.collapsed,
|
|
237
|
+
"onUpdate:collapsed": u[0] || (u[0] = (C) => o.$emit("update:collapsed", C)),
|
|
238
|
+
onCollapse: u[1] || (u[1] = (C) => o.$emit("collapse", C))
|
|
239
|
+
}, B({
|
|
240
|
+
default: m(() => [
|
|
241
|
+
c(o.$slots, p.key, {}, void 0, !0)
|
|
242
|
+
]),
|
|
243
|
+
_: 2
|
|
244
|
+
}, [
|
|
245
|
+
o.$slots.left ? {
|
|
246
|
+
name: "left",
|
|
247
|
+
fn: m(() => [
|
|
248
|
+
c(o.$slots, "left", {}, void 0, !0)
|
|
249
|
+
]),
|
|
250
|
+
key: "0"
|
|
251
|
+
} : void 0
|
|
252
|
+
]), 1032, ["default-sidebar-width", "collapsed"])
|
|
253
|
+
]),
|
|
254
|
+
_: 2
|
|
255
|
+
}, 1032, ["label", "name"]))), 128))
|
|
256
|
+
]),
|
|
257
|
+
_: 3
|
|
258
|
+
}, 8, ["modelValue", "class"])
|
|
259
|
+
], 2),
|
|
260
|
+
o.$slots.footer ? (i(), y("div", {
|
|
261
|
+
key: 1,
|
|
262
|
+
class: n([l(t)("footer")])
|
|
263
|
+
}, [
|
|
264
|
+
c(o.$slots, "footer", {}, void 0, !0),
|
|
265
|
+
f("div", {
|
|
266
|
+
id: k.footer
|
|
267
|
+
}, null, 8, te)
|
|
268
|
+
], 2)) : $("", !0)
|
|
269
|
+
], 6));
|
|
270
|
+
}
|
|
271
|
+
}), j = /* @__PURE__ */ g(oe, [["__scopeId", "data-v-12d97b4e"]]), A = /* @__PURE__ */ S({
|
|
272
|
+
__name: "LayoutPortal",
|
|
273
|
+
props: {
|
|
274
|
+
to: {}
|
|
275
|
+
},
|
|
276
|
+
setup(e) {
|
|
277
|
+
const a = e, t = E(), s = h(() => t ? a.to === "header" ? t.teleportIds.header : t.teleportIds.footer : null);
|
|
278
|
+
return (r, d) => s.value ? (i(), N(D, {
|
|
279
|
+
key: 0,
|
|
280
|
+
to: `#${s.value}`
|
|
281
|
+
}, [
|
|
282
|
+
c(r.$slots, "default")
|
|
283
|
+
], 8, ["to"])) : $("", !0);
|
|
284
|
+
}
|
|
285
|
+
}), z = _;
|
|
286
|
+
z.Tabs = j;
|
|
287
|
+
z.Portal = A;
|
|
288
|
+
function le(e) {
|
|
289
|
+
e.component("NLayout", z), e.component("NLayoutTabs", j), e.component("NLayoutPortal", A), e.use(V);
|
|
290
|
+
}
|
|
291
|
+
const re = {
|
|
292
|
+
install: le
|
|
293
|
+
};
|
|
294
|
+
export {
|
|
295
|
+
z as NLayout,
|
|
296
|
+
A as NLayoutPortal,
|
|
297
|
+
j as NLayoutTabs,
|
|
298
|
+
re as default,
|
|
299
|
+
le as install,
|
|
300
|
+
ne as useTabFocus
|
|
301
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(r,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("element-plus"),require("vue"),require("splitpanes")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue","splitpanes"],f):(r=typeof globalThis<"u"?globalThis:r||self,f(r.NovaKits={},r.ElementPlus,r.Vue,r.splitpanes))})(this,(function(r,f,e,h){"use strict";const w="nova";function C(t){return a=>`${w}-${t}`+(a?`-${a}`:"")}const L=e.defineComponent({__name:"LayoutContent",props:{defaultSidebarWidth:{default:242},collapsed:{type:Boolean,default:!1},containerWidth:{default:1e3}},emits:["update:sidebarWidth","update:collapsed","collapse"],setup(t,{emit:a}){const o=C("layout"),n=t,d=a,s=e.ref(n.defaultSidebarWidth),p=e.computed(()=>Math.min(50,Math.max(10,s.value/n.containerWidth*100)));function m(l){if(n.collapsed)return;const i=l.panes[0].size,c=Math.round(i/100*n.containerWidth);s.value=c,d("update:sidebarWidth",c)}function y(){const l=!n.collapsed;d("update:collapsed",l),d("collapse",l)}return(l,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(o)("content-wrapper")])},[l.$slots.left?(e.openBlock(),e.createBlock(e.unref(h.Splitpanes),{key:0,class:e.normalizeClass(["default-theme",[e.unref(o)("splitpanes")]]),onResize:m},{default:e.withCtx(()=>[e.createVNode(e.unref(h.Pane),{size:t.collapsed?0:p.value,"min-size":t.collapsed?0:10,"max-size":t.collapsed?0:50,class:e.normalizeClass([e.unref(o)("left"),{[e.unref(o)("left-collapsed")]:t.collapsed}])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(o)("left-body")])},[e.renderSlot(l.$slots,"left",{},void 0,!0)],2)]),_:3},8,["size","min-size","max-size","class"]),e.createVNode(e.unref(h.Pane),{size:t.collapsed?100:100-p.value},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(o)("content")])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(o)("content-scroll")])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)],2)]),_:3},8,["size"])]),_:3},8,["class"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(o)("content")])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(o)("content-scroll")])},[e.renderSlot(l.$slots,"default",{},void 0,!0)],2)],2)),l.$slots.left?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass([e.unref(o)("left-collapse-btn"),{[e.unref(o)("left-collapse-btn-collapsed")]:t.collapsed}]),onClick:y},[...i[0]||(i[0]=[e.createElementVNode("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},[e.createElementVNode("path",{d:"M8 1L4 6L8 11",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])],2)):e.createCommentVNode("",!0)],2))}}),k=(t,a)=>{const o=t.__vccOpts||t;for(const[n,d]of a)o[n]=d;return o},S=k(L,[["__scopeId","data-v-a8a5b082"]]),B=Symbol("layout-context");function z(){return e.inject(B,null)}function V(t){e.provide(B,t)}function T(t){const a=z();return a?e.computed(()=>a.activeKey.value===t):e.computed(()=>!0)}const W=["id"],g=["id"],I=k(e.defineComponent({__name:"Layout",props:{defaultSidebarWidth:{default:242},collapsed:{type:Boolean,default:!1},activeKey:{default:void 0},class:{type:[Boolean,null,String,Object,Array],default:void 0},style:{type:[Boolean,null,String,Object,Array],default:void 0}},emits:["update:collapsed","collapse"],setup(t){const a=C("layout"),o=t,n=e.useId(),d={header:`nova-layout-header-${n}`,footer:`nova-layout-footer-${n}`};return V({teleportIds:d,activeKey:e.computed(()=>o.activeKey)}),(s,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(a)(),o.class]),style:e.normalizeStyle(t.style)},[s.$slots.header?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(a)("header")])},[e.renderSlot(s.$slots,"header",{},void 0,!0),e.createElementVNode("div",{id:d.header},null,8,W)],2)):e.createCommentVNode("",!0),e.createVNode(S,{"default-sidebar-width":t.defaultSidebarWidth,collapsed:t.collapsed,"onUpdate:collapsed":p[0]||(p[0]=m=>s.$emit("update:collapsed",m)),onCollapse:p[1]||(p[1]=m=>s.$emit("collapse",m))},e.createSlots({default:e.withCtx(()=>[e.renderSlot(s.$slots,"default",{},void 0,!0)]),_:2},[s.$slots.left?{name:"left",fn:e.withCtx(()=>[e.renderSlot(s.$slots,"left",{},void 0,!0)]),key:"0"}:void 0]),1032,["default-sidebar-width","collapsed"]),s.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(a)("footer")])},[e.renderSlot(s.$slots,"footer",{},void 0,!0),e.createElementVNode("div",{id:d.footer},null,8,g)],2)):e.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-c90dad87"]]),K=["id"],O=["id"],b=k(e.defineComponent({__name:"LayoutTabs",props:{tabs:{default:()=>[]},activeKey:{default:void 0},defaultSidebarWidth:{default:242},collapsed:{type:Boolean,default:!1},class:{type:[Boolean,null,String,Object,Array],default:void 0},style:{type:[Boolean,null,String,Object,Array],default:void 0}},emits:["update:activeKey","update:collapsed","tab-click","collapse"],setup(t,{emit:a}){const o=C("layout"),n=t,d=a,s=e.computed({get:()=>n.activeKey??n.tabs[0]?.key,set:l=>d("update:activeKey",l)});function p(l,i){d("tab-click",String(l.paneName??""))}const m=e.useId(),y={header:`nova-layout-header-${m}`,footer:`nova-layout-footer-${m}`};return V({teleportIds:y,activeKey:s}),(l,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([e.unref(o)("tabs-layout"),n.class]),style:e.normalizeStyle(t.style)},[l.$slots.header?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([e.unref(o)("header")])},[e.renderSlot(l.$slots,"header",{},void 0,!0),e.createElementVNode("div",{id:y.header},null,8,K)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([e.unref(o)("tabs-wrapper")])},[e.createVNode(e.unref(f.ElTabs),{modelValue:s.value,"onUpdate:modelValue":i[2]||(i[2]=c=>s.value=c),class:e.normalizeClass(e.unref(o)("tabs")),onTabClick:p},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tabs,c=>(e.openBlock(),e.createBlock(e.unref(f.ElTabPane),{key:c.key,label:c.label||c.key,name:c.key},{default:e.withCtx(()=>[e.createVNode(S,{"default-sidebar-width":t.defaultSidebarWidth,collapsed:t.collapsed,"onUpdate:collapsed":i[0]||(i[0]=N=>l.$emit("update:collapsed",N)),onCollapse:i[1]||(i[1]=N=>l.$emit("collapse",N))},e.createSlots({default:e.withCtx(()=>[e.renderSlot(l.$slots,c.key,{},void 0,!0)]),_:2},[l.$slots.left?{name:"left",fn:e.withCtx(()=>[e.renderSlot(l.$slots,"left",{},void 0,!0)]),key:"0"}:void 0]),1032,["default-sidebar-width","collapsed"])]),_:2},1032,["label","name"]))),128))]),_:3},8,["modelValue","class"])],2),l.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass([e.unref(o)("footer")])},[e.renderSlot(l.$slots,"footer",{},void 0,!0),e.createElementVNode("div",{id:y.footer},null,8,O)],2)):e.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-12d97b4e"]]),$=e.defineComponent({__name:"LayoutPortal",props:{to:{}},setup(t){const a=t,o=z(),n=e.computed(()=>o?a.to==="header"?o.teleportIds.header:o.teleportIds.footer:null);return(d,s)=>n.value?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:`#${n.value}`},[e.renderSlot(d.$slots,"default")],8,["to"])):e.createCommentVNode("",!0)}}),u=I;u.Tabs=b,u.Portal=$;function E(t){t.component("NLayout",u),t.component("NLayoutTabs",b),t.component("NLayoutPortal",$),t.use(f)}const j={install:E};r.NLayout=u,r.NLayoutPortal=$,r.NLayoutTabs=b,r.default=j,r.install=E,r.useTabFocus=T,Object.keys(f).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:()=>f[t]})}),Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|