vlite3 1.5.18 → 1.5.19
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/CategoryManager/CategoryManager2.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/EditableTitle/EditableTitle.vue.js +2 -2
- package/components/EditableTitle/EditableTitle2.vue.js +187 -184
- package/components/Form/{AccordionView2.vue.js → AccordionView.vue.js} +1 -1
- package/components/Form/index2.vue.js +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Workbook/Sheet.vue.d.ts +5 -0
- package/components/Workbook/Sheet.vue.js +81 -72
- package/components/Workbook/Workbook.vue.d.ts +1 -0
- package/components/Workbook/Workbook.vue.js +2 -2
- package/components/Workbook/Workbook2.vue.js +100 -95
- package/components/Workbook/types.d.ts +4 -0
- package/docs/components/editable-title.md +6 -6
- package/docs/components/workbook.md +7 -2
- package/docs-manifest.json +4 -4
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -6,6 +6,7 @@ interface Props {
|
|
|
6
6
|
canRename?: boolean;
|
|
7
7
|
canDuplicate?: boolean;
|
|
8
8
|
canDelete?: boolean;
|
|
9
|
+
showContextMenu?: boolean;
|
|
9
10
|
customOptions?: WorkbookCustomOption[];
|
|
10
11
|
confirmDelete?: boolean;
|
|
11
12
|
confirmDeleteTexts?: {
|
|
@@ -16,6 +17,8 @@ interface Props {
|
|
|
16
17
|
};
|
|
17
18
|
allowIconChange?: boolean;
|
|
18
19
|
canChangeIcon?: boolean;
|
|
20
|
+
/** Width of the sheet context-menu dropdown. */
|
|
21
|
+
menuWidth?: string;
|
|
19
22
|
itemClass?: string;
|
|
20
23
|
activeItemClass?: string;
|
|
21
24
|
inactiveItemClass?: string;
|
|
@@ -57,8 +60,10 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
57
60
|
canDuplicate: boolean;
|
|
58
61
|
canDelete: boolean;
|
|
59
62
|
canChangeIcon: boolean;
|
|
63
|
+
showContextMenu: boolean;
|
|
60
64
|
customOptions: WorkbookCustomOption[];
|
|
61
65
|
allowIconChange: boolean;
|
|
66
|
+
menuWidth: string;
|
|
62
67
|
activeItemClass: string;
|
|
63
68
|
inactiveItemClass: string;
|
|
64
69
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as M, useSlots as R, ref as k, computed as d, openBlock as r, createElementBlock as c, normalizeClass as V, createElementVNode as m, withModifiers as u, createBlock as j, withCtx as b, createVNode as f, createCommentVNode as w, withDirectives as z, withKeys as C, vModelText as A, toDisplayString as K, unref as N, createSlots as U, renderSlot as W, nextTick as P } from "vue";
|
|
2
|
+
import D from "../Icon.vue.js";
|
|
3
3
|
import q from "../Dropdown/Dropdown.vue.js";
|
|
4
|
-
import { $t as
|
|
4
|
+
import { $t as s } from "../../utils/i18n.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
@@ -9,14 +9,14 @@ import F from "../Button.vue.js";
|
|
|
9
9
|
import G from "../IconPicker.vue.js";
|
|
10
10
|
const H = {
|
|
11
11
|
type: "button",
|
|
12
|
-
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
|
|
12
|
+
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"
|
|
13
13
|
}, J = {
|
|
14
14
|
key: 1,
|
|
15
15
|
class: "flex items-center justify-center p-0.5"
|
|
16
|
-
}, L = { class: "flex-1 min-w-0 pr-1" }, Q = ["onKeydown"],
|
|
16
|
+
}, L = { class: "flex-1 min-w-0 pr-1" }, Q = ["onKeydown"], X = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "block truncate text-sm font-medium leading-normal"
|
|
19
|
-
},
|
|
19
|
+
}, se = /* @__PURE__ */ M({
|
|
20
20
|
__name: "Sheet",
|
|
21
21
|
props: {
|
|
22
22
|
sheet: {},
|
|
@@ -25,46 +25,48 @@ const H = {
|
|
|
25
25
|
canRename: { type: Boolean, default: !0 },
|
|
26
26
|
canDuplicate: { type: Boolean, default: !0 },
|
|
27
27
|
canDelete: { type: Boolean, default: !0 },
|
|
28
|
+
showContextMenu: { type: Boolean, default: !0 },
|
|
28
29
|
customOptions: { default: () => [] },
|
|
29
30
|
confirmDelete: { type: Boolean, default: !1 },
|
|
30
31
|
confirmDeleteTexts: {},
|
|
31
32
|
allowIconChange: { type: Boolean, default: !0 },
|
|
32
33
|
canChangeIcon: { type: Boolean, default: !0 },
|
|
34
|
+
menuWidth: { default: "140px" },
|
|
33
35
|
itemClass: { default: "" },
|
|
34
36
|
activeItemClass: { default: "" },
|
|
35
37
|
inactiveItemClass: { default: "" }
|
|
36
38
|
},
|
|
37
39
|
emits: ["select", "update:title", "update:icon", "edit-start", "edit-end", "duplicate", "delete"],
|
|
38
|
-
setup(
|
|
39
|
-
const e =
|
|
40
|
-
() => e.sheet.titleI18n ?
|
|
41
|
-
),
|
|
42
|
-
e.canRename && (
|
|
43
|
-
|
|
40
|
+
setup(n, { emit: B }) {
|
|
41
|
+
const e = n, i = B, I = R(), p = k(null), a = k(e.sheet.title), v = k(!1), T = d(
|
|
42
|
+
() => e.sheet.titleI18n ? s(e.sheet.titleI18n) : e.sheet.title
|
|
43
|
+
), g = () => {
|
|
44
|
+
e.canRename && (a.value = e.sheet.title, i("edit-start", e.sheet.id), P(() => {
|
|
45
|
+
p.value?.focus(), p.value?.select();
|
|
44
46
|
}));
|
|
45
47
|
};
|
|
46
|
-
let
|
|
47
|
-
const
|
|
48
|
-
if (!e.isEditing ||
|
|
49
|
-
|
|
50
|
-
const o =
|
|
51
|
-
o ?
|
|
52
|
-
|
|
48
|
+
let h = !1;
|
|
49
|
+
const y = () => {
|
|
50
|
+
if (!e.isEditing || h) return;
|
|
51
|
+
h = !0;
|
|
52
|
+
const o = a.value.trim();
|
|
53
|
+
o ? i("update:title", e.sheet.id, o) : a.value = e.sheet.title, i("edit-end", e.sheet.id), setTimeout(() => {
|
|
54
|
+
h = !1;
|
|
53
55
|
}, 100);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
56
|
+
}, O = () => {
|
|
57
|
+
a.value = e.sheet.title, i("edit-end", e.sheet.id);
|
|
58
|
+
}, x = d(() => {
|
|
57
59
|
const o = [];
|
|
58
60
|
e.canRename && o.push({
|
|
59
|
-
label:
|
|
61
|
+
label: s("vlite.workbook.rename") !== "vlite.workbook.rename" ? s("vlite.workbook.rename") : "Rename",
|
|
60
62
|
value: "rename",
|
|
61
63
|
icon: "lucide:pencil"
|
|
62
64
|
}), e.canDuplicate && o.push({
|
|
63
|
-
label:
|
|
65
|
+
label: s("vlite.workbook.duplicate") !== "vlite.workbook.duplicate" ? s("vlite.workbook.duplicate") : "Duplicate",
|
|
64
66
|
value: "duplicate",
|
|
65
67
|
icon: "lucide:copy"
|
|
66
68
|
}), e.canDelete && o.push({
|
|
67
|
-
label:
|
|
69
|
+
label: s("vlite.workbook.delete") !== "vlite.workbook.delete" ? s("vlite.workbook.delete") : "Delete",
|
|
68
70
|
value: "delete",
|
|
69
71
|
icon: "lucide:trash-2",
|
|
70
72
|
confirmation: e.confirmDelete ? {
|
|
@@ -85,89 +87,91 @@ const H = {
|
|
|
85
87
|
});
|
|
86
88
|
return o;
|
|
87
89
|
}), E = d(
|
|
88
|
-
() =>
|
|
89
|
-
),
|
|
90
|
+
() => e.showContextMenu && (x.value.length > 0 || !!I["sheet-actions"])
|
|
91
|
+
), S = (o) => {
|
|
90
92
|
const t = o.option?.data?.workbookCustomOption;
|
|
91
93
|
if (t) {
|
|
92
94
|
t.onClick(e.sheet);
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
95
|
-
if (o.value === "rename" &&
|
|
97
|
+
if (o.value === "rename" && g(), o.value === "duplicate" && e.canDuplicate && i("duplicate", e.sheet.id), o.value === "delete") {
|
|
96
98
|
if (!e.canDelete) return;
|
|
97
|
-
|
|
99
|
+
i("delete", e.sheet.id);
|
|
98
100
|
}
|
|
99
|
-
},
|
|
101
|
+
}, $ = d(() => [
|
|
100
102
|
"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",
|
|
101
103
|
e.itemClass,
|
|
102
104
|
e.isActive ? `bg-secondary text-foreground ring-1 ring-border ring-b-0 z-10 ${e.activeItemClass}` : `text-muted-foreground hover:bg-accent/50 ${e.inactiveItemClass}`,
|
|
103
105
|
e.isEditing ? "cursor-text" : ""
|
|
104
106
|
].filter(Boolean).join(" "));
|
|
105
|
-
return (o, t) => (
|
|
106
|
-
class:
|
|
107
|
-
onClick: t[
|
|
108
|
-
onDblclick:
|
|
107
|
+
return (o, t) => (r(), c("div", {
|
|
108
|
+
class: V($.value),
|
|
109
|
+
onClick: t[7] || (t[7] = (l) => i("select", n.sheet.id)),
|
|
110
|
+
onDblclick: g
|
|
109
111
|
}, [
|
|
110
|
-
|
|
111
|
-
onClick: t[1] || (t[1] =
|
|
112
|
+
m("div", {
|
|
113
|
+
onClick: t[1] || (t[1] = u(() => {
|
|
112
114
|
}, ["stop"])),
|
|
113
115
|
class: "mr-2 flex items-center shrink-0"
|
|
114
116
|
}, [
|
|
115
|
-
(
|
|
117
|
+
(n.sheet.icon || n.isEditing) && n.allowIconChange && n.canChangeIcon ? (r(), j(G, {
|
|
116
118
|
key: 0,
|
|
117
|
-
value:
|
|
119
|
+
value: n.sheet.icon || "lucide:file",
|
|
118
120
|
position: "bottom-start",
|
|
119
|
-
onOnSelect: t[0] || (t[0] = (
|
|
121
|
+
onOnSelect: t[0] || (t[0] = (l) => n.canChangeIcon && i("update:icon", n.sheet.id, l))
|
|
120
122
|
}, {
|
|
121
|
-
default:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
icon:
|
|
123
|
+
default: b(() => [
|
|
124
|
+
m("button", H, [
|
|
125
|
+
f(D, {
|
|
126
|
+
icon: n.sheet.icon || "lucide:file",
|
|
125
127
|
class: "w-4 h-4 opacity-70 hover:opacity-100 transition-opacity"
|
|
126
128
|
}, null, 8, ["icon"])
|
|
127
129
|
])
|
|
128
130
|
]),
|
|
129
131
|
_: 1
|
|
130
|
-
}, 8, ["value"])) :
|
|
131
|
-
|
|
132
|
-
icon:
|
|
132
|
+
}, 8, ["value"])) : n.sheet.icon ? (r(), c("div", J, [
|
|
133
|
+
f(D, {
|
|
134
|
+
icon: n.sheet.icon,
|
|
133
135
|
class: "w-4 h-4 opacity-70"
|
|
134
136
|
}, null, 8, ["icon"])
|
|
135
|
-
])) :
|
|
137
|
+
])) : w("", !0)
|
|
136
138
|
]),
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
m("div", L, [
|
|
140
|
+
n.isEditing ? z((r(), c("input", {
|
|
139
141
|
key: 0,
|
|
140
142
|
ref_key: "inputRef",
|
|
141
|
-
ref:
|
|
142
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
143
|
+
ref: p,
|
|
144
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => a.value = l),
|
|
143
145
|
type: "text",
|
|
144
146
|
class: "w-full bg-transparent border-none outline-none p-0 text-sm font-medium text-foreground placeholder-muted-foreground focus:ring-0",
|
|
145
|
-
onBlur:
|
|
147
|
+
onBlur: y,
|
|
146
148
|
onKeydown: [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
C(u(y, ["prevent"]), ["enter"]),
|
|
150
|
+
C(u(O, ["prevent"]), ["esc"])
|
|
149
151
|
],
|
|
150
|
-
onClick: t[3] || (t[3] =
|
|
152
|
+
onClick: t[3] || (t[3] = u(() => {
|
|
151
153
|
}, ["stop"]))
|
|
152
154
|
}, null, 40, Q)), [
|
|
153
|
-
[
|
|
154
|
-
]) : (
|
|
155
|
+
[A, a.value]
|
|
156
|
+
]) : (r(), c("span", X, K(T.value), 1))
|
|
155
157
|
]),
|
|
156
|
-
E.value ? (
|
|
158
|
+
E.value ? (r(), c("div", {
|
|
157
159
|
key: 0,
|
|
158
160
|
class: "opacity-0 group-hover:opacity-100 transition-opacity ml-auto pl-1 -mr-2 flex items-center",
|
|
159
|
-
onClick: t[
|
|
161
|
+
onClick: t[6] || (t[6] = u(() => {
|
|
160
162
|
}, ["stop"]))
|
|
161
163
|
}, [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
f(N(q), {
|
|
165
|
+
"is-open": v.value,
|
|
166
|
+
"onUpdate:isOpen": t[5] || (t[5] = (l) => v.value = l),
|
|
167
|
+
options: x.value,
|
|
164
168
|
position: "bottom-end",
|
|
165
|
-
width:
|
|
169
|
+
width: n.menuWidth,
|
|
166
170
|
teleport: !0,
|
|
167
|
-
onOnSelect:
|
|
168
|
-
},
|
|
169
|
-
trigger:
|
|
170
|
-
|
|
171
|
+
onOnSelect: S
|
|
172
|
+
}, U({
|
|
173
|
+
trigger: b(() => [
|
|
174
|
+
f(F, {
|
|
171
175
|
icon: "lucide:more-vertical",
|
|
172
176
|
asIcon: "",
|
|
173
177
|
size: "xs",
|
|
@@ -178,17 +182,22 @@ const H = {
|
|
|
178
182
|
_: 2
|
|
179
183
|
}, [
|
|
180
184
|
o.$slots["sheet-actions"] ? {
|
|
181
|
-
name: "
|
|
182
|
-
fn:
|
|
183
|
-
|
|
185
|
+
name: "footer",
|
|
186
|
+
fn: b(() => [
|
|
187
|
+
m("div", {
|
|
188
|
+
class: "border-t p-1 space-y-0.5",
|
|
189
|
+
onClickCapture: t[4] || (t[4] = (l) => v.value = !1)
|
|
190
|
+
}, [
|
|
191
|
+
W(o.$slots, "sheet-actions", { sheet: n.sheet })
|
|
192
|
+
], 32)
|
|
184
193
|
]),
|
|
185
194
|
key: "0"
|
|
186
195
|
} : void 0
|
|
187
|
-
]), 1032, ["options"])
|
|
188
|
-
])) :
|
|
196
|
+
]), 1032, ["is-open", "options", "width"])
|
|
197
|
+
])) : w("", !0)
|
|
189
198
|
], 34));
|
|
190
199
|
}
|
|
191
200
|
});
|
|
192
201
|
export {
|
|
193
|
-
|
|
202
|
+
se as default
|
|
194
203
|
};
|
|
@@ -46,6 +46,7 @@ declare const __VLS_component: import('vue').DefineComponent<WorkbookProps, {},
|
|
|
46
46
|
canChangeIcon: boolean;
|
|
47
47
|
customOptions: import('./types').WorkbookCustomOption[];
|
|
48
48
|
allowIconChange: boolean;
|
|
49
|
+
menuWidth: string;
|
|
49
50
|
activeItemClass: string;
|
|
50
51
|
inactiveItemClass: string;
|
|
51
52
|
sheets: WorkbookSheet[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Workbook2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const _ = /* @__PURE__ */ r(o, [["__scopeId", "data-v-42c2d8b9"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
_ as default
|
|
7
7
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useScroll as
|
|
3
|
-
import { VueDraggable as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as j, ref as S, shallowRef as F, watch as q, openBlock as d, createElementBlock as c, createElementVNode as f, renderSlot as g, createCommentVNode as x, createVNode as b, unref as V, withCtx as $, Fragment as G, renderList as H, isMemoSame as J, createBlock as K, createSlots as Q, normalizeClass as X } from "vue";
|
|
2
|
+
import { useScroll as Z } from "@vueuse/core";
|
|
3
|
+
import { VueDraggable as _ } from "vue-draggable-plus";
|
|
4
|
+
import ee from "./Sheet.vue.js";
|
|
5
|
+
import E from "./WorkbookAddButton.vue.js";
|
|
6
|
+
const te = { class: "flex flex-col w-full font-sans" }, ne = { class: "flex items-end w-full border-b px-1" }, ae = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "flex items-center"
|
|
9
|
-
},
|
|
9
|
+
}, le = { class: "flex items-center mb-0.5 z-20 sticky right-0 ml-auto box-decoration-clone" }, oe = { key: 0 }, se = { key: 1 }, ie = { class: "flex-1 relative bg-white w-full" }, me = /* @__PURE__ */ j({
|
|
10
10
|
__name: "Workbook",
|
|
11
11
|
props: {
|
|
12
12
|
modelValue: { default: "" },
|
|
@@ -29,74 +29,75 @@ const ee = { class: "flex flex-col w-full font-sans" }, te = { class: "flex item
|
|
|
29
29
|
inactiveItemClass: { default: "" },
|
|
30
30
|
confirmDelete: { type: Boolean, default: !1 },
|
|
31
31
|
confirmDeleteTexts: {},
|
|
32
|
+
menuWidth: { default: "140px" },
|
|
32
33
|
allowIconChange: { type: Boolean, default: !0 }
|
|
33
34
|
},
|
|
34
35
|
emits: ["update:modelValue", "update:sheets", "change", "add", "delete", "duplicate", "edit-start", "edit-end"],
|
|
35
|
-
setup(
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
() => [...
|
|
36
|
+
setup(a, { emit: U }) {
|
|
37
|
+
const l = a, s = U, m = S(null), u = S(null), { arrivedState: W } = Z(m), i = F([...l.sheets]);
|
|
38
|
+
q(
|
|
39
|
+
() => [...l.sheets],
|
|
39
40
|
(e) => {
|
|
40
|
-
let
|
|
41
|
+
let n = !1;
|
|
41
42
|
if (e.length !== i.value.length)
|
|
42
|
-
|
|
43
|
+
n = !0;
|
|
43
44
|
else
|
|
44
45
|
for (let t = 0; t < e.length; t++)
|
|
45
46
|
if (e[t] !== i.value[t] || e[t].id !== i.value[t].id) {
|
|
46
|
-
|
|
47
|
+
n = !0;
|
|
47
48
|
break;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
+
n && (i.value = e);
|
|
50
51
|
}
|
|
51
52
|
);
|
|
52
53
|
const A = (e) => {
|
|
53
54
|
i.value = e, s("update:sheets", e);
|
|
54
|
-
},
|
|
55
|
+
}, M = (e) => {
|
|
55
56
|
s("update:modelValue", e), s("change", e);
|
|
56
57
|
}, k = () => {
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
const t =
|
|
60
|
-
if (t !== -1 && v(
|
|
61
|
-
const o = [...
|
|
62
|
-
o[t] = { ...o[t], title:
|
|
58
|
+
l.sheets.length >= l.maxSheets || s("add");
|
|
59
|
+
}, R = (e, n) => {
|
|
60
|
+
const t = l.sheets.findIndex((o) => o.id === e);
|
|
61
|
+
if (t !== -1 && v(l.sheets[t])) {
|
|
62
|
+
const o = [...l.sheets];
|
|
63
|
+
o[t] = { ...o[t], title: n }, s("update:sheets", o);
|
|
63
64
|
}
|
|
64
|
-
},
|
|
65
|
-
const t =
|
|
66
|
-
if (t !== -1 && C(
|
|
67
|
-
const o = [...
|
|
68
|
-
o[t] = { ...o[t], icon:
|
|
65
|
+
}, T = (e, n) => {
|
|
66
|
+
const t = l.sheets.findIndex((o) => o.id === e);
|
|
67
|
+
if (t !== -1 && C(l.sheets[t])) {
|
|
68
|
+
const o = [...l.sheets];
|
|
69
|
+
o[t] = { ...o[t], icon: n }, s("update:sheets", o);
|
|
69
70
|
}
|
|
71
|
+
}, z = (e) => {
|
|
72
|
+
const n = l.sheets.find((t) => t.id === e);
|
|
73
|
+
!n || !v(n) || (u.value = e, s("edit-start", e));
|
|
70
74
|
}, L = (e) => {
|
|
71
|
-
const l = a.sheets.find((t) => t.id === e);
|
|
72
|
-
!l || !v(l) || (u.value = e, s("edit-start", e));
|
|
73
|
-
}, N = (e) => {
|
|
74
75
|
u.value = null, s("edit-end", e);
|
|
76
|
+
}, N = (e) => {
|
|
77
|
+
const n = l.sheets.find((t) => t.id === e);
|
|
78
|
+
!n || !w(n) || s("duplicate", e);
|
|
75
79
|
}, O = (e) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const l = a.sheets.findIndex((o) => o.id === e);
|
|
80
|
-
if (l === -1 || !p(a.sheets[l])) return;
|
|
81
|
-
if (!a.autoDelete) {
|
|
80
|
+
const n = l.sheets.findIndex((o) => o.id === e);
|
|
81
|
+
if (n === -1 || !y(l.sheets[n])) return;
|
|
82
|
+
if (!l.autoDelete) {
|
|
82
83
|
s("delete", e);
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
const t = [...
|
|
86
|
-
if (t.splice(
|
|
86
|
+
const t = [...l.sheets];
|
|
87
|
+
if (t.splice(n, 1), s("update:sheets", t), s("delete", e), l.modelValue === e) {
|
|
87
88
|
let o = "";
|
|
88
89
|
if (t.length > 0) {
|
|
89
|
-
const
|
|
90
|
-
o = t[
|
|
90
|
+
const D = Math.min(n, t.length - 1);
|
|
91
|
+
o = t[D].id;
|
|
91
92
|
}
|
|
92
93
|
s("update:modelValue", o), s("change", o);
|
|
93
94
|
}
|
|
94
|
-
},
|
|
95
|
+
}, P = (e) => {
|
|
95
96
|
m.value && e.deltaY !== 0 && (m.value.scrollLeft += e.deltaY, e.preventDefault());
|
|
96
|
-
}, h = (e,
|
|
97
|
-
return (e,
|
|
98
|
-
f("div",
|
|
99
|
-
e.$slots["left-addons"] ? (d(), c("div",
|
|
97
|
+
}, h = (e, n) => l.editable ? (e[n] ?? l[n] ?? !0) === !0 : !1, v = (e) => h(e, "canRename"), w = (e) => h(e, "canDuplicate"), C = (e) => h(e, "canChangeIcon") && l.allowIconChange, y = (e) => l.sheets.length > 1 && h(e, "canDelete"), p = (e) => e.showContextMenu !== !1;
|
|
98
|
+
return (e, n) => (d(), c("div", te, [
|
|
99
|
+
f("div", ne, [
|
|
100
|
+
e.$slots["left-addons"] ? (d(), c("div", ae, [
|
|
100
101
|
g(e.$slots, "left-addons", {}, void 0, !0)
|
|
101
102
|
])) : x("", !0),
|
|
102
103
|
f("div", {
|
|
@@ -104,98 +105,102 @@ const ee = { class: "flex flex-col w-full font-sans" }, te = { class: "flex item
|
|
|
104
105
|
ref: m,
|
|
105
106
|
class: "flex-1 flex items-end overflow-x-auto scrollbar-none overscroll-contain sheet-container",
|
|
106
107
|
style: { "scrollbar-width": "none", "-ms-overflow-style": "none" },
|
|
107
|
-
onWheel:
|
|
108
|
+
onWheel: P
|
|
108
109
|
}, [
|
|
109
|
-
b(
|
|
110
|
+
b(V(_), {
|
|
110
111
|
"model-value": i.value,
|
|
111
112
|
"onUpdate:modelValue": A,
|
|
112
|
-
disabled: !
|
|
113
|
+
disabled: !l.draggable || !!u.value,
|
|
113
114
|
animation: 150,
|
|
114
115
|
class: "flex items-end min-w-max"
|
|
115
116
|
}, {
|
|
116
|
-
default:
|
|
117
|
-
(d(!0), c(
|
|
118
|
-
const
|
|
117
|
+
default: $(() => [
|
|
118
|
+
(d(!0), c(G, null, H(i.value, (t, o, D, r) => {
|
|
119
|
+
const I = [
|
|
119
120
|
t.id,
|
|
120
121
|
t.title,
|
|
121
122
|
t.icon,
|
|
122
|
-
|
|
123
|
+
a.modelValue === t.id,
|
|
123
124
|
u.value === t.id,
|
|
124
125
|
v(t),
|
|
126
|
+
w(t),
|
|
125
127
|
y(t),
|
|
126
|
-
p(t),
|
|
127
128
|
C(t),
|
|
128
|
-
|
|
129
|
+
p(t),
|
|
130
|
+
a.customOptions,
|
|
129
131
|
e.$slots["sheet-actions"],
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
a.confirmDelete,
|
|
133
|
+
a.allowIconChange,
|
|
134
|
+
a.menuWidth,
|
|
135
|
+
a.itemClass,
|
|
136
|
+
a.activeItemClass,
|
|
137
|
+
a.inactiveItemClass
|
|
135
138
|
];
|
|
136
|
-
if (r && r.el && r.key === t.id &&
|
|
137
|
-
const
|
|
139
|
+
if (r && r.el && r.key === t.id && J(r, I)) return r;
|
|
140
|
+
const B = (d(), K(ee, {
|
|
138
141
|
key: t.id,
|
|
139
142
|
sheet: t,
|
|
140
|
-
"is-active":
|
|
143
|
+
"is-active": a.modelValue === t.id,
|
|
141
144
|
"is-editing": u.value === t.id,
|
|
142
145
|
"can-rename": v(t),
|
|
143
|
-
"can-duplicate":
|
|
144
|
-
"can-delete":
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"confirm-delete
|
|
148
|
-
"
|
|
146
|
+
"can-duplicate": w(t),
|
|
147
|
+
"can-delete": y(t),
|
|
148
|
+
"show-context-menu": p(t),
|
|
149
|
+
"custom-options": a.customOptions,
|
|
150
|
+
"confirm-delete": a.confirmDelete,
|
|
151
|
+
"confirm-delete-texts": a.confirmDeleteTexts,
|
|
152
|
+
"allow-icon-change": a.allowIconChange,
|
|
149
153
|
"can-change-icon": C(t),
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"onUpdate:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
"menu-width": a.menuWidth,
|
|
155
|
+
"item-class": a.itemClass,
|
|
156
|
+
"active-item-class": a.activeItemClass,
|
|
157
|
+
"inactive-item-class": a.inactiveItemClass,
|
|
158
|
+
onSelect: M,
|
|
159
|
+
"onUpdate:title": R,
|
|
160
|
+
"onUpdate:icon": T,
|
|
161
|
+
onEditStart: z,
|
|
162
|
+
onEditEnd: L,
|
|
163
|
+
onDuplicate: N,
|
|
164
|
+
onDelete: O
|
|
165
|
+
}, Q({ _: 2 }, [
|
|
161
166
|
e.$slots["sheet-actions"] ? {
|
|
162
167
|
name: "sheet-actions",
|
|
163
|
-
fn:
|
|
164
|
-
g(e.$slots, "sheet-actions", { sheet:
|
|
168
|
+
fn: $(({ sheet: Y }) => [
|
|
169
|
+
g(e.$slots, "sheet-actions", { sheet: Y }, void 0, !0)
|
|
165
170
|
]),
|
|
166
171
|
key: "0"
|
|
167
172
|
} : void 0
|
|
168
|
-
]), 1032, ["sheet", "is-active", "is-editing", "can-rename", "can-duplicate", "can-delete", "custom-options", "confirm-delete", "confirm-delete-texts", "allow-icon-change", "can-change-icon", "item-class", "active-item-class", "inactive-item-class"]));
|
|
169
|
-
return
|
|
170
|
-
},
|
|
173
|
+
]), 1032, ["sheet", "is-active", "is-editing", "can-rename", "can-duplicate", "can-delete", "show-context-menu", "custom-options", "confirm-delete", "confirm-delete-texts", "allow-icon-change", "can-change-icon", "menu-width", "item-class", "active-item-class", "inactive-item-class"]));
|
|
174
|
+
return B.memo = I, B;
|
|
175
|
+
}, n, 0), 128))
|
|
171
176
|
]),
|
|
172
177
|
_: 3
|
|
173
178
|
}, 8, ["model-value", "disabled"]),
|
|
174
|
-
|
|
179
|
+
a.addable && a.addButtonPosition === "attached" ? (d(), c("div", {
|
|
175
180
|
key: 0,
|
|
176
|
-
class:
|
|
177
|
-
"shadow-[-18px_0_24px_-4px_#fff] dark:shadow-[-18px_0_24px_-4px_#000]": !
|
|
181
|
+
class: X(["shrink-0 sticky right-0 z-10 bg-body flex items-center justify-center h-full", {
|
|
182
|
+
"shadow-[-18px_0_24px_-4px_#fff] dark:shadow-[-18px_0_24px_-4px_#000]": !V(W).right
|
|
178
183
|
}])
|
|
179
184
|
}, [
|
|
180
|
-
b(
|
|
185
|
+
b(E, { onClick: k })
|
|
181
186
|
], 2)) : x("", !0),
|
|
182
|
-
|
|
187
|
+
n[2] || (n[2] = f("div", { class: "w-1 shrink-0" }, null, -1))
|
|
183
188
|
], 544),
|
|
184
|
-
f("div",
|
|
185
|
-
|
|
186
|
-
b(
|
|
189
|
+
f("div", le, [
|
|
190
|
+
a.addable && a.addButtonPosition === "fixed-right" ? (d(), c("div", oe, [
|
|
191
|
+
b(E, { onClick: k })
|
|
187
192
|
])) : x("", !0),
|
|
188
|
-
e.$slots["right-addons"] ? (d(), c("div",
|
|
193
|
+
e.$slots["right-addons"] ? (d(), c("div", se, [
|
|
189
194
|
g(e.$slots, "right-addons", {}, void 0, !0)
|
|
190
195
|
])) : x("", !0)
|
|
191
196
|
])
|
|
192
197
|
]),
|
|
193
|
-
f("div",
|
|
198
|
+
f("div", ie, [
|
|
194
199
|
g(e.$slots, "default", {}, void 0, !0)
|
|
195
200
|
])
|
|
196
201
|
]));
|
|
197
202
|
}
|
|
198
203
|
});
|
|
199
204
|
export {
|
|
200
|
-
|
|
205
|
+
me as default
|
|
201
206
|
};
|
|
@@ -11,6 +11,8 @@ export interface WorkbookSheet {
|
|
|
11
11
|
canDuplicate?: boolean;
|
|
12
12
|
canDelete?: boolean;
|
|
13
13
|
canChangeIcon?: boolean;
|
|
14
|
+
/** Explicitly show or hide this sheet's context-menu trigger. */
|
|
15
|
+
showContextMenu?: boolean;
|
|
14
16
|
[key: string]: any;
|
|
15
17
|
}
|
|
16
18
|
/** A consumer-owned context-menu action rendered alongside Workbook's built-in sheet actions. */
|
|
@@ -54,6 +56,8 @@ export interface WorkbookProps {
|
|
|
54
56
|
confirm?: string;
|
|
55
57
|
cancel?: string;
|
|
56
58
|
};
|
|
59
|
+
/** Width of each sheet's context-menu dropdown (passed to Dropdown `width`). */
|
|
60
|
+
menuWidth?: string;
|
|
57
61
|
allowIconChange?: boolean;
|
|
58
62
|
}
|
|
59
63
|
export interface SheetEvent {
|