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