vlite3 0.7.15 → 0.8.2

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.
Files changed (57) hide show
  1. package/components/Accordion/Accordion.vue.js +35 -22
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/Accordion/AccordionContent.vue2.js +1 -1
  4. package/components/Breadcrumb/Breadcrumb.vue.js +2 -2
  5. package/components/Breadcrumb/Breadcrumb.vue2.js +44 -44
  6. package/components/Carousel/Carousel.vue.js +1 -1
  7. package/components/Carousel/Carousel.vue2.js +3 -3
  8. package/components/ColorPicker/ColorIro.vue3.js +2 -2
  9. package/components/ColorPicker/ColorPicker.vue.js +2 -2
  10. package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
  11. package/components/CommandPalette/CommandPaletteContent.vue2.js +2 -2
  12. package/components/Dropdown/DropdownTrigger.vue.js +1 -1
  13. package/components/FilePicker/FilePicker.vue.js +16 -16
  14. package/components/FileTree/FileTree.vue.js +5 -147
  15. package/components/FileTree/FileTree.vue2.js +164 -2
  16. package/components/FileTree/FileTreeNode.vue.js +89 -84
  17. package/components/Form/CustomFields.vue.js +2 -2
  18. package/components/Form/CustomFields.vue2.js +1 -1
  19. package/components/Form/Form.vue.js +1 -1
  20. package/components/Form/Form.vue2.js +133 -129
  21. package/components/Form/FormField.vue.d.ts +3 -0
  22. package/components/Form/FormField.vue.js +85 -82
  23. package/components/Form/FormFields.vue.d.ts +2 -0
  24. package/components/Form/FormFields.vue.js +2 -2
  25. package/components/Form/FormFields.vue2.js +55 -52
  26. package/components/Form/composables/useForm.d.ts +2 -0
  27. package/components/Form/composables/useForm.js +113 -107
  28. package/components/ImportData/ImportData.vue.js +157 -142
  29. package/components/ImportData/ImportStep1.vue.d.ts +6 -0
  30. package/components/ImportData/ImportStep1.vue.js +69 -61
  31. package/components/ImportData/ImportStep2.vue.js +5 -98
  32. package/components/ImportData/ImportStep2.vue2.js +105 -2
  33. package/components/Kanban/Kanban.vue.js +1 -1
  34. package/components/Kanban/Kanban.vue2.js +1 -1
  35. package/components/Kanban/KanbanBoard.vue.js +1 -1
  36. package/components/Kanban/KanbanBoard.vue2.js +92 -83
  37. package/components/Kanban/useKanbanBoard.d.ts +1 -1
  38. package/components/Kanban/useKanbanBoard.js +17 -17
  39. package/components/List/ListFieldRow.vue.js +4 -6
  40. package/components/MultiSelect/MultiSelect.vue.js +10 -4
  41. package/components/NavbarCommandPalette.vue.js +2 -2
  42. package/components/NumberInput.vue.js +2 -2
  43. package/components/NumberInput.vue2.js +1 -1
  44. package/components/PermissionMatrix/PermissionEditor.vue.d.ts +2 -0
  45. package/components/PermissionMatrix/PermissionEditor.vue.js +25 -23
  46. package/components/PermissionMatrix/PermissionEditorMatrix.vue.d.ts +4 -1
  47. package/components/PermissionMatrix/PermissionEditorMatrix.vue.js +2 -2
  48. package/components/PermissionMatrix/PermissionEditorMatrix.vue2.js +48 -45
  49. package/components/Screen/ScreenFilter.vue.js +1 -1
  50. package/components/Timeline/Timeline.vue.js +62 -57
  51. package/components/ToastNotification.vue.js +2 -2
  52. package/components/ToastNotification.vue2.js +103 -88
  53. package/components/Workbook/Workbook.vue.js +5 -152
  54. package/components/Workbook/Workbook.vue2.js +166 -2
  55. package/package.json +1 -1
  56. package/style.css +3 -3
  57. /package/components/ColorPicker/{ColorIro.vue2.js → ColorIro.vue.js} +0 -0
