@feedmepos/mf-menu 0.32.39 → 0.32.40

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 (97) hide show
  1. package/dist/{App-Dg5GweBn.js → App-DqpxV0zp.js} +5 -5
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-DliryTNe.js → ApplyProduct.vue_vue_type_script_setup_true_lang-BQM40AWC.js} +3 -3
  3. package/dist/{Catalog-Cb66nkUU.js → Catalog-RdpK3RmL.js} +6 -6
  4. package/dist/{Category-CPFnvBBy.js → Category-DbvCHZU4.js} +5 -5
  5. package/dist/{Category-Cfd8CPSx.js → Category-ar15UpWV.js} +4 -4
  6. package/dist/{CookingGuide-DSHWh9Gt.js → CookingGuide-x2w_WTnE.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-DaCFX7KY.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-pRoVDEEM.js} +1 -1
  8. package/dist/{Group-DMmXyHKE.js → Group-D30WEl2L.js} +1 -1
  9. package/dist/{Group-CULwhVe7.js → Group-DevhimQn.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-BPXbprJG.js → Group.vue_vue_type_script_setup_true_lang-BY3nr67e.js} +116 -116
  11. package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-7y3GRcrl.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CPvumpiM.js} +5 -5
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-BrMdia8X.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-hEPchEwW.js} +1958 -1942
  13. package/dist/{Ingredient-BTeAgBic.js → Ingredient-CiJSeTgO.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-B373qMOc.js → InventoryBinding.vue_vue_type_script_setup_true_lang-Cnq9QAeQ.js} +2 -2
  15. package/dist/{LinkProductSideSheet-BQC5B7VR.js → LinkProductSideSheet-CJxffg6I.js} +3 -3
  16. package/dist/{MenuSetting-QrTjKewy.js → MenuSetting-BMuUIgLN.js} +5 -5
  17. package/dist/{PrintRoute-Cw_fjZuS.js → PrintRoute-Uu2n0dAY.js} +4 -4
  18. package/dist/{Product-TfZZCFxL.js → Product-e81DLAaw.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-Cf02oa8B.js → Product.vue_vue_type_script_setup_true_lang-1axfwskP.js} +13 -13
  20. package/dist/{ProductInternalTools--2ISZa9C.js → ProductInternalTools-BiK5b7KA.js} +5 -5
  21. package/dist/{Products-CU17YbjY.js → Products-DOIcfgzd.js} +65 -65
  22. package/dist/{Publish-C92_8tJc.js → Publish-d_T1ROxG.js} +3 -3
  23. package/dist/{Recipe-rN_AUIzI.js → Recipe-QIACzb3h.js} +4 -4
  24. package/dist/{RuleView.vue_vue_type_script_setup_true_lang-Be33vMlU.js → RuleView.vue_vue_type_script_setup_true_lang-01qpukRE.js} +2 -2
  25. package/dist/{Scheduler-udXY9Nxw.js → Scheduler-VxoCoh9o.js} +3 -3
  26. package/dist/{ServingSequence-lqstj5IH.js → ServingSequence-C7aNpyh4.js} +3 -3
  27. package/dist/{Setting-C8hhG68F.js → Setting-BzoqHU2T.js} +5 -5
  28. package/dist/Subcategory-dyK9h6SV.js +349 -0
  29. package/dist/{Takeaway-_ZUqMNYd.js → Takeaway-C3UnFVOa.js} +1 -1
  30. package/dist/{Takeaway-BNXBkxY3.js → Takeaway-DxLGfrmv.js} +4 -4
  31. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-DpIu-F5W.js → Takeaway.vue_vue_type_script_setup_true_lang-zsgXKNRt.js} +6 -6
  32. package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-D7Rx1dQ0.js → Thumbnail.vue_vue_type_script_setup_true_lang-Ba0ZuCdS.js} +4 -4
  33. package/dist/TranslationSideSheet.vue_vue_type_script_setup_true_lang-Xfmvx9wx.js +194 -0
  34. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-blAi_T2i.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang--vNq7F0Z.js} +1907 -1899
  35. package/dist/{Unit-Cb5D0Twk.js → Unit-Clc8AYHy.js} +2 -2
  36. package/dist/{Variant-CFwv2HLG.js → Variant-DOGe2aJK.js} +4 -4
  37. package/dist/{_id_-DfRWmsAf.js → _id_-Bbc2mu9G.js} +9 -9
  38. package/dist/{app-H7J5uHZg.js → app-BSpY6Pgy.js} +26 -26
  39. package/dist/{app-CEN10-4D.js → app-DQD4sPc8.js} +1 -1
  40. package/dist/app.js +1 -1
  41. package/dist/apps/mf-menu/src/components/ProductTranslationDialog.vue.d.ts +4 -0
  42. package/dist/apps/mf-menu/src/components/TranslationFieldSection.vue.d.ts +7 -3
  43. package/dist/apps/mf-menu/src/components/TranslationSideSheet.vue.d.ts +2 -0
  44. package/dist/apps/mf-menu/src/components/feature/ApplyProduct/index.d.ts +6 -0
  45. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierButton.vue.d.ts +6 -0
  46. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierForm.vue.d.ts +6 -0
  47. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/item.d.ts +6 -0
  48. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/scheduler.d.ts +3 -0
  49. package/dist/apps/mf-menu/src/components/feature/TreeEditor/composable/useItemFormManagement.d.ts +3 -0
  50. package/dist/apps/mf-menu/src/components/feature/TreeEditor/item/ItemForm.vue.d.ts +9 -0
  51. package/dist/apps/mf-menu/src/components/feature/TreeEditor/menuUtils.d.ts +3 -0
  52. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +7 -0
  53. package/dist/apps/mf-menu/src/components/import/PreviewAddonContent.vue.d.ts +6 -0
  54. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +3 -0
  55. package/dist/apps/mf-menu/src/helper/import-export-utils.d.ts +17 -0
  56. package/dist/apps/mf-menu/src/helper/itemCategories.d.ts +3 -0
  57. package/dist/apps/mf-menu/src/helper/menu.d.ts +3 -0
  58. package/dist/apps/mf-menu/src/helper/menuExport.d.ts +2 -2
  59. package/dist/apps/mf-menu/src/helper/menuImport.d.ts +7 -0
  60. package/dist/apps/mf-menu/src/helper/menuSanitizer.d.ts +7 -0
  61. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +7 -0
  62. package/dist/apps/mf-menu/src/stores/manager/item.d.ts +9 -0
  63. package/dist/apps/mf-menu/src/stores/manager/scheduler.d.ts +3 -0
  64. package/dist/apps/mf-menu/src/stores/menu.d.ts +7 -0
  65. package/dist/apps/mf-menu/src/views/Catalog/Edit/AddProductPopup/Form.vue.d.ts +6 -0
  66. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  67. package/dist/assets/linked-status-DojmxFzq.js +13 -0
  68. package/dist/assets/{menu-export-B_zRmLzS.js → menu-export-rmsdV9dK.js} +45 -45
  69. package/dist/assets/override-menu-CVjWw9he.js +13 -0
  70. package/dist/assets/{validate-menu-D4jvSNmz.js → validate-menu-BB1XuZ9d.js} +6 -6
  71. package/dist/{catalog-CTuBk61t.js → catalog-ku3nqGmL.js} +1 -1
  72. package/dist/{catalogSetting-DKVNY3JC.js → catalogSetting-CpgLgy9o.js} +1 -1
  73. package/dist/{currency--QAX2jgM.js → currency-B58wqs-1.js} +1 -1
  74. package/dist/{dayjs.min-Dyhv-966.js → dayjs.min-Dj2ONTtr.js} +1 -1
  75. package/dist/index-BGm9S8Ih.js +545 -0
  76. package/dist/{index-CCM6nQtW.js → index-ByMVMoTu.js} +1 -1
  77. package/dist/{index-IWdfpOvK.js → index-CPY_DjD2.js} +58 -54
  78. package/dist/{index.vue_vue_type_script_setup_true_lang-90aRfAsI.js → index.vue_vue_type_script_setup_true_lang-IHmRgZTC.js} +13190 -13149
  79. package/dist/{item-CKij6BhH.js → item-DotiWZRv.js} +2967 -2925
  80. package/dist/{jszip.min-C-AOVv_w.js → jszip.min-OZZMb1gD.js} +2 -2
  81. package/dist/{menu-CX5qZa4q.js → menu-v_Cm5BNh.js} +1 -1
  82. package/dist/{menuV2-CgfWTiZp.js → menuV2-DsvYmLeh.js} +139 -139
  83. package/dist/mf-menu.css +1 -1
  84. package/dist/{priceTier-CKw6yKzC.js → priceTier-BQeJLJUu.js} +1 -1
  85. package/dist/rules-D3qosTfl.js +216 -0
  86. package/dist/{scheduler-CbytS4GA.js → scheduler-B32ag1lR.js} +4 -4
  87. package/dist/{toExcel-1Ir0pgiS.js → toExcel-CIrCsrWL.js} +2 -2
  88. package/dist/translation-Cdap0IVg.js +79 -0
  89. package/dist/{unit-DQOMjCVi.js → unit-y1on6-W3.js} +2 -2
  90. package/package.json +3 -3
  91. package/dist/Subcategory-BSAn0r8r.js +0 -345
  92. package/dist/TranslationSideSheet.vue_vue_type_script_setup_true_lang-C9byidEd.js +0 -185
  93. package/dist/assets/linked-status-D22Wz7QM.js +0 -13
  94. package/dist/assets/override-menu-96YpbKTz.js +0 -13
  95. package/dist/index-ulGt0shB.js +0 -539
  96. package/dist/rules-CoyaaNMj.js +0 -212
  97. package/dist/translation-BeqjfyEb.js +0 -75
