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