@feedmepos/mf-common 1.27.4 → 1.27.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomAttributesForm-1d9add0d.js → CustomAttributesForm-a4f037ad.js} +1 -1
- package/dist/{ItemSelector-7af4226f.js → ItemSelector-b751ecbd.js} +1 -1
- package/dist/RestaurantSelector-7fa74f07.js +242 -0
- package/dist/{app-bab0f0ed.js → app-42fbc6b2.js} +3 -3
- package/dist/app.js +2 -2
- package/dist/components/RestaurantSelector.vue.d.ts.map +1 -1
- package/dist/composables/filterSelector.d.ts +1 -1
- package/dist/composables/filterSelector.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/RestaurantSelector-c9dc3511.js +0 -231
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as A, computed as d, resolveComponent as N, openBlock as f, createElementBlock as b, createVNode as S, toDisplayString as C, unref as F, h } from "vue";
|
|
2
|
-
import { t as w, u as O } from "./app-
|
|
2
|
+
import { t as w, u as O } from "./app-42fbc6b2.js";
|
|
3
3
|
import { components as y } from "@feedmepos/ui-library";
|
|
4
4
|
import { c as x } from "./object-27ce045b.js";
|
|
5
5
|
import "pinia";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref as At, computed as rt, defineComponent as _i, onMounted as ki, watch as Rn, resolveComponent as hr, openBlock as Re, createElementBlock as it, createElementVNode as Qe, toDisplayString as Ln, unref as We, createVNode as nt, isRef as Ei, createCommentVNode as Bt, Fragment as hn, renderList as fn, createBlock as fr, withCtx as gn, normalizeClass as Un, Transition as Kn } from "vue";
|
|
2
|
-
import { c as mn, l as we, e as Dt, d as _e, f as ct, g as et, h as Fi, u as Tn, i as ji, a as Si, O as Hn, t as Ci, b as zi } from "./app-
|
|
2
|
+
import { c as mn, l as we, e as Dt, d as _e, f as ct, g as et, h as Fi, u as Tn, i as ji, a as Si, O as Hn, t as Ci, b as zi } from "./app-42fbc6b2.js";
|
|
3
3
|
import { FmButtonVariant as Vt } from "@feedmepos/ui-library";
|
|
4
4
|
import { defineStore as Oi } from "pinia";
|
|
5
5
|
import { c as Gt } from "./object-27ce045b.js";
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { ref as S, computed as s, defineComponent as le, mergeModels as te, useModel as ae, watch as U, resolveComponent as C, openBlock as d, createElementBlock as y, createElementVNode as k, createVNode as g, withCtx as z, normalizeClass as ne, toDisplayString as ue, createCommentVNode as $, withModifiers as j, unref as h, isRef as re, Fragment as I, renderList as K, createBlock as P, renderSlot as oe, nextTick as se } from "vue";
|
|
2
|
+
import { t as ie, u as ce, a as ve, O as N, b as de } from "./app-42fbc6b2.js";
|
|
3
|
+
import "@feedmepos/ui-library";
|
|
4
|
+
import "pinia";
|
|
5
|
+
import "vue-router";
|
|
6
|
+
function fe(f, e, i = f) {
|
|
7
|
+
const a = S(!0), m = s(() => {
|
|
8
|
+
if (!a.value && !e.value)
|
|
9
|
+
return !0;
|
|
10
|
+
if (e.value && e.value.length > 0) {
|
|
11
|
+
const u = new Set(i.value.map((n) => n.value));
|
|
12
|
+
return e.value.length === i.value.length && e.value.every((n) => u.has(n));
|
|
13
|
+
}
|
|
14
|
+
return !1;
|
|
15
|
+
}), w = s(() => {
|
|
16
|
+
var u, n, p, b;
|
|
17
|
+
return !!((u = e.value) != null && u.length && ((n = e.value) == null ? void 0 : n.length) > 0 && ((p = e.value) == null ? void 0 : p.length) < ((b = f.value) == null ? void 0 : b.length));
|
|
18
|
+
});
|
|
19
|
+
return { allCleared: a, allSelected: m, indeterminate: w, toggleAll: () => {
|
|
20
|
+
if (m.value) {
|
|
21
|
+
e.value = void 0, a.value = !0;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const u = i.value.map((n) => n.value);
|
|
25
|
+
u.length === f.value.length ? (e.value = void 0, a.value = !1) : (e.value = u, a.value = !1);
|
|
26
|
+
}, toggleOption: (u) => {
|
|
27
|
+
var p, b, x;
|
|
28
|
+
let n;
|
|
29
|
+
e.value === void 0 && a.value ? n = [u] : e.value === void 0 && !a.value ? n = (p = f.value.map((c) => c.value)) == null ? void 0 : p.filter((c) => c !== u) : (b = e.value) != null && b.includes(u) ? n = (x = e.value) == null ? void 0 : x.filter((c) => c !== u) : n = [...e.value || [], u], n.length === 0 ? (e.value = void 0, a.value = !0) : n.length === f.value.length ? (e.value = void 0, a.value = !1) : e.value = n;
|
|
30
|
+
} };
|
|
31
|
+
}
|
|
32
|
+
const me = { class: "w-full flex flex-col gap-8" }, pe = { class: "flex items-center gap-8" }, ge = { class: "inline-flex items-center" }, he = { class: "flex flex-col w-[360px] min-h-0 gap-8" }, be = { class: "flex gap-4 px-[6px]" }, ye = { class: "flex-1" }, _e = { class: "flex-1 overflow-y-auto min-h-0" }, ke = { key: 0 }, Oe = /* @__PURE__ */ le({
|
|
33
|
+
__name: "RestaurantSelector",
|
|
34
|
+
props: /* @__PURE__ */ te({
|
|
35
|
+
multiple: { type: Boolean, default: !1 },
|
|
36
|
+
excludeRestaurants: {},
|
|
37
|
+
managableOnly: { type: Boolean, default: !0 },
|
|
38
|
+
disabled: { type: Boolean, default: !1 },
|
|
39
|
+
variant: { default: "default" },
|
|
40
|
+
autoSelectFirst: { type: Boolean, default: !1 }
|
|
41
|
+
}, {
|
|
42
|
+
modelValue: {},
|
|
43
|
+
modelModifiers: {}
|
|
44
|
+
}),
|
|
45
|
+
emits: ["update:modelValue"],
|
|
46
|
+
setup(f) {
|
|
47
|
+
const e = f, { t: i } = ie(), a = ae(f, "modelValue"), { restaurants: m, restaurantAttributeSettings: w } = ce();
|
|
48
|
+
function Q(l) {
|
|
49
|
+
const t = m.value.map((_) => {
|
|
50
|
+
var A;
|
|
51
|
+
return (A = _.customAttributes) == null ? void 0 : A[l];
|
|
52
|
+
}).filter((_) => typeof _ == "string" && !!_);
|
|
53
|
+
return [...new Set(t)];
|
|
54
|
+
}
|
|
55
|
+
const E = s(() => w.value.map((l) => {
|
|
56
|
+
const t = Q(l.key);
|
|
57
|
+
return {
|
|
58
|
+
...l,
|
|
59
|
+
values: t
|
|
60
|
+
};
|
|
61
|
+
})), { searchKey: u, filter: n } = ve(), p = S(null);
|
|
62
|
+
function b(l) {
|
|
63
|
+
var t;
|
|
64
|
+
if (e.multiple)
|
|
65
|
+
throw new Error("Single selection is not supported for multiple selection");
|
|
66
|
+
a.value = l, (t = p.value) == null || t.toggleMenu(!1);
|
|
67
|
+
}
|
|
68
|
+
const x = (l) => {
|
|
69
|
+
const { name: t, code: r } = l.profile;
|
|
70
|
+
return {
|
|
71
|
+
label: `${t} (${r ?? "--"})`,
|
|
72
|
+
value: l._id
|
|
73
|
+
};
|
|
74
|
+
}, c = s(() => m.value.map(x)), F = s(
|
|
75
|
+
() => m.value.filter((l) => e.managableOnly ? l.managable : !0).filter((l) => e.multiple ? !0 : N(l.customAttributes || {}, v.value)).map(x).filter(({ label: l }) => n([l])).filter((l) => {
|
|
76
|
+
var t;
|
|
77
|
+
return !((t = e.excludeRestaurants) != null && t.includes(l.value));
|
|
78
|
+
})
|
|
79
|
+
), T = s(() => {
|
|
80
|
+
var l;
|
|
81
|
+
return a.value ? a.value.length === 1 ? (l = c.value.find((t) => {
|
|
82
|
+
var r;
|
|
83
|
+
return t.value === ((r = a.value) == null ? void 0 : r[0]);
|
|
84
|
+
})) == null ? void 0 : l.label : i("portalshell.components.restaurantSelector.restaurantCount", {
|
|
85
|
+
count: a.value.length
|
|
86
|
+
}) : i("portalshell.components.restaurantSelector.allRestaurants");
|
|
87
|
+
}), W = s(() => {
|
|
88
|
+
var l;
|
|
89
|
+
return a.value ? ((l = c.value.find((t) => t.value === a.value)) == null ? void 0 : l.label) || i("portalshell.components.restaurantSelector.unknownRestaurant") : i("portalshell.components.restaurantSelector.selectRestaurant");
|
|
90
|
+
}), L = s(() => e.multiple ? T.value : W.value), O = s(() => e.disabled ? "neutral-gray-200" : e.variant === "dark" ? "neutral-black" : "neutral-gray-400"), q = s(() => e.disabled ? "text-fm-color-neutral-gray-200" : e.variant === "dark" ? "text-fm-color-neutral-black" : "text-fm-color-neutral-gray-400"), { allSelected: D, toggleAll: G, toggleOption: H, indeterminate: J } = fe(
|
|
91
|
+
c,
|
|
92
|
+
a,
|
|
93
|
+
F
|
|
94
|
+
), V = S(!1), X = s(() => w.value.length > 0), R = S(null);
|
|
95
|
+
async function Y() {
|
|
96
|
+
e.disabled || (V.value ? V.value = !1 : (V.value = !0, await se(), R.value && R.value.toggleProperty(!0)));
|
|
97
|
+
}
|
|
98
|
+
const v = S((() => ({
|
|
99
|
+
logic: "AND",
|
|
100
|
+
rules: []
|
|
101
|
+
}))()), Z = s(() => {
|
|
102
|
+
var l, t;
|
|
103
|
+
return ((t = (l = v.value) == null ? void 0 : l.rules) == null ? void 0 : t.length) || 0;
|
|
104
|
+
});
|
|
105
|
+
return U(
|
|
106
|
+
v,
|
|
107
|
+
() => {
|
|
108
|
+
var l;
|
|
109
|
+
if (e.multiple) {
|
|
110
|
+
if (!v.value || v.value.rules.length === 0) {
|
|
111
|
+
a.value = null;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const t = m.value.filter((r) => N(r.customAttributes || {}, v.value));
|
|
115
|
+
a.value = t.map((r) => r._id);
|
|
116
|
+
} else {
|
|
117
|
+
const t = m.value.filter((r) => N(r.customAttributes || {}, v.value));
|
|
118
|
+
t.length === 0 ? a.value = null : a.value = (l = t[0]) == null ? void 0 : l._id;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
deep: !0
|
|
123
|
+
}
|
|
124
|
+
), U(
|
|
125
|
+
[() => e.autoSelectFirst, F],
|
|
126
|
+
([l, t]) => {
|
|
127
|
+
l && t.length > 0 && !a.value && (a.value = t[0].value);
|
|
128
|
+
},
|
|
129
|
+
{ immediate: !0 }
|
|
130
|
+
), (l, t) => {
|
|
131
|
+
const r = C("FmIcon"), _ = C("FmChip"), A = C("FmSearch"), M = C("FmMenuItem"), ee = C("FmMenu");
|
|
132
|
+
return d(), y("div", me, [
|
|
133
|
+
k("div", pe, [
|
|
134
|
+
g(ee, {
|
|
135
|
+
"close-on-click": !1,
|
|
136
|
+
disabled: e.disabled,
|
|
137
|
+
ref_key: "menuRef",
|
|
138
|
+
ref: p,
|
|
139
|
+
"z-index": 50,
|
|
140
|
+
"selector-for-dismiss-away-event-exclusion": ".fm-dialog, .fm-select__menu__wrapper"
|
|
141
|
+
}, {
|
|
142
|
+
"menu-button": z(() => [
|
|
143
|
+
k("div", ge, [
|
|
144
|
+
g(_, {
|
|
145
|
+
disabled: e.disabled
|
|
146
|
+
}, {
|
|
147
|
+
default: z(() => [
|
|
148
|
+
g(r, {
|
|
149
|
+
color: O.value,
|
|
150
|
+
name: "storefront",
|
|
151
|
+
outline: "",
|
|
152
|
+
size: "sm"
|
|
153
|
+
}, null, 8, ["color"]),
|
|
154
|
+
L.value ? (d(), y("div", {
|
|
155
|
+
key: 0,
|
|
156
|
+
class: ne([
|
|
157
|
+
"fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
|
|
158
|
+
q.value
|
|
159
|
+
])
|
|
160
|
+
}, ue(L.value), 3)) : $("", !0),
|
|
161
|
+
g(r, {
|
|
162
|
+
color: O.value,
|
|
163
|
+
name: "keyboard_arrow_down",
|
|
164
|
+
size: "sm"
|
|
165
|
+
}, null, 8, ["color"]),
|
|
166
|
+
X.value ? (d(), y("div", {
|
|
167
|
+
key: 1,
|
|
168
|
+
class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
|
|
169
|
+
onClick: j(Y, ["stop"])
|
|
170
|
+
}, [
|
|
171
|
+
g(r, {
|
|
172
|
+
name: "filter_alt",
|
|
173
|
+
size: "sm",
|
|
174
|
+
outline: Z.value === 0,
|
|
175
|
+
color: O.value,
|
|
176
|
+
onClick: t[0] || (t[0] = j(() => {
|
|
177
|
+
}, ["prevent"]))
|
|
178
|
+
}, null, 8, ["outline", "color"])
|
|
179
|
+
])) : $("", !0)
|
|
180
|
+
]),
|
|
181
|
+
_: 1
|
|
182
|
+
}, 8, ["disabled"])
|
|
183
|
+
])
|
|
184
|
+
]),
|
|
185
|
+
default: z(() => [
|
|
186
|
+
k("div", he, [
|
|
187
|
+
k("div", be, [
|
|
188
|
+
k("div", ye, [
|
|
189
|
+
g(A, {
|
|
190
|
+
modelValue: h(u),
|
|
191
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => re(u) ? u.value = o : null),
|
|
192
|
+
placeholder: h(i)("common.search")
|
|
193
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
194
|
+
])
|
|
195
|
+
]),
|
|
196
|
+
k("div", _e, [
|
|
197
|
+
l.multiple ? (d(), y(I, { key: 0 }, [
|
|
198
|
+
g(M, {
|
|
199
|
+
label: "All",
|
|
200
|
+
"has-checkbox": "",
|
|
201
|
+
"model-value": h(D),
|
|
202
|
+
indeterminate: h(J),
|
|
203
|
+
onClick: h(G)
|
|
204
|
+
}, null, 8, ["model-value", "indeterminate", "onClick"]),
|
|
205
|
+
(d(!0), y(I, null, K(F.value, (o) => {
|
|
206
|
+
var B;
|
|
207
|
+
return d(), P(M, {
|
|
208
|
+
key: o.value,
|
|
209
|
+
label: o.label,
|
|
210
|
+
"has-checkbox": "",
|
|
211
|
+
"model-value": h(D) || ((B = a.value) == null ? void 0 : B.includes(o.value)),
|
|
212
|
+
onClick: (Ce) => h(H)(o.value)
|
|
213
|
+
}, null, 8, ["label", "model-value", "onClick"]);
|
|
214
|
+
}), 128))
|
|
215
|
+
], 64)) : (d(!0), y(I, { key: 1 }, K(F.value, (o) => (d(), P(M, {
|
|
216
|
+
key: o.value,
|
|
217
|
+
label: o.label,
|
|
218
|
+
onClick: (B) => b(o.value)
|
|
219
|
+
}, null, 8, ["label", "onClick"]))), 128))
|
|
220
|
+
])
|
|
221
|
+
])
|
|
222
|
+
]),
|
|
223
|
+
_: 1
|
|
224
|
+
}, 8, ["disabled"]),
|
|
225
|
+
oe(l.$slots, "append-right")
|
|
226
|
+
]),
|
|
227
|
+
V.value ? (d(), y("div", ke, [
|
|
228
|
+
g(h(de), {
|
|
229
|
+
ref_key: "filterRef",
|
|
230
|
+
ref: R,
|
|
231
|
+
attributes: E.value,
|
|
232
|
+
modelValue: v.value,
|
|
233
|
+
"onUpdate:modelValue": t[2] || (t[2] = (o) => v.value = o)
|
|
234
|
+
}, null, 8, ["attributes", "modelValue"])
|
|
235
|
+
])) : $("", !0)
|
|
236
|
+
]);
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
export {
|
|
241
|
+
Oe as default
|
|
242
|
+
};
|
|
@@ -49485,10 +49485,10 @@ const kO = /* @__PURE__ */ Ad(SO, [["__scopeId", "data-v-318fbbc5"]]), fO = { cl
|
|
|
49485
49485
|
}, 8, ["dropdown-opened", "apps", "businesses", "countries", "current-app", "current-business", "current-country", "user", "embedded", "hide-app-drawer"]));
|
|
49486
49486
|
}
|
|
49487
49487
|
}), Qx = JN(
|
|
49488
|
-
() => import("./CustomAttributesForm-
|
|
49488
|
+
() => import("./CustomAttributesForm-a4f037ad.js")
|
|
49489
49489
|
), gx = JN(
|
|
49490
|
-
() => import("./RestaurantSelector-
|
|
49491
|
-
), vx = JN(() => import("./ItemSelector-
|
|
49490
|
+
() => import("./RestaurantSelector-7fa74f07.js")
|
|
49491
|
+
), vx = JN(() => import("./ItemSelector-b751ecbd.js")), zO = {
|
|
49492
49492
|
yes: "Yes",
|
|
49493
49493
|
no: "No",
|
|
49494
49494
|
ok: "OK",
|
package/dist/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as s } from "./app-
|
|
2
|
-
import { C as u, E as M, s as m, H as E, J as S, F as p, z as P, k as d, I as c, P as C, _, R as g, i as h, K as F, B as R, p as A, A as y, n as O, j as I, q as L, M as T, x as b, v as G, w as N, o as Q, L as U, D as w, N as x, u as B, m as D, r as Y, t as f, G as v, y as z } from "./app-
|
|
1
|
+
import { d as s } from "./app-42fbc6b2.js";
|
|
2
|
+
import { C as u, E as M, s as m, H as E, J as S, F as p, z as P, k as d, I as c, P as C, _, R as g, i as h, K as F, B as R, p as A, A as y, n as O, j as I, q as L, M as T, x as b, v as G, w as N, o as Q, L as U, D as w, N as x, u as B, m as D, r as Y, t as f, G as v, y as z } from "./app-42fbc6b2.js";
|
|
3
3
|
import "pinia";
|
|
4
4
|
import "vue";
|
|
5
5
|
import "vue-router";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestaurantSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/components/RestaurantSelector.vue.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RestaurantSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/components/RestaurantSelector.vue.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyjBD,wBAAwG;AAUxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type Ref } from "vue";
|
|
|
2
2
|
interface Option<T> {
|
|
3
3
|
value: T;
|
|
4
4
|
}
|
|
5
|
-
export declare function useFilterSelector<T>(options: Ref<Option<T>[]>, model: Ref<T[] | undefined | null>): {
|
|
5
|
+
export declare function useFilterSelector<T>(options: Ref<Option<T>[]>, model: Ref<T[] | undefined | null>, filteredOptions?: Ref<Option<T>[]>): {
|
|
6
6
|
allCleared: Ref<boolean, boolean>;
|
|
7
7
|
allSelected: import("vue").ComputedRef<boolean>;
|
|
8
8
|
indeterminate: import("vue").ComputedRef<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterSelector.d.ts","sourceRoot":"","sources":["../../../src/composables/filterSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAE7C,UAAU,MAAM,CAAC,CAAC;IAChB,KAAK,EAAE,CAAC,CAAA;CACT;AAED,wBAAgB,iBAAiB,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"filterSelector.d.ts","sourceRoot":"","sources":["../../../src/composables/filterSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAE7C,UAAU,MAAM,CAAC,CAAC;IAChB,KAAK,EAAE,CAAC,CAAA;CACT;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EACzB,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC,EAClC,eAAe,GAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAW;;;;;0BA8Cd,CAAC;EAwB/B"}
|
package/package.json
CHANGED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { ref as C, computed as i, defineComponent as le, mergeModels as te, useModel as ae, watch as U, resolveComponent as x, openBlock as d, createElementBlock as y, createElementVNode as k, createVNode as m, withCtx as z, normalizeClass as ne, toDisplayString as re, createCommentVNode as $, withModifiers as j, unref as p, isRef as ue, Fragment as I, renderList as K, createBlock as P, renderSlot as oe, nextTick as se } from "vue";
|
|
2
|
-
import { t as ie, u as ce, a as de, O as N, b as ve } from "./app-bab0f0ed.js";
|
|
3
|
-
import "@feedmepos/ui-library";
|
|
4
|
-
import "pinia";
|
|
5
|
-
import "vue-router";
|
|
6
|
-
function fe(g, t) {
|
|
7
|
-
const u = C(!0), a = i(() => {
|
|
8
|
-
var o, n;
|
|
9
|
-
return !u.value && (!t.value || ((o = t.value) == null ? void 0 : o.length) === ((n = g.value) == null ? void 0 : n.length));
|
|
10
|
-
}), b = i(() => {
|
|
11
|
-
var o, n, h, v;
|
|
12
|
-
return !!((o = t.value) != null && o.length && ((n = t.value) == null ? void 0 : n.length) > 0 && ((h = t.value) == null ? void 0 : h.length) < ((v = g.value) == null ? void 0 : v.length));
|
|
13
|
-
});
|
|
14
|
-
return { allCleared: u, allSelected: a, indeterminate: b, toggleAll: () => {
|
|
15
|
-
t.value = void 0, u.value = !u.value;
|
|
16
|
-
}, toggleOption: (o) => {
|
|
17
|
-
var h, v, S;
|
|
18
|
-
let n;
|
|
19
|
-
t.value === void 0 && u.value ? n = [o] : t.value === void 0 && !u.value ? n = (h = g.value.map((f) => f.value)) == null ? void 0 : h.filter((f) => f !== o) : (v = t.value) != null && v.includes(o) ? n = (S = t.value) == null ? void 0 : S.filter((f) => f !== o) : n = [...t.value || [], o], n.length === 0 ? (t.value = void 0, u.value = !0) : n.length === g.value.length ? (t.value = void 0, u.value = !1) : t.value = n;
|
|
20
|
-
} };
|
|
21
|
-
}
|
|
22
|
-
const me = { class: "w-full flex flex-col gap-8" }, pe = { class: "flex items-center gap-8" }, ge = { class: "inline-flex items-center" }, be = { class: "flex flex-col w-[360px] min-h-0 gap-8" }, he = { class: "flex gap-4 px-[6px]" }, ye = { class: "flex-1" }, _e = { class: "flex-1 overflow-y-auto min-h-0" }, ke = { key: 0 }, Ve = /* @__PURE__ */ le({
|
|
23
|
-
__name: "RestaurantSelector",
|
|
24
|
-
props: /* @__PURE__ */ te({
|
|
25
|
-
multiple: { type: Boolean, default: !1 },
|
|
26
|
-
excludeRestaurants: {},
|
|
27
|
-
managableOnly: { type: Boolean, default: !0 },
|
|
28
|
-
disabled: { type: Boolean, default: !1 },
|
|
29
|
-
variant: { default: "default" },
|
|
30
|
-
autoSelectFirst: { type: Boolean, default: !1 }
|
|
31
|
-
}, {
|
|
32
|
-
modelValue: {},
|
|
33
|
-
modelModifiers: {}
|
|
34
|
-
}),
|
|
35
|
-
emits: ["update:modelValue"],
|
|
36
|
-
setup(g) {
|
|
37
|
-
const t = g, { t: u } = ie(), a = ae(g, "modelValue"), { restaurants: b, restaurantAttributeSettings: O } = ce();
|
|
38
|
-
function Q(e) {
|
|
39
|
-
const l = b.value.map((_) => {
|
|
40
|
-
var A;
|
|
41
|
-
return (A = _.customAttributes) == null ? void 0 : A[e];
|
|
42
|
-
}).filter((_) => typeof _ == "string" && !!_);
|
|
43
|
-
return [...new Set(l)];
|
|
44
|
-
}
|
|
45
|
-
const o = i(() => O.value.map((e) => {
|
|
46
|
-
const l = Q(e.key);
|
|
47
|
-
return {
|
|
48
|
-
...e,
|
|
49
|
-
values: l
|
|
50
|
-
};
|
|
51
|
-
})), { searchKey: n, filter: h } = de(), v = C(null);
|
|
52
|
-
function S(e) {
|
|
53
|
-
var l;
|
|
54
|
-
if (t.multiple)
|
|
55
|
-
throw new Error("Single selection is not supported for multiple selection");
|
|
56
|
-
a.value = e, (l = v.value) == null || l.toggleMenu(!1);
|
|
57
|
-
}
|
|
58
|
-
const f = (e) => {
|
|
59
|
-
const { name: l, code: r } = e.profile;
|
|
60
|
-
return {
|
|
61
|
-
label: `${l} (${r ?? "--"})`,
|
|
62
|
-
value: e._id
|
|
63
|
-
};
|
|
64
|
-
}, E = i(() => b.value.map(f)), w = i(
|
|
65
|
-
() => b.value.filter((e) => t.managableOnly ? e.managable : !0).filter((e) => t.multiple ? !0 : N(e.customAttributes || {}, c.value)).map(f).filter(({ label: e }) => h([e])).filter((e) => {
|
|
66
|
-
var l;
|
|
67
|
-
return !((l = t.excludeRestaurants) != null && l.includes(e.value));
|
|
68
|
-
})
|
|
69
|
-
), T = i(() => {
|
|
70
|
-
var e;
|
|
71
|
-
return a.value ? a.value.length === 1 ? (e = E.value.find((l) => {
|
|
72
|
-
var r;
|
|
73
|
-
return l.value === ((r = a.value) == null ? void 0 : r[0]);
|
|
74
|
-
})) == null ? void 0 : e.label : u("portalshell.components.restaurantSelector.restaurantCount", {
|
|
75
|
-
count: a.value.length
|
|
76
|
-
}) : u("portalshell.components.restaurantSelector.allRestaurants");
|
|
77
|
-
}), W = i(() => {
|
|
78
|
-
var e;
|
|
79
|
-
return a.value ? ((e = E.value.find((l) => l.value === a.value)) == null ? void 0 : e.label) || u("portalshell.components.restaurantSelector.unknownRestaurant") : u("portalshell.components.restaurantSelector.selectRestaurant");
|
|
80
|
-
}), L = i(() => t.multiple ? T.value : W.value), V = i(() => t.disabled ? "neutral-gray-200" : t.variant === "dark" ? "neutral-black" : "neutral-gray-400"), q = i(() => t.disabled ? "text-fm-color-neutral-gray-200" : t.variant === "dark" ? "text-fm-color-neutral-black" : "text-fm-color-neutral-gray-400"), { allSelected: D, toggleAll: G, toggleOption: H, indeterminate: J } = fe(
|
|
81
|
-
w,
|
|
82
|
-
a
|
|
83
|
-
), F = C(!1), X = i(() => O.value.length > 0), R = C(null);
|
|
84
|
-
async function Y() {
|
|
85
|
-
t.disabled || (F.value ? F.value = !1 : (F.value = !0, await se(), R.value && R.value.toggleProperty(!0)));
|
|
86
|
-
}
|
|
87
|
-
const c = C((() => ({
|
|
88
|
-
logic: "AND",
|
|
89
|
-
rules: []
|
|
90
|
-
}))()), Z = i(() => {
|
|
91
|
-
var e, l;
|
|
92
|
-
return ((l = (e = c.value) == null ? void 0 : e.rules) == null ? void 0 : l.length) || 0;
|
|
93
|
-
});
|
|
94
|
-
return U(
|
|
95
|
-
c,
|
|
96
|
-
() => {
|
|
97
|
-
var e;
|
|
98
|
-
if (t.multiple) {
|
|
99
|
-
if (!c.value || c.value.rules.length === 0) {
|
|
100
|
-
a.value = null;
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const l = b.value.filter((r) => N(r.customAttributes || {}, c.value));
|
|
104
|
-
a.value = l.map((r) => r._id);
|
|
105
|
-
} else {
|
|
106
|
-
const l = b.value.filter((r) => N(r.customAttributes || {}, c.value));
|
|
107
|
-
l.length === 0 ? a.value = null : a.value = (e = l[0]) == null ? void 0 : e._id;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
deep: !0
|
|
112
|
-
}
|
|
113
|
-
), U(
|
|
114
|
-
[() => t.autoSelectFirst, w],
|
|
115
|
-
([e, l]) => {
|
|
116
|
-
e && l.length > 0 && !a.value && (a.value = l[0].value);
|
|
117
|
-
},
|
|
118
|
-
{ immediate: !0 }
|
|
119
|
-
), (e, l) => {
|
|
120
|
-
const r = x("FmIcon"), _ = x("FmChip"), A = x("FmSearch"), M = x("FmMenuItem"), ee = x("FmMenu");
|
|
121
|
-
return d(), y("div", me, [
|
|
122
|
-
k("div", pe, [
|
|
123
|
-
m(ee, {
|
|
124
|
-
"close-on-click": !1,
|
|
125
|
-
disabled: t.disabled,
|
|
126
|
-
ref_key: "menuRef",
|
|
127
|
-
ref: v,
|
|
128
|
-
"z-index": 50,
|
|
129
|
-
"selector-for-dismiss-away-event-exclusion": ".fm-dialog, .fm-select__menu__wrapper"
|
|
130
|
-
}, {
|
|
131
|
-
"menu-button": z(() => [
|
|
132
|
-
k("div", ge, [
|
|
133
|
-
m(_, {
|
|
134
|
-
disabled: t.disabled
|
|
135
|
-
}, {
|
|
136
|
-
default: z(() => [
|
|
137
|
-
m(r, {
|
|
138
|
-
color: V.value,
|
|
139
|
-
name: "storefront",
|
|
140
|
-
outline: "",
|
|
141
|
-
size: "sm"
|
|
142
|
-
}, null, 8, ["color"]),
|
|
143
|
-
L.value ? (d(), y("div", {
|
|
144
|
-
key: 0,
|
|
145
|
-
class: ne([
|
|
146
|
-
"fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
|
|
147
|
-
q.value
|
|
148
|
-
])
|
|
149
|
-
}, re(L.value), 3)) : $("", !0),
|
|
150
|
-
m(r, {
|
|
151
|
-
color: V.value,
|
|
152
|
-
name: "keyboard_arrow_down",
|
|
153
|
-
size: "sm"
|
|
154
|
-
}, null, 8, ["color"]),
|
|
155
|
-
X.value ? (d(), y("div", {
|
|
156
|
-
key: 1,
|
|
157
|
-
class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
|
|
158
|
-
onClick: j(Y, ["stop"])
|
|
159
|
-
}, [
|
|
160
|
-
m(r, {
|
|
161
|
-
name: "filter_alt",
|
|
162
|
-
size: "sm",
|
|
163
|
-
outline: Z.value === 0,
|
|
164
|
-
color: V.value,
|
|
165
|
-
onClick: l[0] || (l[0] = j(() => {
|
|
166
|
-
}, ["prevent"]))
|
|
167
|
-
}, null, 8, ["outline", "color"])
|
|
168
|
-
])) : $("", !0)
|
|
169
|
-
]),
|
|
170
|
-
_: 1
|
|
171
|
-
}, 8, ["disabled"])
|
|
172
|
-
])
|
|
173
|
-
]),
|
|
174
|
-
default: z(() => [
|
|
175
|
-
k("div", be, [
|
|
176
|
-
k("div", he, [
|
|
177
|
-
k("div", ye, [
|
|
178
|
-
m(A, {
|
|
179
|
-
modelValue: p(n),
|
|
180
|
-
"onUpdate:modelValue": l[1] || (l[1] = (s) => ue(n) ? n.value = s : null),
|
|
181
|
-
placeholder: p(u)("common.search")
|
|
182
|
-
}, null, 8, ["modelValue", "placeholder"])
|
|
183
|
-
])
|
|
184
|
-
]),
|
|
185
|
-
k("div", _e, [
|
|
186
|
-
e.multiple ? (d(), y(I, { key: 0 }, [
|
|
187
|
-
m(M, {
|
|
188
|
-
label: "All",
|
|
189
|
-
"has-checkbox": "",
|
|
190
|
-
"model-value": p(D),
|
|
191
|
-
indeterminate: p(J),
|
|
192
|
-
onClick: p(G)
|
|
193
|
-
}, null, 8, ["model-value", "indeterminate", "onClick"]),
|
|
194
|
-
(d(!0), y(I, null, K(w.value, (s) => {
|
|
195
|
-
var B;
|
|
196
|
-
return d(), P(M, {
|
|
197
|
-
key: s.value,
|
|
198
|
-
label: s.label,
|
|
199
|
-
"has-checkbox": "",
|
|
200
|
-
"model-value": p(D) || ((B = a.value) == null ? void 0 : B.includes(s.value)),
|
|
201
|
-
onClick: (Ce) => p(H)(s.value)
|
|
202
|
-
}, null, 8, ["label", "model-value", "onClick"]);
|
|
203
|
-
}), 128))
|
|
204
|
-
], 64)) : (d(!0), y(I, { key: 1 }, K(w.value, (s) => (d(), P(M, {
|
|
205
|
-
key: s.value,
|
|
206
|
-
label: s.label,
|
|
207
|
-
onClick: (B) => S(s.value)
|
|
208
|
-
}, null, 8, ["label", "onClick"]))), 128))
|
|
209
|
-
])
|
|
210
|
-
])
|
|
211
|
-
]),
|
|
212
|
-
_: 1
|
|
213
|
-
}, 8, ["disabled"]),
|
|
214
|
-
oe(e.$slots, "append-right")
|
|
215
|
-
]),
|
|
216
|
-
F.value ? (d(), y("div", ke, [
|
|
217
|
-
m(p(ve), {
|
|
218
|
-
ref_key: "filterRef",
|
|
219
|
-
ref: R,
|
|
220
|
-
attributes: o.value,
|
|
221
|
-
modelValue: c.value,
|
|
222
|
-
"onUpdate:modelValue": l[2] || (l[2] = (s) => c.value = s)
|
|
223
|
-
}, null, 8, ["attributes", "modelValue"])
|
|
224
|
-
])) : $("", !0)
|
|
225
|
-
]);
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
export {
|
|
230
|
-
Ve as default
|
|
231
|
-
};
|