@feedmepos/mf-inventory-portal 0.0.23-dev.19 → 0.0.23-dev.2

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.
Files changed (95) hide show
  1. package/dist/{App-DY01VbHo.js → App-DRE3c1lJ.js} +31 -36
  2. package/dist/{ApprovalView-DtwXb5T7.js → ApprovalView-B4ZYcS3B.js} +4 -4
  3. package/dist/{BindingsDialog-ClnnwUTV.js → BindingsDialog-Df1yrWHU.js} +2 -2
  4. package/dist/{BindingsPicker-DbdkXiHx.js → BindingsPicker-BERMWh4w.js} +2 -2
  5. package/dist/{BindingsTable-Cqh3Ku0d.js → BindingsTable-DRIapOWW.js} +6 -6
  6. package/dist/{ClosingTemplateView-CVQlOya4.js → ClosingTemplateView-CbFn3Sdy.js} +31 -32
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-7JYNssTm.js +267 -0
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-m92y5x0G.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-KbYSywk2.js} +2 -2
  9. package/dist/{FmMultiselectDialog-Jr9uL_z_.js → FmMultiselectDialog-Da9JMCYa.js} +15 -15
  10. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-BHSGZyJL.js +326 -0
  11. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D7uvrzFU.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DH5IQchQ.js} +1 -1
  12. package/dist/{IngredientGroupView-DgDZnggI.js → IngredientGroupView-DoETcEvV.js} +11 -12
  13. package/dist/IngredientsView-DHAhj9pV.js +1613 -0
  14. package/dist/{IntegrationView-CZQoHCkX.js → IntegrationView-D1HeBiGF.js} +50 -50
  15. package/dist/{InventoryBindingForm-C-E3EINv.js → InventoryBindingForm-Dmz9BQ37.js} +1 -1
  16. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B3nsmCuj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DoyqVBOd.js} +13 -13
  17. package/dist/{InventoryBindingSummary-DNiOKfO8.js → InventoryBindingSummary-DrpwiRGZ.js} +1 -1
  18. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdYa8Pv2.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yNEswIEI.js} +1 -1
  19. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BwxgZ-vM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Br4_VUza.js} +2 -2
  20. package/dist/{PurchaseOrderPrintPreview-C6i2S9L-.js → PurchaseOrderPrintPreview-cp671yWE.js} +1 -1
  21. package/dist/ReceiveRequestView-C1WBlpho.js +4082 -0
  22. package/dist/{RecipeView-CoMcIuHu.js → RecipeView-CD_dAWLo.js} +10 -11
  23. package/dist/{StockView-DhJshtaj.js → StockView-DfUzFC1b.js} +1457 -1356
  24. package/dist/{SupplierView-hQtDIQzE.js → SupplierView-DB-zrNxh.js} +783 -2352
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-2mzqFGCz.js +1144 -0
  26. package/dist/TransferTemplateView-CaAJrqU6.js +1262 -0
  27. package/dist/{UnitView-CRMF6RWu.js → UnitView-BlC9-WOA.js} +80 -81
  28. package/dist/{WarehouseView-AVEDff0v.js → WarehouseView-CgEY87Lo.js} +24 -25
  29. package/dist/api/bill.d.ts +2 -2
  30. package/dist/api/closing.d.ts +0 -1
  31. package/dist/api/netsuite.d.ts +0 -69
  32. package/dist/{app-ww5ibHkL.js → app-CAyFhmAz.js} +3343 -3426
  33. package/dist/app.d.ts +0 -5
  34. package/dist/app.js +1 -1
  35. package/dist/components/FmMinMaxInputRules.d.ts +1 -4
  36. package/dist/components/row-action.enum.d.ts +0 -1
  37. package/dist/{date2-D5MTVjlP.js → date2-D9i5izMt.js} +1 -1
  38. package/dist/{dayjs.min-7pwGJ2aW.js → dayjs.min-SJKP9zBL.js} +17 -17
  39. package/dist/{decimal-N5ymnwhP.js → decimal-D7BCubZO.js} +1 -1
  40. package/dist/{defineDeepModel-DJODEpcR.js → defineDeepModel-DS4Shctf.js} +1 -1
  41. package/dist/{feature-Bfq8yWgS.js → feature-BR-MsGYt.js} +9 -23
  42. package/dist/{format-time-from-id-0UkRUr39.js → format-time-from-id-CUby60uW.js} +1 -1
  43. package/dist/format-unit-display-D25Al2JZ.js +1198 -0
  44. package/dist/{fuzzy-DdOiOd-q.js → fuzzy-BryBtMz_.js} +1 -1
  45. package/dist/{index-Cin_fxtb.js → index-ByJbUSIQ.js} +1 -1
  46. package/dist/index-CFA_VFyX.js +10545 -0
  47. package/dist/{index-gvJJ-xRY.js → index-CTvgBOum.js} +25 -28
  48. package/dist/netsuite-D0G4B60k.js +146 -0
  49. package/dist/normalizeArguments-DP7Hrren.js +1552 -0
  50. package/dist/router/name.d.ts +0 -1
  51. package/dist/{row-action.enum-7rGLGZ5v.js → row-action.enum-PMKMRrZR.js} +5 -10
  52. package/dist/{rules-C83wiSGb.js → rules-DxVY0b7F.js} +35 -40
  53. package/dist/stores/feature.d.ts +0 -2
  54. package/dist/stores/integration/netsuite.d.ts +0 -81
  55. package/dist/stores/inventory.d.ts +4 -1
  56. package/dist/style.css +1 -1
  57. package/dist/{supplier-CSzla-9I.js → supplier-aBuwVukl.js} +22 -22
  58. package/dist/tsconfig.app.tsbuildinfo +1 -1
  59. package/dist/{use-inventory-binding-dialog-BFqxWNzX.js → use-inventory-binding-dialog-CLQ0LUmW.js} +2 -2
  60. package/dist/{use-template-enabled-locations-2-CUkqC-cd.js → use-template-enabled-locations-2-BgTiwy_3.js} +2 -2
  61. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +192 -24
  62. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +192 -24
  63. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +34 -34
  64. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -1
  65. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +54 -54
  66. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +54 -54
  67. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  68. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  69. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  70. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  71. package/dist/{xlsx-C3L2eW52.js → xlsx-BbtURTDy.js} +1 -1
  72. package/dist/{xlsx.util-CJKLCuWK.js → xlsx.util-zYS4OJFi.js} +1 -1
  73. package/package.json +3 -3
  74. package/dist/ClosingDraftView-CzuMTeC1.js +0 -1122
  75. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BO1wCa9i.js +0 -283
  76. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-sgvBxxkn.js +0 -329
  77. package/dist/IngredientsView-SuCckJrj.js +0 -1666
  78. package/dist/ReceiveRequestView-BABjGvIn.js +0 -4195
  79. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DsJUSZsm.js +0 -1235
  80. package/dist/TransferTemplateView-GzwT4hp-.js +0 -1275
  81. package/dist/api/closing-draft.d.ts +0 -6
  82. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  83. package/dist/format-unit-display-CXawcmvj.js +0 -1217
  84. package/dist/index-CcCqc9jx.js +0 -12087
  85. package/dist/netsuite-DX6L1oLu.js +0 -251
  86. package/dist/stock-Btlxmf8R.js +0 -111
  87. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +0 -2
  88. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +0 -22
  89. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +0 -451
  90. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +0 -25
  91. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +0 -2601
  92. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +0 -1
  93. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +0 -19
  94. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +0 -4
  95. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +0 -1
