vlite3 0.2.6 → 0.2.8
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/Carousel/Carousel.vue.d.ts +14 -0
- 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/DataTable/DataTable.vue.js +2 -2
- package/components/DataTable/DataTable.vue2.js +18 -15
- package/components/DataTable/DataTableRow.vue.js +47 -44
- package/components/Kanban/Kanban.vue.d.ts +60 -0
- package/components/Kanban/Kanban.vue.js +7 -0
- package/components/Kanban/Kanban.vue2.js +62 -0
- package/components/Kanban/KanbanBoard.vue.d.ts +59 -0
- package/components/Kanban/KanbanBoard.vue.js +7 -0
- package/components/Kanban/KanbanBoard.vue2.js +132 -0
- package/components/Kanban/index.d.ts +4 -0
- package/components/Kanban/types.d.ts +32 -0
- package/components/Kanban/useKanbanBoard.d.ts +13 -0
- package/components/Kanban/useKanbanBoard.js +43 -0
- 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 -2
- package/components/Workbook/Workbook.vue.js +152 -5
- package/components/Workbook/Workbook.vue2.js +2 -146
- package/components/Workbook/types.d.ts +3 -0
- package/index.d.ts +1 -1
- package/index.js +120 -114
- package/package.json +3 -3
- package/style.css +5 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ref as l, reactive as g } from "vue";
|
|
2
|
+
function I(c, a, r) {
|
|
3
|
+
const o = l(r ? [...r] : []), n = l(!1), s = l(!1), t = g({
|
|
4
|
+
currentPage: 1,
|
|
5
|
+
totalPages: 1,
|
|
6
|
+
totalItems: r ? r.length : 0
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
items: o,
|
|
10
|
+
isInitialLoading: n,
|
|
11
|
+
isLoadingMore: s,
|
|
12
|
+
pageInfo: t,
|
|
13
|
+
loadInitial: async () => {
|
|
14
|
+
if (a) {
|
|
15
|
+
n.value = !0;
|
|
16
|
+
try {
|
|
17
|
+
const e = await a(c, 1);
|
|
18
|
+
o.value = e.items, t.currentPage = e.pageInfo.currentPage, t.totalPages = e.pageInfo.totalPages, t.totalItems = e.pageInfo.totalItems;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
} finally {
|
|
22
|
+
n.value = !1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
loadMore: async () => {
|
|
27
|
+
if (!(!a || n.value || s.value) && !(t.currentPage >= t.totalPages)) {
|
|
28
|
+
s.value = !0;
|
|
29
|
+
try {
|
|
30
|
+
const e = await a(c, t.currentPage + 1);
|
|
31
|
+
o.value = [...o.value, ...e.items], t.currentPage = e.pageInfo.currentPage, t.totalPages = e.pageInfo.totalPages, t.totalItems = e.pageInfo.totalItems;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.error(e);
|
|
34
|
+
} finally {
|
|
35
|
+
s.value = !1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
I as useKanbanBoard
|
|
43
|
+
};
|
|
@@ -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
|
};
|
|
@@ -8,7 +8,6 @@ declare function __VLS_template(): {
|
|
|
8
8
|
};
|
|
9
9
|
refs: {
|
|
10
10
|
scrollContainer: HTMLDivElement;
|
|
11
|
-
parent: HTMLDivElement;
|
|
12
11
|
};
|
|
13
12
|
rootEl: HTMLDivElement;
|
|
14
13
|
};
|
|
@@ -33,18 +32,20 @@ declare const __VLS_component: import('vue').DefineComponent<WorkbookProps, {},
|
|
|
33
32
|
"onUpdate:sheets"?: (sheets: WorkbookSheet[]) => any;
|
|
34
33
|
}>, {
|
|
35
34
|
variant: "chrome" | "folder" | "simple" | "card";
|
|
35
|
+
itemClass: string;
|
|
36
36
|
modelValue: string;
|
|
37
37
|
editable: boolean;
|
|
38
38
|
draggable: boolean;
|
|
39
39
|
confirmDelete: boolean;
|
|
40
40
|
allowIconChange: boolean;
|
|
41
|
+
activeItemClass: string;
|
|
42
|
+
inactiveItemClass: string;
|
|
41
43
|
sheets: WorkbookSheet[];
|
|
42
44
|
addable: boolean;
|
|
43
45
|
addButtonPosition: AddButtonPosition;
|
|
44
46
|
maxSheets: number;
|
|
45
47
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
46
48
|
scrollContainer: HTMLDivElement;
|
|
47
|
-
parent: HTMLDivElement;
|
|
48
49
|
}, HTMLDivElement>;
|
|
49
50
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
50
51
|
export default _default;
|
|
@@ -1,7 +1,154 @@
|
|
|
1
|
-
import o from "
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as N, ref as m, watch as b, nextTick as T, computed as P, openBlock as i, createElementBlock as o, createElementVNode as r, renderSlot as v, createCommentVNode as f, createVNode as g, unref as A, withCtx as J, Fragment as O, renderList as W, createBlock as Y } from "vue";
|
|
2
|
+
import { VueDraggable as z } from "vue-draggable-plus";
|
|
3
|
+
import F from "./Sheet.vue.js";
|
|
4
|
+
import p from "./WorkbookAddButton.vue.js";
|
|
5
|
+
const L = { class: "flex flex-col w-full font-sans" }, M = { class: "flex items-end w-full border-b px-1" }, j = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex items-center"
|
|
8
|
+
}, q = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "shrink-0 mb-1"
|
|
11
|
+
}, 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" }, ee = /* @__PURE__ */ N({
|
|
12
|
+
__name: "Workbook",
|
|
13
|
+
props: {
|
|
14
|
+
modelValue: { default: "" },
|
|
15
|
+
sheets: { default: () => [] },
|
|
16
|
+
editable: { type: Boolean, default: !0 },
|
|
17
|
+
addable: { type: Boolean, default: !0 },
|
|
18
|
+
draggable: { type: Boolean, default: !0 },
|
|
19
|
+
addButtonPosition: { default: "fixed-right" },
|
|
20
|
+
maxSheets: { default: 50 },
|
|
21
|
+
variant: { default: "chrome" },
|
|
22
|
+
class: {},
|
|
23
|
+
itemClass: { default: "" },
|
|
24
|
+
activeItemClass: { default: "" },
|
|
25
|
+
inactiveItemClass: { default: "" },
|
|
26
|
+
confirmDelete: { type: Boolean, default: !1 },
|
|
27
|
+
confirmDeleteTexts: {},
|
|
28
|
+
allowIconChange: { type: Boolean, default: !0 }
|
|
29
|
+
},
|
|
30
|
+
emits: ["update:modelValue", "update:sheets", "change", "add", "delete", "duplicate", "edit-start", "edit-end"],
|
|
31
|
+
setup(d, { emit: k }) {
|
|
32
|
+
const l = d, n = k, h = m(null), c = m(null), u = m([...l.sheets]);
|
|
33
|
+
b(
|
|
34
|
+
() => l.sheets,
|
|
35
|
+
(e) => {
|
|
36
|
+
JSON.stringify(e) !== JSON.stringify(u.value) && (u.value = [...e]);
|
|
37
|
+
},
|
|
38
|
+
{ deep: !0 }
|
|
39
|
+
);
|
|
40
|
+
const w = (e) => {
|
|
41
|
+
u.value = e, n("update:sheets", e);
|
|
42
|
+
}, y = (e) => {
|
|
43
|
+
n("update:modelValue", e), n("change", e);
|
|
44
|
+
}, x = () => {
|
|
45
|
+
l.sheets.length >= l.maxSheets || n("add");
|
|
46
|
+
}, C = (e, s) => {
|
|
47
|
+
const t = l.sheets.findIndex((a) => a.id === e);
|
|
48
|
+
if (t !== -1) {
|
|
49
|
+
const a = [...l.sheets];
|
|
50
|
+
a[t] = { ...a[t], title: s }, n("update:sheets", a);
|
|
51
|
+
}
|
|
52
|
+
}, S = (e, s) => {
|
|
53
|
+
const t = l.sheets.findIndex((a) => a.id === e);
|
|
54
|
+
if (t !== -1) {
|
|
55
|
+
const a = [...l.sheets];
|
|
56
|
+
a[t] = { ...a[t], icon: s }, n("update:sheets", a);
|
|
57
|
+
}
|
|
58
|
+
}, I = (e) => {
|
|
59
|
+
c.value = e, n("edit-start", e);
|
|
60
|
+
}, V = (e) => {
|
|
61
|
+
c.value = null, n("edit-end", e);
|
|
62
|
+
}, B = (e) => {
|
|
63
|
+
n("duplicate", e);
|
|
64
|
+
}, D = (e) => {
|
|
65
|
+
const s = l.sheets.findIndex((a) => a.id === e);
|
|
66
|
+
if (s === -1) return;
|
|
67
|
+
const t = [...l.sheets];
|
|
68
|
+
if (t.splice(s, 1), n("update:sheets", t), n("delete", e), l.modelValue === e) {
|
|
69
|
+
let a = "";
|
|
70
|
+
if (t.length > 0) {
|
|
71
|
+
const U = Math.min(s, t.length - 1);
|
|
72
|
+
a = t[U].id;
|
|
73
|
+
}
|
|
74
|
+
n("update:modelValue", a), n("change", a);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
b(
|
|
78
|
+
() => l.sheets.length,
|
|
79
|
+
(e, s) => {
|
|
80
|
+
s !== void 0 && s > 0 && e === s + 1 && l.addable && T(() => {
|
|
81
|
+
const t = l.sheets[l.sheets.length - 1];
|
|
82
|
+
t.id === l.modelValue && (c.value = t.id);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
const E = (e) => {
|
|
87
|
+
h.value && e.deltaY !== 0 && (h.value.scrollLeft += e.deltaY, e.preventDefault());
|
|
88
|
+
}, $ = P(() => l.sheets.length > 1);
|
|
89
|
+
return (e, s) => (i(), o("div", L, [
|
|
90
|
+
r("div", M, [
|
|
91
|
+
e.$slots["left-addons"] ? (i(), o("div", j, [
|
|
92
|
+
v(e.$slots, "left-addons")
|
|
93
|
+
])) : f("", !0),
|
|
94
|
+
r("div", {
|
|
95
|
+
ref_key: "scrollContainer",
|
|
96
|
+
ref: h,
|
|
97
|
+
class: "flex-1 flex items-end overflow-x-auto scrollbar-none overscroll-contain",
|
|
98
|
+
style: { "scrollbar-width": "none", "-ms-overflow-style": "none" },
|
|
99
|
+
onWheel: E
|
|
100
|
+
}, [
|
|
101
|
+
g(A(z), {
|
|
102
|
+
"model-value": u.value,
|
|
103
|
+
"onUpdate:modelValue": w,
|
|
104
|
+
disabled: !l.draggable || !!c.value,
|
|
105
|
+
animation: 150,
|
|
106
|
+
class: "flex items-end"
|
|
107
|
+
}, {
|
|
108
|
+
default: J(() => [
|
|
109
|
+
(i(!0), o(O, null, W(u.value, (t) => (i(), Y(F, {
|
|
110
|
+
key: t.id,
|
|
111
|
+
sheet: t,
|
|
112
|
+
"is-active": d.modelValue === t.id,
|
|
113
|
+
"is-editing": c.value === t.id,
|
|
114
|
+
"can-delete": $.value,
|
|
115
|
+
"confirm-delete": d.confirmDelete,
|
|
116
|
+
"confirm-delete-texts": d.confirmDeleteTexts,
|
|
117
|
+
"allow-icon-change": d.allowIconChange,
|
|
118
|
+
"item-class": d.itemClass,
|
|
119
|
+
"active-item-class": d.activeItemClass,
|
|
120
|
+
"inactive-item-class": d.inactiveItemClass,
|
|
121
|
+
onSelect: y,
|
|
122
|
+
"onUpdate:title": C,
|
|
123
|
+
"onUpdate:icon": S,
|
|
124
|
+
onEditStart: I,
|
|
125
|
+
onEditEnd: V,
|
|
126
|
+
onDuplicate: B,
|
|
127
|
+
onDelete: D
|
|
128
|
+
}, 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))
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}, 8, ["model-value", "disabled"]),
|
|
132
|
+
d.addable && d.addButtonPosition === "attached" ? (i(), o("div", q, [
|
|
133
|
+
g(p, { onClick: x })
|
|
134
|
+
])) : f("", !0),
|
|
135
|
+
s[0] || (s[0] = r("div", { class: "w-1 shrink-0" }, null, -1))
|
|
136
|
+
], 544),
|
|
137
|
+
r("div", G, [
|
|
138
|
+
d.addable && d.addButtonPosition === "fixed-right" ? (i(), o("div", H, [
|
|
139
|
+
g(p, { onClick: x })
|
|
140
|
+
])) : f("", !0),
|
|
141
|
+
e.$slots["right-addons"] ? (i(), o("div", K, [
|
|
142
|
+
v(e.$slots, "right-addons")
|
|
143
|
+
])) : f("", !0)
|
|
144
|
+
])
|
|
145
|
+
]),
|
|
146
|
+
r("div", Q, [
|
|
147
|
+
v(e.$slots, "default")
|
|
148
|
+
])
|
|
149
|
+
]));
|
|
150
|
+
}
|
|
151
|
+
});
|
|
5
152
|
export {
|
|
6
|
-
|
|
153
|
+
ee as default
|
|
7
154
|
};
|