@feedmepos/mf-inventory-portal 0.0.23-dev.1 → 0.0.23-dev.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.
Files changed (93) hide show
  1. package/dist/{App-Y3Ez8Rjf.js → App-DDxwfi6I.js} +36 -31
  2. package/dist/{ApprovalView-BUU1G4Q2.js → ApprovalView-7rpIigm0.js} +4 -4
  3. package/dist/{BindingsDialog-8wc4Q0JQ.js → BindingsDialog-DbyzX6mw.js} +2 -2
  4. package/dist/{BindingsPicker-DGWN1LQc.js → BindingsPicker-FZfhZr5O.js} +2 -2
  5. package/dist/{BindingsTable-7NJP2jT6.js → BindingsTable-Bk2770OV.js} +6 -6
  6. package/dist/ClosingDraftView-D9CnCwak.js +772 -0
  7. package/dist/{ClosingTemplateView-9s7vmwaT.js → ClosingTemplateView-DkpHmTtx.js} +32 -31
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DjBiov5r.js +283 -0
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-5DINn0ZB.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CBC214tP.js} +2 -2
  10. package/dist/{FmMultiselectDialog-7hok9sJP.js → FmMultiselectDialog-CK6xwOeG.js} +128 -124
  11. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-IFTMUhET.js +329 -0
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-FQ0HjuL3.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-D0otwOX8.js} +1 -1
  13. package/dist/{IngredientGroupView-C3maHTCg.js → IngredientGroupView-D5XtVfIQ.js} +12 -11
  14. package/dist/IngredientsView-c7WnQiTv.js +1666 -0
  15. package/dist/{IntegrationView-gO4h89Wj.js → IntegrationView-CHkhMxVM.js} +50 -50
  16. package/dist/{InventoryBindingForm-dh3GeyG-.js → InventoryBindingForm-BUZ9MS5V.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CJuo3i7W.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-YIRre_Km.js} +13 -13
  18. package/dist/{InventoryBindingSummary-BPoPcEoe.js → InventoryBindingSummary-BUi0mjeC.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-olm8sZKt.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CpYtHPFH.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BezTV43V.js → PremiumBadge.vue_vue_type_script_setup_true_lang-D8IH1X1o.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-Dix_fIoo.js → PurchaseOrderPrintPreview-BLuoVz5N.js} +1 -1
  22. package/dist/ReceiveRequestView-BNM5JdQO.js +4165 -0
  23. package/dist/{RecipeView-C4-a4IEW.js → RecipeView-DxRumcLY.js} +11 -10
  24. package/dist/{StockView-Du2txrIP.js → StockView-CZyeg3sX.js} +1356 -1457
  25. package/dist/{SupplierView-D_09FbQh.js → SupplierView-C2XLbf27.js} +2352 -783
  26. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BQG6UzUU.js +1229 -0
  27. package/dist/{TransferTemplateView-j3CRy6Lc.js → TransferTemplateView-BCxZCU0i.js} +307 -307
  28. package/dist/{UnitView-BXw2Vwq1.js → UnitView-uGpE4txg.js} +81 -80
  29. package/dist/{WarehouseView-CKamiETC.js → WarehouseView-DvQVmixr.js} +25 -24
  30. package/dist/api/bill.d.ts +2 -2
  31. package/dist/api/closing-draft.d.ts +6 -0
  32. package/dist/api/closing.d.ts +1 -0
  33. package/dist/api/netsuite.d.ts +70 -0
  34. package/dist/{app-GUbzqEtW.js → app-BaOENyRY.js} +3425 -3343
  35. package/dist/app.d.ts +3 -0
  36. package/dist/app.js +1 -1
  37. package/dist/components/FmMinMaxInputRules.d.ts +4 -1
  38. package/dist/components/row-action.enum.d.ts +1 -0
  39. package/dist/{date2-CLE9fB2R.js → date2-CfGU3sHq.js} +1 -1
  40. package/dist/{dayjs.min-CY1d38w7.js → dayjs.min-BMk-E1IO.js} +17 -17
  41. package/dist/{decimal-SIjO6Mjw.js → decimal-BkLhxOFS.js} +1 -1
  42. package/dist/{defineDeepModel-l40rX7kr.js → defineDeepModel-Cy-_HBnw.js} +1 -1
  43. package/dist/{feature-BXruKUhX.js → feature-GoxrdjJJ.js} +23 -9
  44. package/dist/form-mode.enum-BKiNVH6A.js +4 -0
  45. package/dist/{format-time-from-id-CcFsBXmk.js → format-time-from-id-96hwVl9P.js} +1 -1
  46. package/dist/format-unit-display-Cp0DBbM8.js +1217 -0
  47. package/dist/{fuzzy-CVOV9zJc.js → fuzzy-CBGiL1wK.js} +1 -1
  48. package/dist/index-0HEhOwKT.js +12087 -0
  49. package/dist/{index-BX5KZXhI.js → index-CoL8wxbn.js} +126 -122
  50. package/dist/{index-m9e9nYfl.js → index-S7yfliEo.js} +1 -1
  51. package/dist/netsuite-D3VPLW8O.js +225 -0
  52. package/dist/router/name.d.ts +1 -0
  53. package/dist/{row-action.enum-PMKMRrZR.js → row-action.enum-7rGLGZ5v.js} +10 -5
  54. package/dist/{rules-DlnN8IP3.js → rules-DxLLla7a.js} +40 -35
  55. package/dist/stock-BbFKtx1y.js +111 -0
  56. package/dist/stores/feature.d.ts +2 -0
  57. package/dist/stores/integration/netsuite.d.ts +81 -0
  58. package/dist/stores/inventory.d.ts +1 -4
  59. package/dist/style.css +1 -1
  60. package/dist/{supplier-B21WlSAM.js → supplier-gGovyyjr.js} +22 -22
  61. package/dist/tsconfig.app.tsbuildinfo +1 -1
  62. package/dist/{use-inventory-binding-dialog-D3x6xj2O.js → use-inventory-binding-dialog-DIBMf_9-.js} +2 -2
  63. package/dist/{use-template-enabled-locations-2-z-b-UXef.js → use-template-enabled-locations-2-Bof9JMYI.js} +2 -2
  64. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +2 -0
  65. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +22 -0
  66. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +447 -0
  67. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +22 -0
  68. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +2601 -0
  69. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -0
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +24 -192
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +24 -192
  72. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -2
  73. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +40 -40
  74. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -0
  75. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +63 -63
  76. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +63 -63
  77. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +1 -0
  78. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  79. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  80. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  81. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  82. package/dist/{xlsx-6mM1eNiL.js → xlsx-DOnDmayp.js} +1 -1
  83. package/dist/{xlsx.util-BLftcF4q.js → xlsx.util-BqsQd9YP.js} +1 -1
  84. package/package.json +3 -3
  85. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B4DDh9-a.js +0 -267
  86. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-CxR1FCft.js +0 -326
  87. package/dist/IngredientsView-DCR3IBkR.js +0 -1613
  88. package/dist/ReceiveRequestView-DdPiYb2P.js +0 -4082
  89. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9MOos--.js +0 -1144
  90. package/dist/format-unit-display-DEKg8cJm.js +0 -1198
  91. package/dist/index-CVsyOEb1.js +0 -10545
  92. package/dist/netsuite-DAKRv7zr.js +0 -146
  93. package/dist/normalizeArguments-DP7Hrren.js +0 -1552
