@nxgt/material 3.75.0 → 3.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +37 -1
- package/dist/{alert-dialog-BfO_ri-N.js → alert-dialog-653apk3f.js} +8 -7
- package/dist/{async-slice-roMAJVzG.js → async-slice-CXLbQuOc.js} +1 -1
- package/dist/{bubble-input-B7BVd9fX.js → bubble-input-CQwVSoU3.js} +30 -29
- package/dist/{button-DgenqmpS.js → button-3op3rtZh.js} +5 -4
- package/dist/calculator-BaSMe0SK.js +1189 -0
- package/dist/calculator-announce-DRd2c6Dq.js +89 -0
- package/dist/calculator-context-BugcKuVG.js +10 -0
- package/dist/calculator-field.js +172 -0
- package/dist/calculator-panel-announce-AZSnZUSr.js +29 -0
- package/dist/calculator-segment-BlJE1LaS.js +22 -0
- package/dist/calculator.js +2 -0
- package/dist/charts.js +3 -3
- package/dist/{chip-CiDczNxO.js → chip-MuKDwtkG.js} +2 -2
- package/dist/{code-editor-CohlhFsA.js → code-editor-Bp2RrdNx.js} +13 -13
- package/dist/code-editor.js +37 -37
- package/dist/{code-language-items-Cs8GLYDp.js → code-language-items-B7WR5ua_.js} +19 -24
- package/dist/components/base-content.css +9 -4
- package/dist/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/dist/{components-zJdfH4im.js → components-Ci3Zo8kC.js} +15837 -17245
- package/dist/components.js +37 -28
- package/dist/conversion-variant-BDFAxqe9.js +529 -0
- package/dist/copy-to-clipboard-Be5Ffvs_.js +7 -0
- package/dist/currency-B-r3ig11.js +16 -0
- package/dist/currency-field-BJ9rSrif.js +285 -0
- package/dist/{number.utils-BG_eEt5g.js → date.utils-DUvqcjan.js} +1 -7
- package/dist/dialog-Bm5LvVlB.js +166 -0
- package/dist/dist-BZe2evxL.js +139 -0
- package/dist/dist-CxhKjOYm.js +28 -0
- package/dist/dist-DHdUUM1w.js +241 -0
- package/dist/{dist-C4wtXCjf.js → dist-DOK3zo5C.js} +33 -32
- package/dist/dist-DWZXlCZR.js +182 -0
- package/dist/dist-DkQbkF9T.js +33 -0
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-CzR6JP31.js → dropdown-menu-xlZ6NYUA.js} +160 -159
- package/dist/editor.js +299 -298
- package/dist/{empty-state-DjHGMp5F.js → empty-state-C0kviQdW.js} +2 -2
- package/dist/{field-blur-CdASxjL7.js → field-blur-DkiZOVNV.js} +178 -180
- package/dist/{field-blur-context-kZ4SD7xu.js → field-blur-context-BLGgf_3z.js} +2 -2
- package/dist/financial-variant-BsZEa5sF.js +459 -0
- package/dist/{hooks-Dqq8O3Az.js → hooks-Dg94jPRq.js} +12 -12
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-BPKqte4a.js → hover-card-B1g55Hi6.js} +44 -43
- package/dist/i18n.js +3 -3
- package/dist/icon-badge-BcW66bRk.js +17 -0
- package/dist/{icon-button-Cr-DyDGg.js → icon-button-Cogxy1cy.js} +5 -4
- package/dist/{in-dialog-Vwkyp-M5.js → in-dialog-D61Yeaol.js} +2 -1
- package/dist/input-CC2joTjB.js +56 -0
- package/dist/key-layout-cR79xfGE.js +38 -0
- package/dist/lib/calculator/index.d.ts +16 -0
- package/dist/lib/calculator-field/index.d.ts +12 -0
- package/dist/lib/components/ui/collections/filter/use-filter-field-config.d.ts +2 -2
- package/dist/lib/components/ui/feedback/moment/moment-body.d.ts +17 -2
- package/dist/lib/components/ui/feedback/moment/moment-passive.d.ts +13 -0
- package/dist/lib/components/ui/feedback/moment/moment.d.ts +16 -2
- package/dist/lib/components/ui/fields/calculator-field/apply-calculated.d.ts +17 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-content.d.ts +16 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field-trigger.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.d.ts +12 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-field.types.d.ts +31 -0
- package/dist/lib/components/ui/fields/calculator-field/calculator-form-field.d.ts +4 -0
- package/dist/lib/components/ui/fields/calculator-field/index.d.ts +3 -0
- package/dist/lib/components/ui/fields/calculator-field/use-calculator-field.d.ts +15 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/fields/currency-field/currency-field.d.ts +7 -1
- package/dist/lib/components/ui/layout/app-shell/app-sidebar-context.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-announce.d.ts +27 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-context.d.ts +49 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-feedback.d.ts +18 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-keyboard.d.ts +30 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-storage.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/calculator-variant-steps.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.selectors.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/calculator.slice.d.ts +1881 -0
- package/dist/lib/components/ui/widgets/calculator/currency.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/engine.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/index.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-announcer.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-display.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-key.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-keypad.d.ts +8 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-loading.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-memory.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-announce.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-panel-body.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-screen.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-segment.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-shell.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-switcher.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tape.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/calculator-tools.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/partials/keypad-navigation.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/types.d.ts +102 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-clipboard.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-conversion.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-feedback.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-keyboard.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-persistence.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-pos.d.ts +25 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-press.d.ts +26 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-tape.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-value.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator-variant.d.ts +23 -0
- package/dist/lib/components/ui/widgets/calculator/use-calculator.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/use-engine-settings.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-fields.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-labels.d.ts +17 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-math.d.ts +31 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-names.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-rates.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-result.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-state.d.ts +36 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/conversion-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/conversion/use-conversion.d.ts +24 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-change.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-figures.d.ts +43 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-format.d.ts +12 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan-math.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-loan.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-margin.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-math.d.ts +10 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-panel.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-parts.d.ts +35 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-table.d.ts +7 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/financial/financial-vat.d.ts +4 -0
- package/dist/lib/components/ui/widgets/calculator/variants/key-layout.d.ts +51 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-announce.d.ts +16 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-aside.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-display.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-fields.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-layout.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-line.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-state.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-tender.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.d.ts +41 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-ticket.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-totals.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-types.d.ts +76 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-vat.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/pos/pos-view.d.ts +28 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-announce.d.ts +19 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-base.d.ts +11 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-bitpad.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-display.d.ts +9 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-layout.d.ts +6 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-readouts.d.ts +14 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-reduce.d.ts +29 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-state.d.ts +22 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-toolbar.d.ts +5 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/programmer/programmer-word.d.ts +15 -0
- package/dist/lib/components/ui/widgets/calculator/variants/registry.d.ts +21 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-names.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-toolbar.d.ts +2 -0
- package/dist/lib/components/ui/widgets/calculator/variants/scientific/scientific-variant.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/standard/standard-layout.d.ts +3 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-loader.d.ts +34 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-logic.d.ts +40 -0
- package/dist/lib/components/ui/widgets/calculator/variants/variant-types.d.ts +62 -0
- package/dist/lib/i18n/resources/en/en.d.ts +412 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +412 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +412 -0
- package/dist/lib/i18n/resources/resources.d.ts +824 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +4 -3
- package/dist/main.js +50 -40
- package/dist/map.js +66 -65
- package/dist/material.css +1 -1
- package/dist/native-select-w_FlBLHV.js +40 -0
- package/dist/number.utils-CSueQZcv.js +7 -0
- package/dist/pdf-reader.js +1 -1
- package/dist/percent-field-lahyDJDG.js +14 -0
- package/dist/picker-surface-CV09H7Nb.js +1220 -0
- package/dist/popover-Cd7DkND4.js +233 -0
- package/dist/pos-types-DKCkOTYy.js +49 -0
- package/dist/pos-variant-GrUfbTTP.js +603 -0
- package/dist/print.js +1 -1
- package/dist/programmer-variant-eKJNKENL.js +501 -0
- package/dist/programmer-word-CNCF7DJF.js +15 -0
- package/dist/{public-DC9VQw4Z.js → public-y6g4ddxd.js} +895 -892
- package/dist/{rich-code-block-DBSL9zEN.js → rich-code-block-CRQ0iyLb.js} +5 -5
- package/dist/scientific-variant-2y3UxAAU.js +149 -0
- package/dist/{sortable-provider-C4tk5esY.js → sortable-provider-DdiI3Fwk.js} +2 -2
- package/dist/{spinner-B2MubVWb.js → spinner-C1QIewWv.js} +133 -159
- package/dist/standard-layout-BuSRr3TY.js +40 -0
- package/dist/tabs-DzEqMb1W.js +383 -0
- package/dist/{icon-badge-B9uvDoyY.js → text-field-BAdY-kpO.js} +20 -34
- package/dist/theme-picker.js +3 -3
- package/dist/{theme-toggle-BInlu21G.js → theme-toggle-C_VeiiCm.js} +2 -2
- package/dist/toggle-FeCCJqbg.js +40 -0
- package/dist/{toggle-group-DXXlqid2.js → toggle-group-CVMxEpWi.js} +1 -1
- package/dist/{toolbar-items-CRJSx1MU.js → toolbar-items-D310xDuM.js} +333 -554
- package/dist/{translate-material-pVlPJ1v4.js → translate-material-BypJJ1l5.js} +1 -1
- package/dist/{translator-BoYCward.js → translator-DJkf4J7t.js} +824 -0
- package/dist/{typography-B6YMbCge.js → typography-CYEquVeb.js} +1 -1
- package/dist/{use-chat-composer-BvWQogJe.js → use-chat-composer-DMXu9E1O.js} +4198 -4600
- package/dist/{use-heading-spy-B_Z4ArDh.js → use-heading-spy-DJR8YYm6.js} +19 -19
- package/dist/{use-material-translation-CIS2n3RB.js → use-material-translation-CD6QoVal.js} +1 -1
- package/dist/{use-return-focus-DNQtADAR.js → use-return-focus-Cevw_6yq.js} +106 -105
- package/dist/useLatest-C2PnQEeD.js +8 -0
- package/docs/README.md +1 -0
- package/docs/components/feedback-and-status.md +10 -1
- package/docs/components/form-fields.md +1 -0
- package/docs/components/rich-widgets.md +108 -0
- package/docs/getting-started.md +1 -0
- package/docs/guides/calculator.md +468 -0
- package/docs/guides/forms.md +4 -2
- package/docs/guides/i18n.md +5 -0
- package/docs/previews/rich-widgets-calculator-conversion.webp +0 -0
- package/docs/previews/rich-widgets-calculator-point-of-sale.webp +0 -0
- package/docs/previews/rich-widgets-calculator.webp +0 -0
- package/docs/roadmap.md +9 -3
- package/docs/troubleshooting.md +134 -0
- package/lib/components/base-content.css +9 -4
- package/lib/components/ui/collections/server-table/server-table-phone-row.css +10 -3
- package/lib/components/ui/widgets/calculator/calculator-bands.css +146 -0
- package/lib/components/ui/widgets/calculator/calculator-display.css +83 -0
- package/lib/components/ui/widgets/calculator/calculator-keys.css +118 -0
- package/lib/components/ui/widgets/calculator/calculator-pos-ticket.css +185 -0
- package/lib/components/ui/widgets/calculator/calculator-pos.css +38 -0
- package/lib/components/ui/widgets/calculator/calculator-tape.css +71 -0
- package/lib/components/ui/widgets/calculator/calculator.css +97 -0
- package/lib/components/ui/widgets/calculator/variants/conversion/conversion.css +98 -0
- package/lib/components/ui/widgets/calculator/variants/financial/financial.css +162 -0
- package/lib/components/ui/widgets/calculator/variants/programmer/programmer.css +162 -0
- package/package.json +17 -3
- package/dist/dialog-AGsB3bv4.js +0 -219
- package/dist/dist-B7RjY7SL.js +0 -158
- package/dist/dist-lmHmz_bu.js +0 -419
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { t as e } from "./utils-BLfntITJ.js";
|
|
2
|
+
import { t } from "./use-material-translation-CD6QoVal.js";
|
|
3
|
+
import { t as n } from "./icon-button-Cogxy1cy.js";
|
|
4
|
+
import { n as r } from "./calculator-context-BugcKuVG.js";
|
|
5
|
+
import { a as i, n as a, r as o, t as s } from "./pos-types-DKCkOTYy.js";
|
|
6
|
+
import { i as c, n as l, s as u } from "./key-layout-cR79xfGE.js";
|
|
7
|
+
import { n as d, t as f } from "./currency-B-r3ig11.js";
|
|
8
|
+
import { t as p } from "./calculator-segment-BlJE1LaS.js";
|
|
9
|
+
import { useId as m, useState as h } from "react";
|
|
10
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
|
+
import { ChevronDown as y, X as b } from "lucide-react";
|
|
12
|
+
import { formatDecimal as x, isZero as S, parseDecimal as C, toPlain as w } from "@nxgt/material-core/calculator";
|
|
13
|
+
import { EMPTY_TICKET as T, addLine as ee, billShortcuts as te, computeTotals as E, decimalToMinor as D, enterMinor as O, minorToDecimal as k, setLineDiscount as A, setTicketDiscount as j, settle as M } from "@nxgt/material-core/calculator/pos";
|
|
14
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-ticket-data.ts
|
|
15
|
+
var N = (e, t) => e.kind === "percent" ? { percent: e.value } : { amount: P(k(BigInt(e.value), t.digits), t) }, P = (e, t) => d(e, t.digits);
|
|
16
|
+
function F(e, t, n) {
|
|
17
|
+
return {
|
|
18
|
+
...n.currency ? { currency: n.currency } : {},
|
|
19
|
+
taxInclusive: a(e, n),
|
|
20
|
+
lines: e.lines.map((e, r) => ({
|
|
21
|
+
id: e.id,
|
|
22
|
+
unitPrice: P(k(BigInt(e.price), n.digits), n),
|
|
23
|
+
quantity: e.quantity,
|
|
24
|
+
vatRate: e.rate,
|
|
25
|
+
...e.discount ? { discount: N(e.discount, n) } : {},
|
|
26
|
+
total: P(t.lines[r]?.total ?? k(0n), n)
|
|
27
|
+
})),
|
|
28
|
+
...e.discount ? { discount: N(e.discount, n) } : {},
|
|
29
|
+
totals: {
|
|
30
|
+
subtotal: P(t.subtotal, n),
|
|
31
|
+
discount: P(t.discountTotal, n),
|
|
32
|
+
vatByRate: t.vat.map((e) => ({
|
|
33
|
+
rate: w(e.rate),
|
|
34
|
+
base: P(e.base, n),
|
|
35
|
+
vat: P(e.vat, n)
|
|
36
|
+
})),
|
|
37
|
+
total: P(t.total, n)
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-view.ts
|
|
43
|
+
var I = (e, t) => e.kind === "percent" ? { percent: e.value } : { amount: w(k(BigInt(e.value), t)) };
|
|
44
|
+
function L(e, t) {
|
|
45
|
+
let n = T;
|
|
46
|
+
for (let r of e.lines) n = ee(n, {
|
|
47
|
+
id: r.id,
|
|
48
|
+
unitPrice: w(k(BigInt(r.price), t)),
|
|
49
|
+
quantity: r.quantity,
|
|
50
|
+
vatRate: r.rate
|
|
51
|
+
}), r.discount && (n = A(n, r.id, I(r.discount, t)));
|
|
52
|
+
return e.discount ? j(n, I(e.discount, t)) : n;
|
|
53
|
+
}
|
|
54
|
+
function R(e, t, n, r) {
|
|
55
|
+
let i = a(e, t), o = E(L(e, t.digits), {
|
|
56
|
+
taxInclusive: i,
|
|
57
|
+
digits: t.digits
|
|
58
|
+
}), s = BigInt(e.tendered), c = s > 0n ? M(o.total, k(s, t.digits)) : null, l = e.lines.length > 0;
|
|
59
|
+
return {
|
|
60
|
+
ticket: F(e, o, t),
|
|
61
|
+
totals: o,
|
|
62
|
+
settlement: c,
|
|
63
|
+
shortcuts: l ? te(o.total, n, { limit: 3 }) : [],
|
|
64
|
+
money: (e) => x(e, {
|
|
65
|
+
locale: r,
|
|
66
|
+
fractionDigits: t.digits
|
|
67
|
+
}),
|
|
68
|
+
withCode: (e) => f(e, {
|
|
69
|
+
locale: r,
|
|
70
|
+
currency: t.currency,
|
|
71
|
+
digits: t.digits
|
|
72
|
+
}),
|
|
73
|
+
number: (e) => x(e, { locale: r }),
|
|
74
|
+
total: d(o.total, t.digits),
|
|
75
|
+
canCharge: l && c?.status !== "short"
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function z(e, t, n) {
|
|
79
|
+
let r = (e) => n.money(k(BigInt(e), t.digits));
|
|
80
|
+
switch (e.field) {
|
|
81
|
+
case "quantity": return `× ${e.quantity}`;
|
|
82
|
+
case "discount": return e.kind === "percent" ? `− ${e.entry} %` : `− ${r(e.entry)}`;
|
|
83
|
+
case "tender": return r(e.tendered);
|
|
84
|
+
default: return r(e.price);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-announce.ts
|
|
89
|
+
function B(e, t, n) {
|
|
90
|
+
let { settlement: r, withCode: i } = R(e, t, n.denominations, n.locale);
|
|
91
|
+
return r ? r.status === "paid" ? {
|
|
92
|
+
key: "material.calculator.pos.announce.change",
|
|
93
|
+
fallback: "Change {change}",
|
|
94
|
+
values: { change: i(r.change) }
|
|
95
|
+
} : {
|
|
96
|
+
key: "material.calculator.pos.announce.due",
|
|
97
|
+
fallback: "{due} still due",
|
|
98
|
+
values: { due: i(r.due) }
|
|
99
|
+
} : null;
|
|
100
|
+
}
|
|
101
|
+
var V = (e, t, n) => {
|
|
102
|
+
let { totals: r, withCode: i } = R(e, t, n.denominations, n.locale);
|
|
103
|
+
return {
|
|
104
|
+
key: "material.calculator.pos.announce.total",
|
|
105
|
+
fallback: "Total {total}",
|
|
106
|
+
values: { total: i(r.total) }
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
function ne(e, t, n, r, i) {
|
|
110
|
+
switch (n.type) {
|
|
111
|
+
case "remove":
|
|
112
|
+
case "remove-discount": return V(t, r, i);
|
|
113
|
+
case "charged": {
|
|
114
|
+
let { totals: t, withCode: n } = R(e, r, i.denominations, i.locale);
|
|
115
|
+
return {
|
|
116
|
+
key: "material.calculator.pos.announce.charged",
|
|
117
|
+
fallback: "Charged {total}",
|
|
118
|
+
values: { total: n(t.total) }
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
case "tender": return B(t, r, i);
|
|
122
|
+
case "key": return n.key === "=" ? e.field === "tender" ? B(t, r, i) : t.lines.length !== e.lines.length || t.discount !== e.discount ? V(t, r, i) : null : null;
|
|
123
|
+
default: return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-tender.tsx
|
|
128
|
+
function H() {
|
|
129
|
+
let { t: e } = t(), { pos: n, state: i } = r(), { view: a, env: o, props: s } = n;
|
|
130
|
+
if (!a || i.pos.lines.length === 0) return null;
|
|
131
|
+
let { settlement: c, money: l, shortcuts: u } = a, d = c?.status === "paid" ? e("material.calculator.pos.tender.change", "Change {change}", { change: l(c.change) }) : c ? e("material.calculator.pos.tender.due", "{due} still due", { due: l(c.due) }) : "";
|
|
132
|
+
return /* @__PURE__ */ v("div", {
|
|
133
|
+
"data-slot": "pos-tender",
|
|
134
|
+
className: "nxgt-pos-tender",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ _("div", {
|
|
137
|
+
role: "group",
|
|
138
|
+
"aria-label": e("material.calculator.pos.tender.label", "Tendered"),
|
|
139
|
+
className: "nxgt-pos-bills",
|
|
140
|
+
children: u.map((e) => /* @__PURE__ */ _("button", {
|
|
141
|
+
type: "button",
|
|
142
|
+
"data-slot": "pos-bill",
|
|
143
|
+
className: "nxgt-pos-bill",
|
|
144
|
+
onClick: () => n.dispatch({
|
|
145
|
+
type: "tender",
|
|
146
|
+
amount: D(e, o.digits).toString()
|
|
147
|
+
}),
|
|
148
|
+
children: l(e)
|
|
149
|
+
}, `${e.c}e${e.e}`))
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ _("p", {
|
|
152
|
+
"data-slot": "pos-settlement",
|
|
153
|
+
"data-status": c?.status,
|
|
154
|
+
className: "nxgt-pos-settlement",
|
|
155
|
+
children: d || "\xA0"
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ v("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
className: "nxgt-pos-charge",
|
|
160
|
+
"data-slot": "pos-charge",
|
|
161
|
+
disabled: !a.canCharge,
|
|
162
|
+
onClick: () => {
|
|
163
|
+
s.onCharge?.(a.total, a.ticket), n.dispatch({ type: "charged" });
|
|
164
|
+
},
|
|
165
|
+
children: [e("material.calculator.pos.charge", "Charge"), ` ${a.withCode(a.totals.total)}`]
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-line.tsx
|
|
172
|
+
function U({ line: e, index: i }) {
|
|
173
|
+
let { t: a } = t(), { pos: o } = r(), { view: s, env: c } = o;
|
|
174
|
+
if (!s) return null;
|
|
175
|
+
let l = a("material.calculator.pos.ticket.item", "Item {n}", { n: e.id.replace("line-", "") }), u = s.money(k(BigInt(e.price), c.digits)), d = s.totals.lines[i]?.total;
|
|
176
|
+
return /* @__PURE__ */ v("li", {
|
|
177
|
+
"data-slot": "pos-line",
|
|
178
|
+
className: "nxgt-pos-line",
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ v("span", {
|
|
181
|
+
className: "nxgt-pos-line-name",
|
|
182
|
+
children: [l, /* @__PURE__ */ _("small", { children: `${e.quantity} × ${u}` })]
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ _("span", {
|
|
185
|
+
className: "nxgt-pos-amount",
|
|
186
|
+
children: d ? s.money(d) : ""
|
|
187
|
+
}),
|
|
188
|
+
/* @__PURE__ */ _(n, {
|
|
189
|
+
size: "sm",
|
|
190
|
+
variant: "ghost",
|
|
191
|
+
className: "nxgt-calc-tool",
|
|
192
|
+
"aria-label": a("material.calculator.pos.ticket.remove", "Remove {name}", { name: l }),
|
|
193
|
+
onClick: () => o.dispatch({
|
|
194
|
+
type: "remove",
|
|
195
|
+
id: e.id
|
|
196
|
+
}),
|
|
197
|
+
children: /* @__PURE__ */ _(b, {})
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-totals.tsx
|
|
204
|
+
function W() {
|
|
205
|
+
let { t: e } = t(), { pos: i, state: a } = r(), { view: o } = i;
|
|
206
|
+
if (!o || a.pos.lines.length === 0) return null;
|
|
207
|
+
let { totals: s, money: c } = o, l = !S(s.discountTotal), u = (e, t, n, r) => /* @__PURE__ */ v("div", {
|
|
208
|
+
className: "nxgt-pos-row",
|
|
209
|
+
"data-row": r ?? e,
|
|
210
|
+
children: [/* @__PURE__ */ _("dt", { children: t }), /* @__PURE__ */ _("dd", { children: n })]
|
|
211
|
+
}, e);
|
|
212
|
+
return /* @__PURE__ */ v("dl", {
|
|
213
|
+
"data-slot": "pos-totals",
|
|
214
|
+
className: "nxgt-pos-totals",
|
|
215
|
+
children: [
|
|
216
|
+
l ? u("subtotal", e("material.calculator.pos.totals.subtotal", "Subtotal"), c(s.subtotal)) : null,
|
|
217
|
+
l ? /* @__PURE__ */ v("div", {
|
|
218
|
+
className: "nxgt-pos-row",
|
|
219
|
+
"data-row": "discount",
|
|
220
|
+
children: [/* @__PURE__ */ _("dt", { children: e("material.calculator.pos.totals.discount", "Discount") }), /* @__PURE__ */ v("dd", { children: [`− ${c(s.discountTotal)}`, a.pos.discount ? /* @__PURE__ */ _(n, {
|
|
221
|
+
size: "sm",
|
|
222
|
+
variant: "ghost",
|
|
223
|
+
className: "nxgt-calc-tool",
|
|
224
|
+
"aria-label": e("material.calculator.pos.totals.remove-discount", "Remove the ticket discount"),
|
|
225
|
+
onClick: () => i.dispatch({ type: "remove-discount" }),
|
|
226
|
+
children: /* @__PURE__ */ _(b, {})
|
|
227
|
+
}) : null] })]
|
|
228
|
+
}) : null,
|
|
229
|
+
s.vat.filter((e) => !S(e.rate)).map((t) => u(`vat-${t.rate.c}e${t.rate.e}`, e("material.calculator.pos.totals.vat", "VAT {rate} %", { rate: o.number(t.rate) }), c(t.vat), "vat")),
|
|
230
|
+
u("total", e("material.calculator.pos.totals.total", "Total"), c(s.total))
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-ticket.tsx
|
|
236
|
+
function G() {
|
|
237
|
+
let { t: n } = t(), { pos: i, state: a } = r(), [o, s] = h(!0), c = m(), { view: l } = i;
|
|
238
|
+
if (!l) return null;
|
|
239
|
+
let { lines: u } = a.pos;
|
|
240
|
+
return /* @__PURE__ */ v("section", {
|
|
241
|
+
"data-slot": "pos-ticket",
|
|
242
|
+
"data-collapsed": o ? void 0 : "",
|
|
243
|
+
"aria-label": n("material.calculator.pos.ticket.title", "Ticket"),
|
|
244
|
+
className: "nxgt-pos-ticket bg-muted",
|
|
245
|
+
children: [/* @__PURE__ */ v("div", {
|
|
246
|
+
className: "nxgt-pos-ticket-head",
|
|
247
|
+
children: [/* @__PURE__ */ v("h3", {
|
|
248
|
+
className: "nxgt-pos-heading",
|
|
249
|
+
children: [n("material.calculator.pos.ticket.title", "Ticket"), /* @__PURE__ */ _("span", {
|
|
250
|
+
className: "nxgt-pos-count",
|
|
251
|
+
children: u.length
|
|
252
|
+
})]
|
|
253
|
+
}), /* @__PURE__ */ _("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
"aria-expanded": o,
|
|
256
|
+
"aria-controls": c,
|
|
257
|
+
"aria-label": o ? n("material.calculator.pos.ticket.hide", "Hide the ticket") : n("material.calculator.pos.ticket.show", "Show the ticket"),
|
|
258
|
+
className: "nxgt-pos-fold nxgt-calc-tool",
|
|
259
|
+
onClick: () => s(!o),
|
|
260
|
+
children: /* @__PURE__ */ _(y, {
|
|
261
|
+
"aria-hidden": "true",
|
|
262
|
+
className: e(o && "rotate-180")
|
|
263
|
+
})
|
|
264
|
+
})]
|
|
265
|
+
}), /* @__PURE__ */ v("div", {
|
|
266
|
+
id: c,
|
|
267
|
+
className: "nxgt-pos-ticket-body",
|
|
268
|
+
children: [u.length === 0 ? /* @__PURE__ */ _("p", {
|
|
269
|
+
className: "nxgt-pos-empty",
|
|
270
|
+
children: n("material.calculator.pos.ticket.empty", "No items yet")
|
|
271
|
+
}) : /* @__PURE__ */ _("ul", {
|
|
272
|
+
className: "nxgt-pos-lines",
|
|
273
|
+
children: u.map((e, t) => /* @__PURE__ */ _(U, {
|
|
274
|
+
line: e,
|
|
275
|
+
index: t
|
|
276
|
+
}, e.id))
|
|
277
|
+
}), /* @__PURE__ */ _(W, {})]
|
|
278
|
+
})]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-aside.tsx
|
|
283
|
+
function K() {
|
|
284
|
+
return /* @__PURE__ */ v("div", {
|
|
285
|
+
className: "nxgt-pos-side",
|
|
286
|
+
children: [/* @__PURE__ */ _(G, {}), /* @__PURE__ */ _(H, {})]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-display.tsx
|
|
291
|
+
function q() {
|
|
292
|
+
let { t: e } = t(), { pos: n, state: a } = r(), { view: o, env: s } = n;
|
|
293
|
+
if (!o) return null;
|
|
294
|
+
let c = z(a.pos, s, o);
|
|
295
|
+
return /* @__PURE__ */ v("div", {
|
|
296
|
+
role: "group",
|
|
297
|
+
tabIndex: -1,
|
|
298
|
+
"aria-label": e("material.calculator.display.label", "Display"),
|
|
299
|
+
dir: "ltr",
|
|
300
|
+
"data-slot": "calculator-display",
|
|
301
|
+
className: "nxgt-calc-display nxgt-pos-display bg-muted",
|
|
302
|
+
children: [/* @__PURE__ */ v("p", {
|
|
303
|
+
"data-slot": "pos-total",
|
|
304
|
+
className: "nxgt-calc-expression nxgt-pos-total",
|
|
305
|
+
children: [
|
|
306
|
+
/* @__PURE__ */ _("span", { children: e("material.calculator.pos.totals.total", "Total") }),
|
|
307
|
+
/* @__PURE__ */ _("strong", { children: o.money(o.totals.total) }),
|
|
308
|
+
s.currency ? /* @__PURE__ */ _("span", { children: s.currency }) : null
|
|
309
|
+
]
|
|
310
|
+
}), /* @__PURE__ */ _("output", {
|
|
311
|
+
"aria-live": "off",
|
|
312
|
+
"data-slot": "calculator-result",
|
|
313
|
+
"data-field": a.pos.field,
|
|
314
|
+
"data-size": i(c),
|
|
315
|
+
className: "nxgt-calc-result",
|
|
316
|
+
children: /* @__PURE__ */ _("span", {
|
|
317
|
+
className: "nxgt-calc-swap",
|
|
318
|
+
children: c
|
|
319
|
+
}, c)
|
|
320
|
+
})]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-vat.tsx
|
|
325
|
+
function J() {
|
|
326
|
+
let { t: e } = t(), { pos: n, state: i } = r(), { env: s } = n;
|
|
327
|
+
if (s.rates.length === 0) return null;
|
|
328
|
+
let c = s.rates.map((t) => {
|
|
329
|
+
let r = C(t), i = e("material.calculator.pos.vat.rate", "{rate} %", { rate: r ? x(r, { locale: n.format.locale }) : t });
|
|
330
|
+
return {
|
|
331
|
+
id: t,
|
|
332
|
+
name: i,
|
|
333
|
+
glyph: i,
|
|
334
|
+
spoken: i
|
|
335
|
+
};
|
|
336
|
+
}), l = [{
|
|
337
|
+
id: "vat",
|
|
338
|
+
name: "Incl. VAT",
|
|
339
|
+
glyph: e("material.calculator.pos.vat.included", "Incl. VAT"),
|
|
340
|
+
spoken: e("material.calculator.pos.vat.included-name", "Prices include VAT")
|
|
341
|
+
}, {
|
|
342
|
+
id: "none",
|
|
343
|
+
name: "Excl. VAT",
|
|
344
|
+
glyph: e("material.calculator.pos.vat.excluded", "Excl. VAT"),
|
|
345
|
+
spoken: e("material.calculator.pos.vat.excluded-name", "Prices exclude VAT")
|
|
346
|
+
}];
|
|
347
|
+
return /* @__PURE__ */ v(g, { children: [c.length > 1 ? /* @__PURE__ */ _(p, {
|
|
348
|
+
label: e("material.calculator.pos.vat.label", "VAT rate"),
|
|
349
|
+
choices: c,
|
|
350
|
+
value: o(i.pos, s),
|
|
351
|
+
onChange: (e) => n.dispatch({
|
|
352
|
+
type: "rate",
|
|
353
|
+
rate: e
|
|
354
|
+
})
|
|
355
|
+
}) : null, /* @__PURE__ */ _(p, {
|
|
356
|
+
label: e("material.calculator.pos.vat.prices", "Prices"),
|
|
357
|
+
choices: l,
|
|
358
|
+
value: a(i.pos, s) ? "vat" : "none",
|
|
359
|
+
onChange: (e) => n.dispatch({
|
|
360
|
+
type: "inclusive",
|
|
361
|
+
on: e === "vat"
|
|
362
|
+
})
|
|
363
|
+
})] });
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-fields.tsx
|
|
367
|
+
var Y = [
|
|
368
|
+
{
|
|
369
|
+
id: "price",
|
|
370
|
+
name: "Price"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
id: "quantity",
|
|
374
|
+
name: "Quantity"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: "discount",
|
|
378
|
+
name: "Discount"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
id: "tender",
|
|
382
|
+
name: "Tendered"
|
|
383
|
+
}
|
|
384
|
+
], X = [{
|
|
385
|
+
id: "percent",
|
|
386
|
+
glyph: "%",
|
|
387
|
+
name: "Percent"
|
|
388
|
+
}, {
|
|
389
|
+
id: "amount",
|
|
390
|
+
glyph: "−",
|
|
391
|
+
name: "Amount"
|
|
392
|
+
}];
|
|
393
|
+
function Z() {
|
|
394
|
+
let { t: e } = t(), { pos: n, state: i } = r(), a = i.pos.lines.length > 0, o = Y.filter((e) => e.id !== "tender" || a).map(({ id: t, name: n }) => {
|
|
395
|
+
let r = e(`material.calculator.pos.field.${t}`, n);
|
|
396
|
+
return {
|
|
397
|
+
id: t,
|
|
398
|
+
name: n,
|
|
399
|
+
glyph: r,
|
|
400
|
+
spoken: r
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
return /* @__PURE__ */ v("div", {
|
|
404
|
+
"data-slot": "pos-fields",
|
|
405
|
+
className: "nxgt-calc-toolbar nxgt-pos-fields",
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ _(p, {
|
|
408
|
+
label: e("material.calculator.pos.field.label", "Typing into"),
|
|
409
|
+
choices: o,
|
|
410
|
+
value: i.pos.field,
|
|
411
|
+
onChange: (e) => n.dispatch({
|
|
412
|
+
type: "field",
|
|
413
|
+
field: e
|
|
414
|
+
})
|
|
415
|
+
}),
|
|
416
|
+
i.pos.field === "discount" ? /* @__PURE__ */ _(p, {
|
|
417
|
+
label: e("material.calculator.pos.discount.label", "Discount type"),
|
|
418
|
+
choices: X.map((t) => ({
|
|
419
|
+
...t,
|
|
420
|
+
spoken: e(`material.calculator.pos.discount.${t.id}`, t.name)
|
|
421
|
+
})),
|
|
422
|
+
value: i.pos.kind,
|
|
423
|
+
onChange: (e) => n.dispatch({
|
|
424
|
+
type: "kind",
|
|
425
|
+
kind: e
|
|
426
|
+
})
|
|
427
|
+
}) : null,
|
|
428
|
+
/* @__PURE__ */ _(J, {})
|
|
429
|
+
]
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-layout.ts
|
|
434
|
+
var re = {
|
|
435
|
+
columns: 12,
|
|
436
|
+
rows: [
|
|
437
|
+
u([
|
|
438
|
+
l(7),
|
|
439
|
+
l(8),
|
|
440
|
+
l(9),
|
|
441
|
+
c("backspace", "backspace", "⌫", "utility", "backspace", "Delete last digit")
|
|
442
|
+
]),
|
|
443
|
+
u([
|
|
444
|
+
l(4),
|
|
445
|
+
l(5),
|
|
446
|
+
l(6),
|
|
447
|
+
c("clear", "C", "C", "utility", "clear", "Clear the amount")
|
|
448
|
+
]),
|
|
449
|
+
u([
|
|
450
|
+
l(1),
|
|
451
|
+
l(2),
|
|
452
|
+
l(3),
|
|
453
|
+
c("quantity", "*", "×", "operator", "quantity", "Enter a quantity")
|
|
454
|
+
]),
|
|
455
|
+
u([
|
|
456
|
+
c("double-zero", "00", "00", "digit", "double-zero", "Double zero"),
|
|
457
|
+
l(0),
|
|
458
|
+
c("discount", "%", "%", "operator", "discount", "Enter a discount"),
|
|
459
|
+
c("add-line", "=", "+", "equals", "add-line", "Add to ticket")
|
|
460
|
+
])
|
|
461
|
+
]
|
|
462
|
+
}, ie = [], ae = 6, oe = 3, se = /* @__PURE__ */ new Set([
|
|
463
|
+
"00",
|
|
464
|
+
"backspace",
|
|
465
|
+
"C"
|
|
466
|
+
]);
|
|
467
|
+
function Q(e, t) {
|
|
468
|
+
let n = t === "C" ? "clear" : /^\d$/.test(t) || se.has(t) ? t : null;
|
|
469
|
+
if (!n) return e;
|
|
470
|
+
let r = (e, t) => O(BigInt(e), n, t).toString();
|
|
471
|
+
switch (e.field) {
|
|
472
|
+
case "price": return {
|
|
473
|
+
...e,
|
|
474
|
+
price: r(e.price)
|
|
475
|
+
};
|
|
476
|
+
case "tender": return {
|
|
477
|
+
...e,
|
|
478
|
+
tendered: r(e.tendered)
|
|
479
|
+
};
|
|
480
|
+
case "quantity": return {
|
|
481
|
+
...e,
|
|
482
|
+
fresh: !1,
|
|
483
|
+
quantity: r(e.fresh ? "0" : e.quantity, ae)
|
|
484
|
+
};
|
|
485
|
+
default: return {
|
|
486
|
+
...e,
|
|
487
|
+
entry: r(e.entry, e.kind === "percent" ? oe : void 0)
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function ce(e) {
|
|
492
|
+
if (BigInt(e.entry) === 0n) return;
|
|
493
|
+
let t = e.kind === "percent" && BigInt(e.entry) > 100n ? "100" : e.entry;
|
|
494
|
+
return {
|
|
495
|
+
kind: e.kind,
|
|
496
|
+
value: t
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
var $ = (e) => ({
|
|
500
|
+
...e,
|
|
501
|
+
field: "price",
|
|
502
|
+
price: "0",
|
|
503
|
+
quantity: "1",
|
|
504
|
+
fresh: !1,
|
|
505
|
+
entry: "0"
|
|
506
|
+
});
|
|
507
|
+
function le(e, t) {
|
|
508
|
+
if (e.field === "tender") return e;
|
|
509
|
+
let n = ce(e);
|
|
510
|
+
if (BigInt(e.price) === 0n) return !n || e.lines.length === 0 ? e : {
|
|
511
|
+
...$(e),
|
|
512
|
+
discount: n
|
|
513
|
+
};
|
|
514
|
+
let r = BigInt(e.quantity) === 0n ? "1" : e.quantity, i = {
|
|
515
|
+
id: `line-${e.next}`,
|
|
516
|
+
price: e.price,
|
|
517
|
+
quantity: r,
|
|
518
|
+
rate: o(e, t),
|
|
519
|
+
...n ? { discount: n } : {}
|
|
520
|
+
};
|
|
521
|
+
return {
|
|
522
|
+
...$(e),
|
|
523
|
+
lines: [...e.lines, i],
|
|
524
|
+
next: e.next + 1
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function ue(e, t, n) {
|
|
528
|
+
return t === "*" ? {
|
|
529
|
+
...e,
|
|
530
|
+
field: e.field === "quantity" ? "price" : "quantity",
|
|
531
|
+
fresh: !0
|
|
532
|
+
} : t === "%" ? {
|
|
533
|
+
...e,
|
|
534
|
+
field: e.field === "discount" ? "price" : "discount"
|
|
535
|
+
} : t === "=" ? le(e, n) : Q(e, t);
|
|
536
|
+
}
|
|
537
|
+
function de(e, t, n) {
|
|
538
|
+
switch (t.type) {
|
|
539
|
+
case "key": return ue(e, t.key, n);
|
|
540
|
+
case "field": return {
|
|
541
|
+
...e,
|
|
542
|
+
field: t.field,
|
|
543
|
+
fresh: t.field === "quantity"
|
|
544
|
+
};
|
|
545
|
+
case "kind": return {
|
|
546
|
+
...e,
|
|
547
|
+
kind: t.kind,
|
|
548
|
+
entry: "0"
|
|
549
|
+
};
|
|
550
|
+
case "rate": return {
|
|
551
|
+
...e,
|
|
552
|
+
rate: t.rate
|
|
553
|
+
};
|
|
554
|
+
case "inclusive": return {
|
|
555
|
+
...e,
|
|
556
|
+
inclusive: t.on
|
|
557
|
+
};
|
|
558
|
+
case "remove": {
|
|
559
|
+
let n = e.lines.filter((e) => e.id !== t.id), r = n.length === 0;
|
|
560
|
+
return {
|
|
561
|
+
...e,
|
|
562
|
+
lines: n,
|
|
563
|
+
...r ? {
|
|
564
|
+
tendered: "0",
|
|
565
|
+
field: e.field === "tender" ? "price" : e.field
|
|
566
|
+
} : {}
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
case "remove-discount": {
|
|
570
|
+
let { discount: t, ...n } = e;
|
|
571
|
+
return n;
|
|
572
|
+
}
|
|
573
|
+
case "tender": return {
|
|
574
|
+
...e,
|
|
575
|
+
tendered: t.amount,
|
|
576
|
+
field: "tender"
|
|
577
|
+
};
|
|
578
|
+
default: return {
|
|
579
|
+
...s,
|
|
580
|
+
rate: e.rate,
|
|
581
|
+
inclusive: e.inclusive,
|
|
582
|
+
next: e.next
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
//#endregion
|
|
587
|
+
//#region lib/components/ui/widgets/calculator/variants/pos/pos-variant.ts
|
|
588
|
+
var fe = {
|
|
589
|
+
part: {
|
|
590
|
+
layout: re,
|
|
591
|
+
extraKeys: ie,
|
|
592
|
+
display: q,
|
|
593
|
+
toolbar: Z,
|
|
594
|
+
aside: K
|
|
595
|
+
},
|
|
596
|
+
logic: {
|
|
597
|
+
reducePos: de,
|
|
598
|
+
announcePos: ne,
|
|
599
|
+
selectPos: R
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
//#endregion
|
|
603
|
+
export { fe as variant };
|
package/dist/print.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, t } from "./translate-material-
|
|
1
|
+
import { i as e, t } from "./translate-material-BypJJ1l5.js";
|
|
2
2
|
import { Children as n, createContext as r, isValidElement as i, useCallback as a, useContext as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
3
3
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
4
|
import { resolvePdfFileName as f } from "@nxgt/material-core/pdf-file-name";
|