@parallelworks/tandem-web 0.180.0 → 0.182.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/_virtual/_virtual_i18n/en/common.js +24 -0
- package/_virtual/_virtual_i18n/es/common.js +24 -0
- package/_virtual/_virtual_i18n/ja/common.js +24 -0
- package/_virtual/_virtual_i18n/ko/common.js +24 -0
- package/_virtual/_virtual_i18n/zh/common.js +24 -0
- package/components/DocStart.js +288 -0
- package/components/DocTable.js +114 -94
- package/package.json +1 -1
- package/routes/_workspace/docs/_doc2.js +239 -226
package/components/DocTable.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { docsQuery as e } from "../api/queries.js";
|
|
2
2
|
import { docPropertiesQuery as t, spaceScope as n, useDocPropertyActions as r } from "../lib/docProperties.js";
|
|
3
|
-
import { docRef as i } from "../lib/docs.js";
|
|
4
|
-
import { usePeople as
|
|
5
|
-
import { useCan as
|
|
6
|
-
import { DocIcon as
|
|
7
|
-
import { usePropertyText as
|
|
8
|
-
import { cx as
|
|
9
|
-
import { Link as
|
|
10
|
-
import { useState as
|
|
11
|
-
import { useFormatter as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { keepPreviousData as
|
|
3
|
+
import { docRef as i, useDocMenu as a } from "../lib/docs.js";
|
|
4
|
+
import { usePeople as o } from "../lib/people.js";
|
|
5
|
+
import { useCan as s } from "../lib/roles.js";
|
|
6
|
+
import { DocIcon as c } from "./DocIcon.js";
|
|
7
|
+
import { usePropertyText as l } from "./DocProperties.js";
|
|
8
|
+
import { cx as u, useOpenMenu as d } from "@parallelworks/ui";
|
|
9
|
+
import { Link as f } from "@tanstack/react-router";
|
|
10
|
+
import { useState as p } from "react";
|
|
11
|
+
import { useFormatter as m, useTranslations as h } from "use-intl";
|
|
12
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
|
+
import { keepPreviousData as v, useQuery as y } from "@tanstack/react-query";
|
|
14
|
+
import { MoreButton as b, rowContextMenuProps as x } from "@parallelworks/ui/list";
|
|
14
15
|
// src/components/DocTable.tsx
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
let o = Object.entries(i.filters ?? {}).map(([e, t]) => `${e}=${t}`), { data: s = [], isPending:
|
|
16
|
+
var S = (e) => e.kind === "select" || e.kind === "person";
|
|
17
|
+
function C(n, r, i, a = !1) {
|
|
18
|
+
let o = Object.entries(i.filters ?? {}).map(([e, t]) => `${e}=${t}`), { data: s = [], isPending: c } = y({
|
|
18
19
|
...e(n, {
|
|
19
20
|
...r === "workspace" ? { workspace: !0 } : { team: r },
|
|
20
21
|
...o.length > 0 && { property: o },
|
|
21
22
|
...a && { top: !0 }
|
|
22
23
|
}),
|
|
23
|
-
placeholderData:
|
|
24
|
-
}), { data: u = [] } =
|
|
24
|
+
placeholderData: v
|
|
25
|
+
}), { data: u = [] } = y(t(n, r)), d = l(n), f = i.sort ?? "title", p = u.find((e) => e.id === f), m = (e) => {
|
|
25
26
|
if (f === "updated") return e.updatedAt;
|
|
26
27
|
if (!p) return e.title.toLowerCase();
|
|
27
28
|
let t = e.properties?.[p.id];
|
|
@@ -33,97 +34,116 @@ function y(n, r, i, a = !1) {
|
|
|
33
34
|
return i.desc ? -a : a;
|
|
34
35
|
}),
|
|
35
36
|
props: u,
|
|
36
|
-
isPending:
|
|
37
|
+
isPending: c
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
let
|
|
40
|
+
function w({ workspace: e, space: t, layout: n, config: r, query: s = "" }) {
|
|
41
|
+
let u = h("docViews"), p = h("common"), v = h("docs"), y = m(), { actorName: w } = o(e), E = d(), D = a(e), O = s.trim().toLowerCase(), k = n === "table" && !O && Object.keys(r.filters ?? {}).length === 0, { docs: A, props: j, isPending: M } = C(e, t, r, k), N = O ? A.filter((e) => e.title.toLowerCase().includes(O)) : A, P = new Map(A.map((e) => [e.id, e])), F = (e) => {
|
|
41
42
|
let t = [];
|
|
42
|
-
for (let n =
|
|
43
|
+
for (let n = P.get(e.parentId ?? ""); n && !(t.length > 20); n = P.get(n.parentId ?? "")) t.unshift(n.title);
|
|
43
44
|
return t.join(" / ");
|
|
44
|
-
},
|
|
45
|
-
if (
|
|
45
|
+
}, I = l(e), L = (e, t) => e.properties?.[t.id];
|
|
46
|
+
if (M) return /* @__PURE__ */ g("p", {
|
|
46
47
|
className: "p-4 text-sm text-muted-foreground",
|
|
47
|
-
children:
|
|
48
|
+
children: u("loading")
|
|
48
49
|
});
|
|
49
50
|
if (n === "board") {
|
|
50
|
-
let n =
|
|
51
|
-
return n ? /* @__PURE__ */
|
|
51
|
+
let n = j.find((e) => e.id === r.groupBy && S(e));
|
|
52
|
+
return n ? /* @__PURE__ */ g(T, {
|
|
52
53
|
workspace: e,
|
|
53
54
|
space: t,
|
|
54
|
-
docs:
|
|
55
|
-
props:
|
|
55
|
+
docs: N,
|
|
56
|
+
props: j,
|
|
56
57
|
by: n
|
|
57
|
-
}) : /* @__PURE__ */
|
|
58
|
+
}) : /* @__PURE__ */ g("p", {
|
|
58
59
|
className: "p-4 text-sm text-muted-foreground",
|
|
59
|
-
children:
|
|
60
|
+
children: u("pickGroup")
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
|
-
let
|
|
63
|
-
return
|
|
63
|
+
let R = r.columns ? r.columns.flatMap((e) => j.filter((t) => t.id === e)) : j;
|
|
64
|
+
return N.length === 0 ? /* @__PURE__ */ g("p", {
|
|
64
65
|
className: "p-4 text-sm text-muted-foreground",
|
|
65
|
-
children:
|
|
66
|
-
}) : /* @__PURE__ */
|
|
66
|
+
children: u("none")
|
|
67
|
+
}) : /* @__PURE__ */ g("div", {
|
|
67
68
|
className: "overflow-x-auto",
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ _("table", {
|
|
69
70
|
className: "doc-table w-full min-w-max text-sm",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ g("thead", { children: /* @__PURE__ */ _("tr", { children: [
|
|
72
|
+
/* @__PURE__ */ g("th", {
|
|
72
73
|
scope: "col",
|
|
73
|
-
children:
|
|
74
|
+
children: u("docTitle")
|
|
74
75
|
}),
|
|
75
|
-
|
|
76
|
+
R.map((e) => /* @__PURE__ */ g("th", {
|
|
76
77
|
scope: "col",
|
|
77
78
|
children: e.name
|
|
78
79
|
}, e.id)),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ g("th", {
|
|
80
81
|
scope: "col",
|
|
81
|
-
children:
|
|
82
|
+
children: u("author")
|
|
82
83
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ g("th", {
|
|
84
85
|
scope: "col",
|
|
85
|
-
children:
|
|
86
|
+
children: u("updated")
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ g("th", {
|
|
89
|
+
scope: "col",
|
|
90
|
+
className: "max-md:sticky max-md:right-0 max-md:bg-card",
|
|
91
|
+
children: /* @__PURE__ */ g("span", {
|
|
92
|
+
className: "sr-only",
|
|
93
|
+
children: p("moreActions")
|
|
94
|
+
})
|
|
86
95
|
})
|
|
87
|
-
] }) }), /* @__PURE__ */
|
|
88
|
-
let n =
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
] }) }), /* @__PURE__ */ g("tbody", { children: N.map((t) => {
|
|
97
|
+
let n = k ? "" : F(t);
|
|
98
|
+
return /* @__PURE__ */ _("tr", {
|
|
99
|
+
className: "group",
|
|
100
|
+
...x(E, () => D(t)),
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ _("td", { children: [/* @__PURE__ */ _("div", {
|
|
103
|
+
className: "flex items-center gap-2",
|
|
104
|
+
children: [/* @__PURE__ */ _(f, {
|
|
105
|
+
to: "/$workspace/docs/$doc",
|
|
106
|
+
params: {
|
|
107
|
+
workspace: e,
|
|
108
|
+
doc: i(t)
|
|
109
|
+
},
|
|
110
|
+
className: "flex min-w-0 items-center gap-2 font-medium hover:underline",
|
|
111
|
+
children: [/* @__PURE__ */ g(c, { icon: t.icon }), /* @__PURE__ */ g("span", {
|
|
112
|
+
className: "truncate",
|
|
113
|
+
children: t.title
|
|
114
|
+
})]
|
|
115
|
+
}), k && (t.children ?? 0) > 0 && /* @__PURE__ */ g("span", {
|
|
116
|
+
className: "shrink-0 text-xs tabular-nums text-muted-foreground",
|
|
117
|
+
children: u("childCount", { count: t.children ?? 0 })
|
|
102
118
|
})]
|
|
103
|
-
}),
|
|
104
|
-
className: "
|
|
105
|
-
children:
|
|
106
|
-
})]
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
}), n && /* @__PURE__ */ g("span", {
|
|
120
|
+
className: "ml-6 block truncate text-xs text-muted-foreground",
|
|
121
|
+
children: u("inParent", { parent: n })
|
|
122
|
+
})] }),
|
|
123
|
+
R.map((e) => /* @__PURE__ */ g("td", { children: I(e, L(t, e)) }, e.id)),
|
|
124
|
+
/* @__PURE__ */ g("td", {
|
|
125
|
+
className: "text-muted-foreground",
|
|
126
|
+
children: w(t.creator)
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ g("td", {
|
|
129
|
+
className: "text-muted-foreground",
|
|
130
|
+
children: y.dateTime(new Date(t.updatedAt), { dateStyle: "medium" })
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ g("td", {
|
|
133
|
+
className: "w-0 max-md:sticky max-md:right-0 max-md:bg-card",
|
|
134
|
+
children: /* @__PURE__ */ g(b, {
|
|
135
|
+
items: () => D(t),
|
|
136
|
+
label: p("moreActionsFor", { name: t.title || v("untitled") })
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
}, t.id);
|
|
121
141
|
}) })]
|
|
122
142
|
})
|
|
123
143
|
});
|
|
124
144
|
}
|
|
125
|
-
function
|
|
126
|
-
let v =
|
|
145
|
+
function T({ workspace: e, space: t, docs: a, props: d, by: m }) {
|
|
146
|
+
let v = h("docViews"), { members: y } = o(e), b = l(e), x = s(e, "edit_docs", n(t)), S = r(e), [C, w] = p(null), [T, E] = p(null), D = [...m.kind === "select" ? m.options.map((e) => ({
|
|
127
147
|
key: e.id ?? "",
|
|
128
148
|
label: e.name
|
|
129
149
|
})) : y.map((e) => ({
|
|
@@ -131,17 +151,17 @@ function x({ workspace: e, space: t, docs: f, props: g, by: _ }) {
|
|
|
131
151
|
label: e.user.name
|
|
132
152
|
})), {
|
|
133
153
|
key: "",
|
|
134
|
-
label: v("noValue", { property:
|
|
154
|
+
label: v("noValue", { property: m.name })
|
|
135
155
|
}], O = (e) => {
|
|
136
|
-
let t = e.properties?.[
|
|
156
|
+
let t = e.properties?.[m.id];
|
|
137
157
|
return typeof t == "string" ? t : "";
|
|
138
|
-
}, k = D.filter((e) =>
|
|
139
|
-
return /* @__PURE__ */
|
|
158
|
+
}, k = D.filter((e) => m.kind === "select" || e.key === "" || a.some((t) => O(t) === e.key)), A = d.filter((e) => e.id !== m.id).slice(0, 2);
|
|
159
|
+
return /* @__PURE__ */ g("ul", {
|
|
140
160
|
className: "flex gap-3 overflow-x-auto p-3",
|
|
141
161
|
"aria-label": v("board"),
|
|
142
162
|
children: k.map((t) => {
|
|
143
|
-
let n =
|
|
144
|
-
return /* @__PURE__ */
|
|
163
|
+
let n = a.filter((e) => O(e) === t.key);
|
|
164
|
+
return /* @__PURE__ */ _("li", {
|
|
145
165
|
"aria-label": t.label,
|
|
146
166
|
onDragOver: (e) => {
|
|
147
167
|
C && (e.preventDefault(), E(t.key));
|
|
@@ -150,40 +170,40 @@ function x({ workspace: e, space: t, docs: f, props: g, by: _ }) {
|
|
|
150
170
|
onDrop: (e) => {
|
|
151
171
|
e.preventDefault(), C && S.setValues.mutate({
|
|
152
172
|
doc: C,
|
|
153
|
-
values: { [
|
|
173
|
+
values: { [m.id]: t.key || null }
|
|
154
174
|
}), w(null), E(null);
|
|
155
175
|
},
|
|
156
|
-
className:
|
|
157
|
-
children: [/* @__PURE__ */
|
|
176
|
+
className: u("flex w-64 shrink-0 flex-col rounded-lg border bg-muted/30", T === t.key ? "border-primary" : "border-border"),
|
|
177
|
+
children: [/* @__PURE__ */ _("p", {
|
|
158
178
|
className: "flex items-center gap-2 px-3 py-2 text-xs font-medium",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
179
|
+
children: [/* @__PURE__ */ g("span", {
|
|
160
180
|
className: "truncate",
|
|
161
181
|
children: t.label
|
|
162
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ g("span", {
|
|
163
183
|
className: "text-muted-foreground tabular-nums",
|
|
164
184
|
children: n.length
|
|
165
185
|
})]
|
|
166
|
-
}), /* @__PURE__ */
|
|
186
|
+
}), /* @__PURE__ */ g("ul", {
|
|
167
187
|
className: "flex flex-col gap-2 px-2 pb-2",
|
|
168
|
-
children: n.map((t) => /* @__PURE__ */
|
|
188
|
+
children: n.map((t) => /* @__PURE__ */ _("li", {
|
|
169
189
|
draggable: x,
|
|
170
190
|
onDragStart: () => w(t.key),
|
|
171
191
|
onDragEnd: () => w(null),
|
|
172
192
|
className: "rounded-md border border-border bg-card p-2.5 text-sm shadow-xs",
|
|
173
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ _(f, {
|
|
174
194
|
to: "/$workspace/docs/$doc",
|
|
175
195
|
params: {
|
|
176
196
|
workspace: e,
|
|
177
197
|
doc: i(t)
|
|
178
198
|
},
|
|
179
199
|
className: "flex items-center gap-2 font-medium hover:underline",
|
|
180
|
-
children: [/* @__PURE__ */
|
|
200
|
+
children: [/* @__PURE__ */ g(c, { icon: t.icon }), /* @__PURE__ */ g("span", {
|
|
181
201
|
className: "truncate",
|
|
182
202
|
children: t.title
|
|
183
203
|
})]
|
|
184
204
|
}), A.map((e) => {
|
|
185
205
|
let n = b(e, t.properties?.[e.id]);
|
|
186
|
-
return n ? /* @__PURE__ */
|
|
206
|
+
return n ? /* @__PURE__ */ _("p", {
|
|
187
207
|
className: "mt-1 truncate text-xs text-muted-foreground",
|
|
188
208
|
children: [
|
|
189
209
|
e.name,
|
|
@@ -198,4 +218,4 @@ function x({ workspace: e, space: t, docs: f, props: g, by: _ }) {
|
|
|
198
218
|
})
|
|
199
219
|
});
|
|
200
220
|
}
|
|
201
|
-
export {
|
|
221
|
+
export { w as DocTable, S as groupable, C as useSpaceDocs };
|