@feedmepos/mf-payment 0.0.0-beta.37 → 0.0.0-beta.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,167 @@
1
+ import { defineComponent as U, ref as r, resolveComponent as v, openBlock as w, createBlock as M, withCtx as z, createVNode as m, createElementVNode as u, normalizeStyle as T, createElementBlock as I, Fragment as $, renderList as j, computed as C, watch as L, onMounted as E, unref as P, toDisplayString as D, normalizeClass as O } from "vue";
2
+ import { u as R } from "./index-Cnxt2xmc.js";
3
+ import "@feedmepos/ui-library";
4
+ const G = ["id"], S = /* @__PURE__ */ U({
5
+ __name: "FmTableSelection",
6
+ props: {
7
+ value: {},
8
+ items: {}
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(p, { emit: F }) {
12
+ const h = F, f = p, i = r(!1);
13
+ return (g, y) => {
14
+ const k = v("FmButton"), V = v("FmMenuItem"), x = v("FmMenu");
15
+ return w(), M(x, {
16
+ "max-height": 264,
17
+ shift: "",
18
+ onMenuChanged: y[0] || (y[0] = (a) => i.value = a)
19
+ }, {
20
+ "menu-button": z(() => {
21
+ var a;
22
+ return [
23
+ m(k, {
24
+ icon: i.value ? "expand_less" : "expand_more",
25
+ label: (a = g.items.find((o) => o.value === f.value)) == null ? void 0 : a.label,
26
+ "icon-position": "append",
27
+ size: "md",
28
+ variant: "tertiary"
29
+ }, null, 8, ["icon", "label"])
30
+ ];
31
+ }),
32
+ "menu-wrapper": z(({ maxHeight: a }) => [
33
+ u("div", {
34
+ id: `menu-wrapper-${a}`,
35
+ style: T({ maxHeight: `${a}px` }),
36
+ class: "bg-fm-color-neutral-white flex flex-col overflow-y-auto px-4 py-12 rounded-md shadow-light-300 w-[75px]"
37
+ }, [
38
+ (w(!0), I($, null, j(g.items, (o) => (w(), M(V, {
39
+ key: o.value,
40
+ label: o.label,
41
+ value: o.value,
42
+ "model-value": o.value === f.value,
43
+ "onUpdate:modelValue": (n) => h("update:modelValue", o.value)
44
+ }, null, 8, ["label", "value", "model-value", "onUpdate:modelValue"]))), 128))
45
+ ], 12, G)
46
+ ]),
47
+ _: 1
48
+ });
49
+ };
50
+ }
51
+ }), H = { class: "basis-72 bg-white flex items-center justify-between px-24 pt-6" }, J = { class: "flex gap-24 items-center justify-between xs:hidden xs:invisible" }, K = { class: "flex gap-8 items-center" }, Q = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary xs:hidden xs:invisible" }, W = {
52
+ class: /* @__PURE__ */ O(["flex gap-8 items-center"])
53
+ }, X = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary xs:mr-auto" }, Y = { class: "flex gap-8" }, ae = /* @__PURE__ */ U({
54
+ __name: "index",
55
+ props: {
56
+ columnDefs: {
57
+ type: Array,
58
+ required: !0
59
+ },
60
+ rowsDefs: {
61
+ type: Function,
62
+ required: !0
63
+ },
64
+ paginate: {
65
+ type: Function,
66
+ required: !0
67
+ }
68
+ },
69
+ emits: ["row-click"],
70
+ setup(p, { expose: F, emit: h }) {
71
+ const f = [10, 20, 30, 50, 100].map((t) => ({
72
+ label: t.toString(),
73
+ value: t
74
+ })), i = p, g = h, { isLoading: y, startLoading: k, stopLoading: V } = R(!0), x = r(), a = r(), o = r(""), n = r(10), l = r(1), c = r(0), b = async function(t = !1) {
75
+ k(), t && (a.value = [], o.value = "", l.value = 1, c.value = 0);
76
+ const e = await i.paginate(n.value, o.value);
77
+ a.value = [...a.value ?? [], ...e.data], o.value = e.meta.cursor ?? "", c.value += 1, V();
78
+ }, q = C(() => l.value > 1), A = C(() => l.value < c.value ? !0 : o.value > ""), N = C(() => {
79
+ const t = n.value * (l.value - 1), e = t + n.value;
80
+ return (a.value ?? []).slice(t, e).map(i.rowsDefs);
81
+ });
82
+ return L(n, () => b(!0)), L(l, (t) => {
83
+ t > c.value && b();
84
+ }), E(() => b()), F({
85
+ reset: () => b(!0),
86
+ data: () => a.value ?? [],
87
+ allData: async () => {
88
+ let t = [], e = "";
89
+ do {
90
+ const d = await i.paginate(100, e);
91
+ t = [...t, ...d.data], e = d.meta.cursor ?? "";
92
+ } while (e > "");
93
+ return t;
94
+ },
95
+ pageData: () => {
96
+ const t = n.value * (l.value - 1), e = t + n.value;
97
+ return (a.value ?? []).slice(t, e);
98
+ },
99
+ replaceData: (t, e) => {
100
+ const d = t * l.value;
101
+ a.value && (a.value[d] = e);
102
+ }
103
+ }), (t, e) => {
104
+ const d = v("FmTable"), B = v("FmButton");
105
+ return w(), I($, null, [
106
+ m(d, {
107
+ modelValue: x.value,
108
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => x.value = s),
109
+ loading: P(y),
110
+ "page-size": n.value,
111
+ "row-data": N.value,
112
+ "column-defs": p.columnDefs,
113
+ "hide-footer": !0,
114
+ onRowClick: e[1] || (e[1] = (s) => {
115
+ var _;
116
+ return g("row-click", (_ = a.value) == null ? void 0 : _.at(s.index));
117
+ })
118
+ }, null, 8, ["modelValue", "loading", "page-size", "row-data", "column-defs"]),
119
+ u("div", H, [
120
+ u("div", J, [
121
+ u("div", K, [
122
+ e[6] || (e[6] = u("span", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, " Items per page: ", -1)),
123
+ m(S, {
124
+ items: P(f),
125
+ value: n.value,
126
+ "onUpdate:modelValue": e[2] || (e[2] = (s) => n.value = s)
127
+ }, null, 8, ["items", "value"])
128
+ ]),
129
+ u("span", Q, D((l.value - 1) * n.value) + " - " + D((l.value - 1) * n.value + n.value), 1)
130
+ ]),
131
+ u("div", W, [
132
+ m(S, {
133
+ items: Array.from(Array(c.value), (s, _) => _ + 1).map(
134
+ (s) => ({
135
+ label: s.toString(),
136
+ value: s
137
+ })
138
+ ),
139
+ value: l.value,
140
+ "onUpdate:modelValue": e[3] || (e[3] = (s) => l.value = s)
141
+ }, null, 8, ["items", "value"]),
142
+ u("span", X, " Page " + D(l.value), 1),
143
+ u("div", Y, [
144
+ m(B, {
145
+ disabled: !q.value,
146
+ icon: "chevron_left",
147
+ "icon-color": "neutral-black",
148
+ variant: "tertiary",
149
+ onClick: e[4] || (e[4] = () => l.value -= 1)
150
+ }, null, 8, ["disabled"]),
151
+ m(B, {
152
+ disabled: !A.value,
153
+ icon: "chevron_right",
154
+ "icon-color": "neutral-black",
155
+ variant: "tertiary",
156
+ onClick: e[5] || (e[5] = () => l.value += 1)
157
+ }, null, 8, ["disabled"])
158
+ ])
159
+ ])
160
+ ])
161
+ ], 64);
162
+ };
163
+ }
164
+ });
165
+ export {
166
+ ae as _
167
+ };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-payment",
3
- "version": "0.0.0-beta.37",
3
+ "version": "0.0.0-beta.39",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"