@@ -1,539 +0,0 @@
1
- import { defineComponent as oe, ref as x, computed as I, watch as W, unref as n, resolveComponent as C, createBlock as z, openBlock as f, withCtx as V, createElementVNode as l, toDisplayString as g, createElementBlock as y, createCommentVNode as U, Fragment as T, renderList as F, createVNode as c, normalizeClass as X, renderSlot as re, createSlots as ce } from "vue";
2
- import { J as O, Q as de, G as ue, I as M, D as Z, M as ee, A as ae } from "./index.vue_vue_type_script_setup_true_lang-90aRfAsI.js";
3
- import { d as me } from "./vuedraggable-CK8z7qA8.js";
4
- import { useI18n as le, useLocale as pe } from "@feedmepos/mf-common";
5
- import { useSnackbar as fe, components as ve } from "@feedmepos/ui-library";
6
- import { _ as _e } from "./FormItem.vue_vue_type_script_setup_true_lang-BmPAVphe.js";
7
- import { _ as ye } from "./RuleView.vue_vue_type_script_setup_true_lang-Be33vMlU.js";
8
- import { u as se } from "./discardConfirm-BHni0LNu.js";
9
- import { _ as he } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-DliryTNe.js";
10
- import { g as q, a as H, _ as te, b as ne } from "./translation-BeqjfyEb.js";
11
- import { c as be } from "./check-C9mY6LiX.js";
12
- const ge = { class: "fm-typo-en-title-md-600" }, xe = { class: "pt-8 space-y-24" }, Ve = { class: "flex flex-col gap-8" }, ke = { class: "text-fm-color-typo-primary fm-typo-en-body-lg-600" }, Ce = { class: "flex items-center gap-8 flex-wrap" }, Ee = { class: "w-24 h-24 rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center fm-typo-en-body-sm-600" }, we = { class: "fm-typo-en-body-md-600" }, Oe = ["onClick"], $e = { class: "flex items-center gap-8" }, Ue = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, je = { class: "fm-typo-en-body-md-400" }, Le = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Se = { class: "fm-typo-en-body-lg-600" }, Te = {
13
- key: 0,
14
- class: "flex flex-col gap-32 pl-32"
15
- }, Fe = {
16
- key: 0,
17
- class: "space-y-8"
18
- }, Me = { class: "flex w-[100px] items-center gap-8" }, Ie = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Ne = { class: "fm-typo-en-body-md-400" }, De = { class: "flex-1" }, Ae = { class: "flex flex-col gap-16 border p-16 rounded-lg" }, Be = { class: "fm-typo-en-body-lg-600" }, qe = {
19
- key: 0,
20
- class: "flex flex-col gap-32 pl-32"
21
- }, ze = { class: "fm-typo-en-body-md-600 text-fm-color-primary border border-fm-color-primary inline-block rounded-md px-8 py-4" }, Pe = { class: "space-y-32" }, Ye = {
22
- key: 0,
23
- class: "space-y-8"
24
- }, Ge = { class: "flex w-[100px] items-center gap-8" }, Re = { class: "w-24 h-24 rounded-full bg-fm-color-opacity-sm flex items-center justify-center fm-typo-en-body-sm-600" }, Ke = { class: "fm-typo-en-body-md-400" }, Je = { class: "flex-1" }, Qe = { class: "flex gap-8 items-center justify-start" }, He = /* @__PURE__ */ oe({
25
- __name: "ProductVariantTranslation",
26
- props: {
27
- modelValue: { type: Boolean },
28
- variant: {},
29
- expandSection: { default: "variant" }
30
- },
31
- emits: ["update:modelValue", "update:variant"],
32
- setup(P, { emit: Y }) {
33
- const m = P, $ = Y, { t: i } = le(), { localeList: E } = pe(), w = x(!1), k = x(!1), t = x([]), j = x([]), v = x({}), L = x({}), b = x({}), S = x({}), N = I(() => m.variant.options.map((e, a) => ({
34
- ...e,
35
- optionIndex: a + 1
36
- })).filter((e) => e.name.trim() !== ""));
37
- function G() {
38
- const e = /* @__PURE__ */ new Set();
39
- m.variant.name_locale && Object.keys(m.variant.name_locale).forEach((d) => e.add(d)), m.variant.options.forEach((d) => {
40
- d.name_locale && Object.keys(d.name_locale).forEach((u) => e.add(u));
41
- });
42
- const a = Array.from(e).map((d) => {
43
- const u = n(E).find((_) => _.code === d);
44
- return {
45
- localeCode: d,
46
- localeName: (u == null ? void 0 : u.name) || d,
47
- value: ""
48
- // Not used for language selection
49
- };
50
- });
51
- t.value = a;
52
- const r = {};
53
- m.variant.name_locale && Object.entries(m.variant.name_locale).forEach(([d, u]) => {
54
- r[d] = u;
55
- }), v.value = r;
56
- const p = {};
57
- m.variant.options.forEach((d) => {
58
- p[d._id] = {}, d.name_locale && Object.entries(d.name_locale).forEach(([u, _]) => {
59
- p[d._id][u] = _;
60
- });
61
- }), b.value = p;
62
- }
63
- W(
64
- () => [m.modelValue, m.variant, m.expandSection],
65
- ([e, , a]) => {
66
- e && (G(), j.value = O.clone(t.value), L.value = O.clone(v.value), S.value = O.clone(b.value), a === "variant" ? (w.value = !0, k.value = !1) : (w.value = !1, k.value = !0));
67
- },
68
- { immediate: !0, deep: !0 }
69
- );
70
- const D = I(() => {
71
- const e = new Set(t.value.map((a) => a.localeCode));
72
- return n(E).filter((a) => !e.has(a.code)).map((a) => ({
73
- code: a.code,
74
- name: a.name,
75
- icon: q(a.code)
76
- }));
77
- });
78
- function R(e) {
79
- const a = n(E).find((r) => r.code === e);
80
- a && (t.value.push({
81
- localeCode: a.code,
82
- localeName: a.name,
83
- value: ""
84
- }), v.value[a.code] || (v.value[a.code] = ""), Object.keys(b.value).forEach((r) => {
85
- b.value[r][a.code] || (b.value[r][a.code] = "");
86
- }));
87
- }
88
- function A(e) {
89
- t.value = t.value.filter((a) => a.localeCode !== e), delete v.value[e], Object.keys(b.value).forEach((a) => {
90
- delete b.value[a][e];
91
- });
92
- }
93
- function K() {
94
- return !O.isEqual(t.value, j.value) || !O.isEqual(v.value, L.value) || !O.isEqual(b.value, S.value);
95
- }
96
- function J() {
97
- const e = O.clone(m.variant), a = {};
98
- Object.entries(v.value).forEach(([r, p]) => {
99
- p && p.trim() && (a[r] = p.trim());
100
- }), Object.keys(a).length > 0 ? e.name_locale = a : delete e.name_locale, e.options.forEach((r) => {
101
- const p = b.value[r._id];
102
- if (p && Object.keys(p).length > 0) {
103
- const d = {};
104
- Object.entries(p).forEach(([u, _]) => {
105
- _ && _.trim() && (d[u] = _.trim());
106
- }), Object.keys(d).length > 0 ? r.name_locale = d : delete r.name_locale;
107
- } else
108
- delete r.name_locale;
109
- }), $("update:variant", e), $("update:modelValue", !1);
110
- }
111
- function Q() {
112
- $("update:modelValue", !1);
113
- }
114
- const B = se(K, Q), o = I({
115
- get: () => m.modelValue,
116
- set: (e) => $("update:modelValue", e)
117
- });
118
- return (e, a) => {
119
- const r = C("FmIcon"), p = C("fm-button"), d = C("FmMenu"), u = C("fm-text-field"), _ = C("fm-side-sheet");
120
- return f(), z(_, {
121
- modelValue: o.value,
122
- "onUpdate:modelValue": a[2] || (a[2] = (s) => o.value = s),
123
- "max-width": 720,
124
- "onOn:clickedAway": n(B)
125
- }, {
126
- "side-sheet-header": V(() => [
127
- l("p", ge, g(n(i)("menu.variant.form.translation.title")), 1)
128
- ]),
129
- "side-sheet-footer": V(() => [
130
- l("div", Qe, [
131
- c(p, {
132
- label: n(i)("common.save"),
133
- size: "lg",
134
- variant: "primary",
135
- onClick: J
136
- }, null, 8, ["label"]),
137
- c(p, {
138
- label: n(i)("common.cancel"),
139
- size: "lg",
140
- variant: "tertiary",
141
- onClick: n(B)
142
- }, null, 8, ["label", "onClick"])
143
- ])
144
- ]),
145
- default: V(() => [
146
- l("div", xe, [
147
- l("div", Ve, [
148
- l("p", ke, g(n(i)("menu.variant.form.translation.language")), 1),
149
- l("div", Ce, [
150
- (f(!0), y(T, null, F(t.value, (s) => (f(), y("div", {
151
- key: s.localeCode,
152
- class: "flex items-center gap-8 p-8 border border-fm-color-primary text-fm-color-primary rounded-full"
153
- }, [
154
- l("div", Ee, g(n(q)(s.localeCode)), 1),
155
- l("span", we, g(n(H)(s.localeCode, n(E))), 1),
156
- c(r, {
157
- name: "close",
158
- class: "cursor-pointer",
159
- variant: "secondary",
160
- onClick: (h) => A(s.localeCode)
161
- }, null, 8, ["onClick"])
162
- ]))), 128)),
163
- D.value.length > 0 ? (f(), z(d, { key: 0 }, {
164
- "menu-button": V(() => [
165
- c(p, {
166
- variant: "secondary",
167
- "border-color": "neutral-gray-300",
168
- "text-color": "neutral-gray-400",
169
- icon: "add"
170
- })
171
- ]),
172
- default: V(() => [
173
- (f(!0), y(T, null, F(D.value, (s) => (f(), y("div", {
174
- key: s.code,
175
- class: "p-12 cursor-pointer hover:bg-fm-color-opacity-md rounded-sm",
176
- onClick: (h) => R(s.code)
177
- }, [
178
- l("div", $e, [
179
- l("div", Ue, g(s.icon), 1),
180
- l("span", je, g(s.name), 1)
181
- ])
182
- ], 8, Oe))), 128))
183
- ]),
184
- _: 1
185
- })) : U("", !0)
186
- ])
187
- ]),
188
- l("div", Le, [
189
- l("div", {
190
- class: "flex items-center gap-16 cursor-pointer",
191
- onClick: a[0] || (a[0] = (s) => w.value = !w.value)
192
- }, [
193
- c(r, {
194
- name: "keyboard_arrow_down",
195
- class: X(["transition-transform", w.value ? "transform rotate-180" : ""])
196
- }, null, 8, ["class"]),
197
- l("p", Se, g(n(i)("menu.variant.form.translation.variant_name")), 1)
198
- ]),
199
- w.value ? (f(), y("div", Te, [
200
- c(te, {
201
- label: n(i)("menu.variant.form.translation.default"),
202
- "model-value": e.variant.name
203
- }, null, 8, ["label", "model-value"]),
204
- t.value.length > 0 ? (f(), y("div", Fe, [
205
- c(ne, {
206
- label: n(i)("menu.variant.form.translation.translation")
207
- }, null, 8, ["label"]),
208
- (f(!0), y(T, null, F(t.value, (s) => (f(), y("div", {
209
- key: s.localeCode,
210
- class: "flex items-center gap-16"
211
- }, [
212
- l("div", Me, [
213
- l("div", Ie, g(n(q)(s.localeCode)), 1),
214
- l("span", Ne, g(n(H)(s.localeCode, n(E))), 1)
215
- ]),
216
- l("div", De, [
217
- c(u, {
218
- modelValue: v.value[s.localeCode],
219
- "onUpdate:modelValue": (h) => v.value[s.localeCode] = h,
220
- placeholder: e.variant.name
221
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
222
- ])
223
- ]))), 128))
224
- ])) : U("", !0)
225
- ])) : U("", !0)
226
- ]),
227
- l("div", Ae, [
228
- l("div", {
229
- class: "flex items-center gap-16 cursor-pointer",
230
- onClick: a[1] || (a[1] = (s) => k.value = !k.value)
231
- }, [
232
- c(r, {
233
- name: "keyboard_arrow_down",
234
- class: X(["transition-transform", k.value ? "transform rotate-180" : ""])
235
- }, null, 8, ["class"]),
236
- l("p", Be, g(n(i)("menu.variant.form.translation.option_value")), 1)
237
- ]),
238
- k.value ? (f(), y("div", qe, [
239
- (f(!0), y(T, null, F(N.value, (s) => (f(), y("div", {
240
- key: s._id,
241
- class: "space-y-8"
242
- }, [
243
- l("p", ze, g(n(i)("menu.variant.form.translation.option", { number: s.optionIndex })), 1),
244
- l("div", Pe, [
245
- c(te, {
246
- label: n(i)("menu.variant.form.translation.default"),
247
- "model-value": s.name,
248
- spacing: "sm"
249
- }, null, 8, ["label", "model-value"]),
250
- t.value.length > 0 ? (f(), y("div", Ye, [
251
- c(ne, {
252
- label: n(i)("menu.variant.form.translation.translation"),
253
- spacing: "sm"
254
- }, null, 8, ["label"]),
255
- (f(!0), y(T, null, F(t.value, (h) => (f(), y("div", {
256
- key: h.localeCode,
257
- class: "flex items-center gap-16"
258
- }, [
259
- l("div", Ge, [
260
- l("div", Re, g(n(q)(h.localeCode)), 1),
261
- l("span", Ke, g(n(H)(h.localeCode, n(E))), 1)
262
- ]),
263
- l("div", Je, [
264
- c(u, {
265
- modelValue: b.value[s._id][h.localeCode],
266
- "onUpdate:modelValue": (ie) => b.value[s._id][h.localeCode] = ie,
267
- placeholder: s.name
268
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
269
- ])
270
- ]))), 128))
271
- ])) : U("", !0)
272
- ])
273
- ]))), 128))
274
- ])) : U("", !0)
275
- ])
276
- ])
277
- ]),
278
- _: 1
279
- }, 8, ["modelValue", "onOn:clickedAway"]);
280
- };
281
- }
282
- }), We = { class: "fm-typo-en-title-md-600" }, Xe = { class: "py-16 space-y-32" }, Ze = ["data-not-allow-sort"], ea = {
283
- key: 1,
284
- class: "w-24"
285
- }, aa = { class: "flex-1" }, ta = { class: "flex items-center gap-8" }, na = { class: "flex gap-8 items-center justify-start" }, oa = /* @__PURE__ */ oe({
286
- __name: "Form",
287
- props: {
288
- initialValue: {}
289
- },
290
- setup(P, { expose: Y }) {
291
- const m = P, $ = de(ue(fe())), { t: i } = le(), E = I(
292
- () => m.initialValue ? i("menu.variant.form.title.edit") : i("menu.variant.form.title.add")
293
- ), w = I(() => m.initialValue ? "Update" : "Add"), k = () => {
294
- if (m.initialValue) {
295
- const o = M(m.initialValue);
296
- return o.options.push({
297
- _id: (/* @__PURE__ */ new Date()).toISOString(),
298
- name: ""
299
- }), o;
300
- } else
301
- return { ...Z.generator.initMenuV4VariantGroup(), usedBy: [] };
302
- }, t = x(k()), j = x(!1), v = x(!1), L = x(!1), b = x("variant"), S = (o) => {
303
- be.isBoolean(o) ? v.value = o : v.value = !v.value;
304
- };
305
- function N(o) {
306
- b.value = o, L.value = !0;
307
- }
308
- function G(o) {
309
- t.value = o;
310
- }
311
- function D(o) {
312
- t.value.options = o;
313
- }
314
- function R(o, e) {
315
- const a = M(t.value.options), r = a.findIndex((p) => p._id == o);
316
- a[r].name = e, t.value.options = a, r === t.value.options.length - 1 && A();
317
- }
318
- function A() {
319
- const o = M(t.value.options);
320
- t.value.options = [
321
- ...o,
322
- {
323
- _id: (/* @__PURE__ */ new Date()).toISOString(),
324
- name: ""
325
- }
326
- ];
327
- }
328
- function K(o) {
329
- const e = M(t.value.options);
330
- t.value.options = e.filter((a) => a._id !== o);
331
- }
332
- W(
333
- () => t.value.options,
334
- (o) => {
335
- o.length <= 0 && A();
336
- },
337
- {
338
- immediate: !0
339
- }
340
- );
341
- function J(o) {
342
- const e = o.draggedContext.futureIndex, a = o.relatedContext.list;
343
- return e !== a.length - 1;
344
- }
345
- const Q = se(
346
- () => {
347
- if (m.initialValue) {
348
- const o = t.value.options.filter((e) => !!e.name.trim());
349
- return !O.isEqual({ ...t.value, options: o }, m.initialValue);
350
- } else
351
- return !!(t.value.options.length > 1 || t.value.name.trim());
352
- },
353
- () => {
354
- v.value = !1;
355
- }
356
- ), B = async () => {
357
- try {
358
- j.value = !0;
359
- const o = M(t.value);
360
- o.options = o.options.filter((e) => !!e.name.trim()), m.initialValue ? await $.updateMenu(
361
- {
362
- module: ae.F_MENU_MODULE_V4_KEY.enum.variant,
363
- operation: ee.F_OPERATION_TYPE.update,
364
- data: o
365
- },
366
- o.name
367
- ) : await $.updateMenu(
368
- {
369
- module: ae.F_MENU_MODULE_V4_KEY.enum.variant,
370
- operation: ee.F_OPERATION_TYPE.create,
371
- data: o
372
- },
373
- o.name
374
- ), S(!1), t.value = { ...Z.generator.initMenuV4VariantGroup(), usedBy: [] };
375
- } finally {
376
- j.value = !1;
377
- }
378
- };
379
- return W(
380
- () => v.value,
381
- (o) => {
382
- o && (t.value = k());
383
- }
384
- ), Y({
385
- show: v,
386
- trigger: S
387
- }), (o, e) => {
388
- const a = C("fm-icon"), r = C("fm-text-field"), p = C("fm-button"), d = C("fm-side-sheet");
389
- return f(), y(T, null, [
390
- re(o.$slots, "default", { trigger: S }),
391
- c(d, {
392
- id: "variant-form",
393
- modelValue: v.value,
394
- "onUpdate:modelValue": e[4] || (e[4] = (u) => v.value = u),
395
- "is-container": n(ve).FmForm,
396
- "is-container-props": {
397
- onValidationSuccess: B,
398
- blameFormChildOnValidationFailed: !0
399
- },
400
- "max-width": 560,
401
- "onOn:clickedAway": n(Q)
402
- }, {
403
- "side-sheet-header": V(() => [
404
- l("p", We, g(E.value), 1)
405
- ]),
406
- "side-sheet-footer": V(() => [
407
- l("div", na, [
408
- c(p, {
409
- label: w.value,
410
- loading: j.value,
411
- size: "lg",
412
- type: "submit",
413
- variant: "primary"
414
- }, null, 8, ["label", "loading"]),
415
- c(p, {
416
- label: n(i)("menu.common.actions.cancel"),
417
- size: "lg",
418
- variant: "tertiary",
419
- onClick: e[3] || (e[3] = () => v.value = !1)
420
- }, null, 8, ["label"])
421
- ])
422
- ]),
423
- default: V(() => {
424
- var u;
425
- return [
426
- l("div", Xe, [
427
- c(ye, {
428
- title: n(i)("menu.variant.form.detail")
429
- }, {
430
- default: V(() => [
431
- c(r, {
432
- autofocus: "",
433
- label: n(i)("menu.variant.form.name.label"),
434
- "helper-text": n(i)("menu.variant.form.name.helper"),
435
- modelValue: t.value.name,
436
- "onUpdate:modelValue": e[1] || (e[1] = (_) => t.value.name = _),
437
- rules: [(_) => !!_ || n(i)("menu.variant.form.name.required")],
438
- placeholder: n(i)("menu.variant.form.name.placeholder")
439
- }, {
440
- append: V(() => [
441
- c(a, {
442
- name: "g_translate",
443
- class: "cursor-pointer",
444
- onClick: e[0] || (e[0] = (_) => N("variant"))
445
- })
446
- ]),
447
- _: 1
448
- }, 8, ["label", "helper-text", "modelValue", "rules", "placeholder"]),
449
- c(_e, {
450
- label: n(i)("menu.variant.form.options.title")
451
- }, {
452
- default: V(() => [
453
- l("div", null, [
454
- c(n(me), {
455
- "model-value": t.value.options,
456
- move: J,
457
- class: "space-y-16",
458
- group: "categories",
459
- handle: ".handle",
460
- "item-key": "_id",
461
- "onUpdate:modelValue": D
462
- }, {
463
- item: V(({ element: _, index: s }) => [
464
- l("div", {
465
- class: X(["flex items-center", "space-x-8"]),
466
- "data-not-allow-sort": s === t.value.options.length - 1
467
- }, [
468
- s !== t.value.options.length - 1 ? (f(), z(a, {
469
- key: 0,
470
- class: "handle",
471
- name: "drag_handle"
472
- })) : s > 0 ? (f(), y("div", ea)) : U("", !0),
473
- l("div", aa, [
474
- c(r, {
475
- "model-value": _.name,
476
- rules: [
477
- () => !!t.value.options.length || n(i)("menu.variant.form.options.min_required"),
478
- (h) => s === t.value.options.length - 1 || h ? !0 : n(i)("menu.variant.form.options.name_required")
479
- ],
480
- class: "flex-1",
481
- placeholder: n(i)("menu.variant.form.options.placeholder"),
482
- "onUpdate:modelValue": (h) => R(_._id, h)
483
- }, ce({ _: 2 }, [
484
- s !== t.value.options.length - 1 ? {
485
- name: "append",
486
- fn: V(() => [
487
- l("div", ta, [
488
- c(a, {
489
- name: "g_translate",
490
- class: "cursor-pointer",
491
- onClick: e[2] || (e[2] = (h) => N("options"))
492
- }),
493
- c(a, {
494
- name: "close",
495
- onClick: (h) => K(_._id)
496
- }, null, 8, ["onClick"])
497
- ])
498
- ]),
499
- key: "0"
500
- } : void 0
501
- ]), 1032, ["model-value", "rules", "placeholder", "onUpdate:modelValue"])
502
- ])
503
- ], 8, Ze)
504
- ]),
505
- _: 1
506
- }, 8, ["model-value"])
507
- ])
508
- ]),
509
- _: 1
510
- }, 8, ["label"])
511
- ]),
512
- _: 1
513
- }, 8, ["title"]),
514
- (u = t.value.usedBy) != null && u.length ? (f(), z(he, {
515
- key: 0,
516
- editable: !1,
517
- overrides: t.value.usedBy || [],
518
- "select-variant": !1,
519
- title: n(i)("menu.variant.form.applied_product")
520
- }, null, 8, ["overrides", "title"])) : U("", !0)
521
- ])
522
- ];
523
- }),
524
- _: 1
525
- }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]),
526
- c(He, {
527
- modelValue: L.value,
528
- "onUpdate:modelValue": e[5] || (e[5] = (u) => L.value = u),
529
- variant: t.value,
530
- "expand-section": b.value,
531
- "onUpdate:variant": G
532
- }, null, 8, ["modelValue", "variant", "expand-section"])
533
- ], 64);
534
- };
535
- }
536
- }), _a = oa;
537
- export {
538
- _a as V
539
- };