@feedmepos/mf-menu 0.31.40-prod → 0.31.41-prod

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 (90) hide show
  1. package/dist/{App-aWEH-ZEk.js → App-5Lzy8zHZ.js} +8 -8
  2. package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js → ApplyProduct.vue_vue_type_script_setup_true_lang-BnKXsQH-.js} +3 -3
  3. package/dist/{Catalog-BoFfFdn8.js → Catalog-s5b8V8nw.js} +8 -9
  4. package/dist/{Category-CWYbb3Jn.js → Category-BJzScJEY.js} +4 -4
  5. package/dist/{Category-DZ45uikR.js → Category-DZ-xqIMI.js} +6 -6
  6. package/dist/{CookingGuide-BU0PRWIQ.js → CookingGuide-Bkd6GPww.js} +4 -4
  7. package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-Z5xsKDIE.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-B8tIjKOW.js} +1 -1
  8. package/dist/{Group-BMQDeqiS.js → Group-0b2Qiov3.js} +1 -1
  9. package/dist/{Group-C0T_uknK.js → Group-BOaCcKiI.js} +3 -3
  10. package/dist/{Group.vue_vue_type_script_setup_true_lang-DyfmY6F1.js → Group.vue_vue_type_script_setup_true_lang-DUlUfMAs.js} +8 -8
  11. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CouimeC4.js +399 -0
  12. package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-Dl-Wvt3D.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DOvQmbrZ.js} +13 -14
  13. package/dist/{Ingredient-3lwDUQx_.js → Ingredient-ChcYUvOg.js} +3 -3
  14. package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-VLrrTkSC.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DE1HkipX.js} +2 -2
  15. package/dist/LinkProductSideSheet-BdzBGYxG.js +361 -0
  16. package/dist/MenuSetting-zAAttaoA.js +618 -0
  17. package/dist/{PrintRoute-DfJ-vUAb.js → PrintRoute-T-vuO5N8.js} +4 -4
  18. package/dist/{Product-F4PoLm9v.js → Product-B5q291VF.js} +1 -1
  19. package/dist/{Product.vue_vue_type_script_setup_true_lang-DT5gffpA.js → Product.vue_vue_type_script_setup_true_lang-DLRlT10W.js} +468 -465
  20. package/dist/{ProductInternalTools-DSGU-OqU.js → ProductInternalTools-BOlc0VUR.js} +5 -5
  21. package/dist/{Products-COzW2Z4g.js → Products-Cd4Mqhm3.js} +88 -85
  22. package/dist/{Publish-CDXVWCk2.js → Publish-SuRzt-_D.js} +3 -3
  23. package/dist/{Recipe-BZx4wrcP.js → Recipe-BKrjNs5g.js} +4 -4
  24. package/dist/{Scheduler-wHCWSeU2.js → Scheduler-DnDgImLC.js} +3 -3
  25. package/dist/{ServingSequence-BbYEhDYh.js → ServingSequence-D602bVnm.js} +3 -3
  26. package/dist/{Setting-C9Tlw1Iy.js → Setting-FMT4oBYH.js} +44 -45
  27. package/dist/{Subcategory-C8AwfrKb.js → Subcategory-CpYmjAvA.js} +4 -4
  28. package/dist/{Takeaway-t1053wg2.js → Takeaway-BXh3iuME.js} +1 -1
  29. package/dist/{Takeaway-DaEUn-yM.js → Takeaway-D4hjN5z5.js} +4 -4
  30. package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-7XycP5fU.js → Takeaway.vue_vue_type_script_setup_true_lang-By1f-FCO.js} +5 -5
  31. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-CZUwa5C_.js +440 -0
  32. package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-Ci6iqOry.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-DfjtfcCh.js} +604 -600
  33. package/dist/{Unit-CnqptGCz.js → Unit-CsjHkV-h.js} +2 -2
  34. package/dist/{Variant-DiOYOwJs.js → Variant-Djra14ZX.js} +3 -3
  35. package/dist/{_id_-BSfU16VO.js → _id_-BXkqoCzB.js} +78 -75
  36. package/dist/{app-Ddb81PNo.js → app-CVqWWV4x.js} +278 -278
  37. package/dist/{LinkProductSideSheet.vue_vue_type_style_index_0_scoped_97fa9d58_lang-DvG3mOom.js → app-CiBqmBzO.js} +2120 -2084
  38. package/dist/{app-Cou6qPF2.js → app-PhBJNss_.js} +1 -1
  39. package/dist/app.js +1 -1
  40. package/dist/apps/mf-menu/src/api/menu.d.ts +2 -1
  41. package/dist/apps/mf-menu/src/app.d.ts +144 -0
  42. package/dist/apps/mf-menu/src/components/feature/PriceTier/PriceTierRuleEditor.vue.d.ts +36 -0
  43. package/dist/apps/mf-menu/src/components/feature/RestaurantAttributesSelector.vue.d.ts +9 -3
  44. package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +294 -4
  45. package/dist/apps/mf-menu/src/composable/attributes.d.ts +26 -0
  46. package/dist/apps/mf-menu/src/composable/linkProducts.d.ts +40 -0
  47. package/dist/apps/mf-menu/src/helper/import-export.d.ts +285 -0
  48. package/dist/apps/mf-menu/src/helper/menu.d.ts +285 -0
  49. package/dist/apps/mf-menu/src/manager/menu/item.d.ts +285 -0
  50. package/dist/apps/mf-menu/src/stores/menu.d.ts +293 -3
  51. package/dist/apps/mf-menu/src/utils/array.d.ts +1 -0
  52. package/dist/apps/mf-menu/src/utils/customAttributes.d.ts +12 -0
  53. package/dist/apps/mf-menu/src/views/MenuSetting/LinkProductRuleGroups.vue.d.ts +2 -0
  54. package/dist/apps/mf-menu/src/views/MenuSetting/RuleGroupSideSheet.vue.d.ts +176 -0
  55. package/dist/apps/mf-menu/src/views/Publish/UpdateCatalogDialog.vue.d.ts +166 -0
  56. package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/assets/linked-status-WlVAcpRn.js +13 -0
  58. package/dist/assets/override-menu-__h4D7ac.js +13 -0
  59. package/dist/assets/validate-menu-DyPuzLRg.js +13 -0
  60. package/dist/{catalog-DSuJhsUb.js → catalog-C_TuQLxq.js} +1 -1
  61. package/dist/{catalogSetting-C3gEw9ov.js → catalogSetting-BUlJu6hG.js} +1 -1
  62. package/dist/{category-CwWq3KCE.js → category-CmVw1Kj-.js} +1 -1
  63. package/dist/{currency-g45Sh-t6.js → currency-OhOTnAqk.js} +1 -1
  64. package/dist/customAttributes-fpOfmGnw.js +180 -0
  65. package/dist/{dayjs.min-g3eN5z-V.js → dayjs.min-CDhP-7L5.js} +1 -1
  66. package/dist/{index-QsLFbxyG.js → index-BJZEWB5C.js} +4 -4
  67. package/dist/{index-BLQCYEc6.js → index-DHAYGEPp.js} +7 -8
  68. package/dist/{index-0yRUi7LL.js → index-DtwHmS38.js} +1 -1
  69. package/dist/index-N3cGc8ex.js +245 -0
  70. package/dist/{item-BvvQ9urP.js → item-BELLphR0.js} +16 -16
  71. package/dist/{jszip.min-DzdUiaR4.js → jszip.min-CZtcGb7A.js} +353 -353
  72. package/dist/{menu-QrVg2Ph7.js → menu-Csyr6W9A.js} +7 -7
  73. package/dist/{menu-DFNvhoNQ.js → menu-DS_ERmBf.js} +23355 -23206
  74. package/dist/{menuV2-Ezf_jW40.js → menuV2-DKzAZ4Ss.js} +151 -146
  75. package/dist/mf-menu.css +1 -1
  76. package/dist/{priceTier-zENsn3P_.js → priceTier-CYWS5lDS.js} +1 -1
  77. package/dist/{scheduler-BuwGSv6A.js → scheduler-DI5dXC7Y.js} +8 -8
  78. package/dist/{subcategory-O3L_zCJA.js → subcategory-D_ao-IV9.js} +2 -2
  79. package/dist/{toExcel-CpRy_4nG.js → toExcel-Cml-rkJQ.js} +2 -2
  80. package/dist/{unit-Ct_7Hfa2.js → unit-BWDp2LkV.js} +42 -41
  81. package/package.json +3 -3
  82. package/dist/FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js +0 -50
  83. package/dist/GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-D6qro5w_.js +0 -367
  84. package/dist/LinkProductSideSheet-LDZjKX95.js +0 -297
  85. package/dist/MenuSetting-AhutsCVy.js +0 -185
  86. package/dist/Thumbnail.vue_vue_type_script_setup_true_lang-B7oLH9cP.js +0 -431
  87. package/dist/assets/linked-status-B_crHhZH.js +0 -24
  88. package/dist/assets/override-menu-BmlCEpHH.js +0 -24
  89. package/dist/assets/validate-menu-CF-psoB-.js +0 -24
  90. package/dist/index-0Q5T9VZV.js +0 -214
