@webx-ui/module-recipes 0.1.10 → 0.1.11
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/index.js +469 -436
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { reorderItems as
|
|
2
|
-
import { provide as
|
|
3
|
-
import { useRoute as
|
|
4
|
-
import { useLocales as
|
|
5
|
-
const
|
|
1
|
+
import { reorderItems as Ue, useAdmin as oe, useDates as Be, useTranslate as ne, useErrorText as Te, provideRelationOwner as Le, provideRecordAddress as Oe, WxScreenHead as He, WxScreen as Fe, WxSaveState as Ke, WxDate as Ge, WxListScreen as Je, WxRowMenu as je, WxAddressNote as Qe, categoryRoutes as Re } from "@webx-ui/module-admin";
|
|
2
|
+
import { provide as Xe, inject as Ye, defineComponent as ce, computed as f, ref as x, watch as le, onMounted as Ve, onBeforeUnmount as ze, openBlock as v, createElementBlock as N, Fragment as te, createVNode as h, unref as e, withCtx as d, createTextVNode as _, toDisplayString as w, createBlock as k, createCommentVNode as q, renderList as Ie, normalizeClass as ke, createElementVNode as E, useTemplateRef as Ze, nextTick as et, isRef as tt, withKeys as at, resolveDynamicComponent as it, mergeProps as rt } from "vue";
|
|
3
|
+
import { useRoute as Ne, useRouter as qe, onBeforeRouteLeave as st } from "vue-router";
|
|
4
|
+
import { useLocales as nt, localizedValue as lt, confirm as Y, WxSkeleton as ue, WxCard as ot, WxBadge as Z, WxBreadcrumb as ut, WxBreadcrumbItem as We, WxAlert as Ae, WxButton as ee, WxActionBar as ct, toast as $, WxEmpty as De, WxText as dt, useModal as pt, WxDialog as vt, WxFormItem as ht, WxInput as Me, WxSpace as ft, createModal as yt, WxIcon as xe, WxSelect as _e, WxSortableList as mt, WxTooltip as gt } from "@webx-ui/core";
|
|
5
|
+
const Se = "recipes";
|
|
6
6
|
function de(l) {
|
|
7
|
-
const n = `${l.apiPath}/${
|
|
7
|
+
const n = `${l.apiPath}/${Se}`, y = (t) => t.data;
|
|
8
8
|
return {
|
|
9
9
|
list: (t = {}) => {
|
|
10
|
-
const
|
|
11
|
-
return t.q &&
|
|
10
|
+
const u = new URLSearchParams();
|
|
11
|
+
return t.q && u.set("q", t.q), t.category != null && u.set("category", String(t.category)), t.nutrient != null && u.set("nutrient", String(t.nutrient)), t.service != null && u.set("service", String(t.service)), t.status && u.set("status", t.status), t.trashed && u.set("trashed", "1"), l.http.get(u.size > 0 ? `${n}?${u}` : n);
|
|
12
12
|
},
|
|
13
13
|
get: (t) => l.http.get(`${n}/${t}`).then(y),
|
|
14
14
|
create: (t) => l.http.post(n, t).then(y),
|
|
15
|
-
save: (t,
|
|
15
|
+
save: (t, u) => l.http.put(`${n}/${t}`, u).then(y),
|
|
16
16
|
discard: (t) => l.http.post(`${n}/${t}/discard`, {}).then(y),
|
|
17
17
|
publish: (t) => l.http.post(`${n}/${t}/publish`, {}).then(y),
|
|
18
18
|
unpublish: (t) => l.http.post(`${n}/${t}/unpublish`, {}).then(y),
|
|
@@ -20,18 +20,18 @@ function de(l) {
|
|
|
20
20
|
}),
|
|
21
21
|
restore: (t) => l.http.post(`${n}/${t}/restore`, {}).then(y),
|
|
22
22
|
versions: (t) => l.http.get(`${n}/${t}/versions`).then(y),
|
|
23
|
-
restoreVersion: (t,
|
|
24
|
-
reorder: (t) =>
|
|
23
|
+
restoreVersion: (t, u) => l.http.post(`${n}/${t}/versions/${u}/restore`, {}).then(y),
|
|
24
|
+
reorder: (t) => Ue(l, Se, t, null)
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
|
|
27
|
+
const Ee = /* @__PURE__ */ Symbol("wx-recipe-editor");
|
|
28
|
+
function bt(l) {
|
|
29
|
+
Xe(Ee, l);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function wt() {
|
|
32
|
+
return Ye(Ee, null);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const xt = {
|
|
35
35
|
module: {
|
|
36
36
|
group: "Recipes",
|
|
37
37
|
recipes: "Recipes",
|
|
@@ -98,8 +98,6 @@ const mt = {
|
|
|
98
98
|
"publish-nowhere": "It has no address in this language yet, so nothing will answer.",
|
|
99
99
|
preview: "Preview",
|
|
100
100
|
discard: "Discard changes",
|
|
101
|
-
"discard-title": "Discard what is waiting?",
|
|
102
|
-
"discard-text": "The recipe goes back to what the site is showing. What was written since is not listed anywhere.",
|
|
103
101
|
discarded: "The recipe is back to what is published.",
|
|
104
102
|
"conflict-title": "The recipe changed while you were editing",
|
|
105
103
|
"conflict-mine": "Keep mine",
|
|
@@ -153,216 +151,245 @@ const mt = {
|
|
|
153
151
|
saved: "Saved.",
|
|
154
152
|
"field-title": "Title"
|
|
155
153
|
}
|
|
156
|
-
},
|
|
154
|
+
}, Ce = /* @__PURE__ */ new WeakSet();
|
|
157
155
|
function pe() {
|
|
158
156
|
try {
|
|
159
|
-
const { i18n: l } =
|
|
160
|
-
|
|
157
|
+
const { i18n: l } = oe();
|
|
158
|
+
Ce.has(l) || (l.defaults("webx-recipes", xt), Ce.add(l));
|
|
161
159
|
} catch {
|
|
162
160
|
}
|
|
163
161
|
}
|
|
164
|
-
const
|
|
162
|
+
const _t = 1200, kt = /* @__PURE__ */ ce({
|
|
165
163
|
__name: "RecipeEditorPage",
|
|
166
164
|
props: {
|
|
167
165
|
base: { default: "/recipes" }
|
|
168
166
|
},
|
|
169
167
|
setup(l) {
|
|
170
|
-
const n = l, y =
|
|
168
|
+
const n = l, y = oe(), t = de(y), u = Ne(), A = qe(), i = nt(), S = Be();
|
|
171
169
|
pe();
|
|
172
|
-
const r =
|
|
170
|
+
const r = ne("webx-recipes"), b = ne("webx-admin"), T = Te(), B = f(() => Number(u.params.id)), z = f(() => n.base), o = x(null), g = x({}), m = x(""), P = x(null), L = x(null), O = x(!0), U = x(!1), V = x(!1), J = x({}), I = x(null), H = x(""), D = f(() => y.can("recipes.manage")), ve = f(() => !D.value || V.value), F = f(() => JSON.stringify(g.value)), R = f(() => H.value !== "" && F.value !== H.value), ie = f(() => U.value ? "saving" : R.value ? "unsaved" : "saved"), j = f(() => {
|
|
173
171
|
const s = g.value.title;
|
|
174
|
-
return
|
|
172
|
+
return lt(s, i.active.value, o.value?.title ?? "");
|
|
175
173
|
}), re = f(() => {
|
|
176
|
-
const s =
|
|
177
|
-
return !s || s.status !== "published" && s.status !== "modified" ? "" : r("recipe.live-since", { date:
|
|
174
|
+
const s = o.value;
|
|
175
|
+
return !s || s.status !== "published" && s.status !== "modified" ? "" : r("recipe.live-since", { date: S.short(s.published_at) });
|
|
178
176
|
});
|
|
179
|
-
|
|
177
|
+
Le({ type: "recipe", id: f(() => o.value?.id ?? null) }), Oe({
|
|
180
178
|
values: g,
|
|
181
|
-
prefix:
|
|
182
|
-
path: f(() =>
|
|
179
|
+
prefix: P,
|
|
180
|
+
path: f(() => o.value?.path),
|
|
183
181
|
moving: () => r("recipe.address-moving")
|
|
184
|
-
}),
|
|
185
|
-
function
|
|
186
|
-
|
|
182
|
+
}), bt({ recipe: o, canManage: D.value, reload: () => K(!0) });
|
|
183
|
+
function se(s) {
|
|
184
|
+
o.value = s.recipe, g.value = s.values, m.value = s.revision, P.value = s.prefix, L.value = s.preview_url, H.value = JSON.stringify(s.values), I.value = null;
|
|
187
185
|
}
|
|
188
|
-
async function
|
|
189
|
-
s || (
|
|
186
|
+
async function K(s = !1) {
|
|
187
|
+
s || (O.value = !0);
|
|
190
188
|
try {
|
|
191
|
-
|
|
189
|
+
se(await t.get(B.value));
|
|
192
190
|
} catch (W) {
|
|
193
|
-
|
|
191
|
+
$.danger(T(W)), A.push(z.value);
|
|
194
192
|
} finally {
|
|
195
|
-
|
|
193
|
+
O.value = !1;
|
|
196
194
|
}
|
|
197
195
|
}
|
|
198
|
-
let
|
|
199
|
-
function ve() {
|
|
200
|
-
!M.value || R.value || !I.value || (clearTimeout(G), G = setTimeout(() => {
|
|
201
|
-
F();
|
|
202
|
-
}, gt));
|
|
203
|
-
}
|
|
196
|
+
let Q;
|
|
204
197
|
function he() {
|
|
205
|
-
!
|
|
198
|
+
!D.value || I.value || !R.value || (clearTimeout(Q), Q = setTimeout(() => {
|
|
199
|
+
M();
|
|
200
|
+
}, _t));
|
|
201
|
+
}
|
|
202
|
+
function fe() {
|
|
203
|
+
!D.value || I.value || !R.value || U.value || (clearTimeout(Q), M());
|
|
206
204
|
}
|
|
207
|
-
let
|
|
208
|
-
async function
|
|
209
|
-
for (;
|
|
210
|
-
const { carried:
|
|
211
|
-
if (await
|
|
205
|
+
let X;
|
|
206
|
+
async function M() {
|
|
207
|
+
for (; X; ) {
|
|
208
|
+
const { carried: C, done: G } = X;
|
|
209
|
+
if (await G, !R.value || I.value || F.value === C) return;
|
|
212
210
|
}
|
|
213
|
-
const s =
|
|
214
|
-
|
|
211
|
+
const s = F.value, W = ye();
|
|
212
|
+
X = { carried: s, done: W };
|
|
215
213
|
try {
|
|
216
214
|
await W;
|
|
217
215
|
} finally {
|
|
218
|
-
|
|
216
|
+
X?.done === W && (X = void 0);
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
|
-
async function
|
|
222
|
-
if (!
|
|
223
|
-
clearTimeout(
|
|
224
|
-
const s =
|
|
225
|
-
U.value = !0,
|
|
219
|
+
async function ye() {
|
|
220
|
+
if (!o.value || !D.value) return;
|
|
221
|
+
clearTimeout(Q);
|
|
222
|
+
const s = F.value, W = g.value;
|
|
223
|
+
U.value = !0, J.value = {};
|
|
226
224
|
try {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
} catch (
|
|
230
|
-
const
|
|
231
|
-
|
|
225
|
+
const C = await t.save(o.value.id, { values: W, revision: m.value });
|
|
226
|
+
o.value = C.recipe, m.value = C.revision, P.value = C.prefix, L.value = C.preview_url, I.value = null, F.value === s && (H.value = s);
|
|
227
|
+
} catch (C) {
|
|
228
|
+
const G = C;
|
|
229
|
+
G.status === 409 && G.body?.data ? I.value = G.body : G.body?.errors ? (J.value = G.body.errors, $.danger(r("recipe.save-failed"))) : $.danger(T(C));
|
|
232
230
|
} finally {
|
|
233
231
|
U.value = !1;
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
|
-
async function
|
|
237
|
-
await
|
|
234
|
+
async function me() {
|
|
235
|
+
await Y({
|
|
238
236
|
title: r("recipe.conflict-theirs-title"),
|
|
239
237
|
message: r("recipe.conflict-theirs-text"),
|
|
240
238
|
confirmText: r("recipe.conflict-theirs"),
|
|
241
239
|
cancelText: r("panel.cancel"),
|
|
242
240
|
tone: "danger"
|
|
243
|
-
}) && await
|
|
241
|
+
}) && await K(!0);
|
|
244
242
|
}
|
|
245
|
-
async function
|
|
246
|
-
const s =
|
|
247
|
-
s && (
|
|
243
|
+
async function ge() {
|
|
244
|
+
const s = I.value;
|
|
245
|
+
s && (m.value = s.data.revision, I.value = null, await M());
|
|
248
246
|
}
|
|
249
|
-
async function
|
|
250
|
-
if (!(!
|
|
251
|
-
title:
|
|
252
|
-
message:
|
|
247
|
+
async function be() {
|
|
248
|
+
if (!(!o.value || !await Y({
|
|
249
|
+
title: b("editor.discard-title"),
|
|
250
|
+
message: b("editor.discard-text"),
|
|
253
251
|
confirmText: r("recipe.discard"),
|
|
254
|
-
|
|
252
|
+
// Not «Cancel»: beside «Discard changes» the two read as the same word.
|
|
253
|
+
cancelText: b("editor.keep-changes"),
|
|
255
254
|
tone: "danger"
|
|
256
255
|
}))) {
|
|
257
|
-
|
|
256
|
+
V.value = !0;
|
|
258
257
|
try {
|
|
259
|
-
|
|
258
|
+
se(await t.discard(o.value.id)), $.success(r("recipe.discarded"));
|
|
260
259
|
} catch (W) {
|
|
261
|
-
|
|
260
|
+
$.danger(T(W));
|
|
262
261
|
} finally {
|
|
263
|
-
|
|
262
|
+
V.value = !1;
|
|
264
263
|
}
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
|
-
async function
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
async function a() {
|
|
267
|
+
if (R.value && await M(), I.value || R.value) return;
|
|
268
|
+
const s = o.value;
|
|
269
|
+
if (!s) return;
|
|
270
|
+
const W = s.next_path ?? s.path, C = s.next_path != null && s.path !== null ? ` ${b("editor.publish-moves", { old: `/${s.path}` })}` : "";
|
|
271
|
+
if (await Y({
|
|
272
|
+
title: r("recipe.publish-title", { title: j.value || s.title }),
|
|
273
|
+
message: W === null ? r("recipe.publish-nowhere") : r("recipe.publish-text", { address: `/${W}` }) + C,
|
|
272
274
|
confirmText: r("panel.publish"),
|
|
273
275
|
cancelText: r("panel.cancel")
|
|
274
|
-
}))
|
|
275
|
-
|
|
276
|
+
})) {
|
|
277
|
+
V.value = !0;
|
|
278
|
+
try {
|
|
279
|
+
await t.publish(s.id), await K(!0), $.success(r("panel.published"));
|
|
280
|
+
} catch (Pe) {
|
|
281
|
+
$.danger(T(Pe));
|
|
282
|
+
} finally {
|
|
283
|
+
V.value = !1;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
async function p() {
|
|
288
|
+
const s = o.value;
|
|
289
|
+
if (!(!s || !await Y({
|
|
290
|
+
title: b("editor.unpublish-title"),
|
|
291
|
+
message: b("editor.unpublish-text"),
|
|
292
|
+
confirmText: b("editor.unpublish"),
|
|
293
|
+
cancelText: b("editor.keep-published")
|
|
294
|
+
}))) {
|
|
295
|
+
V.value = !0;
|
|
276
296
|
try {
|
|
277
|
-
await t.
|
|
278
|
-
} catch (
|
|
279
|
-
|
|
297
|
+
await t.unpublish(s.id), await K(!0), $.success(b("editor.unpublished"));
|
|
298
|
+
} catch (C) {
|
|
299
|
+
$.danger(T(C));
|
|
280
300
|
} finally {
|
|
281
|
-
|
|
301
|
+
V.value = !1;
|
|
282
302
|
}
|
|
283
303
|
}
|
|
284
304
|
}
|
|
285
|
-
function
|
|
286
|
-
const s =
|
|
305
|
+
function c() {
|
|
306
|
+
const s = o.value?.status;
|
|
287
307
|
return s === "published" || s === "modified" ? "success" : "default";
|
|
288
308
|
}
|
|
289
|
-
function
|
|
290
|
-
|
|
309
|
+
function ae(s) {
|
|
310
|
+
R.value && s.preventDefault();
|
|
291
311
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}),
|
|
295
|
-
|
|
296
|
-
}),
|
|
297
|
-
clearTimeout(
|
|
298
|
-
}),
|
|
312
|
+
le(F, he), le(B, () => {
|
|
313
|
+
K();
|
|
314
|
+
}), Ve(() => {
|
|
315
|
+
K(), window.addEventListener("beforeunload", ae);
|
|
316
|
+
}), ze(() => {
|
|
317
|
+
clearTimeout(Q), window.removeEventListener("beforeunload", ae);
|
|
318
|
+
}), st(async () => !R.value || !D.value || (await M(), !R.value) ? !0 : await Y({
|
|
299
319
|
title: r("recipe.leave-title"),
|
|
300
320
|
message: r("recipe.leave-text"),
|
|
301
321
|
confirmText: r("recipe.leave"),
|
|
302
322
|
cancelText: r("panel.cancel"),
|
|
303
323
|
tone: "danger"
|
|
304
324
|
}));
|
|
305
|
-
const
|
|
325
|
+
const we = f(() => {
|
|
306
326
|
const s = [];
|
|
307
|
-
return
|
|
327
|
+
return L.value && s.push({ key: "preview", label: r("recipe.preview"), icon: "eye", href: L.value }), o.value?.url && o.value.status !== "draft" && s.push({
|
|
308
328
|
key: "site",
|
|
309
329
|
label: r("panel.open-on-site"),
|
|
310
330
|
icon: "link",
|
|
311
|
-
href:
|
|
312
|
-
}),
|
|
331
|
+
href: o.value.url
|
|
332
|
+
}), D.value && (o.value?.status === "published" || o.value?.status === "modified") && s.push({
|
|
333
|
+
key: "unpublish",
|
|
334
|
+
label: b("editor.unpublish"),
|
|
335
|
+
icon: "eye-off",
|
|
336
|
+
run: () => {
|
|
337
|
+
p();
|
|
338
|
+
}
|
|
339
|
+
}), o.value?.status === "modified" && s.push({
|
|
313
340
|
key: "discard",
|
|
314
341
|
label: r("recipe.discard"),
|
|
315
342
|
icon: "refresh",
|
|
316
343
|
danger: !0,
|
|
317
344
|
menu: !0,
|
|
318
345
|
run: () => {
|
|
319
|
-
|
|
346
|
+
be();
|
|
320
347
|
}
|
|
321
348
|
}), s;
|
|
322
349
|
});
|
|
323
|
-
return (s, W) => (v(),
|
|
350
|
+
return (s, W) => (v(), N("div", {
|
|
324
351
|
class: "wx-recipe-editor",
|
|
325
|
-
onFocusout:
|
|
352
|
+
onFocusout: fe
|
|
326
353
|
}, [
|
|
327
|
-
|
|
328
|
-
h(e(
|
|
354
|
+
O.value || !o.value ? (v(), N(te, { key: 0 }, [
|
|
355
|
+
h(e(ue), {
|
|
329
356
|
class: "wx-recipe-editor__ghost",
|
|
330
357
|
title: "",
|
|
331
358
|
rows: 1
|
|
332
359
|
}),
|
|
333
|
-
h(e(
|
|
334
|
-
default:
|
|
335
|
-
h(e(
|
|
360
|
+
h(e(ot), null, {
|
|
361
|
+
default: d(() => [
|
|
362
|
+
h(e(ue), { rows: 8 })
|
|
336
363
|
]),
|
|
337
364
|
_: 1
|
|
338
365
|
})
|
|
339
|
-
], 64)) : (v(),
|
|
340
|
-
h(e(
|
|
366
|
+
], 64)) : (v(), N(te, { key: 1 }, [
|
|
367
|
+
h(e(He), {
|
|
341
368
|
divider: "",
|
|
342
|
-
back:
|
|
369
|
+
back: z.value,
|
|
343
370
|
"back-label": e(r)("module.recipes"),
|
|
344
|
-
title:
|
|
371
|
+
title: j.value || e(r)("recipe.untitled"),
|
|
345
372
|
subtitle: re.value,
|
|
346
|
-
actions:
|
|
373
|
+
actions: we.value
|
|
347
374
|
}, {
|
|
348
|
-
trail:
|
|
349
|
-
h(e(
|
|
375
|
+
trail: d(() => [
|
|
376
|
+
h(e(ut), {
|
|
350
377
|
size: "sm",
|
|
351
378
|
label: e(r)("recipe.trail")
|
|
352
379
|
}, {
|
|
353
|
-
default:
|
|
354
|
-
h(e(
|
|
380
|
+
default: d(() => [
|
|
381
|
+
h(e(We), {
|
|
355
382
|
as: "router-link",
|
|
356
|
-
to:
|
|
383
|
+
to: z.value
|
|
357
384
|
}, {
|
|
358
|
-
default:
|
|
359
|
-
_(
|
|
385
|
+
default: d(() => [
|
|
386
|
+
_(w(e(r)("module.recipes")), 1)
|
|
360
387
|
]),
|
|
361
388
|
_: 1
|
|
362
389
|
}, 8, ["to"]),
|
|
363
|
-
h(e(
|
|
364
|
-
default:
|
|
365
|
-
_(
|
|
390
|
+
h(e(We), { current: "" }, {
|
|
391
|
+
default: d(() => [
|
|
392
|
+
_(w(j.value || e(r)("recipe.untitled")), 1)
|
|
366
393
|
]),
|
|
367
394
|
_: 1
|
|
368
395
|
})
|
|
@@ -370,257 +397,257 @@ const gt = 1200, wt = /* @__PURE__ */ ue({
|
|
|
370
397
|
_: 1
|
|
371
398
|
}, 8, ["label"])
|
|
372
399
|
]),
|
|
373
|
-
"title-after":
|
|
374
|
-
h(e(
|
|
375
|
-
type:
|
|
400
|
+
"title-after": d(() => [
|
|
401
|
+
h(e(Z), {
|
|
402
|
+
type: c(),
|
|
376
403
|
dot: ""
|
|
377
404
|
}, {
|
|
378
|
-
default:
|
|
379
|
-
_(
|
|
405
|
+
default: d(() => [
|
|
406
|
+
_(w(e(r)(`panel.status-${o.value.status}`)), 1)
|
|
380
407
|
]),
|
|
381
408
|
_: 1
|
|
382
409
|
}, 8, ["type"]),
|
|
383
|
-
|
|
410
|
+
o.value.status === "modified" ? (v(), k(e(Z), {
|
|
384
411
|
key: 0,
|
|
385
412
|
type: "primary",
|
|
386
413
|
round: ""
|
|
387
414
|
}, {
|
|
388
|
-
default:
|
|
389
|
-
_(
|
|
415
|
+
default: d(() => [
|
|
416
|
+
_(w(e(r)("panel.edits")), 1)
|
|
390
417
|
]),
|
|
391
418
|
_: 1
|
|
392
|
-
})) :
|
|
419
|
+
})) : q("", !0)
|
|
393
420
|
]),
|
|
394
421
|
_: 1
|
|
395
422
|
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
396
|
-
|
|
423
|
+
I.value ? (v(), k(e(Ae), {
|
|
397
424
|
key: 0,
|
|
398
425
|
type: "warning",
|
|
399
426
|
title: e(r)("recipe.conflict-title"),
|
|
400
|
-
description:
|
|
427
|
+
description: I.value.message
|
|
401
428
|
}, {
|
|
402
|
-
actions:
|
|
403
|
-
h(e(
|
|
429
|
+
actions: d(() => [
|
|
430
|
+
h(e(ee), {
|
|
404
431
|
size: "sm",
|
|
405
432
|
variant: "outline",
|
|
406
|
-
onClick:
|
|
433
|
+
onClick: me
|
|
407
434
|
}, {
|
|
408
|
-
default:
|
|
409
|
-
_(
|
|
435
|
+
default: d(() => [
|
|
436
|
+
_(w(e(r)("recipe.conflict-theirs")), 1)
|
|
410
437
|
]),
|
|
411
438
|
_: 1
|
|
412
439
|
}),
|
|
413
|
-
h(e(
|
|
440
|
+
h(e(ee), {
|
|
414
441
|
size: "sm",
|
|
415
442
|
type: "primary",
|
|
416
|
-
onClick:
|
|
443
|
+
onClick: ge
|
|
417
444
|
}, {
|
|
418
|
-
default:
|
|
419
|
-
_(
|
|
445
|
+
default: d(() => [
|
|
446
|
+
_(w(e(r)("recipe.conflict-mine")), 1)
|
|
420
447
|
]),
|
|
421
448
|
_: 1
|
|
422
449
|
})
|
|
423
450
|
]),
|
|
424
451
|
_: 1
|
|
425
|
-
}, 8, ["title", "description"])) :
|
|
426
|
-
h(e(
|
|
452
|
+
}, 8, ["title", "description"])) : q("", !0),
|
|
453
|
+
h(e(Fe), {
|
|
427
454
|
modelValue: g.value,
|
|
428
|
-
"onUpdate:modelValue": W[0] || (W[0] = (
|
|
455
|
+
"onUpdate:modelValue": W[0] || (W[0] = (C) => g.value = C),
|
|
429
456
|
name: "recipes.form",
|
|
430
|
-
errors:
|
|
431
|
-
disabled:
|
|
457
|
+
errors: J.value,
|
|
458
|
+
disabled: ve.value
|
|
432
459
|
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
433
|
-
|
|
434
|
-
state:
|
|
435
|
-
h(e(
|
|
460
|
+
D.value ? (v(), k(e(ct), { key: 1 }, {
|
|
461
|
+
state: d(() => [
|
|
462
|
+
h(e(Ke), { state: ie.value }, null, 8, ["state"])
|
|
436
463
|
]),
|
|
437
|
-
default:
|
|
438
|
-
h(e(
|
|
464
|
+
default: d(() => [
|
|
465
|
+
h(e(ee), {
|
|
439
466
|
variant: "outline",
|
|
440
467
|
loading: U.value,
|
|
441
|
-
disabled: !
|
|
442
|
-
onClick:
|
|
468
|
+
disabled: !R.value,
|
|
469
|
+
onClick: M
|
|
443
470
|
}, {
|
|
444
|
-
default:
|
|
445
|
-
_(
|
|
471
|
+
default: d(() => [
|
|
472
|
+
_(w(e(r)("recipe.save")), 1)
|
|
446
473
|
]),
|
|
447
474
|
_: 1
|
|
448
475
|
}, 8, ["loading", "disabled"]),
|
|
449
|
-
h(e(
|
|
476
|
+
h(e(ee), {
|
|
450
477
|
type: "primary",
|
|
451
|
-
loading:
|
|
452
|
-
disabled:
|
|
453
|
-
onClick:
|
|
478
|
+
loading: V.value,
|
|
479
|
+
disabled: o.value.status === "published" && !R.value,
|
|
480
|
+
onClick: a
|
|
454
481
|
}, {
|
|
455
|
-
default:
|
|
456
|
-
_(
|
|
482
|
+
default: d(() => [
|
|
483
|
+
_(w(e(r)("panel.publish")), 1)
|
|
457
484
|
]),
|
|
458
485
|
_: 1
|
|
459
486
|
}, 8, ["loading", "disabled"])
|
|
460
487
|
]),
|
|
461
488
|
_: 1
|
|
462
|
-
})) :
|
|
489
|
+
})) : q("", !0)
|
|
463
490
|
], 64))
|
|
464
491
|
], 32));
|
|
465
492
|
}
|
|
466
|
-
}),
|
|
493
|
+
}), $e = (l, n) => {
|
|
467
494
|
const y = l.__vccOpts || l;
|
|
468
|
-
for (const [t,
|
|
469
|
-
y[t] =
|
|
495
|
+
for (const [t, u] of n)
|
|
496
|
+
y[t] = u;
|
|
470
497
|
return y;
|
|
471
|
-
},
|
|
498
|
+
}, Tt = /* @__PURE__ */ $e(kt, [["__scopeId", "data-v-77110321"]]), $t = { class: "wx-recipe-history" }, Rt = { class: "wx-recipe-history__number" }, Wt = { class: "wx-recipe-history__who" }, St = /* @__PURE__ */ ce({
|
|
472
499
|
name: "WxRecipeHistory",
|
|
473
500
|
__name: "RecipeHistory",
|
|
474
501
|
setup(l) {
|
|
475
|
-
const n =
|
|
502
|
+
const n = oe(), y = de(n), t = wt();
|
|
476
503
|
pe();
|
|
477
|
-
const
|
|
504
|
+
const u = ne("webx-recipes"), A = Te(), i = x(null), S = x(!1), r = f(() => t?.recipe.value ?? null), b = f(() => t?.canManage ?? !1), T = f(
|
|
478
505
|
() => r.value?.status === "published" || r.value?.status === "modified" ? i.value?.[0]?.number ?? null : null
|
|
479
506
|
);
|
|
480
|
-
async function
|
|
481
|
-
const
|
|
482
|
-
if (
|
|
507
|
+
async function B() {
|
|
508
|
+
const o = r.value;
|
|
509
|
+
if (o)
|
|
483
510
|
try {
|
|
484
|
-
i.value = await y.versions(
|
|
485
|
-
} catch (
|
|
486
|
-
i.value = [],
|
|
511
|
+
i.value = await y.versions(o.id);
|
|
512
|
+
} catch (g) {
|
|
513
|
+
i.value = [], $.danger(A(g));
|
|
487
514
|
}
|
|
488
515
|
}
|
|
489
|
-
async function
|
|
490
|
-
const
|
|
491
|
-
if (!(!
|
|
492
|
-
title:
|
|
493
|
-
message:
|
|
494
|
-
confirmText:
|
|
495
|
-
cancelText:
|
|
516
|
+
async function z(o) {
|
|
517
|
+
const g = r.value;
|
|
518
|
+
if (!(!g || !await Y({
|
|
519
|
+
title: u("recipe.restore-title", { number: o.number }),
|
|
520
|
+
message: u("recipe.restore-text"),
|
|
521
|
+
confirmText: u("recipe.restore-version"),
|
|
522
|
+
cancelText: u("panel.cancel")
|
|
496
523
|
}))) {
|
|
497
|
-
|
|
524
|
+
S.value = !0;
|
|
498
525
|
try {
|
|
499
|
-
await y.restoreVersion(
|
|
500
|
-
} catch (
|
|
501
|
-
|
|
526
|
+
await y.restoreVersion(g.id, o.number), await t?.reload(), $.success(u("recipe.restored-version", { number: o.number }));
|
|
527
|
+
} catch (P) {
|
|
528
|
+
$.danger(A(P));
|
|
502
529
|
} finally {
|
|
503
|
-
|
|
530
|
+
S.value = !1;
|
|
504
531
|
}
|
|
505
532
|
}
|
|
506
533
|
}
|
|
507
|
-
return
|
|
534
|
+
return le(
|
|
508
535
|
() => [r.value?.id, r.value?.published_at, r.value?.updated_at],
|
|
509
536
|
() => {
|
|
510
|
-
|
|
537
|
+
B();
|
|
511
538
|
},
|
|
512
539
|
{ immediate: !0 }
|
|
513
|
-
), (
|
|
514
|
-
i.value === null ? (v(), k(e(
|
|
540
|
+
), (o, g) => (v(), N("div", $t, [
|
|
541
|
+
i.value === null ? (v(), k(e(ue), {
|
|
515
542
|
key: 0,
|
|
516
543
|
class: "wx-recipe-history__ghost",
|
|
517
544
|
rows: 3
|
|
518
|
-
})) : i.value.length === 0 ? (v(), k(e(
|
|
545
|
+
})) : i.value.length === 0 ? (v(), k(e(De), {
|
|
519
546
|
key: 1,
|
|
520
|
-
description: e(
|
|
521
|
-
}, null, 8, ["description"])) : (v(!0),
|
|
547
|
+
description: e(u)("recipe.history-empty")
|
|
548
|
+
}, null, 8, ["description"])) : (v(!0), N(te, { key: 2 }, Ie(i.value, (m) => (v(), N("div", {
|
|
522
549
|
key: m.number,
|
|
523
|
-
class:
|
|
550
|
+
class: ke(["wx-recipe-history__row", { "is-live": m.number === T.value }])
|
|
524
551
|
}, [
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
m.created_at ? (v(), k(e(
|
|
552
|
+
E("code", Rt, w(e(u)("recipe.version", { number: m.number })), 1),
|
|
553
|
+
E("div", Wt, [
|
|
554
|
+
m.created_at ? (v(), k(e(Ge), {
|
|
528
555
|
key: 0,
|
|
529
556
|
value: m.created_at,
|
|
530
557
|
size: "md",
|
|
531
558
|
tone: "default"
|
|
532
|
-
}, null, 8, ["value"])) :
|
|
533
|
-
h(e(
|
|
559
|
+
}, null, 8, ["value"])) : q("", !0),
|
|
560
|
+
h(e(dt), {
|
|
534
561
|
size: "sm",
|
|
535
562
|
tone: "muted"
|
|
536
563
|
}, {
|
|
537
|
-
default:
|
|
538
|
-
_(
|
|
539
|
-
m.comment ? (v(),
|
|
540
|
-
_(" · " +
|
|
541
|
-
], 64)) :
|
|
564
|
+
default: d(() => [
|
|
565
|
+
_(w(m.author ?? e(u)(`recipe.source-${m.source}`)) + " ", 1),
|
|
566
|
+
m.comment ? (v(), N(te, { key: 0 }, [
|
|
567
|
+
_(" · " + w(m.comment), 1)
|
|
568
|
+
], 64)) : q("", !0)
|
|
542
569
|
]),
|
|
543
570
|
_: 2
|
|
544
571
|
}, 1024)
|
|
545
572
|
]),
|
|
546
|
-
m.number ===
|
|
573
|
+
m.number === T.value ? (v(), k(e(Z), {
|
|
547
574
|
key: 0,
|
|
548
575
|
type: "success",
|
|
549
576
|
dot: ""
|
|
550
577
|
}, {
|
|
551
|
-
default:
|
|
552
|
-
_(
|
|
578
|
+
default: d(() => [
|
|
579
|
+
_(w(e(u)("recipe.version-live")), 1)
|
|
553
580
|
]),
|
|
554
581
|
_: 1
|
|
555
|
-
})) :
|
|
556
|
-
|
|
582
|
+
})) : q("", !0),
|
|
583
|
+
b.value && m.number !== T.value ? (v(), k(e(ee), {
|
|
557
584
|
key: 1,
|
|
558
585
|
size: "sm",
|
|
559
586
|
variant: "outline",
|
|
560
|
-
loading:
|
|
561
|
-
onClick: (
|
|
587
|
+
loading: S.value,
|
|
588
|
+
onClick: (P) => z(m)
|
|
562
589
|
}, {
|
|
563
|
-
default:
|
|
564
|
-
_(
|
|
590
|
+
default: d(() => [
|
|
591
|
+
_(w(e(u)("recipe.restore-version")), 1)
|
|
565
592
|
]),
|
|
566
593
|
_: 1
|
|
567
|
-
}, 8, ["loading", "onClick"])) :
|
|
594
|
+
}, 8, ["loading", "onClick"])) : q("", !0)
|
|
568
595
|
], 2))), 128))
|
|
569
596
|
]));
|
|
570
597
|
}
|
|
571
|
-
}),
|
|
572
|
-
function
|
|
598
|
+
}), Ct = /* @__PURE__ */ $e(St, [["__scopeId", "data-v-dcd71040"]]);
|
|
599
|
+
function Vt(l, n) {
|
|
573
600
|
if (l == null || l <= 0) return "";
|
|
574
601
|
const y = Math.floor(l / 60), t = l % 60;
|
|
575
602
|
return y === 0 ? n("panel.minutes", { count: t }) : t === 0 ? n("panel.hours", { hours: y }) : n("panel.hours-minutes", { hours: y, minutes: t });
|
|
576
603
|
}
|
|
577
|
-
const
|
|
604
|
+
const zt = /* @__PURE__ */ ce({
|
|
578
605
|
__name: "RecipeCreateDialog",
|
|
579
606
|
setup(l) {
|
|
580
|
-
const { open: n, resolve: y, dismiss: t } =
|
|
607
|
+
const { open: n, resolve: y, dismiss: t } = pt(), u = oe(), A = de(u);
|
|
581
608
|
pe();
|
|
582
|
-
const i =
|
|
583
|
-
|
|
584
|
-
await
|
|
609
|
+
const i = ne("webx-recipes"), S = x(""), r = x(!1), b = x({}), T = Ze("field");
|
|
610
|
+
Ve(async () => {
|
|
611
|
+
await et(), T.value?.querySelector("input")?.focus();
|
|
585
612
|
});
|
|
586
|
-
async function
|
|
587
|
-
if (!(
|
|
588
|
-
r.value = !0,
|
|
613
|
+
async function B() {
|
|
614
|
+
if (!(S.value.trim() === "" || r.value)) {
|
|
615
|
+
r.value = !0, b.value = {};
|
|
589
616
|
try {
|
|
590
|
-
y((await
|
|
591
|
-
} catch (
|
|
592
|
-
|
|
617
|
+
y((await A.create({ title: S.value.trim() })).recipe);
|
|
618
|
+
} catch (z) {
|
|
619
|
+
b.value = z.body?.errors ?? {};
|
|
593
620
|
} finally {
|
|
594
621
|
r.value = !1;
|
|
595
622
|
}
|
|
596
623
|
}
|
|
597
624
|
}
|
|
598
|
-
return (
|
|
625
|
+
return (z, o) => (v(), k(e(vt), {
|
|
599
626
|
open: e(n),
|
|
600
|
-
"onUpdate:open":
|
|
627
|
+
"onUpdate:open": o[2] || (o[2] = (g) => tt(n) ? n.value = g : null),
|
|
601
628
|
title: e(i)("panel.new-title"),
|
|
602
629
|
width: 440
|
|
603
630
|
}, {
|
|
604
|
-
footer:
|
|
605
|
-
h(e(
|
|
606
|
-
default:
|
|
607
|
-
h(e(
|
|
631
|
+
footer: d(() => [
|
|
632
|
+
h(e(ft), { size: "sm" }, {
|
|
633
|
+
default: d(() => [
|
|
634
|
+
h(e(ee), {
|
|
608
635
|
variant: "outline",
|
|
609
|
-
onClick:
|
|
636
|
+
onClick: o[1] || (o[1] = (g) => e(t)())
|
|
610
637
|
}, {
|
|
611
|
-
default:
|
|
612
|
-
_(
|
|
638
|
+
default: d(() => [
|
|
639
|
+
_(w(e(i)("panel.cancel")), 1)
|
|
613
640
|
]),
|
|
614
641
|
_: 1
|
|
615
642
|
}),
|
|
616
|
-
h(e(
|
|
643
|
+
h(e(ee), {
|
|
617
644
|
type: "primary",
|
|
618
645
|
loading: r.value,
|
|
619
|
-
disabled:
|
|
620
|
-
onClick:
|
|
646
|
+
disabled: S.value.trim() === "",
|
|
647
|
+
onClick: B
|
|
621
648
|
}, {
|
|
622
|
-
default:
|
|
623
|
-
_(
|
|
649
|
+
default: d(() => [
|
|
650
|
+
_(w(e(i)("panel.create")), 1)
|
|
624
651
|
]),
|
|
625
652
|
_: 1
|
|
626
653
|
}, 8, ["loading", "disabled"])
|
|
@@ -628,22 +655,22 @@ const Wt = /* @__PURE__ */ ue({
|
|
|
628
655
|
_: 1
|
|
629
656
|
})
|
|
630
657
|
]),
|
|
631
|
-
default:
|
|
632
|
-
h(e(
|
|
658
|
+
default: d(() => [
|
|
659
|
+
h(e(ht), {
|
|
633
660
|
label: e(i)("panel.field-title"),
|
|
634
|
-
error:
|
|
661
|
+
error: b.value.title?.[0] ?? b.value.slug?.[0],
|
|
635
662
|
required: ""
|
|
636
663
|
}, {
|
|
637
|
-
default:
|
|
638
|
-
|
|
664
|
+
default: d(() => [
|
|
665
|
+
E("div", {
|
|
639
666
|
ref_key: "field",
|
|
640
|
-
ref:
|
|
667
|
+
ref: T
|
|
641
668
|
}, [
|
|
642
|
-
h(e(
|
|
643
|
-
modelValue:
|
|
644
|
-
"onUpdate:modelValue":
|
|
669
|
+
h(e(Me), {
|
|
670
|
+
modelValue: S.value,
|
|
671
|
+
"onUpdate:modelValue": o[0] || (o[0] = (g) => S.value = g),
|
|
645
672
|
"aria-label": e(i)("panel.field-title"),
|
|
646
|
-
onKeyup:
|
|
673
|
+
onKeyup: at(B, ["enter"])
|
|
647
674
|
}, null, 8, ["modelValue", "aria-label"])
|
|
648
675
|
], 512)
|
|
649
676
|
]),
|
|
@@ -653,92 +680,92 @@ const Wt = /* @__PURE__ */ ue({
|
|
|
653
680
|
_: 1
|
|
654
681
|
}, 8, ["open", "title"]));
|
|
655
682
|
}
|
|
656
|
-
}),
|
|
683
|
+
}), It = { class: "wx-recipes" }, Nt = { class: "wx-recipes__bar" }, qt = ["src"], At = { class: "wx-recipe-row__name" }, Dt = { class: "wx-recipe-row__title" }, Mt = { class: "wx-recipe-row__address" }, Et = { class: "wx-recipe-row__facts" }, Pt = { class: "wx-recipe-row__chips" }, Ut = { class: "wx-recipe-row__state" }, Bt = {
|
|
657
684
|
key: 0,
|
|
658
685
|
class: "wx-recipe-row__time"
|
|
659
|
-
},
|
|
686
|
+
}, Lt = /* @__PURE__ */ ce({
|
|
660
687
|
__name: "RecipesPage",
|
|
661
688
|
props: {
|
|
662
689
|
base: { default: "/recipes" }
|
|
663
690
|
},
|
|
664
691
|
setup(l) {
|
|
665
|
-
const n = l, y =
|
|
692
|
+
const n = l, y = oe(), t = de(y), u = Ne(), A = qe();
|
|
666
693
|
pe();
|
|
667
|
-
const i =
|
|
694
|
+
const i = ne("webx-recipes"), S = Te(), r = x([]), b = x({ categories: [], nutrients: [], services: null }), T = x(!0), B = yt(zt), z = f(() => y.can("recipes.manage")), o = f(
|
|
668
695
|
() => y.state.manifest?.modules.find((a) => a.id === "recipes")?.title ?? i("module.recipes")
|
|
669
|
-
),
|
|
670
|
-
get: () => typeof
|
|
696
|
+
), g = f({
|
|
697
|
+
get: () => typeof u.query.view == "string" ? u.query.view : "",
|
|
671
698
|
set: (a) => {
|
|
672
|
-
|
|
673
|
-
query: { ...
|
|
699
|
+
A.replace({
|
|
700
|
+
query: { ...u.query, view: a === "" ? void 0 : String(a) }
|
|
674
701
|
});
|
|
675
702
|
}
|
|
676
|
-
}), m = f(() =>
|
|
677
|
-
function
|
|
678
|
-
const
|
|
679
|
-
return typeof
|
|
703
|
+
}), m = f(() => g.value === "trashed");
|
|
704
|
+
function P(a) {
|
|
705
|
+
const p = u.query[a];
|
|
706
|
+
return typeof p == "string" && p !== "" && Number(p) || null;
|
|
680
707
|
}
|
|
681
|
-
const L = f(() =>
|
|
708
|
+
const L = f(() => P("category")), O = f(() => P("nutrient")), U = f(() => P("service")), V = f(() => typeof u.query.q == "string" ? u.query.q : ""), J = x(V.value), I = f(() => [
|
|
682
709
|
{ value: "", label: i("panel.view-all") },
|
|
683
710
|
{ value: "published", label: i("panel.view-published") },
|
|
684
711
|
{ value: "draft", label: i("panel.view-draft") },
|
|
685
712
|
{ value: "unpublished", label: i("panel.view-unpublished") },
|
|
686
713
|
{ value: "trashed", label: i("panel.bin"), icon: "trash" }
|
|
687
|
-
]),
|
|
688
|
-
() =>
|
|
689
|
-
),
|
|
690
|
-
async function
|
|
691
|
-
|
|
714
|
+
]), H = f(
|
|
715
|
+
() => g.value === "" && V.value.trim() === "" && L.value === null && O.value === null && U.value === null
|
|
716
|
+
), D = f(() => z.value && H.value), ve = f(() => i(H.value ? "panel.order-all" : "panel.order-locked")), F = f(() => V.value !== "" ? i("panel.empty-search") : m.value ? i("panel.empty-bin") : i("panel.empty"));
|
|
717
|
+
async function R() {
|
|
718
|
+
T.value = !0;
|
|
692
719
|
try {
|
|
693
720
|
const a = await t.list({
|
|
694
|
-
q:
|
|
721
|
+
q: V.value,
|
|
695
722
|
category: L.value,
|
|
696
|
-
nutrient:
|
|
697
|
-
service:
|
|
698
|
-
status: m.value ? "" :
|
|
723
|
+
nutrient: O.value,
|
|
724
|
+
service: U.value,
|
|
725
|
+
status: m.value ? "" : g.value,
|
|
699
726
|
trashed: m.value
|
|
700
727
|
});
|
|
701
|
-
r.value = a.data,
|
|
728
|
+
r.value = a.data, b.value = a.filters;
|
|
702
729
|
} catch (a) {
|
|
703
|
-
|
|
730
|
+
$.danger(S(a));
|
|
704
731
|
} finally {
|
|
705
|
-
|
|
732
|
+
T.value = !1;
|
|
706
733
|
}
|
|
707
734
|
}
|
|
708
|
-
|
|
709
|
-
() => [
|
|
735
|
+
le(
|
|
736
|
+
() => [g.value, L.value, O.value, U.value, V.value],
|
|
710
737
|
() => {
|
|
711
|
-
|
|
738
|
+
R();
|
|
712
739
|
}
|
|
713
|
-
),
|
|
714
|
-
let
|
|
715
|
-
|
|
716
|
-
clearTimeout(
|
|
717
|
-
|
|
740
|
+
), R();
|
|
741
|
+
let ie;
|
|
742
|
+
le(J, (a) => {
|
|
743
|
+
clearTimeout(ie), ie = setTimeout(() => {
|
|
744
|
+
A.replace({ query: { ...u.query, q: a.trim() === "" ? void 0 : a } });
|
|
718
745
|
}, 300);
|
|
719
|
-
}),
|
|
720
|
-
function
|
|
721
|
-
|
|
722
|
-
query: { ...
|
|
746
|
+
}), ze(() => clearTimeout(ie));
|
|
747
|
+
function j(a, p) {
|
|
748
|
+
A.replace({
|
|
749
|
+
query: { ...u.query, [a]: typeof p == "number" ? String(p) : void 0 }
|
|
723
750
|
});
|
|
724
751
|
}
|
|
725
|
-
const
|
|
726
|
-
function
|
|
727
|
-
|
|
752
|
+
const re = (a) => (a ?? []).map((p) => ({ value: p.id, label: p.title }));
|
|
753
|
+
function se(a) {
|
|
754
|
+
A.push({ path: `${n.base}/${a.id}`, query: { ...u.query } });
|
|
728
755
|
}
|
|
729
|
-
async function
|
|
730
|
-
const a = await
|
|
731
|
-
a &&
|
|
756
|
+
async function K() {
|
|
757
|
+
const a = await B({});
|
|
758
|
+
a && se(a);
|
|
732
759
|
}
|
|
733
|
-
async function
|
|
760
|
+
async function Q() {
|
|
734
761
|
try {
|
|
735
762
|
await t.reorder(r.value.map((a) => a.id));
|
|
736
763
|
} catch (a) {
|
|
737
|
-
|
|
764
|
+
$.danger(S(a, i("panel.reorder-failed"))), await R();
|
|
738
765
|
}
|
|
739
766
|
}
|
|
740
767
|
function he(a) {
|
|
741
|
-
if (!
|
|
768
|
+
if (!z.value) return [];
|
|
742
769
|
if (m.value)
|
|
743
770
|
return [
|
|
744
771
|
{
|
|
@@ -746,279 +773,285 @@ const Wt = /* @__PURE__ */ ue({
|
|
|
746
773
|
icon: "refresh",
|
|
747
774
|
label: i("panel.restore"),
|
|
748
775
|
run: () => {
|
|
749
|
-
|
|
776
|
+
X(a);
|
|
750
777
|
}
|
|
751
778
|
}
|
|
752
779
|
];
|
|
753
|
-
const
|
|
754
|
-
{ key: "open", icon: "edit", label: i("panel.open"), run: () =>
|
|
780
|
+
const p = [
|
|
781
|
+
{ key: "open", icon: "edit", label: i("panel.open"), run: () => se(a) }
|
|
755
782
|
];
|
|
756
|
-
return a.url && a.status !== "draft" &&
|
|
783
|
+
return a.url && a.status !== "draft" && p.push({
|
|
757
784
|
key: "site",
|
|
758
785
|
icon: "external-link",
|
|
759
786
|
label: i("panel.open-on-site"),
|
|
760
787
|
href: a.url
|
|
761
|
-
}), a.url &&
|
|
788
|
+
}), a.url && p.push({
|
|
762
789
|
key: "copy",
|
|
763
790
|
icon: "copy",
|
|
764
791
|
label: i("panel.copy-address"),
|
|
765
792
|
run: () => {
|
|
766
|
-
|
|
793
|
+
ye(a);
|
|
767
794
|
}
|
|
768
|
-
}),
|
|
795
|
+
}), p.push(
|
|
769
796
|
a.status === "published" || a.status === "modified" ? {
|
|
770
797
|
key: "unpublish",
|
|
771
798
|
icon: "eye-off",
|
|
772
799
|
label: i("panel.unpublish"),
|
|
773
800
|
run: () => {
|
|
774
|
-
|
|
801
|
+
M(() => t.unpublish(a.id), i("panel.unpublished-done"));
|
|
775
802
|
}
|
|
776
803
|
} : {
|
|
777
804
|
key: "publish",
|
|
778
805
|
icon: "upload",
|
|
779
806
|
label: i("panel.publish"),
|
|
780
807
|
run: () => {
|
|
781
|
-
|
|
808
|
+
M(() => t.publish(a.id), i("panel.published"));
|
|
782
809
|
}
|
|
783
810
|
}
|
|
784
|
-
),
|
|
811
|
+
), p.push({
|
|
785
812
|
key: "delete",
|
|
786
813
|
icon: "trash",
|
|
787
814
|
label: i("panel.delete"),
|
|
788
815
|
danger: !0,
|
|
789
816
|
run: () => {
|
|
790
|
-
|
|
817
|
+
fe(a);
|
|
791
818
|
}
|
|
792
|
-
}),
|
|
819
|
+
}), p;
|
|
793
820
|
}
|
|
794
|
-
async function
|
|
795
|
-
await
|
|
821
|
+
async function fe(a) {
|
|
822
|
+
await Y({
|
|
796
823
|
title: i("panel.delete-title", { title: a.title }),
|
|
797
824
|
message: i("panel.delete-text"),
|
|
798
825
|
confirmText: i("panel.delete"),
|
|
799
826
|
cancelText: i("panel.cancel"),
|
|
800
827
|
tone: "danger"
|
|
801
|
-
}) && await
|
|
828
|
+
}) && await M(() => t.remove(a.id), i("panel.deleted"));
|
|
802
829
|
}
|
|
803
|
-
async function
|
|
804
|
-
await
|
|
830
|
+
async function X(a) {
|
|
831
|
+
await M(() => t.restore(a.id), i("panel.restored"));
|
|
805
832
|
}
|
|
806
|
-
async function
|
|
833
|
+
async function M(a, p) {
|
|
807
834
|
try {
|
|
808
|
-
await a(),
|
|
809
|
-
} catch (
|
|
810
|
-
|
|
835
|
+
await a(), $.success(p);
|
|
836
|
+
} catch (c) {
|
|
837
|
+
$.danger(S(c));
|
|
811
838
|
} finally {
|
|
812
|
-
await
|
|
839
|
+
await R();
|
|
813
840
|
}
|
|
814
841
|
}
|
|
815
|
-
async function
|
|
842
|
+
async function ye(a) {
|
|
816
843
|
if (a.url)
|
|
817
844
|
try {
|
|
818
|
-
await navigator.clipboard.writeText(a.url),
|
|
845
|
+
await navigator.clipboard.writeText(a.url), $.success(i("panel.address-copied"));
|
|
819
846
|
} catch {
|
|
820
847
|
}
|
|
821
848
|
}
|
|
822
|
-
function
|
|
849
|
+
function me(a) {
|
|
823
850
|
return a === "published" || a === "modified" ? "success" : "default";
|
|
824
851
|
}
|
|
825
|
-
function
|
|
852
|
+
function ge(a) {
|
|
826
853
|
return m.value ? "—" : a.path === null ? i("panel.no-address") : `/${a.path}`;
|
|
827
854
|
}
|
|
828
|
-
const
|
|
829
|
-
() =>
|
|
830
|
-
|
|
855
|
+
const be = f(
|
|
856
|
+
() => z.value ? [{ key: "new", label: i("panel.new"), icon: "plus", primary: !0, run: () => {
|
|
857
|
+
K();
|
|
831
858
|
} }] : []
|
|
832
859
|
);
|
|
833
|
-
return (a,
|
|
834
|
-
h(e(
|
|
835
|
-
view:
|
|
836
|
-
"onUpdate:view":
|
|
837
|
-
title:
|
|
838
|
-
views:
|
|
839
|
-
actions:
|
|
860
|
+
return (a, p) => (v(), N("div", It, [
|
|
861
|
+
h(e(Je), {
|
|
862
|
+
view: g.value,
|
|
863
|
+
"onUpdate:view": p[5] || (p[5] = (c) => g.value = c),
|
|
864
|
+
title: o.value,
|
|
865
|
+
views: I.value,
|
|
866
|
+
actions: be.value,
|
|
840
867
|
padding: "sm"
|
|
841
868
|
}, {
|
|
842
|
-
default:
|
|
843
|
-
|
|
844
|
-
h(e(
|
|
845
|
-
modelValue:
|
|
846
|
-
"onUpdate:modelValue":
|
|
869
|
+
default: d(() => [
|
|
870
|
+
E("div", Nt, [
|
|
871
|
+
h(e(Me), {
|
|
872
|
+
modelValue: J.value,
|
|
873
|
+
"onUpdate:modelValue": p[0] || (p[0] = (c) => J.value = c),
|
|
847
874
|
class: "wx-recipes__search",
|
|
848
875
|
size: "sm",
|
|
849
876
|
clearable: "",
|
|
850
877
|
placeholder: e(i)("panel.search"),
|
|
851
878
|
"aria-label": e(i)("panel.search")
|
|
852
879
|
}, {
|
|
853
|
-
prefix:
|
|
854
|
-
h(e(
|
|
880
|
+
prefix: d(() => [
|
|
881
|
+
h(e(xe), {
|
|
855
882
|
name: "search",
|
|
856
883
|
size: "sm"
|
|
857
884
|
})
|
|
858
885
|
]),
|
|
859
886
|
_: 1
|
|
860
887
|
}, 8, ["modelValue", "placeholder", "aria-label"]),
|
|
861
|
-
h(e(
|
|
888
|
+
h(e(_e), {
|
|
862
889
|
"model-value": L.value,
|
|
863
|
-
options:
|
|
890
|
+
options: re(b.value.categories),
|
|
864
891
|
placeholder: e(i)("panel.any-category"),
|
|
865
892
|
"aria-label": e(i)("panel.filter-category"),
|
|
866
893
|
clearable: "",
|
|
867
894
|
size: "sm",
|
|
868
|
-
"onUpdate:modelValue":
|
|
895
|
+
"onUpdate:modelValue": p[1] || (p[1] = (c) => j("category", c))
|
|
869
896
|
}, null, 8, ["model-value", "options", "placeholder", "aria-label"]),
|
|
870
|
-
h(e(
|
|
871
|
-
"model-value":
|
|
872
|
-
options:
|
|
897
|
+
h(e(_e), {
|
|
898
|
+
"model-value": O.value,
|
|
899
|
+
options: re(b.value.nutrients),
|
|
873
900
|
placeholder: e(i)("panel.any-nutrient"),
|
|
874
901
|
"aria-label": e(i)("panel.filter-nutrient"),
|
|
875
902
|
clearable: "",
|
|
876
903
|
size: "sm",
|
|
877
|
-
"onUpdate:modelValue":
|
|
904
|
+
"onUpdate:modelValue": p[2] || (p[2] = (c) => j("nutrient", c))
|
|
878
905
|
}, null, 8, ["model-value", "options", "placeholder", "aria-label"]),
|
|
879
|
-
|
|
906
|
+
b.value.services !== null ? (v(), k(e(_e), {
|
|
880
907
|
key: 0,
|
|
881
|
-
"model-value":
|
|
882
|
-
options:
|
|
908
|
+
"model-value": U.value,
|
|
909
|
+
options: re(b.value.services),
|
|
883
910
|
placeholder: e(i)("panel.any-service"),
|
|
884
911
|
"aria-label": e(i)("panel.filter-service"),
|
|
885
912
|
clearable: "",
|
|
886
913
|
size: "sm",
|
|
887
|
-
"onUpdate:modelValue":
|
|
888
|
-
}, null, 8, ["model-value", "options", "placeholder", "aria-label"])) :
|
|
914
|
+
"onUpdate:modelValue": p[3] || (p[3] = (c) => j("service", c))
|
|
915
|
+
}, null, 8, ["model-value", "options", "placeholder", "aria-label"])) : q("", !0)
|
|
889
916
|
]),
|
|
890
|
-
|
|
917
|
+
T.value && r.value.length === 0 ? (v(), k(e(ue), {
|
|
891
918
|
key: 0,
|
|
892
919
|
class: "wx-recipes__loading",
|
|
893
920
|
rows: 5
|
|
894
|
-
})) : r.value.length === 0 ? (v(), k(e(
|
|
921
|
+
})) : r.value.length === 0 ? (v(), k(e(De), {
|
|
895
922
|
key: 1,
|
|
896
|
-
title:
|
|
897
|
-
description:
|
|
898
|
-
}, null, 8, ["title", "description"])) : (v(),
|
|
899
|
-
h(e(
|
|
923
|
+
title: F.value,
|
|
924
|
+
description: H.value ? e(i)("panel.empty-help") : void 0
|
|
925
|
+
}, null, 8, ["title", "description"])) : (v(), N(te, { key: 2 }, [
|
|
926
|
+
h(e(mt), {
|
|
900
927
|
modelValue: r.value,
|
|
901
|
-
"onUpdate:modelValue":
|
|
902
|
-
class:
|
|
928
|
+
"onUpdate:modelValue": p[4] || (p[4] = (c) => r.value = c),
|
|
929
|
+
class: ke(["wx-recipes__list", { "is-loading": T.value }]),
|
|
903
930
|
plain: "",
|
|
904
931
|
"item-key": "id",
|
|
905
|
-
handle:
|
|
906
|
-
"item-label": (
|
|
907
|
-
disabled: !
|
|
908
|
-
onMove:
|
|
932
|
+
handle: D.value ? "grip" : "row",
|
|
933
|
+
"item-label": (c) => c.title,
|
|
934
|
+
disabled: !D.value,
|
|
935
|
+
onMove: Q
|
|
909
936
|
}, {
|
|
910
|
-
default:
|
|
911
|
-
(v(), k(
|
|
912
|
-
default:
|
|
913
|
-
|
|
914
|
-
class:
|
|
937
|
+
default: d(({ item: c }) => [
|
|
938
|
+
(v(), k(it(m.value ? "div" : "router-link"), rt({ class: "wx-recipe-row" }, m.value ? {} : { to: { path: `${n.base}/${c.id}`, query: e(u).query } }), {
|
|
939
|
+
default: d(() => [
|
|
940
|
+
E("span", {
|
|
941
|
+
class: ke(["wx-recipe-row__cover", { "is-empty": !c.cover?.thumb }])
|
|
915
942
|
}, [
|
|
916
|
-
|
|
943
|
+
c.cover?.thumb ? (v(), N("img", {
|
|
917
944
|
key: 0,
|
|
918
|
-
src:
|
|
945
|
+
src: c.cover.thumb,
|
|
919
946
|
alt: "",
|
|
920
947
|
loading: "lazy"
|
|
921
|
-
}, null, 8,
|
|
948
|
+
}, null, 8, qt)) : (v(), k(e(xe), {
|
|
922
949
|
key: 1,
|
|
923
950
|
name: "image",
|
|
924
951
|
size: "sm"
|
|
925
952
|
}))
|
|
926
953
|
], 2),
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
954
|
+
E("span", At, [
|
|
955
|
+
E("span", Dt, w(c.title), 1),
|
|
956
|
+
E("span", Mt, [
|
|
957
|
+
_(w(ge(c)), 1),
|
|
958
|
+
m.value ? q("", !0) : (v(), k(e(Qe), {
|
|
959
|
+
key: 0,
|
|
960
|
+
locale: c.address_locale
|
|
961
|
+
}, null, 8, ["locale"]))
|
|
962
|
+
])
|
|
930
963
|
]),
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
(v(!0),
|
|
934
|
-
key:
|
|
964
|
+
E("span", Et, [
|
|
965
|
+
E("span", Pt, [
|
|
966
|
+
(v(!0), N(te, null, Ie(c.categories, (ae, we) => (v(), N(te, {
|
|
967
|
+
key: ae.id
|
|
935
968
|
}, [
|
|
936
|
-
|
|
969
|
+
we === 0 ? (v(), k(e(gt), {
|
|
937
970
|
key: 0,
|
|
938
971
|
content: e(i)("panel.main-category")
|
|
939
972
|
}, {
|
|
940
|
-
default:
|
|
941
|
-
h(e(
|
|
973
|
+
default: d(() => [
|
|
974
|
+
h(e(Z), {
|
|
942
975
|
size: "sm",
|
|
943
976
|
round: "",
|
|
944
977
|
type: "primary"
|
|
945
978
|
}, {
|
|
946
|
-
default:
|
|
947
|
-
_(
|
|
979
|
+
default: d(() => [
|
|
980
|
+
_(w(ae.title), 1)
|
|
948
981
|
]),
|
|
949
982
|
_: 2
|
|
950
983
|
}, 1024)
|
|
951
984
|
]),
|
|
952
985
|
_: 2
|
|
953
|
-
}, 1032, ["content"])) : (v(), k(e(
|
|
986
|
+
}, 1032, ["content"])) : (v(), k(e(Z), {
|
|
954
987
|
key: 1,
|
|
955
988
|
size: "sm",
|
|
956
989
|
round: ""
|
|
957
990
|
}, {
|
|
958
|
-
default:
|
|
959
|
-
_(
|
|
991
|
+
default: d(() => [
|
|
992
|
+
_(w(ae.title), 1)
|
|
960
993
|
]),
|
|
961
994
|
_: 2
|
|
962
995
|
}, 1024))
|
|
963
996
|
], 64))), 128))
|
|
964
997
|
]),
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
h(e(
|
|
998
|
+
E("span", Ut, [
|
|
999
|
+
c.minutes ? (v(), N("span", Bt, [
|
|
1000
|
+
h(e(xe), {
|
|
968
1001
|
name: "clock",
|
|
969
1002
|
size: "sm"
|
|
970
1003
|
}),
|
|
971
|
-
_(
|
|
972
|
-
])) :
|
|
973
|
-
h(e(
|
|
974
|
-
type:
|
|
1004
|
+
_(w(e(Vt)(c.minutes, e(i))), 1)
|
|
1005
|
+
])) : q("", !0),
|
|
1006
|
+
h(e(Z), {
|
|
1007
|
+
type: me(c.status),
|
|
975
1008
|
dot: "",
|
|
976
1009
|
size: "sm"
|
|
977
1010
|
}, {
|
|
978
|
-
default:
|
|
979
|
-
_(
|
|
1011
|
+
default: d(() => [
|
|
1012
|
+
_(w(e(i)(`panel.status-${c.status}`)), 1)
|
|
980
1013
|
]),
|
|
981
1014
|
_: 2
|
|
982
1015
|
}, 1032, ["type"]),
|
|
983
|
-
|
|
1016
|
+
c.status === "modified" ? (v(), k(e(Z), {
|
|
984
1017
|
key: 1,
|
|
985
1018
|
type: "primary",
|
|
986
1019
|
size: "sm",
|
|
987
1020
|
round: ""
|
|
988
1021
|
}, {
|
|
989
|
-
default:
|
|
990
|
-
_(
|
|
1022
|
+
default: d(() => [
|
|
1023
|
+
_(w(e(i)("panel.edits")), 1)
|
|
991
1024
|
]),
|
|
992
1025
|
_: 1
|
|
993
|
-
})) :
|
|
1026
|
+
})) : q("", !0)
|
|
994
1027
|
])
|
|
995
1028
|
])
|
|
996
1029
|
]),
|
|
997
1030
|
_: 2
|
|
998
1031
|
}, 1040))
|
|
999
1032
|
]),
|
|
1000
|
-
actions:
|
|
1001
|
-
h(e(
|
|
1002
|
-
actions: he(
|
|
1003
|
-
label:
|
|
1033
|
+
actions: d(({ item: c }) => [
|
|
1034
|
+
h(e(je), {
|
|
1035
|
+
actions: he(c),
|
|
1036
|
+
label: c.title
|
|
1004
1037
|
}, null, 8, ["actions", "label"])
|
|
1005
1038
|
]),
|
|
1006
1039
|
_: 1
|
|
1007
1040
|
}, 8, ["modelValue", "class", "handle", "item-label", "disabled"]),
|
|
1008
|
-
|
|
1041
|
+
z.value && !m.value ? (v(), k(e(Ae), {
|
|
1009
1042
|
key: 0,
|
|
1010
1043
|
class: "wx-recipes__note",
|
|
1011
1044
|
type: "info",
|
|
1012
|
-
description:
|
|
1013
|
-
}, null, 8, ["description"])) :
|
|
1045
|
+
description: ve.value
|
|
1046
|
+
}, null, 8, ["description"])) : q("", !0)
|
|
1014
1047
|
], 64))
|
|
1015
1048
|
]),
|
|
1016
1049
|
_: 1
|
|
1017
1050
|
}, 8, ["view", "title", "views", "actions"])
|
|
1018
1051
|
]));
|
|
1019
1052
|
}
|
|
1020
|
-
}),
|
|
1021
|
-
function
|
|
1053
|
+
}), Ot = /* @__PURE__ */ $e(Lt, [["__scopeId", "data-v-27e46b1b"]]);
|
|
1054
|
+
function Ht(l = "/recipes") {
|
|
1022
1055
|
return {
|
|
1023
1056
|
api: "recipes/categories",
|
|
1024
1057
|
path: `${l}/categories`,
|
|
@@ -1048,7 +1081,7 @@ function Ut(l = "/recipes") {
|
|
|
1048
1081
|
}
|
|
1049
1082
|
};
|
|
1050
1083
|
}
|
|
1051
|
-
function
|
|
1084
|
+
function Ft(l = "/recipes") {
|
|
1052
1085
|
return {
|
|
1053
1086
|
api: "recipes/nutrients",
|
|
1054
1087
|
path: `${l}/nutrients`,
|
|
@@ -1074,18 +1107,18 @@ function Bt(l = "/recipes") {
|
|
|
1074
1107
|
}
|
|
1075
1108
|
};
|
|
1076
1109
|
}
|
|
1077
|
-
function
|
|
1110
|
+
function Qt(l = {}) {
|
|
1078
1111
|
const n = l.path ?? "/recipes";
|
|
1079
1112
|
return [
|
|
1080
1113
|
{
|
|
1081
1114
|
id: "recipes",
|
|
1082
1115
|
path: n,
|
|
1083
1116
|
routes: [
|
|
1084
|
-
{ path: n, name: "webx.recipes", component:
|
|
1117
|
+
{ path: n, name: "webx.recipes", component: Ot, props: { base: n } },
|
|
1085
1118
|
{
|
|
1086
1119
|
path: `${n}/:id(\\d+)`,
|
|
1087
1120
|
name: "webx.recipes.edit",
|
|
1088
|
-
component:
|
|
1121
|
+
component: Tt,
|
|
1089
1122
|
props: { base: n }
|
|
1090
1123
|
}
|
|
1091
1124
|
],
|
|
@@ -1094,35 +1127,35 @@ function Kt(l = {}) {
|
|
|
1094
1127
|
* panel's (`wx-slug`, `wx-categories`, `wx-relations`, `wx-gallery`, `wx-rich-text`).
|
|
1095
1128
|
*/
|
|
1096
1129
|
types: {
|
|
1097
|
-
"wx-recipe-history": { component:
|
|
1130
|
+
"wx-recipe-history": { component: Ct, kind: "display" }
|
|
1098
1131
|
}
|
|
1099
1132
|
},
|
|
1100
1133
|
{
|
|
1101
1134
|
id: "recipe-categories",
|
|
1102
1135
|
path: `${n}/categories`,
|
|
1103
|
-
routes:
|
|
1136
|
+
routes: Re(Ht(n))
|
|
1104
1137
|
},
|
|
1105
1138
|
{
|
|
1106
1139
|
id: "recipe-nutrients",
|
|
1107
1140
|
path: `${n}/nutrients`,
|
|
1108
|
-
routes:
|
|
1141
|
+
routes: Re(Ft(n))
|
|
1109
1142
|
}
|
|
1110
1143
|
];
|
|
1111
1144
|
}
|
|
1112
1145
|
export {
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1146
|
+
Se as RECIPES_API,
|
|
1147
|
+
zt as WxRecipeCreateDialog,
|
|
1148
|
+
Tt as WxRecipeEditorPage,
|
|
1149
|
+
Ct as WxRecipeHistory,
|
|
1150
|
+
Ot as WxRecipesPage,
|
|
1118
1151
|
de as createRecipesApi,
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1152
|
+
Vt as formatMinutes,
|
|
1153
|
+
bt as provideRecipeEditor,
|
|
1154
|
+
Ht as recipeCategoriesOptions,
|
|
1155
|
+
Ee as recipeEditorKey,
|
|
1156
|
+
Ft as recipeNutrientsOptions,
|
|
1157
|
+
Qt as recipes,
|
|
1158
|
+
xt as recipesMessages,
|
|
1159
|
+
wt as useRecipeEditor
|
|
1127
1160
|
};
|
|
1128
1161
|
//# sourceMappingURL=index.js.map
|