vlite3 0.2.7 → 0.2.9
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/Carousel/Carousel.vue.d.ts +14 -0
- package/components/DataTable/DataTable.vue.js +317 -5
- package/components/DataTable/DataTable.vue2.js +2 -314
- 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 +134 -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/Workbook/Workbook.vue.d.ts +0 -2
- package/components/Workbook/Workbook.vue.js +152 -5
- package/components/Workbook/Workbook.vue2.js +2 -152
- package/index.d.ts +1 -1
- package/index.js +120 -114
- package/package.json +3 -3
- package/style.css +26 -11
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineComponent as B, ref as K, watch as U, onMounted as E, openBlock as r, createElementBlock as d, normalizeClass as u, createElementVNode as n, renderSlot as m, unref as t, toDisplayString as f, Fragment as g, renderList as b, createVNode as h, withCtx as L, createCommentVNode as M } from "vue";
|
|
2
|
+
import { VueDraggable as V } from "vue-draggable-plus";
|
|
3
|
+
import j from "../Spinner/Spinner.vue.js";
|
|
4
|
+
import { useKanbanBoard as z } from "./useKanbanBoard.js";
|
|
5
|
+
const F = { class: "flex items-center justify-between font-semibold text-foreground" }, H = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "flex-1 flex flex-col gap-3 min-h-[50px] py-1"
|
|
8
|
+
}, J = { class: "bg-body p-3 rounded-md shadow-sm border border-border text-sm" }, O = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "py-4 flex justify-center shrink-0"
|
|
11
|
+
}, G = /* @__PURE__ */ B({
|
|
12
|
+
__name: "KanbanBoard",
|
|
13
|
+
props: {
|
|
14
|
+
column: {},
|
|
15
|
+
group: {},
|
|
16
|
+
itemKey: {},
|
|
17
|
+
loadData: { type: Function },
|
|
18
|
+
columnData: {},
|
|
19
|
+
boardClass: {},
|
|
20
|
+
headerClass: {},
|
|
21
|
+
bodyClass: {},
|
|
22
|
+
draggableClass: {},
|
|
23
|
+
ghostClass: {}
|
|
24
|
+
},
|
|
25
|
+
emits: ["change", "update:columnData"],
|
|
26
|
+
setup(o, { emit: v }) {
|
|
27
|
+
const l = o, i = v, p = K(null), { items: a, isInitialLoading: y, isLoadingMore: x, pageInfo: C, loadInitial: k, loadMore: D } = z(
|
|
28
|
+
l.column.id,
|
|
29
|
+
l.loadData,
|
|
30
|
+
l.columnData
|
|
31
|
+
), w = (e) => {
|
|
32
|
+
a.value = e, i("update:columnData", e);
|
|
33
|
+
};
|
|
34
|
+
U(
|
|
35
|
+
() => l.columnData,
|
|
36
|
+
(e) => {
|
|
37
|
+
e && JSON.stringify(e) !== JSON.stringify(a.value) && (a.value = [...e]);
|
|
38
|
+
},
|
|
39
|
+
{ deep: !0 }
|
|
40
|
+
), E(() => {
|
|
41
|
+
l.loadData && (!l.columnData || l.columnData.length === 0) && k();
|
|
42
|
+
});
|
|
43
|
+
const I = (e) => {
|
|
44
|
+
const c = e.target;
|
|
45
|
+
c.scrollTop + c.clientHeight >= c.scrollHeight - 50 && D();
|
|
46
|
+
}, S = (e) => {
|
|
47
|
+
i("change", { type: "add", event: e, columnId: l.column.id });
|
|
48
|
+
}, N = (e) => {
|
|
49
|
+
i("change", { type: "remove", event: e, columnId: l.column.id });
|
|
50
|
+
}, $ = (e) => {
|
|
51
|
+
i("change", { type: "update", event: e, columnId: l.column.id });
|
|
52
|
+
};
|
|
53
|
+
return (e, c) => (r(), d("div", {
|
|
54
|
+
class: u([
|
|
55
|
+
"flex flex-col bg-card rounded-lg overflow-hidden shrink-0 border border-border/60",
|
|
56
|
+
o.boardClass || "w-80"
|
|
57
|
+
])
|
|
58
|
+
}, [
|
|
59
|
+
n("div", {
|
|
60
|
+
class: u(["p-3 border-b border-border/80 ", o.headerClass])
|
|
61
|
+
}, [
|
|
62
|
+
m(e.$slots, "header", {
|
|
63
|
+
column: o.column,
|
|
64
|
+
pageInfo: t(C)
|
|
65
|
+
}, () => [
|
|
66
|
+
n("div", F, [
|
|
67
|
+
n("span", null, f(o.column.title), 1)
|
|
68
|
+
])
|
|
69
|
+
], !0)
|
|
70
|
+
], 2),
|
|
71
|
+
n("div", {
|
|
72
|
+
ref_key: "scrollContainer",
|
|
73
|
+
ref: p,
|
|
74
|
+
class: u(["flex-1 flex flex-col overflow-y-auto p-3 custom-scrollbar", o.bodyClass]),
|
|
75
|
+
onScroll: I
|
|
76
|
+
}, [
|
|
77
|
+
t(y) && t(a).length === 0 ? (r(), d("div", H, [
|
|
78
|
+
(r(), d(g, null, b(3, (s) => n("div", {
|
|
79
|
+
key: "skeleton-" + s,
|
|
80
|
+
class: "bg-body p-3 rounded-md shadow-sm border border-border animate-pulse flex flex-col gap-3"
|
|
81
|
+
}, [...c[0] || (c[0] = [
|
|
82
|
+
n("div", { class: "h-4 bg-muted/60 rounded w-2/3" }, null, -1),
|
|
83
|
+
n("div", { class: "h-3 bg-muted/60 rounded w-1/3" }, null, -1)
|
|
84
|
+
])])), 64))
|
|
85
|
+
])) : (r(), d(g, { key: 1 }, [
|
|
86
|
+
m(e.$slots, "prepend-item", {
|
|
87
|
+
column: o.column,
|
|
88
|
+
items: t(a)
|
|
89
|
+
}, void 0, !0),
|
|
90
|
+
h(t(V), {
|
|
91
|
+
"model-value": t(a),
|
|
92
|
+
"onUpdate:modelValue": w,
|
|
93
|
+
group: o.group,
|
|
94
|
+
animation: 150,
|
|
95
|
+
ghostClass: o.ghostClass || "kanban-ghost",
|
|
96
|
+
class: u(["flex-1 flex flex-col gap-2 min-h-[50px] py-1", o.draggableClass]),
|
|
97
|
+
onAdd: S,
|
|
98
|
+
onRemove: N,
|
|
99
|
+
onUpdate: $
|
|
100
|
+
}, {
|
|
101
|
+
default: L(() => [
|
|
102
|
+
(r(!0), d(g, null, b(t(a), (s) => (r(), d("div", {
|
|
103
|
+
key: s[o.itemKey || "id"],
|
|
104
|
+
class: "cursor-grab active:cursor-grabbing"
|
|
105
|
+
}, [
|
|
106
|
+
m(e.$slots, "item", {
|
|
107
|
+
item: s,
|
|
108
|
+
column: o.column
|
|
109
|
+
}, () => [
|
|
110
|
+
n("div", J, f(s.title || s.name || s.id), 1)
|
|
111
|
+
], !0)
|
|
112
|
+
]))), 128))
|
|
113
|
+
]),
|
|
114
|
+
_: 3
|
|
115
|
+
}, 8, ["model-value", "group", "ghostClass", "class"]),
|
|
116
|
+
m(e.$slots, "append-item", {
|
|
117
|
+
column: o.column,
|
|
118
|
+
items: t(a)
|
|
119
|
+
}, void 0, !0),
|
|
120
|
+
t(x) ? (r(), d("div", O, [
|
|
121
|
+
h(j, {
|
|
122
|
+
size: "sm",
|
|
123
|
+
variant: "dots",
|
|
124
|
+
color: "primary"
|
|
125
|
+
})
|
|
126
|
+
])) : M("", !0)
|
|
127
|
+
], 64))
|
|
128
|
+
], 34)
|
|
129
|
+
], 2));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
export {
|
|
133
|
+
G as default
|
|
134
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface KanbanPageInfo {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
totalPages: number;
|
|
4
|
+
totalItems: number;
|
|
5
|
+
}
|
|
6
|
+
export interface KanbanLoadDataResult<T = any> {
|
|
7
|
+
items: T[];
|
|
8
|
+
pageInfo: KanbanPageInfo;
|
|
9
|
+
}
|
|
10
|
+
export interface KanbanColumn {
|
|
11
|
+
id: string | number;
|
|
12
|
+
title: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export interface KanbanChangeEvent {
|
|
16
|
+
type: 'add' | 'remove' | 'update';
|
|
17
|
+
event: any;
|
|
18
|
+
columnId: string | number;
|
|
19
|
+
}
|
|
20
|
+
export interface KanbanProps {
|
|
21
|
+
columns: KanbanColumn[];
|
|
22
|
+
group?: string;
|
|
23
|
+
itemKey?: string;
|
|
24
|
+
loadData?: (columnId: string | number, page: number) => Promise<KanbanLoadDataResult>;
|
|
25
|
+
data?: Record<string | number, any[]>;
|
|
26
|
+
boardClass?: string;
|
|
27
|
+
headerClass?: string;
|
|
28
|
+
bodyClass?: string;
|
|
29
|
+
draggableClass?: string;
|
|
30
|
+
ghostClass?: string;
|
|
31
|
+
class?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KanbanLoadDataResult } from './types';
|
|
2
|
+
export declare function useKanbanBoard(columnId: string | number, loadDataFn?: (columnId: string | number, page: number) => Promise<KanbanLoadDataResult>, initialData?: any[]): {
|
|
3
|
+
items: import('vue').Ref<any[], any[]>;
|
|
4
|
+
isInitialLoading: import('vue').Ref<boolean, boolean>;
|
|
5
|
+
isLoadingMore: import('vue').Ref<boolean, boolean>;
|
|
6
|
+
pageInfo: {
|
|
7
|
+
currentPage: number;
|
|
8
|
+
totalPages: number;
|
|
9
|
+
totalItems: number;
|
|
10
|
+
};
|
|
11
|
+
loadInitial: () => Promise<void>;
|
|
12
|
+
loadMore: () => Promise<void>;
|
|
13
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -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
|
};
|
|
@@ -47,7 +46,6 @@ declare const __VLS_component: import('vue').DefineComponent<WorkbookProps, {},
|
|
|
47
46
|
maxSheets: number;
|
|
48
47
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
49
48
|
scrollContainer: HTMLDivElement;
|
|
50
|
-
parent: HTMLDivElement;
|
|
51
49
|
}, HTMLDivElement>;
|
|
52
50
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
53
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
|
};
|
|
@@ -1,154 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useDragAndDrop as Y } from "@formkit/drag-and-drop/vue";
|
|
3
|
-
import { animations as z } from "@formkit/drag-and-drop";
|
|
4
|
-
import F from "./Sheet.vue.js";
|
|
5
|
-
import b from "./WorkbookAddButton.vue.js";
|
|
6
|
-
const L = { class: "flex flex-col w-full font-sans" }, M = { class: "flex items-end w-full border-b px-1" }, j = {
|
|
7
|
-
key: 0,
|
|
8
|
-
class: "flex items-center"
|
|
9
|
-
}, q = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "shrink-0 mb-1"
|
|
12
|
-
}, G = { class: "flex items-center mb-0.5 z-20 sticky right-0 ml-auto box-decoration-clone" }, H = { key: 0 }, K = { key: 1 }, Q = { class: "flex-1 relative bg-white w-full" }, te = /* @__PURE__ */ T({
|
|
13
|
-
__name: "Workbook",
|
|
14
|
-
props: {
|
|
15
|
-
modelValue: { default: "" },
|
|
16
|
-
sheets: { default: () => [] },
|
|
17
|
-
editable: { type: Boolean, default: !0 },
|
|
18
|
-
addable: { type: Boolean, default: !0 },
|
|
19
|
-
draggable: { type: Boolean, default: !0 },
|
|
20
|
-
addButtonPosition: { default: "fixed-right" },
|
|
21
|
-
maxSheets: { default: 50 },
|
|
22
|
-
variant: { default: "chrome" },
|
|
23
|
-
class: {},
|
|
24
|
-
itemClass: { default: "" },
|
|
25
|
-
activeItemClass: { default: "" },
|
|
26
|
-
inactiveItemClass: { default: "" },
|
|
27
|
-
confirmDelete: { type: Boolean, default: !1 },
|
|
28
|
-
confirmDeleteTexts: {},
|
|
29
|
-
allowIconChange: { type: Boolean, default: !0 }
|
|
30
|
-
},
|
|
31
|
-
emits: ["update:modelValue", "update:sheets", "change", "add", "delete", "duplicate", "edit-start", "edit-end"],
|
|
32
|
-
setup(i, { emit: k }) {
|
|
33
|
-
const l = i, a = k, f = g(null), r = g(null), [w, h] = Y(l.sheets, {
|
|
34
|
-
plugins: [z()],
|
|
35
|
-
draggable: (e) => l.draggable && !r.value,
|
|
36
|
-
onSort: (e) => {
|
|
37
|
-
a("update:sheets", e.values);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
x(
|
|
41
|
-
() => l.sheets,
|
|
42
|
-
(e) => {
|
|
43
|
-
JSON.stringify(e) !== JSON.stringify(h.value) && (h.value = [...e]);
|
|
44
|
-
},
|
|
45
|
-
{ deep: !0 }
|
|
46
|
-
);
|
|
47
|
-
const y = (e) => {
|
|
48
|
-
a("update:modelValue", e), a("change", e);
|
|
49
|
-
}, v = () => {
|
|
50
|
-
l.sheets.length >= l.maxSheets || a("add");
|
|
51
|
-
}, C = (e, n) => {
|
|
52
|
-
const t = l.sheets.findIndex((s) => s.id === e);
|
|
53
|
-
if (t !== -1) {
|
|
54
|
-
const s = [...l.sheets];
|
|
55
|
-
s[t] = { ...s[t], title: n }, a("update:sheets", s);
|
|
56
|
-
}
|
|
57
|
-
}, S = (e, n) => {
|
|
58
|
-
const t = l.sheets.findIndex((s) => s.id === e);
|
|
59
|
-
if (t !== -1) {
|
|
60
|
-
const s = [...l.sheets];
|
|
61
|
-
s[t] = { ...s[t], icon: n }, a("update:sheets", s);
|
|
62
|
-
}
|
|
63
|
-
}, I = (e) => {
|
|
64
|
-
r.value = e, a("edit-start", e);
|
|
65
|
-
}, D = (e) => {
|
|
66
|
-
r.value = null, a("edit-end", e);
|
|
67
|
-
}, B = (e) => {
|
|
68
|
-
a("duplicate", e);
|
|
69
|
-
}, V = (e) => {
|
|
70
|
-
const n = l.sheets.findIndex((s) => s.id === e);
|
|
71
|
-
if (n === -1) return;
|
|
72
|
-
const t = [...l.sheets];
|
|
73
|
-
if (t.splice(n, 1), a("update:sheets", t), a("delete", e), l.modelValue === e) {
|
|
74
|
-
let s = "";
|
|
75
|
-
if (t.length > 0) {
|
|
76
|
-
const N = Math.min(n, t.length - 1);
|
|
77
|
-
s = t[N].id;
|
|
78
|
-
}
|
|
79
|
-
a("update:modelValue", s), a("change", s);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
x(
|
|
83
|
-
() => l.sheets.length,
|
|
84
|
-
(e, n) => {
|
|
85
|
-
n !== void 0 && n > 0 && e === n + 1 && l.addable && U(() => {
|
|
86
|
-
const t = l.sheets[l.sheets.length - 1];
|
|
87
|
-
t.id === l.modelValue && (r.value = t.id);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
const E = (e) => {
|
|
92
|
-
f.value && e.deltaY !== 0 && (f.value.scrollLeft += e.deltaY, e.preventDefault());
|
|
93
|
-
}, $ = A(() => l.sheets.length > 1);
|
|
94
|
-
return (e, n) => (d(), o("div", L, [
|
|
95
|
-
c("div", M, [
|
|
96
|
-
e.$slots["left-addons"] ? (d(), o("div", j, [
|
|
97
|
-
m(e.$slots, "left-addons", {}, void 0, !0)
|
|
98
|
-
])) : u("", !0),
|
|
99
|
-
c("div", {
|
|
100
|
-
ref_key: "scrollContainer",
|
|
101
|
-
ref: f,
|
|
102
|
-
class: "flex-1 flex items-end overflow-x-auto scrollbar-none overscroll-contain",
|
|
103
|
-
style: { "scrollbar-width": "none", "-ms-overflow-style": "none" },
|
|
104
|
-
onWheel: E
|
|
105
|
-
}, [
|
|
106
|
-
c("div", {
|
|
107
|
-
ref_key: "parent",
|
|
108
|
-
ref: w,
|
|
109
|
-
class: "flex items-end"
|
|
110
|
-
}, [
|
|
111
|
-
(d(!0), o(P, null, J(O(h), (t) => (d(), W(F, {
|
|
112
|
-
key: t.id,
|
|
113
|
-
sheet: t,
|
|
114
|
-
"is-active": i.modelValue === t.id,
|
|
115
|
-
"is-editing": r.value === t.id,
|
|
116
|
-
"can-delete": $.value,
|
|
117
|
-
"confirm-delete": i.confirmDelete,
|
|
118
|
-
"confirm-delete-texts": i.confirmDeleteTexts,
|
|
119
|
-
"allow-icon-change": i.allowIconChange,
|
|
120
|
-
"item-class": i.itemClass,
|
|
121
|
-
"active-item-class": i.activeItemClass,
|
|
122
|
-
"inactive-item-class": i.inactiveItemClass,
|
|
123
|
-
onSelect: y,
|
|
124
|
-
"onUpdate:title": C,
|
|
125
|
-
"onUpdate:icon": S,
|
|
126
|
-
onEditStart: I,
|
|
127
|
-
onEditEnd: D,
|
|
128
|
-
onDuplicate: B,
|
|
129
|
-
onDelete: V
|
|
130
|
-
}, null, 8, ["sheet", "is-active", "is-editing", "can-delete", "confirm-delete", "confirm-delete-texts", "allow-icon-change", "item-class", "active-item-class", "inactive-item-class"]))), 128))
|
|
131
|
-
], 512),
|
|
132
|
-
i.addable && i.addButtonPosition === "attached" ? (d(), o("div", q, [
|
|
133
|
-
p(b, { onClick: v })
|
|
134
|
-
])) : u("", !0),
|
|
135
|
-
n[0] || (n[0] = c("div", { class: "w-1 shrink-0" }, null, -1))
|
|
136
|
-
], 544),
|
|
137
|
-
c("div", G, [
|
|
138
|
-
i.addable && i.addButtonPosition === "fixed-right" ? (d(), o("div", H, [
|
|
139
|
-
p(b, { onClick: v })
|
|
140
|
-
])) : u("", !0),
|
|
141
|
-
e.$slots["right-addons"] ? (d(), o("div", K, [
|
|
142
|
-
m(e.$slots, "right-addons", {}, void 0, !0)
|
|
143
|
-
])) : u("", !0)
|
|
144
|
-
])
|
|
145
|
-
]),
|
|
146
|
-
c("div", Q, [
|
|
147
|
-
m(e.$slots, "default", {}, void 0, !0)
|
|
148
|
-
])
|
|
149
|
-
]));
|
|
150
|
-
}
|
|
151
|
-
});
|
|
1
|
+
import f from "./Workbook.vue.js";
|
|
152
2
|
export {
|
|
153
|
-
|
|
3
|
+
f as default
|
|
154
4
|
};
|
package/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * from './components/Heatmap';
|
|
|
22
22
|
export { default as Icon } from './components/Icon.vue';
|
|
23
23
|
export { default as IconPicker } from './components/IconPicker.vue';
|
|
24
24
|
export { default as Input } from './components/Input.vue';
|
|
25
|
+
export * from './components/Kanban';
|
|
25
26
|
export { default as NumberInput } from './components/NumberInput.vue';
|
|
26
27
|
export { default as Label } from './components/Label.vue';
|
|
27
28
|
export { default as Logo } from './components/Logo.vue';
|
|
@@ -46,7 +47,6 @@ export { default as Tooltip } from './components/Tooltip.vue';
|
|
|
46
47
|
export * from './components/Workbook';
|
|
47
48
|
export { default as GoogleLogin } from './components/GoogleLogin.vue';
|
|
48
49
|
export * from './components/ProgressBar';
|
|
49
|
-
export * from './components/Spinner';
|
|
50
50
|
export * from './composables/useNotifications';
|
|
51
51
|
export * from './composables/useTheme';
|
|
52
52
|
export * from './composables/useKeyStroke';
|