@openrails/contentkit-ui 0.95.1 → 0.97.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/README.md +9 -1
- package/dist/client/discovery.d.ts +2 -1
- package/dist/client/discovery.js.map +1 -1
- package/dist/client/entities.d.ts +6 -0
- package/dist/client/entities.js +13 -0
- package/dist/client/entities.js.map +1 -1
- package/dist/client/generated/routes.d.ts +26 -0
- package/dist/client/generated/routes.js +44 -0
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +7 -11
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/http.d.ts +1 -0
- package/dist/client/http.js +5 -4
- package/dist/client/http.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/reader-preferences.js +3 -7
- package/dist/client/reader-preferences.js.map +1 -1
- package/dist/components/admin/content-manager.d.ts +3 -1
- package/dist/components/admin/content-manager.js +241 -239
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/group-manager.js +133 -119
- package/dist/components/admin/group-manager.js.map +1 -1
- package/dist/components/content/editors.d.ts +1 -0
- package/dist/components/content/editors.js +1 -0
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/filters.d.ts +1 -1
- package/dist/components/content/filters.js +1 -1
- package/dist/components/content/filters.js.map +1 -1
- package/dist/components/groups/banner.d.ts +3 -1
- package/dist/components/groups/banner.js +29 -26
- package/dist/components/groups/banner.js.map +1 -1
- package/dist/components/groups/editor.d.ts +4 -1
- package/dist/components/groups/editor.js +369 -315
- package/dist/components/groups/editor.js.map +1 -1
- package/dist/components/groups/memberships.d.ts +2 -0
- package/dist/components/groups/memberships.js +1 -0
- package/dist/components/groups/memberships.js.map +1 -1
- package/dist/components/groups/parts.d.ts +4 -1
- package/dist/components/groups/parts.js +32 -30
- package/dist/components/groups/parts.js.map +1 -1
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/groups/de.js +2 -0
- package/dist/locales/groups/de.js.map +1 -1
- package/dist/locales/groups/en.d.ts +2 -0
- package/dist/locales/groups/en.js +2 -0
- package/dist/locales/groups/en.js.map +1 -1
- package/dist/locales/groups/es.js +2 -0
- package/dist/locales/groups/es.js.map +1 -1
- package/dist/locales/groups/ja.js +2 -0
- package/dist/locales/groups/ja.js.map +1 -1
- package/dist/locales/groups/ko.js +2 -0
- package/dist/locales/groups/ko.js.map +1 -1
- package/dist/locales/groups/zh.js +2 -0
- package/dist/locales/groups/zh.js.map +1 -1
- package/dist/react/discovery.d.ts +2 -1
- package/dist/react/discovery.js +54 -29
- package/dist/react/discovery.js.map +1 -1
- package/dist/react/groups.d.ts +3 -1
- package/dist/react/groups.js +7 -7
- package/dist/react/groups.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,53 +12,58 @@ import { Select as _, SelectContent as v, SelectItem as y, SelectTrigger as b, S
|
|
|
12
12
|
import { Skeleton as S } from "../../ui/skeleton.js";
|
|
13
13
|
import { Textarea as C } from "../../ui/textarea.js";
|
|
14
14
|
import { ErrorLine as w, contentError as T, useAction as E } from "../social/parts.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
15
|
+
import { Switch as D } from "../../ui/switch.js";
|
|
16
|
+
import { parseAttributes as O, slugify as k } from "../../client/group-fields.js";
|
|
17
|
+
import { GroupPicker as A, labelOf as j, useGroupNames as M } from "./parts.js";
|
|
18
|
+
import { OfferFields as N } from "../content/offer-fields.js";
|
|
19
|
+
import { AttributeFields as P, formOf as F } from "./fields.js";
|
|
20
|
+
import { GroupImageEditor as I } from "./banner.js";
|
|
21
|
+
import { useCallback as L, useEffect as R, useId as z, useRef as B, useState as V } from "react";
|
|
22
|
+
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
23
|
+
import { cn as G } from "cn";
|
|
23
24
|
//#region src/components/groups/editor.tsx
|
|
24
|
-
function
|
|
25
|
-
let { t } = n(), { kinds: i, loading: c } = o({ client: e.client }), l = a(e.id, {
|
|
25
|
+
function K(e) {
|
|
26
|
+
let { t } = n(), { kinds: i, loading: c } = o({ client: e.client }), l = a(e.id, {
|
|
27
|
+
client: e.client,
|
|
28
|
+
management: e.management
|
|
29
|
+
}), u = e.languages ?? i?.languages ?? ["en"], d = l.group?.kind ?? e.kind, f = i?.entity_kinds?.[d] ?? {}, p = (t) => /* @__PURE__ */ U(r, {
|
|
26
30
|
appearance: e.appearance,
|
|
27
|
-
className:
|
|
31
|
+
className: G("grid gap-6 text-sm", e.className),
|
|
28
32
|
"data-ckui": "group-editor",
|
|
29
33
|
"data-kind": d,
|
|
30
34
|
children: t
|
|
31
35
|
});
|
|
32
|
-
if (c) return p(/* @__PURE__ */
|
|
33
|
-
if (!e.id && !l.group && !l.loading) return p(/* @__PURE__ */
|
|
36
|
+
if (c) return p(/* @__PURE__ */ U(S, { className: "h-40 w-full" }));
|
|
37
|
+
if (!e.id && !l.group && !l.loading) return p(/* @__PURE__ */ U(ee, {
|
|
34
38
|
...e,
|
|
35
39
|
kind: d,
|
|
36
40
|
spec: f,
|
|
37
41
|
languages: u,
|
|
38
42
|
g: l
|
|
39
43
|
}));
|
|
40
|
-
if (l.deleted) return p(/* @__PURE__ */
|
|
44
|
+
if (l.deleted) return p(/* @__PURE__ */ U(Y, {
|
|
41
45
|
group: l.deleted,
|
|
42
46
|
onRestore: () => l.restore(),
|
|
43
47
|
onError: e.onError,
|
|
44
48
|
name: l.deleted.slug
|
|
45
49
|
}));
|
|
46
|
-
if (!l.group) return l.error ? p(/* @__PURE__ */
|
|
50
|
+
if (!l.group) return l.error ? p(/* @__PURE__ */ W("div", {
|
|
47
51
|
role: "alert",
|
|
48
52
|
className: "grid justify-items-start gap-2",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ U("p", {
|
|
50
54
|
className: "text-destructive",
|
|
51
55
|
children: t("groupEditor.loadFailed")
|
|
52
|
-
}), /* @__PURE__ */
|
|
56
|
+
}), /* @__PURE__ */ U(s, {
|
|
53
57
|
size: "sm",
|
|
54
58
|
variant: "outline",
|
|
55
59
|
onClick: l.reload,
|
|
56
60
|
children: t("common.retry")
|
|
57
61
|
})]
|
|
58
|
-
})) : p(/* @__PURE__ */
|
|
62
|
+
})) : p(/* @__PURE__ */ U(S, { className: "h-40 w-full" }));
|
|
59
63
|
let m = l.group;
|
|
60
|
-
return p(/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
64
|
+
return p(/* @__PURE__ */ W(H, { children: [
|
|
65
|
+
/* @__PURE__ */ U(X, {
|
|
66
|
+
management: e.management,
|
|
62
67
|
group: m,
|
|
63
68
|
g: l,
|
|
64
69
|
labels: e.labels,
|
|
@@ -67,7 +72,8 @@ function G(e) {
|
|
|
67
72
|
onError: e.onError,
|
|
68
73
|
client: e.client
|
|
69
74
|
}),
|
|
70
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ U(te, {
|
|
76
|
+
management: e.management,
|
|
71
77
|
group: m,
|
|
72
78
|
spec: f,
|
|
73
79
|
g: l,
|
|
@@ -75,30 +81,32 @@ function G(e) {
|
|
|
75
81
|
onError: e.onError,
|
|
76
82
|
client: e.client
|
|
77
83
|
}, m.id),
|
|
78
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ U(ne, {
|
|
79
85
|
group: m,
|
|
80
86
|
g: l,
|
|
81
87
|
languages: u,
|
|
82
88
|
onError: e.onError
|
|
83
89
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ U(re, {
|
|
85
91
|
group: m,
|
|
86
92
|
g: l,
|
|
87
93
|
languages: u,
|
|
88
94
|
onError: e.onError
|
|
89
95
|
}, m.id),
|
|
90
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ U(ie, {
|
|
97
|
+
management: e.management,
|
|
91
98
|
group: m,
|
|
92
99
|
spec: f,
|
|
93
100
|
onError: e.onError,
|
|
94
101
|
client: e.client
|
|
95
102
|
}),
|
|
96
|
-
f.sellable && /* @__PURE__ */
|
|
103
|
+
f.sellable && /* @__PURE__ */ U(ae, {
|
|
97
104
|
group: m,
|
|
98
105
|
onError: e.onError,
|
|
99
106
|
client: e.client
|
|
100
107
|
}),
|
|
101
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ U(se, {
|
|
109
|
+
management: e.management,
|
|
102
110
|
group: m,
|
|
103
111
|
g: l,
|
|
104
112
|
kinds: i,
|
|
@@ -109,212 +117,215 @@ function G(e) {
|
|
|
109
117
|
e.children?.(m)
|
|
110
118
|
] }));
|
|
111
119
|
}
|
|
112
|
-
function
|
|
113
|
-
let [n, r] =
|
|
114
|
-
return a.current = e,
|
|
120
|
+
function q(e, t) {
|
|
121
|
+
let [n, r] = V(e), i = B(!1), a = B(e);
|
|
122
|
+
return a.current = e, R(() => {
|
|
115
123
|
i.current || r(a.current());
|
|
116
124
|
}, [t]), [
|
|
117
125
|
n,
|
|
118
|
-
|
|
126
|
+
L((e) => {
|
|
119
127
|
i.current = !0, r(e);
|
|
120
128
|
}, []),
|
|
121
|
-
|
|
129
|
+
L(() => {
|
|
122
130
|
i.current = !1;
|
|
123
131
|
}, [])
|
|
124
132
|
];
|
|
125
133
|
}
|
|
126
|
-
function
|
|
127
|
-
return /* @__PURE__ */
|
|
134
|
+
function J({ title: e, children: t, ckui: n, action: r }) {
|
|
135
|
+
return /* @__PURE__ */ W("section", {
|
|
128
136
|
className: "grid gap-3",
|
|
129
137
|
"data-ckui": n,
|
|
130
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ W("div", {
|
|
131
139
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
132
|
-
children: [/* @__PURE__ */
|
|
140
|
+
children: [/* @__PURE__ */ U("h3", {
|
|
133
141
|
className: "font-medium",
|
|
134
142
|
children: e
|
|
135
143
|
}), r]
|
|
136
144
|
}), t]
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
|
-
function
|
|
147
|
+
function Y({ group: e, name: t, onRestore: r, onError: i }) {
|
|
140
148
|
let { t: a } = n(), o = E("group.save", i);
|
|
141
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ W("div", {
|
|
142
150
|
className: "grid justify-items-start gap-2",
|
|
143
151
|
"data-ckui": "group-deleted",
|
|
144
152
|
"data-state": e.state,
|
|
145
153
|
children: [
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ U("p", { children: a("groupEditor.deletedNotice", { name: t }) }),
|
|
155
|
+
/* @__PURE__ */ U(s, {
|
|
148
156
|
size: "sm",
|
|
149
157
|
variant: "outline",
|
|
150
158
|
disabled: o.pending,
|
|
151
159
|
onClick: () => void o.run(r),
|
|
152
160
|
children: a("groupEditor.restore")
|
|
153
161
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ U(w, { error: o.error })
|
|
155
163
|
]
|
|
156
164
|
});
|
|
157
165
|
}
|
|
158
|
-
function
|
|
159
|
-
let { t:
|
|
160
|
-
return /* @__PURE__ */
|
|
166
|
+
function X({ group: e, g: t, labels: r, onMerged: i, onDeleted: a, onError: o, client: h, management: g }) {
|
|
167
|
+
let { t: _ } = n(), [v, y] = V(!1), [b, x] = V(!1), S = E("group.save", o);
|
|
168
|
+
return /* @__PURE__ */ W("div", {
|
|
161
169
|
className: "flex flex-wrap items-center gap-2",
|
|
162
170
|
"data-ckui": "group-head",
|
|
163
171
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ U("h2", {
|
|
165
173
|
className: "text-base font-semibold break-words",
|
|
166
174
|
children: e.name || e.slug
|
|
167
175
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
176
|
+
/* @__PURE__ */ U(m, {
|
|
169
177
|
variant: "outline",
|
|
170
|
-
children:
|
|
178
|
+
children: j(r, e.kind)
|
|
171
179
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ W("div", {
|
|
173
181
|
className: "ms-auto flex flex-wrap gap-2",
|
|
174
|
-
children: [/* @__PURE__ */
|
|
182
|
+
children: [/* @__PURE__ */ U(s, {
|
|
175
183
|
size: "sm",
|
|
176
184
|
variant: "outline",
|
|
177
|
-
onClick: () =>
|
|
178
|
-
children:
|
|
179
|
-
}), /* @__PURE__ */
|
|
185
|
+
onClick: () => y(!0),
|
|
186
|
+
children: _("groupEditor.merge")
|
|
187
|
+
}), /* @__PURE__ */ U(s, {
|
|
180
188
|
size: "sm",
|
|
181
189
|
variant: "destructive",
|
|
182
|
-
disabled:
|
|
183
|
-
onClick: () =>
|
|
184
|
-
children:
|
|
190
|
+
disabled: S.pending,
|
|
191
|
+
onClick: () => x(!0),
|
|
192
|
+
children: _("groupEditor.delete")
|
|
185
193
|
})]
|
|
186
194
|
}),
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
error:
|
|
195
|
+
/* @__PURE__ */ U(w, {
|
|
196
|
+
error: S.error,
|
|
189
197
|
className: "basis-full"
|
|
190
198
|
}),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
open:
|
|
193
|
-
onOpenChange:
|
|
199
|
+
/* @__PURE__ */ U(Z, {
|
|
200
|
+
open: v,
|
|
201
|
+
onOpenChange: y,
|
|
194
202
|
group: e,
|
|
203
|
+
management: g,
|
|
195
204
|
client: h,
|
|
196
205
|
onMerge: async (e) => {
|
|
197
206
|
let n = await t.merge(e.id);
|
|
198
207
|
return i?.(n), n;
|
|
199
208
|
}
|
|
200
209
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
open:
|
|
203
|
-
onOpenChange:
|
|
204
|
-
children: /* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ U(c, {
|
|
211
|
+
open: b,
|
|
212
|
+
onOpenChange: x,
|
|
213
|
+
children: /* @__PURE__ */ W(l, {
|
|
205
214
|
"data-ckui": "group-delete-dialog",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
215
|
+
children: [/* @__PURE__ */ W(f, { children: [/* @__PURE__ */ U(p, { children: _("groupEditor.deleteTitle", { name: e.name || e.slug }) }), /* @__PURE__ */ U(u, { children: _("groupEditor.deleteBody") })] }), /* @__PURE__ */ W(d, { children: [/* @__PURE__ */ U(s, {
|
|
207
216
|
variant: "outline",
|
|
208
|
-
onClick: () =>
|
|
209
|
-
children:
|
|
210
|
-
}), /* @__PURE__ */
|
|
217
|
+
onClick: () => x(!1),
|
|
218
|
+
children: _("common.cancel")
|
|
219
|
+
}), /* @__PURE__ */ U(s, {
|
|
211
220
|
variant: "destructive",
|
|
212
|
-
disabled:
|
|
221
|
+
disabled: S.pending,
|
|
213
222
|
onClick: () => {
|
|
214
|
-
|
|
223
|
+
x(!1), S.run(t.remove).then((e) => e && a?.(e));
|
|
215
224
|
},
|
|
216
|
-
children:
|
|
225
|
+
children: _("groupEditor.delete")
|
|
217
226
|
})] })]
|
|
218
227
|
})
|
|
219
228
|
})
|
|
220
229
|
]
|
|
221
230
|
});
|
|
222
231
|
}
|
|
223
|
-
function
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
t && (
|
|
232
|
+
function Z({ open: t, onOpenChange: r, group: i, onMerge: a, language: o, client: m, management: _ }) {
|
|
233
|
+
let v = n(), { t: y } = v, b = z(), [x, S] = V(null), [C, E] = V(""), [D, O] = V(!1), [k, j] = V(null);
|
|
234
|
+
R(() => {
|
|
235
|
+
t && (S(null), E(""), j(null));
|
|
227
236
|
}, [t]);
|
|
228
|
-
let
|
|
229
|
-
return /* @__PURE__ */
|
|
237
|
+
let M = y("groupEditor.mergeWord"), N = !!x && C.trim().toLowerCase() === M.toLowerCase(), P = i.name || i.slug;
|
|
238
|
+
return /* @__PURE__ */ U(c, {
|
|
230
239
|
open: t,
|
|
231
240
|
onOpenChange: r,
|
|
232
|
-
children: /* @__PURE__ */
|
|
241
|
+
children: /* @__PURE__ */ W(l, {
|
|
233
242
|
"data-ckui": "group-merge-dialog",
|
|
234
243
|
children: [
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
|
|
244
|
+
/* @__PURE__ */ W(f, { children: [/* @__PURE__ */ U(p, { children: y("groupEditor.mergeTitle", { name: P }) }), /* @__PURE__ */ U(u, { children: y("groupEditor.mergeBody") })] }),
|
|
245
|
+
x ? /* @__PURE__ */ W("div", {
|
|
237
246
|
className: "flex flex-wrap items-center gap-2",
|
|
238
247
|
"data-ckui": "merge-target",
|
|
239
|
-
children: [/* @__PURE__ */
|
|
248
|
+
children: [/* @__PURE__ */ U("span", { children: y("groupEditor.mergeInto", { name: x.name || x.slug }) }), /* @__PURE__ */ U(s, {
|
|
240
249
|
size: "xs",
|
|
241
250
|
variant: "ghost",
|
|
242
|
-
onClick: () =>
|
|
243
|
-
children:
|
|
251
|
+
onClick: () => S(null),
|
|
252
|
+
children: y("groupEditor.change")
|
|
244
253
|
})]
|
|
245
|
-
}) : /* @__PURE__ */
|
|
254
|
+
}) : /* @__PURE__ */ U(A, {
|
|
255
|
+
management: _,
|
|
246
256
|
kind: i.kind,
|
|
247
257
|
language: o,
|
|
248
258
|
exclude: [i.id],
|
|
249
|
-
label:
|
|
250
|
-
onPick:
|
|
259
|
+
label: y("groupEditor.mergeTarget"),
|
|
260
|
+
onPick: S,
|
|
251
261
|
client: m,
|
|
252
262
|
autoFocus: !0
|
|
253
263
|
}),
|
|
254
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ W("div", {
|
|
255
265
|
className: "grid gap-1.5",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
257
|
-
htmlFor: `${
|
|
258
|
-
children:
|
|
259
|
-
}), /* @__PURE__ */
|
|
260
|
-
id: `${
|
|
261
|
-
value:
|
|
266
|
+
children: [/* @__PURE__ */ U(g, {
|
|
267
|
+
htmlFor: `${b}-typed`,
|
|
268
|
+
children: y("admin.typeToConfirm", { word: M })
|
|
269
|
+
}), /* @__PURE__ */ U(h, {
|
|
270
|
+
id: `${b}-typed`,
|
|
271
|
+
value: C,
|
|
262
272
|
autoComplete: "off",
|
|
263
|
-
onChange: (e) =>
|
|
273
|
+
onChange: (e) => E(e.target.value)
|
|
264
274
|
})]
|
|
265
275
|
}),
|
|
266
|
-
|
|
267
|
-
/* @__PURE__ */
|
|
276
|
+
k && /* @__PURE__ */ U(w, { children: T(v, k) }),
|
|
277
|
+
/* @__PURE__ */ W(d, { children: [/* @__PURE__ */ U(s, {
|
|
268
278
|
variant: "outline",
|
|
269
279
|
onClick: () => r(!1),
|
|
270
|
-
children:
|
|
271
|
-
}), /* @__PURE__ */
|
|
280
|
+
children: y("common.cancel")
|
|
281
|
+
}), /* @__PURE__ */ U(s, {
|
|
272
282
|
variant: "destructive",
|
|
273
|
-
disabled: !
|
|
283
|
+
disabled: !N || D,
|
|
274
284
|
onClick: async () => {
|
|
275
|
-
if (
|
|
276
|
-
|
|
285
|
+
if (x) {
|
|
286
|
+
O(!0), j(null);
|
|
277
287
|
try {
|
|
278
|
-
await a(
|
|
288
|
+
await a(x), r(!1);
|
|
279
289
|
} catch (t) {
|
|
280
|
-
|
|
290
|
+
j(e(t));
|
|
281
291
|
} finally {
|
|
282
|
-
|
|
292
|
+
O(!1);
|
|
283
293
|
}
|
|
284
294
|
}
|
|
285
295
|
},
|
|
286
|
-
children:
|
|
296
|
+
children: y("groupEditor.merge")
|
|
287
297
|
})] })
|
|
288
298
|
]
|
|
289
299
|
})
|
|
290
300
|
});
|
|
291
301
|
}
|
|
292
|
-
function
|
|
293
|
-
let { t:
|
|
294
|
-
return /* @__PURE__ */
|
|
302
|
+
function Q({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o, client: c, management: l }) {
|
|
303
|
+
let { t: u } = n();
|
|
304
|
+
return /* @__PURE__ */ W("div", {
|
|
295
305
|
className: "grid gap-1.5",
|
|
296
306
|
"data-ckui": "group-field",
|
|
297
|
-
children: [/* @__PURE__ */
|
|
307
|
+
children: [/* @__PURE__ */ W("span", {
|
|
298
308
|
className: "text-sm font-medium",
|
|
299
|
-
children: [e, o && /* @__PURE__ */
|
|
309
|
+
children: [e, o && /* @__PURE__ */ U("span", {
|
|
300
310
|
"aria-hidden": !0,
|
|
301
311
|
children: " *"
|
|
302
312
|
})]
|
|
303
|
-
}), r ? /* @__PURE__ */
|
|
313
|
+
}), r ? /* @__PURE__ */ W("div", {
|
|
304
314
|
className: "flex flex-wrap items-center gap-2",
|
|
305
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ U("span", {
|
|
306
316
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
307
317
|
"data-ckui": "group-field-value",
|
|
308
318
|
children: r.name || r.slug
|
|
309
|
-
}), /* @__PURE__ */
|
|
319
|
+
}), /* @__PURE__ */ U(s, {
|
|
310
320
|
type: "button",
|
|
311
321
|
size: "xs",
|
|
312
322
|
variant: "ghost",
|
|
313
323
|
onClick: () => i(null),
|
|
314
|
-
"aria-label":
|
|
315
|
-
children:
|
|
324
|
+
"aria-label": u("groupEditor.clearField", { field: e }),
|
|
325
|
+
children: u(o ? "groupEditor.change" : "common.remove")
|
|
316
326
|
})]
|
|
317
|
-
}) : /* @__PURE__ */
|
|
327
|
+
}) : /* @__PURE__ */ U(A, {
|
|
328
|
+
management: l,
|
|
318
329
|
kind: t,
|
|
319
330
|
label: e,
|
|
320
331
|
exclude: a,
|
|
@@ -323,233 +334,270 @@ function Z({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o,
|
|
|
323
334
|
})]
|
|
324
335
|
});
|
|
325
336
|
}
|
|
326
|
-
function
|
|
327
|
-
let
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
}, [
|
|
331
|
-
let
|
|
332
|
-
|
|
337
|
+
function ee({ kind: e, spec: r, languages: i, labels: a, g: o, onCreated: c, onError: l, client: u, management: d }) {
|
|
338
|
+
let f = n(), { t: p } = f, m = z(), _ = t(), [v, y] = V({}), [b, x] = V(""), [S, C] = V(!1), [D, A] = V(!1), [M, N] = V(null), [I, L] = V(null), B = r.attributes ?? {}, [H, G] = V(() => F(B, {})), [K, q] = V(null), J = E("group.save", l), Y = v[i[0]] ?? "";
|
|
339
|
+
R(() => {
|
|
340
|
+
S || x(k(Y));
|
|
341
|
+
}, [Y, S]);
|
|
342
|
+
let X = async () => {
|
|
343
|
+
q(null);
|
|
333
344
|
let t;
|
|
334
345
|
try {
|
|
335
|
-
t =
|
|
346
|
+
t = O(B, H);
|
|
336
347
|
} catch (e) {
|
|
337
|
-
|
|
348
|
+
q(e.message);
|
|
338
349
|
return;
|
|
339
350
|
}
|
|
340
|
-
let n = i.filter((e) =>
|
|
351
|
+
let n = i.filter((e) => v[e]?.trim()).map((e) => ({
|
|
341
352
|
language: e,
|
|
342
353
|
kind: "name",
|
|
343
|
-
name:
|
|
344
|
-
})), r = await
|
|
354
|
+
name: v[e].trim()
|
|
355
|
+
})), r = await J.run(() => o.create({
|
|
345
356
|
kind: e,
|
|
346
|
-
slug:
|
|
357
|
+
slug: b.trim(),
|
|
358
|
+
...d ? { internal: D } : {},
|
|
347
359
|
names: n,
|
|
348
|
-
parent_id:
|
|
349
|
-
scope_id:
|
|
360
|
+
parent_id: M?.id,
|
|
361
|
+
scope_id: I?.id,
|
|
350
362
|
attributes: Object.keys(t).length ? t : void 0
|
|
351
363
|
}));
|
|
352
364
|
r && c?.(r);
|
|
353
365
|
};
|
|
354
|
-
return /* @__PURE__ */
|
|
366
|
+
return /* @__PURE__ */ W("form", {
|
|
355
367
|
className: "grid gap-4",
|
|
356
368
|
"data-ckui": "group-create",
|
|
357
369
|
onSubmit: (e) => {
|
|
358
|
-
e.preventDefault(),
|
|
370
|
+
e.preventDefault(), X();
|
|
359
371
|
},
|
|
360
372
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ U("h2", {
|
|
362
374
|
className: "text-base font-semibold",
|
|
363
|
-
children:
|
|
375
|
+
children: p("groupEditor.newTitle", { kind: j(a, e) })
|
|
364
376
|
}),
|
|
365
|
-
i.map((e, t) => /* @__PURE__ */
|
|
377
|
+
i.map((e, t) => /* @__PURE__ */ W("div", {
|
|
366
378
|
className: "grid gap-1.5",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
368
|
-
htmlFor: `${
|
|
369
|
-
children:
|
|
370
|
-
}), /* @__PURE__ */
|
|
371
|
-
id: `${
|
|
379
|
+
children: [/* @__PURE__ */ U(g, {
|
|
380
|
+
htmlFor: `${m}-${e}`,
|
|
381
|
+
children: p("groupEditor.nameIn", { language: _(e) })
|
|
382
|
+
}), /* @__PURE__ */ U(h, {
|
|
383
|
+
id: `${m}-${e}`,
|
|
372
384
|
className: "h-8",
|
|
373
385
|
lang: e,
|
|
374
386
|
required: t === 0,
|
|
375
|
-
value:
|
|
376
|
-
onChange: (t) =>
|
|
387
|
+
value: v[e] ?? "",
|
|
388
|
+
onChange: (t) => y((n) => ({
|
|
377
389
|
...n,
|
|
378
390
|
[e]: t.target.value
|
|
379
391
|
}))
|
|
380
392
|
})]
|
|
381
393
|
}, e)),
|
|
382
|
-
/* @__PURE__ */
|
|
394
|
+
/* @__PURE__ */ W("div", {
|
|
383
395
|
className: "grid gap-1.5",
|
|
384
|
-
children: [/* @__PURE__ */
|
|
385
|
-
htmlFor: `${
|
|
386
|
-
children:
|
|
387
|
-
}), /* @__PURE__ */
|
|
388
|
-
id: `${
|
|
396
|
+
children: [/* @__PURE__ */ U(g, {
|
|
397
|
+
htmlFor: `${m}-slug`,
|
|
398
|
+
children: p("groupEditor.slug")
|
|
399
|
+
}), /* @__PURE__ */ U(h, {
|
|
400
|
+
id: `${m}-slug`,
|
|
389
401
|
className: "h-8",
|
|
390
402
|
required: !0,
|
|
391
|
-
value:
|
|
403
|
+
value: b,
|
|
392
404
|
onChange: (e) => {
|
|
393
|
-
|
|
405
|
+
C(!0), x(e.target.value);
|
|
394
406
|
}
|
|
395
407
|
})]
|
|
396
408
|
}),
|
|
397
|
-
r.scoped_by && /* @__PURE__ */
|
|
398
|
-
|
|
409
|
+
r.scoped_by && /* @__PURE__ */ U(Q, {
|
|
410
|
+
management: d,
|
|
411
|
+
label: j(a, r.scoped_by),
|
|
399
412
|
kind: r.scoped_by,
|
|
400
|
-
value:
|
|
401
|
-
onChange:
|
|
413
|
+
value: I,
|
|
414
|
+
onChange: L,
|
|
402
415
|
required: !0,
|
|
403
416
|
client: u
|
|
404
417
|
}),
|
|
405
|
-
r.parent && /* @__PURE__ */
|
|
406
|
-
|
|
418
|
+
r.parent && /* @__PURE__ */ U(Q, {
|
|
419
|
+
management: d,
|
|
420
|
+
label: p("groupEditor.parent"),
|
|
407
421
|
kind: r.parent,
|
|
408
|
-
value:
|
|
409
|
-
onChange:
|
|
422
|
+
value: M,
|
|
423
|
+
onChange: N,
|
|
410
424
|
client: u
|
|
411
425
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
onChange:
|
|
426
|
+
d && /* @__PURE__ */ U($, {
|
|
427
|
+
id: `${m}-internal`,
|
|
428
|
+
checked: D,
|
|
429
|
+
onChange: A
|
|
430
|
+
}),
|
|
431
|
+
/* @__PURE__ */ U(P, {
|
|
432
|
+
declared: B,
|
|
433
|
+
form: H,
|
|
434
|
+
onChange: (e, t) => G((n) => ({
|
|
416
435
|
...n,
|
|
417
436
|
[e]: t
|
|
418
437
|
})),
|
|
419
438
|
labels: a
|
|
420
439
|
}),
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
/* @__PURE__ */
|
|
440
|
+
K && /* @__PURE__ */ U(w, { children: K }),
|
|
441
|
+
J.error && /* @__PURE__ */ U(w, { children: T(f, J.error) }),
|
|
442
|
+
/* @__PURE__ */ U(s, {
|
|
424
443
|
type: "submit",
|
|
425
444
|
className: "justify-self-start",
|
|
426
|
-
disabled:
|
|
427
|
-
children:
|
|
445
|
+
disabled: J.pending || !Y.trim() || !b.trim() || !!r.scoped_by && !I,
|
|
446
|
+
children: J.pending ? p("common.saving") : p("groupEditor.create")
|
|
428
447
|
})
|
|
429
448
|
]
|
|
430
449
|
});
|
|
431
450
|
}
|
|
432
|
-
function $({
|
|
433
|
-
let { t:
|
|
451
|
+
function $({ id: e, checked: t, onChange: r }) {
|
|
452
|
+
let { t: i } = n();
|
|
453
|
+
return /* @__PURE__ */ W("div", {
|
|
454
|
+
className: "flex items-start gap-3",
|
|
455
|
+
children: [/* @__PURE__ */ U(D, {
|
|
456
|
+
id: e,
|
|
457
|
+
checked: t,
|
|
458
|
+
onCheckedChange: r
|
|
459
|
+
}), /* @__PURE__ */ W("div", {
|
|
460
|
+
className: "grid gap-1",
|
|
461
|
+
children: [/* @__PURE__ */ U(g, {
|
|
462
|
+
htmlFor: e,
|
|
463
|
+
children: i("groupEditor.internal")
|
|
464
|
+
}), /* @__PURE__ */ U("p", {
|
|
465
|
+
className: "text-xs text-muted-foreground",
|
|
466
|
+
children: i("groupEditor.internalHint")
|
|
467
|
+
})]
|
|
468
|
+
})]
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function te({ group: e, spec: t, g: r, labels: i, onError: a, client: o, management: c }) {
|
|
472
|
+
let { t: l } = n(), u = z(), d = t.attributes ?? {}, [f, p, m] = q(() => ({
|
|
434
473
|
slug: e.slug,
|
|
474
|
+
internal: e.internal ?? !1,
|
|
435
475
|
parent: e.parent ?? null,
|
|
436
476
|
scope: e.scope ?? null,
|
|
437
|
-
attrs:
|
|
438
|
-
}), e.revision), { slug:
|
|
439
|
-
|
|
477
|
+
attrs: F(d, e.attributes)
|
|
478
|
+
}), e.revision), { slug: _, internal: v, parent: y, scope: b, attrs: x } = f, S = (e) => {
|
|
479
|
+
I(!1), p((t) => ({
|
|
440
480
|
...t,
|
|
441
481
|
...e
|
|
442
482
|
}));
|
|
443
|
-
},
|
|
444
|
-
|
|
483
|
+
}, C = (e) => S({ slug: e }), T = (e) => S({ parent: e }), D = (e) => S({ scope: e }), k = (e) => S({ attrs: e(x) }), [A, M] = V(null), [N, I] = V(!1), L = E("group.save", a), R = async () => {
|
|
484
|
+
M(null), I(!1);
|
|
445
485
|
let e;
|
|
446
486
|
try {
|
|
447
|
-
e =
|
|
487
|
+
e = O(d, x);
|
|
448
488
|
} catch (e) {
|
|
449
|
-
|
|
489
|
+
M(e.message);
|
|
450
490
|
return;
|
|
451
491
|
}
|
|
452
|
-
await
|
|
453
|
-
slug:
|
|
492
|
+
await L.run(() => r.update({
|
|
493
|
+
slug: _.trim(),
|
|
494
|
+
...c ? { internal: v } : {},
|
|
454
495
|
attributes: e,
|
|
455
|
-
...t.parent ? { parent_id:
|
|
456
|
-
...t.scoped_by &&
|
|
457
|
-
})) && (
|
|
496
|
+
...t.parent ? { parent_id: y?.id ?? "" } : {},
|
|
497
|
+
...t.scoped_by && b ? { scope_id: b.id } : {}
|
|
498
|
+
})) && (m(), I(!0));
|
|
458
499
|
};
|
|
459
|
-
return /* @__PURE__ */
|
|
460
|
-
title:
|
|
500
|
+
return /* @__PURE__ */ U(J, {
|
|
501
|
+
title: l("groupEditor.details"),
|
|
461
502
|
ckui: "group-details",
|
|
462
|
-
children: /* @__PURE__ */
|
|
503
|
+
children: /* @__PURE__ */ W("form", {
|
|
463
504
|
className: "grid gap-3",
|
|
464
505
|
onSubmit: (e) => {
|
|
465
|
-
e.preventDefault(),
|
|
506
|
+
e.preventDefault(), R();
|
|
466
507
|
},
|
|
467
508
|
children: [
|
|
468
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ W("div", {
|
|
469
510
|
className: "grid gap-1.5",
|
|
470
|
-
children: [/* @__PURE__ */
|
|
471
|
-
htmlFor: `${
|
|
472
|
-
children:
|
|
473
|
-
}), /* @__PURE__ */
|
|
474
|
-
id: `${
|
|
511
|
+
children: [/* @__PURE__ */ U(g, {
|
|
512
|
+
htmlFor: `${u}-slug`,
|
|
513
|
+
children: l("groupEditor.slug")
|
|
514
|
+
}), /* @__PURE__ */ U(h, {
|
|
515
|
+
id: `${u}-slug`,
|
|
475
516
|
className: "h-8",
|
|
476
517
|
required: !0,
|
|
477
|
-
value:
|
|
478
|
-
onChange: (e) =>
|
|
518
|
+
value: _,
|
|
519
|
+
onChange: (e) => C(e.target.value)
|
|
479
520
|
})]
|
|
480
521
|
}),
|
|
481
|
-
t.scoped_by && /* @__PURE__ */
|
|
482
|
-
|
|
522
|
+
t.scoped_by && /* @__PURE__ */ U(Q, {
|
|
523
|
+
management: c,
|
|
524
|
+
label: j(i, t.scoped_by),
|
|
483
525
|
kind: t.scoped_by,
|
|
484
|
-
value:
|
|
485
|
-
onChange:
|
|
526
|
+
value: b,
|
|
527
|
+
onChange: D,
|
|
486
528
|
required: !0,
|
|
487
529
|
client: o
|
|
488
530
|
}),
|
|
489
|
-
t.parent && /* @__PURE__ */
|
|
490
|
-
|
|
531
|
+
t.parent && /* @__PURE__ */ U(Q, {
|
|
532
|
+
management: c,
|
|
533
|
+
label: l("groupEditor.parent"),
|
|
491
534
|
kind: t.parent,
|
|
492
|
-
value:
|
|
493
|
-
onChange:
|
|
535
|
+
value: y,
|
|
536
|
+
onChange: T,
|
|
494
537
|
exclude: [e.id],
|
|
495
538
|
client: o
|
|
496
539
|
}),
|
|
497
|
-
/* @__PURE__ */
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
onChange: (e
|
|
540
|
+
c && /* @__PURE__ */ U($, {
|
|
541
|
+
id: `${u}-internal`,
|
|
542
|
+
checked: v,
|
|
543
|
+
onChange: (e) => S({ internal: e })
|
|
544
|
+
}),
|
|
545
|
+
/* @__PURE__ */ U(P, {
|
|
546
|
+
declared: d,
|
|
547
|
+
form: x,
|
|
548
|
+
onChange: (e, t) => k((n) => ({
|
|
501
549
|
...n,
|
|
502
550
|
[e]: t
|
|
503
551
|
})),
|
|
504
552
|
labels: i
|
|
505
553
|
}),
|
|
506
|
-
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
554
|
+
A && /* @__PURE__ */ U(w, { children: A }),
|
|
555
|
+
/* @__PURE__ */ U(w, { error: L.error }),
|
|
556
|
+
/* @__PURE__ */ W("div", {
|
|
509
557
|
className: "flex items-center gap-3",
|
|
510
|
-
children: [/* @__PURE__ */
|
|
558
|
+
children: [/* @__PURE__ */ U(s, {
|
|
511
559
|
type: "submit",
|
|
512
560
|
size: "sm",
|
|
513
|
-
disabled:
|
|
514
|
-
children:
|
|
515
|
-
}),
|
|
561
|
+
disabled: L.pending || !_.trim() || !!t.scoped_by && !b,
|
|
562
|
+
children: L.pending ? l("common.saving") : l("common.save")
|
|
563
|
+
}), N && /* @__PURE__ */ U("span", {
|
|
516
564
|
role: "status",
|
|
517
565
|
className: "text-muted-foreground",
|
|
518
|
-
children:
|
|
566
|
+
children: l("groupEditor.saved")
|
|
519
567
|
})]
|
|
520
568
|
})
|
|
521
569
|
]
|
|
522
570
|
})
|
|
523
571
|
});
|
|
524
572
|
}
|
|
525
|
-
function
|
|
526
|
-
let { t: o } = n(), c =
|
|
527
|
-
return /* @__PURE__ */
|
|
573
|
+
function ne({ group: e, g: r, languages: i, onError: a }) {
|
|
574
|
+
let { t: o } = n(), c = z(), l = t(), [u, d] = V(i[0]), [f, p] = V("alias"), [S, C] = V(""), T = E("group.save", a), D = [...e.names].sort((e, t) => e.language.localeCompare(t.language) || (e.kind === t.kind ? e.name.localeCompare(t.name) : e.kind === "name" ? -1 : 1)), O = [.../* @__PURE__ */ new Set([...i, ...e.names.map((e) => e.language)])];
|
|
575
|
+
return /* @__PURE__ */ W(J, {
|
|
528
576
|
title: o("groupEditor.names"),
|
|
529
577
|
ckui: "group-names-editor",
|
|
530
578
|
children: [
|
|
531
|
-
D.length ? /* @__PURE__ */
|
|
579
|
+
D.length ? /* @__PURE__ */ U("ul", {
|
|
532
580
|
className: "grid divide-y divide-border rounded-lg border border-border",
|
|
533
|
-
children: D.map((e) => /* @__PURE__ */
|
|
581
|
+
children: D.map((e) => /* @__PURE__ */ W("li", {
|
|
534
582
|
className: "flex flex-wrap items-center gap-2 p-2.5",
|
|
535
583
|
"data-ckui": "group-name",
|
|
536
584
|
"data-kind": e.kind,
|
|
537
585
|
"data-language": e.language,
|
|
538
586
|
children: [
|
|
539
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ U(m, {
|
|
540
588
|
variant: "outline",
|
|
541
589
|
children: l(e.language)
|
|
542
590
|
}),
|
|
543
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ U("span", {
|
|
544
592
|
className: "min-w-0 flex-1 break-words",
|
|
545
593
|
lang: e.language,
|
|
546
594
|
children: e.name
|
|
547
595
|
}),
|
|
548
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ U("span", {
|
|
549
597
|
className: "text-xs text-muted-foreground",
|
|
550
598
|
children: o(e.kind === "name" ? "groupEditor.canonical" : "groupEditor.alias")
|
|
551
599
|
}),
|
|
552
|
-
e.kind === "alias" && /* @__PURE__ */
|
|
600
|
+
e.kind === "alias" && /* @__PURE__ */ U(s, {
|
|
553
601
|
size: "xs",
|
|
554
602
|
variant: "ghost",
|
|
555
603
|
disabled: T.pending,
|
|
@@ -559,7 +607,7 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
|
559
607
|
}])),
|
|
560
608
|
children: o("groupEditor.makeCanonical")
|
|
561
609
|
}),
|
|
562
|
-
/* @__PURE__ */
|
|
610
|
+
/* @__PURE__ */ U(s, {
|
|
563
611
|
size: "xs",
|
|
564
612
|
variant: "ghost",
|
|
565
613
|
disabled: T.pending,
|
|
@@ -569,11 +617,11 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
|
569
617
|
})
|
|
570
618
|
]
|
|
571
619
|
}, `${e.language}:${e.kind}:${e.name}`))
|
|
572
|
-
}) : /* @__PURE__ */
|
|
620
|
+
}) : /* @__PURE__ */ U("p", {
|
|
573
621
|
className: "text-muted-foreground",
|
|
574
622
|
children: o("groupEditor.noNames")
|
|
575
623
|
}),
|
|
576
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ W("form", {
|
|
577
625
|
className: "flex flex-wrap items-end gap-2",
|
|
578
626
|
onSubmit: (e) => {
|
|
579
627
|
e.preventDefault();
|
|
@@ -585,39 +633,39 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
|
585
633
|
}])).then((e) => e && C(""));
|
|
586
634
|
},
|
|
587
635
|
children: [
|
|
588
|
-
O.length > 1 && /* @__PURE__ */
|
|
636
|
+
O.length > 1 && /* @__PURE__ */ W(_, {
|
|
589
637
|
value: u,
|
|
590
638
|
onValueChange: (e) => d(String(e)),
|
|
591
|
-
children: [/* @__PURE__ */
|
|
639
|
+
children: [/* @__PURE__ */ U(b, {
|
|
592
640
|
size: "sm",
|
|
593
641
|
"aria-label": o("groupEditor.language"),
|
|
594
|
-
children: /* @__PURE__ */
|
|
595
|
-
}), /* @__PURE__ */
|
|
642
|
+
children: /* @__PURE__ */ U(x, { children: (e) => l(e) })
|
|
643
|
+
}), /* @__PURE__ */ U(v, { children: O.map((e) => /* @__PURE__ */ U(y, {
|
|
596
644
|
value: e,
|
|
597
645
|
children: l(e)
|
|
598
646
|
}, e)) })]
|
|
599
647
|
}),
|
|
600
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ W(_, {
|
|
601
649
|
value: f,
|
|
602
650
|
onValueChange: (e) => p(e),
|
|
603
|
-
children: [/* @__PURE__ */
|
|
651
|
+
children: [/* @__PURE__ */ U(b, {
|
|
604
652
|
size: "sm",
|
|
605
653
|
"aria-label": o("groupEditor.nameKind"),
|
|
606
|
-
children: /* @__PURE__ */
|
|
607
|
-
}), /* @__PURE__ */
|
|
654
|
+
children: /* @__PURE__ */ U(x, { children: (e) => o(e === "name" ? "groupEditor.canonical" : "groupEditor.alias") })
|
|
655
|
+
}), /* @__PURE__ */ W(v, { children: [/* @__PURE__ */ U(y, {
|
|
608
656
|
value: "alias",
|
|
609
657
|
children: o("groupEditor.alias")
|
|
610
|
-
}), /* @__PURE__ */
|
|
658
|
+
}), /* @__PURE__ */ U(y, {
|
|
611
659
|
value: "name",
|
|
612
660
|
children: o("groupEditor.canonical")
|
|
613
661
|
})] })]
|
|
614
662
|
}),
|
|
615
|
-
/* @__PURE__ */
|
|
663
|
+
/* @__PURE__ */ U(g, {
|
|
616
664
|
htmlFor: `${c}-name`,
|
|
617
665
|
className: "sr-only",
|
|
618
666
|
children: o("groupEditor.newName")
|
|
619
667
|
}),
|
|
620
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ U(h, {
|
|
621
669
|
id: `${c}-name`,
|
|
622
670
|
className: "h-8 min-w-40 flex-1",
|
|
623
671
|
lang: u,
|
|
@@ -625,7 +673,7 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
|
625
673
|
placeholder: o("groupEditor.newName"),
|
|
626
674
|
onChange: (e) => C(e.target.value)
|
|
627
675
|
}),
|
|
628
|
-
/* @__PURE__ */
|
|
676
|
+
/* @__PURE__ */ U(s, {
|
|
629
677
|
type: "submit",
|
|
630
678
|
size: "sm",
|
|
631
679
|
variant: "outline",
|
|
@@ -634,12 +682,12 @@ function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
|
634
682
|
})
|
|
635
683
|
]
|
|
636
684
|
}),
|
|
637
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ U(w, { error: T.error })
|
|
638
686
|
]
|
|
639
687
|
});
|
|
640
688
|
}
|
|
641
|
-
function
|
|
642
|
-
let { t: o } = n(), c =
|
|
689
|
+
function re({ group: e, g: r, languages: i, onError: a }) {
|
|
690
|
+
let { t: o } = n(), c = z(), l = t(), u = [.../* @__PURE__ */ new Set([...i, ...e.text.map((e) => e.language)])], [d, f, p] = q(() => Object.fromEntries(u.map((t) => [t, e.text.find((e) => e.language === t) ?? { language: t }])), e.revision), [m, _] = V(!1), v = E("group.save", a), y = (e, t) => {
|
|
643
691
|
_(!1), f((n) => ({
|
|
644
692
|
...n,
|
|
645
693
|
[e]: {
|
|
@@ -648,10 +696,10 @@ function te({ group: e, g: r, languages: i, onError: a }) {
|
|
|
648
696
|
}
|
|
649
697
|
}));
|
|
650
698
|
};
|
|
651
|
-
return /* @__PURE__ */
|
|
699
|
+
return /* @__PURE__ */ U(J, {
|
|
652
700
|
title: o("groupEditor.text"),
|
|
653
701
|
ckui: "group-text",
|
|
654
|
-
children: /* @__PURE__ */
|
|
702
|
+
children: /* @__PURE__ */ W("form", {
|
|
655
703
|
className: "grid gap-4",
|
|
656
704
|
onSubmit: (e) => {
|
|
657
705
|
e.preventDefault();
|
|
@@ -665,20 +713,20 @@ function te({ group: e, g: r, languages: i, onError: a }) {
|
|
|
665
713
|
});
|
|
666
714
|
},
|
|
667
715
|
children: [
|
|
668
|
-
u.map((e) => /* @__PURE__ */
|
|
716
|
+
u.map((e) => /* @__PURE__ */ W("fieldset", {
|
|
669
717
|
className: "grid gap-2",
|
|
670
718
|
"data-language": e,
|
|
671
719
|
children: [
|
|
672
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ U("legend", {
|
|
673
721
|
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
674
722
|
children: l(e)
|
|
675
723
|
}),
|
|
676
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ U(g, {
|
|
677
725
|
htmlFor: `${c}-${e}-d`,
|
|
678
726
|
className: "sr-only",
|
|
679
727
|
children: o("groupEditor.descriptionIn", { language: l(e) })
|
|
680
728
|
}),
|
|
681
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ U(C, {
|
|
682
730
|
id: `${c}-${e}-d`,
|
|
683
731
|
lang: e,
|
|
684
732
|
rows: 3,
|
|
@@ -686,12 +734,12 @@ function te({ group: e, g: r, languages: i, onError: a }) {
|
|
|
686
734
|
value: d[e]?.description ?? "",
|
|
687
735
|
onChange: (t) => y(e, { description: t.target.value })
|
|
688
736
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ U(g, {
|
|
690
738
|
htmlFor: `${c}-${e}-s`,
|
|
691
739
|
className: "sr-only",
|
|
692
740
|
children: o("groupEditor.sortKeyIn", { language: l(e) })
|
|
693
741
|
}),
|
|
694
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ U(h, {
|
|
695
743
|
id: `${c}-${e}-s`,
|
|
696
744
|
className: "h-8",
|
|
697
745
|
lang: e,
|
|
@@ -701,15 +749,15 @@ function te({ group: e, g: r, languages: i, onError: a }) {
|
|
|
701
749
|
})
|
|
702
750
|
]
|
|
703
751
|
}, e)),
|
|
704
|
-
/* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
752
|
+
/* @__PURE__ */ U(w, { error: v.error }),
|
|
753
|
+
/* @__PURE__ */ W("div", {
|
|
706
754
|
className: "flex items-center gap-3",
|
|
707
|
-
children: [/* @__PURE__ */
|
|
755
|
+
children: [/* @__PURE__ */ U(s, {
|
|
708
756
|
type: "submit",
|
|
709
757
|
size: "sm",
|
|
710
758
|
disabled: v.pending,
|
|
711
759
|
children: v.pending ? o("common.saving") : o("common.save")
|
|
712
|
-
}), m && /* @__PURE__ */
|
|
760
|
+
}), m && /* @__PURE__ */ U("span", {
|
|
713
761
|
role: "status",
|
|
714
762
|
className: "text-muted-foreground",
|
|
715
763
|
children: o("groupEditor.saved")
|
|
@@ -719,24 +767,26 @@ function te({ group: e, g: r, languages: i, onError: a }) {
|
|
|
719
767
|
})
|
|
720
768
|
});
|
|
721
769
|
}
|
|
722
|
-
function
|
|
723
|
-
let { t:
|
|
724
|
-
return /* @__PURE__ */
|
|
725
|
-
title:
|
|
770
|
+
function ie({ group: e, spec: t, onError: r, client: i, management: a }) {
|
|
771
|
+
let { t: o } = n(), s = e.cover, c = s?.image ? "image" : s?.content_id && !s.auto ? "content" : "auto";
|
|
772
|
+
return /* @__PURE__ */ W(J, {
|
|
773
|
+
title: o(t.owner === "user" ? "groupEditor.images" : "groupEditor.cover"),
|
|
726
774
|
ckui: "group-cover-editor",
|
|
727
775
|
children: [
|
|
728
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ U("p", {
|
|
729
777
|
className: "text-muted-foreground",
|
|
730
778
|
"data-ckui": "cover-mode",
|
|
731
|
-
children:
|
|
779
|
+
children: o(c === "image" ? "groupEditor.coverImage" : c === "content" ? "groupEditor.coverContent" : "groupEditor.coverAuto")
|
|
732
780
|
}),
|
|
733
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ U(I, {
|
|
782
|
+
management: a,
|
|
734
783
|
group: e,
|
|
735
784
|
slot: "cover",
|
|
736
785
|
client: i,
|
|
737
786
|
onError: r
|
|
738
787
|
}),
|
|
739
|
-
t.owner === "user" && /* @__PURE__ */
|
|
788
|
+
t.owner === "user" && /* @__PURE__ */ U(I, {
|
|
789
|
+
management: a,
|
|
740
790
|
group: e,
|
|
741
791
|
slot: "avatar",
|
|
742
792
|
client: i,
|
|
@@ -745,116 +795,120 @@ function ne({ group: e, spec: t, onError: r, client: i }) {
|
|
|
745
795
|
]
|
|
746
796
|
});
|
|
747
797
|
}
|
|
748
|
-
function
|
|
798
|
+
function ae({ group: e, onError: t, client: r }) {
|
|
749
799
|
let { t: a } = n(), o = i(r), s = E("offer.save", t);
|
|
750
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ W(J, {
|
|
751
801
|
title: a("groupEditor.membershipPrice"),
|
|
752
802
|
ckui: "group-offer",
|
|
753
|
-
children: [/* @__PURE__ */
|
|
803
|
+
children: [/* @__PURE__ */ U(N, {
|
|
754
804
|
offer: e.offer,
|
|
755
805
|
pending: s.pending,
|
|
756
806
|
onSell: (t) => void s.run(() => o.offers.sellGroup(e.id, t)),
|
|
757
807
|
onWithdraw: () => void s.run(() => o.offers.withdrawGroup(e.id))
|
|
758
|
-
}, e.offer?.revision), /* @__PURE__ */
|
|
808
|
+
}, e.offer?.revision), /* @__PURE__ */ U(w, { error: s.error })]
|
|
759
809
|
});
|
|
760
810
|
}
|
|
761
|
-
var
|
|
762
|
-
function
|
|
763
|
-
let { t:
|
|
764
|
-
|
|
811
|
+
var oe = /^[a-z][a-z0-9_]*$/;
|
|
812
|
+
function se({ group: e, g: t, kinds: r, labels: i, onError: a, client: o, management: c }) {
|
|
813
|
+
let { t: l } = n(), u = z(), d = E("group.save", a), f = M(e.edges.map((t) => t.from === e.id ? t.to : t.from), {
|
|
814
|
+
client: o,
|
|
815
|
+
management: c
|
|
816
|
+
}), p = Object.keys(r?.entity_kinds ?? {}).sort(), [S, C] = V(""), [T, D] = V(p[0] ?? e.kind), O = e.edges.filter((t) => t.from === e.id), k = e.edges.filter((t) => t.to === e.id), N = (e) => {
|
|
817
|
+
let t = f.get(e);
|
|
765
818
|
return t ? t.name || t.slug : e;
|
|
766
|
-
},
|
|
767
|
-
return /* @__PURE__ */
|
|
768
|
-
title:
|
|
819
|
+
}, P = oe.test(S.trim());
|
|
820
|
+
return /* @__PURE__ */ W(J, {
|
|
821
|
+
title: l("groupEditor.edges"),
|
|
769
822
|
ckui: "group-edges",
|
|
770
823
|
children: [
|
|
771
|
-
|
|
824
|
+
O.length + k.length ? /* @__PURE__ */ W("ul", {
|
|
772
825
|
className: "grid gap-1.5",
|
|
773
|
-
children: [
|
|
826
|
+
children: [O.map((e) => /* @__PURE__ */ W("li", {
|
|
774
827
|
className: "flex flex-wrap items-center gap-2",
|
|
775
828
|
"data-ckui": "group-edge",
|
|
776
829
|
"data-relation": e.relation,
|
|
777
830
|
children: [
|
|
778
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ U(m, {
|
|
779
832
|
variant: "secondary",
|
|
780
|
-
children:
|
|
833
|
+
children: j(i, e.relation)
|
|
781
834
|
}),
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
/* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ U("span", { children: N(e.to) }),
|
|
836
|
+
/* @__PURE__ */ U(s, {
|
|
784
837
|
size: "xs",
|
|
785
838
|
variant: "ghost",
|
|
786
|
-
disabled:
|
|
787
|
-
"aria-label":
|
|
788
|
-
onClick: () => void
|
|
839
|
+
disabled: d.pending,
|
|
840
|
+
"aria-label": l("groupEditor.removeEdge", { name: N(e.to) }),
|
|
841
|
+
onClick: () => void d.run(() => t.edges("remove", [{
|
|
789
842
|
relation: e.relation,
|
|
790
843
|
to: e.to
|
|
791
844
|
}])),
|
|
792
|
-
children:
|
|
845
|
+
children: l("common.remove")
|
|
793
846
|
})
|
|
794
847
|
]
|
|
795
|
-
}, `${e.relation}:${e.to}`)),
|
|
848
|
+
}, `${e.relation}:${e.to}`)), k.map((e) => /* @__PURE__ */ W("li", {
|
|
796
849
|
className: "flex flex-wrap items-center gap-2 text-muted-foreground",
|
|
797
850
|
"data-ckui": "group-edge",
|
|
798
851
|
"data-relation": `inverse:${e.relation}`,
|
|
799
|
-
children: [/* @__PURE__ */
|
|
852
|
+
children: [/* @__PURE__ */ U("span", {
|
|
800
853
|
className: "text-foreground",
|
|
801
|
-
children:
|
|
802
|
-
}), /* @__PURE__ */
|
|
854
|
+
children: N(e.from)
|
|
855
|
+
}), /* @__PURE__ */ U(m, {
|
|
803
856
|
variant: "outline",
|
|
804
|
-
children:
|
|
857
|
+
children: j(i, e.relation)
|
|
805
858
|
})]
|
|
806
859
|
}, `in:${e.relation}:${e.from}`))]
|
|
807
|
-
}) : /* @__PURE__ */
|
|
860
|
+
}) : /* @__PURE__ */ U("p", {
|
|
808
861
|
className: "text-muted-foreground",
|
|
809
|
-
children:
|
|
862
|
+
children: l("groupEditor.noEdges")
|
|
810
863
|
}),
|
|
811
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ W("div", {
|
|
812
865
|
className: "flex flex-wrap items-end gap-2",
|
|
813
866
|
children: [
|
|
814
|
-
/* @__PURE__ */
|
|
867
|
+
/* @__PURE__ */ W("div", {
|
|
815
868
|
className: "grid gap-1",
|
|
816
|
-
children: [/* @__PURE__ */
|
|
817
|
-
htmlFor: `${
|
|
869
|
+
children: [/* @__PURE__ */ U(g, {
|
|
870
|
+
htmlFor: `${u}-rel`,
|
|
818
871
|
className: "text-xs text-muted-foreground",
|
|
819
|
-
children:
|
|
820
|
-
}), /* @__PURE__ */
|
|
821
|
-
id: `${
|
|
872
|
+
children: l("groupEditor.relation")
|
|
873
|
+
}), /* @__PURE__ */ U(h, {
|
|
874
|
+
id: `${u}-rel`,
|
|
822
875
|
className: "h-8 w-40",
|
|
823
|
-
value:
|
|
876
|
+
value: S,
|
|
824
877
|
placeholder: "member_of",
|
|
825
|
-
"aria-invalid": !!
|
|
826
|
-
onChange: (e) =>
|
|
878
|
+
"aria-invalid": !!S && !P,
|
|
879
|
+
onChange: (e) => C(e.target.value)
|
|
827
880
|
})]
|
|
828
881
|
}),
|
|
829
|
-
|
|
830
|
-
value:
|
|
831
|
-
onValueChange: (e) =>
|
|
832
|
-
children: [/* @__PURE__ */
|
|
882
|
+
p.length > 1 && /* @__PURE__ */ W(_, {
|
|
883
|
+
value: T,
|
|
884
|
+
onValueChange: (e) => D(String(e)),
|
|
885
|
+
children: [/* @__PURE__ */ U(b, {
|
|
833
886
|
size: "sm",
|
|
834
|
-
"aria-label":
|
|
835
|
-
children: /* @__PURE__ */
|
|
836
|
-
}), /* @__PURE__ */
|
|
887
|
+
"aria-label": l("groupEditor.edgeKind"),
|
|
888
|
+
children: /* @__PURE__ */ U(x, { children: (e) => j(i, e) })
|
|
889
|
+
}), /* @__PURE__ */ U(v, { children: p.map((e) => /* @__PURE__ */ U(y, {
|
|
837
890
|
value: e,
|
|
838
|
-
children:
|
|
891
|
+
children: j(i, e)
|
|
839
892
|
}, e)) })]
|
|
840
893
|
}),
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
894
|
+
P && /* @__PURE__ */ U(A, {
|
|
895
|
+
management: c,
|
|
896
|
+
kind: T,
|
|
897
|
+
label: l("groupEditor.edgeTarget"),
|
|
844
898
|
exclude: [e.id],
|
|
845
899
|
client: o,
|
|
846
|
-
onPick: (e) => void
|
|
847
|
-
relation:
|
|
900
|
+
onPick: (e) => void d.run(() => t.edges("add", [{
|
|
901
|
+
relation: S.trim(),
|
|
848
902
|
to: e.id
|
|
849
|
-
}])).then((e) => e &&
|
|
850
|
-
},
|
|
903
|
+
}])).then((e) => e && C(""))
|
|
904
|
+
}, T)
|
|
851
905
|
]
|
|
852
906
|
}),
|
|
853
|
-
/* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ U(w, { error: d.error })
|
|
854
908
|
]
|
|
855
909
|
});
|
|
856
910
|
}
|
|
857
911
|
//#endregion
|
|
858
|
-
export {
|
|
912
|
+
export { K as GroupEditor, Z as GroupMergeDialog };
|
|
859
913
|
|
|
860
914
|
//# sourceMappingURL=editor.js.map
|