@@ -1,144 +1,159 @@
1
- import { defineComponent as L, ref as G, openBlock as o, createElementBlock as l, createBlock as p, Teleport as P, Fragment as h, renderList as b, createElementVNode as i, normalizeClass as c, createVNode as x, TransitionGroup as Y, withCtx as y, normalizeStyle as F, toDisplayString as m, createCommentVNode as v, createTextVNode as q } from "vue";
2
- import H from "./Icon.vue.js";
3
- import { useNotifications as J } from "../composables/useNotifications.js";
4
- import K from "./Button.vue.js";
5
- const Q = {
1
+ import { defineComponent as P, ref as Y, onUnmounted as F, openBlock as o, createElementBlock as i, createBlock as y, Teleport as U, Fragment as v, renderList as _, createElementVNode as m, normalizeClass as g, createVNode as w, TransitionGroup as q, withCtx as k, unref as H, isMemoSame as J, normalizeStyle as K, toDisplayString as p, createCommentVNode as T, createTextVNode as Q } from "vue";
2
+ import R from "./Icon.vue.js";
3
+ import { useNotifications as W } from "../composables/useNotifications.js";
4
+ import X from "./Button.vue.js";
5
+ const Z = {
6
6
  class: "toast-provider pointer-events-none fixed inset-0 z-[9999999999] overflow-hidden",
7
7
  "aria-live": "polite"
8
- }, R = { class: "flex-1 min-w-0" }, U = { class: "text-sm font-medium leading-tight mt-0.5" }, W = {
8
+ }, ee = { class: "flex-1 min-w-0" }, te = { class: "text-sm font-medium leading-tight mt-0.5" }, re = {
9
9
  key: 0,
10
10
  class: "text-sm mt-1 leading-relaxed opacity-90"
11
- }, X = 3, w = 14, lt = /* @__PURE__ */ L({
11
+ }, se = 3, C = 14, ce = /* @__PURE__ */ P({
12
12
  __name: "ToastNotification",
13
13
  props: {
14
14
  position: {},
15
15
  expand: { type: Boolean }
16
16
  },
17
- setup(Z) {
18
- const { notifications: _, removeToast: k, globalConfig: T, pauseTimers: C, resumeTimers: z } = J(), d = G(!1), B = [
17
+ setup(oe) {
18
+ const { notifications: z, removeToast: B, globalConfig: b, pauseTimers: $, resumeTimers: S } = W(), c = Y(!1), V = [
19
19
  "top-left",
20
20
  "top-center",
21
21
  "top-right",
22
22
  "bottom-left",
23
23
  "bottom-center",
24
24
  "bottom-right"
25
- ], u = (t) => _.value.filter((e) => e.position === t).slice().reverse(), $ = {
25
+ ], d = (e) => z.value.filter((t) => t.position === e).slice().reverse(), N = {
26
26
  "top-left": "top-0 left-0 py-4",
27
27
  "top-center": "top-0 left-1/2 -translate-x-1/2 py-4",
28
28
  "top-right": "top-0 right-0 py-4",
29
29
  "bottom-left": "bottom-2.5 left-0",
30
30
  "bottom-center": "bottom-2.5 left-1/2 -translate-x-1/2",
31
31
  "bottom-right": "bottom-2.5 right-0"
32
- }, V = (t, s, e) => {
33
- const r = e.includes("bottom"), n = d.value || T.value.expand;
34
- if (!(t < X) && !n)
32
+ }, E = (e, s, t) => {
33
+ const r = t.includes("bottom"), l = c.value || b.value.expand;
34
+ if (!(e < se) && !l)
35
35
  return {
36
36
  opacity: 0,
37
37
  pointerEvents: "none",
38
38
  transform: r ? "translateY(20px) scale(0.95)" : "translateY(-20px) scale(0.95)",
39
39
  zIndex: -1
40
40
  };
41
- if (n)
41
+ if (l)
42
42
  return {
43
- transform: `translate3d(0, ${t * ((r ? -1 : 1) * (100 + w))}%, 0) scale(1)`,
43
+ transform: `translate3d(0, ${e * ((r ? -1 : 1) * (100 + C))}%, 0) scale(1)`,
44
44
  opacity: 1,
45
- zIndex: s - t
45
+ zIndex: s - e
46
46
  };
47
- const j = 1 - t * 0.05, A = r ? -1 : 1;
47
+ const a = 1 - e * 0.05, u = r ? -1 : 1;
48
48
  return {
49
- transform: `translate3d(0, ${t * w * A}px, -${t}px) scale(${j})`,
49
+ transform: `translate3d(0, ${e * C * u}px, -${e}px) scale(${a})`,
50
50
  opacity: 1,
51
- zIndex: s - t
51
+ zIndex: s - e
52
52
  };
53
- }, N = (t, s) => s !== 0 ? {} : {
54
- "--entrance-offset": t.includes("bottom") ? "25px" : "-25px",
53
+ }, I = (e, s) => s !== 0 ? {} : {
54
+ "--entrance-offset": e.includes("bottom") ? "25px" : "-25px",
55
55
  "--entrance-opacity": "0.6"
56
- }, S = (t) => {
57
- t.action && (t.action.onClick(), k(t.id));
58
- }, g = {
56
+ }, M = (e) => {
57
+ e.action && (e.action.onClick(), B(e.id));
58
+ }, h = {
59
59
  error: "lucide:octagon-x",
60
60
  success: "lucide:circle-check",
61
61
  info: "lucide:info",
62
62
  warning: "lucide:triangle-alert",
63
63
  default: "lucide:bell"
64
- }, f = {
64
+ }, x = {
65
65
  default: "bg-gray-100 border-border text-foreground shadow-lg",
66
66
  success: "bg-success text-success-fg border-success-fg/30 dark:border-success-fg/10 shadow-lg",
67
67
  error: "bg-danger text-danger-fg border-danger-fg/30 dark:border-danger-fg/10 shadow-lg",
68
68
  warning: "bg-warning-light text-warning-fg border-warning-fg/30 shadow-lg",
69
69
  info: "bg-gray-100 text-gray-900 border/50 shadow-lg"
70
- }, E = (t) => f[t] || f.default;
71
- let a = null;
72
- const I = () => {
73
- a && (clearTimeout(a), a = null), d.value = !0, C();
74
- }, D = () => {
75
- a = setTimeout(() => {
76
- d.value = !1, z();
70
+ }, D = (e) => x[e] || x.default;
71
+ let n = null;
72
+ const O = () => {
73
+ n && (clearTimeout(n), n = null), c.value = !0, $();
74
+ }, j = () => {
75
+ n = setTimeout(() => {
76
+ c.value = !1, S();
77
77
  }, 400);
78
- }, M = (t) => {
79
- const s = t.includes("bottom") ? "bottom" : "top", e = t.includes("right") ? "right" : t.includes("left") ? "left" : "center";
80
- return `${s} ${e}`;
81
78
  };
82
- return (t, s) => (o(), l("div", Q, [
83
- (o(), p(P, { to: "body" }, [
84
- (o(), l(h, null, b(B, (e) => i("div", {
85
- key: e,
86
- class: c(["fixed z-[9999999999]! px-4 flex flex-col gap-2 transition-all duration-300 max-w-full sm:max-w-120", [
87
- $[e],
88
- e.includes("center") ? "items-center" : e.includes("right") ? "items-end" : "items-start"
79
+ F(() => {
80
+ n && clearTimeout(n);
81
+ });
82
+ const A = (e) => {
83
+ const s = e.includes("bottom") ? "bottom" : "top", t = e.includes("right") ? "right" : e.includes("left") ? "left" : "center";
84
+ return `${s} ${t}`;
85
+ };
86
+ return (e, s) => (o(), i("div", Z, [
87
+ (o(), y(U, { to: "body" }, [
88
+ (o(), i(v, null, _(V, (t) => m("div", {
89
+ key: t,
90
+ class: g(["fixed z-[9999999999]! px-4 flex flex-col gap-2 transition-all duration-300 max-w-full sm:max-w-120", [
91
+ N[t],
92
+ t.includes("center") ? "items-center" : t.includes("right") ? "items-end" : "items-start"
89
93
  ]]),
90
- onMouseenter: I,
91
- onMouseleave: D
94
+ onMouseenter: O,
95
+ onMouseleave: j
92
96
  }, [
93
- i("div", {
94
- class: c(["relative w-full transition-all pointer-events-auto", [{ "flex-col-reverse": e.includes("top") }]])
97
+ m("div", {
98
+ class: g(["relative w-full transition-all pointer-events-auto", [{ "flex-col-reverse": t.includes("top") }]])
95
99
  }, [
96
- x(Y, {
97
- name: u(e).length <= 1 ? "first-toast" : "stack-toast",
100
+ w(q, {
101
+ name: d(t).length <= 1 ? "first-toast" : "stack-toast",
98
102
  tag: "div",
99
- class: c(["w-full grid grid-cols-1 grid-rows-1", [
100
- e.includes("center") ? "justify-items-center" : e.includes("right") ? "justify-items-end" : "justify-items-start"
103
+ class: g(["w-full grid grid-cols-1 grid-rows-1", [
104
+ t.includes("center") ? "justify-items-center" : t.includes("right") ? "justify-items-end" : "justify-items-start"
101
105
  ]]),
102
106
  style: { "min-height": "20px" }
103
107
  }, {
104
- default: y(() => [
105
- (o(!0), l(h, null, b(u(e), (r, n) => (o(), l("div", {
106
- key: r.id,
107
- class: c(["toast-item col-start-1 h-max row-start-1 mb-1 w-auto border pl-4 pr-6 py-3 flex gap-2.5 items-start transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] transform-gpu will-change-transform", [
108
- E(r.type),
109
- r.description || r.action ? "rounded-xl" : "rounded-full"
110
- ]]),
111
- style: F([
112
- V(n, u(e).length, e),
113
- N(e, n),
114
- {
115
- "--hover-offset": e.includes("bottom") ? "-5px" : "5px",
116
- "transform-origin": M(e)
117
- }
118
- ])
119
- }, [
120
- x(H, {
121
- icon: g[r.type] || g.default,
122
- class: "w-5 h-5 shrink-0 mt-0.5"
123
- }, null, 8, ["icon"]),
124
- i("div", R, [
125
- i("p", U, m(r.message), 1),
126
- r.description ? (o(), l("p", W, m(r.description), 1)) : v("", !0)
127
- ]),
128
- r.action ? (o(), p(K, {
129
- key: 0,
130
- type: "button",
131
- size: "xs",
132
- variant: "outline",
133
- class: "ml-2 shrink-0 h-8 px-3 text-xs bg-transparent border-current/20 hover:bg-black/5 dark:hover:bg-white/10",
134
- onClick: (O) => S(r)
135
- }, {
136
- default: y(() => [
137
- q(m(r.action.label), 1)
108
+ default: k(() => [
109
+ (o(!0), i(v, null, _(d(t), (r, l, L, a) => {
110
+ const u = [
111
+ r,
112
+ l,
113
+ d(t).length,
114
+ c.value,
115
+ H(b).expand
116
+ ];
117
+ if (a && a.key === r.id && J(a, u)) return a;
118
+ const f = (o(), i("div", {
119
+ key: r.id,
120
+ class: g(["toast-item col-start-1 h-max row-start-1 mb-1 w-auto border pl-4 pr-6 py-2.5 flex gap-2.5 items-start transition-all duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] transform-gpu", [
121
+ D(r.type),
122
+ r.description || r.action ? "rounded-xl" : "rounded-full"
123
+ ]]),
124
+ style: K([
125
+ E(l, d(t).length, t),
126
+ I(t, l),
127
+ {
128
+ "--hover-offset": t.includes("bottom") ? "-5px" : "5px",
129
+ "transform-origin": A(t)
130
+ }
131
+ ])
132
+ }, [
133
+ w(R, {
134
+ icon: h[r.type] || h.default,
135
+ class: "w-5 h-5 shrink-0 mt-0.5"
136
+ }, null, 8, ["icon"]),
137
+ m("div", ee, [
138
+ m("p", te, p(r.message), 1),
139
+ r.description ? (o(), i("p", re, p(r.description), 1)) : T("", !0)
138
140
  ]),
139
- _: 2
140
- }, 1032, ["onClick"])) : v("", !0)
141
- ], 6))), 128))
141
+ r.action ? (o(), y(X, {
142
+ key: 0,
143
+ type: "button",
144
+ size: "xs",
145
+ variant: "outline",
146
+ class: "ml-2 shrink-0 h-8 px-3 text-xs bg-transparent border-current/20 hover:bg-black/5 dark:hover:bg-white/10",
147
+ onClick: (G) => M(r)
148
+ }, {
149
+ default: k(() => [
150
+ Q(p(r.action.label), 1)
151
+ ]),
152
+ _: 2
153
+ }, 1032, ["onClick"])) : T("", !0)
154
+ ], 6));
155
+ return f.memo = u, f;
156
+ }, s, 0), 128))
142
157
  ]),
143
158
  _: 2
144
159
  }, 1032, ["name", "class"])
@@ -149,5 +164,5 @@ const Q = {
149
164
  }
150
165
  });
151
166
  export {
152
- lt as default
167
+ ce as default
153
168
  };
@@ -1,154 +1,7 @@
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
- });
1
+ import o from "./Workbook.vue2.js";
2
+ /* empty css */
3
+ import r from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-a5e9ca6f"]]);
152
5
  export {
153
- ee as default
6
+ m as default
154
7
  };
@@ -1,4 +1,168 @@
1
- import f from "./Workbook.vue.js";
1
+ import { defineComponent as N, ref as y, shallowRef as P, watch as A, computed as M, openBlock as o, createElementBlock as c, createElementVNode as r, renderSlot as v, createCommentVNode as m, createVNode as g, unref as W, withCtx as Y, Fragment as z, renderList as F, isMemoSame as R, createBlock as j } from "vue";
2
+ import { VueDraggable as q } from "vue-draggable-plus";
3
+ import G from "./Sheet.vue.js";
4
+ import p from "./WorkbookAddButton.vue.js";
5
+ const H = { class: "flex flex-col w-full font-sans" }, J = { class: "flex items-end w-full border-b px-1" }, K = {
6
+ key: 0,
7
+ class: "flex items-center"
8
+ }, O = {
9
+ key: 0,
10
+ class: "shrink-0 mb-1"
11
+ }, Q = { class: "flex items-center mb-0.5 z-20 sticky right-0 ml-auto box-decoration-clone" }, X = { key: 0 }, Z = { key: 1 }, _ = { class: "flex-1 relative bg-white w-full" }, ne = /* @__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(a, { emit: I }) {
32
+ const i = a, d = I, h = y(null), u = y(null), s = P([...i.sheets]);
33
+ A(
34
+ () => i.sheets,
35
+ (e) => {
36
+ let n = !1;
37
+ if (e.length !== s.value.length)
38
+ n = !0;
39
+ else
40
+ for (let t = 0; t < e.length; t++)
41
+ if (e[t] !== s.value[t] || e[t].id !== s.value[t].id) {
42
+ n = !0;
43
+ break;
44
+ }
45
+ n && (s.value = [...e]);
46
+ },
47
+ { deep: !0 }
48
+ // Must be true so parent mutating the array via .push() correctly triggers the watcher
49
+ );
50
+ const D = (e) => {
51
+ s.value = e, d("update:sheets", e);
52
+ }, V = (e) => {
53
+ d("update:modelValue", e), d("change", e);
54
+ }, x = () => {
55
+ i.sheets.length >= i.maxSheets || d("add");
56
+ }, B = (e, n) => {
57
+ const t = i.sheets.findIndex((l) => l.id === e);
58
+ if (t !== -1) {
59
+ const l = [...i.sheets];
60
+ l[t] = { ...l[t], title: n }, d("update:sheets", l);
61
+ }
62
+ }, S = (e, n) => {
63
+ const t = i.sheets.findIndex((l) => l.id === e);
64
+ if (t !== -1) {
65
+ const l = [...i.sheets];
66
+ l[t] = { ...l[t], icon: n }, d("update:sheets", l);
67
+ }
68
+ }, E = (e) => {
69
+ u.value = e, d("edit-start", e);
70
+ }, U = (e) => {
71
+ u.value = null, d("edit-end", e);
72
+ }, $ = (e) => {
73
+ d("duplicate", e);
74
+ }, T = (e) => {
75
+ const n = i.sheets.findIndex((l) => l.id === e);
76
+ if (n === -1) return;
77
+ const t = [...i.sheets];
78
+ if (t.splice(n, 1), d("update:sheets", t), d("delete", e), i.modelValue === e) {
79
+ let l = "";
80
+ if (t.length > 0) {
81
+ const k = Math.min(n, t.length - 1);
82
+ l = t[k].id;
83
+ }
84
+ d("update:modelValue", l), d("change", l);
85
+ }
86
+ }, L = (e) => {
87
+ h.value && e.deltaY !== 0 && (h.value.scrollLeft += e.deltaY, e.preventDefault());
88
+ }, b = M(() => i.sheets.length > 1);
89
+ return (e, n) => (o(), c("div", H, [
90
+ r("div", J, [
91
+ e.$slots["left-addons"] ? (o(), c("div", K, [
92
+ v(e.$slots, "left-addons", {}, void 0, !0)
93
+ ])) : m("", !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 sheet-container",
98
+ style: { "scrollbar-width": "none", "-ms-overflow-style": "none" },
99
+ onWheel: L
100
+ }, [
101
+ g(W(q), {
102
+ "model-value": s.value,
103
+ "onUpdate:modelValue": D,
104
+ disabled: !i.draggable || !!u.value,
105
+ animation: 150,
106
+ class: "flex items-end min-w-max"
107
+ }, {
108
+ default: Y(() => [
109
+ (o(!0), c(z, null, F(s.value, (t, l, k, f) => {
110
+ const w = [
111
+ t.id,
112
+ t.title,
113
+ t.icon,
114
+ a.modelValue === t.id,
115
+ u.value === t.id,
116
+ b.value,
117
+ a.confirmDelete,
118
+ a.allowIconChange
119
+ ];
120
+ if (f && f.key === t.id && R(f, w)) return f;
121
+ const C = (o(), j(G, {
122
+ key: t.id,
123
+ sheet: t,
124
+ "is-active": a.modelValue === t.id,
125
+ "is-editing": u.value === t.id,
126
+ "can-delete": b.value,
127
+ "confirm-delete": a.confirmDelete,
128
+ "confirm-delete-texts": a.confirmDeleteTexts,
129
+ "allow-icon-change": a.allowIconChange,
130
+ "item-class": a.itemClass,
131
+ "active-item-class": a.activeItemClass,
132
+ "inactive-item-class": a.inactiveItemClass,
133
+ onSelect: V,
134
+ "onUpdate:title": B,
135
+ "onUpdate:icon": S,
136
+ onEditStart: E,
137
+ onEditEnd: U,
138
+ onDuplicate: $,
139
+ onDelete: T
140
+ }, 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"]));
141
+ return C.memo = w, C;
142
+ }, n, 0), 128))
143
+ ]),
144
+ _: 1
145
+ }, 8, ["model-value", "disabled"]),
146
+ a.addable && a.addButtonPosition === "attached" ? (o(), c("div", O, [
147
+ g(p, { onClick: x })
148
+ ])) : m("", !0),
149
+ n[2] || (n[2] = r("div", { class: "w-1 shrink-0" }, null, -1))
150
+ ], 544),
151
+ r("div", Q, [
152
+ a.addable && a.addButtonPosition === "fixed-right" ? (o(), c("div", X, [
153
+ g(p, { onClick: x })
154
+ ])) : m("", !0),
155
+ e.$slots["right-addons"] ? (o(), c("div", Z, [
156
+ v(e.$slots, "right-addons", {}, void 0, !0)
157
+ ])) : m("", !0)
158
+ ])
159
+ ]),
160
+ r("div", _, [
161
+ v(e.$slots, "default", {}, void 0, !0)
162
+ ])
163
+ ]));
164
+ }
165
+ });
2
166
  export {
3
- f as default
167
+ ne as default
4
168
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A Vue 3 UI component library built with Tailwind CSS.",
5
5
  "license": "MIT",
6
- "version": "0.7.15",
6
+ "version": "0.8.2",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "module": "index.js",