@feedmepos/mf-menu-portal 1.0.4-dev.3 → 1.0.4-dev.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.
Files changed (80) hide show
  1. package/dist/{App-nS46pByh.js → App-CrpoLCjA.js} +3 -3
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-C9OSr8ft.js → ApplyProduct.vue_vue_type_script_setup_true_lang-Hdsnu29V.js} +1 -1
  3. package/dist/{BindingTable.vue_vue_type_script_setup_true_lang-DnvN5R5w.js → BindingTable.vue_vue_type_script_setup_true_lang-D3CmOOPY.js} +1 -1
  4. package/dist/{Catalog-B4RS8T29.js → Catalog-VU3HhNro.js} +4 -4
  5. package/dist/{CatalogBinding-6_783kbu.js → CatalogBinding-BNATtZEY.js} +3 -3
  6. package/dist/{CatalogEditTabs.vue_vue_type_script_setup_true_lang-BawCLY5-.js → CatalogEditTabs.vue_vue_type_script_setup_true_lang-BmG-xpW4.js} +3 -3
  7. package/dist/{CatalogEditor.vue_vue_type_script_setup_true_lang-BjP8ZXyb.js → CatalogEditor.vue_vue_type_script_setup_true_lang-BFsRDFpj.js} +7 -7
  8. package/dist/{CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Diapahfp.js → CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Bk4FqVmx.js} +14 -14
  9. package/dist/{Category-CqneIGq4.js → Category-DMoXTsfG.js} +5 -5
  10. package/dist/{Category-DNQH1CI7.js → Category-DxjdQ-NN.js} +2 -2
  11. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-B3Ts1O-9.js +847 -0
  12. package/dist/{CookingGuide-DTAiFmEL.js → CookingGuide-DiZZDYD-.js} +5 -5
  13. package/dist/{Group-DeUqUomY.js → Group-DFR8q-tt.js} +5 -5
  14. package/dist/{Group-5xO2j3CL.js → Group-rzfh_o6r.js} +2 -2
  15. package/dist/GroupList.vue_vue_type_script_setup_true_lang-DiN-wQXX.js +1807 -0
  16. package/dist/Ingredient-DpjGIuH9.js +505 -0
  17. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-CnI80Ojd.js +782 -0
  18. package/dist/{MenuSetting-DdekHsQy.js → MenuSetting-DR-pDSF_.js} +4 -4
  19. package/dist/OrderPacing-JcTuweqF.js +769 -0
  20. package/dist/{OrderPacingFields.vue_vue_type_script_setup_true_lang-C3SqQPSr.js → OrderPacingFields.vue_vue_type_script_setup_true_lang-HwwJ2mGv.js} +2 -2
  21. package/dist/{Preview-DGTw0POk.js → Preview-BZyun5lZ.js} +1 -1
  22. package/dist/{PriceTierNotice.vue_vue_type_script_setup_true_lang-DffhFv0Y.js → PriceTierNotice.vue_vue_type_script_setup_true_lang-DquqNbE1.js} +1 -1
  23. package/dist/PrintRoute-CzEx2dCt.js +518 -0
  24. package/dist/{Product-CsbcyIgD.js → Product-CQb0n06E.js} +4 -4
  25. package/dist/ProductAttributeFilter.vue_vue_type_script_setup_true_lang-B2KdolJS.js +7931 -0
  26. package/dist/{ProductEditorHost.vue_vue_type_script_setup_true_lang--rBKdKV7.js → ProductEditorHost.vue_vue_type_script_setup_true_lang-CBlDEjqF.js} +9 -9
  27. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-D8NQTCLx.js +2011 -0
  28. package/dist/{ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-DtCzHjpN.js → ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-cG47Pu-6.js} +1 -1
  29. package/dist/{ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-aDx01-WW.js → ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-0UwUcA2L.js} +630 -587
  30. package/dist/{ProductInternalTools-Ccd4dAmx.js → ProductInternalTools-QrBR1nFp.js} +2 -2
  31. package/dist/{ProductInventoryDialog-DYcKdKHi.js → ProductInventoryDialog-fV38GO1a.js} +1 -1
  32. package/dist/{ProductInventoryDialog.vue_vue_type_script_setup_true_lang-DySFcCJz.js → ProductInventoryDialog.vue_vue_type_script_setup_true_lang-Bzb3RrMg.js} +1 -1
  33. package/dist/ProductList.vue_vue_type_script_setup_true_lang-BwKQESr3.js +2765 -0
  34. package/dist/{ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-Dw2xiPYX.js → ProductVariantTranslationSheet.vue_vue_type_script_setup_true_lang-CDYcHXo1.js} +1 -1
  35. package/dist/{Products-phZwCZhU.js → Products-B8tysOAL.js} +3 -3
  36. package/dist/Publish-DTvOvFNa.js +1337 -0
  37. package/dist/Recipe-Ddx31csF.js +388 -0
  38. package/dist/{Scheduler-C-A5m92O.js → Scheduler-CST5L_cw.js} +314 -254
  39. package/dist/ServingSequence-DYyEZI2S.js +374 -0
  40. package/dist/{Setting-C24V-lps.js → Setting-Ip0pGjks.js} +6 -6
  41. package/dist/Subcategory-BIgjzVta.js +459 -0
  42. package/dist/{Takeaway-DywX5BiX.js → Takeaway-CekhGM-m.js} +2 -2
  43. package/dist/{Takeaway-BFP2ohJn.js → Takeaway-aXsPg4JT.js} +5 -5
  44. package/dist/{TakeawayList.vue_vue_type_script_setup_true_lang-B3QS7o1v.js → TakeawayList.vue_vue_type_script_setup_true_lang-CaRR4_j3.js} +4 -4
  45. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-CshqYpc9.js +1291 -0
  46. package/dist/Unit-BMW8u0Us.js +424 -0
  47. package/dist/{Variant-BBfWhH-s.js → Variant-CZsrYRMU.js} +5 -5
  48. package/dist/{_id_-BooM3FX1.js → _id_-D4swrvNa.js} +3 -3
  49. package/dist/{app-Bmgb8ACe.js → app-BWwwHsWi.js} +312 -312
  50. package/dist/app.js +1 -1
  51. package/dist/apps/mf-menu/src/app.d.ts +60 -0
  52. package/dist/apps/mf-menu/src/components/Product/BulkCategorySelect.vue.d.ts +37 -0
  53. package/dist/apps/mf-menu/src/components/Product/ProductAttributeFilter.vue.d.ts +11 -1
  54. package/dist/apps/mf-menu/src/components/ProductList.vue.d.ts +2 -2
  55. package/dist/apps/mf-menu/src/components/feature/NestedGroupManager/NestedGroupOverrideSheets.vue.d.ts +27 -0
  56. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesFilter.vue.d.ts +20 -0
  57. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  58. package/dist/assets/{menu-compute-CG-fX5pi.js → menu-compute-D7TdiHt4.js} +4 -4
  59. package/dist/assets/{validate-menu-BeGMWVns.js → validate-menu-DXppWUVq.js} +2 -2
  60. package/dist/mf-menu-portal.css +1 -1
  61. package/dist/{provide-CfF0FmUz.js → provide-CDmXzkhz.js} +67990 -66891
  62. package/dist/{useActionFeedback-DyUCQl2x.js → useActionFeedback-Dm2HDa_2.js} +1 -1
  63. package/dist/{FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js → vuedraggable-CBtQLb_S.js} +140 -139
  64. package/package.json +2 -2
  65. package/dist/CategoryList.vue_vue_type_script_setup_true_lang-Bt_onPrP.js +0 -797
  66. package/dist/GroupList.vue_vue_type_script_setup_true_lang-Dgya_JLB.js +0 -2183
  67. package/dist/Ingredient-BlDW3TfZ.js +0 -463
  68. package/dist/LinkProductSideSheet.vue_vue_type_script_setup_true_lang-0tCpJlOf.js +0 -709
  69. package/dist/OrderPacing-Bb2n5wmI.js +0 -698
  70. package/dist/PrintRoute-CJB4gIP2.js +0 -473
  71. package/dist/ProductChipSummary.vue_vue_type_script_setup_true_lang-D8DygCBl.js +0 -110
  72. package/dist/ProductGroupCreateSheet.vue_vue_type_script_setup_true_lang-J6LpJ5wT.js +0 -1257
  73. package/dist/ProductList.vue_vue_type_script_setup_true_lang-DTLslTpK.js +0 -10353
  74. package/dist/Publish-BeKIXu3z.js +0 -1261
  75. package/dist/Recipe-Fo4tBkBv.js +0 -350
  76. package/dist/ServingSequence-BrCwLSO7.js +0 -336
  77. package/dist/Subcategory-B0oZIKbw.js +0 -412
  78. package/dist/TreeEditorOpenner.vue_vue_type_script_setup_true_lang-D7mhnrXx.js +0 -1213
  79. package/dist/Unit-NhEwH-kr.js +0 -385
  80. package/dist/apps/mf-menu/src/views/MenuManagementEditor/RestaurantAttributesFilter.vue.d.ts +0 -2
