vlite3 1.5.16 → 1.5.18

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