@@ -1,4 +1,4 @@
1
- import { u as m, A as s, J as g, ah as _ } from "./menu-DFNvhoNQ.js";
1
+ import { u as m, A as s, J as g, ah as _ } from "./menu-DS_ERmBf.js";
2
2
  import "@feedmepos/ui-library";
3
3
  class u {
4
4
  constructor(t, e, a, r) {
@@ -1,4 +1,4 @@
1
- import { A as u, H as i } from "./menu-DFNvhoNQ.js";
1
+ import { A as u, H as i } from "./menu-DS_ERmBf.js";
2
2
  var a = /* @__PURE__ */ ((e) => (e.AUTO = "auto", e.MANUAL = "manual", e))(a || {}), m = /* @__PURE__ */ ((e) => (e[e.Normal = 0] = "Normal", e[e.Rules = 1] = "Rules", e))(m || {});
3
3
  class s {
4
4
  static fromCatalog(r, n) {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as M, watch as _, ref as f, resolveComponent as g, createBlock as x, openBlock as A, unref as l, withCtx as C, createVNode as V } from "vue";
2
- import { J as s, A as u, u as F } from "./menu-DFNvhoNQ.js";
2
+ import { J as s, A as u, u as F } from "./menu-DS_ERmBf.js";
3
3
  import { useI18n as E } from "@feedmepos/mf-common";
4
4
  import { useDialogChild as O } from "@feedmepos/ui-library";
5
5
  const y = /* @__PURE__ */ M({
@@ -1,4 +1,4 @@
1
- import { B as e } from "./menu-DFNvhoNQ.js";
1
+ import { B as e } from "./menu-DS_ERmBf.js";
2
2
  function n(r, o = !0) {
3
3
  return e.Dinero.fromFdoDinero(r).toFormat(o).replaceAll(" ", "");
4
4
  }
@@ -0,0 +1,180 @@
1
+ import { defineComponent as v, createElementBlock as c, openBlock as u, normalizeClass as h, renderSlot as y, createCommentVNode as _, createVNode as $, createElementVNode as m, toDisplayString as f, withCtx as A, computed as d } from "vue";
2
+ import { I as b } from "./menu-DS_ERmBf.js";
3
+ import { x as T, N as E } from "./app-CiBqmBzO.js";
4
+ import { useCoreStore as I, EMPTY_RULE as N, isEmptyMongoQuery as C, isEmptyRule as S } from "@feedmepos/mf-common";
5
+ const w = /* @__PURE__ */ v({
6
+ __name: "FormColumn",
7
+ props: {
8
+ shrinkable: { type: Boolean }
9
+ },
10
+ setup(r) {
11
+ return (s, a) => (u(), c("div", {
12
+ class: h(["flex-1 flex flex-col space-y-24", { "min-h-0": s.shrinkable }])
13
+ }, [
14
+ y(s.$slots, "default")
15
+ ], 2));
16
+ }
17
+ }), M = {
18
+ key: 0,
19
+ class: "flex flex-row justify-between items-center"
20
+ }, V = { class: "space-y-4" }, B = { class: "fm-typo-en-title-sm-600" }, D = {
21
+ key: 0,
22
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
23
+ }, Y = /* @__PURE__ */ v({
24
+ __name: "FormSection",
25
+ props: {
26
+ title: {},
27
+ subTitle: {},
28
+ shrinkable: { type: Boolean }
29
+ },
30
+ setup(r) {
31
+ return (s, a) => (u(), c("div", {
32
+ class: h(["flex flex-col space-y-16", { "min-h-0": s.shrinkable }])
33
+ }, [
34
+ s.title ? (u(), c("div", M, [
35
+ m("div", V, [
36
+ m("p", B, f(s.title), 1),
37
+ s.subTitle ? (u(), c("p", D, f(s.subTitle), 1)) : _("", !0)
38
+ ]),
39
+ y(s.$slots, "append-title")
40
+ ])) : _("", !0),
41
+ $(w, { shrinkable: s.shrinkable }, {
42
+ default: A(() => [
43
+ y(s.$slots, "default")
44
+ ]),
45
+ _: 3
46
+ }, 8, ["shrinkable"])
47
+ ], 2));
48
+ }
49
+ }), F = { class: "space-y-8" }, x = { class: "flex items-center justify-between" }, Q = { class: "space-y-8" }, R = { class: "fm-typo-en-body-lg-600" }, j = {
50
+ key: 0,
51
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
52
+ }, H = /* @__PURE__ */ v({
53
+ __name: "FormItem",
54
+ props: {
55
+ label: {},
56
+ description: {}
57
+ },
58
+ setup(r) {
59
+ return (s, a) => (u(), c("div", F, [
60
+ m("div", x, [
61
+ m("div", Q, [
62
+ m("p", R, f(s.label), 1),
63
+ s.description ? (u(), c("p", j, f(s.description), 1)) : _("", !0)
64
+ ]),
65
+ y(s.$slots, "append")
66
+ ]),
67
+ y(s.$slots, "default")
68
+ ]));
69
+ }
70
+ });
71
+ function p(r) {
72
+ return Array.from(new Set(r));
73
+ }
74
+ function J() {
75
+ const r = I();
76
+ return {
77
+ restaurantAttributes: d(() => [
78
+ {
79
+ type: "string",
80
+ key: "name",
81
+ entity: "restaurant",
82
+ values: p(
83
+ r.restaurants.value.filter((a) => {
84
+ var i;
85
+ return !!((i = a.profile) != null && i.name);
86
+ }).map((a) => a.profile.name)
87
+ )
88
+ },
89
+ {
90
+ type: "string",
91
+ key: "code",
92
+ entity: "restaurant",
93
+ values: p(
94
+ r.restaurants.value.filter((a) => {
95
+ var i;
96
+ return !!((i = a.profile) != null && i.code);
97
+ }).map((a) => a.profile.code)
98
+ )
99
+ }
100
+ ])
101
+ };
102
+ }
103
+ function K(r = {}) {
104
+ const s = d(() => {
105
+ var e, l;
106
+ const n = ((e = r.menuItems) == null ? void 0 : e.value) || [], t = ((l = r.categories) == null ? void 0 : l.value) || [];
107
+ return [
108
+ {
109
+ type: "string",
110
+ key: "name",
111
+ entity: "item",
112
+ values: p(n.filter((o) => !!o.name).map((o) => o.name))
113
+ },
114
+ {
115
+ type: "string",
116
+ key: "code",
117
+ entity: "item",
118
+ values: p(n.filter((o) => !!o.code).map((o) => o.code))
119
+ },
120
+ {
121
+ type: "string",
122
+ key: "category",
123
+ entity: "item",
124
+ values: p(t.filter((o) => !!o.name).map((o) => o.name))
125
+ }
126
+ ];
127
+ }), a = d(() => {
128
+ var t;
129
+ const n = {};
130
+ return (t = r.categories) == null || t.value.forEach((e) => {
131
+ n[e.name] = e._id;
132
+ }), n;
133
+ }), i = d(() => {
134
+ var t;
135
+ const n = {};
136
+ return (t = r.categories) == null || t.value.forEach((e) => {
137
+ n[e._id] = e.name;
138
+ }), n;
139
+ });
140
+ function g(n) {
141
+ const t = b.cloneDeep(n);
142
+ return t != null && t.rules && (t.rules = t.rules.map((e) => {
143
+ if ("property" in e && e.property === "category" && Array.isArray(e.value)) {
144
+ const l = e.value.map((o) => i.value[o]);
145
+ return { ...e, value: l };
146
+ }
147
+ return e;
148
+ })), t;
149
+ }
150
+ function k(n) {
151
+ const t = b.cloneDeep(n);
152
+ return t != null && t.rules && (t.rules = t.rules.map((e) => {
153
+ if ("property" in e && e.property === "category" && Array.isArray(e.value)) {
154
+ const l = e.value.map((o) => a.value[o]);
155
+ return { ...e, value: l };
156
+ }
157
+ return e;
158
+ })), t;
159
+ }
160
+ return {
161
+ itemAttributes: s,
162
+ convertCategoryIdToName: g,
163
+ convertCategoryNameToId: k
164
+ };
165
+ }
166
+ function O(r) {
167
+ return C(r) ? N : T.build(r);
168
+ }
169
+ function W(r) {
170
+ return S(r) ? null : E.build(r);
171
+ }
172
+ export {
173
+ Y as _,
174
+ H as a,
175
+ w as b,
176
+ K as c,
177
+ W as f,
178
+ O as m,
179
+ J as u
180
+ };
@@ -1,4 +1,4 @@
1
- import { g as a, ai as r } from "./menu-DFNvhoNQ.js";
1
+ import { g as a, ai as r } from "./menu-DS_ERmBf.js";
2
2
  var s = r();
3
3
  const t = /* @__PURE__ */ a(s);
4
4
  export {
@@ -1,12 +1,12 @@
1
- import { B as S, A, u as K, H as O, D as q, I as R } from "./menu-DFNvhoNQ.js";
1
+ import { B as S, A, u as K, H as O, D as q, I as R } from "./menu-DS_ERmBf.js";
2
2
  import { defineComponent as T, ref as f, computed as B, watch as L, onMounted as z, onBeforeUnmount as H, resolveComponent as F, createBlock as N, openBlock as M, withModifiers as D, withCtx as g, renderSlot as U, createElementBlock as P, Fragment as W, createVNode as c, unref as i, createElementVNode as C, createCommentVNode as j, toDisplayString as Y } from "vue";
3
3
  import { useI18n as I } from "@feedmepos/mf-common";
4
4
  import { components as Z } from "@feedmepos/ui-library";
5
- import { _ as G } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
5
+ import { _ as G } from "./customAttributes-fpOfmGnw.js";
6
6
  import { u as J } from "./discardConfirm-BHni0LNu.js";
7
- import { _ as Q } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js";
7
+ import { _ as Q } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-BnKXsQH-.js";
8
8
  import { c as X } from "./check-C9mY6LiX.js";
9
- import { f as ee } from "./currency-g45Sh-t6.js";
9
+ import { f as ee } from "./currency-OhOTnAqk.js";
10
10
  import { c as ae } from "./string-DpfFixWH.js";
11
11
  const te = /* @__PURE__ */ T({
12
12
  __name: "CurrencyInput",
@@ -1,12 +1,11 @@
1
1
  import { defineComponent as R, computed as w, ref as E, watch as C, resolveComponent as g, createElementBlock as F, openBlock as V, Fragment as K, renderSlot as j, createVNode as s, unref as n, withCtx as m, createElementVNode as d, createBlock as M, createCommentVNode as U, normalizeClass as H, createSlots as J, toDisplayString as Q } from "vue";
2
- import { O as W, G as X, H as f, D, J as I, A as S, I as Z } from "./menu-DFNvhoNQ.js";
2
+ import { O as W, G as X, H as f, D, J as I, A as S, I as Z } from "./menu-DS_ERmBf.js";
3
3
  import { d as ee } from "./vuedraggable-CK8z7qA8.js";
4
4
  import { useI18n as te } from "@feedmepos/mf-common";
5
5
  import { useSnackbar as ae, components as ne } from "@feedmepos/ui-library";
6
- import { a as oe } from "./LinkProductSideSheet-LDZjKX95.js";
7
- import { _ as le } from "./FormSection.vue_vue_type_script_setup_true_lang-CO4YGYLB.js";
6
+ import { _ as oe, a as le } from "./customAttributes-fpOfmGnw.js";
8
7
  import { u as ie } from "./discardConfirm-BHni0LNu.js";
9
- import { _ as se } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-jJyinQZl.js";
8
+ import { _ as se } from "./ApplyProduct.vue_vue_type_script_setup_true_lang-BnKXsQH-.js";
10
9
  import { c as re } from "./check-C9mY6LiX.js";
11
10
  const ue = { class: "fm-typo-en-title-md-600" }, me = { class: "py-16 space-y-32" }, de = ["data-not-allow-sort"], ce = {
12
11
  key: 1,
@@ -147,7 +146,7 @@ const ue = { class: "fm-typo-en-title-md-600" }, me = { class: "py-16 space-y-32
147
146
  var _;
148
147
  return [
149
148
  d("div", me, [
150
- s(le, {
149
+ s(oe, {
151
150
  title: n(o)("menu.variant.form.detail")
152
151
  }, {
153
152
  default: m(() => [
@@ -160,7 +159,7 @@ const ue = { class: "fm-typo-en-title-md-600" }, me = { class: "py-16 space-y-32
160
159
  rules: [(u) => !!u || n(o)("menu.variant.form.name.required")],
161
160
  placeholder: n(o)("menu.variant.form.name.placeholder")
162
161
  }, null, 8, ["label", "helper-text", "modelValue", "rules", "placeholder"]),
163
- s(oe, {
162
+ s(le, {
164
163
  label: n(o)("menu.variant.form.options.title")
165
164
  }, {
166
165
  default: m(() => [
@@ -233,7 +232,7 @@ const ue = { class: "fm-typo-en-title-md-600" }, me = { class: "py-16 space-y-32
233
232
  ], 64);
234
233
  };
235
234
  }
236
- }), we = ve;
235
+ }), ke = ve;
237
236
  export {
238
- we as V
237
+ ke as V
239
238
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as y, resolveComponent as p, createBlock as f, openBlock as i, Teleport as E, createVNode as _, Transition as g, withCtx as h, createCommentVNode as L, withKeys as w, normalizeStyle as F, normalizeClass as d, createElementVNode as m, renderSlot as x, createElementBlock as T, toDisplayString as R, Fragment as A, renderList as v, computed as C, unref as I } from "vue";
2
- import { _ as k } from "./LinkProductSideSheet-LDZjKX95.js";
2
+ import { _ as k } from "./LinkProductSideSheet-BdzBGYxG.js";
3
3
  import { useI18n as U } from "@feedmepos/mf-common";
4
4
  const N = {
5
5
  class: /* @__PURE__ */ d([
@@ -0,0 +1,245 @@
1
+ import { defineComponent as W, ref as A, resolveComponent as v, createElementBlock as E, openBlock as I, Fragment as B, createElementVNode as g, createVNode as c, normalizeClass as T, withCtx as _, toDisplayString as S, unref as i, h as G, watch as O, onMounted as K, nextTick as M, readonly as N, getCurrentInstance as U, getCurrentScope as L, onScopeDispose as $ } from "vue";
2
+ import { useI18n as q, useCustomAttributes as H, useCoreStore as J } from "@feedmepos/mf-common";
3
+ import { components as Q } from "@feedmepos/ui-library";
4
+ import { u as X, _ as k } from "./customAttributes-fpOfmGnw.js";
5
+ const Y = {
6
+ class: /* @__PURE__ */ T(["fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap", "text-fm-color-neutral-gray-400"])
7
+ }, Z = {
8
+ class: "fm-typo-en-title-sm-600"
9
+ }, ee = {
10
+ class: "max-h-[60vh] flex-1 overflow-y-auto min-h-0"
11
+ }, me = /* @__PURE__ */ W({
12
+ __name: "RestaurantAttributesSelector",
13
+ props: {
14
+ fullWidth: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ currentRestaurantAttrParams: {}
19
+ },
20
+ emits: ["confirm"],
21
+ setup(e, {
22
+ emit: n
23
+ }) {
24
+ const o = e, {
25
+ t
26
+ } = q(), {
27
+ attributes: r
28
+ } = H({
29
+ valueSource: J().restaurants,
30
+ entity: "restaurant"
31
+ }), {
32
+ restaurantAttributes: a
33
+ } = X(), y = [{
34
+ header: () => t("portalshell.customAttributes.form.key"),
35
+ accessorKey: "key",
36
+ enableSorting: !1
37
+ }, {
38
+ header: () => t("portalshell.customAttributes.form.value"),
39
+ accessorKey: "values",
40
+ enableSorting: !1,
41
+ cell: (f) => {
42
+ const s = f.row.original, u = s.values;
43
+ return G(Q.FmSelect, {
44
+ modelValue: s.value,
45
+ placeholder: t("portalshell.customAttributes.form.valuePlaceholder"),
46
+ items: u.map((l) => ({
47
+ label: l,
48
+ value: l
49
+ })),
50
+ clearable: !0,
51
+ "onUpdate:modelValue": (l) => s.value = l
52
+ });
53
+ }
54
+ }], m = n;
55
+ function b(f) {
56
+ return f.reduce((s, u) => (u.value != null && (s[u.key] = u.value), s), {});
57
+ }
58
+ const h = () => {
59
+ const f = r.value.filter((l) => l.value != null), s = a.value.filter((l) => l.value != null), u = {
60
+ restaurantCustomAttributes: b(f),
61
+ restaurantAttributes: b(s)
62
+ };
63
+ m("confirm", u), C();
64
+ }, p = A(!1);
65
+ function w() {
66
+ var u, l;
67
+ p.value = !0;
68
+ const f = ((u = o.currentRestaurantAttrParams) == null ? void 0 : u.restaurantCustomAttributes) ?? {};
69
+ r.value.forEach((d) => {
70
+ d.value = f[d.key] ?? void 0;
71
+ });
72
+ const s = ((l = o.currentRestaurantAttrParams) == null ? void 0 : l.restaurantAttributes) ?? {};
73
+ a.value.forEach((d) => {
74
+ d.value = s[d.key] ?? void 0;
75
+ });
76
+ }
77
+ function C() {
78
+ p.value = !1;
79
+ }
80
+ return (f, s) => {
81
+ const u = v("FmIcon"), l = v("FmChip"), d = v("FmTable"), V = v("FmSpacer"), F = v("fm-button"), j = v("FmDialog");
82
+ return I(), E(B, null, [g("div", {
83
+ class: "cursor-pointer",
84
+ onClick: w
85
+ }, [c(l, {
86
+ class: T([f.fullWidth ? "w-full justify-between" : ""])
87
+ }, {
88
+ default: _(() => [g("div", Y, S(i(t)("menu.catalog.form.restaurant_attributes_title")), 1), c(u, {
89
+ color: "neutral-gray-400",
90
+ name: "launch",
91
+ size: "sm"
92
+ })]),
93
+ _: 1
94
+ }, 8, ["class"])]), c(j, {
95
+ modelValue: p.value,
96
+ "onUpdate:modelValue": s[0] || (s[0] = (R) => p.value = R),
97
+ overlay: !0,
98
+ "min-width": "min(calc(100% - 48px), 560px)"
99
+ }, {
100
+ "dialog-header": _(() => [g("div", Z, S(i(t)("menu.catalog.form.restaurant_attributes_title")), 1)]),
101
+ "dialog-footer": _(() => [c(V), c(F, {
102
+ label: i(t)("menu.common.actions.confirm"),
103
+ size: "lg",
104
+ type: "submit",
105
+ variant: "primary",
106
+ onClick: h
107
+ }, null, 8, ["label"]), c(F, {
108
+ label: i(t)("menu.common.actions.cancel"),
109
+ size: "lg",
110
+ variant: "tertiary",
111
+ onClick: C
112
+ }, null, 8, ["label"])]),
113
+ default: _(() => [g("div", ee, [c(k, {
114
+ title: i(t)("menu.link_product.rules.restaurant_custom_attributes_filter")
115
+ }, {
116
+ default: _(() => [c(d, {
117
+ "column-defs": y,
118
+ "row-data": i(r),
119
+ "shrink-at": !1,
120
+ "page-size": i(r).length,
121
+ "hide-footer": ""
122
+ }, null, 8, ["row-data", "page-size"])]),
123
+ _: 1
124
+ }, 8, ["title"]), c(k, {
125
+ title: i(t)("menu.link_product.rules.restaurant_filter")
126
+ }, {
127
+ default: _(() => [c(d, {
128
+ "column-defs": y,
129
+ "row-data": i(a),
130
+ "shrink-at": !1,
131
+ "page-size": i(a).length,
132
+ "hide-footer": ""
133
+ }, null, 8, ["row-data", "page-size"])]),
134
+ _: 1
135
+ }, 8, ["title"])])]),
136
+ _: 1
137
+ }, 8, ["modelValue"])], 64);
138
+ };
139
+ }
140
+ });
141
+ function fe(e) {
142
+ return L() ? ($(e), !0) : !1;
143
+ }
144
+ function x(e) {
145
+ return typeof e == "function" ? e() : i(e);
146
+ }
147
+ const pe = typeof window < "u" && typeof document < "u";
148
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
149
+ const te = Object.prototype.toString, de = (e) => te.call(e) === "[object Object]", D = () => {
150
+ };
151
+ function P(e, n) {
152
+ function o(...t) {
153
+ return new Promise((r, a) => {
154
+ Promise.resolve(e(() => n.apply(this, t), { fn: n, thisArg: this, args: t })).then(r).catch(a);
155
+ });
156
+ }
157
+ return o;
158
+ }
159
+ const z = (e) => e();
160
+ function ne(e, n = {}) {
161
+ let o, t, r = D;
162
+ const a = (m) => {
163
+ clearTimeout(m), r(), r = D;
164
+ };
165
+ return (m) => {
166
+ const b = x(e), h = x(n.maxWait);
167
+ return o && a(o), b <= 0 || h !== void 0 && h <= 0 ? (t && (a(t), t = null), Promise.resolve(m())) : new Promise((p, w) => {
168
+ r = n.rejectOnCancel ? w : p, h && !t && (t = setTimeout(() => {
169
+ o && a(o), t = null, p(m());
170
+ }, h)), o = setTimeout(() => {
171
+ t && a(t), t = null, p(m());
172
+ }, b);
173
+ });
174
+ };
175
+ }
176
+ function oe(e = z) {
177
+ const n = A(!0);
178
+ function o() {
179
+ n.value = !1;
180
+ }
181
+ function t() {
182
+ n.value = !0;
183
+ }
184
+ const r = (...a) => {
185
+ n.value && e(...a);
186
+ };
187
+ return { isActive: N(n), pause: o, resume: t, eventFilter: r };
188
+ }
189
+ function re(e) {
190
+ return U();
191
+ }
192
+ function ae(e, n = 200, o = {}) {
193
+ return P(
194
+ ne(n, o),
195
+ e
196
+ );
197
+ }
198
+ function be(e, n = 200, o = {}) {
199
+ const t = A(e.value), r = ae(() => {
200
+ t.value = e.value;
201
+ }, n, o);
202
+ return O(e, () => r()), t;
203
+ }
204
+ function se(e, n, o = {}) {
205
+ const {
206
+ eventFilter: t = z,
207
+ ...r
208
+ } = o;
209
+ return O(
210
+ e,
211
+ P(
212
+ t,
213
+ n
214
+ ),
215
+ r
216
+ );
217
+ }
218
+ function he(e, n, o = {}) {
219
+ const {
220
+ eventFilter: t,
221
+ ...r
222
+ } = o, { eventFilter: a, pause: y, resume: m, isActive: b } = oe(t);
223
+ return { stop: se(
224
+ e,
225
+ n,
226
+ {
227
+ ...r,
228
+ eventFilter: a
229
+ }
230
+ ), pause: y, resume: m, isActive: b };
231
+ }
232
+ function ve(e, n = !0, o) {
233
+ re() ? K(e, o) : n ? e() : M(e);
234
+ }
235
+ export {
236
+ me as _,
237
+ ve as a,
238
+ fe as b,
239
+ de as c,
240
+ pe as i,
241
+ D as n,
242
+ be as r,
243
+ x as t,
244
+ he as w
245
+ };