@burdenoff/microfe-planmagnet 2026.930.7 → 2026.930.8
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/planmagnet/board/BoardViewBar.d.ts +27 -0
- package/dist/planmagnet/board/BoardViewBar.d.ts.map +1 -0
- package/dist/planmagnet/board/BoardViewBar.js +684 -0
- package/dist/planmagnet/board/BoardViewBar.js.map +1 -0
- package/dist/planmagnet/board/ProjectBoard.d.ts.map +1 -1
- package/dist/planmagnet/board/ProjectBoard.js +440 -345
- package/dist/planmagnet/board/ProjectBoard.js.map +1 -1
- package/dist/planmagnet/board/boardViewConfig.d.ts +144 -0
- package/dist/planmagnet/board/boardViewConfig.d.ts.map +1 -0
- package/dist/planmagnet/board/boardViewConfig.js +265 -0
- package/dist/planmagnet/board/boardViewConfig.js.map +1 -0
- package/dist/planmagnet/controls/ConfirmButton.d.ts +3 -1
- package/dist/planmagnet/controls/ConfirmButton.d.ts.map +1 -1
- package/dist/planmagnet/controls/ConfirmButton.js +2 -1
- package/dist/planmagnet/controls/ConfirmButton.js.map +1 -1
- package/dist/planmagnet/milestones/MilestoneControls.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
import { usePlanMagnet as e } from "../providers/PlanMagnetProvider.js";
|
|
2
|
+
import { PersonName as t } from "../people/People.js";
|
|
3
|
+
import { throwOnError as n } from "../utils/mutationResult.js";
|
|
4
|
+
import { ConfirmButton as r, ErrorLine as i } from "../controls/ConfirmButton.js";
|
|
5
|
+
import { WORK_ITEM_PRIORITIES as a, enumLabel as o, useAssigneeOptions as s } from "../controls/WorkItemControls.js";
|
|
6
|
+
import { CREATE_BOARD_VIEW as c, DEFAULT_VISIBLE_FIELDS as l, DELETE_BOARD_VIEW as u, GROUP_BY_OPTIONS as d, SORT_FIELD_OPTIONS as f, UPDATE_BOARD_VIEW as p, VIEW_REFETCH as m, VISIBLE_FIELD_OPTIONS as h, WORK_ITEM_TYPES as g, configFromView as _, configToInput as ee, configsEqual as v, defaultConfig as y, emptyFilter as te, filterToGraphQLInput as b, isFilterActive as x, readViewIdFromUrl as ne, useBoardViews as re, writeViewIdToUrl as ie } from "./boardViewConfig.js";
|
|
7
|
+
import { useDeferredValue as ae, useEffect as oe, useState as S } from "react";
|
|
8
|
+
import { Pencil as se, Save as ce, Share2 as le, Trash2 as ue, X as de } from "lucide-react";
|
|
9
|
+
import { useMutation as C } from "@apollo/client/react";
|
|
10
|
+
import { Fragment as fe, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
11
|
+
import { Badge as pe, Button as E, Checkbox as D, Input as O, ResponsiveDialog as k, ResponsiveDialogContent as A, ResponsiveDialogDescription as me, ResponsiveDialogFooter as j, ResponsiveDialogHeader as M, ResponsiveDialogTitle as N, ResponsiveDialogTrigger as P } from "@burdenoff/fe-libs/ui";
|
|
12
|
+
//#region src/planmagnet/board/BoardViewBar.tsx
|
|
13
|
+
function he(e) {
|
|
14
|
+
return {
|
|
15
|
+
filter: b(e.filter),
|
|
16
|
+
sort: {
|
|
17
|
+
field: e.sort.field,
|
|
18
|
+
direction: e.sort.direction
|
|
19
|
+
},
|
|
20
|
+
groupBy: e.groupBy,
|
|
21
|
+
visibleFields: e.visibleFields.length > 0 ? e.visibleFields : l,
|
|
22
|
+
filterActive: x(e.filter)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
var F = "rounded-md border border-input bg-background px-2 py-1 text-sm disabled:opacity-60", I = "text-xs font-medium text-muted-foreground";
|
|
26
|
+
function L(e, t) {
|
|
27
|
+
return e instanceof Error ? e.message : t;
|
|
28
|
+
}
|
|
29
|
+
function R({ projectId: b, boardId: se, onSelectBoard: k, sprintOptions: A, milestoneOptions: me, onStateChange: j }) {
|
|
30
|
+
let { workspaceId: M } = e(), { views: N, loading: P, error: R } = re(M, b), [z, B] = S(() => ne()), [ve, ye] = S(!1), [V, H] = S(y), [be, U] = S(""), [xe, Se] = S(null), [Ce, W] = S(null), G = z ? N.find((e) => e.id === z) ?? null : null;
|
|
31
|
+
if (!ve && !P && (ye(!0), z)) {
|
|
32
|
+
let e = N.find((e) => e.id === z);
|
|
33
|
+
e ? H(_(e)) : (B(null), ie(null), Se("That view is no longer available — showing all cards."));
|
|
34
|
+
}
|
|
35
|
+
let we = ae(V);
|
|
36
|
+
oe(() => {
|
|
37
|
+
j(he(we));
|
|
38
|
+
}, [we, j]);
|
|
39
|
+
let K = G?.boardId ?? null;
|
|
40
|
+
oe(() => {
|
|
41
|
+
K && k(K);
|
|
42
|
+
}, [K, k]);
|
|
43
|
+
let q = (e) => {
|
|
44
|
+
W(null), Se(null), B(e?.id ?? null), ie(e?.id ?? null), H(e ? _(e) : y());
|
|
45
|
+
}, J = (e) => H((t) => ({
|
|
46
|
+
...t,
|
|
47
|
+
filter: {
|
|
48
|
+
...t.filter,
|
|
49
|
+
...e
|
|
50
|
+
}
|
|
51
|
+
})), Y = (e, t) => H((n) => {
|
|
52
|
+
let r = n.filter[e], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t];
|
|
53
|
+
return {
|
|
54
|
+
...n,
|
|
55
|
+
filter: {
|
|
56
|
+
...n.filter,
|
|
57
|
+
[e]: i
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}), Te = () => {
|
|
61
|
+
let e = be.trim();
|
|
62
|
+
e && (U(""), V.filter.labels.includes(e) || J({ labels: [...V.filter.labels, e] }));
|
|
63
|
+
}, Ee = (e) => J({ labels: V.filter.labels.filter((t) => t !== e) }), De = () => {
|
|
64
|
+
J(te()), U("");
|
|
65
|
+
}, { options: Oe, hasMore: ke, fetchMore: Ae } = s(null), [je, Me] = C(c, {
|
|
66
|
+
refetchQueries: m,
|
|
67
|
+
awaitRefetchQueries: !0
|
|
68
|
+
}), [X, Z] = C(p, {
|
|
69
|
+
refetchQueries: m,
|
|
70
|
+
awaitRefetchQueries: !0
|
|
71
|
+
}), [Ne, Pe] = C(u, {
|
|
72
|
+
refetchQueries: m,
|
|
73
|
+
awaitRefetchQueries: !0
|
|
74
|
+
}), Fe = async () => {
|
|
75
|
+
if (G) {
|
|
76
|
+
W(null);
|
|
77
|
+
try {
|
|
78
|
+
await n(X({ variables: {
|
|
79
|
+
id: G.id,
|
|
80
|
+
input: { config: ee(V) }
|
|
81
|
+
} }));
|
|
82
|
+
} catch (e) {
|
|
83
|
+
W(L(e, "The view could not be updated."));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, Ie = async () => {
|
|
87
|
+
if (!G) return;
|
|
88
|
+
W(null);
|
|
89
|
+
let e = G.visibility === "SHARED" ? "PRIVATE" : "SHARED";
|
|
90
|
+
try {
|
|
91
|
+
await n(X({ variables: {
|
|
92
|
+
id: G.id,
|
|
93
|
+
input: { visibility: e }
|
|
94
|
+
} }));
|
|
95
|
+
} catch (e) {
|
|
96
|
+
W(L(e, "The view could not be shared."));
|
|
97
|
+
}
|
|
98
|
+
}, Le = async () => {
|
|
99
|
+
if (G) {
|
|
100
|
+
W(null);
|
|
101
|
+
try {
|
|
102
|
+
await n(Ne({ variables: { id: G.id } })), q(null);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
W(L(e, "The view could not be deleted."));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, Re = N.filter((e) => e.isMine).sort((e, t) => e.name.localeCompare(t.name)), Q = N.filter((e) => !e.isMine).sort((e, t) => e.name.localeCompare(t.name)), ze = G ? !v(V, _(G)) : x(V.filter), $ = Me.loading || Z.loading || Pe.loading;
|
|
108
|
+
return /* @__PURE__ */ T("div", {
|
|
109
|
+
className: "space-y-3 rounded-md border bg-muted/20 p-3",
|
|
110
|
+
"data-testid": "board-view-bar",
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ T("div", {
|
|
113
|
+
className: "flex flex-wrap items-center gap-2",
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ w("label", {
|
|
116
|
+
className: "flex items-center gap-1.5 text-sm",
|
|
117
|
+
htmlFor: "board-view-select",
|
|
118
|
+
children: /* @__PURE__ */ w("span", {
|
|
119
|
+
className: "text-muted-foreground",
|
|
120
|
+
children: "View"
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ T("select", {
|
|
124
|
+
id: "board-view-select",
|
|
125
|
+
"data-testid": "board-view-select",
|
|
126
|
+
className: F,
|
|
127
|
+
value: z ?? "",
|
|
128
|
+
onChange: (e) => q(N.find((t) => t.id === e.target.value) ?? null),
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ w("option", {
|
|
131
|
+
value: "",
|
|
132
|
+
children: "All cards"
|
|
133
|
+
}),
|
|
134
|
+
Re.length > 0 && /* @__PURE__ */ w("optgroup", {
|
|
135
|
+
label: "My views",
|
|
136
|
+
children: Re.map((e) => /* @__PURE__ */ w("option", {
|
|
137
|
+
value: e.id,
|
|
138
|
+
children: e.name
|
|
139
|
+
}, e.id))
|
|
140
|
+
}),
|
|
141
|
+
Q.length > 0 && /* @__PURE__ */ w("optgroup", {
|
|
142
|
+
label: "Shared views",
|
|
143
|
+
children: Q.map((e) => /* @__PURE__ */ w("option", {
|
|
144
|
+
value: e.id,
|
|
145
|
+
children: e.name
|
|
146
|
+
}, e.id))
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
}),
|
|
150
|
+
P && /* @__PURE__ */ w("span", {
|
|
151
|
+
className: "text-xs text-muted-foreground",
|
|
152
|
+
children: "Loading views…"
|
|
153
|
+
}),
|
|
154
|
+
G && !G.isMine && /* @__PURE__ */ T("span", {
|
|
155
|
+
className: "text-xs text-muted-foreground",
|
|
156
|
+
children: [
|
|
157
|
+
"Shared by ",
|
|
158
|
+
/* @__PURE__ */ w(t, { id: G.ownerId }),
|
|
159
|
+
" — read-only"
|
|
160
|
+
]
|
|
161
|
+
}),
|
|
162
|
+
ze && G?.isMine && /* @__PURE__ */ w("span", {
|
|
163
|
+
className: "text-xs text-muted-foreground",
|
|
164
|
+
children: "(unsaved changes)"
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ T("div", {
|
|
167
|
+
className: "ml-auto flex flex-wrap items-center gap-2",
|
|
168
|
+
children: [/* @__PURE__ */ w(ge, {
|
|
169
|
+
projectId: b,
|
|
170
|
+
boardId: se,
|
|
171
|
+
config: V,
|
|
172
|
+
initial: G && !G.isMine ? {
|
|
173
|
+
name: `${G.name} (copy)`,
|
|
174
|
+
description: G.description
|
|
175
|
+
} : null,
|
|
176
|
+
createView: je,
|
|
177
|
+
creating: Me.loading,
|
|
178
|
+
onSaved: (e) => q(e),
|
|
179
|
+
onError: W
|
|
180
|
+
}), G?.isMine && /* @__PURE__ */ T(fe, { children: [
|
|
181
|
+
/* @__PURE__ */ T(E, {
|
|
182
|
+
size: "sm",
|
|
183
|
+
variant: "outline",
|
|
184
|
+
"data-testid": "board-view-update",
|
|
185
|
+
disabled: $,
|
|
186
|
+
onClick: () => void Fe(),
|
|
187
|
+
children: [/* @__PURE__ */ w(ce, { className: "mr-1 h-4 w-4" }), Z.loading ? "Saving…" : "Update view"]
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ w(_e, {
|
|
190
|
+
view: G,
|
|
191
|
+
updateView: X,
|
|
192
|
+
busy: Z.loading,
|
|
193
|
+
onError: W
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ T(E, {
|
|
196
|
+
size: "sm",
|
|
197
|
+
variant: "outline",
|
|
198
|
+
"data-testid": "board-view-share",
|
|
199
|
+
disabled: $,
|
|
200
|
+
onClick: () => void Ie(),
|
|
201
|
+
children: [/* @__PURE__ */ w(le, { className: "mr-1 h-4 w-4" }), G.visibility === "SHARED" ? "Unshare" : "Share"]
|
|
202
|
+
}),
|
|
203
|
+
/* @__PURE__ */ w(r, {
|
|
204
|
+
label: "Delete",
|
|
205
|
+
variant: "outline",
|
|
206
|
+
icon: /* @__PURE__ */ w(ue, { className: "mr-1 h-4 w-4" }),
|
|
207
|
+
title: `Delete "${G.name}"?`,
|
|
208
|
+
description: "This view is deleted for everyone it was shared with. The work items it filters are not affected.",
|
|
209
|
+
confirmLabel: "Delete view",
|
|
210
|
+
destructive: !0,
|
|
211
|
+
disabled: $,
|
|
212
|
+
onConfirm: () => void Le(),
|
|
213
|
+
testId: "board-view-delete"
|
|
214
|
+
})
|
|
215
|
+
] })]
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
}),
|
|
219
|
+
xe && /* @__PURE__ */ w("p", {
|
|
220
|
+
className: "text-xs text-muted-foreground",
|
|
221
|
+
role: "status",
|
|
222
|
+
children: xe
|
|
223
|
+
}),
|
|
224
|
+
R && /* @__PURE__ */ w(i, { message: `Views could not be loaded: ${R}` }),
|
|
225
|
+
Ce && /* @__PURE__ */ w(i, { message: Ce }),
|
|
226
|
+
/* @__PURE__ */ T("div", {
|
|
227
|
+
className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4",
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ T("div", {
|
|
230
|
+
className: "lg:col-span-2",
|
|
231
|
+
children: [/* @__PURE__ */ w("label", {
|
|
232
|
+
className: I,
|
|
233
|
+
htmlFor: "board-filter-search-input",
|
|
234
|
+
children: "Search"
|
|
235
|
+
}), /* @__PURE__ */ w(O, {
|
|
236
|
+
id: "board-filter-search-input",
|
|
237
|
+
"data-testid": "board-filter-search",
|
|
238
|
+
className: "mt-1",
|
|
239
|
+
placeholder: "Search by key or title",
|
|
240
|
+
value: V.filter.search,
|
|
241
|
+
onChange: (e) => J({ search: e.target.value })
|
|
242
|
+
})]
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ T("fieldset", {
|
|
245
|
+
className: "min-w-0",
|
|
246
|
+
"data-testid": "board-filter-assignee",
|
|
247
|
+
children: [/* @__PURE__ */ w("legend", {
|
|
248
|
+
className: I,
|
|
249
|
+
children: "Assignee"
|
|
250
|
+
}), /* @__PURE__ */ T("div", {
|
|
251
|
+
className: "mt-1 max-h-28 space-y-1 overflow-y-auto rounded-md border p-1.5",
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ T("label", {
|
|
254
|
+
className: "flex items-center gap-1.5 text-xs",
|
|
255
|
+
children: [/* @__PURE__ */ w(D, {
|
|
256
|
+
checked: V.filter.unassigned,
|
|
257
|
+
onCheckedChange: (e) => J({ unassigned: e === !0 })
|
|
258
|
+
}), "Unassigned"]
|
|
259
|
+
}),
|
|
260
|
+
Oe.map((e) => /* @__PURE__ */ T("label", {
|
|
261
|
+
className: "flex items-center gap-1.5 text-xs",
|
|
262
|
+
children: [/* @__PURE__ */ w(D, {
|
|
263
|
+
checked: V.filter.assigneeIds.includes(e.id),
|
|
264
|
+
onCheckedChange: () => Y("assigneeIds", e.id)
|
|
265
|
+
}), /* @__PURE__ */ w("span", {
|
|
266
|
+
className: "truncate",
|
|
267
|
+
children: e.name
|
|
268
|
+
})]
|
|
269
|
+
}, e.id)),
|
|
270
|
+
ke && /* @__PURE__ */ w("button", {
|
|
271
|
+
type: "button",
|
|
272
|
+
className: "text-xs text-primary hover:underline",
|
|
273
|
+
onClick: Ae,
|
|
274
|
+
children: "Show more members"
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})]
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ T("fieldset", {
|
|
280
|
+
className: "min-w-0",
|
|
281
|
+
"data-testid": "board-filter-type",
|
|
282
|
+
children: [/* @__PURE__ */ w("legend", {
|
|
283
|
+
className: I,
|
|
284
|
+
children: "Type"
|
|
285
|
+
}), /* @__PURE__ */ w("div", {
|
|
286
|
+
className: "mt-1 space-y-1 rounded-md border p-1.5",
|
|
287
|
+
children: g.map((e) => /* @__PURE__ */ T("label", {
|
|
288
|
+
className: "flex items-center gap-1.5 text-xs",
|
|
289
|
+
children: [/* @__PURE__ */ w(D, {
|
|
290
|
+
checked: V.filter.types.includes(e),
|
|
291
|
+
onCheckedChange: () => Y("types", e)
|
|
292
|
+
}), o(e)]
|
|
293
|
+
}, e))
|
|
294
|
+
})]
|
|
295
|
+
}),
|
|
296
|
+
/* @__PURE__ */ T("fieldset", {
|
|
297
|
+
className: "min-w-0",
|
|
298
|
+
"data-testid": "board-filter-priority",
|
|
299
|
+
children: [/* @__PURE__ */ w("legend", {
|
|
300
|
+
className: I,
|
|
301
|
+
children: "Priority"
|
|
302
|
+
}), /* @__PURE__ */ w("div", {
|
|
303
|
+
className: "mt-1 space-y-1 rounded-md border p-1.5",
|
|
304
|
+
children: a.map((e) => /* @__PURE__ */ T("label", {
|
|
305
|
+
className: "flex items-center gap-1.5 text-xs",
|
|
306
|
+
children: [/* @__PURE__ */ w(D, {
|
|
307
|
+
checked: V.filter.priorities.includes(e),
|
|
308
|
+
onCheckedChange: () => Y("priorities", e)
|
|
309
|
+
}), o(e)]
|
|
310
|
+
}, e))
|
|
311
|
+
})]
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ T("div", {
|
|
314
|
+
className: "min-w-0 lg:col-span-2",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ w("label", {
|
|
317
|
+
className: I,
|
|
318
|
+
htmlFor: "board-filter-label-input",
|
|
319
|
+
children: "Labels"
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ w(O, {
|
|
322
|
+
id: "board-filter-label-input",
|
|
323
|
+
"data-testid": "board-filter-label",
|
|
324
|
+
className: "mt-1",
|
|
325
|
+
placeholder: "Type a label, press Enter",
|
|
326
|
+
value: be,
|
|
327
|
+
onChange: (e) => U(e.target.value),
|
|
328
|
+
onKeyDown: (e) => {
|
|
329
|
+
(e.key === "Enter" || e.key === ",") && (e.preventDefault(), Te());
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
V.filter.labels.length > 0 && /* @__PURE__ */ w("div", {
|
|
333
|
+
className: "mt-1 flex flex-wrap gap-1",
|
|
334
|
+
children: V.filter.labels.map((e) => /* @__PURE__ */ T(pe, {
|
|
335
|
+
variant: "secondary",
|
|
336
|
+
className: "gap-1",
|
|
337
|
+
children: [e, /* @__PURE__ */ w("button", {
|
|
338
|
+
type: "button",
|
|
339
|
+
"aria-label": `Remove label ${e}`,
|
|
340
|
+
onClick: () => Ee(e),
|
|
341
|
+
children: /* @__PURE__ */ w(de, { className: "h-3 w-3" })
|
|
342
|
+
})]
|
|
343
|
+
}, e))
|
|
344
|
+
})
|
|
345
|
+
]
|
|
346
|
+
}),
|
|
347
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
348
|
+
className: I,
|
|
349
|
+
htmlFor: "board-filter-sprint",
|
|
350
|
+
children: "Sprint"
|
|
351
|
+
}), /* @__PURE__ */ T("select", {
|
|
352
|
+
id: "board-filter-sprint",
|
|
353
|
+
"data-testid": "board-filter-sprint",
|
|
354
|
+
className: `${F} mt-1 w-full`,
|
|
355
|
+
value: V.filter.sprintId,
|
|
356
|
+
onChange: (e) => J({ sprintId: e.target.value }),
|
|
357
|
+
children: [/* @__PURE__ */ w("option", {
|
|
358
|
+
value: "",
|
|
359
|
+
children: "Any sprint"
|
|
360
|
+
}), A.map((e) => /* @__PURE__ */ w("option", {
|
|
361
|
+
value: e.id,
|
|
362
|
+
children: e.name
|
|
363
|
+
}, e.id))]
|
|
364
|
+
})] }),
|
|
365
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
366
|
+
className: I,
|
|
367
|
+
htmlFor: "board-filter-milestone",
|
|
368
|
+
children: "Milestone"
|
|
369
|
+
}), /* @__PURE__ */ T("select", {
|
|
370
|
+
id: "board-filter-milestone",
|
|
371
|
+
"data-testid": "board-filter-milestone",
|
|
372
|
+
className: `${F} mt-1 w-full`,
|
|
373
|
+
value: V.filter.milestoneId,
|
|
374
|
+
onChange: (e) => J({ milestoneId: e.target.value }),
|
|
375
|
+
children: [/* @__PURE__ */ w("option", {
|
|
376
|
+
value: "",
|
|
377
|
+
children: "Any milestone"
|
|
378
|
+
}), me.map((e) => /* @__PURE__ */ w("option", {
|
|
379
|
+
value: e.id,
|
|
380
|
+
children: e.name
|
|
381
|
+
}, e.id))]
|
|
382
|
+
})] }),
|
|
383
|
+
/* @__PURE__ */ T("div", {
|
|
384
|
+
className: "flex gap-2",
|
|
385
|
+
children: [/* @__PURE__ */ T("div", {
|
|
386
|
+
className: "min-w-0 flex-1",
|
|
387
|
+
children: [/* @__PURE__ */ w("label", {
|
|
388
|
+
className: I,
|
|
389
|
+
htmlFor: "board-filter-due-from",
|
|
390
|
+
children: "Due from"
|
|
391
|
+
}), /* @__PURE__ */ w("input", {
|
|
392
|
+
id: "board-filter-due-from",
|
|
393
|
+
"data-testid": "board-filter-due-from",
|
|
394
|
+
type: "date",
|
|
395
|
+
className: `${F} mt-1 w-full`,
|
|
396
|
+
value: V.filter.dueFrom,
|
|
397
|
+
onChange: (e) => J({ dueFrom: e.target.value })
|
|
398
|
+
})]
|
|
399
|
+
}), /* @__PURE__ */ T("div", {
|
|
400
|
+
className: "min-w-0 flex-1",
|
|
401
|
+
children: [/* @__PURE__ */ w("label", {
|
|
402
|
+
className: I,
|
|
403
|
+
htmlFor: "board-filter-due-to",
|
|
404
|
+
children: "Due to"
|
|
405
|
+
}), /* @__PURE__ */ w("input", {
|
|
406
|
+
id: "board-filter-due-to",
|
|
407
|
+
"data-testid": "board-filter-due-to",
|
|
408
|
+
type: "date",
|
|
409
|
+
className: `${F} mt-1 w-full`,
|
|
410
|
+
value: V.filter.dueTo,
|
|
411
|
+
onChange: (e) => J({ dueTo: e.target.value })
|
|
412
|
+
})]
|
|
413
|
+
})]
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ w("div", {
|
|
416
|
+
className: "flex items-end",
|
|
417
|
+
children: /* @__PURE__ */ w(E, {
|
|
418
|
+
size: "sm",
|
|
419
|
+
variant: "ghost",
|
|
420
|
+
"data-testid": "board-filter-clear",
|
|
421
|
+
disabled: !x(V.filter),
|
|
422
|
+
onClick: De,
|
|
423
|
+
children: "Clear filters"
|
|
424
|
+
})
|
|
425
|
+
})
|
|
426
|
+
]
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ T("div", {
|
|
429
|
+
className: "flex flex-wrap items-center gap-4 border-t pt-3",
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ T("label", {
|
|
432
|
+
className: "flex items-center gap-1.5 text-sm",
|
|
433
|
+
children: [/* @__PURE__ */ w("span", {
|
|
434
|
+
className: "text-muted-foreground",
|
|
435
|
+
children: "Group by"
|
|
436
|
+
}), /* @__PURE__ */ w("select", {
|
|
437
|
+
"aria-label": "Group by",
|
|
438
|
+
"data-testid": "board-groupby",
|
|
439
|
+
className: F,
|
|
440
|
+
value: V.groupBy,
|
|
441
|
+
onChange: (e) => H((t) => ({
|
|
442
|
+
...t,
|
|
443
|
+
groupBy: e.target.value
|
|
444
|
+
})),
|
|
445
|
+
children: d.map((e) => /* @__PURE__ */ w("option", {
|
|
446
|
+
value: e.value,
|
|
447
|
+
children: e.label
|
|
448
|
+
}, e.value))
|
|
449
|
+
})]
|
|
450
|
+
}),
|
|
451
|
+
/* @__PURE__ */ T("div", {
|
|
452
|
+
className: "flex items-center gap-1.5",
|
|
453
|
+
"data-testid": "board-sort",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ w("span", {
|
|
456
|
+
className: "text-sm text-muted-foreground",
|
|
457
|
+
children: "Sort by"
|
|
458
|
+
}),
|
|
459
|
+
/* @__PURE__ */ w("select", {
|
|
460
|
+
"aria-label": "Sort field",
|
|
461
|
+
className: F,
|
|
462
|
+
value: V.sort.field,
|
|
463
|
+
onChange: (e) => H((t) => ({
|
|
464
|
+
...t,
|
|
465
|
+
sort: {
|
|
466
|
+
...t.sort,
|
|
467
|
+
field: e.target.value
|
|
468
|
+
}
|
|
469
|
+
})),
|
|
470
|
+
children: f.map((e) => /* @__PURE__ */ w("option", {
|
|
471
|
+
value: e.value,
|
|
472
|
+
children: e.label
|
|
473
|
+
}, e.value))
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ T("select", {
|
|
476
|
+
"aria-label": "Sort direction",
|
|
477
|
+
className: F,
|
|
478
|
+
value: V.sort.direction,
|
|
479
|
+
onChange: (e) => H((t) => ({
|
|
480
|
+
...t,
|
|
481
|
+
sort: {
|
|
482
|
+
...t.sort,
|
|
483
|
+
direction: e.target.value
|
|
484
|
+
}
|
|
485
|
+
})),
|
|
486
|
+
children: [/* @__PURE__ */ w("option", {
|
|
487
|
+
value: "ASC",
|
|
488
|
+
children: "Ascending"
|
|
489
|
+
}), /* @__PURE__ */ w("option", {
|
|
490
|
+
value: "DESC",
|
|
491
|
+
children: "Descending"
|
|
492
|
+
})]
|
|
493
|
+
})
|
|
494
|
+
]
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ T("fieldset", {
|
|
497
|
+
className: "flex flex-wrap items-center gap-2",
|
|
498
|
+
"data-testid": "board-fields",
|
|
499
|
+
children: [/* @__PURE__ */ w("legend", {
|
|
500
|
+
className: "text-sm text-muted-foreground",
|
|
501
|
+
children: "Fields"
|
|
502
|
+
}), h.map((e) => /* @__PURE__ */ T("label", {
|
|
503
|
+
className: "flex items-center gap-1 text-xs",
|
|
504
|
+
children: [/* @__PURE__ */ w(D, {
|
|
505
|
+
checked: V.visibleFields.length > 0 ? V.visibleFields.includes(e.value) : l.includes(e.value),
|
|
506
|
+
onCheckedChange: () => H((t) => {
|
|
507
|
+
let n = t.visibleFields.length > 0 ? t.visibleFields : [...l], r = n.includes(e.value) ? n.filter((t) => t !== e.value) : [...n, e.value];
|
|
508
|
+
return {
|
|
509
|
+
...t,
|
|
510
|
+
visibleFields: r
|
|
511
|
+
};
|
|
512
|
+
})
|
|
513
|
+
}), e.label]
|
|
514
|
+
}, e.value))]
|
|
515
|
+
})
|
|
516
|
+
]
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function ge({ projectId: e, boardId: t, config: r, initial: a, createView: o, creating: s, onSaved: c, onError: l }) {
|
|
522
|
+
let [u, d] = S(!1), [f, p] = S(""), [m, h] = S(""), [g, _] = S("PRIVATE"), [v, y] = S(null), te = () => {
|
|
523
|
+
p(a?.name ?? ""), h(a?.description ?? ""), _("PRIVATE"), y(null);
|
|
524
|
+
}, b = async () => {
|
|
525
|
+
y(null);
|
|
526
|
+
try {
|
|
527
|
+
let i = (await n(o({ variables: { input: {
|
|
528
|
+
projectId: e,
|
|
529
|
+
boardId: t,
|
|
530
|
+
name: f.trim(),
|
|
531
|
+
description: m.trim() || null,
|
|
532
|
+
visibility: g,
|
|
533
|
+
config: ee(r)
|
|
534
|
+
} } }))).data?.planmagnetCreateBoardView;
|
|
535
|
+
d(!1), i && c(i);
|
|
536
|
+
} catch (e) {
|
|
537
|
+
let t = L(e, "The view could not be saved.");
|
|
538
|
+
y(t), l(t);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
return /* @__PURE__ */ T(k, {
|
|
542
|
+
open: u,
|
|
543
|
+
onOpenChange: (e) => {
|
|
544
|
+
d(e), e && te();
|
|
545
|
+
},
|
|
546
|
+
children: [/* @__PURE__ */ w(P, {
|
|
547
|
+
asChild: !0,
|
|
548
|
+
children: /* @__PURE__ */ T(E, {
|
|
549
|
+
size: "sm",
|
|
550
|
+
"data-testid": "board-view-save",
|
|
551
|
+
children: [/* @__PURE__ */ w(ce, { className: "mr-1 h-4 w-4" }), a ? "Save as my view" : "Save view"]
|
|
552
|
+
})
|
|
553
|
+
}), /* @__PURE__ */ T(A, {
|
|
554
|
+
className: "max-w-md",
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ T(M, { children: [/* @__PURE__ */ w(N, { children: a ? "Save as my view" : "Save view" }), /* @__PURE__ */ w(me, { children: "Saves the current filter, group-by, sort and fields as a new view over this board." })] }),
|
|
557
|
+
/* @__PURE__ */ T("div", {
|
|
558
|
+
className: "space-y-3",
|
|
559
|
+
children: [
|
|
560
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
561
|
+
htmlFor: "save-view-name",
|
|
562
|
+
className: "text-sm font-medium",
|
|
563
|
+
children: "Name"
|
|
564
|
+
}), /* @__PURE__ */ w(O, {
|
|
565
|
+
id: "save-view-name",
|
|
566
|
+
className: "mt-1",
|
|
567
|
+
value: f,
|
|
568
|
+
onChange: (e) => p(e.target.value)
|
|
569
|
+
})] }),
|
|
570
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
571
|
+
htmlFor: "save-view-description",
|
|
572
|
+
className: "text-sm font-medium",
|
|
573
|
+
children: "Description (optional)"
|
|
574
|
+
}), /* @__PURE__ */ w(O, {
|
|
575
|
+
id: "save-view-description",
|
|
576
|
+
className: "mt-1",
|
|
577
|
+
value: m,
|
|
578
|
+
onChange: (e) => h(e.target.value)
|
|
579
|
+
})] }),
|
|
580
|
+
/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("span", {
|
|
581
|
+
className: "text-sm font-medium",
|
|
582
|
+
children: "Visibility"
|
|
583
|
+
}), /* @__PURE__ */ T("div", {
|
|
584
|
+
className: "mt-1 flex gap-4 text-sm",
|
|
585
|
+
children: [/* @__PURE__ */ T("label", {
|
|
586
|
+
className: "flex items-center gap-1.5",
|
|
587
|
+
children: [/* @__PURE__ */ w("input", {
|
|
588
|
+
type: "radio",
|
|
589
|
+
name: "save-view-visibility",
|
|
590
|
+
checked: g === "PRIVATE",
|
|
591
|
+
onChange: () => _("PRIVATE")
|
|
592
|
+
}), "Private — only me"]
|
|
593
|
+
}), /* @__PURE__ */ T("label", {
|
|
594
|
+
className: "flex items-center gap-1.5",
|
|
595
|
+
children: [/* @__PURE__ */ w("input", {
|
|
596
|
+
type: "radio",
|
|
597
|
+
name: "save-view-visibility",
|
|
598
|
+
checked: g === "SHARED",
|
|
599
|
+
onChange: () => _("SHARED")
|
|
600
|
+
}), "Shared — everyone who can read this board"]
|
|
601
|
+
})]
|
|
602
|
+
})] })
|
|
603
|
+
]
|
|
604
|
+
}),
|
|
605
|
+
v && /* @__PURE__ */ w(i, { message: v }),
|
|
606
|
+
/* @__PURE__ */ w(j, { children: /* @__PURE__ */ w(E, {
|
|
607
|
+
onClick: () => void b(),
|
|
608
|
+
disabled: f.trim() === "" || s,
|
|
609
|
+
children: s ? "Saving…" : "Save view"
|
|
610
|
+
}) })
|
|
611
|
+
]
|
|
612
|
+
})]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function _e({ view: e, updateView: t, busy: r, onError: a }) {
|
|
616
|
+
let [o, s] = S(!1), [c, l] = S(e.name), [u, d] = S(e.description ?? ""), [f, p] = S(null), m = async () => {
|
|
617
|
+
p(null);
|
|
618
|
+
try {
|
|
619
|
+
await n(t({ variables: {
|
|
620
|
+
id: e.id,
|
|
621
|
+
input: {
|
|
622
|
+
name: c.trim(),
|
|
623
|
+
description: u.trim() || null
|
|
624
|
+
}
|
|
625
|
+
} })), s(!1);
|
|
626
|
+
} catch (e) {
|
|
627
|
+
let t = L(e, "The view could not be renamed.");
|
|
628
|
+
p(t), a(t);
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
return /* @__PURE__ */ T(k, {
|
|
632
|
+
open: o,
|
|
633
|
+
onOpenChange: (t) => {
|
|
634
|
+
s(t), t && (l(e.name), d(e.description ?? ""), p(null));
|
|
635
|
+
},
|
|
636
|
+
children: [/* @__PURE__ */ w(P, {
|
|
637
|
+
asChild: !0,
|
|
638
|
+
children: /* @__PURE__ */ w(E, {
|
|
639
|
+
size: "icon",
|
|
640
|
+
variant: "ghost",
|
|
641
|
+
"aria-label": `Rename ${e.name}`,
|
|
642
|
+
disabled: r,
|
|
643
|
+
children: /* @__PURE__ */ w(se, { className: "h-3.5 w-3.5" })
|
|
644
|
+
})
|
|
645
|
+
}), /* @__PURE__ */ T(A, {
|
|
646
|
+
className: "max-w-md",
|
|
647
|
+
children: [
|
|
648
|
+
/* @__PURE__ */ w(M, { children: /* @__PURE__ */ w(N, { children: "Rename view" }) }),
|
|
649
|
+
/* @__PURE__ */ T("div", {
|
|
650
|
+
className: "space-y-3",
|
|
651
|
+
children: [/* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
652
|
+
htmlFor: "rename-view-name",
|
|
653
|
+
className: "text-sm font-medium",
|
|
654
|
+
children: "Name"
|
|
655
|
+
}), /* @__PURE__ */ w(O, {
|
|
656
|
+
id: "rename-view-name",
|
|
657
|
+
className: "mt-1",
|
|
658
|
+
value: c,
|
|
659
|
+
onChange: (e) => l(e.target.value)
|
|
660
|
+
})] }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
|
|
661
|
+
htmlFor: "rename-view-description",
|
|
662
|
+
className: "text-sm font-medium",
|
|
663
|
+
children: "Description (optional)"
|
|
664
|
+
}), /* @__PURE__ */ w(O, {
|
|
665
|
+
id: "rename-view-description",
|
|
666
|
+
className: "mt-1",
|
|
667
|
+
value: u,
|
|
668
|
+
onChange: (e) => d(e.target.value)
|
|
669
|
+
})] })]
|
|
670
|
+
}),
|
|
671
|
+
f && /* @__PURE__ */ w(i, { message: f }),
|
|
672
|
+
/* @__PURE__ */ w(j, { children: /* @__PURE__ */ w(E, {
|
|
673
|
+
onClick: () => void m(),
|
|
674
|
+
disabled: c.trim() === "" || r,
|
|
675
|
+
children: r ? "Saving…" : "Save"
|
|
676
|
+
}) })
|
|
677
|
+
]
|
|
678
|
+
})]
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
//#endregion
|
|
682
|
+
export { R as BoardViewBar };
|
|
683
|
+
|
|
684
|
+
//# sourceMappingURL=BoardViewBar.js.map
|