vlite3 0.2.6 → 0.2.7
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/components/Button.vue.js +42 -33
- package/components/ChoiceBox/ChoiceBox.vue.js +19 -19
- package/components/ColorPicker/ColorIro.vue.d.ts +18 -1
- package/components/ColorPicker/ColorIro.vue.js +59 -61
- package/components/ColorPicker/ColorPicker.vue.d.ts +2 -0
- package/components/ColorPicker/ColorPicker.vue.js +81 -26
- package/components/Tabes/Tabes.vue.js +10 -10
- package/components/Workbook/Sheet.vue.d.ts +6 -0
- package/components/Workbook/Sheet.vue.js +63 -55
- package/components/Workbook/Workbook.vue.d.ts +3 -0
- package/components/Workbook/Workbook.vue.js +1 -1
- package/components/Workbook/Workbook.vue2.js +68 -62
- package/components/Workbook/types.d.ts +3 -0
- package/package.json +1 -1
- package/style.css +4 -0
package/components/Button.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as v, useSlots as x, computed as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as v, useSlots as x, computed as c, withDirectives as w, openBlock as i, createElementBlock as y, normalizeClass as o, createBlock as l, createCommentVNode as u, renderSlot as p, createTextVNode as z, toDisplayString as k, unref as B } from "vue";
|
|
2
|
+
import d from "./Icon.vue.js";
|
|
3
3
|
import { vRipple as C } from "../directives/vRipple.js";
|
|
4
|
-
const
|
|
4
|
+
const S = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
5
5
|
__name: "Button",
|
|
6
6
|
props: {
|
|
7
7
|
variant: { default: "primary" },
|
|
@@ -16,8 +16,8 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
16
16
|
rounded: { default: "md" }
|
|
17
17
|
},
|
|
18
18
|
setup(e) {
|
|
19
|
-
const t = e, g = x(),
|
|
20
|
-
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] cursor-pointer gap-2",
|
|
19
|
+
const t = e, g = x(), s = c(() => t.icon && !t.text && !g.default), h = c(() => {
|
|
20
|
+
const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] cursor-pointer gap-2", r = {
|
|
21
21
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
22
22
|
"primary-light": "bg-primary-light text-primary-fg-light hover:bg-primary/20",
|
|
23
23
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -43,13 +43,13 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
43
43
|
md: "h-9 px-4 py-2",
|
|
44
44
|
lg: "h-10 px-6",
|
|
45
45
|
xl: "h-12 px-10"
|
|
46
|
-
}, b = {
|
|
47
|
-
xs: "h-6.5 w-6.5 min-h-6.5 min-w-6.5",
|
|
48
|
-
sm: "h-8 w-8 min-h-9 min-w-9",
|
|
49
|
-
md: "h-9 w-9 min-h-9 min-w-9",
|
|
50
|
-
lg: "h-10 w-10 min-h-11 min-w-11",
|
|
51
|
-
xl: "h-12 w-12 min-h-12 min-w-12"
|
|
52
46
|
}, m = {
|
|
47
|
+
xs: "h-6.5 w-6.5 min-h-6.5 min-w-6.5",
|
|
48
|
+
sm: "h-7 w-7 min-h-7 min-w-7",
|
|
49
|
+
md: "h-7.5 w-7.5 min-h-7.5 min-w-7.5",
|
|
50
|
+
lg: "h-8 w-8 min-h-8 min-w-8",
|
|
51
|
+
xl: "h-8.5 w-8.5 min-h-8.5 min-w-8.5"
|
|
52
|
+
}, b = {
|
|
53
53
|
none: "rounded-none",
|
|
54
54
|
sm: "rounded-sm",
|
|
55
55
|
md: "rounded",
|
|
@@ -60,44 +60,53 @@ const R = ["type", "disabled"], D = /* @__PURE__ */ v({
|
|
|
60
60
|
};
|
|
61
61
|
return [
|
|
62
62
|
n,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
r[t.variant],
|
|
64
|
+
b[t.rounded],
|
|
65
|
+
s.value ? m[t.size] : f[t.size],
|
|
66
66
|
t.class
|
|
67
67
|
].join(" ");
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
}), a = c(() => {
|
|
69
|
+
const n = {
|
|
70
|
+
xs: "w-3 h-3",
|
|
71
|
+
sm: "w-4 h-4",
|
|
72
|
+
md: "w-4 h-4",
|
|
73
|
+
lg: "w-4 h-4",
|
|
74
|
+
xl: "w-4 h-4"
|
|
75
|
+
}, r = {
|
|
76
|
+
xs: "w-3 h-3",
|
|
77
|
+
sm: "w-3.5 h-3.5",
|
|
78
|
+
md: "w-3.5 h-3.5",
|
|
79
|
+
lg: "w-4 h-4",
|
|
80
|
+
xl: "w-4 h-4"
|
|
81
|
+
};
|
|
82
|
+
return s.value ? r[t.size] : n[t.size];
|
|
83
|
+
});
|
|
84
|
+
return (n, r) => w((i(), y("button", {
|
|
76
85
|
type: e.type,
|
|
77
|
-
class:
|
|
86
|
+
class: o(h.value),
|
|
78
87
|
disabled: e.disabled || e.loading
|
|
79
88
|
}, [
|
|
80
|
-
e.loading ? (
|
|
89
|
+
e.loading ? (i(), l(d, {
|
|
81
90
|
key: 0,
|
|
82
91
|
icon: "lucide:loader-2",
|
|
83
|
-
class:
|
|
84
|
-
}, null, 8, ["class"])) : e.icon ? (
|
|
92
|
+
class: o(["animate-spin", { [a.value]: !0 }])
|
|
93
|
+
}, null, 8, ["class"])) : e.icon ? (i(), l(d, {
|
|
85
94
|
key: 1,
|
|
86
95
|
icon: e.icon,
|
|
87
|
-
class:
|
|
88
|
-
"mx-auto":
|
|
89
|
-
[
|
|
96
|
+
class: o({
|
|
97
|
+
"mx-auto": s.value,
|
|
98
|
+
[a.value]: !0
|
|
90
99
|
})
|
|
91
100
|
}, null, 8, ["icon", "class"])) : u("", !0),
|
|
92
101
|
p(n.$slots, "default", {}, () => [
|
|
93
|
-
k(
|
|
102
|
+
z(k(e.text), 1)
|
|
94
103
|
]),
|
|
95
|
-
e.iconRight && !e.loading ? (
|
|
104
|
+
e.iconRight && !e.loading ? (i(), l(d, {
|
|
96
105
|
key: 2,
|
|
97
106
|
icon: e.iconRight,
|
|
98
|
-
class:
|
|
107
|
+
class: o([a.value, "h-4 w-4"])
|
|
99
108
|
}, null, 8, ["icon", "class"])) : u("", !0)
|
|
100
|
-
], 10,
|
|
109
|
+
], 10, S)), [
|
|
101
110
|
[B(C)]
|
|
102
111
|
]);
|
|
103
112
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as w, computed as
|
|
1
|
+
import { defineComponent as w, computed as x, openBlock as t, createElementBlock as i, toDisplayString as o, createCommentVNode as a, createElementVNode as c, normalizeClass as u, Fragment as V, renderList as _, withKeys as C, withModifiers as B, createVNode as A, createBlock as y } from "vue";
|
|
2
2
|
import m from "../Icon.vue.js";
|
|
3
3
|
const K = { class: "w-full" }, N = {
|
|
4
4
|
key: 0,
|
|
@@ -14,7 +14,7 @@ const K = { class: "w-full" }, N = {
|
|
|
14
14
|
class: "shrink-0 pt-0.5"
|
|
15
15
|
}, q = { class: "flex flex-col" }, z = { class: "flex items-center gap-2" }, D = {
|
|
16
16
|
key: 0,
|
|
17
|
-
class: "mt-1 text-
|
|
17
|
+
class: "mt-1 -text-fs-3 text-muted leading-relaxed"
|
|
18
18
|
}, F = {
|
|
19
19
|
key: 0,
|
|
20
20
|
class: "absolute top-4 right-4 text-primary"
|
|
@@ -31,18 +31,18 @@ const K = { class: "w-full" }, N = {
|
|
|
31
31
|
gap: { default: 4 }
|
|
32
32
|
},
|
|
33
33
|
emits: ["update:modelValue", "change"],
|
|
34
|
-
setup(
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
34
|
+
setup(s, { emit: h }) {
|
|
35
|
+
const r = s, g = h, n = (l) => Array.isArray(r.modelValue) ? r.modelValue.includes(l) : r.modelValue === l, f = (l) => {
|
|
36
|
+
if (r.disabled || r.options.find((d) => d.id === l)?.disabled) return;
|
|
37
37
|
let e;
|
|
38
|
-
if (
|
|
39
|
-
const d = Array.isArray(
|
|
38
|
+
if (r.multiple) {
|
|
39
|
+
const d = Array.isArray(r.modelValue) ? [...r.modelValue] : [], p = d.indexOf(l);
|
|
40
40
|
p === -1 ? d.push(l) : d.splice(p, 1), e = d;
|
|
41
41
|
} else
|
|
42
42
|
e = l;
|
|
43
43
|
g("update:modelValue", e), g("change", e);
|
|
44
|
-
}, b =
|
|
45
|
-
switch (
|
|
44
|
+
}, b = x(() => {
|
|
45
|
+
switch (r.grid) {
|
|
46
46
|
case 1:
|
|
47
47
|
return "grid-cols-1";
|
|
48
48
|
case 2:
|
|
@@ -54,8 +54,8 @@ const K = { class: "w-full" }, N = {
|
|
|
54
54
|
default:
|
|
55
55
|
return "grid-cols-1";
|
|
56
56
|
}
|
|
57
|
-
}), v =
|
|
58
|
-
switch (
|
|
57
|
+
}), v = x(() => {
|
|
58
|
+
switch (r.gap) {
|
|
59
59
|
case 2:
|
|
60
60
|
return "gap-2";
|
|
61
61
|
case 3:
|
|
@@ -71,18 +71,18 @@ const K = { class: "w-full" }, N = {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
return (l, k) => (t(), i("div", K, [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
s.title || s.description ? (t(), i("div", N, [
|
|
75
|
+
s.title ? (t(), i("h3", $, o(s.title), 1)) : a("", !0),
|
|
76
|
+
s.description ? (t(), i("p", E, o(s.description), 1)) : a("", !0)
|
|
77
77
|
])) : a("", !0),
|
|
78
78
|
c("div", {
|
|
79
79
|
class: u(["grid", [b.value, v.value]])
|
|
80
80
|
}, [
|
|
81
|
-
(t(!0), i(V, null, _(
|
|
81
|
+
(t(!0), i(V, null, _(s.options, (e) => (t(), i("div", {
|
|
82
82
|
key: e.id,
|
|
83
83
|
class: u(["relative flex cursor-pointer rounded-xl border border-border p-4 transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2", [
|
|
84
84
|
n(e.id) ? "border-primary bg-accent" : "bg-card hover:border-primary/50 hover:bg-accent",
|
|
85
|
-
|
|
85
|
+
s.disabled || e.disabled ? "opacity-50 cursor-not-allowed grayscale" : ""
|
|
86
86
|
]]),
|
|
87
87
|
onClick: (d) => f(e.id),
|
|
88
88
|
tabindex: "0",
|
|
@@ -105,7 +105,7 @@ const K = { class: "w-full" }, N = {
|
|
|
105
105
|
c("div", q, [
|
|
106
106
|
c("div", z, [
|
|
107
107
|
c("span", {
|
|
108
|
-
class: u(["font-semibold text-foreground", {
|
|
108
|
+
class: u(["font-semibold text-foreground text-fs-1", {
|
|
109
109
|
"text-primary": n(e.id)
|
|
110
110
|
}])
|
|
111
111
|
}, o(e.title), 3),
|
|
@@ -121,11 +121,11 @@ const K = { class: "w-full" }, N = {
|
|
|
121
121
|
])
|
|
122
122
|
]),
|
|
123
123
|
n(e.id) ? (t(), i("div", F, [
|
|
124
|
-
|
|
124
|
+
s.multiple ? (t(), y(m, {
|
|
125
125
|
key: 0,
|
|
126
126
|
icon: "lucide:check-square",
|
|
127
127
|
class: "h-5 w-5"
|
|
128
|
-
})) : (t(),
|
|
128
|
+
})) : (t(), y(m, {
|
|
129
129
|
key: 1,
|
|
130
130
|
icon: "lucide:check-circle-2",
|
|
131
131
|
class: "h-5 w-5"
|
|
@@ -3,7 +3,18 @@ type __VLS_Props = {
|
|
|
3
3
|
showHeader?: boolean;
|
|
4
4
|
size?: 'sm' | 'md' | 'lg';
|
|
5
5
|
};
|
|
6
|
-
declare
|
|
6
|
+
declare function __VLS_template(): {
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
slots: {
|
|
9
|
+
bottom?(_: {}): any;
|
|
10
|
+
};
|
|
11
|
+
refs: {
|
|
12
|
+
pickerRef: HTMLDivElement;
|
|
13
|
+
};
|
|
14
|
+
rootEl: HTMLDivElement;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
18
|
close: () => any;
|
|
8
19
|
"update:color": (color: string) => any;
|
|
9
20
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -15,4 +26,10 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
15
26
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
16
27
|
pickerRef: HTMLDivElement;
|
|
17
28
|
}, HTMLDivElement>;
|
|
29
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
18
30
|
export default _default;
|
|
31
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useEyeDropper as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as H, defineAsyncComponent as B, ref as g, computed as E, watch as p, onMounted as T, onUnmounted as C, openBlock as a, createElementBlock as x, createVNode as P, unref as c, createBlock as b, createCommentVNode as d, createElementVNode as M, normalizeStyle as N, renderSlot as R, nextTick as V } from "vue";
|
|
2
|
+
import i from "@jaames/iro";
|
|
3
|
+
import { useEyeDropper as D } from "@vueuse/core";
|
|
4
|
+
const L = { class: "space-y-3 w-max" }, _ = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "flex gap-2 mb-2.5 -text-fs-3 pr-0.5"
|
|
7
|
-
},
|
|
7
|
+
}, I = /* @__PURE__ */ H({
|
|
8
8
|
__name: "ColorIro",
|
|
9
9
|
props: {
|
|
10
10
|
color: {},
|
|
@@ -12,9 +12,9 @@ const D = { class: "space-y-3" }, $ = {
|
|
|
12
12
|
size: { default: "md" }
|
|
13
13
|
},
|
|
14
14
|
emits: ["update:color", "close"],
|
|
15
|
-
setup(l, { emit:
|
|
16
|
-
const
|
|
17
|
-
switch (
|
|
15
|
+
setup(l, { emit: S }) {
|
|
16
|
+
const s = B(() => import("../Button.vue2.js")), n = l, u = S, r = g(), e = g(null), { isSupported: m, open: z, sRGBHex: w } = D(), f = E(() => {
|
|
17
|
+
switch (n.size) {
|
|
18
18
|
case "sm":
|
|
19
19
|
return 140;
|
|
20
20
|
case "lg":
|
|
@@ -22,121 +22,119 @@ const D = { class: "space-y-3" }, $ = {
|
|
|
22
22
|
default:
|
|
23
23
|
return 162;
|
|
24
24
|
}
|
|
25
|
-
}),
|
|
25
|
+
}), v = {
|
|
26
26
|
sm: 120,
|
|
27
27
|
md: 140,
|
|
28
28
|
lg: 150
|
|
29
|
-
},
|
|
30
|
-
if (!(!
|
|
31
|
-
await
|
|
29
|
+
}, y = async () => {
|
|
30
|
+
if (!(!r.value || e.value)) {
|
|
31
|
+
await V();
|
|
32
32
|
try {
|
|
33
|
-
e.value && (e.value.off("color:change"), e.value = null), e.value =
|
|
33
|
+
e.value && (e.value.off("color:change"), e.value = null), r.value && (r.value.innerHTML = ""), e.value = i.ColorPicker(r.value, {
|
|
34
34
|
width: f.value,
|
|
35
|
-
color:
|
|
35
|
+
color: n.color,
|
|
36
36
|
margin: 9,
|
|
37
|
-
boxHeight:
|
|
38
|
-
// Auto-scale or keep ratio? default is usually width.
|
|
39
|
-
// Let's rely on default square-ish box unless specified.
|
|
40
|
-
// But for small size, maybe we want to keep it compact.
|
|
41
|
-
// iro defaults boxHeight to width if not specified.
|
|
37
|
+
boxHeight: v[n.size],
|
|
42
38
|
sliderSize: 14,
|
|
43
39
|
layout: [
|
|
44
40
|
{
|
|
45
|
-
component:
|
|
41
|
+
component: i.ui.Box
|
|
46
42
|
},
|
|
47
43
|
{
|
|
48
|
-
component:
|
|
44
|
+
component: i.ui.Slider,
|
|
49
45
|
options: {
|
|
50
46
|
sliderType: "hue"
|
|
51
47
|
}
|
|
52
48
|
},
|
|
53
49
|
{
|
|
54
|
-
component:
|
|
50
|
+
component: i.ui.Slider,
|
|
55
51
|
options: {
|
|
56
52
|
sliderType: "saturation"
|
|
57
53
|
}
|
|
58
54
|
},
|
|
59
55
|
{
|
|
60
|
-
component:
|
|
56
|
+
component: i.ui.Slider,
|
|
61
57
|
options: {
|
|
62
58
|
sliderType: "value"
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
]
|
|
66
62
|
}), e.value.on("color:change", (o) => {
|
|
67
|
-
|
|
63
|
+
u("update:color", o.hexString);
|
|
68
64
|
});
|
|
69
65
|
} catch (o) {
|
|
70
66
|
console.error("Failed to initialize color picker:", o);
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
|
-
},
|
|
74
|
-
e.value && (e.value.off("color:change"), e.value = null);
|
|
69
|
+
}, h = () => {
|
|
70
|
+
e.value && (e.value.off("color:change"), e.value = null), r.value && (r.value.innerHTML = "");
|
|
75
71
|
};
|
|
76
|
-
|
|
77
|
-
() =>
|
|
72
|
+
p(
|
|
73
|
+
() => n.color,
|
|
78
74
|
(o) => {
|
|
79
75
|
if (e.value && e.value.color.hexString !== o)
|
|
80
76
|
try {
|
|
81
77
|
e.value.color.hexString = o;
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Error updating color:",
|
|
78
|
+
} catch (t) {
|
|
79
|
+
console.error("Error updating color:", t);
|
|
84
80
|
}
|
|
85
81
|
}
|
|
86
|
-
),
|
|
87
|
-
() =>
|
|
82
|
+
), p(
|
|
83
|
+
() => n.size,
|
|
88
84
|
() => {
|
|
89
|
-
|
|
85
|
+
h(), y();
|
|
90
86
|
}
|
|
91
|
-
),
|
|
92
|
-
if (o && (
|
|
87
|
+
), p(w, (o) => {
|
|
88
|
+
if (o && (u("update:color", o), e.value))
|
|
93
89
|
try {
|
|
94
90
|
e.value.color.hexString = o;
|
|
95
|
-
} catch (
|
|
96
|
-
console.error("Error updating color from eyedropper:",
|
|
91
|
+
} catch (t) {
|
|
92
|
+
console.error("Error updating color from eyedropper:", t);
|
|
97
93
|
}
|
|
98
94
|
});
|
|
99
|
-
const
|
|
95
|
+
const k = async () => {
|
|
100
96
|
try {
|
|
101
97
|
await z();
|
|
102
98
|
} catch (o) {
|
|
103
99
|
console.error("Error opening eyedropper:", o);
|
|
104
100
|
}
|
|
105
101
|
};
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
|
|
110
|
-
}), (o,
|
|
111
|
-
l.showHeader ? (
|
|
112
|
-
P(c(
|
|
102
|
+
return T(() => {
|
|
103
|
+
y();
|
|
104
|
+
}), C(() => {
|
|
105
|
+
h();
|
|
106
|
+
}), (o, t) => (a(), x("div", L, [
|
|
107
|
+
l.showHeader ? (a(), x("div", _, [
|
|
108
|
+
P(c(s), {
|
|
113
109
|
icon: "typcn:arrow-back",
|
|
114
|
-
onClick:
|
|
110
|
+
onClick: t[0] || (t[0] = ($) => u("close")),
|
|
115
111
|
class: "flex-1 px-2 py-1 bg-background hover:bg-accent rounded text-xs border border-border transition-colors"
|
|
116
112
|
}),
|
|
117
|
-
c(m) ? (
|
|
113
|
+
c(m) ? (a(), b(c(s), {
|
|
118
114
|
key: 0,
|
|
119
|
-
onClick:
|
|
115
|
+
onClick: k,
|
|
120
116
|
icon: "pepicons-pop:color-picker",
|
|
121
117
|
class: "flex-1 px-2 py-1 bg-background hover:bg-accent rounded text-xs border border-border transition-colors"
|
|
122
118
|
})) : d("", !0)
|
|
123
119
|
])) : d("", !0),
|
|
124
|
-
|
|
120
|
+
M("div", {
|
|
125
121
|
ref_key: "pickerRef",
|
|
126
|
-
ref:
|
|
127
|
-
|
|
128
|
-
}, null,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
122
|
+
ref: r,
|
|
123
|
+
style: N({ width: f.value + "px", minHeight: v[l.size] + "px" })
|
|
124
|
+
}, null, 4),
|
|
125
|
+
R(o.$slots, "bottom", {}, () => [
|
|
126
|
+
c(m) && !l.showHeader ? (a(), b(c(s), {
|
|
127
|
+
key: 0,
|
|
128
|
+
onClick: k,
|
|
129
|
+
icon: "pepicons-pop:color-picker",
|
|
130
|
+
variant: "outline",
|
|
131
|
+
size: "sm",
|
|
132
|
+
class: "w-full"
|
|
133
|
+
})) : d("", !0)
|
|
134
|
+
])
|
|
137
135
|
]));
|
|
138
136
|
}
|
|
139
137
|
});
|
|
140
138
|
export {
|
|
141
|
-
|
|
139
|
+
I as default
|
|
142
140
|
};
|
|
@@ -6,6 +6,7 @@ interface Props {
|
|
|
6
6
|
size?: 'sm' | 'md' | 'lg';
|
|
7
7
|
position?: TooltTipPlacement;
|
|
8
8
|
btnProps?: ButtonProps;
|
|
9
|
+
showInput?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
11
12
|
"update:modelValue": (value: string) => any;
|
|
@@ -18,5 +19,6 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
18
19
|
size: "sm" | "md" | "lg";
|
|
19
20
|
modelValue: string;
|
|
20
21
|
position: TooltTipPlacement;
|
|
22
|
+
showInput: boolean;
|
|
21
23
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
22
24
|
export default _default;
|
|
@@ -1,56 +1,111 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as z, ref as p, watch as i, openBlock as a, createBlock as f, unref as v, withCtx as u, createElementBlock as h, createVNode as c, createCommentVNode as d, createElementVNode as $, mergeProps as w } from "vue";
|
|
2
|
+
import B from "../Dropdown/Dropdown.vue.js";
|
|
3
3
|
import "@iconify/vue";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import O from "../Input.vue.js";
|
|
5
|
+
import y from "../Button.vue.js";
|
|
6
|
+
import E from "./ColorIro.vue.js";
|
|
6
7
|
/* empty css */
|
|
7
|
-
|
|
8
|
+
import { useEyeDropper as P } from "@vueuse/core";
|
|
9
|
+
const I = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "p-2 w-max flex flex-col justify-center"
|
|
12
|
+
}, N = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "flex items-center gap-1.5 w-full"
|
|
15
|
+
}, D = { class: "w-32" }, q = /* @__PURE__ */ z({
|
|
8
16
|
__name: "ColorPicker",
|
|
9
17
|
props: {
|
|
10
18
|
modelValue: { default: "#000000" },
|
|
11
19
|
disabled: { type: Boolean, default: !1 },
|
|
12
20
|
size: { default: "md" },
|
|
13
21
|
position: { default: "bottom" },
|
|
14
|
-
btnProps: {}
|
|
22
|
+
btnProps: {},
|
|
23
|
+
showInput: { type: Boolean, default: !0 }
|
|
15
24
|
},
|
|
16
25
|
emits: ["update:modelValue", "change"],
|
|
17
|
-
setup(
|
|
18
|
-
const
|
|
19
|
-
|
|
26
|
+
setup(o, { emit: V }) {
|
|
27
|
+
const n = o, m = V, r = p(!1), t = p(n.modelValue || "#000000"), { isSupported: b, open: g, sRGBHex: k } = P();
|
|
28
|
+
i(k, (e) => {
|
|
29
|
+
e && (t.value = e);
|
|
30
|
+
});
|
|
31
|
+
const x = async () => {
|
|
32
|
+
try {
|
|
33
|
+
await g();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error("Error opening eyedropper:", e);
|
|
36
|
+
}
|
|
20
37
|
};
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
i(
|
|
39
|
+
() => n.modelValue,
|
|
40
|
+
(e) => {
|
|
41
|
+
e && e !== t.value && (t.value = e);
|
|
42
|
+
}
|
|
43
|
+
), i(t, (e) => {
|
|
44
|
+
/^#([0-9A-F]{3,8})$/i.test(e) && e !== n.modelValue && (m("update:modelValue", e), m("change", e));
|
|
45
|
+
});
|
|
46
|
+
const C = (e) => {
|
|
47
|
+
t.value = e;
|
|
48
|
+
};
|
|
49
|
+
return (e, l) => (a(), f(v(B), {
|
|
50
|
+
disabled: o.disabled,
|
|
23
51
|
class: "w-auto",
|
|
24
|
-
position:
|
|
52
|
+
position: o.position,
|
|
25
53
|
offset: [0, 8],
|
|
26
54
|
searchable: !1,
|
|
27
|
-
"close-on-select": !1
|
|
55
|
+
"close-on-select": !1,
|
|
56
|
+
onOnOpen: l[1] || (l[1] = (s) => r.value = !0),
|
|
57
|
+
onOnClose: l[2] || (l[2] = (s) => r.value = !1)
|
|
28
58
|
}, {
|
|
29
|
-
trigger:
|
|
30
|
-
|
|
31
|
-
style: { backgroundColor:
|
|
59
|
+
trigger: u(({ isOpen: s }) => [
|
|
60
|
+
c(y, w({
|
|
61
|
+
style: { backgroundColor: o.modelValue }
|
|
32
62
|
}, {
|
|
33
63
|
rounded: "full",
|
|
34
64
|
size: "xs",
|
|
35
65
|
icon: " ",
|
|
36
66
|
variant: "outline",
|
|
37
|
-
...
|
|
67
|
+
...o.btnProps || {}
|
|
38
68
|
}), null, 16, ["style"])
|
|
39
69
|
]),
|
|
40
|
-
default:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
color:
|
|
70
|
+
default: u(() => [
|
|
71
|
+
r.value ? (a(), h("div", I, [
|
|
72
|
+
c(E, {
|
|
73
|
+
color: o.modelValue,
|
|
44
74
|
"show-header": !1,
|
|
45
|
-
size:
|
|
46
|
-
"onUpdate:color":
|
|
47
|
-
},
|
|
48
|
-
|
|
75
|
+
size: o.size,
|
|
76
|
+
"onUpdate:color": C
|
|
77
|
+
}, {
|
|
78
|
+
bottom: u(() => [
|
|
79
|
+
o.showInput ? (a(), h("div", N, [
|
|
80
|
+
v(b) ? (a(), f(y, {
|
|
81
|
+
key: 0,
|
|
82
|
+
onClick: x,
|
|
83
|
+
icon: "pepicons-pop:color-picker",
|
|
84
|
+
variant: "outline",
|
|
85
|
+
size: "sm",
|
|
86
|
+
class: "px-2 shrink-0"
|
|
87
|
+
})) : d("", !0),
|
|
88
|
+
$("div", D, [
|
|
89
|
+
c(O, {
|
|
90
|
+
modelValue: t.value,
|
|
91
|
+
"onUpdate:modelValue": l[0] || (l[0] = (s) => t.value = s),
|
|
92
|
+
size: "sm",
|
|
93
|
+
"show-clear-button": !1,
|
|
94
|
+
placeholder: "#000000",
|
|
95
|
+
class: "flex-1 w-full",
|
|
96
|
+
"input-class": "font-mono text-xs uppercase "
|
|
97
|
+
}, null, 8, ["modelValue"])
|
|
98
|
+
])
|
|
99
|
+
])) : d("", !0)
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 8, ["color", "size"])
|
|
103
|
+
])) : d("", !0)
|
|
49
104
|
]),
|
|
50
105
|
_: 1
|
|
51
106
|
}, 8, ["disabled", "position"]));
|
|
52
107
|
}
|
|
53
108
|
});
|
|
54
109
|
export {
|
|
55
|
-
|
|
110
|
+
q as default
|
|
56
111
|
};
|
|
@@ -15,7 +15,7 @@ const q = ["aria-selected", "disabled", "onClick"], K = /* @__PURE__ */ M({
|
|
|
15
15
|
setup(s, { emit: x }) {
|
|
16
16
|
const r = s, v = x, d = g(null), f = g(/* @__PURE__ */ new Map()), h = (e, n) => {
|
|
17
17
|
e ? f.value.set(n, e) : f.value.delete(n);
|
|
18
|
-
},
|
|
18
|
+
}, m = g({
|
|
19
19
|
width: "0px",
|
|
20
20
|
height: "0px",
|
|
21
21
|
transform: "translate(0px, 0px)",
|
|
@@ -24,14 +24,14 @@ const q = ["aria-selected", "disabled", "onClick"], K = /* @__PURE__ */ M({
|
|
|
24
24
|
await D();
|
|
25
25
|
const e = d.value, n = f.value.get(r.modelValue);
|
|
26
26
|
if (!e || !n) {
|
|
27
|
-
|
|
27
|
+
m.value.opacity = 0;
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const a = e.getBoundingClientRect(), t = n.getBoundingClientRect(),
|
|
31
|
-
|
|
30
|
+
const a = e.getBoundingClientRect(), t = n.getBoundingClientRect(), b = t.left - a.left, $ = t.top - a.top, B = t.width, L = t.height;
|
|
31
|
+
m.value = {
|
|
32
32
|
width: `${B}px`,
|
|
33
33
|
height: `${L}px`,
|
|
34
|
-
transform: `translate(${
|
|
34
|
+
transform: `translate(${b}px, ${$}px)`,
|
|
35
35
|
opacity: 1
|
|
36
36
|
};
|
|
37
37
|
};
|
|
@@ -48,8 +48,8 @@ const q = ["aria-selected", "disabled", "onClick"], K = /* @__PURE__ */ M({
|
|
|
48
48
|
line: "bg-transparent gap-6 rounded-none p-0 border-b border-border w-full"
|
|
49
49
|
}[r.variant], r.block ? "flex w-full" : ""]), w = {
|
|
50
50
|
sm: "text-xs px-2.5 py-1",
|
|
51
|
-
md: "text-
|
|
52
|
-
lg: "text-
|
|
51
|
+
md: "-text-fs-2 px-3 py-1",
|
|
52
|
+
lg: "-text-fs-1 px-4 py-1"
|
|
53
53
|
}, z = p(() => [r.variant === "line" ? "relative z-10 flex items-center justify-center gap-2 font-medium transition-colors duration-50 ease-out cursor-pointer select-none outline-none focus-visible:ring-2 focus-visible:ring-primary/50 pb-2 border-b-2 border-transparent hover:text-foreground" : "relative z-10 flex-1 flex items-center justify-center gap-2 font-medium transition-colors duration-50 ease-out cursor-pointer select-none rounded-md outline-none focus-visible:ring-2 focus-visible:ring-primary/50"]), V = (e) => {
|
|
54
54
|
const n = e.value === r.modelValue, a = r.variant === "line";
|
|
55
55
|
let t = "";
|
|
@@ -81,8 +81,8 @@ const q = ["aria-selected", "disabled", "onClick"], K = /* @__PURE__ */ M({
|
|
|
81
81
|
}
|
|
82
82
|
else
|
|
83
83
|
t = a ? "text-muted-foreground" : "text-muted-foreground hover:text-foreground/80";
|
|
84
|
-
const
|
|
85
|
-
return [z.value, t,
|
|
84
|
+
const b = e.disabled ? "opacity-50 cursor-not-allowed" : "";
|
|
85
|
+
return [z.value, t, b].join(" ");
|
|
86
86
|
}, R = p(() => {
|
|
87
87
|
const e = "absolute left-0 top-0 transition-all duration-300 ease-[cubic-bezier(0.25,0.1,0.25,1)] z-0 pointer-events-none";
|
|
88
88
|
return r.variant === "line" ? `${e} !h-[2px] !top-auto bottom-0` : `${e} rounded-md shadow-sm`;
|
|
@@ -104,7 +104,7 @@ const q = ["aria-selected", "disabled", "onClick"], K = /* @__PURE__ */ M({
|
|
|
104
104
|
s.modelValue !== void 0 ? (i(), u("div", {
|
|
105
105
|
key: 0,
|
|
106
106
|
class: l([R.value, S()]),
|
|
107
|
-
style: A(
|
|
107
|
+
style: A(m.value)
|
|
108
108
|
}, null, 6)) : y("", !0),
|
|
109
109
|
(i(!0), u(E, null, I(s.options, (a) => (i(), u("button", {
|
|
110
110
|
key: a.value,
|
|
@@ -12,6 +12,9 @@ interface Props {
|
|
|
12
12
|
cancel?: string;
|
|
13
13
|
};
|
|
14
14
|
allowIconChange?: boolean;
|
|
15
|
+
itemClass?: string;
|
|
16
|
+
activeItemClass?: string;
|
|
17
|
+
inactiveItemClass?: string;
|
|
15
18
|
}
|
|
16
19
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
17
20
|
select: (id: string) => any;
|
|
@@ -30,10 +33,13 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
30
33
|
"onEdit-end"?: (id: string) => any;
|
|
31
34
|
onDuplicate?: (id: string) => any;
|
|
32
35
|
}>, {
|
|
36
|
+
itemClass: string;
|
|
33
37
|
isEditing: boolean;
|
|
34
38
|
canDelete: boolean;
|
|
35
39
|
confirmDelete: boolean;
|
|
36
40
|
allowIconChange: boolean;
|
|
41
|
+
activeItemClass: string;
|
|
42
|
+
inactiveItemClass: string;
|
|
37
43
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
38
44
|
inputRef: HTMLInputElement;
|
|
39
45
|
}, HTMLDivElement>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as S, ref as g, computed as y, openBlock as a, createElementBlock as c, normalizeClass as D, createElementVNode as r, withModifiers as f, createBlock as b, withCtx as v, createVNode as d, createCommentVNode as C, withDirectives as V, vModelText as N, toDisplayString as k, unref as O, createTextVNode as j, nextTick as M } from "vue";
|
|
2
2
|
import u from "../Icon.vue.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
3
|
+
import R from "../Dropdown/Dropdown.vue.js";
|
|
4
|
+
import z from "../IconPicker.vue.js";
|
|
5
|
+
const A = {
|
|
6
6
|
type: "button",
|
|
7
7
|
class: "flex items-center justify-center rounded hover:bg-accent transition-colors p-0.5 outline-none focus-visible:ring-2 focus-visible:ring-primary/20 mt-1"
|
|
8
8
|
}, K = {
|
|
@@ -11,9 +11,9 @@ const I = {
|
|
|
11
11
|
}, U = { class: "flex-1 min-w-0 pr-1" }, q = {
|
|
12
12
|
key: 1,
|
|
13
13
|
class: "block truncate text-sm font-medium leading-normal"
|
|
14
|
-
}, F = { class: "
|
|
15
|
-
class: /* @__PURE__ */
|
|
16
|
-
},
|
|
14
|
+
}, F = { class: "p-1 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors" }, G = {
|
|
15
|
+
class: /* @__PURE__ */ D(["flex items-center"])
|
|
16
|
+
}, Q = /* @__PURE__ */ S({
|
|
17
17
|
__name: "Sheet",
|
|
18
18
|
props: {
|
|
19
19
|
sheet: {},
|
|
@@ -22,23 +22,26 @@ const I = {
|
|
|
22
22
|
canDelete: { type: Boolean, default: !0 },
|
|
23
23
|
confirmDelete: { type: Boolean, default: !1 },
|
|
24
24
|
confirmDeleteTexts: {},
|
|
25
|
-
allowIconChange: { type: Boolean, default: !0 }
|
|
25
|
+
allowIconChange: { type: Boolean, default: !0 },
|
|
26
|
+
itemClass: { default: "" },
|
|
27
|
+
activeItemClass: { default: "" },
|
|
28
|
+
inactiveItemClass: { default: "" }
|
|
26
29
|
},
|
|
27
30
|
emits: ["select", "update:title", "update:icon", "edit-start", "edit-end", "duplicate", "delete"],
|
|
28
|
-
setup(i, { emit:
|
|
29
|
-
const e = i,
|
|
30
|
-
s.value = e.sheet.title,
|
|
31
|
-
|
|
31
|
+
setup(i, { emit: w }) {
|
|
32
|
+
const e = i, l = w, m = g(null), s = g(e.sheet.title), p = () => {
|
|
33
|
+
s.value = e.sheet.title, l("edit-start", e.sheet.id), M(() => {
|
|
34
|
+
m.value?.focus(), m.value?.select();
|
|
32
35
|
});
|
|
33
36
|
}, h = () => {
|
|
34
37
|
if (!e.isEditing) return;
|
|
35
38
|
const t = s.value.trim();
|
|
36
|
-
t ?
|
|
39
|
+
t ? l("update:title", e.sheet.id, t) : s.value = e.sheet.title, l("edit-end", e.sheet.id);
|
|
37
40
|
}, E = () => {
|
|
38
|
-
s.value = e.sheet.title,
|
|
41
|
+
s.value = e.sheet.title, l("edit-end", e.sheet.id);
|
|
39
42
|
}, T = (t) => {
|
|
40
43
|
t.key === "Enter" && h(), t.key === "Escape" && E();
|
|
41
|
-
}, B =
|
|
44
|
+
}, B = y(() => [
|
|
42
45
|
{ label: "Rename", value: "rename", icon: "lucide:pencil" },
|
|
43
46
|
{ label: "Duplicate", value: "duplicate", icon: "lucide:copy" },
|
|
44
47
|
{
|
|
@@ -54,40 +57,41 @@ const I = {
|
|
|
54
57
|
cancelText: e.confirmDeleteTexts?.cancel,
|
|
55
58
|
variant: "danger",
|
|
56
59
|
onConfirm: () => {
|
|
57
|
-
e.canDelete &&
|
|
60
|
+
e.canDelete && l("delete", e.sheet.id);
|
|
58
61
|
}
|
|
59
62
|
} : void 0
|
|
60
63
|
}
|
|
61
|
-
]),
|
|
62
|
-
if (t.value === "rename" &&
|
|
64
|
+
]), I = (t) => {
|
|
65
|
+
if (t.value === "rename" && p(), t.value === "duplicate" && l("duplicate", e.sheet.id), t.value === "delete") {
|
|
63
66
|
if (!e.canDelete || e.confirmDelete) return;
|
|
64
|
-
|
|
67
|
+
l("delete", e.sheet.id);
|
|
65
68
|
}
|
|
66
|
-
},
|
|
67
|
-
t && t.value && t.value !== "delete" || e.canDelete &&
|
|
68
|
-
},
|
|
69
|
+
}, x = (t) => {
|
|
70
|
+
t && t.value && t.value !== "delete" || e.canDelete && l("delete", e.sheet.id);
|
|
71
|
+
}, $ = y(() => [
|
|
69
72
|
"group relative flex items-center min-w-[120px] max-w-[240px] h-9 px-3 border-r border-border select-none cursor-pointer transition-all duration-200 ease-out",
|
|
70
|
-
e.
|
|
73
|
+
e.itemClass,
|
|
74
|
+
e.isActive ? `bg-muted text-foreground ring-1 ring-border ring-b-0 z-10 ${e.activeItemClass}` : `text-muted-foreground hover:bg-accent/50 ${e.inactiveItemClass}`,
|
|
71
75
|
e.isEditing ? "cursor-text" : ""
|
|
72
|
-
].join(" "));
|
|
73
|
-
return (t,
|
|
74
|
-
class:
|
|
75
|
-
onClick:
|
|
76
|
-
onDblclick:
|
|
76
|
+
].filter(Boolean).join(" "));
|
|
77
|
+
return (t, n) => (a(), c("div", {
|
|
78
|
+
class: D($.value),
|
|
79
|
+
onClick: n[5] || (n[5] = (o) => l("select", i.sheet.id)),
|
|
80
|
+
onDblclick: p
|
|
77
81
|
}, [
|
|
78
82
|
r("div", {
|
|
79
|
-
onClick:
|
|
83
|
+
onClick: n[1] || (n[1] = f(() => {
|
|
80
84
|
}, ["stop"])),
|
|
81
85
|
class: "mr-2 flex items-center shrink-0"
|
|
82
86
|
}, [
|
|
83
|
-
(i.sheet.icon || i.isEditing) && i.allowIconChange ? (
|
|
87
|
+
(i.sheet.icon || i.isEditing) && i.allowIconChange ? (a(), b(z, {
|
|
84
88
|
key: 0,
|
|
85
89
|
value: i.sheet.icon || "lucide:file",
|
|
86
90
|
position: "bottom-start",
|
|
87
|
-
onOnSelect:
|
|
91
|
+
onOnSelect: n[0] || (n[0] = (o) => l("update:icon", i.sheet.id, o))
|
|
88
92
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
r("button",
|
|
93
|
+
default: v(() => [
|
|
94
|
+
r("button", A, [
|
|
91
95
|
d(u, {
|
|
92
96
|
icon: i.sheet.icon || "lucide:file",
|
|
93
97
|
class: "w-4 h-4 opacity-70 hover:opacity-100 transition-opacity"
|
|
@@ -95,55 +99,59 @@ const I = {
|
|
|
95
99
|
])
|
|
96
100
|
]),
|
|
97
101
|
_: 1
|
|
98
|
-
}, 8, ["value"])) : i.sheet.icon ? (
|
|
102
|
+
}, 8, ["value"])) : i.sheet.icon ? (a(), c("div", K, [
|
|
99
103
|
d(u, {
|
|
100
104
|
icon: i.sheet.icon,
|
|
101
105
|
class: "w-4 h-4 opacity-70"
|
|
102
106
|
}, null, 8, ["icon"])
|
|
103
|
-
])) :
|
|
107
|
+
])) : C("", !0)
|
|
104
108
|
]),
|
|
105
109
|
r("div", U, [
|
|
106
|
-
i.isEditing ?
|
|
110
|
+
i.isEditing ? V((a(), c("input", {
|
|
107
111
|
key: 0,
|
|
108
112
|
ref_key: "inputRef",
|
|
109
|
-
ref:
|
|
110
|
-
"onUpdate:modelValue":
|
|
113
|
+
ref: m,
|
|
114
|
+
"onUpdate:modelValue": n[2] || (n[2] = (o) => s.value = o),
|
|
111
115
|
type: "text",
|
|
112
116
|
class: "w-full bg-transparent border-none outline-none p-0 text-sm font-medium text-foreground placeholder-muted-foreground focus:ring-0",
|
|
113
117
|
onBlur: h,
|
|
114
118
|
onKeydown: T,
|
|
115
|
-
onClick:
|
|
119
|
+
onClick: n[3] || (n[3] = f(() => {
|
|
116
120
|
}, ["stop"]))
|
|
117
121
|
}, null, 544)), [
|
|
118
|
-
[
|
|
119
|
-
]) : (
|
|
122
|
+
[N, s.value]
|
|
123
|
+
]) : (a(), c("span", q, k(i.sheet.title), 1))
|
|
120
124
|
]),
|
|
121
|
-
r("div",
|
|
122
|
-
|
|
125
|
+
r("div", {
|
|
126
|
+
class: "opacity-0 group-hover:opacity-100 transition-opacity ml-auto pl-1 flex items-center bg-inherit",
|
|
127
|
+
onClick: n[4] || (n[4] = f(() => {
|
|
128
|
+
}, ["stop"]))
|
|
129
|
+
}, [
|
|
130
|
+
d(O(R), {
|
|
123
131
|
options: B.value,
|
|
124
132
|
position: "bottom-end",
|
|
125
133
|
width: "140px",
|
|
126
134
|
teleport: !0,
|
|
127
|
-
onOnSelect:
|
|
128
|
-
onOnConfirm:
|
|
129
|
-
onConfirm:
|
|
135
|
+
onOnSelect: I,
|
|
136
|
+
onOnConfirm: x,
|
|
137
|
+
onConfirm: x
|
|
130
138
|
}, {
|
|
131
|
-
trigger:
|
|
132
|
-
r("button",
|
|
139
|
+
trigger: v(() => [
|
|
140
|
+
r("button", F, [
|
|
133
141
|
d(u, {
|
|
134
142
|
icon: "lucide:more-vertical",
|
|
135
143
|
class: "w-3.5 h-3.5"
|
|
136
144
|
})
|
|
137
145
|
])
|
|
138
146
|
]),
|
|
139
|
-
item:
|
|
140
|
-
r("div",
|
|
141
|
-
|
|
147
|
+
item: v(({ option: o }) => [
|
|
148
|
+
r("div", G, [
|
|
149
|
+
o?.icon ? (a(), b(u, {
|
|
142
150
|
key: 0,
|
|
143
|
-
icon:
|
|
151
|
+
icon: o?.icon,
|
|
144
152
|
class: "w-3.5 h-3.5 mr-2 opacity-70"
|
|
145
|
-
}, null, 8, ["icon"])) :
|
|
146
|
-
|
|
153
|
+
}, null, 8, ["icon"])) : C("", !0),
|
|
154
|
+
j(" " + k(o?.label), 1)
|
|
147
155
|
])
|
|
148
156
|
]),
|
|
149
157
|
_: 1
|
|
@@ -153,5 +161,5 @@ const I = {
|
|
|
153
161
|
}
|
|
154
162
|
});
|
|
155
163
|
export {
|
|
156
|
-
|
|
164
|
+
Q as default
|
|
157
165
|
};
|
|
@@ -33,11 +33,14 @@ declare const __VLS_component: import('vue').DefineComponent<WorkbookProps, {},
|
|
|
33
33
|
"onUpdate:sheets"?: (sheets: WorkbookSheet[]) => any;
|
|
34
34
|
}>, {
|
|
35
35
|
variant: "chrome" | "folder" | "simple" | "card";
|
|
36
|
+
itemClass: string;
|
|
36
37
|
modelValue: string;
|
|
37
38
|
editable: boolean;
|
|
38
39
|
draggable: boolean;
|
|
39
40
|
confirmDelete: boolean;
|
|
40
41
|
allowIconChange: boolean;
|
|
42
|
+
activeItemClass: string;
|
|
43
|
+
inactiveItemClass: string;
|
|
41
44
|
sheets: WorkbookSheet[];
|
|
42
45
|
addable: boolean;
|
|
43
46
|
addButtonPosition: AddButtonPosition;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Workbook.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const _ = /* @__PURE__ */ r(o, [["__scopeId", "data-v-
|
|
4
|
+
const _ = /* @__PURE__ */ r(o, [["__scopeId", "data-v-833e6dc5"]]);
|
|
5
5
|
export {
|
|
6
6
|
_ as default
|
|
7
7
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as T, ref as g, watch as
|
|
2
|
-
import { useDragAndDrop as
|
|
3
|
-
import { animations as
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as T, ref as g, watch as x, nextTick as U, computed as A, openBlock as d, createElementBlock as o, createElementVNode as c, renderSlot as m, createCommentVNode as u, Fragment as P, renderList as J, unref as O, createBlock as W, createVNode as p } from "vue";
|
|
2
|
+
import { useDragAndDrop as Y } from "@formkit/drag-and-drop/vue";
|
|
3
|
+
import { animations as z } from "@formkit/drag-and-drop";
|
|
4
|
+
import F from "./Sheet.vue.js";
|
|
5
5
|
import b from "./WorkbookAddButton.vue.js";
|
|
6
|
-
const
|
|
6
|
+
const L = { class: "flex flex-col w-full font-sans" }, M = { class: "flex items-end w-full border-b px-1" }, j = {
|
|
7
7
|
key: 0,
|
|
8
|
-
class: "flex items-center
|
|
9
|
-
},
|
|
8
|
+
class: "flex items-center"
|
|
9
|
+
}, q = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "shrink-0 mb-1"
|
|
12
|
-
},
|
|
12
|
+
}, G = { class: "flex items-center mb-0.5 z-20 sticky right-0 ml-auto box-decoration-clone" }, H = { key: 0 }, K = { key: 1 }, Q = { class: "flex-1 relative bg-white w-full" }, te = /* @__PURE__ */ T({
|
|
13
13
|
__name: "Workbook",
|
|
14
14
|
props: {
|
|
15
15
|
modelValue: { default: "" },
|
|
@@ -21,20 +21,23 @@ const F = { class: "flex flex-col w-full font-sans" }, L = { class: "flex items-
|
|
|
21
21
|
maxSheets: { default: 50 },
|
|
22
22
|
variant: { default: "chrome" },
|
|
23
23
|
class: {},
|
|
24
|
+
itemClass: { default: "" },
|
|
25
|
+
activeItemClass: { default: "" },
|
|
26
|
+
inactiveItemClass: { default: "" },
|
|
24
27
|
confirmDelete: { type: Boolean, default: !1 },
|
|
25
28
|
confirmDeleteTexts: {},
|
|
26
29
|
allowIconChange: { type: Boolean, default: !0 }
|
|
27
30
|
},
|
|
28
31
|
emits: ["update:modelValue", "update:sheets", "change", "add", "delete", "duplicate", "edit-start", "edit-end"],
|
|
29
|
-
setup(
|
|
30
|
-
const l =
|
|
31
|
-
plugins: [
|
|
32
|
+
setup(i, { emit: k }) {
|
|
33
|
+
const l = i, a = k, f = g(null), r = g(null), [w, h] = Y(l.sheets, {
|
|
34
|
+
plugins: [z()],
|
|
32
35
|
draggable: (e) => l.draggable && !r.value,
|
|
33
36
|
onSort: (e) => {
|
|
34
|
-
|
|
37
|
+
a("update:sheets", e.values);
|
|
35
38
|
}
|
|
36
39
|
});
|
|
37
|
-
|
|
40
|
+
x(
|
|
38
41
|
() => l.sheets,
|
|
39
42
|
(e) => {
|
|
40
43
|
JSON.stringify(e) !== JSON.stringify(h.value) && (h.value = [...e]);
|
|
@@ -42,44 +45,44 @@ const F = { class: "flex flex-col w-full font-sans" }, L = { class: "flex items-
|
|
|
42
45
|
{ deep: !0 }
|
|
43
46
|
);
|
|
44
47
|
const y = (e) => {
|
|
45
|
-
|
|
48
|
+
a("update:modelValue", e), a("change", e);
|
|
46
49
|
}, v = () => {
|
|
47
|
-
l.sheets.length >= l.maxSheets ||
|
|
48
|
-
},
|
|
49
|
-
const t = l.sheets.findIndex((
|
|
50
|
+
l.sheets.length >= l.maxSheets || a("add");
|
|
51
|
+
}, C = (e, n) => {
|
|
52
|
+
const t = l.sheets.findIndex((s) => s.id === e);
|
|
50
53
|
if (t !== -1) {
|
|
51
|
-
const
|
|
52
|
-
|
|
54
|
+
const s = [...l.sheets];
|
|
55
|
+
s[t] = { ...s[t], title: n }, a("update:sheets", s);
|
|
53
56
|
}
|
|
54
|
-
},
|
|
55
|
-
const t = l.sheets.findIndex((
|
|
57
|
+
}, S = (e, n) => {
|
|
58
|
+
const t = l.sheets.findIndex((s) => s.id === e);
|
|
56
59
|
if (t !== -1) {
|
|
57
|
-
const
|
|
58
|
-
|
|
60
|
+
const s = [...l.sheets];
|
|
61
|
+
s[t] = { ...s[t], icon: n }, a("update:sheets", s);
|
|
59
62
|
}
|
|
63
|
+
}, I = (e) => {
|
|
64
|
+
r.value = e, a("edit-start", e);
|
|
65
|
+
}, D = (e) => {
|
|
66
|
+
r.value = null, a("edit-end", e);
|
|
60
67
|
}, B = (e) => {
|
|
61
|
-
|
|
68
|
+
a("duplicate", e);
|
|
62
69
|
}, V = (e) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
o("duplicate", e);
|
|
66
|
-
}, C = (e) => {
|
|
67
|
-
const s = l.sheets.findIndex((n) => n.id === e);
|
|
68
|
-
if (s === -1) return;
|
|
70
|
+
const n = l.sheets.findIndex((s) => s.id === e);
|
|
71
|
+
if (n === -1) return;
|
|
69
72
|
const t = [...l.sheets];
|
|
70
|
-
if (t.splice(
|
|
71
|
-
let
|
|
73
|
+
if (t.splice(n, 1), a("update:sheets", t), a("delete", e), l.modelValue === e) {
|
|
74
|
+
let s = "";
|
|
72
75
|
if (t.length > 0) {
|
|
73
|
-
const N = Math.min(
|
|
74
|
-
|
|
76
|
+
const N = Math.min(n, t.length - 1);
|
|
77
|
+
s = t[N].id;
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
a("update:modelValue", s), a("change", s);
|
|
77
80
|
}
|
|
78
81
|
};
|
|
79
|
-
|
|
82
|
+
x(
|
|
80
83
|
() => l.sheets.length,
|
|
81
|
-
(e,
|
|
82
|
-
|
|
84
|
+
(e, n) => {
|
|
85
|
+
n !== void 0 && n > 0 && e === n + 1 && l.addable && U(() => {
|
|
83
86
|
const t = l.sheets[l.sheets.length - 1];
|
|
84
87
|
t.id === l.modelValue && (r.value = t.id);
|
|
85
88
|
});
|
|
@@ -87,10 +90,10 @@ const F = { class: "flex flex-col w-full font-sans" }, L = { class: "flex items-
|
|
|
87
90
|
);
|
|
88
91
|
const E = (e) => {
|
|
89
92
|
f.value && e.deltaY !== 0 && (f.value.scrollLeft += e.deltaY, e.preventDefault());
|
|
90
|
-
}, $ =
|
|
91
|
-
return (e,
|
|
92
|
-
c("div",
|
|
93
|
-
e.$slots["left-addons"] ? (
|
|
93
|
+
}, $ = A(() => l.sheets.length > 1);
|
|
94
|
+
return (e, n) => (d(), o("div", L, [
|
|
95
|
+
c("div", M, [
|
|
96
|
+
e.$slots["left-addons"] ? (d(), o("div", j, [
|
|
94
97
|
m(e.$slots, "left-addons", {}, void 0, !0)
|
|
95
98
|
])) : u("", !0),
|
|
96
99
|
c("div", {
|
|
@@ -105,39 +108,42 @@ const F = { class: "flex flex-col w-full font-sans" }, L = { class: "flex items-
|
|
|
105
108
|
ref: w,
|
|
106
109
|
class: "flex items-end"
|
|
107
110
|
}, [
|
|
108
|
-
(
|
|
111
|
+
(d(!0), o(P, null, J(O(h), (t) => (d(), W(F, {
|
|
109
112
|
key: t.id,
|
|
110
113
|
sheet: t,
|
|
111
|
-
"is-active":
|
|
114
|
+
"is-active": i.modelValue === t.id,
|
|
112
115
|
"is-editing": r.value === t.id,
|
|
113
116
|
"can-delete": $.value,
|
|
114
|
-
"confirm-delete":
|
|
115
|
-
"confirm-delete-texts":
|
|
116
|
-
"allow-icon-change":
|
|
117
|
+
"confirm-delete": i.confirmDelete,
|
|
118
|
+
"confirm-delete-texts": i.confirmDeleteTexts,
|
|
119
|
+
"allow-icon-change": i.allowIconChange,
|
|
120
|
+
"item-class": i.itemClass,
|
|
121
|
+
"active-item-class": i.activeItemClass,
|
|
122
|
+
"inactive-item-class": i.inactiveItemClass,
|
|
117
123
|
onSelect: y,
|
|
118
|
-
"onUpdate:title":
|
|
119
|
-
"onUpdate:icon":
|
|
120
|
-
onEditStart:
|
|
121
|
-
onEditEnd:
|
|
122
|
-
onDuplicate:
|
|
123
|
-
onDelete:
|
|
124
|
-
}, null, 8, ["sheet", "is-active", "is-editing", "can-delete", "confirm-delete", "confirm-delete-texts", "allow-icon-change"]))), 128))
|
|
124
|
+
"onUpdate:title": C,
|
|
125
|
+
"onUpdate:icon": S,
|
|
126
|
+
onEditStart: I,
|
|
127
|
+
onEditEnd: D,
|
|
128
|
+
onDuplicate: B,
|
|
129
|
+
onDelete: V
|
|
130
|
+
}, null, 8, ["sheet", "is-active", "is-editing", "can-delete", "confirm-delete", "confirm-delete-texts", "allow-icon-change", "item-class", "active-item-class", "inactive-item-class"]))), 128))
|
|
125
131
|
], 512),
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
i.addable && i.addButtonPosition === "attached" ? (d(), o("div", q, [
|
|
133
|
+
p(b, { onClick: v })
|
|
128
134
|
])) : u("", !0),
|
|
129
|
-
|
|
135
|
+
n[0] || (n[0] = c("div", { class: "w-1 shrink-0" }, null, -1))
|
|
130
136
|
], 544),
|
|
131
|
-
c("div",
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
c("div", G, [
|
|
138
|
+
i.addable && i.addButtonPosition === "fixed-right" ? (d(), o("div", H, [
|
|
139
|
+
p(b, { onClick: v })
|
|
134
140
|
])) : u("", !0),
|
|
135
|
-
e.$slots["right-addons"] ? (
|
|
141
|
+
e.$slots["right-addons"] ? (d(), o("div", K, [
|
|
136
142
|
m(e.$slots, "right-addons", {}, void 0, !0)
|
|
137
143
|
])) : u("", !0)
|
|
138
144
|
])
|
|
139
145
|
]),
|
|
140
|
-
c("div",
|
|
146
|
+
c("div", Q, [
|
|
141
147
|
m(e.$slots, "default", {}, void 0, !0)
|
|
142
148
|
])
|
|
143
149
|
]));
|
|
@@ -19,6 +19,9 @@ export interface WorkbookProps {
|
|
|
19
19
|
maxSheets?: number;
|
|
20
20
|
variant?: 'chrome' | 'folder' | 'simple' | 'card';
|
|
21
21
|
class?: string;
|
|
22
|
+
itemClass?: string;
|
|
23
|
+
activeItemClass?: string;
|
|
24
|
+
inactiveItemClass?: string;
|
|
22
25
|
confirmDelete?: boolean;
|
|
23
26
|
confirmDeleteTexts?: {
|
|
24
27
|
title?: string;
|
package/package.json
CHANGED