UNPKG

@octavianlab/olab-ui

Version:
216 lines (215 loc) 6.57 kB
import { c as D, i as P, m as i, e as y } from "./vendor-55459b0e.js"; import { reactive as x } from "vue"; import { f as h } from "./oprogressbar-4b49da46.js"; import { O as tt } from "./oprogressbar-4b49da46.js"; import { d as b } from "./ocalendar/ocalendar-6c5efede.js"; import { O as ot } from "./ocalendar/ocalendar-6c5efede.js"; import { O as st, u as it } from "./okeycloak/okeycloakloginbutton-1e392998.js"; import { O as nt } from "./ofield-3e4130b0.js"; import { O as ct } from "./ofieldscontainer-907bcbcd.js"; import { O as mt } from "./ocard-e054337e.js"; import { O as pt } from "./ochart-9c70aa12.js"; import { O as dt } from "./odialog-026c1444.js"; import { O as xt } from "./odialogexport-b6e3ec97.js"; import { O as bt } from "./odialogotp-260555ee.js"; import { O as St } from "./odropdown-5c24d61f.js"; import { O as wt } from "./opanelwrapper-b53bfcc5.js"; import { O as Pt } from "./oinputotp-42710905.js"; import { O as zt } from "./olist-4e53592a.js"; import { _ as Tt } from "./olottie-09ebb51f.js"; import { O as Lt } from "./otable-4bbb1c3e.js"; import { O as Nt } from "./ofilterspanel/ofilter-ac4aa31a.js"; import { O as Ct } from "./ofilterspanel/ofilterspanel-fa068416.js"; import { O as Rt } from "./opassword-b5666f45.js"; import { O as Xt } from "./odraggable-561e5d9b.js"; import { O as Ht } from "./obannerbrowsersupport-8a97766f.js"; import { O as Yt } from "./okeycloak/okeycloaktokenexpired-5f35d211.js"; import { O as Kt } from "./obulkoperationui-f227d3a6.js"; import "moment"; import "./ocalendar/ocalendarbuttons-72b21776.js"; import "./ocalendar/ocalendarcustombuttons-c1d462cb.js"; import "chart.js"; import "./opagesettingapi-4ef67f0a.js"; import "./opagesettingstore-e7152f96.js"; import "qrcode-vue3"; import "axios"; import "./ofilterspanel/odialogstoredsearches-3a8c38bb.js"; import "./ofilterspanel/ofilterspanelbtnsearch-d44d126b.js"; const I = () => { const t = D(); return t.use(P), t; }, m = x({ arr: [], start(t = (/* @__PURE__ */ new Date()).getTime()) { return this.arr.push(t), t; }, stopAll() { this.arr = []; }, stop(t) { if (!t) { this.arr = []; return; } this.arr = this.arr.filter((o) => o !== t); }, isLoading(t) { return this.arr.includes(t); }, // Controlla se un qualsiasi loading è presente nell'array. isLoadingLength() { return this.arr.length > 0; } }), S = { install(t) { t.config.globalProperties.$loading = m; }, loading: m }, u = x({ id: null, data: {}, mode: null, step: 0, isVisible(t) { return this.id === t.toLowerCase(); }, open(t, o = {}, r = null, e = 0) { this.id = t.toLowerCase(), this.data = o, this.mode = r, this.step = e, console.info( `INFO: $modal.open() => you are trying to open a modal with a name: %c${t}`, "color:#0086b3" ); }, close() { this.id = null, this.data = {}, this.mode = null, this.step = 0; } }), $ = { install(t) { t.config.globalProperties.$modal = u; }, modal: u }, p = localStorage.getItem("site"); function z(t, o = "DD/MM/YYYY HH:mm:ss") { const e = (localStorage.getItem(`olab-ui-${p}:utils`) ? JSON.parse(localStorage.getItem(`olab-ui-${p}:utils`)) : {}).timezone; if (t) { const s = i.utc(t).toDate(); if (e && e !== i.tz.guess()) return i.tz(s, e).format(o); const a = i(s).local(); return a.format(o), a.format(o); } return ""; } const g = localStorage.getItem("site"); function F(t, o = !0) { const e = (localStorage.getItem(`olab-ui-${g}:utils`) ? JSON.parse(localStorage.getItem(`olab-ui-${g}:utils`)) : {}).timezone; if (!t) return null; if (e && e !== i.tz.guess()) { const s = (w) => +w.split(":")[0], a = s(i(t).tz(i.tz.guess()).format("Z")), l = s(i(t).tz(e).format("Z")), n = a - l; return b.methods.addPeriod(t, o ? -n : +n, "hours").toDate(); } return i(t).toDate(); } const d = localStorage.getItem("site"); let c = []; var O; localStorage.getItem(`octavianlab-${d}-admin`) && (c = ((O = JSON.parse(localStorage.getItem(`octavianlab-${d}-admin`)).currency) == null ? void 0 : O.list) || []); function T(t, o = "EUR", r = !1) { let e = o; isNaN(parseInt(e)) || (e = "XXX"), e.length !== 3 && (e = "XXX"); let s; if (c.length > 0) { const n = c.find((f) => f.id === e); s = n ? n.precision || n.valuePrecision || n.fractions : "EUR"; } else s = 2; if (t == null) return ""; let a, l; switch (e) { case "PTS": return `${t} ${e}`; default: return l = new Intl.NumberFormat("it-IT", { style: "currency", currency: e }), a = parseFloat(t) / Math.pow(10, s), r === !0 ? a.toFixed(s) : l.format(a.toFixed(s)); } } function k(t, o = "EUR") { let r; switch (o) { case "EUR": r = 2; break; case "RUB": r = 0; break; default: r = 2; break; } if (t === null || t === void 0) return null; let e = parseFloat(t) * Math.pow(10, r); return parseInt(e); } function L(t) { if (t < 0) return "0:00"; const r = parseInt(t / 60), e = parseInt(t % 60) + ""; return r + ":" + (e.length == 1 ? "0" + e : e); } function M(t, o = 2) { let r; return t ? r = Math.pow(10, -o) * t : r = 0, `${r} %`; } y(I()); const W = () => h.methods, _ = () => $.modal, q = () => S.loading, G = { install: (t, o) => { if (!o.fxTranslate) { console.warn("Please pass to the options a translate function: fxTranslate"); return; } localStorage.getItem("site") || console.warn( "Script with site name is missing, info here: https://wiki.octavianlab.com/it/devs/backoffice-agp" ), t.use(I()), t.use(S), t.use($), (o.installMixins === void 0 || o.installMixins === !0) && (t.mixin(h), t.mixin(b)), t.config.globalProperties.$translate = o.fxTranslate, t.config.globalProperties.$filters = { asDate: z, toJSDate: F, asAmount: T, asHHmm: L, toAmount: k, asPercentage: M }; } }; export { Ht as OBannerBrowserSupport, Kt as OBulkOperationUI, ot as OCalendar, mt as OCard, pt as OChart, dt as ODialog, xt as ODialogExport, bt as ODialogOTP, Xt as ODraggable, St as ODropdown, nt as OField, ct as OFieldsContainer, Nt as OFilter, Ct as OFiltersPanel, Pt as OInputOTP, st as OKeycloakLoginButton, Yt as OKeycloakTokenExpired, zt as OList, Tt as OLottie, wt as OPanelWrapper, Rt as OPassword, tt as OProgressBar, Lt as OTable, G as default, W as useFunctions, it as useKeycloak, q as useLoading, _ as useModal };