laif-ds 0.2.71 → 0.2.72
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/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/app-kanban.js +149 -118
- package/dist/index.d.ts +8 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/package.json +1 -1
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,185 +1,216 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { KanbanBoardProvider as
|
|
5
|
-
import { stringToHexColor as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { jsx as i, jsxs as c, Fragment as L } from "react/jsx-runtime";
|
|
3
|
+
import { useState as S, useMemo as q, useCallback as h } from "react";
|
|
4
|
+
import { KanbanBoardProvider as G, KanbanBoard as M, KanbanBoardColumn as Q, KanbanBoardColumnHeader as T, KanbanBoardColumnList as V, KanbanBoardColumnListItem as X, KanbanBoardCard as Y, KanbanBoardCardTitle as Z, KanbanBoardCardDescription as _ } from "./kanban.js";
|
|
5
|
+
import { stringToHexColor as $, cn as I, hexToRgba as E } from "../../lib/utils.js";
|
|
6
|
+
import { Button as k } from "./button.js";
|
|
7
|
+
import { Icon as ee } from "./icon.js";
|
|
8
|
+
import re from "../../node_modules/lucide-react/dist/esm/icons/lock.js";
|
|
9
|
+
import ne from "../../node_modules/lucide-react/dist/esm/icons/arrow-down-to-line.js";
|
|
10
|
+
import ae from "../../node_modules/lucide-react/dist/esm/icons/arrow-up-from-line.js";
|
|
11
|
+
import te from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
|
|
12
|
+
function pe({
|
|
13
|
+
columns: C,
|
|
14
|
+
initialTasks: P,
|
|
15
|
+
onTaskMove: x,
|
|
16
|
+
onTaskEdit: y,
|
|
17
|
+
onTaskCreate: N,
|
|
18
|
+
taskActions: A,
|
|
19
|
+
renderTaskContent: B,
|
|
20
|
+
className: H,
|
|
21
|
+
allowTaskCreate: F = !0
|
|
20
22
|
}) {
|
|
21
|
-
const [
|
|
22
|
-
() => new
|
|
23
|
-
[
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
const [v, w] = S(P), [g, K] = S(null), u = q(
|
|
24
|
+
() => new Map(C.map((e) => [e.id, e])),
|
|
25
|
+
[C]
|
|
26
|
+
), O = h(
|
|
27
|
+
(e) => !!u.get(e)?.disabled,
|
|
28
|
+
[u]
|
|
29
|
+
), D = h(
|
|
30
|
+
(e) => {
|
|
31
|
+
const r = u.get(e);
|
|
32
|
+
return r ? !r.disabled && !r.disableOnDragIn : !0;
|
|
33
|
+
},
|
|
34
|
+
[u]
|
|
35
|
+
), b = h(
|
|
36
|
+
(e) => {
|
|
37
|
+
const r = u.get(e);
|
|
38
|
+
return r ? !r.disabled && !r.disableOnDragOut : !0;
|
|
39
|
+
},
|
|
40
|
+
[u]
|
|
41
|
+
), U = h(
|
|
42
|
+
(e) => !g || g === e ? !1 : !b(g),
|
|
43
|
+
[g, b]
|
|
44
|
+
), z = (e) => {
|
|
45
|
+
const r = {};
|
|
46
|
+
for (const t of Object.keys(e))
|
|
47
|
+
r[t] = [...e[t]];
|
|
48
|
+
return r;
|
|
49
|
+
}, J = (e, r) => {
|
|
50
|
+
w((t) => {
|
|
51
|
+
const d = z(t);
|
|
52
|
+
let s, n;
|
|
53
|
+
for (const o of Object.keys(d)) {
|
|
54
|
+
const a = d[o].findIndex((l) => l.id === e);
|
|
55
|
+
if (a !== -1) {
|
|
56
|
+
n = o, [s] = d[o].splice(a, 1);
|
|
37
57
|
break;
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
|
-
return !
|
|
60
|
+
return !s || n === r || n && !b(n) || !D(r) ? t : (d[r] || (d[r] = []), d[r].push(s), n && x && x(e, n, r), d);
|
|
41
61
|
});
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
const n =
|
|
45
|
-
(
|
|
62
|
+
}, R = (e, r, t, d) => {
|
|
63
|
+
w((s) => {
|
|
64
|
+
const n = z(s), o = Object.keys(n).find(
|
|
65
|
+
(m) => n[m].some((W) => W.id === e)
|
|
46
66
|
);
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
(
|
|
67
|
+
if (!o) return s;
|
|
68
|
+
const a = n[o].findIndex(
|
|
69
|
+
(m) => m.id === e
|
|
50
70
|
);
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
71
|
+
if (a === -1) return s;
|
|
72
|
+
const l = o === t;
|
|
73
|
+
if (l && O(t) || !l && (!b(o) || !D(t)))
|
|
74
|
+
return s;
|
|
75
|
+
const [f] = n[o].splice(a, 1);
|
|
76
|
+
n[t] || (n[t] = []);
|
|
77
|
+
const p = n[t].findIndex(
|
|
78
|
+
(m) => m.id === r
|
|
57
79
|
);
|
|
58
|
-
if (
|
|
59
|
-
n[
|
|
80
|
+
if (p === -1)
|
|
81
|
+
n[t].push(f);
|
|
60
82
|
else {
|
|
61
|
-
const
|
|
62
|
-
n[
|
|
83
|
+
const m = d === "top" ? p : p + 1;
|
|
84
|
+
n[t].splice(m, 0, f);
|
|
63
85
|
}
|
|
64
|
-
return
|
|
86
|
+
return o !== t && x && x(e, o, t), n;
|
|
65
87
|
});
|
|
66
|
-
},
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
const
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
|
|
88
|
+
}, j = (e) => JSON.parse(e);
|
|
89
|
+
return /* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(M, { className: H, children: C.map((e) => {
|
|
90
|
+
const r = $(e.label), t = O(e.id), d = !D(e.id), s = !b(e.id), n = d && s, o = d || U(e.id);
|
|
91
|
+
return /* @__PURE__ */ c(
|
|
92
|
+
Q,
|
|
71
93
|
{
|
|
72
94
|
columnId: e.id,
|
|
73
|
-
disabled:
|
|
74
|
-
onDropOverColumn: (
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
|
|
95
|
+
disabled: o,
|
|
96
|
+
onDropOverColumn: (a) => {
|
|
97
|
+
if (o) return;
|
|
98
|
+
const l = j(a);
|
|
99
|
+
J(l.id, e.id);
|
|
78
100
|
},
|
|
79
|
-
className:
|
|
101
|
+
className: I(
|
|
80
102
|
"group/column relative transition-all duration-200",
|
|
81
|
-
!
|
|
103
|
+
!n && "hover:-translate-y-0.5 hover:shadow-lg"
|
|
82
104
|
),
|
|
83
105
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ i(T, { className: "border-d-border/60 bg-d-sidebar/90 sticky top-0 z-10 mb-2 rounded-xl border px-2.5 py-2 backdrop-blur", children: /* @__PURE__ */ c("div", { className: "flex w-full items-center justify-between", children: [
|
|
107
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
108
|
+
/* @__PURE__ */ c(
|
|
87
109
|
"div",
|
|
88
110
|
{
|
|
89
111
|
className: "flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-semibold shadow-sm",
|
|
90
112
|
style: {
|
|
91
|
-
backgroundColor:
|
|
92
|
-
color:
|
|
93
|
-
borderColor:
|
|
113
|
+
backgroundColor: E(r, 0.15),
|
|
114
|
+
color: r,
|
|
115
|
+
borderColor: E(r, 0.35)
|
|
94
116
|
},
|
|
95
117
|
children: [
|
|
96
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ i(
|
|
97
119
|
"span",
|
|
98
120
|
{
|
|
99
121
|
className: "size-1.5 rounded-full",
|
|
100
|
-
style: { backgroundColor:
|
|
122
|
+
style: { backgroundColor: r }
|
|
101
123
|
}
|
|
102
124
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ i("span", { className: "max-w-[150px] truncate", children: e.label })
|
|
104
126
|
]
|
|
105
127
|
}
|
|
106
128
|
),
|
|
107
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ i("span", { className: "text-d-muted-foreground border-d-border/60 bg-d-muted/40 inline-flex items-center rounded-full border px-2 py-0.5 text-[11px] font-medium", children: v[e.id]?.length ?? 0 })
|
|
108
130
|
] }),
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
131
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
132
|
+
(d || s) && /* @__PURE__ */ i(
|
|
111
133
|
"span",
|
|
112
134
|
{
|
|
113
|
-
className: "text-d-muted-foreground inline-flex
|
|
114
|
-
title: "
|
|
115
|
-
"aria-label": "
|
|
116
|
-
children: /* @__PURE__ */
|
|
135
|
+
className: "text-d-muted-foreground border-d-border/60 bg-d-muted/30 inline-flex h-6 items-center justify-center gap-1 rounded-md border px-1.5",
|
|
136
|
+
title: n ? "Entrata e uscita bloccate" : d ? "Entrata bloccata" : "Uscita bloccata",
|
|
137
|
+
"aria-label": n ? "Entrata e uscita bloccate" : d ? "Entrata bloccata" : "Uscita bloccata",
|
|
138
|
+
children: n ? /* @__PURE__ */ i(re, { className: "size-3.5" }) : /* @__PURE__ */ c(L, { children: [
|
|
139
|
+
d && /* @__PURE__ */ i(ne, { className: "size-3.5" }),
|
|
140
|
+
s && /* @__PURE__ */ i(ae, { className: "size-3.5" })
|
|
141
|
+
] })
|
|
117
142
|
}
|
|
118
143
|
),
|
|
119
|
-
|
|
120
|
-
|
|
144
|
+
F && N && /* @__PURE__ */ i(
|
|
145
|
+
k,
|
|
121
146
|
{
|
|
122
147
|
variant: "ghost",
|
|
123
148
|
size: "icon",
|
|
124
149
|
className: "text-d-muted-foreground hover:text-d-foreground h-6 w-6",
|
|
125
|
-
onClick: () =>
|
|
126
|
-
children: /* @__PURE__ */
|
|
150
|
+
onClick: () => N(e.id),
|
|
151
|
+
children: /* @__PURE__ */ i(te, { className: "size-3.5" })
|
|
127
152
|
}
|
|
128
153
|
)
|
|
129
154
|
] })
|
|
130
155
|
] }) }),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
|
|
156
|
+
/* @__PURE__ */ i(
|
|
157
|
+
V,
|
|
133
158
|
{
|
|
134
159
|
className: "px-1.5 pb-3",
|
|
135
|
-
dropDisabled:
|
|
136
|
-
children:
|
|
137
|
-
|
|
160
|
+
dropDisabled: o,
|
|
161
|
+
children: v[e.id]?.map((a) => /* @__PURE__ */ i(
|
|
162
|
+
X,
|
|
138
163
|
{
|
|
139
|
-
cardId:
|
|
140
|
-
dropDisabled:
|
|
164
|
+
cardId: a.id,
|
|
165
|
+
dropDisabled: o,
|
|
141
166
|
className: "mb-2 border-0 last:mb-0",
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
onDragStartCapture: () => {
|
|
168
|
+
K(e.id);
|
|
169
|
+
},
|
|
170
|
+
onDragEndCapture: () => {
|
|
171
|
+
K(null);
|
|
172
|
+
},
|
|
173
|
+
onDropOverListItem: (l, f) => {
|
|
174
|
+
if (o || f === "none") return;
|
|
175
|
+
const p = j(l);
|
|
176
|
+
R(
|
|
177
|
+
p.id,
|
|
178
|
+
a.id,
|
|
148
179
|
e.id,
|
|
149
|
-
|
|
180
|
+
f
|
|
150
181
|
);
|
|
151
182
|
},
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
183
|
+
children: /* @__PURE__ */ i(
|
|
184
|
+
Y,
|
|
154
185
|
{
|
|
155
|
-
data:
|
|
156
|
-
dragDisabled:
|
|
157
|
-
className:
|
|
186
|
+
data: a,
|
|
187
|
+
dragDisabled: t,
|
|
188
|
+
className: I(
|
|
158
189
|
"group/card relative rounded-xl border border-transparent shadow-sm transition-all duration-200",
|
|
159
|
-
!
|
|
190
|
+
!t && "hover:border-d-border/60 hover:-translate-y-0.5 hover:shadow-lg"
|
|
160
191
|
),
|
|
161
|
-
backgroundColor:
|
|
162
|
-
onEdit:
|
|
163
|
-
actions:
|
|
164
|
-
meta:
|
|
165
|
-
children:
|
|
166
|
-
/* @__PURE__ */
|
|
167
|
-
|
|
168
|
-
|
|
192
|
+
backgroundColor: r,
|
|
193
|
+
onEdit: y ? () => y(a, e.id) : void 0,
|
|
194
|
+
actions: A?.(a, e.id),
|
|
195
|
+
meta: a.meta,
|
|
196
|
+
children: B ? B(a, e.id) : /* @__PURE__ */ c(L, { children: [
|
|
197
|
+
/* @__PURE__ */ c("div", { className: "mb-1 flex items-start gap-2", children: [
|
|
198
|
+
a.icon && /* @__PURE__ */ i(
|
|
199
|
+
ee,
|
|
169
200
|
{
|
|
170
|
-
name:
|
|
201
|
+
name: a.icon,
|
|
171
202
|
size: "sm",
|
|
172
203
|
className: "text-d-muted-foreground mt-0.5 shrink-0"
|
|
173
204
|
}
|
|
174
205
|
),
|
|
175
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ i(Z, { className: "flex-1 text-sm leading-snug font-semibold", children: a.title })
|
|
176
207
|
] }),
|
|
177
|
-
|
|
208
|
+
a.description && /* @__PURE__ */ i(_, { className: "text-d-muted-foreground mt-1.5 line-clamp-2 text-xs leading-relaxed", children: a.description })
|
|
178
209
|
] })
|
|
179
210
|
}
|
|
180
211
|
)
|
|
181
212
|
},
|
|
182
|
-
|
|
213
|
+
a.id
|
|
183
214
|
))
|
|
184
215
|
}
|
|
185
216
|
)
|
|
@@ -190,5 +221,5 @@ function ne({
|
|
|
190
221
|
}) }) });
|
|
191
222
|
}
|
|
192
223
|
export {
|
|
193
|
-
|
|
224
|
+
pe as AppKanban
|
|
194
225
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,14 @@ export declare type AppKanbanColumn = {
|
|
|
265
265
|
id: string;
|
|
266
266
|
label: string;
|
|
267
267
|
disabled?: boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Prevent dropping cards into this column.
|
|
270
|
+
*/
|
|
271
|
+
disableOnDragIn?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Prevent dragging cards out of this column.
|
|
274
|
+
*/
|
|
275
|
+
disableOnDragOut?: boolean;
|
|
268
276
|
};
|
|
269
277
|
|
|
270
278
|
export declare type AppKanbanConfig<T = any> = {
|