@feedmepos/mf-common 1.29.24 → 1.29.25

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as C, computed as b, resolveComponent as N, openBlock as h, createElementBlock as v, createVNode as S, toDisplayString as F, unref as w, h as d } from "vue";
2
- import { t as x, u as B } from "./app-9ae28090.js";
2
+ import { t as x, u as B } from "./app-594ba388.js";
3
3
  import { components as c } from "@feedmepos/ui-library";
4
4
  import { c as O } from "./object-27ce045b.js";
5
5
  import "pinia";
@@ -1,5 +1,5 @@
1
1
  import { ref as Fr, computed as Vt, defineComponent as Rd, onMounted as qd, watch as Ks, resolveComponent as _i, openBlock as It, createElementBlock as $n, createElementVNode as Rt, toDisplayString as Ys, unref as qt, createVNode as en, isRef as Bd, createCommentVNode as ra, Fragment as Io, renderList as To, createBlock as Ei, withCtx as Co, normalizeClass as ds, Transition as Js } from "vue";
2
- import { c as kr, l as G, d as xe, e as Ie, f as Nd, u as $s, g as Ud, a as xd, O as Ws, t as Ld, b as Gd } from "./app-9ae28090.js";
2
+ import { c as kr, l as G, d as xe, e as Ie, f as Nd, u as $s, g as Ud, a as xd, O as Ws, t as Ld, b as Gd } from "./app-594ba388.js";
3
3
  import { FmButtonVariant as aa } from "@feedmepos/ui-library";
4
4
  import { defineStore as Vd } from "pinia";
5
5
  import { c as ia } from "./object-27ce045b.js";
@@ -1,10 +1,10 @@
1
- import { ref as w, computed as o, defineComponent as ae, mergeModels as ne, useModel as ue, watch as j, resolveComponent as k, openBlock as i, createElementBlock as b, createElementVNode as C, createVNode as y, withCtx as L, normalizeClass as re, toDisplayString as oe, createCommentVNode as N, createBlock as O, withModifiers as K, unref as g, isRef as se, Fragment as Q, renderList as T, renderSlot as ie, nextTick as ce } from "vue";
2
- import { t as ve, u as de, a as fe, O as E, b as me } from "./app-9ae28090.js";
1
+ import { ref as S, computed as o, defineComponent as ne, mergeModels as ue, useModel as re, watch as j, resolveComponent as C, openBlock as i, createElementBlock as y, createElementVNode as w, createVNode as k, withCtx as N, renderSlot as K, normalizeClass as oe, toDisplayString as se, createCommentVNode as Q, createBlock as R, withModifiers as T, unref as g, isRef as ie, Fragment as E, renderList as W, nextTick as ce } from "vue";
2
+ import { t as ve, u as de, a as fe, O as P, b as me } from "./app-594ba388.js";
3
3
  import "@feedmepos/ui-library";
4
4
  import "pinia";
5
5
  import "vue-router";