@@ -1,267 +0,0 @@
1
- import { r as I, u as B, I as D, y as R, z as V } from "./app-GUbzqEtW.js";
2
- import { a as P, t as H } from "./rules-DlnN8IP3.js";
3
- import { u as j } from "./supplier-B21WlSAM.js";
4
- import { P as S } from "./format-unit-display-DEKg8cJm.js";
5
- import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as w, openBlock as F, createElementBlock as A, normalizeStyle as K, createElementVNode as N, createVNode as Q, withCtx as X, createBlock as x, createCommentVNode as E, Fragment as Y, renderList as Z, unref as M } from "vue";
6
- function oe(c, i, t, s) {
7
- var b, g, u;
8
- if (s != null && s.manualTotalCost)
9
- return s == null ? void 0 : s.manualTotalCost;
10
- const e = (u = (g = (b = s == null ? void 0 : s.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
11
- (r) => r.skuId === c._id
12
- )) == null ? void 0 : u.defaultCost, o = c.defaultCost, n = e ?? o, l = n == null ? void 0 : n.costPerUnit, a = l ? n != null && n.measurement ? +P(l) / +P(n == null ? void 0 : n.measurement.conversion) : +P(l) : void 0, p = a ? t ? a * +P(t.conversion) : a : void 0, f = p ? +P(i) * p : void 0;
13
- return f ? {
14
- ...H(f ?? 0, 2),
15
- currency: I()
16
- } : {
17
- amount: 0,
18
- precision: 0,
19
- currency: I()
20
- };
21
- }
22
- function _(c) {
23
- return R.parse(c);
24
- }
25
- function T(c) {
26
- return {
27
- _id: c.doc._id,
28
- internal: c.type,
29
- contactName: c.doc.profile.name,
30
- name: c.doc.profile.name ?? "",
31
- email: c.doc.profile.email,
32
- phoneNumber: c.doc.profile.phoneNo,
33
- registrationNumber: c.doc.profile.regNo,
34
- address: c.doc.profile.address ?? {
35
- line1: "",
36
- state: "",
37
- city: "",
38
- postcode: "",
39
- country: ""
40
- }
41
- };
42
- }
43
- function le(c, i, t = !1, s = !1) {
44
- const e = j(), o = B();
45
- o.watchLocation(async () => {
46
- var v;
47
- await e.readSuppliers();
48
- const u = c();
49
- if ((v = u.supplier) != null && v._id) return;
50
- const r = s ? e.suppliers[0] : e.businessSuppliers[0], d = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations)[0];
51
- i({
52
- ...u,
53
- supplier: r ? _(r) : d ? T(d) : u.supplier
54
- });
55
- });
56
- const n = y(
57
- () => {
58
- var u, r;
59
- return typeof ((r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r.internal) == "string" ? S.TRANSFER : S.PURCHASE;
60
- }
61
- ), l = y({
62
- get() {
63
- var u, r;
64
- return (r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r._id;
65
- },
66
- set(u) {
67
- const r = c() ?? {};
68
- if (n.value === S.PURCHASE) {
69
- const C = (s ? e.suppliers : e.businessSuppliers).find((U) => U._id === u);
70
- i({
71
- ...r,
72
- supplier: C ? _(C) : r.supplier
73
- });
74
- return;
75
- }
76
- const v = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
77
- i({
78
- ...r,
79
- supplier: v ? T(v) : r.supplier
80
- });
81
- }
82
- }), a = y(() => e.locationSuppliers.map(_)), p = y(() => e.businessSuppliers.map(_)), f = y(() => {
83
- const u = [...a.value], r = [...p.value];
84
- return s ? [...r, ...u] : r;
85
- }), k = y(() => {
86
- var h;
87
- const u = ((h = o._currentLocation) == null ? void 0 : h.type) === D.warehouse;
88
- return (t ? o.locations.filter((d) => d.doc._id !== o.currentLocation.doc._id) : o.locations).filter((d) => u || d.acceptRequest).map(T);
89
- }), b = y(() => {
90
- if (n.value === S.PURCHASE) {
91
- const r = a.value.map((d) => ({
92
- label: d.name,
93
- value: d._id
94
- })), h = p.value.map((d) => ({
95
- label: d.name,
96
- sublabel: "Business supplier",
97
- value: d._id
98
- }));
99
- return s ? [...r, ...h] : h;
100
- }
101
- return k.value.map((r) => ({
102
- label: r.name,
103
- sublabel: r.internal ? `${r.internal}` : void 0,
104
- value: r._id
105
- }));
106
- }), g = y(() => {
107
- var d, v;
108
- const u = (v = (d = c()) == null ? void 0 : d.supplier) == null ? void 0 : v._id;
109
- if (n.value === S.PURCHASE) {
110
- const m = e.suppliers.find((C) => C._id === u);
111
- return m ? _(m) : null;
112
- }
113
- const h = o.locations.find((m) => m.doc._id);
114
- return h ? T(h) : null;
115
- });
116
- return {
117
- transferLocationModel: l,
118
- transferLocationOptions: b,
119
- locationOptionsTypePurchase: f,
120
- locationOptionsTypePurchaseLocationLevel: a,
121
- locationOptionsTypeTransfer: k,
122
- selectedLocation: g
123
- };
124
- }
125
- class O {
126
- static getDescendantProperty(i, t, s = []) {
127
- let e, o, n, l, a, p;
128
- if (t) {
129
- if (n = t.indexOf("."), n === -1 ? e = t : (e = t.slice(0, n), o = t.slice(n + 1)), l = i[e], l !== null && typeof l < "u")
130
- if (!o && (typeof l == "string" || typeof l == "number"))
131
- s.push(l);
132
- else if (Object.prototype.toString.call(l) === "[object Array]")
133
- for (a = 0, p = l.length; a < p; a++)
134
- O.getDescendantProperty(l[a], o, s);
135
- else o && O.getDescendantProperty(l, o, s);
136
- } else
137
- s.push(i);
138
- return s;
139
- }
140
- }
141
- class L {
142
- constructor(i = [], t = [], s = {}) {
143
- Array.isArray(t) || (s = t, t = []), this.haystack = i, this.keys = t, this.options = Object.assign({
144
- caseSensitive: !1,
145
- sort: !1
146
- }, s);
147
- }
148
- search(i = "") {
149
- if (i === "")
150
- return this.haystack;
151
- const t = [];
152
- for (let s = 0; s < this.haystack.length; s++) {
153
- const e = this.haystack[s];
154
- if (this.keys.length === 0) {
155
- const o = L.isMatch(e, i, this.options.caseSensitive);
156
- o && t.push({ item: e, score: o });
157
- } else
158
- for (let o = 0; o < this.keys.length; o++) {
159
- const n = O.getDescendantProperty(e, this.keys[o]);
160
- let l = !1;
161
- for (let a = 0; a < n.length; a++) {
162
- const p = L.isMatch(n[a], i, this.options.caseSensitive);
163
- if (p) {
164
- l = !0, t.push({ item: e, score: p });
165
- break;
166
- }
167
- }
168
- if (l)
169
- break;
170
- }
171
- }
172
- return this.options.sort && t.sort((s, e) => s.score - e.score), t.map((s) => s.item);
173
- }
174
- static isMatch(i, t, s) {
175
- i = String(i), t = String(t), s || (i = i.toLocaleLowerCase(), t = t.toLocaleLowerCase());
176
- const e = L.nearestIndexesFor(i, t);
177
- return e ? i === t ? 1 : e.length > 1 ? 2 + (e[e.length - 1] - e[0]) : 2 + e[0] : !1;
178
- }
179
- static nearestIndexesFor(i, t) {
180
- const s = t.split("");
181
- let e = [];
182
- return L.indexesOfFirstLetter(i, t).forEach((n, l) => {
183
- let a = n + 1;
184
- e[l] = [n];
185
- for (let p = 1; p < s.length; p++) {
186
- const f = s[p];
187
- if (a = i.indexOf(f, a), a === -1) {
188
- e[l] = !1;
189
- break;
190
- }
191
- e[l].push(a), a++;
192
- }
193
- }), e = e.filter((n) => n !== !1), e.length ? e.sort((n, l) => n.length === 1 ? n[0] - l[0] : (n = n[n.length - 1] - n[0], l = l[l.length - 1] - l[0], n - l))[0] : !1;
194
- }
195
- static indexesOfFirstLetter(i, t) {
196
- const s = t[0];
197
- return i.split("").map((e, o) => e !== s ? !1 : o).filter((e) => e !== !1);
198
- }
199
- }
200
- const z = { class: "sticky top-0 bg-white mb-8" }, G = { class: "overflow-y-auto pb-8" }, ie = /* @__PURE__ */ $({
201
- __name: "FmFilterableMenuOptions",
202
- props: /* @__PURE__ */ W({
203
- modelValue: {},
204
- maxHeight: {},
205
- width: {},
206
- handleItemChange: { type: Function },
207
- items: {},
208
- options: {}
209
- }, {
210
- search: {},
211
- searchModifiers: {}
212
- }),
213
- emits: ["update:search"],
214
- setup(c) {
215
- const i = c, t = J(c, "search"), s = y(
216
- () => new L(i.items, ["label", "sublabel"], i.options)
217
- ), e = y(() => s.value.search(t.value));
218
- return (o, n) => {
219
- const l = w("FmButton"), a = w("FmTextField"), p = w("FmMenuItem");
220
- return F(), A("div", {
221
- class: "relative",
222
- style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
223
- }, [
224
- N("div", z, [
225
- Q(a, {
226
- modelValue: t.value,
227
- "onUpdate:modelValue": n[1] || (n[1] = (f) => t.value = f),
228
- placeholder: "Filter options"
229
- }, {
230
- append: X(() => [
231
- t.value ? (F(), x(l, {
232
- key: 0,
233
- variant: "tertiary",
234
- "prepend-icon": "close",
235
- onClick: n[0] || (n[0] = (f) => t.value = "")
236
- })) : E("", !0)
237
- ]),
238
- _: 1
239
- }, 8, ["modelValue"])
240
- ]),
241
- N("div", G, [
242
- (F(!0), A(Y, null, Z(e.value, (f, k) => (F(), x(p, {
243
- key: k,
244
- label: f.label,
245
- sublabel: f.sublabel,
246
- "model-value": M(V)(o.modelValue, f.value),
247
- onClick: () => o.handleItemChange(M(V)(o.modelValue, f.value), f),
248
- onVnodeMounted: (b) => {
249
- var g;
250
- return M(V)(o.modelValue, f.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
251
- }
252
- }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
253
- e.value.length ? E("", !0) : (F(), x(p, {
254
- key: 0,
255
- disabled: "",
256
- label: "No options available"
257
- }))
258
- ])
259
- ], 4);
260
- };
261
- }
262
- });
263
- export {
264
- ie as _,
265
- oe as c,
266
- le as u
267
- };
@@ -1,326 +0,0 @@
1
- import { defineComponent as oe, mergeModels as z, useModel as se, computed as v, ref as P, watch as T, inject as le, resolveComponent as b, openBlock as f, createElementBlock as y, createElementVNode as a, createVNode as h, withCtx as M, renderSlot as $, normalizeClass as V, toDisplayString as g, withDirectives as ie, vModelText as ae, createCommentVNode as W, createTextVNode as ue, createBlock as q, Fragment as re, renderList as me } from "vue";
2
- import { F as I } from "./index-BX5KZXhI.js";
3
- import { I as k, g as j, c as ce, a as x, m as de, t as pe, b as fe, p as ve, l as be, u as ye } from "./rules-DlnN8IP3.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(s) {
16
- return function(n) {
17
- return k()(n.amountAsString) !== !0 ? !0 : +n.amountAsString < s ? `Must be at least ${s}` : !0;
18
- };
19
- }
20
- function je(s) {
21
- return function(n) {
22
- return k()(n.amountAsString) !== !0 ? !0 : +n.amountAsString > s ? `Must be at most ${s}` : !0;
23
- };
24
- }
25
- function G(s, d = !1) {
26
- return function(u) {
27
- const o = H()(u);
28
- if (o != !0)
29
- return d ? o : !0;
30
- const F = typeof s == "number" ? s : j(s, u.modelValue.measurement);
31
- return ce(+u.amountAsString).precision > F ? `Cannot exceed precision more than ${x({
32
- amount: 1,
33
- precision: F
34
- })}` : !0;
35
- };
36
- }
37
- function Le(s) {
38
- const d = de(s);
39
- return function(u) {
40
- return d(u.modelValue.amount);
41
- };
42
- }
43
- const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { class: "flex-1" }, xe = { class: "flex items-center gap-4" }, Fe = { 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" }, Re = { 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
- }, Be = {
53
- class: "flex items-center",
54
- style: { "pointer-events": "none" }
55
- }, Ce = {
56
- class: "flex items-center",
57
- style: { "pointer-events": "none" }
58
- }, Oe = /* @__PURE__ */ oe({
59
- __name: "FmUnitInput",
60
- props: /* @__PURE__ */ z({
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__ */ z(["update:amount", "update:measurement"], ["update:modelValue"]),
108
- setup(s, { emit: d }) {
109
- const n = s, u = d, o = se(s, "modelValue"), F = k(), R = v(() => {
110
- var t;
111
- return j(n.unit, (t = o.value) == null ? void 0 : t.measurement);
112
- }), c = P((() => {
113
- var i;
114
- const e = ((i = o.value) == null ? void 0 : i.amount) ?? I.reset(), t = be(e), l = n.formatMinimumPrecision ?? t.precision, r = ye(t, l);
115
- return x(r);
116
- })());
117
- T(c, (e) => {
118
- const t = F(e), l = n.precision ?? R.value, i = typeof n.formatMinimumPrecision == "number" && n.formatMinimumPrecision > l ? n.formatMinimumPrecision : l;
119
- t == !0 && (o.value = {
120
- ...o.value,
121
- amount: pe(+e, i)
122
- }), u("update:amount", e);
123
- });
124
- const J = Symbol.for("fm:form-state"), D = le(J, null), A = v(() => n.disabled ?? (D == null ? void 0 : D.getDisabled()) ?? !1), K = P(), B = P(!1), L = P(!1), Q = v(() => B.value || L.value), X = v(() => {
125
- var e;
126
- return [
127
- {
128
- label: (e = n.unit) == null ? void 0 : e.abbrev,
129
- value: null
130
- },
131
- ...n.unit.measurements.map((t) => ({
132
- label: t.abbrev,
133
- value: t.id
134
- }))
135
- ];
136
- }), C = v({
137
- get() {
138
- var e, t;
139
- return ((t = (e = o.value) == null ? void 0 : e.measurement) == null ? void 0 : t.id) ?? null;
140
- },
141
- set(e) {
142
- if (e == null)
143
- o.value = {
144
- ...o.value ?? E(),
145
- measurement: null
146
- }, u("update:measurement", null);
147
- else {
148
- const t = n.unit.measurements.find((l) => l.id === e) ?? null;
149
- o.value = {
150
- ...o.value ?? E(),
151
- measurement: t
152
- }, u("update:measurement", t);
153
- }
154
- }
155
- });
156
- T(C, (e, t) => {
157
- var m;
158
- if (!n.convertAmountOnChangeUnit)
159
- return;
160
- const l = ((m = o.value) == null ? void 0 : m.amount) ?? I.reset(), r = n.unit.measurements.find((_) => _.id === t) ?? null, i = n.unit.measurements.find((_) => _.id === e) ?? null, p = r ? fe(l, r.conversion) : l, w = i ? ve(p, i.conversion) : p, N = j(n.unit, i), S = I.convertPrecision({
161
- value: w,
162
- precision: N
163
- });
164
- c.value = x(S);
165
- });
166
- const U = v(() => {
167
- var e, t;
168
- return ((t = (e = o.value) == null ? void 0 : e.measurement) == null ? void 0 : t.abbrev) ?? n.unit.abbrev;
169
- }), Y = v(
170
- () => {
171
- var e;
172
- return ((e = n.rules) == null ? void 0 : e.map(
173
- (t) => (l) => typeof t == "function" ? t(l) : t
174
- )) ?? [];
175
- }
176
- ), ee = v(() => [...n.applyDefaultRules ? [
177
- H(),
178
- typeof n.precision == "number" ? G(n.precision) : G(n.unit)
179
- ] : [], ...Y.value]);
180
- function O(e) {
181
- const t = n.precision ?? R.value, r = typeof n.formatMinimumPrecision == "number" && n.formatMinimumPrecision > t ? n.formatMinimumPrecision : t, i = e.toFixed(r), p = i.includes(".") ? i.replace(/0+$/, "") : i;
182
- return p.endsWith(".") ? p.slice(0, p.length - 1) : p;
183
- }
184
- function te() {
185
- if (!n.stepper)
186
- return;
187
- const e = +c.value + +x(n.stepper);
188
- c.value = O(e);
189
- }
190
- function ne() {
191
- if (!n.stepper)
192
- return;
193
- const e = +c.value - +x(n.stepper);
194
- c.value = O(e);
195
- }
196
- return (e, t) => {
197
- const l = b("FmLabel"), r = b("FmIcon"), i = b("FmMenuItem"), p = b("FmMenu"), w = b("FmTooltip"), N = b("FmField"), S = b("FmFormGroup");
198
- return f(), y("div", he, [
199
- a("div", Me, [
200
- a("div", ge, [
201
- h(l, {
202
- label: e.label,
203
- disabled: e.disabled,
204
- required: e.labelMark === "required",
205
- optional: e.labelMark === "optional"
206
- }, null, 8, ["label", "disabled", "required", "optional"])
207
- ]),
208
- h(N, { focused: Q.value }, {
209
- default: M(() => [
210
- a("div", xe, [
211
- $(e.$slots, "prepend"),
212
- a("div", Fe, [
213
- a("div", Ae, [
214
- e.stepperOnly ? (f(), y("span", {
215
- key: 0,
216
- class: V({
217
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
218
- "text-fm-color-typo-primary": !A.value,
219
- "text-fm-color-typo-disabled": A.value
220
- })
221
- }, g(c.value), 3)) : ie((f(), y("input", {
222
- key: 1,
223
- type: "text",
224
- ref_key: "inputRef",
225
- ref: K,
226
- onFocus: t[0] || (t[0] = () => B.value = !0),
227
- onBlur: t[1] || (t[1] = () => B.value = !1),
228
- "onUpdate:modelValue": t[2] || (t[2] = (m) => c.value = m),
229
- class: V({
230
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
231
- "text-fm-color-typo-primary": !A.value,
232
- "text-fm-color-typo-disabled": A.value
233
- })
234
- }, null, 34)), [
235
- [ae, c.value]
236
- ])
237
- ]),
238
- e.separator ? (f(), y("div", _e, g(e.separator), 1)) : W("", !0),
239
- a("div", {
240
- class: V([e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"])
241
- }, [
242
- h(w, { "z-index": 51 }, {
243
- content: M(() => [
244
- ue(g(U.value), 1)
245
- ]),
246
- default: M(() => [
247
- e.disableUnit ? (f(), y("div", Pe, g(U.value), 1)) : (f(), q(p, {
248
- key: 1,
249
- onMenuChanged: t[3] || (t[3] = (m) => L.value = m),
250
- "z-index": 500,
251
- placement: e.placement,
252
- disabled: e.disabled
253
- }, {
254
- "menu-button": M(() => [
255
- a("div", Ie, [
256
- a("div", ke, g(U.value), 1),
257
- h(r, { name: "keyboard_arrow_down" })
258
- ])
259
- ]),
260
- default: M(() => [
261
- a("div", Re, [
262
- (f(!0), y(re, null, me(X.value, (m) => (f(), q(i, {
263
- key: m.value ?? void 0,
264
- label: m.label,
265
- "model-value": m.value == C.value,
266
- onClick: (_) => C.value = m.value
267
- }, null, 8, ["label", "model-value", "onClick"]))), 128))
268
- ])
269
- ]),
270
- _: 1
271
- }, 8, ["placement", "disabled"]))
272
- ]),
273
- _: 1
274
- })
275
- ], 2),
276
- e.stepper ? (f(), y("div", De, [
277
- a("div", {
278
- 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",
279
- onClick: te
280
- }, [
281
- a("div", Be, [
282
- h(r, {
283
- name: "expand_less",
284
- size: "md"
285
- })
286
- ])
287
- ]),
288
- a("div", {
289
- 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",
290
- onClick: ne
291
- }, [
292
- a("div", Ce, [
293
- h(r, {
294
- name: "expand_more",
295
- size: "md"
296
- })
297
- ])
298
- ])
299
- ])) : W("", !0)
300
- ]),
301
- $(e.$slots, "append")
302
- ])
303
- ]),
304
- _: 3
305
- }, 8, ["focused"])
306
- ]),
307
- h(S, {
308
- class: "flex-1",
309
- "model-value": { modelValue: o.value, amountAsString: String(c.value) },
310
- info: e.labelInfo,
311
- rules: ee.value,
312
- "helper-text": e.helperText,
313
- "helper-state": e.helperState
314
- }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
315
- ]);
316
- };
317
- }
318
- });
319
- export {
320
- Ve as F,
321
- Oe as _,
322
- je as a,
323
- Le as b,
324
- H as c,
325
- G as d
326
- };