@feedmepos/mf-common 1.27.4 → 1.27.6
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-05d5b316.js} +1 -1
- package/dist/ItemSelector-b13afc4e.js +49466 -0
- package/dist/RestaurantSelector-571a07f4.js +242 -0
- package/dist/{app-bab0f0ed.js → app-f8b2e389.js} +188 -42
- package/dist/app.js +26 -25
- 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/dist/permission/permission.d.ts +7 -1
- package/dist/permission/permission.d.ts.map +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/ItemSelector-7af4226f.js +0 -25170
- package/dist/RestaurantSelector-c9dc3511.js +0 -231
|
@@ -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
|
-
};
|