6
6
  function pe(f, t, c = f) {
7
- const a = w(!0), v = o(() => {
7
+ const a = S(!0), v = o(() => {
8
8
  if (!a.value && !t.value)
9
9
  return !0;
10
10
  if (t.value && t.value.length > 0) {
@@ -13,8 +13,8 @@ function pe(f, t, c = f) {
13
13
  }
14
14
  return !1;
15
15
  }), x = o(() => {
16
- var u, n, h, m;
17
- return !!((u = t.value) != null && u.length && ((n = t.value) == null ? void 0 : n.length) > 0 && ((h = t.value) == null ? void 0 : h.length) < ((m = f.value) == null ? void 0 : m.length));
16
+ var u, n, b, m;
17
+ return !!((u = t.value) != null && u.length && ((n = t.value) == null ? void 0 : n.length) > 0 && ((b = t.value) == null ? void 0 : b.length) < ((m = f.value) == null ? void 0 : m.length));
18
18
  });
19
19
  return { allCleared: a, allSelected: v, indeterminate: x, toggleAll: () => {
20
20
  if (v.value) {
@@ -24,14 +24,14 @@ function pe(f, t, c = f) {
24
24
  const u = c.value.map((n) => n.value);
25
25
  u.length === f.value.length ? (t.value = void 0, a.value = !1) : (t.value = u, a.value = !1);
26
26
  }, toggleOption: (u) => {
27
- var h, m, S;
27
+ var b, m, F;
28
28
  let n;
29
- t.value === void 0 && a.value ? n = [u] : t.value === void 0 && !a.value ? n = (h = f.value.map((p) => p.value)) == null ? void 0 : h.filter((p) => p !== u) : (m = t.value) != null && m.includes(u) ? n = (S = t.value) == null ? void 0 : S.filter((p) => p !== u) : n = [...t.value || [], u], n.length === 0 ? (t.value = void 0, a.value = !0) : n.length === f.value.length ? (t.value = void 0, a.value = !1) : t.value = n;
29
+ t.value === void 0 && a.value ? n = [u] : t.value === void 0 && !a.value ? n = (b = f.value.map((p) => p.value)) == null ? void 0 : b.filter((p) => p !== u) : (m = t.value) != null && m.includes(u) ? n = (F = t.value) == null ? void 0 : F.filter((p) => p !== u) : n = [...t.value || [], u], n.length === 0 ? (t.value = void 0, a.value = !0) : n.length === f.value.length ? (t.value = void 0, a.value = !1) : t.value = n;
30
30
  } };
31
31
  }
32
- const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-center gap-8 min-w-0" }, be = { class: "inline-flex items-center max-w-full" }, ye = { class: "flex flex-col w-[360px] min-h-0 gap-8" }, _e = { class: "flex gap-4 px-[6px]" }, ke = { class: "flex-1" }, Ce = { class: "flex-1 overflow-y-auto min-h-0" }, we = { key: 0 }, Me = /* @__PURE__ */ ae({
32
+ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-center gap-8 min-w-0" }, be = { class: "inline-flex items-center max-w-full" }, ye = { class: "flex flex-col w-[360px] min-h-0 gap-8" }, ke = { class: "flex gap-4 px-[6px]" }, _e = { class: "flex-1" }, Ce = { class: "flex-1 overflow-y-auto min-h-0" }, we = { key: 0 }, Me = /* @__PURE__ */ ne({
33
33
  __name: "RestaurantSelector",
34
- props: /* @__PURE__ */ ne({
34
+ props: /* @__PURE__ */ ue({
35
35
  multiple: { type: Boolean, default: !1 },
36
36
  excludeRestaurants: {},
37
37
  managableOnly: { type: Boolean, default: !0 },
@@ -44,22 +44,22 @@ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-ce
44
44
  }),
45
45
  emits: ["update:modelValue"],
46
46
  setup(f) {
47
- const t = f, { t: c } = ve(), a = ue(f, "modelValue"), { restaurants: v, restaurantAttributeSettings: x } = de(), R = o(() => v.value.length === 0);
48
- function P(e) {
47
+ const t = f, { t: c } = ve(), a = re(f, "modelValue"), { restaurants: v, restaurantAttributeSettings: x } = de(), h = o(() => v.value.length === 0);
48
+ function D(e) {
49
49
  const l = v.value.map((_) => {
50
- var A;
51
- return (A = _.customAttributes) == null ? void 0 : A[e];
50
+ var O;
51
+ return (O = _.customAttributes) == null ? void 0 : O[e];
52
52
  }).filter((_) => typeof _ == "string" && !!_);
53
53
  return [...new Set(l)];
54
54
  }
55
55
  const u = o(() => x.value.map((e) => {
56
- const l = P(e.key);
56
+ const l = D(e.key);
57
57
  return {
58
58
  ...e,
59
59
  values: l
60
60
  };
61
- })), { searchKey: n, filter: h } = fe(), m = w(null);
62
- function S(e) {
61
+ })), { searchKey: n, filter: b } = fe(), m = S(null);
62
+ function F(e) {
63
63
  var l;
64
64
  if (t.multiple)
65
65
  throw new Error("Single selection is not supported for multiple selection");
@@ -71,12 +71,12 @@ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-ce
71
71
  label: `${l} (${r ?? "--"})`,
72
72
  value: e._id
73
73
  };
74
- }, M = o(() => v.value.map(p)), F = o(
75
- () => v.value.filter((e) => t.managableOnly ? e.managable : !0).filter((e) => t.multiple ? !0 : E(e.customAttributes || {}, d.value)).map(p).filter(({ label: e }) => h([e])).filter((e) => {
74
+ }, M = o(() => v.value.map(p)), V = o(
75
+ () => v.value.filter((e) => t.managableOnly ? e.managable : !0).filter((e) => t.multiple ? !0 : P(e.customAttributes || {}, d.value)).map(p).filter(({ label: e }) => b([e])).filter((e) => {
76
76
  var l;
77
77
  return !((l = t.excludeRestaurants) != null && l.includes(e.value));
78
78
  })
79
- ), W = o(() => {
79
+ ), q = o(() => {
80
80
  var e;
81
81
  return a.value ? a.value.length === 1 ? (e = M.value.find((l) => {
82
82
  var r;
@@ -84,21 +84,21 @@ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-ce
84
84
  })) == null ? void 0 : e.label : c("portalshell.components.restaurantSelector.restaurantCount", {
85
85
  count: a.value.length
86
86
  }) : c("portalshell.components.restaurantSelector.allRestaurants");
87
- }), q = o(() => {
87
+ }), G = o(() => {
88
88
  var e;
89
89
  return a.value ? ((e = M.value.find((l) => l.value === a.value)) == null ? void 0 : e.label) || c("portalshell.components.restaurantSelector.unknownRestaurant") : c("portalshell.components.restaurantSelector.selectRestaurant");
90
- }), D = o(() => t.multiple ? W.value : q.value), B = o(() => t.disabled ? "neutral-gray-200" : t.variant === "dark" ? "neutral-black" : "neutral-gray-400"), G = o(() => t.disabled ? "text-fm-color-neutral-gray-200" : t.variant === "dark" ? "text-fm-color-neutral-black" : "text-fm-color-neutral-gray-400"), { allSelected: U, toggleAll: H, toggleOption: J, indeterminate: X } = pe(
90
+ }), B = o(() => t.multiple ? q.value : G.value), z = o(() => t.disabled ? "neutral-gray-200" : t.variant === "dark" ? "neutral-black" : "neutral-gray-400"), H = o(() => t.disabled ? "text-fm-color-neutral-gray-200" : t.variant === "dark" ? "text-fm-color-neutral-black" : "text-fm-color-neutral-gray-400"), { allSelected: U, toggleAll: J, toggleOption: X, indeterminate: Y } = pe(
91
91
  M,
92
92
  a,
93
- F
94
- ), V = w(!1), Y = o(() => x.value.length > 0), z = w(null);
95
- async function Z() {
96
- t.disabled || (V.value ? V.value = !1 : (V.value = !0, await ce(), z.value && z.value.toggleProperty(!0)));
93
+ V
94
+ ), A = S(!1), Z = o(() => x.value.length > 0), $ = S(null);
95
+ async function ee() {
96
+ t.disabled || h.value || (A.value ? A.value = !1 : (A.value = !0, await ce(), $.value && $.value.toggleProperty(!0)));
97
97
  }
98
- const d = w((() => ({
98
+ const d = S((() => ({
99
99
  logic: "AND",
100
100
  rules: []
101
- }))()), ee = o(() => {
101
+ }))()), le = o(() => {
102
102
  var e, l;
103
103
  return ((l = (e = d.value) == null ? void 0 : e.rules) == null ? void 0 : l.length) || 0;
104
104
  });
@@ -111,10 +111,10 @@ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-ce
111
111
  a.value = null;
112
112
  return;
113
113
  }
114
- const l = v.value.filter((r) => E(r.customAttributes || {}, d.value));
114
+ const l = v.value.filter((r) => P(r.customAttributes || {}, d.value));
115
115
  a.value = l.map((r) => r._id);
116
116
  } else {
117
- const l = v.value.filter((r) => E(r.customAttributes || {}, d.value));
117
+ const l = v.value.filter((r) => P(r.customAttributes || {}, d.value));
118
118
  l.length === 0 ? a.value = null : a.value = (e = l[0]) == null ? void 0 : e._id;
119
119
  }
120
120
  },
@@ -122,123 +122,129 @@ const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-ce
122
122
  deep: !0
123
123
  }
124
124
  ), j(
125
- [() => t.autoSelectFirst, F],
125
+ [() => t.autoSelectFirst, V],
126
126
  ([e, l]) => {
127
127
  e && l.length > 0 && !a.value && (a.value = l[0].value);
128
128
  },
129
129
  { immediate: !0 }
130
130
  ), (e, l) => {
131
- const r = k("FmIcon"), _ = k("FmCircularProgress"), A = k("FmChip"), le = k("FmSearch"), $ = k("FmMenuItem"), te = k("FmMenu");
132
- return i(), b("div", ge, [
133
- C("div", he, [
134
- y(te, {
131
+ const r = C("FmIcon"), _ = C("FmCircularProgress"), O = C("FmChip"), te = C("FmSearch"), L = C("FmMenuItem"), ae = C("FmMenu");
132
+ return i(), y("div", ge, [
133
+ w("div", he, [
134
+ k(ae, {
135
135
  class: "min-w-0",
136
136
  "close-on-click": !1,
137
- disabled: e.disabled || R.value,
137
+ disabled: e.disabled || h.value,
138
138
  ref_key: "menuRef",
139
139
  ref: m,
140
140
  "z-index": 50,
141
141
  "selector-for-dismiss-away-event-exclusion": ".fm-dialog, .fm-select__menu__wrapper"
142
142
  }, {
143
- "menu-button": L(() => [
144
- C("div", be, [
145
- y(A, {
146
- disabled: e.disabled,
147
- class: "max-w-full overflow-hidden"
148
- }, {
149
- default: L(() => [
150
- y(r, {
151
- color: B.value,
152
- name: "storefront",
153
- outline: "",
154
- size: "sm"
155
- }, null, 8, ["color"]),
156
- D.value ? (i(), b("div", {
157
- key: 0,
158
- class: re([
159
- "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
160
- G.value
161
- ])
162
- }, oe(D.value), 3)) : N("", !0),
163
- R.value ? (i(), O(_, {
164
- key: 1,
165
- size: "md"
166
- })) : (i(), O(r, {
167
- key: 2,
168
- color: B.value,
169
- name: "keyboard_arrow_down",
170
- size: "sm"
171
- }, null, 8, ["color"])),
172
- Y.value ? (i(), b("div", {
173
- key: 3,
174
- class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
175
- onClick: K(Z, ["stop"])
176
- }, [
177
- y(r, {
178
- name: "filter_alt",
179
- size: "sm",
180
- outline: ee.value === 0,
181
- color: B.value,
182
- onClick: l[0] || (l[0] = K(() => {
183
- }, ["prevent"]))
184
- }, null, 8, ["outline", "color"])
185
- ])) : N("", !0)
186
- ]),
187
- _: 1
188
- }, 8, ["disabled"])
143
+ "menu-button": N(() => [
144
+ K(e.$slots, "menu-button", {
145
+ disabled: e.disabled || h.value,
146
+ isLoading: h.value,
147
+ label: B.value
148
+ }, () => [
149
+ w("div", be, [
150
+ k(O, {
151
+ disabled: e.disabled || h.value,
152
+ class: "max-w-full overflow-hidden"
153
+ }, {
154
+ default: N(() => [
155
+ k(r, {
156
+ color: z.value,
157
+ name: "storefront",
158
+ outline: "",
159
+ size: "sm"
160
+ }, null, 8, ["color"]),
161
+ B.value ? (i(), y("div", {
162
+ key: 0,
163
+ class: oe([
164
+ "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
165
+ H.value
166
+ ])
167
+ }, se(B.value), 3)) : Q("", !0),
168
+ h.value ? (i(), R(_, {
169
+ key: 1,
170
+ size: "md"
171
+ })) : (i(), R(r, {
172
+ key: 2,
173
+ color: z.value,
174
+ name: "keyboard_arrow_down",
175
+ size: "sm"
176
+ }, null, 8, ["color"])),
177
+ Z.value ? (i(), y("div", {
178
+ key: 3,
179
+ class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
180
+ onClick: T(ee, ["stop"])
181
+ }, [
182
+ k(r, {
183
+ name: "filter_alt",
184
+ size: "sm",
185
+ outline: le.value === 0,
186
+ color: z.value,
187
+ onClick: l[0] || (l[0] = T(() => {
188
+ }, ["prevent"]))
189
+ }, null, 8, ["outline", "color"])
190
+ ])) : Q("", !0)
191
+ ]),
192
+ _: 1
193
+ }, 8, ["disabled"])
194
+ ])
189
195
  ])
190
196
  ]),
191
- default: L(() => [
192
- C("div", ye, [
193
- C("div", _e, [
194
- C("div", ke, [
195
- y(le, {
197
+ default: N(() => [
198
+ w("div", ye, [
199
+ w("div", ke, [
200
+ w("div", _e, [
201
+ k(te, {
196
202
  modelValue: g(n),
197
- "onUpdate:modelValue": l[1] || (l[1] = (s) => se(n) ? n.value = s : null),
203
+ "onUpdate:modelValue": l[1] || (l[1] = (s) => ie(n) ? n.value = s : null),
198
204
  placeholder: g(c)("common.search")
199
205
  }, null, 8, ["modelValue", "placeholder"])
200
206
  ])
201
207
  ]),
202
- C("div", Ce, [
203
- e.multiple ? (i(), b(Q, { key: 0 }, [
204
- y($, {
208
+ w("div", Ce, [
209
+ e.multiple ? (i(), y(E, { key: 0 }, [
210
+ k(L, {
205
211
  label: "All",
206
212
  "has-checkbox": "",
207
213
  "model-value": g(U),
208
- indeterminate: g(X),
209
- onClick: g(H)
214
+ indeterminate: g(Y),
215
+ onClick: g(J)
210
216
  }, null, 8, ["model-value", "indeterminate", "onClick"]),
211
- (i(!0), b(Q, null, T(F.value, (s) => {
217
+ (i(!0), y(E, null, W(V.value, (s) => {
212
218
  var I;
213
- return i(), O($, {
219
+ return i(), R(L, {
214
220
  key: s.value,
215
221
  label: s.label,
216
222
  "has-checkbox": "",
217
223
  "model-value": g(U) || ((I = a.value) == null ? void 0 : I.includes(s.value)),
218
- onClick: (Se) => g(J)(s.value)
224
+ onClick: (xe) => g(X)(s.value)
219
225
  }, null, 8, ["label", "model-value", "onClick"]);
220
226
  }), 128))
221
- ], 64)) : (i(!0), b(Q, { key: 1 }, T(F.value, (s) => (i(), O($, {
227
+ ], 64)) : (i(!0), y(E, { key: 1 }, W(V.value, (s) => (i(), R(L, {
222
228
  key: s.value,
223
229
  label: s.label,
224
- onClick: (I) => S(s.value)
230
+ onClick: (I) => F(s.value)
225
231
  }, null, 8, ["label", "onClick"]))), 128))
226
232
  ])
227
233
  ])
228
234
  ]),
229
- _: 1
235
+ _: 3
230
236
  }, 8, ["disabled"]),
231
- ie(e.$slots, "append-right")
237
+ K(e.$slots, "append-right")
232
238
  ]),
233
- V.value ? (i(), b("div", we, [
234
- y(g(me), {
239
+ A.value ? (i(), y("div", we, [
240
+ k(g(me), {
235
241
  ref_key: "filterRef",
236
- ref: z,
242
+ ref: $,
237
243
  attributes: u.value,
238
244
  modelValue: d.value,
239
245
  "onUpdate:modelValue": l[2] || (l[2] = (s) => d.value = s)
240
246
  }, null, 8, ["attributes", "modelValue"])
241
- ])) : N("", !0)
247
+ ])) : Q("", !0)
242
248
  ]);
243
249
  };
244
250
  }