@feedmepos/mf-common 1.26.8 → 1.26.10
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-6ed5a586.js +102 -0
- package/dist/{ItemSelector-cc1896b7.js → ItemSelector-857bb5e5.js} +460 -471
- package/dist/RestaurantSelector-05e5e2d8.js +226 -0
- package/dist/{app-2d272ee9.js → app-bac1d13e.js} +16011 -15723
- 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/composables/usePaginatedBusinesses.d.ts +2 -0
- package/dist/composables/usePaginatedBusinesses.d.ts.map +1 -1
- package/dist/i18n.d.ts +13 -0
- package/dist/i18n.d.ts.map +1 -1
- package/dist/locales/th-TH.json +2 -2
- package/dist/store.d.ts +96 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/vite-preset.d.ts.map +1 -1
- package/dist/vite-preset.js +2 -2
- package/package.json +9 -9
- package/dist/CustomAttributesForm-5b6d4433.js +0 -96
- package/dist/RestaurantSelector-84c538d3.js +0 -218
@@ -0,0 +1,102 @@
|
|
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-bac1d13e.js";
|
3
|
+
import { components as y } from "@feedmepos/ui-library";
|
4
|
+
import { c as x } from "./object-27ce045b.js";
|
5
|
+
import "pinia";
|
6
|
+
import "vue-router";
|
7
|
+
const B = { key: 0 }, T = {
|
8
|
+
key: 1,
|
9
|
+
class: "text-fm-color-neutral-gray-500"
|
10
|
+
}, D = /* @__PURE__ */ A({
|
11
|
+
__name: "CustomAttributesForm",
|
12
|
+
props: {
|
13
|
+
entity: {},
|
14
|
+
modelValue: {},
|
15
|
+
valueOptions: {}
|
16
|
+
},
|
17
|
+
emits: ["update:modelValue"],
|
18
|
+
setup(g, { emit: v }) {
|
19
|
+
const l = g, k = v, { t: a } = w(), m = O();
|
20
|
+
function V(t) {
|
21
|
+
var e;
|
22
|
+
if ((e = l.valueOptions) != null && e[t] && l.valueOptions[t].length > 0)
|
23
|
+
return l.valueOptions[t];
|
24
|
+
if (l.entity === "restaurant") {
|
25
|
+
const r = m.restaurants.value.map((n) => {
|
26
|
+
var o;
|
27
|
+
return (o = n.customAttributes) == null ? void 0 : o[t];
|
28
|
+
}).filter((n) => typeof n == "string" && !!n), s = [...new Set(r)];
|
29
|
+
return s.length > 0 ? s : void 0;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
const c = d(() => {
|
33
|
+
var t, e;
|
34
|
+
return ((e = (t = m.currentBusiness.value) == null ? void 0 : t.attributeSettings) == null ? void 0 : e.filter(
|
35
|
+
(r) => r.entity === l.entity
|
36
|
+
)) || [];
|
37
|
+
}), i = d(() => c.value.map((t) => {
|
38
|
+
var r;
|
39
|
+
const e = V(t.key);
|
40
|
+
return {
|
41
|
+
key: t.key,
|
42
|
+
type: t.type,
|
43
|
+
value: ((r = l.modelValue) == null ? void 0 : r[t.key]) || "",
|
44
|
+
options: e
|
45
|
+
};
|
46
|
+
}) || []), _ = [
|
47
|
+
{
|
48
|
+
header: () => a("portalshell.customAttributes.form.key"),
|
49
|
+
accessorKey: "key",
|
50
|
+
enableSorting: !1
|
51
|
+
},
|
52
|
+
{
|
53
|
+
header: () => a("portalshell.customAttributes.form.value"),
|
54
|
+
accessorKey: "value",
|
55
|
+
enableSorting: !1,
|
56
|
+
cell: (t) => {
|
57
|
+
var n;
|
58
|
+
const e = t.row.original, r = (o) => {
|
59
|
+
const u = x(l.modelValue);
|
60
|
+
if (u[e.key] = typeof o == "string" ? o.trim() : o, e.type === "number") {
|
61
|
+
if (isNaN(Number(o)))
|
62
|
+
return;
|
63
|
+
u[e.key] = Number(o);
|
64
|
+
}
|
65
|
+
Object.keys(u).forEach((p) => {
|
66
|
+
u[p] || delete u[p];
|
67
|
+
}), k("update:modelValue", u);
|
68
|
+
}, s = ((n = c.value.find((o) => o.key === e.key)) == null ? void 0 : n.options) || [];
|
69
|
+
return s != null && s.length ? h(y.FmSelect, {
|
70
|
+
modelValue: e.value,
|
71
|
+
placeholder: a("portalshell.customAttributes.form.valuePlaceholder"),
|
72
|
+
items: s.map((o) => ({ label: o, value: o })),
|
73
|
+
"onUpdate:modelValue": r
|
74
|
+
}) : h(y.FmTextField, {
|
75
|
+
modelValue: e.value,
|
76
|
+
placeholder: a("portalshell.customAttributes.form.valuePlaceholder"),
|
77
|
+
datalist: e.options,
|
78
|
+
rules: [
|
79
|
+
(o) => e.type === "number" && isNaN(Number(o)) ? a("portalshell.customAttributes.form.attributeValueMustBeNumber") : !0
|
80
|
+
],
|
81
|
+
"onUpdate:modelValue": r
|
82
|
+
});
|
83
|
+
}
|
84
|
+
}
|
85
|
+
];
|
86
|
+
return (t, e) => {
|
87
|
+
const r = N("FmTable");
|
88
|
+
return i.value.length > 0 ? (f(), b("div", B, [
|
89
|
+
S(r, {
|
90
|
+
"column-defs": _,
|
91
|
+
"row-data": i.value,
|
92
|
+
"shrink-at": !1,
|
93
|
+
"page-size": i.value.length,
|
94
|
+
"hide-footer": ""
|
95
|
+
}, null, 8, ["row-data", "page-size"])
|
96
|
+
])) : (f(), b("p", T, C(F(a)("portalshell.customAttributes.form.noCustomAttributes")), 1));
|
97
|
+
};
|
98
|
+
}
|
99
|
+
});
|
100
|
+
export {
|
101
|
+
D as default
|
102
|
+
};
|