@nubisco/ui 5.8.2 → 5.9.0
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/Board-CS1pMX4d.cjs +1 -0
- package/dist/Board-DmTUOIbg.js +420 -0
- package/dist/{Confirm-BewLtgMD.js → Confirm-BQkB2b4e.js} +2 -2
- package/dist/{Confirm-DHWWbfmu.cjs → Confirm-DZ_nb6Z0.cjs} +1 -1
- package/dist/{Modal-xl0ku1IX.cjs → Modal-BkCiD4gu.cjs} +1 -1
- package/dist/{Modal-BsuYzVSB.js → Modal-kfgbfLM4.js} +1 -1
- package/dist/{TextInput-DMWj3d3i.cjs → TextInput-C1akT0kW.cjs} +1 -1
- package/dist/{TextInput-CW0Tj61o.js → TextInput-DBeZ3X3P.js} +2 -2
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +4 -4
- package/dist/components/Board.cjs +1 -1
- package/dist/components/Board.d.ts +25 -0
- package/dist/components/Board.mjs +1 -1
- package/dist/components/Board.vue.d.ts +4 -1
- package/dist/components/Board.vue.d.ts.map +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/TextInput.cjs +1 -1
- package/dist/components/TextInput.mjs +1 -1
- package/dist/components/TextInput.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/styles/Board.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/TextInput.css +1 -1
- package/dist/ui.css +3 -3
- package/package.json +1 -1
- package/dist/Board-BuSaR4pf.js +0 -362
- package/dist/Board-Dsril3p2.cjs +0 -1
package/dist/Board-BuSaR4pf.js
DELETED
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import { useStableId as e } from "./composables/useStableId.composable.mjs";
|
|
2
|
-
import { useSurfaceLayer as t } from "./composables/useSurfaceLayer.composable.mjs";
|
|
3
|
-
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, mergeProps as ee, nextTick as c, normalizeClass as l, normalizeStyle as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, withModifiers as _ } from "vue";
|
|
4
|
-
//#region src/components/Board.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var v = [
|
|
6
|
-
"draggable",
|
|
7
|
-
"onDragstart",
|
|
8
|
-
"onDragover"
|
|
9
|
-
], y = { class: "nb-board__col-title" }, b = { class: "nb-board__col-count" }, x = ["onClick"], S = ["aria-label"], C = { class: "nb-board__lane-label" }, te = { class: "nb-board__lane-count" }, ne = ["onDragover", "onDrop"], re = ["aria-label"], ie = [
|
|
10
|
-
"data-item-id",
|
|
11
|
-
"aria-label",
|
|
12
|
-
"aria-describedby",
|
|
13
|
-
"onDragstart",
|
|
14
|
-
"onDragover",
|
|
15
|
-
"onKeydown",
|
|
16
|
-
"onBlur"
|
|
17
|
-
], ae = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "nb-board__empty-cell",
|
|
20
|
-
"aria-hidden": "true"
|
|
21
|
-
}, oe = {
|
|
22
|
-
key: 0,
|
|
23
|
-
class: "nb-board__cell-footer"
|
|
24
|
-
}, se = ["id"], ce = {
|
|
25
|
-
class: "nb-board__sr",
|
|
26
|
-
"aria-live": "assertive"
|
|
27
|
-
}, w = /* @__PURE__ */ s({
|
|
28
|
-
__name: "Board",
|
|
29
|
-
props: {
|
|
30
|
-
columns: {},
|
|
31
|
-
items: {},
|
|
32
|
-
lanes: { default: void 0 },
|
|
33
|
-
reorderableColumns: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: !1
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
emits: ["move", "column-move"],
|
|
39
|
-
setup(s, { emit: w }) {
|
|
40
|
-
let T = s, { layerProps: le } = t(), E = w, D = e({}), O = f(null), ue = r(() => ({ gridTemplateColumns: `repeat(${T.columns.length}, var(--nb-board-column-track, minmax(200px, 1fr)))` })), de = r(() => T.lanes && T.lanes.length > 0 ? T.lanes : [null]);
|
|
41
|
-
function k(e) {
|
|
42
|
-
return e ? e.id ?? null : null;
|
|
43
|
-
}
|
|
44
|
-
function A(e) {
|
|
45
|
-
return e ? M(e.id) : "__flat__";
|
|
46
|
-
}
|
|
47
|
-
function j(e) {
|
|
48
|
-
return T.items.filter((t) => t.columnId === e).length;
|
|
49
|
-
}
|
|
50
|
-
function M(e) {
|
|
51
|
-
return e ?? "__none__";
|
|
52
|
-
}
|
|
53
|
-
function fe(e) {
|
|
54
|
-
return T.lanes ? T.items.filter((t) => (t.laneId ?? null) === e).length : 0;
|
|
55
|
-
}
|
|
56
|
-
function N(e, t) {
|
|
57
|
-
return !T.lanes || T.lanes.length === 0 ? T.items.filter((e) => e.columnId === t) : T.items.filter((n) => n.columnId === t && (n.laneId ?? null) === e);
|
|
58
|
-
}
|
|
59
|
-
function P(e) {
|
|
60
|
-
return T.columns.find((t) => t.id === e);
|
|
61
|
-
}
|
|
62
|
-
let F = f(/* @__PURE__ */ new Set());
|
|
63
|
-
function I(e) {
|
|
64
|
-
let t = M(e), n = new Set(F.value);
|
|
65
|
-
n.has(t) ? n.delete(t) : n.add(t), F.value = n;
|
|
66
|
-
}
|
|
67
|
-
function L(e) {
|
|
68
|
-
return F.value.has(M(e));
|
|
69
|
-
}
|
|
70
|
-
function R(e) {
|
|
71
|
-
let t = e.label ?? e.name ?? e.title;
|
|
72
|
-
return typeof t == "string" ? t : `Item ${e.id}`;
|
|
73
|
-
}
|
|
74
|
-
function z(e, t) {
|
|
75
|
-
return e ? `${t.label}, ${e.label}` : t.label;
|
|
76
|
-
}
|
|
77
|
-
function B(e, t) {
|
|
78
|
-
return z(e, t);
|
|
79
|
-
}
|
|
80
|
-
function V(e, t, n) {
|
|
81
|
-
let r = N(k(t), n.id), i = r.findIndex((t) => t.id === e.id), a = `${R(e)}, ${i + 1} of ${r.length} in ${z(t, n)}`;
|
|
82
|
-
return q.value?.item.id === e.id ? `${a}, picked up` : a;
|
|
83
|
-
}
|
|
84
|
-
let H = f("");
|
|
85
|
-
function U(e, t, n, r) {
|
|
86
|
-
let i = N(t, n).filter((t) => t.id !== e.item.id), a = Math.max(0, Math.min(r, i.length));
|
|
87
|
-
return e.fromColumnId === n && e.fromLaneId === t && a === N(t, n).findIndex((t) => t.id === e.item.id) ? !1 : (E("move", {
|
|
88
|
-
itemId: e.item.id,
|
|
89
|
-
fromColumnId: e.fromColumnId,
|
|
90
|
-
toColumnId: n,
|
|
91
|
-
fromLaneId: e.fromLaneId,
|
|
92
|
-
toLaneId: t,
|
|
93
|
-
toIndex: a,
|
|
94
|
-
beforeItemId: i[a - 1]?.id ?? null,
|
|
95
|
-
afterItemId: i[a]?.id ?? null
|
|
96
|
-
}), !0);
|
|
97
|
-
}
|
|
98
|
-
let W = f(null), G = f(null);
|
|
99
|
-
function pe(e, t, n) {
|
|
100
|
-
q.value = null, W.value = {
|
|
101
|
-
item: e,
|
|
102
|
-
fromLaneId: k(t),
|
|
103
|
-
fromColumnId: n
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function me(e, t, n, r) {
|
|
107
|
-
if (!W.value) return;
|
|
108
|
-
let i = e.currentTarget.getBoundingClientRect(), a = e.clientY >= i.top + i.height / 2;
|
|
109
|
-
G.value = {
|
|
110
|
-
laneId: k(t),
|
|
111
|
-
colId: n,
|
|
112
|
-
index: r + (a ? 1 : 0)
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function he(e, t) {
|
|
116
|
-
if (!W.value) return;
|
|
117
|
-
let n = k(e);
|
|
118
|
-
G.value = {
|
|
119
|
-
laneId: n,
|
|
120
|
-
colId: t,
|
|
121
|
-
index: N(n, t).length
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function ge() {
|
|
125
|
-
G.value = null;
|
|
126
|
-
}
|
|
127
|
-
function _e() {
|
|
128
|
-
W.value = null, G.value = null;
|
|
129
|
-
}
|
|
130
|
-
function ve(e, t) {
|
|
131
|
-
return K(e, t) !== null;
|
|
132
|
-
}
|
|
133
|
-
function K(e, t) {
|
|
134
|
-
let n = k(e), r = G.value;
|
|
135
|
-
if (W.value && r && r.laneId === n && r.colId === t) return r.index;
|
|
136
|
-
let i = q.value;
|
|
137
|
-
if (i && i.laneId === n && i.colId === t) {
|
|
138
|
-
let e = N(n, t).findIndex((e) => e.id === i.item.id);
|
|
139
|
-
return e !== -1 && e <= i.index ? i.index + 1 : i.index;
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
function ye(e, t, n) {
|
|
144
|
-
return n === N(k(e), t).length - 1 && K(e, t) === n + 1;
|
|
145
|
-
}
|
|
146
|
-
function be(e, t) {
|
|
147
|
-
if (Z.value !== null) return;
|
|
148
|
-
let n = G.value;
|
|
149
|
-
G.value = null;
|
|
150
|
-
let r = W.value;
|
|
151
|
-
if (W.value = null, !r) return;
|
|
152
|
-
let i = k(e), a = N(i, t), o = n && n.laneId === i && n.colId === t ? n.index : a.length, s = a.findIndex((e) => e.id === r.item.id);
|
|
153
|
-
U(r, i, t, s !== -1 && s < o ? o - 1 : o);
|
|
154
|
-
}
|
|
155
|
-
let q = f(null);
|
|
156
|
-
function xe(e, t, n, r) {
|
|
157
|
-
let i = k(n);
|
|
158
|
-
if (e.key === "Escape") {
|
|
159
|
-
if (!q.value) return;
|
|
160
|
-
e.preventDefault(), q.value = null, H.value = "Move cancelled";
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (e.key === " " || e.key === "Enter") {
|
|
164
|
-
e.preventDefault(), q.value?.item.id === t.id ? Te() : Se(t, i, r);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
[
|
|
168
|
-
"ArrowUp",
|
|
169
|
-
"ArrowDown",
|
|
170
|
-
"ArrowLeft",
|
|
171
|
-
"ArrowRight"
|
|
172
|
-
].includes(e.key) && (e.preventDefault(), q.value?.item.id === t.id ? we(e.key) : Y(e.key, t, i, r));
|
|
173
|
-
}
|
|
174
|
-
function Se(e, t, n) {
|
|
175
|
-
q.value = {
|
|
176
|
-
item: e,
|
|
177
|
-
fromLaneId: t,
|
|
178
|
-
fromColumnId: n,
|
|
179
|
-
laneId: t,
|
|
180
|
-
colId: n,
|
|
181
|
-
index: N(t, n).findIndex((t) => t.id === e.id)
|
|
182
|
-
}, H.value = `${R(e)} picked up, ${J()}`;
|
|
183
|
-
}
|
|
184
|
-
function J() {
|
|
185
|
-
let e = q.value;
|
|
186
|
-
if (!e) return "";
|
|
187
|
-
let t = N(e.laneId, e.colId).filter((t) => t.id !== e.item.id), n = P(e.colId), r = T.lanes?.find((t) => (t.id ?? null) === e.laneId) ?? null, i = n ? z(r, n) : e.colId;
|
|
188
|
-
return `position ${e.index + 1} of ${t.length + 1} in ${i}`;
|
|
189
|
-
}
|
|
190
|
-
function Ce() {
|
|
191
|
-
return !T.lanes || T.lanes.length === 0 ? [null] : T.lanes.filter((e) => !L(e.id)).map((e) => e.id ?? null);
|
|
192
|
-
}
|
|
193
|
-
function we(e) {
|
|
194
|
-
let t = q.value;
|
|
195
|
-
if (!t) return;
|
|
196
|
-
let n = N(t.laneId, t.colId).filter((e) => e.id !== t.item.id);
|
|
197
|
-
if (e === "ArrowUp" || e === "ArrowDown") {
|
|
198
|
-
let r = e === "ArrowUp" ? -1 : 1, i = t.index + r;
|
|
199
|
-
if (i >= 0 && i <= n.length) t.index = i;
|
|
200
|
-
else {
|
|
201
|
-
let e = Ce(), n = e.indexOf(t.laneId), i = n + r;
|
|
202
|
-
if (n === -1 || i < 0 || i >= e.length) return;
|
|
203
|
-
let a = e[i];
|
|
204
|
-
t.laneId = a, t.index = r === 1 ? 0 : N(a, t.colId).filter((e) => e.id !== t.item.id).length;
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
let n = e === "ArrowLeft" ? -1 : 1, r = T.columns.findIndex((e) => e.id === t.colId), i = T.columns[r + n];
|
|
208
|
-
if (r === -1 || !i) return;
|
|
209
|
-
t.colId = i.id;
|
|
210
|
-
let a = N(t.laneId, t.colId).filter((e) => e.id !== t.item.id);
|
|
211
|
-
t.index = Math.min(t.index, a.length);
|
|
212
|
-
}
|
|
213
|
-
H.value = `${R(t.item)}, ${J()}`;
|
|
214
|
-
}
|
|
215
|
-
function Te() {
|
|
216
|
-
let e = q.value;
|
|
217
|
-
if (!e) return;
|
|
218
|
-
q.value = null;
|
|
219
|
-
let t = U({
|
|
220
|
-
item: e.item,
|
|
221
|
-
fromLaneId: e.fromLaneId,
|
|
222
|
-
fromColumnId: e.fromColumnId
|
|
223
|
-
}, e.laneId, e.colId, e.index), n = P(e.colId), r = T.lanes?.find((t) => (t.id ?? null) === e.laneId) ?? null, i = n ? z(r, n) : e.colId;
|
|
224
|
-
H.value = t ? `${R(e.item)} dropped, position ${e.index + 1} in ${i}` : `${R(e.item)} dropped`, Ee(e.item.id);
|
|
225
|
-
}
|
|
226
|
-
function Y(e, t, n, r) {
|
|
227
|
-
let i = N(n, r), a = i.findIndex((e) => e.id === t.id);
|
|
228
|
-
if (e === "ArrowUp" || e === "ArrowDown") {
|
|
229
|
-
let t = a + (e === "ArrowDown" ? 1 : -1);
|
|
230
|
-
t >= 0 && t < i.length && X(i[t].id);
|
|
231
|
-
} else {
|
|
232
|
-
let t = T.columns.findIndex((e) => e.id === r), i = T.columns[t + (e === "ArrowRight" ? 1 : -1)];
|
|
233
|
-
if (t === -1 || !i) return;
|
|
234
|
-
let o = N(n, i.id);
|
|
235
|
-
if (o.length === 0) return;
|
|
236
|
-
X(o[Math.min(a, o.length - 1)].id);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function X(e) {
|
|
240
|
-
let t = O.value?.querySelectorAll("[data-item-id]");
|
|
241
|
-
if (t) {
|
|
242
|
-
for (let n of t) if (n.dataset.itemId === e) {
|
|
243
|
-
n.focus();
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
async function Ee(e) {
|
|
249
|
-
await c(), await c(), X(e);
|
|
250
|
-
}
|
|
251
|
-
function De(e) {
|
|
252
|
-
q.value?.item.id === e.id && (q.value = null);
|
|
253
|
-
}
|
|
254
|
-
let Z = f(null), Q = f(null);
|
|
255
|
-
function Oe(e, t) {
|
|
256
|
-
if (!T.reorderableColumns) {
|
|
257
|
-
t.preventDefault();
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
Z.value = e, Q.value = e;
|
|
261
|
-
}
|
|
262
|
-
function ke(e, t) {
|
|
263
|
-
if (Z.value === null) return;
|
|
264
|
-
t.preventDefault();
|
|
265
|
-
let n = t.currentTarget.getBoundingClientRect();
|
|
266
|
-
Q.value = t.clientX < n.left + n.width / 2 ? e : e + 1;
|
|
267
|
-
}
|
|
268
|
-
function Ae(e) {
|
|
269
|
-
let t = Z.value, n = Q.value;
|
|
270
|
-
if ($(), t === null || n === null) return;
|
|
271
|
-
e.preventDefault();
|
|
272
|
-
let r = n > t ? n - 1 : n;
|
|
273
|
-
r !== t && E("column-move", {
|
|
274
|
-
columnId: T.columns[t].id,
|
|
275
|
-
toIndex: r
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
function $() {
|
|
279
|
-
Z.value = null, Q.value = null;
|
|
280
|
-
}
|
|
281
|
-
return (e, t) => (d(), a("div", ee({
|
|
282
|
-
ref_key: "boardRef",
|
|
283
|
-
ref: O,
|
|
284
|
-
class: "nb-board"
|
|
285
|
-
}, g(le)), [
|
|
286
|
-
o("div", {
|
|
287
|
-
class: "nb-board__grid",
|
|
288
|
-
style: u(ue.value)
|
|
289
|
-
}, [(d(!0), a(n, null, p(s.columns, (t, n) => (d(), a("div", {
|
|
290
|
-
key: t.id,
|
|
291
|
-
class: l(["nb-board__col-header", {
|
|
292
|
-
"nb-board__col-header--reorderable": s.reorderableColumns,
|
|
293
|
-
"nb-board__col-header--dragging": Z.value === n,
|
|
294
|
-
"nb-board__col-header--drop-before": Q.value === n,
|
|
295
|
-
"nb-board__col-header--drop-after": Q.value === n + 1 && n === s.columns.length - 1
|
|
296
|
-
}]),
|
|
297
|
-
style: u(t.color ? { borderTopColor: t.color } : void 0),
|
|
298
|
-
draggable: s.reorderableColumns || void 0,
|
|
299
|
-
onDragstart: (e) => Oe(n, e),
|
|
300
|
-
onDragover: (e) => ke(n, e),
|
|
301
|
-
onDrop: Ae,
|
|
302
|
-
onDragend: $
|
|
303
|
-
}, [m(e.$slots, "column-header", {
|
|
304
|
-
column: t,
|
|
305
|
-
count: j(t.id)
|
|
306
|
-
}, () => [o("span", y, h(t.label), 1), o("span", b, h(j(t.id)), 1)])], 46, v))), 128)), (d(!0), a(n, null, p(de.value, (t) => (d(), a(n, { key: A(t) }, [t ? (d(), a("div", {
|
|
307
|
-
key: 0,
|
|
308
|
-
class: "nb-board__lane-header",
|
|
309
|
-
onClick: (e) => I(t.id)
|
|
310
|
-
}, [
|
|
311
|
-
o("button", {
|
|
312
|
-
class: "nb-board__collapse-btn",
|
|
313
|
-
"aria-label": L(t.id) ? "Expand" : "Collapse"
|
|
314
|
-
}, h(L(t.id) ? "▶" : "▼"), 9, S),
|
|
315
|
-
m(e.$slots, "lane-header", { lane: t }, () => [o("span", C, h(t.label), 1)]),
|
|
316
|
-
o("span", te, h(fe(t.id)), 1)
|
|
317
|
-
], 8, x)) : i("", !0), !t || !L(t.id) ? (d(!0), a(n, { key: 1 }, p(s.columns, (r) => (d(), a("div", {
|
|
318
|
-
key: A(t) + "-" + r.id,
|
|
319
|
-
class: l(["nb-board__cell", { "nb-board__cell--drag-over": ve(t, r.id) }]),
|
|
320
|
-
onDragover: _((e) => he(t, r.id), ["prevent"]),
|
|
321
|
-
onDragleave: ge,
|
|
322
|
-
onDrop: _((e) => be(t, r.id), ["prevent"])
|
|
323
|
-
}, [o("div", {
|
|
324
|
-
class: "nb-board__cell-items",
|
|
325
|
-
role: "list",
|
|
326
|
-
"aria-label": B(t, r)
|
|
327
|
-
}, [(d(!0), a(n, null, p(N(k(t), r.id), (n, i) => (d(), a("div", {
|
|
328
|
-
key: n.id,
|
|
329
|
-
class: l(["nb-board__card", {
|
|
330
|
-
"nb-board__card--lifted": q.value?.item.id === n.id,
|
|
331
|
-
"nb-board__card--drop-before": K(t, r.id) === i,
|
|
332
|
-
"nb-board__card--drop-after": ye(t, r.id, i)
|
|
333
|
-
}]),
|
|
334
|
-
role: "listitem",
|
|
335
|
-
tabindex: "0",
|
|
336
|
-
"data-item-id": n.id,
|
|
337
|
-
"aria-label": V(n, t, r),
|
|
338
|
-
"aria-describedby": `${g(D)}-hint`,
|
|
339
|
-
draggable: "true",
|
|
340
|
-
onDragstart: (e) => pe(n, t, r.id),
|
|
341
|
-
onDragover: _((e) => me(e, t, r.id, i), ["prevent", "stop"]),
|
|
342
|
-
onDragend: _e,
|
|
343
|
-
onKeydown: (e) => xe(e, n, t, r.id),
|
|
344
|
-
onBlur: (e) => De(n)
|
|
345
|
-
}, [m(e.$slots, "card", {
|
|
346
|
-
item: n,
|
|
347
|
-
column: r,
|
|
348
|
-
lane: t ?? void 0
|
|
349
|
-
})], 42, ie))), 128)), N(k(t), r.id).length === 0 ? (d(), a("div", ae)) : i("", !0)], 8, re), e.$slots["column-footer"] ? (d(), a("div", oe, [m(e.$slots, "column-footer", {
|
|
350
|
-
column: r,
|
|
351
|
-
lane: t ?? void 0
|
|
352
|
-
})])) : i("", !0)], 42, ne))), 128)) : i("", !0)], 64))), 128))], 4),
|
|
353
|
-
o("span", {
|
|
354
|
-
id: `${g(D)}-hint`,
|
|
355
|
-
class: "nb-board__sr"
|
|
356
|
-
}, " Press Space or Enter to pick up, arrow keys to move, Space or Enter to drop, Escape to cancel. ", 8, se),
|
|
357
|
-
o("span", ce, h(H.value), 1)
|
|
358
|
-
], 16));
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
//#endregion
|
|
362
|
-
export { w as t };
|
package/dist/Board-Dsril3p2.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useStableId.composable.cjs`),t=require(`./composables/useSurfaceLayer.composable.cjs`);let n=require(`vue`);var r=[`draggable`,`onDragstart`,`onDragover`],i={class:`nb-board__col-title`},a={class:`nb-board__col-count`},o=[`onClick`],s=[`aria-label`],c={class:`nb-board__lane-label`},l={class:`nb-board__lane-count`},u=[`onDragover`,`onDrop`],d=[`aria-label`],f=[`data-item-id`,`aria-label`,`aria-describedby`,`onDragstart`,`onDragover`,`onKeydown`,`onBlur`],ee={key:0,class:`nb-board__empty-cell`,"aria-hidden":`true`},te={key:0,class:`nb-board__cell-footer`},p=[`id`],m={class:`nb-board__sr`,"aria-live":`assertive`},h=(0,n.defineComponent)({__name:`Board`,props:{columns:{},items:{},lanes:{default:void 0},reorderableColumns:{type:Boolean,default:!1}},emits:[`move`,`column-move`],setup(h,{emit:g}){let _=h,{layerProps:v}=t.useSurfaceLayer(),y=g,b=e.useStableId({}),x=(0,n.ref)(null),ne=(0,n.computed)(()=>({gridTemplateColumns:`repeat(${_.columns.length}, var(--nb-board-column-track, minmax(200px, 1fr)))`})),re=(0,n.computed)(()=>_.lanes&&_.lanes.length>0?_.lanes:[null]);function S(e){return e?e.id??null:null}function C(e){return e?T(e.id):`__flat__`}function w(e){return _.items.filter(t=>t.columnId===e).length}function T(e){return e??`__none__`}function E(e){return _.lanes?_.items.filter(t=>(t.laneId??null)===e).length:0}function D(e,t){return!_.lanes||_.lanes.length===0?_.items.filter(e=>e.columnId===t):_.items.filter(n=>n.columnId===t&&(n.laneId??null)===e)}function O(e){return _.columns.find(t=>t.id===e)}let k=(0,n.ref)(new Set);function ie(e){let t=T(e),n=new Set(k.value);n.has(t)?n.delete(t):n.add(t),k.value=n}function A(e){return k.value.has(T(e))}function j(e){let t=e.label??e.name??e.title;return typeof t==`string`?t:`Item ${e.id}`}function M(e,t){return e?`${t.label}, ${e.label}`:t.label}function N(e,t){return M(e,t)}function P(e,t,n){let r=D(S(t),n.id),i=r.findIndex(t=>t.id===e.id),a=`${j(e)}, ${i+1} of ${r.length} in ${M(t,n)}`;return q.value?.item.id===e.id?`${a}, picked up`:a}let F=(0,n.ref)(``);function I(e,t,n,r){let i=D(t,n).filter(t=>t.id!==e.item.id),a=Math.max(0,Math.min(r,i.length));return e.fromColumnId===n&&e.fromLaneId===t&&a===D(t,n).findIndex(t=>t.id===e.item.id)?!1:(y(`move`,{itemId:e.item.id,fromColumnId:e.fromColumnId,toColumnId:n,fromLaneId:e.fromLaneId,toLaneId:t,toIndex:a,beforeItemId:i[a-1]?.id??null,afterItemId:i[a]?.id??null}),!0)}let L=(0,n.ref)(null),R=(0,n.ref)(null);function z(e,t,n){q.value=null,L.value={item:e,fromLaneId:S(t),fromColumnId:n}}function B(e,t,n,r){if(!L.value)return;let i=e.currentTarget.getBoundingClientRect(),a=e.clientY>=i.top+i.height/2;R.value={laneId:S(t),colId:n,index:r+(a?1:0)}}function V(e,t){if(!L.value)return;let n=S(e);R.value={laneId:n,colId:t,index:D(n,t).length}}function H(){R.value=null}function U(){L.value=null,R.value=null}function W(e,t){return G(e,t)!==null}function G(e,t){let n=S(e),r=R.value;if(L.value&&r&&r.laneId===n&&r.colId===t)return r.index;let i=q.value;if(i&&i.laneId===n&&i.colId===t){let e=D(n,t).findIndex(e=>e.id===i.item.id);return e!==-1&&e<=i.index?i.index+1:i.index}return null}function ae(e,t,n){return n===D(S(e),t).length-1&&G(e,t)===n+1}function K(e,t){if(Z.value!==null)return;let n=R.value;R.value=null;let r=L.value;if(L.value=null,!r)return;let i=S(e),a=D(i,t),o=n&&n.laneId===i&&n.colId===t?n.index:a.length,s=a.findIndex(e=>e.id===r.item.id);I(r,i,t,s!==-1&&s<o?o-1:o)}let q=(0,n.ref)(null);function J(e,t,n,r){let i=S(n);if(e.key===`Escape`){if(!q.value)return;e.preventDefault(),q.value=null,F.value=`Move cancelled`;return}if(e.key===` `||e.key===`Enter`){e.preventDefault(),q.value?.item.id===t.id?le():oe(t,i,r);return}[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),q.value?.item.id===t.id?ce(e.key):ue(e.key,t,i,r))}function oe(e,t,n){q.value={item:e,fromLaneId:t,fromColumnId:n,laneId:t,colId:n,index:D(t,n).findIndex(t=>t.id===e.id)},F.value=`${j(e)} picked up, ${Y()}`}function Y(){let e=q.value;if(!e)return``;let t=D(e.laneId,e.colId).filter(t=>t.id!==e.item.id),n=O(e.colId),r=_.lanes?.find(t=>(t.id??null)===e.laneId)??null,i=n?M(r,n):e.colId;return`position ${e.index+1} of ${t.length+1} in ${i}`}function se(){return!_.lanes||_.lanes.length===0?[null]:_.lanes.filter(e=>!A(e.id)).map(e=>e.id??null)}function ce(e){let t=q.value;if(!t)return;let n=D(t.laneId,t.colId).filter(e=>e.id!==t.item.id);if(e===`ArrowUp`||e===`ArrowDown`){let r=e===`ArrowUp`?-1:1,i=t.index+r;if(i>=0&&i<=n.length)t.index=i;else{let e=se(),n=e.indexOf(t.laneId),i=n+r;if(n===-1||i<0||i>=e.length)return;let a=e[i];t.laneId=a,t.index=r===1?0:D(a,t.colId).filter(e=>e.id!==t.item.id).length}}else{let n=e===`ArrowLeft`?-1:1,r=_.columns.findIndex(e=>e.id===t.colId),i=_.columns[r+n];if(r===-1||!i)return;t.colId=i.id;let a=D(t.laneId,t.colId).filter(e=>e.id!==t.item.id);t.index=Math.min(t.index,a.length)}F.value=`${j(t.item)}, ${Y()}`}function le(){let e=q.value;if(!e)return;q.value=null;let t=I({item:e.item,fromLaneId:e.fromLaneId,fromColumnId:e.fromColumnId},e.laneId,e.colId,e.index),n=O(e.colId),r=_.lanes?.find(t=>(t.id??null)===e.laneId)??null,i=n?M(r,n):e.colId;F.value=t?`${j(e.item)} dropped, position ${e.index+1} in ${i}`:`${j(e.item)} dropped`,de(e.item.id)}function ue(e,t,n,r){let i=D(n,r),a=i.findIndex(e=>e.id===t.id);if(e===`ArrowUp`||e===`ArrowDown`){let t=a+(e===`ArrowDown`?1:-1);t>=0&&t<i.length&&X(i[t].id)}else{let t=_.columns.findIndex(e=>e.id===r),i=_.columns[t+(e===`ArrowRight`?1:-1)];if(t===-1||!i)return;let o=D(n,i.id);if(o.length===0)return;X(o[Math.min(a,o.length-1)].id)}}function X(e){let t=x.value?.querySelectorAll(`[data-item-id]`);if(t){for(let n of t)if(n.dataset.itemId===e){n.focus();return}}}async function de(e){await(0,n.nextTick)(),await(0,n.nextTick)(),X(e)}function fe(e){q.value?.item.id===e.id&&(q.value=null)}let Z=(0,n.ref)(null),Q=(0,n.ref)(null);function pe(e,t){if(!_.reorderableColumns){t.preventDefault();return}Z.value=e,Q.value=e}function me(e,t){if(Z.value===null)return;t.preventDefault();let n=t.currentTarget.getBoundingClientRect();Q.value=t.clientX<n.left+n.width/2?e:e+1}function he(e){let t=Z.value,n=Q.value;if($(),t===null||n===null)return;e.preventDefault();let r=n>t?n-1:n;r!==t&&y(`column-move`,{columnId:_.columns[t].id,toIndex:r})}function $(){Z.value=null,Q.value=null}return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({ref_key:`boardRef`,ref:x,class:`nb-board`},(0,n.unref)(v)),[(0,n.createElementVNode)(`div`,{class:`nb-board__grid`,style:(0,n.normalizeStyle)(ne.value)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(h.columns,(t,o)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:t.id,class:(0,n.normalizeClass)([`nb-board__col-header`,{"nb-board__col-header--reorderable":h.reorderableColumns,"nb-board__col-header--dragging":Z.value===o,"nb-board__col-header--drop-before":Q.value===o,"nb-board__col-header--drop-after":Q.value===o+1&&o===h.columns.length-1}]),style:(0,n.normalizeStyle)(t.color?{borderTopColor:t.color}:void 0),draggable:h.reorderableColumns||void 0,onDragstart:e=>pe(o,e),onDragover:e=>me(o,e),onDrop:he,onDragend:$},[(0,n.renderSlot)(e.$slots,`column-header`,{column:t,count:w(t.id)},()=>[(0,n.createElementVNode)(`span`,i,(0,n.toDisplayString)(t.label),1),(0,n.createElementVNode)(`span`,a,(0,n.toDisplayString)(w(t.id)),1)])],46,r))),128)),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(re.value,t=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:C(t)},[t?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`nb-board__lane-header`,onClick:e=>ie(t.id)},[(0,n.createElementVNode)(`button`,{class:`nb-board__collapse-btn`,"aria-label":A(t.id)?`Expand`:`Collapse`},(0,n.toDisplayString)(A(t.id)?`▶`:`▼`),9,s),(0,n.renderSlot)(e.$slots,`lane-header`,{lane:t},()=>[(0,n.createElementVNode)(`span`,c,(0,n.toDisplayString)(t.label),1)]),(0,n.createElementVNode)(`span`,l,(0,n.toDisplayString)(E(t.id)),1)],8,o)):(0,n.createCommentVNode)(``,!0),!t||!A(t.id)?((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,{key:1},(0,n.renderList)(h.columns,r=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:C(t)+`-`+r.id,class:(0,n.normalizeClass)([`nb-board__cell`,{"nb-board__cell--drag-over":W(t,r.id)}]),onDragover:(0,n.withModifiers)(e=>V(t,r.id),[`prevent`]),onDragleave:H,onDrop:(0,n.withModifiers)(e=>K(t,r.id),[`prevent`])},[(0,n.createElementVNode)(`div`,{class:`nb-board__cell-items`,role:`list`,"aria-label":N(t,r)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(D(S(t),r.id),(i,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:i.id,class:(0,n.normalizeClass)([`nb-board__card`,{"nb-board__card--lifted":q.value?.item.id===i.id,"nb-board__card--drop-before":G(t,r.id)===a,"nb-board__card--drop-after":ae(t,r.id,a)}]),role:`listitem`,tabindex:`0`,"data-item-id":i.id,"aria-label":P(i,t,r),"aria-describedby":`${(0,n.unref)(b)}-hint`,draggable:`true`,onDragstart:e=>z(i,t,r.id),onDragover:(0,n.withModifiers)(e=>B(e,t,r.id,a),[`prevent`,`stop`]),onDragend:U,onKeydown:e=>J(e,i,t,r.id),onBlur:e=>fe(i)},[(0,n.renderSlot)(e.$slots,`card`,{item:i,column:r,lane:t??void 0})],42,f))),128)),D(S(t),r.id).length===0?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,ee)):(0,n.createCommentVNode)(``,!0)],8,d),e.$slots[`column-footer`]?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,te,[(0,n.renderSlot)(e.$slots,`column-footer`,{column:r,lane:t??void 0})])):(0,n.createCommentVNode)(``,!0)],42,u))),128)):(0,n.createCommentVNode)(``,!0)],64))),128))],4),(0,n.createElementVNode)(`span`,{id:`${(0,n.unref)(b)}-hint`,class:`nb-board__sr`},` Press Space or Enter to pick up, arrow keys to move, Space or Enter to drop, Escape to cancel. `,8,p),(0,n.createElementVNode)(`span`,m,(0,n.toDisplayString)(F.value),1)],16))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|