@feedmepos/mf-common 1.27.6 → 1.27.7
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-05d5b316.js → CustomAttributesForm-9af4a917.js} +1 -1
- package/dist/{ItemSelector-b13afc4e.js → ItemSelector-7f86b7a1.js} +9418 -9287
- package/dist/RestaurantSelector-1d17c411.js +244 -0
- package/dist/{app-f8b2e389.js → app-d45aa4b4.js} +3 -3
- package/dist/app.js +2 -2
- package/dist/components/RestaurantSelector.vue.d.ts.map +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/RestaurantSelector-571a07f4.js +0 -242
package/package.json
CHANGED
|
@@ -1,242 +0,0 @@
|
|
|
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-f8b2e389.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
|
-
};
|