@@ -1,283 +0,0 @@
1
- import { w as V, u as E, I, B as H, D as M } from "./app-ww5ibHkL.js";
2
- import { a as k, t as R } from "./rules-C83wiSGb.js";
3
- import { u as j } from "./supplier-CSzla-9I.js";
4
- import { P as S } from "./format-unit-display-CXawcmvj.js";
5
- import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as U, openBlock as T, createElementBlock as A, normalizeStyle as K, createElementVNode as D, createVNode as Q, withCtx as X, createBlock as w, createCommentVNode as N, Fragment as Y, renderList as Z, unref as x } from "vue";
6
- function z(l, r, e) {
7
- var s;
8
- if (!!r.measurement === !!e && ((s = r.measurement) == null ? void 0 : s.id) === e)
9
- return r;
10
- if (!e)
11
- return {
12
- costPerUnit: r.costPerUnit
13
- };
14
- const o = l.measurements.find((i) => i.id === e);
15
- return o ? {
16
- costPerUnit: r.costPerUnit,
17
- measurement: o
18
- } : {
19
- costPerUnit: r.costPerUnit
20
- };
21
- }
22
- function re(l, r, e, n) {
23
- var b, g, u;
24
- if (n != null && n.manualTotalCost)
25
- return n == null ? void 0 : n.manualTotalCost;
26
- const t = (u = (g = (b = n == null ? void 0 : n.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
27
- (a) => a.skuId === l._id
28
- )) == null ? void 0 : u.defaultCost, o = l.defaultCost ? z(l.unit, l.defaultCost, l.trackingMeasurement) : void 0, s = t ?? o, i = s == null ? void 0 : s.costPerUnit, c = i ? s != null && s.measurement ? +k(i) / +k(s == null ? void 0 : s.measurement.conversion) : +k(i) : void 0, p = c ? e ? c * +k(e.conversion) : c : void 0, f = p ? +k(r) * p : void 0;
29
- return f ? {
30
- ...R(f ?? 0, 2),
31
- currency: V()
32
- } : {
33
- amount: 0,
34
- precision: 0,
35
- currency: V()
36
- };
37
- }
38
- function F(l) {
39
- return H.parse(l);
40
- }
41
- function C(l) {
42
- return {
43
- _id: l.doc._id,
44
- internal: l.type,
45
- contactName: l.doc.profile.name,
46
- name: l.doc.profile.name ?? "",
47
- email: l.doc.profile.email,
48
- phoneNumber: l.doc.profile.phoneNo,
49
- registrationNumber: l.doc.profile.regNo,
50
- address: l.doc.profile.address ?? {
51
- line1: "",
52
- state: "",
53
- city: "",
54
- postcode: "",
55
- country: ""
56
- }
57
- };
58
- }
59
- function ie(l, r, e = !1, n = !1) {
60
- const t = j(), o = E();
61
- o.watchLocation(async () => {
62
- var v;
63
- await t.readSuppliers();
64
- const u = l();
65
- if ((v = u.supplier) != null && v._id) return;
66
- const a = n ? t.suppliers[0] : t.businessSuppliers[0], d = (e ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations)[0];
67
- r({
68
- ...u,
69
- supplier: a ? F(a) : d ? C(d) : u.supplier
70
- });
71
- });
72
- const s = y(
73
- () => {
74
- var u, a;
75
- return typeof ((a = (u = l()) == null ? void 0 : u.supplier) == null ? void 0 : a.internal) == "string" ? S.TRANSFER : S.PURCHASE;
76
- }
77
- ), i = y({
78
- get() {
79
- var u, a;
80
- return (a = (u = l()) == null ? void 0 : u.supplier) == null ? void 0 : a._id;
81
- },
82
- set(u) {
83
- const a = l() ?? {};
84
- if (s.value === S.PURCHASE) {
85
- const _ = (n ? t.suppliers : t.businessSuppliers).find((B) => B._id === u);
86
- r({
87
- ...a,
88
- supplier: _ ? F(_) : a.supplier
89
- });
90
- return;
91
- }
92
- const v = (e ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
93
- r({
94
- ...a,
95
- supplier: v ? C(v) : a.supplier
96
- });
97
- }
98
- }), c = y(() => t.locationSuppliers.map(F)), p = y(() => t.businessSuppliers.map(F)), f = y(() => {
99
- const u = [...c.value], a = [...p.value];
100
- return n ? [...a, ...u] : a;
101
- }), L = y(() => {
102
- var h;
103
- const u = ((h = o._currentLocation) == null ? void 0 : h.type) === I.warehouse;
104
- return (e ? o.locations.filter((d) => d.doc._id !== o.currentLocation.doc._id) : o.locations).filter((d) => u || d.acceptRequest).map(C);
105
- }), b = y(() => {
106
- if (s.value === S.PURCHASE) {
107
- const a = c.value.map((d) => ({
108
- label: d.name,
109
- value: d._id
110
- })), h = p.value.map((d) => ({
111
- label: d.name,
112
- sublabel: "Business supplier",
113
- value: d._id
114
- }));
115
- return n ? [...a, ...h] : h;
116
- }
117
- return L.value.map((a) => ({
118
- label: a.name,
119
- sublabel: a.internal ? `${a.internal}` : void 0,
120
- value: a._id
121
- }));
122
- }), g = y(() => {
123
- var d, v;
124
- const u = (v = (d = l()) == null ? void 0 : d.supplier) == null ? void 0 : v._id;
125
- if (s.value === S.PURCHASE) {
126
- const m = t.suppliers.find((_) => _._id === u);
127
- return m ? F(m) : null;
128
- }
129
- const h = o.locations.find((m) => m.doc._id);
130
- return h ? C(h) : null;
131
- });
132
- return {
133
- transferLocationModel: i,
134
- transferLocationOptions: b,
135
- locationOptionsTypePurchase: f,
136
- locationOptionsTypePurchaseLocationLevel: c,
137
- locationOptionsTypeTransfer: L,
138
- selectedLocation: g
139
- };
140
- }
141
- class O {
142
- static getDescendantProperty(r, e, n = []) {
143
- let t, o, s, i, c, p;
144
- if (e) {
145
- if (s = e.indexOf("."), s === -1 ? t = e : (t = e.slice(0, s), o = e.slice(s + 1)), i = r[t], i !== null && typeof i < "u")
146
- if (!o && (typeof i == "string" || typeof i == "number"))
147
- n.push(i);
148
- else if (Object.prototype.toString.call(i) === "[object Array]")
149
- for (c = 0, p = i.length; c < p; c++)
150
- O.getDescendantProperty(i[c], o, n);
151
- else o && O.getDescendantProperty(i, o, n);
152
- } else
153
- n.push(r);
154
- return n;
155
- }
156
- }
157
- class P {
158
- constructor(r = [], e = [], n = {}) {
159
- Array.isArray(e) || (n = e, e = []), this.haystack = r, this.keys = e, this.options = Object.assign({
160
- caseSensitive: !1,
161
- sort: !1
162
- }, n);
163
- }
164
- search(r = "") {
165
- if (r === "")
166
- return this.haystack;
167
- const e = [];
168
- for (let n = 0; n < this.haystack.length; n++) {
169
- const t = this.haystack[n];
170
- if (this.keys.length === 0) {
171
- const o = P.isMatch(t, r, this.options.caseSensitive);
172
- o && e.push({ item: t, score: o });
173
- } else
174
- for (let o = 0; o < this.keys.length; o++) {
175
- const s = O.getDescendantProperty(t, this.keys[o]);
176
- let i = !1;
177
- for (let c = 0; c < s.length; c++) {
178
- const p = P.isMatch(s[c], r, this.options.caseSensitive);
179
- if (p) {
180
- i = !0, e.push({ item: t, score: p });
181
- break;
182
- }
183
- }
184
- if (i)
185
- break;
186
- }
187
- }
188
- return this.options.sort && e.sort((n, t) => n.score - t.score), e.map((n) => n.item);
189
- }
190
- static isMatch(r, e, n) {
191
- r = String(r), e = String(e), n || (r = r.toLocaleLowerCase(), e = e.toLocaleLowerCase());
192
- const t = P.nearestIndexesFor(r, e);
193
- return t ? r === e ? 1 : t.length > 1 ? 2 + (t[t.length - 1] - t[0]) : 2 + t[0] : !1;
194
- }
195
- static nearestIndexesFor(r, e) {
196
- const n = e.split("");
197
- let t = [];
198
- return P.indexesOfFirstLetter(r, e).forEach((s, i) => {
199
- let c = s + 1;
200
- t[i] = [s];
201
- for (let p = 1; p < n.length; p++) {
202
- const f = n[p];
203
- if (c = r.indexOf(f, c), c === -1) {
204
- t[i] = !1;
205
- break;
206
- }
207
- t[i].push(c), c++;
208
- }
209
- }), t = t.filter((s) => s !== !1), t.length ? t.sort((s, i) => s.length === 1 ? s[0] - i[0] : (s = s[s.length - 1] - s[0], i = i[i.length - 1] - i[0], s - i))[0] : !1;
210
- }
211
- static indexesOfFirstLetter(r, e) {
212
- const n = e[0];
213
- return r.split("").map((t, o) => t !== n ? !1 : o).filter((t) => t !== !1);
214
- }
215
- }
216
- const G = { class: "sticky top-0 bg-white mb-8" }, q = { class: "overflow-y-auto pb-8" }, le = /* @__PURE__ */ $({
217
- __name: "FmFilterableMenuOptions",
218
- props: /* @__PURE__ */ W({
219
- modelValue: {},
220
- maxHeight: {},
221
- width: {},
222
- handleItemChange: { type: Function },
223
- items: {},
224
- options: {}
225
- }, {
226
- search: {},
227
- searchModifiers: {}
228
- }),
229
- emits: ["update:search"],
230
- setup(l) {
231
- const r = l, e = J(l, "search"), n = y(
232
- () => new P(r.items, ["label", "sublabel"], r.options)
233
- ), t = y(() => n.value.search(e.value));
234
- return (o, s) => {
235
- const i = U("FmButton"), c = U("FmTextField"), p = U("FmMenuItem");
236
- return T(), A("div", {
237
- class: "relative",
238
- style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
239
- }, [
240
- D("div", G, [
241
- Q(c, {
242
- modelValue: e.value,
243
- "onUpdate:modelValue": s[1] || (s[1] = (f) => e.value = f),
244
- placeholder: "Filter options"
245
- }, {
246
- append: X(() => [
247
- e.value ? (T(), w(i, {
248
- key: 0,
249
- variant: "tertiary",
250
- "prepend-icon": "close",
251
- onClick: s[0] || (s[0] = (f) => e.value = "")
252
- })) : N("", !0)
253
- ]),
254
- _: 1
255
- }, 8, ["modelValue"])
256
- ]),
257
- D("div", q, [
258
- (T(!0), A(Y, null, Z(t.value, (f, L) => (T(), w(p, {
259
- key: L,
260
- label: f.label,
261
- sublabel: f.sublabel,
262
- "model-value": x(M)(o.modelValue, f.value),
263
- onClick: () => o.handleItemChange(x(M)(o.modelValue, f.value), f),
264
- onVnodeMounted: (b) => {
265
- var g;
266
- return x(M)(o.modelValue, f.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
267
- }
268
- }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
269
- t.value.length ? N("", !0) : (T(), w(p, {
270
- key: 0,
271
- disabled: "",
272
- label: "No options available"
273
- }))
274
- ])
275
- ], 4);
276
- };
277
- }
278
- });
279
- export {
280
- le as _,
281
- re as c,
282
- ie as u
283
- };
@@ -1,329 +0,0 @@
1
- import { defineComponent as oe, mergeModels as O, useModel as se, computed as v, ref as P, watch as z, inject as ie, resolveComponent as b, openBlock as f, createElementBlock as y, createElementVNode as u, createVNode as M, withCtx as h, renderSlot as T, normalizeClass as V, toDisplayString as F, withDirectives as le, vModelText as ae, createCommentVNode as q, createTextVNode as ue, createBlock as W, Fragment as re, renderList as me } from "vue";
2
- import { F as I } from "./index-gvJJ-xRY.js";
3
- import { I as k, g as L, c as ce, a as g, p as de, t as pe, b as fe, m as ve, n as be, u as ye } from "./rules-C83wiSGb.js";
4
- import "@feedmepos/ui-library";
5
- function E() {
6
- return {
7
- amount: I.reset()
8
- };
9
- }
10
- function H() {
11
- return function(d) {
12
- return k()(d.amountAsString);
13
- };
14
- }
15
- function Ve(l) {
16
- return function(t) {
17
- return k()(t.amountAsString) !== !0 ? !0 : +t.amountAsString < l ? `Must be at least ${l}` : !0;
18
- };
19
- }
20
- function Le(l) {
21
- return function(t) {
22
- return k()(t.amountAsString) !== !0 ? !0 : +t.amountAsString > l ? `Must be at most ${l}` : !0;
23
- };
24
- }
25
- function G(l, d = !1) {
26
- return function(r) {
27
- const s = H()(r);
28
- if (s != !0)
29
- return d ? s : !0;
30
- const x = typeof l == "number" ? l : L(l, r.modelValue.measurement);
31
- return ce(+r.amountAsString).precision > x ? `Cannot exceed precision more than ${g({
32
- amount: 1,
33
- precision: x
34
- })}` : !0;
35
- };
36
- }
37
- function $e(l) {
38
- const d = de(l);
39
- return function(r) {
40
- return d(r.modelValue.amount);
41
- };
42
- }
43
- const Me = { class: "flex flex-col" }, ge = { class: "flex flex-col" }, he = { class: "flex-1" }, Fe = { class: "flex items-center gap-4" }, xe = { class: "flex-1 flex gap-4" }, Ae = { class: "shrink-0 grow basis-2/5" }, _e = {
44
- key: 0,
45
- class: "text-fm-color-typo-secondary"
46
- }, Pe = {
47
- key: 0,
48
- class: "line-clamp-1 text-ellipsis break-all"
49
- }, Ie = { class: "flex items-center gap-4" }, ke = { class: "line-clamp-1 text-ellipsis break-all" }, Be = { class: "max-w-[200px] flex flex-col gap-[1px]" }, De = {
50
- key: 1,
51
- class: "flex flex-col gap-4 pl-8 shrink-0"
52
- }, Re = {
53
- class: "flex items-center",
54
- style: { "pointer-events": "none" }
55
- }, Ue = {
56
- class: "flex items-center",
57
- style: { "pointer-events": "none" }
58
- }, je = /* @__PURE__ */ oe({
59
- __name: "FmUnitInput",
60
- props: /* @__PURE__ */ O({
61
- modelValue: {},
62
- unit: {},
63
- rules: {},
64
- zIndex: {},
65
- applyDefaultRules: { type: Boolean },
66
- placement: {},
67
- separator: {},
68
- precision: {},
69
- convertAmountOnChangeUnit: { type: Boolean },
70
- formatMinimumPrecision: {},
71
- disableUnit: { type: Boolean },
72
- stepperOnly: { type: Boolean },
73
- stepper: {},
74
- placeholder: {},
75
- minLength: {},
76
- maxLength: {},
77
- inputmode: {},
78
- type: {},
79
- readonly: { type: Boolean },
80
- labelMark: {},
81
- prependIcon: {},
82
- appendIcon: {},
83
- showValidBorder: { type: Boolean },
84
- labelInfo: {},
85
- showWordCount: { type: Boolean },
86
- invalid: { type: Boolean },
87
- autofocus: { type: Boolean },
88
- formatter: { type: Function },
89
- decimal: {},
90
- datalist: {},
91
- shiftDatalist: { type: Boolean },
92
- datalistMaxHeight: {},
93
- datalistMinHeight: {},
94
- offsetDatalist: {},
95
- datalistPlacement: {},
96
- datalistZIndex: {},
97
- datalistWidth: {},
98
- label: {},
99
- disabled: { type: Boolean },
100
- focused: { type: Boolean },
101
- helperText: {},
102
- helperState: {}
103
- }, {
104
- modelValue: {},
105
- modelModifiers: {}
106
- }),
107
- emits: /* @__PURE__ */ O(["update:amount", "update:measurement"], ["update:modelValue"]),
108
- setup(l, { emit: d }) {
109
- const t = l, r = d, s = se(l, "modelValue"), x = k(), B = v(() => {
110
- var n;
111
- return L(t.unit, (n = s.value) == null ? void 0 : n.measurement);
112
- }), c = P((() => {
113
- var o;
114
- const e = ((o = s.value) == null ? void 0 : o.amount) ?? I.reset(), n = be(e), i = t.formatMinimumPrecision ?? n.precision, a = ye(n, i);
115
- return g(a);
116
- })());
117
- z(c, (e) => {
118
- const n = x(e), i = t.precision ?? B.value, o = typeof t.formatMinimumPrecision == "number" && t.formatMinimumPrecision > i ? t.formatMinimumPrecision : i;
119
- n == !0 && (s.value = {
120
- ...s.value,
121
- amount: pe(+e, o)
122
- }), r("update:amount", e);
123
- });
124
- const J = Symbol.for("fm:form-state"), D = ie(J, null), A = v(() => t.disabled ?? (D == null ? void 0 : D.getDisabled()) ?? !1), K = P(), R = P(!1), $ = P(!1), Q = v(() => R.value || $.value), X = v(() => {
125
- var a;
126
- const i = [...t.unit.measurements.filter((o) => !o.name.toLocaleLowerCase().includes("inactive")).filter((o) => o.abbrev !== t.unit.abbrev || +g(o.conversion) != 1).groupBy(
127
- (o) => `${o.abbrev}${g(o.conversion)}`
128
- ).values()].map((o) => o[0]).flat();
129
- return [
130
- {
131
- label: (a = t.unit) == null ? void 0 : a.abbrev,
132
- value: null
133
- },
134
- ...i.map((o) => ({
135
- label: o.abbrev,
136
- value: o.id
137
- }))
138
- ];
139
- }), U = v({
140
- get() {
141
- var e, n;
142
- return ((n = (e = s.value) == null ? void 0 : e.measurement) == null ? void 0 : n.id) ?? null;
143
- },
144
- set(e) {
145
- if (e == null)
146
- s.value = {
147
- ...s.value ?? E(),
148
- measurement: null
149
- }, r("update:measurement", null);
150
- else {
151
- const n = t.unit.measurements.find((i) => i.id === e) ?? null;
152
- s.value = {
153
- ...s.value ?? E(),
154
- measurement: n
155
- }, r("update:measurement", n);
156
- }
157
- }
158
- });
159
- z(U, (e, n) => {
160
- var m;
161
- if (!t.convertAmountOnChangeUnit)
162
- return;
163
- const i = ((m = s.value) == null ? void 0 : m.amount) ?? I.reset(), a = t.unit.measurements.find((_) => _.id === n) ?? null, o = t.unit.measurements.find((_) => _.id === e) ?? null, p = a ? fe(i, a.conversion) : i, w = o ? ve(p, o.conversion) : p, N = L(t.unit, o), S = I.convertPrecision({
164
- value: w,
165
- precision: N
166
- });
167
- c.value = g(S);
168
- });
169
- const C = v(() => {
170
- var e, n;
171
- return ((n = (e = s.value) == null ? void 0 : e.measurement) == null ? void 0 : n.abbrev) ?? t.unit.abbrev;
172
- }), Y = v(
173
- () => {
174
- var e;
175
- return ((e = t.rules) == null ? void 0 : e.map(
176
- (n) => (i) => typeof n == "function" ? n(i) : n
177
- )) ?? [];
178
- }
179
- ), ee = v(() => [...t.applyDefaultRules ? [
180
- H(),
181
- typeof t.precision == "number" ? G(t.precision) : G(t.unit)
182
- ] : [], ...Y.value]);
183
- function j(e) {
184
- const n = t.precision ?? B.value, a = typeof t.formatMinimumPrecision == "number" && t.formatMinimumPrecision > n ? t.formatMinimumPrecision : n, o = e.toFixed(a), p = o.includes(".") ? o.replace(/0+$/, "") : o;
185
- return p.endsWith(".") ? p.slice(0, p.length - 1) : p;
186
- }
187
- function te() {
188
- if (!t.stepper)
189
- return;
190
- const e = +c.value + +g(t.stepper);
191
- c.value = j(e);
192
- }
193
- function ne() {
194
- if (!t.stepper)
195
- return;
196
- const e = +c.value - +g(t.stepper);
197
- c.value = j(e);
198
- }
199
- return (e, n) => {
200
- const i = b("FmLabel"), a = b("FmIcon"), o = b("FmMenuItem"), p = b("FmMenu"), w = b("FmTooltip"), N = b("FmField"), S = b("FmFormGroup");
201
- return f(), y("div", Me, [
202
- u("div", ge, [
203
- u("div", he, [
204
- M(i, {
205
- label: e.label,
206
- disabled: e.disabled,
207
- required: e.labelMark === "required",
208
- optional: e.labelMark === "optional"
209
- }, null, 8, ["label", "disabled", "required", "optional"])
210
- ]),
211
- M(N, { focused: Q.value }, {
212
- default: h(() => [
213
- u("div", Fe, [
214
- T(e.$slots, "prepend"),
215
- u("div", xe, [
216
- u("div", Ae, [
217
- e.stepperOnly ? (f(), y("span", {
218
- key: 0,
219
- class: V({
220
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
221
- "text-fm-color-typo-primary": !A.value,
222
- "text-fm-color-typo-disabled": A.value
223
- })
224
- }, F(c.value), 3)) : le((f(), y("input", {
225
- key: 1,
226
- type: "text",
227
- ref_key: "inputRef",
228
- ref: K,
229
- onFocus: n[0] || (n[0] = () => R.value = !0),
230
- onBlur: n[1] || (n[1] = () => R.value = !1),
231
- "onUpdate:modelValue": n[2] || (n[2] = (m) => c.value = m),
232
- class: V({
233
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
234
- "text-fm-color-typo-primary": !A.value,
235
- "text-fm-color-typo-disabled": A.value
236
- })
237
- }, null, 34)), [
238
- [ae, c.value]
239
- ])
240
- ]),
241
- e.separator ? (f(), y("div", _e, F(e.separator), 1)) : q("", !0),
242
- u("div", {
243
- class: V([e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"])
244
- }, [
245
- M(w, { "z-index": 51 }, {
246
- content: h(() => [
247
- ue(F(C.value), 1)
248
- ]),
249
- default: h(() => [
250
- e.disableUnit ? (f(), y("div", Pe, F(C.value), 1)) : (f(), W(p, {
251
- key: 1,
252
- onMenuChanged: n[3] || (n[3] = (m) => $.value = m),
253
- "z-index": 500,
254
- placement: e.placement,
255
- disabled: e.disabled
256
- }, {
257
- "menu-button": h(() => [
258
- u("div", Ie, [
259
- u("div", ke, F(C.value), 1),
260
- M(a, { name: "keyboard_arrow_down" })
261
- ])
262
- ]),
263
- default: h(() => [
264
- u("div", Be, [
265
- (f(!0), y(re, null, me(X.value, (m) => (f(), W(o, {
266
- key: m.value ?? void 0,
267
- label: m.label,
268
- "model-value": m.value == U.value,
269
- onClick: (_) => U.value = m.value
270
- }, null, 8, ["label", "model-value", "onClick"]))), 128))
271
- ])
272
- ]),
273
- _: 1
274
- }, 8, ["placement", "disabled"]))
275
- ]),
276
- _: 1
277
- })
278
- ], 2),
279
- e.stepper ? (f(), y("div", De, [
280
- u("div", {
281
- class: "w-24 h-12 flex items-center justify-center fm-corner-radius-sm bg-fm-color-neutral-gray-100 hover:bg-fm-color-neutral-gray-200",
282
- onClick: te
283
- }, [
284
- u("div", Re, [
285
- M(a, {
286
- name: "expand_less",
287
- size: "md"
288
- })
289
- ])
290
- ]),
291
- u("div", {
292
- class: "w-24 h-12 flex items-center justify-center fm-corner-radius-sm bg-fm-color-neutral-gray-100 hover:bg-fm-color-neutral-gray-200",
293
- onClick: ne
294
- }, [
295
- u("div", Ue, [
296
- M(a, {
297
- name: "expand_more",
298
- size: "md"
299
- })
300
- ])
301
- ])
302
- ])) : q("", !0)
303
- ]),
304
- T(e.$slots, "append")
305
- ])
306
- ]),
307
- _: 3
308
- }, 8, ["focused"])
309
- ]),
310
- M(S, {
311
- class: "flex-1",
312
- "model-value": { modelValue: s.value, amountAsString: String(c.value) },
313
- info: e.labelInfo,
314
- rules: ee.value,
315
- "helper-text": e.helperText,
316
- "helper-state": e.helperState
317
- }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
318
- ]);
319
- };
320
- }
321
- });
322
- export {
323
- Ve as F,
324
- je as _,
325
- Le as a,
326
- $e as b,
327
- H as c,
328
- G as d
329
- };