@@ -1,1213 +0,0 @@
1
- import { defineComponent as H, shallowRef as W, computed as x, watch as te, onBeforeUnmount as ne, openBlock as v, createElementBlock as S, createBlock as E, unref as e, toDisplayString as j, createVNode as y, resolveComponent as V, Fragment as Z, createCommentVNode as M, ref as P, withKeys as se, withModifiers as K, withCtx as z, createElementVNode as L, h as pe, onUnmounted as ve, mergeProps as fe, normalizeClass as X, renderList as oe, onMounted as ce, nextTick as ge, renderSlot as ye } from "vue";
2
- import { useI18n as Q } from "@feedmepos/mf-common";
3
- import { components as be, useSnackbar as _e, useDialog as ke } from "@feedmepos/ui-library";
4
- import { _ as we } from "./ProductImageEditorDialog.vue_vue_type_script_setup_true_lang-DtCzHjpN.js";
5
- import { u as he } from "./useActionFeedback-DyUCQl2x.js";
6
- import { e as ee, u as J, b as me, N as ie, f as Ce, a as xe } from "./provide-CfF0FmUz.js";
7
- import { _ as $e, a as Ie } from "./ProductInlineCreateHost.vue_vue_type_script_setup_true_lang-aDx01-WW.js";
8
- import { _ as ue } from "./ProductFilterMenu.vue_vue_type_script_setup_true_lang-Cgc0Ms_n.js";
9
- import { _ as de } from "./FormSection.vue_vue_type_script_setup_true_lang-pY-_msnM.js";
10
- import { _ as Fe } from "./TranslationLanguageSelector.vue_vue_type_script_setup_true_lang-BJZ6VcrT.js";
11
- import { _ as Se } from "./TranslationSideSheet.vue_vue_type_script_setup_true_lang-B0j2PNih.js";
12
- import { u as Te } from "./useEditorValidation-Ctef5Bxt.js";
13
- import { O as ze } from "./LinkProductSideSheet.vue_vue_type_script_setup_true_lang-0tCpJlOf.js";
14
- import { _ as Ee } from "./CatalogLinkProductAction.vue_vue_type_script_setup_true_lang-Diapahfp.js";
15
- const Re = { class: "h-full overflow-auto pl-[25px]" }, Be = {
16
- key: 1,
17
- class: "fm-typo-en-body-md-400 p-24 text-center text-fm-color-neutral-gray-400"
18
- }, Le = /* @__PURE__ */ H({
19
- __name: "DetailPane",
20
- props: {
21
- selected: {}
22
- },
23
- setup(U, { expose: _ }) {
24
- const t = U, o = ee(), { t: n } = Q(), p = W(null), f = W(null), s = W({ status: "loading" });
25
- let w = null, $ = null;
26
- const R = x(
27
- () => s.value.status === "ready" ? s.value.value : null
28
- );
29
- function I() {
30
- var a;
31
- (a = p.value) == null || a.open("category");
32
- }
33
- function F() {
34
- var m, h;
35
- const a = (h = (m = t.selected) == null ? void 0 : m.selection) == null ? void 0 : h.itemId;
36
- d(), a && k(a);
37
- }
38
- _({ openCategoryCreate: I, refreshSelected: F });
39
- function d() {
40
- var a;
41
- w == null || w(), w = null, (a = f.value) == null || a.dispose(), f.value = null, s.value = { status: "loading" };
42
- }
43
- function g() {
44
- d(), $ == null || $.dispose(), $ = null;
45
- }
46
- function k(a) {
47
- $ ?? ($ = o.item.editorScope());
48
- const m = o.item.editor(a);
49
- f.value = m, s.value = m.get(), w = m.subscribe((h) => {
50
- s.value = h;
51
- });
52
- }
53
- function D(a) {
54
- var h;
55
- const m = ((h = R.value) == null ? void 0 : h.itemId) ?? null;
56
- d(), $ == null || $.select(a), m && k(m);
57
- }
58
- return te(
59
- () => t.selected,
60
- (a) => {
61
- var h;
62
- if (a && !a.selectable) return;
63
- const m = a == null ? void 0 : a.selection;
64
- (m == null ? void 0 : m.itemId) !== ((h = R.value) == null ? void 0 : h.itemId) && (d(), m && k(m.itemId));
65
- },
66
- { immediate: !0 }
67
- ), ne(g), (a, m) => {
68
- var h, O, l;
69
- return v(), S("div", Re, [
70
- R.value && f.value ? (v(), E($e, {
71
- key: 0,
72
- sdk: e(o),
73
- session: f.value,
74
- view: R.value,
75
- "tree-selection": (h = a.selected) == null ? void 0 : h.selection,
76
- "item-breadcrumb": (O = a.selected) == null ? void 0 : O.itemBreadcrumb,
77
- presentation: "tree",
78
- onCreateEntity: m[0] || (m[0] = (i) => {
79
- var T;
80
- return (T = p.value) == null ? void 0 : T.open(i);
81
- }),
82
- onSelectScope: m[1] || (m[1] = (i) => D(i))
83
- }, null, 8, ["sdk", "session", "view", "tree-selection", "item-breadcrumb"])) : (v(), S("p", Be, j(e(n)("menu.tree_editor.labels.please_select_a_product_to_edit")), 1)),
84
- y(Ie, {
85
- ref_key: "inlineCreate",
86
- ref: p,
87
- "item-id": ((l = R.value) == null ? void 0 : l.itemId) ?? null,
88
- presentation: "tree",
89
- sdk: e(o)
90
- }, null, 8, ["item-id", "sdk"])
91
- ]);
92
- };
93
- }
94
- }), De = /* @__PURE__ */ H({
95
- __name: "EditorHistoryControls",
96
- props: {
97
- canUndo: { type: Boolean },
98
- canRedo: { type: Boolean },
99
- committing: { type: Boolean }
100
- },
101
- emits: ["undo", "redo"],
102
- setup(U, { emit: _ }) {
103
- const t = _, { t: o } = Q();
104
- return (n, p) => {
105
- const f = V("FmButton");
106
- return v(), S(Z, null, [
107
- y(f, {
108
- "aria-label": e(o)("menu.tree_editor.actions.undo"),
109
- disabled: !n.canUndo || n.committing,
110
- icon: "undo",
111
- variant: "tertiary",
112
- onClick: p[0] || (p[0] = (s) => t("undo"))
113
- }, null, 8, ["aria-label", "disabled"]),
114
- y(f, {
115
- "aria-label": e(o)("menu.tree_editor.actions.redo"),
116
- disabled: !n.canRedo || n.committing,
117
- icon: "redo",
118
- variant: "tertiary",
119
- onClick: p[1] || (p[1] = (s) => t("redo"))
120
- }, null, 8, ["aria-label", "disabled"])
121
- ], 64);
122
- };
123
- }
124
- }), Me = { class: "space-y-8" }, Ve = /* @__PURE__ */ H({
125
- __name: "ScopeSwitcher",
126
- setup(U) {
127
- const _ = ee(), { t } = Q(), o = J(_.context.current), n = J(_.catalog.list), p = J(_.scheduler.list), f = J(_.tree.view), s = x(
128
- () => o.value.status === "ready" ? o.value.value : { catalogId: null, schedulerId: null }
129
- ), w = x(() => [
130
- { label: t("menu.tree_editor.labels.main_catalog"), value: null },
131
- ...n.value.status === "ready" ? n.value.value.rows.map((d) => ({
132
- label: d.name,
133
- value: d.id
134
- })) : []
135
- ]), $ = x(() => [
136
- { label: t("menu.tree_editor.labels.all_time"), value: null },
137
- ...p.value.status === "ready" ? p.value.value.rows.map((d) => ({
138
- label: d.name,
139
- value: d.id
140
- })) : []
141
- ]), R = x(() => {
142
- const d = w.value.find(
143
- (g) => g.value === s.value.catalogId
144
- );
145
- return t("menu.common.labels.a11y_labelled_name", {
146
- label: t("menu.common.labels.catalog"),
147
- name: (d == null ? void 0 : d.label) ?? t("menu.tree_editor.labels.main_catalog")
148
- });
149
- }), I = x(() => {
150
- const d = $.value.find(
151
- (g) => g.value === s.value.schedulerId
152
- );
153
- return t("menu.common.labels.a11y_labelled_name", {
154
- label: t("menu.common.labels.scheduler"),
155
- name: (d == null ? void 0 : d.label) ?? t("menu.tree_editor.labels.all_time")
156
- });
157
- }), F = x(
158
- () => f.value.status === "ready" && f.value.value.schedulerScopeAvailable
159
- );
160
- return (d, g) => (v(), S("div", Me, [
161
- y(ue, {
162
- "model-value": s.value.catalogId,
163
- options: w.value,
164
- title: R.value,
165
- "full-width": "",
166
- "onUpdate:modelValue": g[0] || (g[0] = (k) => e(_).context.select({ catalogId: k }))
167
- }, null, 8, ["model-value", "options", "title"]),
168
- F.value ? (v(), E(ue, {
169
- key: 0,
170
- "model-value": s.value.schedulerId,
171
- options: $.value,
172
- title: I.value,
173
- "full-width": "",
174
- "onUpdate:modelValue": g[1] || (g[1] = (k) => e(_).context.select({ schedulerId: k }))
175
- }, null, 8, ["model-value", "options", "title"])) : M("", !0)
176
- ]));
177
- }
178
- }), Ue = { key: 0 }, Ae = { class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400" }, Oe = { class: "fm-typo-en-title-sm-600" }, Ne = { class: "max-h-[60vh] min-h-0 flex-1 overflow-y-auto" }, Pe = /* @__PURE__ */ H({
179
- __name: "RestaurantAttributesFilter",
180
- setup(U) {
181
- const _ = ee(), { t } = Q(), o = J(_.tree.view), n = x(
182
- () => o.value.status === "ready" ? o.value.value.restaurantFilter : null
183
- ), p = P(!1), f = P({}), s = P({});
184
- function w() {
185
- var d;
186
- (d = n.value) != null && d.available && (f.value = { ...n.value.selectedCustom }, s.value = { ...n.value.selectedStandard }, p.value = !0);
187
- }
188
- function $() {
189
- _.tree.setRestaurantFilter({
190
- custom: f.value,
191
- standard: s.value
192
- }), p.value = !1;
193
- }
194
- const R = x(
195
- () => {
196
- var d;
197
- return (((d = n.value) == null ? void 0 : d.custom) ?? []).map((g) => ({ ...g, kind: "custom" }));
198
- }
199
- ), I = x(
200
- () => {
201
- var d;
202
- return (((d = n.value) == null ? void 0 : d.standard) ?? []).map((g) => ({ ...g, kind: "standard" }));
203
- }
204
- ), F = [
205
- {
206
- header: () => t("portalshell.customAttributes.form.key"),
207
- accessorKey: "key",
208
- enableSorting: !1
209
- },
210
- {
211
- header: () => t("portalshell.customAttributes.form.value"),
212
- accessorKey: "values",
213
- enableSorting: !1,
214
- cell: (d) => {
215
- const g = d.row.original, k = g.kind === "custom" ? f : s, D = t("menu.common.labels.a11y_labelled_name", {
216
- label: t(
217
- g.kind === "custom" ? "menu.link_product.rules.restaurant_custom_attributes_filter" : "menu.link_product.rules.restaurant_filter"
218
- ),
219
- name: g.key
220
- }), a = (m) => {
221
- var h;
222
- m.el instanceof HTMLElement && ((h = m.el.querySelector("input")) == null || h.setAttribute("aria-label", D));
223
- };
224
- return pe(be.FmSelect, {
225
- "aria-label": D,
226
- modelValue: k.value[g.key] ?? null,
227
- onVnodeMounted: a,
228
- onVnodeUpdated: a,
229
- placeholder: t("portalshell.customAttributes.form.valuePlaceholder"),
230
- items: g.values.map((m) => ({ label: m, value: m })),
231
- clearable: !0,
232
- searchable: !0,
233
- "onUpdate:modelValue": (m) => {
234
- k.value = { ...k.value, [g.key]: m ?? "" };
235
- }
236
- });
237
- }
238
- }
239
- ];
240
- return (d, g) => {
241
- var l;
242
- const k = V("FmIcon"), D = V("FmChip"), a = V("FmTable"), m = V("FmSpacer"), h = V("FmButton"), O = V("FmDialog");
243
- return (l = n.value) != null && l.available ? (v(), S("div", Ue, [
244
- y(D, {
245
- class: "w-full cursor-pointer justify-between",
246
- role: "button",
247
- tabindex: "0",
248
- "aria-label": e(t)("menu.catalog.form.restaurant_attributes_title"),
249
- onClick: w,
250
- onKeydown: [
251
- se(K(w, ["prevent"]), ["enter"]),
252
- se(K(w, ["prevent"]), ["space"])
253
- ]
254
- }, {
255
- default: z(() => [
256
- L("span", Ae, j(e(t)("menu.catalog.form.restaurant_attributes_title")), 1),
257
- y(k, {
258
- color: "neutral-gray-400",
259
- name: "launch",
260
- size: "sm"
261
- })
262
- ]),
263
- _: 1
264
- }, 8, ["aria-label", "onKeydown"]),
265
- y(O, {
266
- modelValue: p.value,
267
- "onUpdate:modelValue": g[1] || (g[1] = (i) => p.value = i),
268
- overlay: !0,
269
- "min-width": "min(calc(100% - 48px), 560px)"
270
- }, {
271
- "dialog-header": z(() => [
272
- L("div", Oe, j(e(t)("menu.catalog.form.restaurant_attributes_title")), 1)
273
- ]),
274
- "dialog-footer": z(() => [
275
- y(m),
276
- y(h, {
277
- label: e(t)("menu.common.actions.confirm"),
278
- size: "lg",
279
- type: "submit",
280
- variant: "primary",
281
- onClick: $
282
- }, null, 8, ["label"]),
283
- y(h, {
284
- label: e(t)("menu.common.actions.cancel"),
285
- size: "lg",
286
- variant: "tertiary",
287
- onClick: g[0] || (g[0] = (i) => p.value = !1)
288
- }, null, 8, ["label"])
289
- ]),
290
- default: z(() => [
291
- L("div", Ne, [
292
- y(de, {
293
- title: e(t)("menu.link_product.rules.restaurant_custom_attributes_filter")
294
- }, {
295
- default: z(() => [
296
- y(a, {
297
- "column-defs": F,
298
- "row-data": R.value,
299
- "shrink-at": !1,
300
- "page-size": R.value.length,
301
- "hide-footer": ""
302
- }, null, 8, ["row-data", "page-size"])
303
- ]),
304
- _: 1
305
- }, 8, ["title"]),
306
- y(de, {
307
- title: e(t)("menu.link_product.rules.restaurant_filter")
308
- }, {
309
- default: z(() => [
310
- y(a, {
311
- "column-defs": F,
312
- "row-data": I.value,
313
- "shrink-at": !1,
314
- "page-size": I.value.length,
315
- "hide-footer": ""
316
- }, null, 8, ["row-data", "page-size"])
317
- ]),
318
- _: 1
319
- }, 8, ["title"])
320
- ])
321
- ]),
322
- _: 1
323
- }, 8, ["modelValue"])
324
- ])) : M("", !0);
325
- };
326
- }
327
- }), je = { class: "space-y-8" }, Ke = /* @__PURE__ */ H({
328
- __name: "TreeFilter",
329
- setup(U) {
330
- const _ = ee(), { t } = Q(), o = P("");
331
- let n;
332
- return te(o, (p) => {
333
- n && clearTimeout(n), n = setTimeout(() => _.tree.setQuery(p), 300);
334
- }), ve(() => {
335
- n && clearTimeout(n);
336
- }), (p, f) => {
337
- const s = V("FmSearch");
338
- return v(), S("div", je, [
339
- y(Ve),
340
- y(Pe),
341
- f[1] || (f[1] = L("div", { class: "h-[1px] bg-fm-color-neutral-gray-100" }, null, -1)),
342
- y(s, {
343
- modelValue: o.value,
344
- "onUpdate:modelValue": f[0] || (f[0] = (w) => o.value = w),
345
- placeholder: e(t)("menu.tree_editor.labels.search")
346
- }, null, 8, ["modelValue", "placeholder"])
347
- ]);
348
- };
349
- }
350
- }), He = { class: "fm-typo-en-title-sm-600" }, qe = /* @__PURE__ */ H({
351
- __name: "CategoryRenameDialog",
352
- props: {
353
- categoryId: {}
354
- },
355
- emits: ["close"],
356
- setup(U, { emit: _ }) {
357
- const t = U, o = _, n = ee(), { t: p } = Q(), f = me(), s = W(null), w = W({
358
- status: "loading"
359
- }), $ = x(
360
- () => w.value.status === "ready" ? w.value.value : null
361
- ), R = Te(() => s.value), I = x(
362
- () => $.value ? R.issue($.value.fieldIssues, "name") ?? $.value.nameIssue : null
363
- );
364
- let F = null;
365
- const d = W(null), g = W(
366
- null
367
- ), k = x(
368
- () => {
369
- var C;
370
- return ((C = g.value) == null ? void 0 : C.status) === "ready" ? g.value.value : null;
371
- }
372
- ), D = W(!1);
373
- let a = null;
374
- function m(C) {
375
- var c;
376
- a == null || a(), a = null, C && ((c = d.value) == null || c.dispose()), d.value = null, g.value = null, D.value = !1;
377
- }
378
- function h(C) {
379
- var c, b;
380
- m(!0), F == null || F(), F = null, C ? (c = s.value) == null || c.discard() : (b = s.value) == null || b.dispose(), s.value = null, w.value = { status: "loading" };
381
- }
382
- te(
383
- () => t.categoryId,
384
- (C) => {
385
- if (s.value && h(!0), !C) return;
386
- const c = n.category.editor(C);
387
- s.value = c, w.value = c.get(), F = c.subscribe((b) => {
388
- w.value = b;
389
- });
390
- },
391
- { immediate: !0 }
392
- ), ne(() => h(!0));
393
- async function O() {
394
- const C = s.value;
395
- !C || (await R.submit(() => C.submit())).kind !== "success" || (h(!1), o("close"));
396
- }
397
- function l() {
398
- h(!0), o("close");
399
- }
400
- function i() {
401
- var b;
402
- const C = s.value;
403
- if (!C || ((b = $.value) == null ? void 0 : b.translation.state) !== "allowed") return;
404
- m(!0);
405
- const c = C.translationEditor();
406
- d.value = c, g.value = c.get(), a = c.subscribe((Y) => {
407
- g.value = Y;
408
- }), D.value = !0;
409
- }
410
- function T(C) {
411
- var Y;
412
- const c = d.value, b = (Y = k.value) == null ? void 0 : Y.nameLocale;
413
- if (!(!c || !b)) {
414
- for (const q of Object.keys(b))
415
- q in C || c.removeLocale(q);
416
- for (const [q, u] of Object.entries(C))
417
- q in b || c.addLocale(q), c.setNameLocale(q, u);
418
- }
419
- }
420
- function N() {
421
- const C = d.value;
422
- C && C.apply().kind === "success" && m(!1);
423
- }
424
- return (C, c) => {
425
- const b = V("FmButton"), Y = V("FmForm"), q = V("FmSpacer"), u = V("FmDialog");
426
- return v(), S(Z, null, [
427
- y(u, {
428
- "model-value": C.categoryId !== null,
429
- overlay: !0,
430
- "min-width": "min(calc(100% - 48px), 480px)",
431
- "onUpdate:modelValue": c[0] || (c[0] = (r) => !r && l())
432
- }, {
433
- "dialog-header": z(() => [
434
- L("div", He, j(e(p)("menu.category.manager.dialog.update.title")), 1)
435
- ]),
436
- "dialog-footer": z(() => [
437
- y(q),
438
- y(b, {
439
- label: e(p)("menu.common.actions.cancel"),
440
- size: "md",
441
- variant: "tertiary",
442
- onClick: l
443
- }, null, 8, ["label"]),
444
- y(b, {
445
- label: e(p)("menu.category.manager.dialog.update.action"),
446
- size: "md",
447
- variant: "primary"
448
- }, null, 8, ["label"])
449
- ]),
450
- default: z(() => [
451
- y(Y, { onValidationSuccess: O }, {
452
- default: z(() => {
453
- var r;
454
- return [
455
- y(Fe, fe(
456
- {
457
- autofocus: "",
458
- "error-messages": I.value ? [e(f)(I.value)] : [],
459
- label: e(p)("menu.category.dialog.add.name.label"),
460
- placeholder: e(p)("menu.category.dialog.add.name.placeholder"),
461
- "model-value": ((r = $.value) == null ? void 0 : r.name) ?? ""
462
- },
463
- e(R).field("name", (B) => {
464
- var G;
465
- return (G = s.value) == null ? void 0 : G.setName(B);
466
- })
467
- ), {
468
- append: z(() => {
469
- var B;
470
- return [
471
- y(b, {
472
- "aria-label": e(p)("menu.common.translation.translation_label"),
473
- disabled: ((B = $.value) == null ? void 0 : B.translation.state) !== "allowed",
474
- icon: "g_translate",
475
- variant: "tertiary",
476
- onClick: i
477
- }, null, 8, ["aria-label", "disabled"])
478
- ];
479
- }),
480
- _: 1
481
- }, 16, ["error-messages", "label", "placeholder", "model-value"])
482
- ];
483
- }),
484
- _: 1
485
- })
486
- ]),
487
- _: 1
488
- }, 8, ["model-value"]),
489
- k.value ? (v(), E(Se, {
490
- key: 0,
491
- "model-value": D.value,
492
- dirty: k.value.dirty,
493
- name: k.value.name,
494
- "name-locale": k.value.nameLocale,
495
- "supported-locales": k.value.supportedLocales,
496
- title: e(p)("menu.common.translation.sheet_title", {
497
- entity: e(p)("menu.category.entity")
498
- }),
499
- "name-section-label": e(p)("menu.common.translation.name_section", {
500
- entity: e(p)("menu.category.entity")
501
- }),
502
- "z-index": 200,
503
- onDiscard: c[1] || (c[1] = (r) => m(!0)),
504
- onSave: N,
505
- "onUpdate:modelValue": c[2] || (c[2] = (r) => !r && m(!0)),
506
- "onUpdate:name": c[3] || (c[3] = (r) => {
507
- var B;
508
- return (B = d.value) == null ? void 0 : B.setName(r);
509
- }),
510
- "onUpdate:nameLocale": T
511
- }, null, 8, ["model-value", "dirty", "name", "name-locale", "supported-locales", "title", "name-section-label"])) : M("", !0)
512
- ], 64);
513
- };
514
- }
515
- }), le = /* @__PURE__ */ H({
516
- __name: "TextChip",
517
- props: {
518
- label: {},
519
- variant: {},
520
- border: { type: Boolean },
521
- bold: { type: Boolean, default: !0 },
522
- size: { default: "md" }
523
- },
524
- setup(U) {
525
- const _ = U, t = {
526
- neutral: "text-fm-color-typo-neutral bg-fm-color-neutral-gray-100",
527
- primary: "text-fm-color-typo-primary bg-fm-color-system-primary-100",
528
- secondary: "text-fm-color-typo-secondary bg-fm-color-system-secondary-100",
529
- success: "text-fm-color-typo-success bg-fm-color-system-success-100",
530
- warning: "text-fm-color-primary bg-fm-color-system-warning-100",
531
- error: "text-fm-color-typo-error bg-fm-color-system-error-100",
532
- info: "text-fm-color-typo-info bg-fm-color-system-info-100"
533
- }, o = x(() => _.size === "xs" ? "text-[8px] tracking-wide leading-[10px] no-underline" : _.size === "sm" ? _.bold ? "fm-typo-en-body-sm-600" : "fm-typo-en-body-sm-400" : _.bold ? "fm-typo-en-body-md-600" : "fm-typo-en-body-md-400");
534
- return (n, p) => (v(), S("span", {
535
- class: X(["inline-block fm-corner-radius-md px-4 py-[2px] text-nowrap max-w-full", [
536
- o.value,
537
- t[n.variant],
538
- n.border ? "border border-fm-color-neutral-gray-400" : ""
539
- ]])
540
- }, j(n.label), 3));
541
- }
542
- }), We = ["aria-selected", "aria-expanded", "aria-label"], Qe = ["draggable", "data-node-id", "data-testid"], Ye = { class: "flex min-w-0 flex-1 items-center gap-4" }, Ge = { class: "flex min-w-0 items-center gap-4" }, Je = {
543
- key: 2,
544
- class: "w-24 shrink-0"
545
- }, Xe = { class: "flex shrink-0 items-center gap-4" }, Ze = { class: "tree-right-area relative flex shrink-0 items-center gap-4" }, et = { class: "absolute right-full flex items-center opacity-0 group-hover:static group-hover:opacity-100 focus-within:static focus-within:opacity-100" }, tt = {
546
- key: 0,
547
- role: "group"
548
- }, at = /* @__PURE__ */ H({
549
- __name: "TreeRow",
550
- props: {
551
- node: {},
552
- depth: {},
553
- expanded: {},
554
- selectedId: {},
555
- draggingId: {},
556
- currencySymbol: {}
557
- },
558
- emits: ["toggle", "select", "remove", "add-item", "rename", "catalog-link", "drag-start", "drag-end", "drop"],
559
- setup(U, { emit: _ }) {
560
- const t = U, o = _, { t: n, n: p } = Q(), f = x(() => t.expanded.has(t.node.id)), s = x(() => t.node.remove.state === "allowed"), w = x(() => t.node.kind === "item"), $ = x(() => t.node.addItem.state === "allowed"), R = x(() => {
561
- var l;
562
- return ((l = t.node.rename) == null ? void 0 : l.state) === "allowed";
563
- }), I = x(
564
- () => {
565
- var l;
566
- return ((l = t.node.linkToCatalog) == null ? void 0 : l.state) === "allowed";
567
- }
568
- ), F = x(
569
- () => {
570
- var l;
571
- return ((l = t.node.unlinkFromCatalog) == null ? void 0 : l.state) === "allowed";
572
- }
573
- ), d = x(() => t.node.children.length > 0);
574
- function g(l) {
575
- o("catalog-link", { node: t.node, linked: l }), w.value && t.node.selectable && o("select", t.node);
576
- }
577
- const k = x(
578
- () => t.node.labelMessage ? n(t.node.labelMessage.code) : t.node.label
579
- ), D = x(() => {
580
- const l = t.node.highlight.filter(Boolean);
581
- if (!l.length) return [{ text: k.value, highlighted: !1 }];
582
- const i = l.map((T) => T.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
583
- return k.value.split(new RegExp(`(${i})`, "gi")).map((T, N) => ({
584
- text: T,
585
- highlighted: N % 2 === 1
586
- }));
587
- }), a = x(() => k.value.trim()), m = x(
588
- () => ["pl-12", "pl-32", "pl-[52px]", "pl-72", "pl-[92px]", "pl-112"][Math.min(t.depth, 5)]
589
- ), h = x(() => t.node.kind === "category" || t.node.kind === "subCategory" ? "view_list" : t.node.kind === "group" ? "database" : t.node.kind === "variant" ? "lunch_dining" : "fastfood");
590
- function O(l) {
591
- const i = l.currentTarget.getBoundingClientRect(), T = (l.clientY - i.top) / i.height;
592
- return T < 0.25 ? "before" : T > 0.75 ? "after" : d.value || t.node.kind !== "item" ? "inside" : "after";
593
- }
594
- return (l, i) => {
595
- const T = V("FmIcon"), N = V("FmButton"), C = V("TreeRow", !0);
596
- return v(), S("li", {
597
- role: "treeitem",
598
- "aria-selected": l.node.selectable ? l.selectedId === l.node.id : void 0,
599
- "aria-expanded": d.value ? f.value : void 0,
600
- "aria-label": a.value,
601
- onClick: i[19] || (i[19] = K((c) => l.node.selectable && o("select", l.node), ["stop"]))
602
- }, [
603
- L("div", {
604
- class: X(["tree-row group relative flex max-w-full select-none items-center gap-4 rounded min-h-[32px] py-4 pr-8 hover:bg-fm-color-opacity-sm", [
605
- m.value,
606
- l.node.selectable ? "cursor-pointer" : void 0,
607
- l.selectedId === l.node.id ? "bg-fm-color-system-warning-100" : void 0
608
- ]]),
609
- draggable: l.node.draggable,
610
- "data-node-id": l.node.id,
611
- "data-testid": `tree-row-${l.node.id}`,
612
- onDragstart: i[6] || (i[6] = (c) => o("drag-start", l.node)),
613
- onDragend: i[7] || (i[7] = (c) => o("drag-end")),
614
- onDragover: i[8] || (i[8] = K(() => {
615
- }, ["prevent"])),
616
- onDrop: i[9] || (i[9] = K((c) => o("drop", { node: l.node, position: O(c) }), ["prevent"]))
617
- }, [
618
- L("div", Ye, [
619
- L("div", Ge, [
620
- l.node.draggable ? (v(), E(T, {
621
- key: 0,
622
- class: "invisible absolute left-0 shrink-0 text-fm-color-neutral-gray-400 group-hover:visible",
623
- name: "drag_indicator",
624
- outline: "",
625
- size: "sm"
626
- })) : M("", !0),
627
- d.value ? (v(), E(N, {
628
- key: 1,
629
- class: "shrink-0 !h-24 !w-24 !p-4",
630
- label: a.value,
631
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
632
- label: f.value ? e(n)("menu.tree_editor.actions.collapse_row") : e(n)("menu.tree_editor.actions.expand_row"),
633
- name: a.value
634
- }),
635
- size: "md",
636
- variant: "tertiary",
637
- onClick: i[0] || (i[0] = K((c) => o("toggle", l.node.id), ["stop"]))
638
- }, {
639
- default: z(() => [
640
- y(T, {
641
- name: f.value ? "expand_more" : "chevron_right",
642
- color: "neutral-gray-400",
643
- outline: "",
644
- size: "sm"
645
- }, null, 8, ["name"])
646
- ]),
647
- _: 1
648
- }, 8, ["label", "aria-label"])) : (v(), S("span", Je)),
649
- y(T, {
650
- name: h.value,
651
- class: "shrink-0 text-fm-color-neutral-gray-400",
652
- outline: "",
653
- size: "sm"
654
- }, null, 8, ["name"]),
655
- L("span", {
656
- class: X([
657
- "fm-typo-en-body-md-400 min-w-0 flex-1 truncate",
658
- l.selectedId === l.node.id ? "text-fm-color-primary" : void 0
659
- ])
660
- }, [
661
- (v(!0), S(Z, null, oe(D.value, (c, b) => (v(), S("span", {
662
- key: b,
663
- class: X(
664
- c.highlighted ? "bg-fm-color-system-warning-100" : void 0
665
- )
666
- }, j(c.text), 3))), 128))
667
- ], 2)
668
- ]),
669
- L("div", Xe, [
670
- l.node.kind === "category" && l.node.itemCount > 0 ? (v(), E(le, {
671
- key: 0,
672
- label: e(n)("menu.tree_editor.labels.products", { count: l.node.itemCount }),
673
- class: "shrink-0",
674
- size: "xs",
675
- variant: "neutral"
676
- }, null, 8, ["label"])) : M("", !0),
677
- w.value && l.node.groupCount > 0 ? (v(), E(le, {
678
- key: 1,
679
- label: e(n)("menu.tree_editor.labels.groups", { count: l.node.groupCount }),
680
- class: "shrink-0",
681
- size: "xs",
682
- variant: "neutral"
683
- }, null, 8, ["label"])) : M("", !0),
684
- w.value && l.node.variantCount > 0 ? (v(), E(le, {
685
- key: 2,
686
- label: e(n)("menu.tree_editor.labels.variants", {
687
- count: l.node.variantCount
688
- }),
689
- class: "shrink-0",
690
- size: "xs",
691
- variant: "neutral"
692
- }, null, 8, ["label"])) : M("", !0),
693
- l.node.orderFrom ? (v(), E(le, {
694
- key: 3,
695
- label: e(n)(e(ze)[l.node.orderFrom]),
696
- border: "",
697
- class: "shrink-0",
698
- size: "xs",
699
- variant: "neutral"
700
- }, null, 8, ["label"])) : M("", !0)
701
- ])
702
- ]),
703
- L("div", Ze, [
704
- L("div", et, [
705
- $.value ? (v(), E(N, {
706
- key: 0,
707
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
708
- label: e(n)("menu.tree_editor.actions.add_product"),
709
- name: a.value
710
- }),
711
- class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
712
- label: a.value,
713
- size: "md",
714
- variant: "tertiary",
715
- onClick: i[1] || (i[1] = K((c) => o("add-item", l.node), ["stop"]))
716
- }, {
717
- default: z(() => [
718
- y(T, {
719
- name: "add",
720
- color: "neutral-gray-400",
721
- outline: "",
722
- size: "sm"
723
- })
724
- ]),
725
- _: 1
726
- }, 8, ["aria-label", "label"])) : M("", !0),
727
- R.value ? (v(), E(N, {
728
- key: 1,
729
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
730
- label: e(n)("menu.tree_editor.actions.edit_category"),
731
- name: a.value
732
- }),
733
- class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
734
- label: a.value,
735
- size: "md",
736
- variant: "tertiary",
737
- onClick: i[2] || (i[2] = K((c) => o("rename", l.node), ["stop"]))
738
- }, {
739
- default: z(() => [
740
- y(T, {
741
- name: "edit",
742
- color: "neutral-gray-400",
743
- outline: "",
744
- size: "sm"
745
- })
746
- ]),
747
- _: 1
748
- }, 8, ["aria-label", "label"])) : M("", !0),
749
- s.value ? (v(), E(N, {
750
- key: 2,
751
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
752
- label: w.value ? e(n)("menu.tree_editor.actions.delete_product") : e(n)("menu.tree_editor.actions.delete_category"),
753
- name: a.value
754
- }),
755
- class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
756
- label: a.value,
757
- size: "md",
758
- variant: "tertiary",
759
- onClick: i[3] || (i[3] = K((c) => o("remove", l.node), ["stop"]))
760
- }, {
761
- default: z(() => [
762
- y(T, {
763
- name: "delete",
764
- color: "neutral-gray-400",
765
- outline: "",
766
- size: "sm"
767
- })
768
- ]),
769
- _: 1
770
- }, 8, ["aria-label", "label"])) : M("", !0),
771
- I.value ? (v(), E(N, {
772
- key: 3,
773
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
774
- label: w.value ? e(n)("menu.tree_editor.actions.link_product_to_catalog") : e(n)("menu.tree_editor.actions.link_category_to_catalog"),
775
- name: a.value
776
- }),
777
- class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
778
- label: a.value,
779
- size: "md",
780
- variant: "tertiary",
781
- onClick: i[4] || (i[4] = K((c) => g(!0), ["stop"]))
782
- }, {
783
- default: z(() => [
784
- y(T, {
785
- name: "add_link",
786
- color: "neutral-gray-400",
787
- outline: "",
788
- size: "sm"
789
- })
790
- ]),
791
- _: 1
792
- }, 8, ["aria-label", "label"])) : M("", !0),
793
- F.value ? (v(), E(N, {
794
- key: 4,
795
- "aria-label": e(n)("menu.common.labels.a11y_labelled_name", {
796
- label: e(n)(
797
- "menu.tree_editor.actions.unlink_product_from_catalog"
798
- ),
799
- name: a.value
800
- }),
801
- class: "shrink-0 !h-24 !w-24 !p-4 opacity-0 focus-visible:opacity-100 group-hover:opacity-100",
802
- label: a.value,
803
- size: "md",
804
- variant: "tertiary",
805
- onClick: i[5] || (i[5] = K((c) => g(!1), ["stop"]))
806
- }, {
807
- default: z(() => [
808
- y(T, {
809
- name: "link_off",
810
- color: "neutral-gray-400",
811
- outline: "",
812
- size: "sm"
813
- })
814
- ]),
815
- _: 1
816
- }, 8, ["aria-label", "label"])) : M("", !0)
817
- ]),
818
- l.node.price ? (v(), S("span", {
819
- key: 0,
820
- class: X([
821
- "fm-typo-en-body-md-400 shrink-0",
822
- l.node.priceTone === "primary" ? "text-fm-color-primary" : "text-fm-color-typo-secondary"
823
- ])
824
- }, j(l.currencySymbol) + j(e(p)(l.node.price.amount, {
825
- minimumFractionDigits: l.node.price.precision,
826
- maximumFractionDigits: l.node.price.precision
827
- })), 3)) : M("", !0)
828
- ])
829
- ], 42, Qe),
830
- f.value && d.value ? (v(), S("ul", tt, [
831
- (v(!0), S(Z, null, oe(l.node.children, (c) => (v(), E(C, {
832
- key: c.id,
833
- depth: l.depth + 1,
834
- "dragging-id": l.draggingId,
835
- expanded: l.expanded,
836
- "currency-symbol": l.currencySymbol,
837
- node: c,
838
- "selected-id": l.selectedId,
839
- onAddItem: i[10] || (i[10] = (b) => o("add-item", b)),
840
- onRename: i[11] || (i[11] = (b) => o("rename", b)),
841
- onCatalogLink: i[12] || (i[12] = (b) => o("catalog-link", b)),
842
- onRemove: i[13] || (i[13] = (b) => o("remove", b)),
843
- onDragEnd: i[14] || (i[14] = (b) => o("drag-end")),
844
- onDragStart: i[15] || (i[15] = (b) => o("drag-start", b)),
845
- onDrop: i[16] || (i[16] = (b) => o("drop", b)),
846
- onSelect: i[17] || (i[17] = (b) => o("select", b)),
847
- onToggle: i[18] || (i[18] = (b) => o("toggle", b))
848
- }, null, 8, ["depth", "dragging-id", "expanded", "currency-symbol", "node", "selected-id"]))), 128))
849
- ])) : M("", !0)
850
- ], 8, We);
851
- };
852
- }
853
- }), lt = { class: "relative flex h-full min-h-0 flex-col gap-4 p-8" }, nt = { class: "mt-12 flex items-center justify-between gap-4" }, ot = { class: "fm-typo-en-body-md-400 flex items-center" }, rt = { class: "ml-auto flex items-center" }, st = {
854
- key: 1,
855
- class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400",
856
- role: "alert"
857
- }, it = {
858
- key: 2,
859
- class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400",
860
- role: "status"
861
- }, ut = {
862
- key: 3,
863
- class: "fm-typo-en-body-md-400 p-16 text-fm-color-neutral-gray-400"
864
- }, dt = ["aria-label"], ct = {
865
- key: 0,
866
- class: "tree-overlay absolute inset-0 flex items-center justify-center bg-white/50"
867
- }, mt = /* @__PURE__ */ H({
868
- __name: "TreePanel",
869
- emits: ["select", "create-category"],
870
- setup(U, { emit: _ }) {
871
- const t = ee(), { t: o } = Q(), n = _e(), p = me(), f = _, s = J(t.tree.view), w = J(t.category.list), $ = x(
872
- () => s.value.status === "ready" ? s.value.value : null
873
- ), R = x(
874
- () => w.value.status === "ready" && w.value.value.create.state === "allowed"
875
- ), I = P(/* @__PURE__ */ new Set()), F = P(null), d = P(null), g = P(null), k = P(null), D = P(!1);
876
- let a = null, m = null;
877
- function h() {
878
- const u = k.value;
879
- D.value = !!u && u.scrollHeight > u.clientHeight + 1;
880
- }
881
- function O() {
882
- var r;
883
- const u = ((r = k.value) == null ? void 0 : r.querySelector('ul[role="tree"]')) ?? null;
884
- u !== m && (m && (a == null || a.unobserve(m)), u && (a == null || a.observe(u)), m = u), h();
885
- }
886
- ce(() => {
887
- a = new ResizeObserver(O), k.value && a.observe(k.value), O();
888
- }), ne(() => a == null ? void 0 : a.disconnect()), te([$, I], async () => {
889
- await ge(), O();
890
- }), te(
891
- () => {
892
- var u;
893
- return (u = $.value) == null ? void 0 : u.autoExpandIds;
894
- },
895
- (u) => {
896
- if (!(u != null && u.length)) return;
897
- const r = new Set(I.value);
898
- for (const B of u) r.add(B);
899
- I.value = r;
900
- },
901
- // The first published view can already carry a query's matches, so this has
902
- // to run on mount rather than only on the next change.
903
- { immediate: !0 }
904
- );
905
- function l(u) {
906
- const r = new Set(I.value);
907
- r.has(u) ? r.delete(u) : r.add(u), I.value = r;
908
- }
909
- function i() {
910
- var u;
911
- I.value = new Set(((u = $.value) == null ? void 0 : u.expandableIds) ?? []);
912
- }
913
- function T() {
914
- I.value = /* @__PURE__ */ new Set();
915
- }
916
- function N(u) {
917
- u.selectable && (F.value = u.id, f("select", u));
918
- }
919
- function C(u) {
920
- const r = u.kind === "rejected" ? p(u.issues[0]) : u.kind === "failure" ? p(u.error.message) : null;
921
- r !== null && n.open({
922
- type: "error",
923
- title: o("menu.tree_editor.feedback.update_failed"),
924
- message: r
925
- });
926
- }
927
- async function c(u) {
928
- if (!u.entityId) return;
929
- const r = u.kind === "item" ? await t.item.remove(u.entityId) : await t.category.remove(u.entityId);
930
- C(r);
931
- }
932
- async function b(u) {
933
- C(
934
- await t.tree.setCatalogLink(u.node.id, u.linked)
935
- );
936
- }
937
- async function Y(u) {
938
- if (!u.entityId) return;
939
- const r = t.item.editor(void 0, { loadInventoryCatalogue: !1 });
940
- try {
941
- r.setName(ie), r.setCategory(u.entityId);
942
- const B = await r.submit();
943
- if (B.kind === "success") {
944
- const G = new Set(I.value);
945
- G.add(u.id), I.value = G, n.open({
946
- type: "success",
947
- title: o("menu.tree_editor.feedback.product_created", {
948
- name: ie
949
- })
950
- });
951
- return;
952
- }
953
- C(B);
954
- } finally {
955
- r.dispose();
956
- }
957
- }
958
- async function q(u) {
959
- const r = d.value;
960
- if (d.value = null, !r || r === u.node.id) return;
961
- const B = await t.tree.rearrange({
962
- draggedNodeId: r,
963
- targetNodeId: u.node.id,
964
- position: u.position
965
- });
966
- B.kind === "rejected" ? n.open({ message: o(B.issues[0].code), type: "warning" }) : C(B);
967
- }
968
- return (u, r) => {
969
- const B = V("FmButton"), G = V("FmIcon"), re = V("FmCircularProgress");
970
- return v(), S("div", lt, [
971
- y(Ke),
972
- L("div", nt, [
973
- R.value ? (v(), E(B, {
974
- key: 0,
975
- label: e(o)("menu.tree_editor.actions.add_category"),
976
- "prepend-icon": "add",
977
- class: "!h-32 shrink-0 !gap-4 !px-8 !py-4",
978
- "text-color": "primary",
979
- variant: "plain",
980
- onClick: r[0] || (r[0] = (ae) => f("create-category"))
981
- }, {
982
- default: z(() => [
983
- L("span", ot, j(e(o)("menu.tree_editor.actions.add_category")), 1)
984
- ]),
985
- _: 1
986
- }, 8, ["label"])) : (v(), E(Ee, {
987
- key: 1,
988
- sdk: e(t),
989
- presentation: "tree"
990
- }, null, 8, ["sdk"])),
991
- L("div", rt, [
992
- y(B, {
993
- "aria-label": e(o)("menu.tree_editor.actions.expand_all"),
994
- label: e(o)("menu.tree_editor.actions.expand_all"),
995
- class: "shrink-0 !h-24 !w-24 !p-4",
996
- variant: "tertiary",
997
- onClick: i
998
- }, {
999
- default: z(() => [
1000
- y(G, {
1001
- name: "expand_all",
1002
- color: "neutral-gray-400",
1003
- outline: "",
1004
- size: "sm"
1005
- })
1006
- ]),
1007
- _: 1
1008
- }, 8, ["aria-label", "label"]),
1009
- y(B, {
1010
- "aria-label": e(o)("menu.tree_editor.actions.collapse_all"),
1011
- label: e(o)("menu.tree_editor.actions.collapse_all"),
1012
- class: "shrink-0 !h-24 !w-24 !p-4",
1013
- variant: "tertiary",
1014
- onClick: T
1015
- }, {
1016
- default: z(() => [
1017
- y(G, {
1018
- name: "collapse_all",
1019
- color: "neutral-gray-400",
1020
- outline: "",
1021
- size: "sm"
1022
- })
1023
- ]),
1024
- _: 1
1025
- }, 8, ["aria-label", "label"])
1026
- ])
1027
- ]),
1028
- L("div", {
1029
- ref_key: "scrollElement",
1030
- ref: k,
1031
- class: X(["menu-tree-scroll min-h-0 flex-1 overflow-auto", D.value ? "pr-[14px]" : void 0])
1032
- }, [
1033
- e(s).status === "loading" ? (v(), E(re, {
1034
- key: 0,
1035
- size: "lg"
1036
- })) : e(s).status === "error" ? (v(), S("p", st, j(e(p)(e(s).error.message)), 1)) : e(s).status === "unavailable" ? (v(), S("p", it, j(e(p)(e(s).reason)), 1)) : e(s).status === "ready" && e(s).value.nodes.length === 0 ? (v(), S("p", ut, j(e(o)("menu.tree_editor.labels.no_items")), 1)) : e(s).status === "ready" ? (v(), S("ul", {
1037
- key: 4,
1038
- "aria-label": e(o)("menu.tree_editor.labels.tree"),
1039
- role: "tree"
1040
- }, [
1041
- (v(!0), S(Z, null, oe(e(s).value.nodes, (ae) => (v(), E(at, {
1042
- key: ae.id,
1043
- depth: 0,
1044
- "dragging-id": d.value,
1045
- expanded: I.value,
1046
- node: ae,
1047
- "currency-symbol": e(s).value.currencySymbol,
1048
- "selected-id": F.value,
1049
- onAddItem: r[1] || (r[1] = (A) => Y(A)),
1050
- onRename: r[2] || (r[2] = (A) => g.value = A.entityId),
1051
- onCatalogLink: r[3] || (r[3] = (A) => b(A)),
1052
- onRemove: r[4] || (r[4] = (A) => c(A)),
1053
- onDragEnd: r[5] || (r[5] = (A) => d.value = null),
1054
- onDragStart: r[6] || (r[6] = (A) => d.value = A.id),
1055
- onDrop: r[7] || (r[7] = (A) => q(A)),
1056
- onSelect: r[8] || (r[8] = (A) => N(A)),
1057
- onToggle: r[9] || (r[9] = (A) => l(A))
1058
- }, null, 8, ["dragging-id", "expanded", "node", "currency-symbol", "selected-id"]))), 128))
1059
- ], 8, dt)) : M("", !0)
1060
- ], 2),
1061
- e(s).status === "ready" && e(s).stale ? (v(), S("div", ct, [
1062
- y(re, { size: "lg" })
1063
- ])) : M("", !0),
1064
- y(qe, {
1065
- "category-id": g.value,
1066
- onClose: r[10] || (r[10] = (ae) => g.value = null)
1067
- }, null, 8, ["category-id"])
1068
- ]);
1069
- };
1070
- }
1071
- }), pt = { class: "-mx-24 flex min-h-0 flex-1" }, vt = ["aria-label"], ft = ["aria-label"], gt = /* @__PURE__ */ H({
1072
- __name: "MenuManagementEditor",
1073
- props: {
1074
- draft: {}
1075
- },
1076
- emits: ["close"],
1077
- setup(U, { emit: _ }) {
1078
- const t = U, o = _, { t: n } = Q(), { run: p } = he(), f = P(null), s = P(null);
1079
- function w() {
1080
- var a;
1081
- (a = s.value) == null || a.openCategoryCreate();
1082
- }
1083
- function $() {
1084
- var a;
1085
- t.draft.undo(), (a = s.value) == null || a.refreshSelected();
1086
- }
1087
- function R() {
1088
- var a;
1089
- t.draft.redo(), (a = s.value) == null || a.refreshSelected();
1090
- }
1091
- Ce(t.draft);
1092
- const I = J(t.draft.state), F = x(
1093
- () => I.value.status === "ready" ? I.value.value : {
1094
- dirty: !1,
1095
- canUndo: !1,
1096
- canRedo: !1,
1097
- committing: !1,
1098
- invalidated: !0
1099
- }
1100
- ), d = ke();
1101
- async function g() {
1102
- (await p(() => t.draft.commit(), {
1103
- loadingTitle: n("menu.tree_editor.feedback.saving"),
1104
- successMessage: n("menu.tree_editor.feedback.saved")
1105
- })).kind === "success" && o("close");
1106
- }
1107
- async function k() {
1108
- (await p(() => t.draft.discard(), {
1109
- showLoading: !1
1110
- })).kind === "success" && o("close");
1111
- }
1112
- function D() {
1113
- if (!F.value.dirty) return void k();
1114
- d.open({
1115
- title: n("menu.tree_editor.actions.confirm_discard_title"),
1116
- message: n("menu.tree_editor.actions.confirm_discard_message"),
1117
- primaryActions: {
1118
- text: n("menu.tree_editor.actions.discard"),
1119
- variant: "primary",
1120
- close: !0
1121
- },
1122
- secondaryActions: {
1123
- text: n("menu.tree_editor.actions.keep_editing"),
1124
- variant: "tertiary",
1125
- close: !0
1126
- }
1127
- }).onPrimary(() => void k());
1128
- }
1129
- return (a, m) => (v(), E(we, {
1130
- "primary-action": {
1131
- label: e(n)("menu.tree_editor.actions.save"),
1132
- disabled: F.value.committing
1133
- },
1134
- "secondary-actions": [
1135
- { label: e(n)("menu.tree_editor.actions.cancel"), click: D }
1136
- ],
1137
- show: !0,
1138
- title: e(n)("menu.tree_editor.title"),
1139
- onOnCancel: D,
1140
- onOnPrimary: g
1141
- }, {
1142
- "append-title": z(() => [
1143
- y(De, {
1144
- "can-redo": F.value.canRedo,
1145
- "can-undo": F.value.canUndo,
1146
- committing: F.value.committing,
1147
- onRedo: R,
1148
- onUndo: $
1149
- }, null, 8, ["can-redo", "can-undo", "committing"])
1150
- ]),
1151
- default: z(() => [
1152
- L("div", pt, [
1153
- L("aside", {
1154
- "aria-label": e(n)("menu.tree_editor.labels.tree"),
1155
- class: "w-[300px] shrink-0 overflow-hidden border-r bg-fm-color-neutral-white pl-24"
1156
- }, [
1157
- y(mt, {
1158
- onCreateCategory: w,
1159
- onSelect: m[0] || (m[0] = (h) => f.value = h)
1160
- })
1161
- ], 8, vt),
1162
- L("section", {
1163
- "aria-label": e(n)("menu.tree_editor.labels.detail"),
1164
- class: "min-h-0 min-w-0 flex-1 overflow-hidden pr-24",
1165
- "data-testid": "menu-management-editor-detail-host"
1166
- }, [
1167
- y(Le, {
1168
- ref_key: "detailPane",
1169
- ref: s,
1170
- selected: f.value
1171
- }, null, 8, ["selected"])
1172
- ], 8, ft)
1173
- ])
1174
- ]),
1175
- _: 1
1176
- }, 8, ["primary-action", "secondary-actions", "title"]));
1177
- }
1178
- }), yt = "treeEditorOpen", Rt = /* @__PURE__ */ H({
1179
- __name: "TreeEditorOpenner",
1180
- props: {
1181
- canOpen: { type: Boolean },
1182
- listenForMessage: { type: Boolean, default: !0 }
1183
- },
1184
- setup(U) {
1185
- const _ = U, t = xe(), o = W(null);
1186
- function n() {
1187
- if (!_.canOpen || o.value) return;
1188
- const f = t.drafts.open();
1189
- f.kind === "success" && (o.value = f.value);
1190
- }
1191
- function p(f) {
1192
- var s;
1193
- _.canOpen && ((s = f.data) == null ? void 0 : s.type) === yt && n();
1194
- }
1195
- return ce(() => {
1196
- _.listenForMessage && window.addEventListener("message", p);
1197
- }), ne(() => {
1198
- var f;
1199
- _.listenForMessage && window.removeEventListener("message", p), (f = o.value) == null || f.dispose();
1200
- }), (f, s) => (v(), S(Z, null, [
1201
- ye(f.$slots, "default", { trigger: n }),
1202
- o.value ? (v(), E(gt, {
1203
- key: 0,
1204
- draft: o.value,
1205
- onClose: s[0] || (s[0] = (w) => o.value = null)
1206
- }, null, 8, ["draft"])) : M("", !0)
1207
- ], 64));
1208
- }
1209
- });
1210
- export {
1211
- Rt as _,
1212
- le as a
1213
- };