@feedmepos/mf-common 1.29.23 → 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.
- package/dist/{CustomAttributesForm-34cb2e10.js → CustomAttributesForm-97319d56.js} +1 -1
- package/dist/ItemSelector-eefda1b9.js +51528 -0
- package/dist/RestaurantSelector-1352748c.js +254 -0
- package/dist/api/index.d.ts +9 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/{app-5956b5d6.js → app-594ba388.js} +6488 -6446
- package/dist/app.js +9 -9
- package/dist/components/DebugUserDialog.vue.d.ts.map +1 -1
- package/dist/components/MyBusinessDialog.vue.d.ts.map +1 -1
- package/dist/components/Portal/PortalDesktop.vue.d.ts.map +1 -1
- package/dist/components/RestaurantSelector.vue.d.ts +5 -0
- package/dist/components/RestaurantSelector.vue.d.ts.map +1 -1
- package/dist/components.d.ts +5 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/composables/usePaginatedBusinesses.d.ts +6 -0
- package/dist/composables/usePaginatedBusinesses.d.ts.map +1 -1
- package/dist/store.d.ts +81 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/ItemSelector-f6a5b9a3.js +0 -25356
- package/dist/RestaurantSelector-0a3d3f18.js +0 -244
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { ref as S, 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-5956b5d6.js";
|
|
3
|
-
import "@feedmepos/ui-library";
|
|
4
|
-
import "pinia";
|
|
5
|
-
import "vue-router";
|
|
6
|
-
function pe(f, t, c = f) {
|
|
7
|
-
const a = S(!0), v = o(() => {
|
|
8
|
-
if (!a.value && !t.value)
|
|
9
|
-
return !0;
|
|
10
|
-
if (t.value && t.value.length > 0) {
|
|
11
|
-
const u = new Set(c.value.map((n) => n.value));
|
|
12
|
-
return t.value.length === c.value.length && t.value.every((n) => u.has(n));
|
|
13
|
-
}
|
|
14
|
-
return !1;
|
|
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));
|
|
18
|
-
});
|
|
19
|
-
return { allCleared: a, allSelected: v, indeterminate: x, toggleAll: () => {
|
|
20
|
-
if (v.value) {
|
|
21
|
-
t.value = void 0, a.value = !0;
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const u = c.value.map((n) => n.value);
|
|
25
|
-
u.length === f.value.length ? (t.value = void 0, a.value = !1) : (t.value = u, a.value = !1);
|
|
26
|
-
}, toggleOption: (u) => {
|
|
27
|
-
var h, m, w;
|
|
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 = (w = t.value) == null ? void 0 : w.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
|
-
} };
|
|
31
|
-
}
|
|
32
|
-
const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-center gap-8" }, be = { class: "inline-flex items-center" }, 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" }, Se = { key: 0 }, Me = /* @__PURE__ */ ae({
|
|
33
|
-
__name: "RestaurantSelector",
|
|
34
|
-
props: /* @__PURE__ */ ne({
|
|
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 t = f, { t: c } = ve(), a = ue(f, "modelValue"), { restaurants: v, restaurantAttributeSettings: x } = de(), R = o(() => v.value.length === 0);
|
|
48
|
-
function P(e) {
|
|
49
|
-
const l = v.value.map((_) => {
|
|
50
|
-
var A;
|
|
51
|
-
return (A = _.customAttributes) == null ? void 0 : A[e];
|
|
52
|
-
}).filter((_) => typeof _ == "string" && !!_);
|
|
53
|
-
return [...new Set(l)];
|
|
54
|
-
}
|
|
55
|
-
const u = o(() => x.value.map((e) => {
|
|
56
|
-
const l = P(e.key);
|
|
57
|
-
return {
|
|
58
|
-
...e,
|
|
59
|
-
values: l
|
|
60
|
-
};
|
|
61
|
-
})), { searchKey: n, filter: h } = fe(), m = S(null);
|
|
62
|
-
function w(e) {
|
|
63
|
-
var l;
|
|
64
|
-
if (t.multiple)
|
|
65
|
-
throw new Error("Single selection is not supported for multiple selection");
|
|
66
|
-
a.value = e, (l = m.value) == null || l.toggleMenu(!1);
|
|
67
|
-
}
|
|
68
|
-
const p = (e) => {
|
|
69
|
-
const { name: l, code: r } = e.profile;
|
|
70
|
-
return {
|
|
71
|
-
label: `${l} (${r ?? "--"})`,
|
|
72
|
-
value: e._id
|
|
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) => {
|
|
76
|
-
var l;
|
|
77
|
-
return !((l = t.excludeRestaurants) != null && l.includes(e.value));
|
|
78
|
-
})
|
|
79
|
-
), W = o(() => {
|
|
80
|
-
var e;
|
|
81
|
-
return a.value ? a.value.length === 1 ? (e = M.value.find((l) => {
|
|
82
|
-
var r;
|
|
83
|
-
return l.value === ((r = a.value) == null ? void 0 : r[0]);
|
|
84
|
-
})) == null ? void 0 : e.label : c("portalshell.components.restaurantSelector.restaurantCount", {
|
|
85
|
-
count: a.value.length
|
|
86
|
-
}) : c("portalshell.components.restaurantSelector.allRestaurants");
|
|
87
|
-
}), q = o(() => {
|
|
88
|
-
var e;
|
|
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(
|
|
91
|
-
M,
|
|
92
|
-
a,
|
|
93
|
-
F
|
|
94
|
-
), V = S(!1), Y = o(() => x.value.length > 0), z = S(null);
|
|
95
|
-
async function Z() {
|
|
96
|
-
t.disabled || (V.value ? V.value = !1 : (V.value = !0, await ce(), z.value && z.value.toggleProperty(!0)));
|
|
97
|
-
}
|
|
98
|
-
const d = S((() => ({
|
|
99
|
-
logic: "AND",
|
|
100
|
-
rules: []
|
|
101
|
-
}))()), ee = o(() => {
|
|
102
|
-
var e, l;
|
|
103
|
-
return ((l = (e = d.value) == null ? void 0 : e.rules) == null ? void 0 : l.length) || 0;
|
|
104
|
-
});
|
|
105
|
-
return j(
|
|
106
|
-
d,
|
|
107
|
-
() => {
|
|
108
|
-
var e;
|
|
109
|
-
if (t.multiple) {
|
|
110
|
-
if (!d.value || d.value.rules.length === 0) {
|
|
111
|
-
a.value = null;
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const l = v.value.filter((r) => E(r.customAttributes || {}, d.value));
|
|
115
|
-
a.value = l.map((r) => r._id);
|
|
116
|
-
} else {
|
|
117
|
-
const l = v.value.filter((r) => E(r.customAttributes || {}, d.value));
|
|
118
|
-
l.length === 0 ? a.value = null : a.value = (e = l[0]) == null ? void 0 : e._id;
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
deep: !0
|
|
123
|
-
}
|
|
124
|
-
), j(
|
|
125
|
-
[() => t.autoSelectFirst, F],
|
|
126
|
-
([e, l]) => {
|
|
127
|
-
e && l.length > 0 && !a.value && (a.value = l[0].value);
|
|
128
|
-
},
|
|
129
|
-
{ immediate: !0 }
|
|
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, {
|
|
135
|
-
"close-on-click": !1,
|
|
136
|
-
disabled: e.disabled || R.value,
|
|
137
|
-
ref_key: "menuRef",
|
|
138
|
-
ref: m,
|
|
139
|
-
"z-index": 50,
|
|
140
|
-
"selector-for-dismiss-away-event-exclusion": ".fm-dialog, .fm-select__menu__wrapper"
|
|
141
|
-
}, {
|
|
142
|
-
"menu-button": L(() => [
|
|
143
|
-
C("div", be, [
|
|
144
|
-
y(A, { disabled: e.disabled }, {
|
|
145
|
-
default: L(() => [
|
|
146
|
-
y(r, {
|
|
147
|
-
color: B.value,
|
|
148
|
-
name: "storefront",
|
|
149
|
-
outline: "",
|
|
150
|
-
size: "sm"
|
|
151
|
-
}, null, 8, ["color"]),
|
|
152
|
-
D.value ? (i(), b("div", {
|
|
153
|
-
key: 0,
|
|
154
|
-
class: re([
|
|
155
|
-
"fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
|
|
156
|
-
G.value
|
|
157
|
-
])
|
|
158
|
-
}, oe(D.value), 3)) : N("", !0),
|
|
159
|
-
R.value ? (i(), O(_, {
|
|
160
|
-
key: 1,
|
|
161
|
-
size: "md"
|
|
162
|
-
})) : (i(), O(r, {
|
|
163
|
-
key: 2,
|
|
164
|
-
color: B.value,
|
|
165
|
-
name: "keyboard_arrow_down",
|
|
166
|
-
size: "sm"
|
|
167
|
-
}, null, 8, ["color"])),
|
|
168
|
-
Y.value ? (i(), b("div", {
|
|
169
|
-
key: 3,
|
|
170
|
-
class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
|
|
171
|
-
onClick: K(Z, ["stop"])
|
|
172
|
-
}, [
|
|
173
|
-
y(r, {
|
|
174
|
-
name: "filter_alt",
|
|
175
|
-
size: "sm",
|
|
176
|
-
outline: ee.value === 0,
|
|
177
|
-
color: B.value,
|
|
178
|
-
onClick: l[0] || (l[0] = K(() => {
|
|
179
|
-
}, ["prevent"]))
|
|
180
|
-
}, null, 8, ["outline", "color"])
|
|
181
|
-
])) : N("", !0)
|
|
182
|
-
]),
|
|
183
|
-
_: 1
|
|
184
|
-
}, 8, ["disabled"])
|
|
185
|
-
])
|
|
186
|
-
]),
|
|
187
|
-
default: L(() => [
|
|
188
|
-
C("div", ye, [
|
|
189
|
-
C("div", _e, [
|
|
190
|
-
C("div", ke, [
|
|
191
|
-
y(le, {
|
|
192
|
-
modelValue: g(n),
|
|
193
|
-
"onUpdate:modelValue": l[1] || (l[1] = (s) => se(n) ? n.value = s : null),
|
|
194
|
-
placeholder: g(c)("common.search")
|
|
195
|
-
}, null, 8, ["modelValue", "placeholder"])
|
|
196
|
-
])
|
|
197
|
-
]),
|
|
198
|
-
C("div", Ce, [
|
|
199
|
-
e.multiple ? (i(), b(Q, { key: 0 }, [
|
|
200
|
-
y($, {
|
|
201
|
-
label: "All",
|
|
202
|
-
"has-checkbox": "",
|
|
203
|
-
"model-value": g(U),
|
|
204
|
-
indeterminate: g(X),
|
|
205
|
-
onClick: g(H)
|
|
206
|
-
}, null, 8, ["model-value", "indeterminate", "onClick"]),
|
|
207
|
-
(i(!0), b(Q, null, T(F.value, (s) => {
|
|
208
|
-
var I;
|
|
209
|
-
return i(), O($, {
|
|
210
|
-
key: s.value,
|
|
211
|
-
label: s.label,
|
|
212
|
-
"has-checkbox": "",
|
|
213
|
-
"model-value": g(U) || ((I = a.value) == null ? void 0 : I.includes(s.value)),
|
|
214
|
-
onClick: (we) => g(J)(s.value)
|
|
215
|
-
}, null, 8, ["label", "model-value", "onClick"]);
|
|
216
|
-
}), 128))
|
|
217
|
-
], 64)) : (i(!0), b(Q, { key: 1 }, T(F.value, (s) => (i(), O($, {
|
|
218
|
-
key: s.value,
|
|
219
|
-
label: s.label,
|
|
220
|
-
onClick: (I) => w(s.value)
|
|
221
|
-
}, null, 8, ["label", "onClick"]))), 128))
|
|
222
|
-
])
|
|
223
|
-
])
|
|
224
|
-
]),
|
|
225
|
-
_: 1
|
|
226
|
-
}, 8, ["disabled"]),
|
|
227
|
-
ie(e.$slots, "append-right")
|
|
228
|
-
]),
|
|
229
|
-
V.value ? (i(), b("div", Se, [
|
|
230
|
-
y(g(me), {
|
|
231
|
-
ref_key: "filterRef",
|
|
232
|
-
ref: z,
|
|
233
|
-
attributes: u.value,
|
|
234
|
-
modelValue: d.value,
|
|
235
|
-
"onUpdate:modelValue": l[2] || (l[2] = (s) => d.value = s)
|
|
236
|
-
}, null, 8, ["attributes", "modelValue"])
|
|
237
|
-
])) : N("", !0)
|
|
238
|
-
]);
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
export {
|
|
243
|
-
Me as default
|
|
244
|
-
};
|