@feedmepos/mf-inventory-portal 0.0.23-dev.3 → 0.0.23-dev.31

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 (118) hide show
  1. package/dist/{App-BREfwtck.js → App-CEmWJ9lp.js} +85 -73
  2. package/dist/{ApprovalView-DCzLx24G.js → ApprovalView-jDll4AVe.js} +24 -27
  3. package/dist/{BindingsDialog-CUcC8lue.js → BindingsDialog-BC_gRSif.js} +4 -4
  4. package/dist/{BindingsPicker-3VOdZBWI.js → BindingsPicker-BJsGoBzM.js} +8 -9
  5. package/dist/{BindingsTable-D5Lt6GOO.js → BindingsTable-DSdwNK_q.js} +18 -22
  6. package/dist/ClosingDraftView-UfWdRXb-.js +1190 -0
  7. package/dist/{ClosingTemplateView-CukthwOo.js → ClosingTemplateView-BzG16gl5.js} +272 -286
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DW2IOPST.js +282 -0
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DigsIOB0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DDuZEf_v.js} +116 -114
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DweLQVwq.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CiNvnaaE.js} +5 -5
  11. package/dist/{IngredientGroupView-CkD8x2CP.js → IngredientGroupView-DL8eBhkk.js} +63 -69
  12. package/dist/IngredientsView-B_HC9fgq.js +1657 -0
  13. package/dist/{IntegrationView-BfeV07OO.js → IntegrationView-BeFT5S24.js} +92 -95
  14. package/dist/{InventoryBindingForm-BsSmth0U.js → InventoryBindingForm-DJ3uwq_X.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CMV5e99K.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DIviTipZ.js} +25 -27
  16. package/dist/{InventoryBindingSummary-BHloDawE.js → InventoryBindingSummary-CvB5j9xq.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BjddpTCS.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CQPdnXEF.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BZBa_99i.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BdscwUGn.js} +23 -24
  19. package/dist/{PurchaseOrderPrintPreview-CTdd-RuH.js → PurchaseOrderPrintPreview-3_6nBajH.js} +13 -14
  20. package/dist/ReceiveRequestView-B_0UldQ7.js +4188 -0
  21. package/dist/{RecipeView-CrmDQdc5.js → RecipeView-D9p0Ou_I.js} +79 -85
  22. package/dist/{StockView-Xb3fQaiD.js → StockView-TIdUgG3O.js} +1338 -1446
  23. package/dist/{SupplierView-CrtIiaz0.js → SupplierView-B1b9Otcr.js} +2325 -787
  24. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-jUYB4L8Y.js +1275 -0
  25. package/dist/TransferTemplateView-Dxk5b-2j.js +1264 -0
  26. package/dist/{UnitView-C6BgrZ1G.js → UnitView-BrpzJ7D3.js} +40 -44
  27. package/dist/{WarehouseView-Hhd76ybU.js → WarehouseView-CjbdEy8o.js} +94 -100
  28. package/dist/api/adjustment-template.d.ts +23 -0
  29. package/dist/api/bill.d.ts +2 -2
  30. package/dist/api/closing-draft.d.ts +6 -0
  31. package/dist/api/closing.d.ts +1 -0
  32. package/dist/api/netsuite.d.ts +3 -3
  33. package/dist/app-AcMtTQ07.js +84202 -0
  34. package/dist/app.d.ts +56 -0
  35. package/dist/app.js +2 -2
  36. package/dist/components/FmMinMaxInputRules.d.ts +4 -1
  37. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  38. package/dist/components/row-action.enum.d.ts +1 -0
  39. package/dist/composable/defineDeepModel.d.ts +1 -1
  40. package/dist/{decimal-rPKr5T-H.js → decimal-DHYZglKx.js} +1 -1
  41. package/dist/{feature-z95vJnA1.js → feature-G-NnqKcY.js} +23 -9
  42. package/dist/format-unit-display-BWqJsV_R.js +1207 -0
  43. package/dist/index-Bt8vaUdT.js +12087 -0
  44. package/dist/router/name.d.ts +2 -0
  45. package/dist/stock-VZXyPw2C.js +125 -0
  46. package/dist/stores/feature.d.ts +2 -0
  47. package/dist/stores/integration/netsuite.d.ts +70 -2
  48. package/dist/stores/inventory.d.ts +1 -4
  49. package/dist/style.css +1 -1
  50. package/dist/{supplier-BixmjZyl.js → supplier-DTUUR48O.js} +15 -15
  51. package/dist/tsconfig.app.tsbuildinfo +1 -1
  52. package/dist/{use-inventory-binding-dialog-BRygbm1p.js → use-inventory-binding-dialog-DvC_i-Ih.js} +10 -11
  53. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  54. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  55. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  56. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  57. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  58. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  59. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  60. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1295 -0
  61. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  62. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  63. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  64. package/dist/views/adjustment-template/wastage-template/props.d.ts +29 -0
  65. package/dist/views/adjustment-template/wastage-template/table.d.ts +1273 -0
  66. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +2 -0
  67. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +22 -0
  68. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +621 -0
  69. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +25 -0
  70. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +3621 -0
  71. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -0
  72. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  73. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  74. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +24 -192
  75. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +25 -193
  76. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  77. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  78. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  79. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
  80. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +40 -34
  81. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -0
  82. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +63 -54
  83. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +63 -54
  84. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +1 -0
  85. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  86. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  87. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  88. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  89. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  90. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  91. package/package.json +2 -2
  92. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  93. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dwb3eBLo.js +0 -267
  94. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CvtvzIt1.js +0 -436
  95. package/dist/FmMultiselectDialog-CKBcMDGC.js +0 -415
  96. package/dist/IngredientsView-DuK4YSD6.js +0 -1613
  97. package/dist/ReceiveRequestView-CgWNaYs1.js +0 -4104
  98. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  99. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9H41eg7.js +0 -1189
  100. package/dist/TransferTemplateView-Cc7VRbZ7.js +0 -1262
  101. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  102. package/dist/app-CwUHqg7h.js +0 -33462
  103. package/dist/date2-CHNm4ELK.js +0 -117
  104. package/dist/dayjs.min-FE3dpxHU.js +0 -282
  105. package/dist/defineDeepModel-Dc1zZzOi.js +0 -13
  106. package/dist/format-time-from-id-CaPj8EHN.js +0 -15
  107. package/dist/format-unit-display-Bkz5kW6p.js +0 -1198
  108. package/dist/fuzzy-DXqhGaFi.js +0 -41
  109. package/dist/index-BMJHz32O.js +0 -22277
  110. package/dist/index-Be5vGZdr.js +0 -45
  111. package/dist/index-D2juQPg6.js +0 -10545
  112. package/dist/netsuite-P0as0Moa.js +0 -194
  113. package/dist/normalizeArguments-DP7Hrren.js +0 -1552
  114. package/dist/row-action.enum-PMKMRrZR.js +0 -50
  115. package/dist/rules-BQz4NGht.js +0 -198
  116. package/dist/use-template-enabled-locations-2-Dd15d-ng.js +0 -86
  117. package/dist/xlsx-k2Rf0NcF.js +0 -24004
  118. package/dist/xlsx.util-CJxPf7XZ.js +0 -78
