@object-ui/plugin-kanban 3.1.3 → 3.1.5
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/.turbo/turbo-build.log +24 -12
- package/CHANGELOG.md +18 -0
- package/dist/KanbanEnhanced-CvxO2soF.js +817 -0
- package/dist/KanbanImpl-ii52_k8g.js +396 -0
- package/dist/chevron-down-DpXJN6OX.js +7 -0
- package/dist/index.js +718 -15
- package/dist/index.umd.cjs +4 -4
- package/dist/plus-CAtTu4zt.js +223 -0
- package/dist/sortable.esm-DzUCoMzQ.js +2414 -0
- package/dist/src/ObjectKanban.d.ts +4 -0
- package/dist/src/ObjectKanban.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/ObjectKanban.tsx +26 -8
- package/dist/KanbanEnhanced-DbOkJkpo.js +0 -949
- package/dist/KanbanImpl-BnNosFpy.js +0 -350
- package/dist/index-DP2mI15e.js +0 -1077
- package/dist/sortable.esm-CNNHgHk5.js +0 -3206
package/dist/index.js
CHANGED
|
@@ -1,16 +1,719 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "@object-ui/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { n as e, r as t, t as n } from "./plus-CAtTu4zt.js";
|
|
2
|
+
import { t as r } from "./chevron-down-DpXJN6OX.js";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import a, { Suspense as o, useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
5
|
+
import { ComponentRegistry as d, buildExpandFields as f, extractRecords as p } from "@object-ui/core";
|
|
6
|
+
import { useDataScope as m, useNavigationOverlay as h, useSchemaContext as g } from "@object-ui/react";
|
|
7
|
+
import { Button as _, Input as v, NavigationOverlay as y, Skeleton as b } from "@object-ui/components";
|
|
8
|
+
//#region src/ObjectKanban.tsx
|
|
9
|
+
var x = t(), S = ({ schema: e, dataSource: t, className: n, data: r, loading: i, onRowClick: a, onCardClick: o, ...s }) => {
|
|
10
|
+
let d = Array.isArray(r), [g, _] = u([]), [v, b] = u(null), [S, C] = u(d ? i ?? !1 : !1), [w, T] = u(null), E = m(e.bind);
|
|
11
|
+
c(() => {
|
|
12
|
+
d && i !== void 0 && C(i);
|
|
13
|
+
}, [i, d]), c(() => {
|
|
14
|
+
let n = !0;
|
|
15
|
+
return (async () => {
|
|
16
|
+
if (!(!t || !e.objectName)) try {
|
|
17
|
+
let r = await t.getObjectSchema(e.objectName);
|
|
18
|
+
n && b(r);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.warn("Failed to fetch object def", e);
|
|
21
|
+
}
|
|
22
|
+
})(), () => {
|
|
23
|
+
n = !1;
|
|
24
|
+
};
|
|
25
|
+
}, [e.objectName, t]), c(() => {
|
|
26
|
+
if (d) return;
|
|
27
|
+
let n = !0;
|
|
28
|
+
return e.objectName && !E && !e.data && (async () => {
|
|
29
|
+
if (!(!t || typeof t.find != "function" || !e.objectName)) {
|
|
30
|
+
n && C(!0);
|
|
31
|
+
try {
|
|
32
|
+
let r = f(v?.fields), i = p(await t.find(e.objectName, {
|
|
33
|
+
options: { $top: 100 },
|
|
34
|
+
$filter: e.filter,
|
|
35
|
+
...r.length > 0 ? { $expand: r } : {}
|
|
36
|
+
}));
|
|
37
|
+
n && _(i);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.error("[ObjectKanban] Fetch error:", e), n && T(e);
|
|
40
|
+
} finally {
|
|
41
|
+
n && C(!1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
})(), () => {
|
|
45
|
+
n = !1;
|
|
46
|
+
};
|
|
47
|
+
}, [
|
|
48
|
+
e.objectName,
|
|
49
|
+
t,
|
|
50
|
+
E,
|
|
51
|
+
e.data,
|
|
52
|
+
e.filter,
|
|
53
|
+
d,
|
|
54
|
+
v
|
|
55
|
+
]);
|
|
56
|
+
let D = (d ? r : void 0) || E || e.data || g, O = l(() => {
|
|
57
|
+
if (!Array.isArray(D)) return [];
|
|
58
|
+
let t = e.cardTitle || e.titleField;
|
|
59
|
+
if (!t && v) {
|
|
60
|
+
if (v.titleFormat) {
|
|
61
|
+
let e = /\{(.+?)\}/.exec(v.titleFormat);
|
|
62
|
+
e && (t = e[1]);
|
|
63
|
+
}
|
|
64
|
+
!t && v.NAME_FIELD_KEY && (t = v.NAME_FIELD_KEY);
|
|
65
|
+
}
|
|
66
|
+
let n = [
|
|
67
|
+
"name",
|
|
68
|
+
"title",
|
|
69
|
+
"subject",
|
|
70
|
+
"label",
|
|
71
|
+
"display_name"
|
|
72
|
+
];
|
|
73
|
+
return D.map((e) => {
|
|
74
|
+
let r = t ? e[t] : void 0;
|
|
75
|
+
if (!r) {
|
|
76
|
+
for (let t of n) if (e[t]) {
|
|
77
|
+
r = e[t];
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
...e,
|
|
83
|
+
id: e.id || e._id,
|
|
84
|
+
title: r || "Untitled"
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}, [
|
|
88
|
+
D,
|
|
89
|
+
e,
|
|
90
|
+
v
|
|
91
|
+
]), k = l(() => {
|
|
92
|
+
if (e.columns && e.columns.length > 0) if (typeof e.columns[0] == "string") {
|
|
93
|
+
if (!e.groupBy) return e.columns.map((e) => ({
|
|
94
|
+
id: e,
|
|
95
|
+
title: e
|
|
96
|
+
}));
|
|
97
|
+
} else return e.columns;
|
|
98
|
+
if (e.groupBy && v?.fields?.[e.groupBy]?.options) return v.fields[e.groupBy].options.map((e) => ({
|
|
99
|
+
id: e.value,
|
|
100
|
+
title: e.label
|
|
101
|
+
}));
|
|
102
|
+
if (e.groupBy && O.length > 0) {
|
|
103
|
+
let t = new Set(O.map((t) => t[e.groupBy]));
|
|
104
|
+
return Array.from(t).map((e) => ({
|
|
105
|
+
id: String(e),
|
|
106
|
+
title: String(e)
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}, [
|
|
111
|
+
e.columns,
|
|
112
|
+
e.groupBy,
|
|
113
|
+
O,
|
|
114
|
+
v
|
|
115
|
+
]), A = e.swimlaneField || e.grouping?.fields?.[0]?.field, j = {
|
|
116
|
+
...e,
|
|
117
|
+
data: O,
|
|
118
|
+
columns: k,
|
|
119
|
+
className: n || e.className,
|
|
120
|
+
...A ? { swimlaneField: A } : {}
|
|
121
|
+
}, M = h({
|
|
122
|
+
navigation: e.navigation,
|
|
123
|
+
objectName: e.objectName,
|
|
124
|
+
onRowClick: a ?? o
|
|
125
|
+
});
|
|
126
|
+
if (w) return /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
127
|
+
className: "p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive",
|
|
128
|
+
children: ["Error loading kanban data: ", w.message]
|
|
129
|
+
});
|
|
130
|
+
let N = e.objectName ? `${e.objectName.charAt(0).toUpperCase() + e.objectName.slice(1).replace(/_/g, " ")} Detail` : "Card Details";
|
|
131
|
+
return /* @__PURE__ */ (0, x.jsxs)(x.Fragment, { children: [/* @__PURE__ */ (0, x.jsx)(B, { schema: {
|
|
132
|
+
...j,
|
|
133
|
+
onCardClick: (e) => {
|
|
134
|
+
M.handleClick(e), o?.(e);
|
|
135
|
+
}
|
|
136
|
+
} }), M.isOverlay && /* @__PURE__ */ (0, x.jsx)(y, {
|
|
137
|
+
...M,
|
|
138
|
+
title: N,
|
|
139
|
+
children: (e) => /* @__PURE__ */ (0, x.jsx)("div", {
|
|
140
|
+
className: "space-y-3",
|
|
141
|
+
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
142
|
+
className: "flex flex-col",
|
|
143
|
+
children: [/* @__PURE__ */ (0, x.jsx)("span", {
|
|
144
|
+
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
145
|
+
children: e.replace(/_/g, " ")
|
|
146
|
+
}), /* @__PURE__ */ (0, x.jsx)("span", {
|
|
147
|
+
className: "text-sm",
|
|
148
|
+
children: String(t ?? "—")
|
|
149
|
+
})]
|
|
150
|
+
}, e))
|
|
151
|
+
})
|
|
152
|
+
})] });
|
|
153
|
+
}, C = e("check", [["path", {
|
|
154
|
+
d: "M20 6 9 17l-5-5",
|
|
155
|
+
key: "1gmf2c"
|
|
156
|
+
}]]), w = e("file-text", [
|
|
157
|
+
["path", {
|
|
158
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
159
|
+
key: "1oefj6"
|
|
160
|
+
}],
|
|
161
|
+
["path", {
|
|
162
|
+
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
163
|
+
key: "wfsgrz"
|
|
164
|
+
}],
|
|
165
|
+
["path", {
|
|
166
|
+
d: "M10 9H8",
|
|
167
|
+
key: "b1mrlr"
|
|
168
|
+
}],
|
|
169
|
+
["path", {
|
|
170
|
+
d: "M16 13H8",
|
|
171
|
+
key: "t4e002"
|
|
172
|
+
}],
|
|
173
|
+
["path", {
|
|
174
|
+
d: "M16 17H8",
|
|
175
|
+
key: "z1uh3a"
|
|
176
|
+
}]
|
|
177
|
+
]), T = e("x", [["path", {
|
|
178
|
+
d: "M18 6 6 18",
|
|
179
|
+
key: "1bl5f8"
|
|
180
|
+
}], ["path", {
|
|
181
|
+
d: "m6 6 12 12",
|
|
182
|
+
key: "d8bk6v"
|
|
183
|
+
}]]), E = (...e) => e.filter(Boolean).join(" "), D = ({ columnId: e, fields: t, onSubmit: n, onCancel: r, defaultValues: a }) => {
|
|
184
|
+
let [o, s] = i.useState(() => {
|
|
185
|
+
let e = {};
|
|
186
|
+
for (let n of t) e[n.name] = a?.[n.name] ?? n.defaultValue ?? "";
|
|
187
|
+
return e;
|
|
188
|
+
}), c = i.useRef(null);
|
|
189
|
+
i.useEffect(() => {
|
|
190
|
+
let e = setTimeout(() => c.current?.focus(), 0);
|
|
191
|
+
return () => clearTimeout(e);
|
|
192
|
+
}, []);
|
|
193
|
+
let l = i.useCallback((e, t) => {
|
|
194
|
+
s((n) => ({
|
|
195
|
+
...n,
|
|
196
|
+
[e]: t
|
|
197
|
+
}));
|
|
198
|
+
}, []), u = i.useCallback(() => {
|
|
199
|
+
Object.values(o).some((e) => typeof e == "string" ? e.trim().length > 0 : e != null) && n(e, o);
|
|
200
|
+
}, [
|
|
201
|
+
e,
|
|
202
|
+
o,
|
|
203
|
+
n
|
|
204
|
+
]);
|
|
205
|
+
return /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
206
|
+
className: "mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm",
|
|
207
|
+
onKeyDown: i.useCallback((e) => {
|
|
208
|
+
e.key === "Enter" ? (e.preventDefault(), u()) : e.key === "Escape" && (e.preventDefault(), r());
|
|
209
|
+
}, [u, r]),
|
|
210
|
+
role: "form",
|
|
211
|
+
"aria-label": "Quick add card",
|
|
212
|
+
children: [t.map((t, n) => /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
213
|
+
className: "space-y-1",
|
|
214
|
+
children: [/* @__PURE__ */ (0, x.jsx)("label", {
|
|
215
|
+
htmlFor: `qa-${e}-${t.name}`,
|
|
216
|
+
className: "text-xs font-mono text-muted-foreground",
|
|
217
|
+
children: t.label ?? t.name
|
|
218
|
+
}), O(t, o[t.name], l, n === 0 ? c : void 0, `qa-${e}-${t.name}`)]
|
|
219
|
+
}, t.name)), /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
220
|
+
className: "flex items-center gap-2 pt-1",
|
|
221
|
+
children: [/* @__PURE__ */ (0, x.jsxs)(_, {
|
|
222
|
+
type: "button",
|
|
223
|
+
size: "sm",
|
|
224
|
+
className: "h-7 text-xs gap-1",
|
|
225
|
+
onClick: u,
|
|
226
|
+
children: [/* @__PURE__ */ (0, x.jsx)(C, { className: "h-3 w-3" }), "Save"]
|
|
227
|
+
}), /* @__PURE__ */ (0, x.jsxs)(_, {
|
|
228
|
+
type: "button",
|
|
229
|
+
variant: "ghost",
|
|
230
|
+
size: "sm",
|
|
231
|
+
className: "h-7 text-xs gap-1",
|
|
232
|
+
onClick: r,
|
|
233
|
+
children: [/* @__PURE__ */ (0, x.jsx)(T, { className: "h-3 w-3" }), "Cancel"]
|
|
234
|
+
})]
|
|
235
|
+
})]
|
|
236
|
+
});
|
|
16
237
|
};
|
|
238
|
+
function O(e, t, n, r, i) {
|
|
239
|
+
let a = "text-sm h-8";
|
|
240
|
+
switch (e.type) {
|
|
241
|
+
case "select": return /* @__PURE__ */ (0, x.jsxs)("select", {
|
|
242
|
+
ref: r,
|
|
243
|
+
id: i,
|
|
244
|
+
value: t ?? "",
|
|
245
|
+
onChange: (t) => n(e.name, t.target.value),
|
|
246
|
+
className: E(a, "w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
|
|
247
|
+
children: [/* @__PURE__ */ (0, x.jsx)("option", {
|
|
248
|
+
value: "",
|
|
249
|
+
children: e.placeholder ?? `Select ${e.label ?? e.name}...`
|
|
250
|
+
}), (e.options ?? []).map((e) => /* @__PURE__ */ (0, x.jsx)("option", {
|
|
251
|
+
value: e.value,
|
|
252
|
+
children: e.label
|
|
253
|
+
}, e.value))]
|
|
254
|
+
});
|
|
255
|
+
case "number": return /* @__PURE__ */ (0, x.jsx)(v, {
|
|
256
|
+
ref: r,
|
|
257
|
+
id: i,
|
|
258
|
+
type: "number",
|
|
259
|
+
value: t ?? "",
|
|
260
|
+
onChange: (t) => n(e.name, t.target.value === "" ? "" : Number(t.target.value)),
|
|
261
|
+
placeholder: e.placeholder ?? `Enter ${e.label ?? e.name}...`,
|
|
262
|
+
className: a
|
|
263
|
+
});
|
|
264
|
+
default: return /* @__PURE__ */ (0, x.jsx)(v, {
|
|
265
|
+
ref: r,
|
|
266
|
+
id: i,
|
|
267
|
+
type: "text",
|
|
268
|
+
value: t ?? "",
|
|
269
|
+
onChange: (t) => n(e.name, t.target.value),
|
|
270
|
+
placeholder: e.placeholder ?? `Enter ${e.label ?? e.name}...`,
|
|
271
|
+
className: a
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/CardTemplates.tsx
|
|
277
|
+
var k = (...e) => e.filter(Boolean).join(" "), A = ({ templates: e, onSelect: t, columnId: a }) => {
|
|
278
|
+
let [o, s] = i.useState(!1), c = i.useRef(null);
|
|
279
|
+
return i.useEffect(() => {
|
|
280
|
+
if (!o) return;
|
|
281
|
+
let e = (e) => {
|
|
282
|
+
c.current && !c.current.contains(e.target) && s(!1);
|
|
283
|
+
};
|
|
284
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
285
|
+
}, [o]), /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
286
|
+
ref: c,
|
|
287
|
+
className: "relative",
|
|
288
|
+
onKeyDown: i.useCallback((e) => {
|
|
289
|
+
e.key === "Escape" && s(!1);
|
|
290
|
+
}, []),
|
|
291
|
+
children: [/* @__PURE__ */ (0, x.jsxs)(_, {
|
|
292
|
+
variant: "ghost",
|
|
293
|
+
size: "sm",
|
|
294
|
+
className: "w-full mt-2 text-muted-foreground hover:text-foreground gap-1",
|
|
295
|
+
onClick: () => s((e) => !e),
|
|
296
|
+
"aria-haspopup": "listbox",
|
|
297
|
+
"aria-expanded": o,
|
|
298
|
+
"aria-label": `Add card to ${a}`,
|
|
299
|
+
children: [
|
|
300
|
+
/* @__PURE__ */ (0, x.jsx)(n, { className: "h-4 w-4" }),
|
|
301
|
+
"Add Card",
|
|
302
|
+
/* @__PURE__ */ (0, x.jsx)(r, { className: k("h-3 w-3 transition-transform", o ? "rotate-180" : "") })
|
|
303
|
+
]
|
|
304
|
+
}), o && /* @__PURE__ */ (0, x.jsxs)("div", {
|
|
305
|
+
className: "absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md",
|
|
306
|
+
role: "listbox",
|
|
307
|
+
"aria-label": "Card templates",
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ (0, x.jsxs)("button", {
|
|
310
|
+
type: "button",
|
|
311
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
312
|
+
role: "option",
|
|
313
|
+
"aria-selected": !1,
|
|
314
|
+
onClick: () => {
|
|
315
|
+
t(null), s(!1);
|
|
316
|
+
},
|
|
317
|
+
children: [/* @__PURE__ */ (0, x.jsx)(n, { className: "h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ (0, x.jsx)("span", {
|
|
318
|
+
className: "font-mono text-xs",
|
|
319
|
+
children: "Custom"
|
|
320
|
+
})]
|
|
321
|
+
}),
|
|
322
|
+
e.length > 0 && /* @__PURE__ */ (0, x.jsx)("div", {
|
|
323
|
+
className: "my-1 h-px bg-border",
|
|
324
|
+
role: "separator"
|
|
325
|
+
}),
|
|
326
|
+
e.map((e) => /* @__PURE__ */ (0, x.jsxs)("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",
|
|
329
|
+
role: "option",
|
|
330
|
+
"aria-selected": !1,
|
|
331
|
+
onClick: () => {
|
|
332
|
+
t(e), s(!1);
|
|
333
|
+
},
|
|
334
|
+
children: [/* @__PURE__ */ (0, x.jsx)(w, { className: "h-4 w-4 text-muted-foreground" }), /* @__PURE__ */ (0, x.jsx)("span", {
|
|
335
|
+
className: "font-mono text-xs truncate",
|
|
336
|
+
children: e.name
|
|
337
|
+
})]
|
|
338
|
+
}, e.id))
|
|
339
|
+
]
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
342
|
+
}, j = "objectui:kanban-column-widths";
|
|
343
|
+
function M(e) {
|
|
344
|
+
try {
|
|
345
|
+
let t = localStorage.getItem(e);
|
|
346
|
+
if (t) {
|
|
347
|
+
let e = JSON.parse(t);
|
|
348
|
+
if (e && typeof e == "object" && !Array.isArray(e)) return e;
|
|
349
|
+
}
|
|
350
|
+
} catch {}
|
|
351
|
+
return {};
|
|
352
|
+
}
|
|
353
|
+
function N(e, t) {
|
|
354
|
+
try {
|
|
355
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
356
|
+
} catch {}
|
|
357
|
+
}
|
|
358
|
+
function P({ columns: e, defaultWidth: t = 320, minWidth: n = 200, maxWidth: r = 600, storageKey: i }) {
|
|
359
|
+
let a = i ? `${j}:${i}` : j, [o, c] = u(() => M(a)), d = s((e) => Math.max(n, Math.min(r, e)), [n, r]);
|
|
360
|
+
return {
|
|
361
|
+
getColumnWidth: s((e) => {
|
|
362
|
+
let n = o[e];
|
|
363
|
+
return n == null ? t : d(n);
|
|
364
|
+
}, [
|
|
365
|
+
o,
|
|
366
|
+
t,
|
|
367
|
+
d
|
|
368
|
+
]),
|
|
369
|
+
setColumnWidth: s((e, t) => {
|
|
370
|
+
let n = d(t);
|
|
371
|
+
c((t) => {
|
|
372
|
+
let r = {
|
|
373
|
+
...t,
|
|
374
|
+
[e]: n
|
|
375
|
+
};
|
|
376
|
+
return N(a, r), r;
|
|
377
|
+
});
|
|
378
|
+
}, [d, a]),
|
|
379
|
+
resetWidths: s(() => {
|
|
380
|
+
c({});
|
|
381
|
+
try {
|
|
382
|
+
localStorage.removeItem(a);
|
|
383
|
+
} catch {}
|
|
384
|
+
}, [a]),
|
|
385
|
+
config: l(() => ({
|
|
386
|
+
defaultWidth: t,
|
|
387
|
+
minWidth: n,
|
|
388
|
+
maxWidth: r,
|
|
389
|
+
overrides: { ...o }
|
|
390
|
+
}), [
|
|
391
|
+
t,
|
|
392
|
+
n,
|
|
393
|
+
r,
|
|
394
|
+
o
|
|
395
|
+
])
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/useCrossSwimlaneMove.ts
|
|
400
|
+
function F({ swimlanes: e, onCardMove: t }) {
|
|
401
|
+
let [n, r] = u(null), i = l(() => {
|
|
402
|
+
let t = /* @__PURE__ */ new Map();
|
|
403
|
+
for (let n of e) t.set(n.id, n);
|
|
404
|
+
return t;
|
|
405
|
+
}, [e]), a = s((e, t) => {
|
|
406
|
+
if (e === t) return !0;
|
|
407
|
+
let n = i.get(t);
|
|
408
|
+
return n ? n.acceptFrom ? n.acceptFrom.includes(e) : !0 : !1;
|
|
409
|
+
}, [i]), o = s((e, n, i, o) => a(n, i) ? (t?.({
|
|
410
|
+
cardId: e,
|
|
411
|
+
fromSwimlane: n,
|
|
412
|
+
toSwimlane: i,
|
|
413
|
+
columnId: o
|
|
414
|
+
}), r(null), !0) : !1, [a, t]), c = s((e) => {
|
|
415
|
+
r(e);
|
|
416
|
+
}, []), d = s(() => {
|
|
417
|
+
r(null);
|
|
418
|
+
}, []);
|
|
419
|
+
return {
|
|
420
|
+
handleCrossSwimlaneMove: o,
|
|
421
|
+
isDraggingAcrossSwimlanes: n !== null,
|
|
422
|
+
startCrossSwimlaneDrag: c,
|
|
423
|
+
endCrossSwimlaneDrag: d,
|
|
424
|
+
canMoveTo: a
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/useQuickAddReorder.ts
|
|
429
|
+
function I({ cards: e, onReorderComplete: t }) {
|
|
430
|
+
let [n, r] = u(e), [i, a] = u(!1);
|
|
431
|
+
!L(n, e) && !i && r(e);
|
|
432
|
+
let o = s(() => {
|
|
433
|
+
r(e), a(!1);
|
|
434
|
+
}, [e]);
|
|
435
|
+
return {
|
|
436
|
+
reorderedCards: n,
|
|
437
|
+
onReorder: s((e, t) => {
|
|
438
|
+
r((n) => {
|
|
439
|
+
if (e < 0 || t < 0 || e >= n.length || t >= n.length) return n;
|
|
440
|
+
let r = [...n], [i] = r.splice(e, 1);
|
|
441
|
+
return r.splice(t, 0, i), r;
|
|
442
|
+
});
|
|
443
|
+
}, []),
|
|
444
|
+
isDragging: i,
|
|
445
|
+
startDrag: s(() => {
|
|
446
|
+
a(!0);
|
|
447
|
+
}, []),
|
|
448
|
+
endDrag: s(() => {
|
|
449
|
+
a(!1), r((e) => (t?.(e), e));
|
|
450
|
+
}, [t]),
|
|
451
|
+
reset: o
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function L(e, t) {
|
|
455
|
+
if (e.length !== t.length) return !1;
|
|
456
|
+
for (let n = 0; n < e.length; n++) if (e[n].id !== t[n].id) return !1;
|
|
457
|
+
return !0;
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/index.tsx
|
|
461
|
+
var R = a.lazy(() => import("./KanbanImpl-ii52_k8g.js")), z = a.lazy(() => import("./KanbanEnhanced-CvxO2soF.js")), B = ({ schema: e }) => {
|
|
462
|
+
let t = a.useMemo(() => {
|
|
463
|
+
let { columns: t = [], data: n, groupBy: r, coverImageField: i } = e, a = (e) => {
|
|
464
|
+
if (!i) return e;
|
|
465
|
+
let t = e[i];
|
|
466
|
+
if (!t) return e;
|
|
467
|
+
let n = typeof t == "string" ? t : t?.url;
|
|
468
|
+
return n ? {
|
|
469
|
+
...e,
|
|
470
|
+
coverImage: n
|
|
471
|
+
} : e;
|
|
472
|
+
};
|
|
473
|
+
if (n && r && Array.isArray(n)) {
|
|
474
|
+
let e = {};
|
|
475
|
+
t.forEach((t) => {
|
|
476
|
+
t.id && (e[String(t.id).toLowerCase()] = t.id), t.title && (e[String(t.title).toLowerCase()] = t.id);
|
|
477
|
+
});
|
|
478
|
+
let i = n.reduce((t, n) => {
|
|
479
|
+
let i = String(n[r] ?? ""), o = e[i.toLowerCase()] ?? i;
|
|
480
|
+
return t[o] || (t[o] = []), t[o].push(a(n)), t;
|
|
481
|
+
}, {});
|
|
482
|
+
return t.map((e) => ({
|
|
483
|
+
...e,
|
|
484
|
+
cards: [...(e.cards || []).map(a), ...i[e.id] || []]
|
|
485
|
+
}));
|
|
486
|
+
}
|
|
487
|
+
return t.map((e) => ({
|
|
488
|
+
...e,
|
|
489
|
+
cards: (e.cards || []).map(a)
|
|
490
|
+
}));
|
|
491
|
+
}, [e]);
|
|
492
|
+
return /* @__PURE__ */ (0, x.jsx)(o, {
|
|
493
|
+
fallback: /* @__PURE__ */ (0, x.jsx)(b, { className: "w-full h-[600px]" }),
|
|
494
|
+
children: /* @__PURE__ */ (0, x.jsx)(R, {
|
|
495
|
+
columns: t,
|
|
496
|
+
onCardMove: e.onCardMove,
|
|
497
|
+
onCardClick: e.onCardClick,
|
|
498
|
+
className: e.className,
|
|
499
|
+
quickAdd: e.quickAdd,
|
|
500
|
+
onQuickAdd: e.onQuickAdd,
|
|
501
|
+
coverImageField: e.coverImageField,
|
|
502
|
+
conditionalFormatting: e.conditionalFormatting,
|
|
503
|
+
swimlaneField: e.swimlaneField
|
|
504
|
+
})
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
d.register("kanban-ui", B, {
|
|
508
|
+
namespace: "plugin-kanban",
|
|
509
|
+
label: "Kanban Board",
|
|
510
|
+
icon: "LayoutDashboard",
|
|
511
|
+
category: "plugin",
|
|
512
|
+
inputs: [
|
|
513
|
+
{
|
|
514
|
+
name: "columns",
|
|
515
|
+
type: "array",
|
|
516
|
+
label: "Columns",
|
|
517
|
+
description: "Array of { id, title, cards, limit, className }",
|
|
518
|
+
required: !0
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
name: "onCardMove",
|
|
522
|
+
type: "code",
|
|
523
|
+
label: "On Card Move",
|
|
524
|
+
description: "Callback when a card is moved",
|
|
525
|
+
advanced: !0
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
name: "className",
|
|
529
|
+
type: "string",
|
|
530
|
+
label: "CSS Class"
|
|
531
|
+
}
|
|
532
|
+
],
|
|
533
|
+
defaultProps: {
|
|
534
|
+
columns: [
|
|
535
|
+
{
|
|
536
|
+
id: "todo",
|
|
537
|
+
title: "To Do",
|
|
538
|
+
cards: [{
|
|
539
|
+
id: "card-1",
|
|
540
|
+
title: "Task 1",
|
|
541
|
+
description: "This is the first task",
|
|
542
|
+
badges: [{
|
|
543
|
+
label: "High Priority",
|
|
544
|
+
variant: "destructive"
|
|
545
|
+
}, {
|
|
546
|
+
label: "Feature",
|
|
547
|
+
variant: "default"
|
|
548
|
+
}]
|
|
549
|
+
}, {
|
|
550
|
+
id: "card-2",
|
|
551
|
+
title: "Task 2",
|
|
552
|
+
description: "This is the second task",
|
|
553
|
+
badges: [{
|
|
554
|
+
label: "Bug",
|
|
555
|
+
variant: "destructive"
|
|
556
|
+
}]
|
|
557
|
+
}]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: "in-progress",
|
|
561
|
+
title: "In Progress",
|
|
562
|
+
limit: 3,
|
|
563
|
+
cards: [{
|
|
564
|
+
id: "card-3",
|
|
565
|
+
title: "Task 3",
|
|
566
|
+
description: "Currently working on this",
|
|
567
|
+
badges: [{
|
|
568
|
+
label: "In Progress",
|
|
569
|
+
variant: "default"
|
|
570
|
+
}]
|
|
571
|
+
}]
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
id: "done",
|
|
575
|
+
title: "Done",
|
|
576
|
+
cards: [{
|
|
577
|
+
id: "card-4",
|
|
578
|
+
title: "Task 4",
|
|
579
|
+
description: "This task is completed",
|
|
580
|
+
badges: [{
|
|
581
|
+
label: "Completed",
|
|
582
|
+
variant: "outline"
|
|
583
|
+
}]
|
|
584
|
+
}, {
|
|
585
|
+
id: "card-5",
|
|
586
|
+
title: "Task 5",
|
|
587
|
+
description: "Another completed task",
|
|
588
|
+
badges: [{
|
|
589
|
+
label: "Completed",
|
|
590
|
+
variant: "outline"
|
|
591
|
+
}]
|
|
592
|
+
}]
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
className: "w-full"
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
var V = {
|
|
599
|
+
kanban: B,
|
|
600
|
+
"kanban-enhanced": z,
|
|
601
|
+
"object-kanban": S
|
|
602
|
+
};
|
|
603
|
+
d.register("kanban-enhanced", ({ schema: e }) => {
|
|
604
|
+
let t = a.useMemo(() => {
|
|
605
|
+
let { columns: t = [], data: n, groupBy: r } = e;
|
|
606
|
+
if (n && r && Array.isArray(n)) {
|
|
607
|
+
let e = n.reduce((e, t) => {
|
|
608
|
+
let n = t[r];
|
|
609
|
+
return e[n] || (e[n] = []), e[n].push(t), e;
|
|
610
|
+
}, {});
|
|
611
|
+
return t.map((t) => ({
|
|
612
|
+
...t,
|
|
613
|
+
cards: [...t.cards || [], ...e[t.id] || []]
|
|
614
|
+
}));
|
|
615
|
+
}
|
|
616
|
+
return t;
|
|
617
|
+
}, [e]);
|
|
618
|
+
return /* @__PURE__ */ (0, x.jsx)(o, {
|
|
619
|
+
fallback: /* @__PURE__ */ (0, x.jsx)(b, { className: "w-full h-[600px]" }),
|
|
620
|
+
children: /* @__PURE__ */ (0, x.jsx)(z, {
|
|
621
|
+
columns: t,
|
|
622
|
+
onCardMove: e.onCardMove,
|
|
623
|
+
onColumnToggle: e.onColumnToggle,
|
|
624
|
+
enableVirtualScrolling: e.enableVirtualScrolling,
|
|
625
|
+
virtualScrollThreshold: e.virtualScrollThreshold,
|
|
626
|
+
className: e.className,
|
|
627
|
+
quickAdd: e.quickAdd,
|
|
628
|
+
onQuickAdd: e.onQuickAdd,
|
|
629
|
+
conditionalFormatting: e.conditionalFormatting
|
|
630
|
+
})
|
|
631
|
+
});
|
|
632
|
+
}, {
|
|
633
|
+
namespace: "plugin-kanban",
|
|
634
|
+
label: "Kanban Board (Enhanced)",
|
|
635
|
+
icon: "LayoutGrid",
|
|
636
|
+
category: "plugin",
|
|
637
|
+
inputs: [
|
|
638
|
+
{
|
|
639
|
+
name: "columns",
|
|
640
|
+
type: "array",
|
|
641
|
+
label: "Columns",
|
|
642
|
+
required: !0
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: "enableVirtualScrolling",
|
|
646
|
+
type: "boolean",
|
|
647
|
+
label: "Virtual Scrolling",
|
|
648
|
+
defaultValue: !1
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "virtualScrollThreshold",
|
|
652
|
+
type: "number",
|
|
653
|
+
label: "Virtual Scroll Threshold",
|
|
654
|
+
defaultValue: 50
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: "onCardMove",
|
|
658
|
+
type: "code",
|
|
659
|
+
label: "On Card Move",
|
|
660
|
+
advanced: !0
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
name: "onColumnToggle",
|
|
664
|
+
type: "code",
|
|
665
|
+
label: "On Column Toggle",
|
|
666
|
+
advanced: !0
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
name: "className",
|
|
670
|
+
type: "string",
|
|
671
|
+
label: "CSS Class"
|
|
672
|
+
}
|
|
673
|
+
],
|
|
674
|
+
defaultProps: {
|
|
675
|
+
columns: [],
|
|
676
|
+
enableVirtualScrolling: !1,
|
|
677
|
+
virtualScrollThreshold: 50,
|
|
678
|
+
className: "w-full"
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
var H = ({ schema: e, ...t }) => {
|
|
682
|
+
let { dataSource: n } = g() || {};
|
|
683
|
+
return /* @__PURE__ */ (0, x.jsx)(S, {
|
|
684
|
+
schema: e,
|
|
685
|
+
dataSource: n,
|
|
686
|
+
...t
|
|
687
|
+
});
|
|
688
|
+
};
|
|
689
|
+
d.register("object-kanban", H, {
|
|
690
|
+
namespace: "plugin-kanban",
|
|
691
|
+
label: "Object Kanban",
|
|
692
|
+
category: "view",
|
|
693
|
+
inputs: [{
|
|
694
|
+
name: "objectName",
|
|
695
|
+
type: "string",
|
|
696
|
+
label: "Object Name",
|
|
697
|
+
required: !0
|
|
698
|
+
}, {
|
|
699
|
+
name: "columns",
|
|
700
|
+
type: "array",
|
|
701
|
+
label: "Columns"
|
|
702
|
+
}]
|
|
703
|
+
}), d.register("kanban", H, {
|
|
704
|
+
namespace: "view",
|
|
705
|
+
label: "Kanban Board",
|
|
706
|
+
category: "view",
|
|
707
|
+
inputs: [{
|
|
708
|
+
name: "objectName",
|
|
709
|
+
type: "string",
|
|
710
|
+
label: "Object Name",
|
|
711
|
+
required: !0
|
|
712
|
+
}, {
|
|
713
|
+
name: "columns",
|
|
714
|
+
type: "array",
|
|
715
|
+
label: "Columns"
|
|
716
|
+
}]
|
|
717
|
+
});
|
|
718
|
+
//#endregion
|
|
719
|
+
export { A as CardTemplates, D as InlineQuickAdd, B as KanbanRenderer, S as ObjectKanban, H as ObjectKanbanRenderer, V as kanbanComponents, P as useColumnWidths, F as useCrossSwimlaneMove, I as useQuickAddReorder };
|