@@ -0,0 +1,282 @@
1
+ import { i as k, t as H, aq as V, u as B, aw as I, aG as R, aH as M } from "./app-AcMtTQ07.js";
2
+ import { u as j } from "./supplier-DTUUR48O.js";
3
+ import { P as S } from "./format-unit-display-BWqJsV_R.js";
4
+ 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 N, createVNode as Q, withCtx as X, createBlock as w, createCommentVNode as D, Fragment as Y, renderList as Z, unref as x } from "vue";
5
+ function z(l, r, e) {
6
+ var s;
7
+ if (!!r.measurement === !!e && ((s = r.measurement) == null ? void 0 : s.id) === e)
8
+ return r;
9
+ if (!e)
10
+ return {
11
+ costPerUnit: r.costPerUnit
12
+ };
13
+ const o = l.measurements.find((i) => i.id === e);
14
+ return o ? {
15
+ costPerUnit: r.costPerUnit,
16
+ measurement: o
17
+ } : {
18
+ costPerUnit: r.costPerUnit
19
+ };
20
+ }
21
+ function oe(l, r, e, n) {
22
+ var b, g, u;
23
+ if (n != null && n.manualTotalCost)
24
+ return n == null ? void 0 : n.manualTotalCost;
25
+ const t = (u = (g = (b = n == null ? void 0 : n.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
26
+ (a) => a.skuId === l._id
27
+ )) == 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;
28
+ return f ? {
29
+ ...H(f ?? 0, 2),
30
+ currency: V()
31
+ } : {
32
+ amount: 0,
33
+ precision: 0,
34
+ currency: V()
35
+ };
36
+ }
37
+ function F(l) {
38
+ return R.parse(l);
39
+ }
40
+ function C(l) {
41
+ return {
42
+ _id: l.doc._id,
43
+ internal: l.type,
44
+ contactName: l.doc.profile.name,
45
+ name: l.doc.profile.name ?? "",
46
+ email: l.doc.profile.email,
47
+ phoneNumber: l.doc.profile.phoneNo,
48
+ registrationNumber: l.doc.profile.regNo,
49
+ address: l.doc.profile.address ?? {
50
+ line1: "",
51
+ state: "",
52
+ city: "",
53
+ postcode: "",
54
+ country: ""
55
+ }
56
+ };
57
+ }
58
+ function re(l, r, e = !1, n = !1) {
59
+ const t = j(), o = B();
60
+ o.watchLocation(async () => {
61
+ var v;
62
+ await t.readSuppliers();
63
+ const u = l();
64
+ if ((v = u.supplier) != null && v._id) return;
65
+ 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];
66
+ r({
67
+ ...u,
68
+ supplier: a ? F(a) : d ? C(d) : u.supplier
69
+ });
70
+ });
71
+ const s = y(
72
+ () => {
73
+ var u, a;
74
+ return typeof ((a = (u = l()) == null ? void 0 : u.supplier) == null ? void 0 : a.internal) == "string" ? S.TRANSFER : S.PURCHASE;
75
+ }
76
+ ), i = y({
77
+ get() {
78
+ var u, a;
79
+ return (a = (u = l()) == null ? void 0 : u.supplier) == null ? void 0 : a._id;
80
+ },
81
+ set(u) {
82
+ const a = l() ?? {};
83
+ if (s.value === S.PURCHASE) {
84
+ const _ = (n ? t.suppliers : t.businessSuppliers).find((E) => E._id === u);
85
+ r({
86
+ ...a,
87
+ supplier: _ ? F(_) : a.supplier
88
+ });
89
+ return;
90
+ }
91
+ const v = (e ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
92
+ r({
93
+ ...a,
94
+ supplier: v ? C(v) : a.supplier
95
+ });
96
+ }
97
+ }), c = y(() => t.locationSuppliers.map(F)), p = y(() => t.businessSuppliers.map(F)), f = y(() => {
98
+ const u = [...c.value], a = [...p.value];
99
+ return n ? [...a, ...u] : a;
100
+ }), L = y(() => {
101
+ var h;
102
+ const u = ((h = o._currentLocation) == null ? void 0 : h.type) === I.warehouse;
103
+ return (e ? o.locations.filter((d) => d.doc._id !== o.currentLocation.doc._id) : o.locations).filter((d) => u || d.acceptRequest).map(C);
104
+ }), b = y(() => {
105
+ if (s.value === S.PURCHASE) {
106
+ const a = c.value.map((d) => ({
107
+ label: d.name,
108
+ value: d._id
109
+ })), h = p.value.map((d) => ({
110
+ label: d.name,
111
+ sublabel: "Business supplier",
112
+ value: d._id
113
+ }));
114
+ return n ? [...a, ...h] : h;
115
+ }
116
+ return L.value.map((a) => ({
117
+ label: a.name,
118
+ sublabel: a.internal ? `${a.internal}` : void 0,
119
+ value: a._id
120
+ }));
121
+ }), g = y(() => {
122
+ var d, v;
123
+ const u = (v = (d = l()) == null ? void 0 : d.supplier) == null ? void 0 : v._id;
124
+ if (s.value === S.PURCHASE) {
125
+ const m = t.suppliers.find((_) => _._id === u);
126
+ return m ? F(m) : null;
127
+ }
128
+ const h = o.locations.find((m) => m.doc._id);
129
+ return h ? C(h) : null;
130
+ });
131
+ return {
132
+ transferLocationModel: i,
133
+ transferLocationOptions: b,
134
+ locationOptionsTypePurchase: f,
135
+ locationOptionsTypePurchaseLocationLevel: c,
136
+ locationOptionsTypeTransfer: L,
137
+ selectedLocation: g
138
+ };
139
+ }
140
+ class O {
141
+ static getDescendantProperty(r, e, n = []) {
142
+ let t, o, s, i, c, p;
143
+ if (e) {
144
+ 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")
145
+ if (!o && (typeof i == "string" || typeof i == "number"))
146
+ n.push(i);
147
+ else if (Object.prototype.toString.call(i) === "[object Array]")
148
+ for (c = 0, p = i.length; c < p; c++)
149
+ O.getDescendantProperty(i[c], o, n);
150
+ else o && O.getDescendantProperty(i, o, n);
151
+ } else
152
+ n.push(r);
153
+ return n;
154
+ }
155
+ }
156
+ class P {
157
+ constructor(r = [], e = [], n = {}) {
158
+ Array.isArray(e) || (n = e, e = []), this.haystack = r, this.keys = e, this.options = Object.assign({
159
+ caseSensitive: !1,
160
+ sort: !1
161
+ }, n);
162
+ }
163
+ search(r = "") {
164
+ if (r === "")
165
+ return this.haystack;
166
+ const e = [];
167
+ for (let n = 0; n < this.haystack.length; n++) {
168
+ const t = this.haystack[n];
169
+ if (this.keys.length === 0) {
170
+ const o = P.isMatch(t, r, this.options.caseSensitive);
171
+ o && e.push({ item: t, score: o });
172
+ } else
173
+ for (let o = 0; o < this.keys.length; o++) {
174
+ const s = O.getDescendantProperty(t, this.keys[o]);
175
+ let i = !1;
176
+ for (let c = 0; c < s.length; c++) {
177
+ const p = P.isMatch(s[c], r, this.options.caseSensitive);
178
+ if (p) {
179
+ i = !0, e.push({ item: t, score: p });
180
+ break;
181
+ }
182
+ }
183
+ if (i)
184
+ break;
185
+ }
186
+ }
187
+ return this.options.sort && e.sort((n, t) => n.score - t.score), e.map((n) => n.item);
188
+ }
189
+ static isMatch(r, e, n) {
190
+ r = String(r), e = String(e), n || (r = r.toLocaleLowerCase(), e = e.toLocaleLowerCase());
191
+ const t = P.nearestIndexesFor(r, e);
192
+ return t ? r === e ? 1 : t.length > 1 ? 2 + (t[t.length - 1] - t[0]) : 2 + t[0] : !1;
193
+ }
194
+ static nearestIndexesFor(r, e) {
195
+ const n = e.split("");
196
+ let t = [];
197
+ return P.indexesOfFirstLetter(r, e).forEach((s, i) => {
198
+ let c = s + 1;
199
+ t[i] = [s];
200
+ for (let p = 1; p < n.length; p++) {
201
+ const f = n[p];
202
+ if (c = r.indexOf(f, c), c === -1) {
203
+ t[i] = !1;
204
+ break;
205
+ }
206
+ t[i].push(c), c++;
207
+ }
208
+ }), 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;
209
+ }
210
+ static indexesOfFirstLetter(r, e) {
211
+ const n = e[0];
212
+ return r.split("").map((t, o) => t !== n ? !1 : o).filter((t) => t !== !1);
213
+ }
214
+ }
215
+ const G = { class: "sticky top-0 bg-white mb-8" }, q = { class: "overflow-y-auto pb-8" }, ie = /* @__PURE__ */ $({
216
+ __name: "FmFilterableMenuOptions",
217
+ props: /* @__PURE__ */ W({
218
+ modelValue: {},
219
+ maxHeight: {},
220
+ width: {},
221
+ handleItemChange: { type: Function },
222
+ items: {},
223
+ options: {}
224
+ }, {
225
+ search: {},
226
+ searchModifiers: {}
227
+ }),
228
+ emits: ["update:search"],
229
+ setup(l) {
230
+ const r = l, e = J(l, "search"), n = y(
231
+ () => new P(r.items, ["label", "sublabel"], r.options)
232
+ ), t = y(() => n.value.search(e.value));
233
+ return (o, s) => {
234
+ const i = U("FmButton"), c = U("FmTextField"), p = U("FmMenuItem");
235
+ return T(), A("div", {
236
+ class: "relative",
237
+ style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
238
+ }, [
239
+ N("div", G, [
240
+ Q(c, {
241
+ modelValue: e.value,
242
+ "onUpdate:modelValue": s[1] || (s[1] = (f) => e.value = f),
243
+ placeholder: "Filter options"
244
+ }, {
245
+ append: X(() => [
246
+ e.value ? (T(), w(i, {
247
+ key: 0,
248
+ variant: "tertiary",
249
+ "prepend-icon": "close",
250
+ onClick: s[0] || (s[0] = (f) => e.value = "")
251
+ })) : D("", !0)
252
+ ]),
253
+ _: 1
254
+ }, 8, ["modelValue"])
255
+ ]),
256
+ N("div", q, [
257
+ (T(!0), A(Y, null, Z(t.value, (f, L) => (T(), w(p, {
258
+ key: L,
259
+ label: f.label,
260
+ sublabel: f.sublabel,
261
+ "model-value": x(M)(o.modelValue, f.value),
262
+ onClick: () => o.handleItemChange(x(M)(o.modelValue, f.value), f),
263
+ onVnodeMounted: (b) => {
264
+ var g;
265
+ return x(M)(o.modelValue, f.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
266
+ }
267
+ }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
268
+ t.value.length ? D("", !0) : (T(), w(p, {
269
+ key: 0,
270
+ disabled: "",
271
+ label: "No options available"
272
+ }))
273
+ ])
274
+ ], 4);
275
+ };
276
+ }
277
+ });
278
+ export {
279
+ ie as _,
280
+ oe as c,
281
+ re as u
282
+ };
@@ -1,6 +1,5 @@
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-BMJHz32O.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-BQz4NGht.js";
1
+ import { defineComponent as oe, mergeModels as $, 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 g, renderSlot as T, normalizeClass as V, toDisplayString as x, 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 { Z as I, I as k, O as L, K as ce, i as h, aE as de, t as pe, J as fe, aj as ve, aC as be, aB as ye } from "./app-AcMtTQ07.js";
4
3
  import "@feedmepos/ui-library";
5
4
  function E() {
6
5
  return {
@@ -12,52 +11,52 @@ function H() {
12
11
  return k()(d.amountAsString);
13
12
  };
14
13
  }
15
- function Ve(s) {
16
- return function(n) {
17
- return k()(n.amountAsString) !== !0 ? !0 : +n.amountAsString < s ? `Must be at least ${s}` : !0;
14
+ function Se(l) {
15
+ return function(t) {
16
+ return k()(t.amountAsString) !== !0 ? !0 : +t.amountAsString < l ? `Must be at least ${l}` : !0;
18
17
  };
19
18
  }
20
- function je(s) {
21
- return function(n) {
22
- return k()(n.amountAsString) !== !0 ? !0 : +n.amountAsString > s ? `Must be at most ${s}` : !0;
19
+ function Ve(l) {
20
+ return function(t) {
21
+ return k()(t.amountAsString) !== !0 ? !0 : +t.amountAsString > l ? `Must be at most ${l}` : !0;
23
22
  };
24
23
  }
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({
24
+ function G(l, d = !1) {
25
+ return function(r) {
26
+ const s = H()(r);
27
+ if (s != !0)
28
+ return d ? s : !0;
29
+ const F = typeof l == "number" ? l : L(l, r.modelValue.measurement);
30
+ return ce(+r.amountAsString).precision > F ? `Cannot exceed precision more than ${h({
32
31
  amount: 1,
33
32
  precision: F
34
33
  })}` : !0;
35
34
  };
36
35
  }
37
- function Le(s) {
38
- const d = de(s);
39
- return function(u) {
40
- return d(u.modelValue.amount);
36
+ function Le(l) {
37
+ const d = de(l);
38
+ return function(r) {
39
+ return d(r.modelValue.amount);
41
40
  };
42
41
  }
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 = {
42
+ const Me = { class: "flex flex-col" }, he = { 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
43
  key: 0,
45
44
  class: "text-fm-color-typo-secondary"
46
45
  }, Pe = {
47
46
  key: 0,
48
47
  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 = {
48
+ }, 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
49
  key: 1,
51
50
  class: "flex flex-col gap-4 pl-8 shrink-0"
52
- }, Be = {
51
+ }, Re = {
53
52
  class: "flex items-center",
54
53
  style: { "pointer-events": "none" }
55
54
  }, Ce = {
56
55
  class: "flex items-center",
57
56
  style: { "pointer-events": "none" }
58
- }, Oe = /* @__PURE__ */ oe({
57
+ }, je = /* @__PURE__ */ oe({
59
58
  __name: "FmUnitInput",
60
- props: /* @__PURE__ */ z({
59
+ props: /* @__PURE__ */ $({
61
60
  modelValue: {},
62
61
  unit: {},
63
62
  rules: {},
@@ -104,113 +103,116 @@ const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { c
104
103
  modelValue: {},
105
104
  modelModifiers: {}
106
105
  }),
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);
106
+ emits: /* @__PURE__ */ $(["update:amount", "update:measurement"], ["update:modelValue"]),
107
+ setup(l, { emit: d }) {
108
+ const t = l, r = d, s = se(l, "modelValue"), F = k(), B = v(() => {
109
+ var n;
110
+ return L(t.unit, (n = s.value) == null ? void 0 : n.measurement);
112
111
  }), 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);
112
+ var o;
113
+ const e = ((o = s.value) == null ? void 0 : o.amount) ?? I.reset(), n = be(e), i = t.formatMinimumPrecision ?? n.precision, a = ye(n, i);
114
+ return h(a);
116
115
  })());
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);
116
+ z(c, (e) => {
117
+ const n = F(e), i = t.precision ?? B.value, o = typeof t.formatMinimumPrecision == "number" && t.formatMinimumPrecision > i ? t.formatMinimumPrecision : i;
118
+ n == !0 && (s.value = {
119
+ ...s.value,
120
+ amount: pe(+e, o)
121
+ }), r("update:amount", e);
123
122
  });
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;
123
+ 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), j = P(!1), Q = v(() => R.value || j.value), X = v(() => {
124
+ var a;
125
+ const i = [...t.unit.measurements.filter((o) => !o.name.toLocaleLowerCase().includes("inactive")).filter((o) => o.abbrev !== t.unit.abbrev || +h(o.conversion) != 1).groupBy(
126
+ (o) => `${o.abbrev}${h(o.conversion)}`
127
+ ).values()].map((o) => o[0]).flat();
126
128
  return [
127
129
  {
128
- label: (e = n.unit) == null ? void 0 : e.abbrev,
130
+ label: (a = t.unit) == null ? void 0 : a.abbrev,
129
131
  value: null
130
132
  },
131
- ...n.unit.measurements.map((t) => ({
132
- label: t.abbrev,
133
- value: t.id
133
+ ...i.map((o) => ({
134
+ label: o.abbrev,
135
+ value: o.id
134
136
  }))
135
137
  ];
136
138
  }), C = v({
137
139
  get() {
138
- var e, t;
139
- return ((t = (e = o.value) == null ? void 0 : e.measurement) == null ? void 0 : t.id) ?? null;
140
+ var e, n;
141
+ return ((n = (e = s.value) == null ? void 0 : e.measurement) == null ? void 0 : n.id) ?? null;
140
142
  },
141
143
  set(e) {
142
144
  if (e == null)
143
- o.value = {
144
- ...o.value ?? E(),
145
+ s.value = {
146
+ ...s.value ?? E(),
145
147
  measurement: null
146
- }, u("update:measurement", null);
148
+ }, r("update:measurement", null);
147
149
  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);
150
+ const n = t.unit.measurements.find((i) => i.id === e) ?? null;
151
+ s.value = {
152
+ ...s.value ?? E(),
153
+ measurement: n
154
+ }, r("update:measurement", n);
153
155
  }
154
156
  }
155
157
  });
156
- T(C, (e, t) => {
158
+ z(C, (e, n) => {
157
159
  var m;
158
- if (!n.convertAmountOnChangeUnit)
160
+ if (!t.convertAmountOnChangeUnit)
159
161
  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({
162
+ 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({
161
163
  value: w,
162
164
  precision: N
163
165
  });
164
- c.value = x(S);
166
+ c.value = h(S);
165
167
  });
166
168
  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
+ var e, n;
170
+ return ((n = (e = s.value) == null ? void 0 : e.measurement) == null ? void 0 : n.abbrev) ?? t.unit.abbrev;
169
171
  }), Y = v(
170
172
  () => {
171
173
  var e;
172
- return ((e = n.rules) == null ? void 0 : e.map(
173
- (t) => (l) => typeof t == "function" ? t(l) : t
174
+ return ((e = t.rules) == null ? void 0 : e.map(
175
+ (n) => (i) => typeof n == "function" ? n(i) : n
174
176
  )) ?? [];
175
177
  }
176
- ), ee = v(() => [...n.applyDefaultRules ? [
178
+ ), ee = v(() => [...t.applyDefaultRules ? [
177
179
  H(),
178
- typeof n.precision == "number" ? G(n.precision) : G(n.unit)
180
+ typeof t.precision == "number" ? G(t.precision) : G(t.unit)
179
181
  ] : [], ...Y.value]);
180
182
  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;
183
+ 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;
182
184
  return p.endsWith(".") ? p.slice(0, p.length - 1) : p;
183
185
  }
184
186
  function te() {
185
- if (!n.stepper)
187
+ if (!t.stepper)
186
188
  return;
187
- const e = +c.value + +x(n.stepper);
189
+ const e = +c.value + +h(t.stepper);
188
190
  c.value = O(e);
189
191
  }
190
192
  function ne() {
191
- if (!n.stepper)
193
+ if (!t.stepper)
192
194
  return;
193
- const e = +c.value - +x(n.stepper);
195
+ const e = +c.value - +h(t.stepper);
194
196
  c.value = O(e);
195
197
  }
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, {
198
+ return (e, n) => {
199
+ const i = b("FmLabel"), a = b("FmIcon"), o = b("FmMenuItem"), p = b("FmMenu"), w = b("FmTooltip"), N = b("FmField"), S = b("FmFormGroup");
200
+ return f(), y("div", Me, [
201
+ u("div", he, [
202
+ u("div", ge, [
203
+ M(i, {
202
204
  label: e.label,
203
205
  disabled: e.disabled,
204
206
  required: e.labelMark === "required",
205
207
  optional: e.labelMark === "optional"
206
208
  }, null, 8, ["label", "disabled", "required", "optional"])
207
209
  ]),
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, [
210
+ M(N, { focused: Q.value }, {
211
+ default: g(() => [
212
+ u("div", xe, [
213
+ T(e.$slots, "prepend"),
214
+ u("div", Fe, [
215
+ u("div", Ae, [
214
216
  e.stepperOnly ? (f(), y("span", {
215
217
  key: 0,
216
218
  class: V({
@@ -218,14 +220,14 @@ const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { c
218
220
  "text-fm-color-typo-primary": !A.value,
219
221
  "text-fm-color-typo-disabled": A.value
220
222
  })
221
- }, g(c.value), 3)) : ie((f(), y("input", {
223
+ }, x(c.value), 3)) : le((f(), y("input", {
222
224
  key: 1,
223
225
  type: "text",
224
226
  ref_key: "inputRef",
225
227
  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),
228
+ onFocus: n[0] || (n[0] = () => R.value = !0),
229
+ onBlur: n[1] || (n[1] = () => R.value = !1),
230
+ "onUpdate:modelValue": n[2] || (n[2] = (m) => c.value = m),
229
231
  class: V({
230
232
  "fm-text-field--input fm-typo-en-body-lg-400": !0,
231
233
  "text-fm-color-typo-primary": !A.value,
@@ -235,31 +237,31 @@ const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { c
235
237
  [ae, c.value]
236
238
  ])
237
239
  ]),
238
- e.separator ? (f(), y("div", _e, g(e.separator), 1)) : W("", !0),
239
- a("div", {
240
+ e.separator ? (f(), y("div", _e, x(e.separator), 1)) : q("", !0),
241
+ u("div", {
240
242
  class: V([e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"])
241
243
  }, [
242
- h(w, { "z-index": 51 }, {
243
- content: M(() => [
244
- ue(g(U.value), 1)
244
+ M(w, { "z-index": 51 }, {
245
+ content: g(() => [
246
+ ue(x(U.value), 1)
245
247
  ]),
246
- default: M(() => [
247
- e.disableUnit ? (f(), y("div", Pe, g(U.value), 1)) : (f(), q(p, {
248
+ default: g(() => [
249
+ e.disableUnit ? (f(), y("div", Pe, x(U.value), 1)) : (f(), W(p, {
248
250
  key: 1,
249
- onMenuChanged: t[3] || (t[3] = (m) => L.value = m),
251
+ onMenuChanged: n[3] || (n[3] = (m) => j.value = m),
250
252
  "z-index": 500,
251
253
  placement: e.placement,
252
254
  disabled: e.disabled
253
255
  }, {
254
- "menu-button": M(() => [
255
- a("div", Ie, [
256
- a("div", ke, g(U.value), 1),
257
- h(r, { name: "keyboard_arrow_down" })
256
+ "menu-button": g(() => [
257
+ u("div", Ie, [
258
+ u("div", ke, x(U.value), 1),
259
+ M(a, { name: "keyboard_arrow_down" })
258
260
  ])
259
261
  ]),
260
- default: M(() => [
261
- a("div", Re, [
262
- (f(!0), y(re, null, me(X.value, (m) => (f(), q(i, {
262
+ default: g(() => [
263
+ u("div", Be, [
264
+ (f(!0), y(re, null, me(X.value, (m) => (f(), W(o, {
263
265
  key: m.value ?? void 0,
264
266
  label: m.label,
265
267
  "model-value": m.value == C.value,
@@ -274,39 +276,39 @@ const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { c
274
276
  })
275
277
  ], 2),
276
278
  e.stepper ? (f(), y("div", De, [
277
- a("div", {
279
+ u("div", {
278
280
  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
281
  onClick: te
280
282
  }, [
281
- a("div", Be, [
282
- h(r, {
283
+ u("div", Re, [
284
+ M(a, {
283
285
  name: "expand_less",
284
286
  size: "md"
285
287
  })
286
288
  ])
287
289
  ]),
288
- a("div", {
290
+ u("div", {
289
291
  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
292
  onClick: ne
291
293
  }, [
292
- a("div", Ce, [
293
- h(r, {
294
+ u("div", Ce, [
295
+ M(a, {
294
296
  name: "expand_more",
295
297
  size: "md"
296
298
  })
297
299
  ])
298
300
  ])
299
- ])) : W("", !0)
301
+ ])) : q("", !0)
300
302
  ]),
301
- $(e.$slots, "append")
303
+ T(e.$slots, "append")
302
304
  ])
303
305
  ]),
304
306
  _: 3
305
307
  }, 8, ["focused"])
306
308
  ]),
307
- h(S, {
309
+ M(S, {
308
310
  class: "flex-1",
309
- "model-value": { modelValue: o.value, amountAsString: String(c.value) },
311
+ "model-value": { modelValue: s.value, amountAsString: String(c.value) },
310
312
  info: e.labelInfo,
311
313
  rules: ee.value,
312
314
  "helper-text": e.helperText,
@@ -317,9 +319,9 @@ const he = { class: "flex flex-col" }, Me = { class: "flex flex-col" }, ge = { c
317
319
  }
318
320
  });
319
321
  export {
320
- Ve as F,
321
- Oe as _,
322
- je as a,
322
+ Se as F,
323
+ je as _,
324
+ Ve as a,
323
325
  Le as b,
324
326
  H as c,
325
327
  G as d