web-mojo 2.1.1099 → 2.1.1100
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/dist/admin.cjs.js +1 -1
- package/dist/admin.es.js +9 -9
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.es.js +1 -1
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +3 -3
- package/dist/chunks/{ChatView-C7sLr2J4.js → ChatView-D5QdhLLu.js} +2 -2
- package/dist/chunks/{ChatView-C7sLr2J4.js.map → ChatView-D5QdhLLu.js.map} +1 -1
- package/dist/chunks/{ChatView-BMOwUJvp.js → ChatView-SeOtA6Ln.js} +6 -6
- package/dist/chunks/{ChatView-BMOwUJvp.js.map → ChatView-SeOtA6Ln.js.map} +1 -1
- package/dist/chunks/{Collection-DpdzB_n7.js → Collection-CsAk0UhA.js} +2 -2
- package/dist/chunks/{Collection-DpdzB_n7.js.map → Collection-CsAk0UhA.js.map} +1 -1
- package/dist/chunks/{ContextMenu-CLRRrCUp.js → ContextMenu-Dfdrnd0f.js} +2 -2
- package/dist/chunks/{ContextMenu-CLRRrCUp.js.map → ContextMenu-Dfdrnd0f.js.map} +1 -1
- package/dist/chunks/{Dialog-B2JUzeMM.js → Dialog-Ba8-_bwZ.js} +2 -2
- package/dist/chunks/{Dialog-B2JUzeMM.js.map → Dialog-Ba8-_bwZ.js.map} +1 -1
- package/dist/chunks/{Dialog-VNV1BoVO.js → Dialog-DhUxk9f6.js} +3 -3
- package/dist/chunks/{Dialog-VNV1BoVO.js.map → Dialog-DhUxk9f6.js.map} +1 -1
- package/dist/chunks/{FormView-D5FEA-Nu.js → FormView-6msHIICZ.js} +2 -2
- package/dist/chunks/{FormView-D5FEA-Nu.js.map → FormView-6msHIICZ.js.map} +1 -1
- package/dist/chunks/{FormView-DRiG4b10.js → FormView-BhNE8_ux.js} +35 -1
- package/dist/chunks/{FormView-DRiG4b10.js.map → FormView-BhNE8_ux.js.map} +1 -1
- package/dist/chunks/{ListView-B2gyVSMW.js → ListView-BGJG4GYH.js} +2 -2
- package/dist/chunks/{ListView-B2gyVSMW.js.map → ListView-BGJG4GYH.js.map} +1 -1
- package/dist/chunks/{MetricsMiniChartWidget-DNNWwpp0.js → MetricsMiniChartWidget-DpdCMZZq.js} +2 -2
- package/dist/chunks/{MetricsMiniChartWidget-DNNWwpp0.js.map → MetricsMiniChartWidget-DpdCMZZq.js.map} +1 -1
- package/dist/chunks/{MetricsMiniChartWidget-CYENExa2.js → MetricsMiniChartWidget-jCLMh6Bm.js} +2 -2
- package/dist/chunks/{MetricsMiniChartWidget-CYENExa2.js.map → MetricsMiniChartWidget-jCLMh6Bm.js.map} +1 -1
- package/dist/chunks/{PDFViewer-Ci7vFBlz.js → PDFViewer-Daqgh9u9.js} +2 -2
- package/dist/chunks/{PDFViewer-Ci7vFBlz.js.map → PDFViewer-Daqgh9u9.js.map} +1 -1
- package/dist/chunks/{PDFViewer-DG345H4m.js → PDFViewer-kcsI_Orb.js} +2 -2
- package/dist/chunks/{PDFViewer-DG345H4m.js.map → PDFViewer-kcsI_Orb.js.map} +1 -1
- package/dist/chunks/{TokenManager-BJa_JUI4.js → TokenManager-B8v1e48O.js} +4 -4
- package/dist/chunks/{TokenManager-BJa_JUI4.js.map → TokenManager-B8v1e48O.js.map} +1 -1
- package/dist/chunks/{TokenManager-DpzgbkN4.js → TokenManager-_H9DetR8.js} +2 -2
- package/dist/chunks/{TokenManager-DpzgbkN4.js.map → TokenManager-_H9DetR8.js.map} +1 -1
- package/dist/chunks/{version-CGkPXReu.js → version-DMeIxex5.js} +4 -4
- package/dist/chunks/{version-CGkPXReu.js.map → version-DMeIxex5.js.map} +1 -1
- package/dist/chunks/{version-Dv-LRsJ8.js → version-DQJsIARK.js} +2 -2
- package/dist/chunks/{version-Dv-LRsJ8.js.map → version-DQJsIARK.js.map} +1 -1
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.es.js +5 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +11 -11
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +4 -4
- package/dist/map.es.js +1 -1
- package/dist/timeline.es.js +2 -2
- package/package.json +1 -1
package/dist/admin.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { P as Page, C as ContextMenu, a as Group, G as GroupList, b as GroupForms, f as UserDevice, i as UserDeviceLocationList, g as UserDeviceList, U as User, e as UserDataView, d as UserForms, c as UserList } from "./chunks/ContextMenu-
|
|
1
|
+
import { P as Page, C as ContextMenu, a as Group, G as GroupList, b as GroupForms, f as UserDevice, i as UserDeviceLocationList, g as UserDeviceList, U as User, e as UserDataView, d as UserForms, c as UserList } from "./chunks/ContextMenu-Dfdrnd0f.js";
|
|
2
2
|
import { V as View, M as MOJOUtils, r as rest } from "./chunks/Rest-DpbPbmra.js";
|
|
3
3
|
import "./chunks/WebSocketClient-DghNkEyO.js";
|
|
4
|
-
import { D as Dialog$1 } from "./chunks/Dialog-
|
|
5
|
-
import { W } from "./chunks/Dialog-
|
|
6
|
-
import { M as MetricsChart, c as MetricsMiniChartWidget, P as PieChart } from "./chunks/MetricsMiniChartWidget-
|
|
7
|
-
import { b as TablePage, j as EmailDomainForms, i as EmailDomainList, E as EmailDomain, m as MailboxForms, l as MailboxList, k as Mailbox, q as EmailTemplate, c as TabView, s as EmailTemplateForms, r as EmailTemplateList, I as IncidentEvent, A as IncidentEventForms, z as IncidentEventList, v as FileManagerForms, u as FileManagerList, w as File, T as TableView, y as FileForms, x as FileList, au as GeoLocatedIP, ae as LogList, av as GeoLocatedIPList, af as MemberList, ax as TicketList, D as IncidentList, Y as IncidentStats, O as IncidentHistoryList, N as IncidentHistory, B as Incident, C as ChatView, G as IncidentForms, a2 as Job, a8 as JobEventList, a6 as JobLogList, a4 as JobForms, a3 as JobList, ab as JobRunnerList, a9 as JobsEngineStats, ac as JobRunnerForms, aa as JobRunner, ad as Log, M as Member, ag as MemberForms, ah as MetricsPermission, aj as MetricsForms, ai as MetricsPermissionList, as as PushConfigForms, ap as PushConfigList, ar as PushDeliveryList, al as PushDeviceList, at as PushTemplateForms, an as PushTemplateList, R as RuleSet, _ as MatchByOptions, Z as BundleByOptions, W as RuleList, Q as RuleSetList, h as S3BucketForms, g as S3BucketList, n as SentMessage, o as SentMessageList, az as TicketNoteList, ay as TicketNote, aw as Ticket, aA as TicketForms, aB as TicketCategories } from "./chunks/ChatView-
|
|
4
|
+
import { D as Dialog$1 } from "./chunks/Dialog-DhUxk9f6.js";
|
|
5
|
+
import { W } from "./chunks/Dialog-DhUxk9f6.js";
|
|
6
|
+
import { M as MetricsChart, c as MetricsMiniChartWidget, P as PieChart } from "./chunks/MetricsMiniChartWidget-jCLMh6Bm.js";
|
|
7
|
+
import { b as TablePage, j as EmailDomainForms, i as EmailDomainList, E as EmailDomain, m as MailboxForms, l as MailboxList, k as Mailbox, q as EmailTemplate, c as TabView, s as EmailTemplateForms, r as EmailTemplateList, I as IncidentEvent, A as IncidentEventForms, z as IncidentEventList, v as FileManagerForms, u as FileManagerList, w as File, T as TableView, y as FileForms, x as FileList, au as GeoLocatedIP, ae as LogList, av as GeoLocatedIPList, af as MemberList, ax as TicketList, D as IncidentList, Y as IncidentStats, O as IncidentHistoryList, N as IncidentHistory, B as Incident, C as ChatView, G as IncidentForms, a2 as Job, a8 as JobEventList, a6 as JobLogList, a4 as JobForms, a3 as JobList, ab as JobRunnerList, a9 as JobsEngineStats, ac as JobRunnerForms, aa as JobRunner, ad as Log, M as Member, ag as MemberForms, ah as MetricsPermission, aj as MetricsForms, ai as MetricsPermissionList, as as PushConfigForms, ap as PushConfigList, ar as PushDeliveryList, al as PushDeviceList, at as PushTemplateForms, an as PushTemplateList, R as RuleSet, _ as MatchByOptions, Z as BundleByOptions, W as RuleList, Q as RuleSetList, h as S3BucketForms, g as S3BucketList, n as SentMessage, o as SentMessageList, az as TicketNoteList, ay as TicketNote, aw as Ticket, aA as TicketForms, aB as TicketCategories } from "./chunks/ChatView-SeOtA6Ln.js";
|
|
8
8
|
import DataView from "./chunks/DataView-QXyfcg2M.js";
|
|
9
|
-
import { C as Collection, M as Model } from "./chunks/Collection-
|
|
10
|
-
import { L as LightboxGallery, P as PDFViewer } from "./chunks/PDFViewer-
|
|
11
|
-
import { a as applyFileDropMixin, F as FormView } from "./chunks/FormView-
|
|
9
|
+
import { C as Collection, M as Model } from "./chunks/Collection-CsAk0UhA.js";
|
|
10
|
+
import { L as LightboxGallery, P as PDFViewer } from "./chunks/PDFViewer-kcsI_Orb.js";
|
|
11
|
+
import { a as applyFileDropMixin, F as FormView } from "./chunks/FormView-BhNE8_ux.js";
|
|
12
12
|
import { MapView } from "./map.es.js";
|
|
13
|
-
import { B, a, V, b, c, d } from "./chunks/version-
|
|
13
|
+
import { B, a, V, b, c, d } from "./chunks/version-DMeIxex5.js";
|
|
14
14
|
class AdminHeaderView extends View {
|
|
15
15
|
constructor(options = {}) {
|
|
16
16
|
super({
|
package/dist/auth.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/version-Dv-LRsJ8.js");function s({baseURL:e,fetchImpl:s=("undefined"!=typeof fetch?fetch.bind(window):null),storage:t=("undefined"!=typeof localStorage?localStorage:null),endpoints:n={}}={}){if(!e)throw new Error("createAuthClient: baseURL is required");if(!s)throw new Error("createAuthClient: fetch implementation is not available in this environment");if(!t)throw new Error("createAuthClient: storage (localStorage) is not available in this environment");const o="access_token",r="refresh_token",a="user",i={login:"/login",forgot:"/auth/forgot",resetCode:"/auth/password/reset/code",resetToken:"/auth/password/reset/token",...n};async function l(t,n){const o=await s(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});let r={};try{r=await o.json()}catch(a){}if(!o.ok)throw r||{message:`Request failed with status ${o.status}`};return r}function d(e){return e&&e.data&&e.data.data||e&&e.data||e}function c(e){const s=d(e);if(!s||!s.access_token)throw new Error("No access_token in response.");t.setItem(o,s.access_token),s.refresh_token&&t.setItem(r,s.refresh_token),s.user&&t.setItem(a,JSON.stringify(s.user))}return{async login(e,s){const t=await l(i.login,{username:e,password:s});return c(t),d(t)},forgot:async({email:e,method:s})=>l(i.forgot,{email:e,method:s}),async resetWithCode({email:e,code:s,newPassword:t}){const n=await l(i.resetCode,{email:e,code:s,new_password:t});return c(n),d(n)},async resetWithToken({token:e,newPassword:s}){const t=await l(i.resetToken,{token:e,new_password:s});return c(t),d(t)},logout(){t.removeItem(o),t.removeItem(r),t.removeItem(a)},isAuthenticated:()=>!!t.getItem(o),getToken:()=>t.getItem(o),getUser(){const e=t.getItem(a);try{return e?JSON.parse(e):null}catch{return null}},getAuthHeader(){const e=t.getItem(o);return e?`Bearer ${e}`:null},getErrorMessage:function(e){return e?.message||e?.error||Array.isArray(e?.errors)&&e.errors[0]?.message||"An error occurred. Please try again."},parseResponse:d}}function t(e,t={}){if(!(e&&e instanceof Element))throw new Error("mountAuth: container must be a DOM Element");const{baseURL:n,onSuccessRedirect:o,allowRedirectOrigins:r,branding:a={},theme:i,endpoints:l,providers:d,texts:c={}}=t;if(!n)throw new Error("mountAuth: baseURL is required");const u=new URLSearchParams(window.location.search),m=u.get("redirect")||u.get("next")||u.get("returnTo"),p=String(o||m||"/");function g(){!function(e){if(!r||0===r.length)return!0;try{const s=new URL(e,window.location.origin);return r.includes(s.origin)}catch{return!1}}(p)?window.location.href="/":window.location.href=p.startsWith("http")?p:new URL(p,window.location.origin).href}const w=s({baseURL:n,endpoints:l}),b=a.title||"Sign In",f=a.subtitle||"Sign in to your account",h=a.logoUrl||"",y={emailOrUsername:c.emailOrUsername||"Email or Username",password:c.password||"Password",signIn:c.signIn||"Sign In",forgotPassword:c.forgotPassword||"Forgot password?",resetYourPassword:c.resetYourPassword||"Reset Your Password",emailAddress:c.emailAddress||"Email Address",resetMethod:c.resetMethod||"Reset Method",emailCode:c.emailCode||"Email me a code",emailLink:c.emailLink||"Email me a magic link",sendReset:c.sendReset||"Send Reset",back:c.back||"Back",enterResetCode:c.enterResetCode||"Enter Reset Code",weSentCodeTo:c.weSentCodeTo||"We sent a code to",resetCode:c.resetCode||"Reset Code",newPassword:c.newPassword||"New Password",confirmPassword:c.confirmPassword||"Confirm Password",resetPassword:c.resetPassword||"Reset Password",setYourNewPassword:c.setYourNewPassword||"Set Your New Password",setPassword:c.setPassword||"Set Password",invalidCredentials:c.invalidCredentials||"Invalid credentials.",successRedirecting:c.successRedirecting||"Success! Redirecting...",pleaseFillAllFields:c.pleaseFillAllFields||"Please fill in all fields.",passwordsDoNotMatch:c.passwordsDoNotMatch||"Passwords do not match."},v=`\n <div class="auth-container">\n <div class="auth-card">\n <div class="auth-header">\n ${h?`<img src="${h}" alt="${b}" style="max-height:60px;margin-bottom:10px" />`:""}\n <h1 class="auth-title">${b}</h1>\n <p class="auth-subtitle">${f}</p>\n </div>\n\n <div id="status-message" class="alert" role="status" style="display:none;"></div>\n\n \x3c!-- Sign In View --\x3e\n <div id="view-signin" class="auth-view">\n <form id="form-signin" novalidate>\n <div class="mb-3">\n <label for="signin-username" class="form-label">${y.emailOrUsername}</label>\n <input type="text" class="form-control" id="signin-username" placeholder="${y.emailOrUsername}" autocomplete="username" required />\n </div>\n <div class="mb-3">\n <label for="signin-password" class="form-label">${y.password}</label>\n <input type="password" class="form-control" id="signin-password" placeholder="${y.password}" autocomplete="current-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100 mb-3" id="btn-signin">\n <span class="btn-text">${y.signIn}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n <div class="text-center">\n <a href="#" id="link-forgot" class="text-decoration-none">${y.forgotPassword}</a>\n </div>\n\n ${d&&(d.google||d.passkey)?`\n <div class="position-relative my-3">\n <hr class="text-muted" />\n <span class="position-absolute top-50 start-50 translate-middle bg-white px-3 text-muted small">OR</span>\n </div>\n <div class="d-grid gap-2">\n ${d.google?'<button type="button" class="btn btn-outline-primary" id="btn-google"><i class="bi bi-google me-2"></i>Continue with Google</button>':""}\n ${d.passkey?'<button type="button" class="btn btn-outline-secondary" id="btn-passkey"><i class="bi bi-fingerprint me-2"></i>Sign in with Passkey</button>':""}\n </div>\n `:""}\n </form>\n </div>\n\n \x3c!-- Forgot Password View --\x3e\n <div id="view-forgot" class="auth-view" style="display:none;">\n <button type="button" class="btn btn-link p-0 mb-3" id="btn-back-signin">\n <span aria-hidden="true">←</span> ${y.back}\n </button>\n <h2 class="h5 mb-3">${y.resetYourPassword}</h2>\n <form id="form-forgot" novalidate>\n <div class="mb-3">\n <label for="forgot-email" class="form-label">${y.emailAddress}</label>\n <input type="email" class="form-control" id="forgot-email" placeholder="${y.emailAddress}" autocomplete="email" required />\n </div>\n <div class="mb-3">\n <label class="form-label">${y.resetMethod}</label>\n <div class="form-check">\n <input class="form-check-input" type="radio" name="reset-method" id="method-code" value="code" checked />\n <label class="form-check-label" for="method-code">${y.emailCode}</label>\n </div>\n <div class="form-check">\n <input class="form-check-input" type="radio" name="reset-method" id="method-link" value="link" />\n <label class="form-check-label" for="method-link">${y.emailLink}</label>\n </div>\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-forgot">\n <span class="btn-text">${y.sendReset}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n\n \x3c!-- Reset with Code View --\x3e\n <div id="view-reset-code" class="auth-view" style="display:none;">\n <button type="button" class="btn btn-link p-0 mb-3" id="btn-back-forgot">\n <span aria-hidden="true">←</span> ${y.back}\n </button>\n <h2 class="h5 mb-3">${y.enterResetCode}</h2>\n <p class="text-muted small mb-3">${y.weSentCodeTo} <strong id="reset-email-display"></strong></p>\n <form id="form-reset-code" novalidate>\n <div class="mb-3">\n <label for="reset-code" class="form-label">${y.resetCode}</label>\n <input type="text" class="form-control" id="reset-code" placeholder="${y.resetCode}" required />\n </div>\n <div class="mb-3">\n <label for="reset-password" class="form-label">${y.newPassword}</label>\n <input type="password" class="form-control" id="reset-password" placeholder="${y.newPassword}" autocomplete="new-password" required />\n </div>\n <div class="mb-3">\n <label for="reset-password-confirm" class="form-label">${y.confirmPassword}</label>\n <input type="password" class="form-control" id="reset-password-confirm" placeholder="${y.confirmPassword}" autocomplete="new-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-reset-code">\n <span class="btn-text">${y.resetPassword}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n\n \x3c!-- Set Password via Magic Link View --\x3e\n <div id="view-set-password" class="auth-view" style="display:none;">\n <h2 class="h5 mb-3">${y.setYourNewPassword}</h2>\n <form id="form-set-password" novalidate>\n <div class="mb-3">\n <label for="set-password" class="form-label">${y.newPassword}</label>\n <input type="password" class="form-control" id="set-password" placeholder="${y.newPassword}" autocomplete="new-password" required />\n </div>\n <div class="mb-3">\n <label for="set-password-confirm" class="form-label">${y.confirmPassword}</label>\n <input type="password" class="form-control" id="set-password-confirm" placeholder="${y.confirmPassword}" autocomplete="new-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-set-password">\n <span class="btn-text">${y.setPassword}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n </div>\n </div>\n `;e.innerHTML=v,i&&e.classList.add(String(i));const k={views:{signin:e.querySelector("#view-signin"),forgot:e.querySelector("#view-forgot"),resetCode:e.querySelector("#view-reset-code"),setPassword:e.querySelector("#view-set-password")},forms:{signin:e.querySelector("#form-signin"),forgot:e.querySelector("#form-forgot"),resetCode:e.querySelector("#form-reset-code"),setPassword:e.querySelector("#form-set-password")},buttons:{signin:e.querySelector("#btn-signin"),forgot:e.querySelector("#btn-forgot"),resetCode:e.querySelector("#btn-reset-code"),setPassword:e.querySelector("#btn-set-password"),backSignin:e.querySelector("#btn-back-signin"),backForgot:e.querySelector("#btn-back-forgot"),google:e.querySelector("#btn-google"),passkey:e.querySelector("#btn-passkey")},inputs:{signinUsername:e.querySelector("#signin-username"),signinPassword:e.querySelector("#signin-password"),forgotEmail:e.querySelector("#forgot-email"),resetCode:e.querySelector("#reset-code"),resetPassword:e.querySelector("#reset-password"),resetPasswordConfirm:e.querySelector("#reset-password-confirm"),setPassword:e.querySelector("#set-password"),setPasswordConfirm:e.querySelector("#set-password-confirm")},radios:{resetMethodCode:e.querySelector("#method-code"),resetMethodLink:e.querySelector("#method-link")},labels:{resetEmailDisplay:e.querySelector("#reset-email-display")},links:{forgot:e.querySelector("#link-forgot")},message:e.querySelector("#status-message")};function S(e){Object.entries(k.views).forEach(([s,t])=>{t&&(t.style.display=s===e?"block":"none")}),setTimeout(()=>{const s=k.views[e],t=s?.querySelector("h1, h2, .auth-title, .h5");if(t)t.setAttribute("tabindex","-1"),t.focus?.();else{const e=s?.querySelector("input, button");e?.focus?.()}},60)}function P(e,s="info"){const t=k.message;t&&(t.textContent=e,t.className=`alert alert-${s}`,t.style.display="block",t.setAttribute("role","danger"===s?"alert":"status"))}function C(){const e=k.message;e&&(e.style.display="none")}function E(e,s){if(!e)return;const t=e.querySelector(".btn-text"),n=e.querySelector(".btn-spinner");e.disabled=!!s,t&&(t.style.display=s?"none":"inline"),n&&(n.style.display=s?"inline-block":"none")}async function I(e){e?.preventDefault?.(),C();const s=k.inputs.signinUsername?.value?.trim(),t=k.inputs.signinPassword?.value;if(s&&t){E(k.buttons.signin,!0);try{await w.login(s,t),P(`${y.successRedirecting}`,"success"),setTimeout(g,350)}catch(n){P(w.getErrorMessage(n)||y.invalidCredentials,"danger"),E(k.buttons.signin,!1)}}else P("Please enter both username and password.","danger")}async function R(e){e?.preventDefault?.(),C();const s=k.inputs.forgotEmail?.value?.trim(),t=k.radios.resetMethodCode?.checked?"code":k.radios.resetMethodLink?.checked?"link":"code";if(s){E(k.buttons.forgot,!0);try{await w.forgot({email:s,method:t}),"code"===t?(sessionStorage.setItem("reset_email",s),sessionStorage.setItem("reset_method",t),k.labels.resetEmailDisplay&&(k.labels.resetEmailDisplay.textContent=s),S("resetCode"),P("Reset code sent! Check your email.","success")):P("Magic link sent! Check your email and click the link.","success")}catch(n){P(w.getErrorMessage(n)||"Something went wrong. Please try again.","danger")}finally{E(k.buttons.forgot,!1)}}else P("Please enter your email address.","danger")}async function q(e){e?.preventDefault?.(),C();const s=k.inputs.resetCode?.value?.trim(),t=k.inputs.resetPassword?.value,n=k.inputs.resetPasswordConfirm?.value,o=sessionStorage.getItem("reset_email");if(!o)return P("Session expired. Please restart the password reset process.","danger"),void S("forgot");if(s&&t)if(t===n){E(k.buttons.resetCode,!0);try{await w.resetWithCode({email:o,code:s,newPassword:t}),sessionStorage.removeItem("reset_email"),sessionStorage.removeItem("reset_method"),P(y.successRedirecting,"success"),setTimeout(g,350)}catch(r){P(w.getErrorMessage(r)||"Invalid code or code expired.","danger"),E(k.buttons.resetCode,!1)}}else P(y.passwordsDoNotMatch,"danger");else P(y.pleaseFillAllFields,"danger")}async function $(e){e?.preventDefault?.(),C();const s=k.inputs.setPassword?.value,t=k.inputs.setPasswordConfirm?.value,n=sessionStorage.getItem("login_token");if(!n)return P("Invalid or expired link. Please request a new one.","danger"),void S("forgot");if(s)if(s===t){E(k.buttons.setPassword,!0);try{await w.resetWithToken({token:n,newPassword:s}),sessionStorage.removeItem("login_token"),P(y.successRedirecting,"success"),setTimeout(g,350)}catch(o){P(w.getErrorMessage(o)||"Invalid or expired link.","danger"),E(k.buttons.setPassword,!1)}}else P(y.passwordsDoNotMatch,"danger");else P("Please enter a new password.","danger")}function x(e){e?.preventDefault?.(),C(),S("forgot")}function L(){C(),S("signin")}function _(){C(),S("forgot")}return k.forms.signin?.addEventListener("submit",I),k.forms.forgot?.addEventListener("submit",R),k.forms.resetCode?.addEventListener("submit",q),k.forms.setPassword?.addEventListener("submit",$),k.links.forgot?.addEventListener("click",x),k.buttons.backSignin?.addEventListener("click",L),k.buttons.backForgot?.addEventListener("click",_),d?.google&&k.buttons.google&&k.buttons.google.addEventListener("click",s=>{s?.preventDefault?.(),d.google.onClick?.({container:e,auth:w,redirect:g,showMessage:P})}),d?.passkey&&k.buttons.passkey&&k.buttons.passkey.addEventListener("click",s=>{s?.preventDefault?.(),d.passkey.onClick?.({container:e,auth:w,redirect:g,showMessage:P})}),function(){const e=new URLSearchParams(window.location.search),s=e.get("login_token");if(s){sessionStorage.setItem("login_token",s),e.delete("login_token");const t=e.toString()?`${window.location.pathname}?${e.toString()}`:window.location.pathname;return window.history.replaceState({},"",t),S("setPassword"),void P("Please set your new password.","info")}const t=sessionStorage.getItem("reset_email");if(t)return k.labels.resetEmailDisplay&&(k.labels.resetEmailDisplay.textContent=t),void S("resetCode");S("signin")}(),{destroy(){k.forms.signin?.removeEventListener("submit",I),k.forms.forgot?.removeEventListener("submit",R),k.forms.resetCode?.removeEventListener("submit",q),k.forms.setPassword?.removeEventListener("submit",$),k.links.forgot?.removeEventListener("click",x),k.buttons.backSignin?.removeEventListener("click",L),k.buttons.backForgot?.removeEventListener("click",_),d?.google&&k.buttons.google&&k.buttons.google.replaceWith(k.buttons.google.cloneNode(!0)),d?.passkey&&k.buttons.passkey&&k.buttons.passkey.replaceWith(k.buttons.passkey.cloneNode(!0)),e.innerHTML=""}}}const n={mountAuth:t,createAuthClient:s},o=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,createAuthClient:s,default:n,mountAuth:t},Symbol.toStringTag,{value:"Module"}));exports.BUILD_TIME=e.BUILD_TIME,exports.VERSION=e.VERSION,exports.VERSION_INFO=e.VERSION_INFO,exports.VERSION_MAJOR=e.VERSION_MAJOR,exports.VERSION_MINOR=e.VERSION_MINOR,exports.VERSION_REVISION=e.VERSION_REVISION,exports.createAuthClient=s,exports.default=o,exports.mountAuth=t;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./chunks/version-DQJsIARK.js");function s({baseURL:e,fetchImpl:s=("undefined"!=typeof fetch?fetch.bind(window):null),storage:t=("undefined"!=typeof localStorage?localStorage:null),endpoints:n={}}={}){if(!e)throw new Error("createAuthClient: baseURL is required");if(!s)throw new Error("createAuthClient: fetch implementation is not available in this environment");if(!t)throw new Error("createAuthClient: storage (localStorage) is not available in this environment");const o="access_token",r="refresh_token",a="user",i={login:"/login",forgot:"/auth/forgot",resetCode:"/auth/password/reset/code",resetToken:"/auth/password/reset/token",...n};async function l(t,n){const o=await s(`${e}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n||{})});let r={};try{r=await o.json()}catch(a){}if(!o.ok)throw r||{message:`Request failed with status ${o.status}`};return r}function d(e){return e&&e.data&&e.data.data||e&&e.data||e}function c(e){const s=d(e);if(!s||!s.access_token)throw new Error("No access_token in response.");t.setItem(o,s.access_token),s.refresh_token&&t.setItem(r,s.refresh_token),s.user&&t.setItem(a,JSON.stringify(s.user))}return{async login(e,s){const t=await l(i.login,{username:e,password:s});return c(t),d(t)},forgot:async({email:e,method:s})=>l(i.forgot,{email:e,method:s}),async resetWithCode({email:e,code:s,newPassword:t}){const n=await l(i.resetCode,{email:e,code:s,new_password:t});return c(n),d(n)},async resetWithToken({token:e,newPassword:s}){const t=await l(i.resetToken,{token:e,new_password:s});return c(t),d(t)},logout(){t.removeItem(o),t.removeItem(r),t.removeItem(a)},isAuthenticated:()=>!!t.getItem(o),getToken:()=>t.getItem(o),getUser(){const e=t.getItem(a);try{return e?JSON.parse(e):null}catch{return null}},getAuthHeader(){const e=t.getItem(o);return e?`Bearer ${e}`:null},getErrorMessage:function(e){return e?.message||e?.error||Array.isArray(e?.errors)&&e.errors[0]?.message||"An error occurred. Please try again."},parseResponse:d}}function t(e,t={}){if(!(e&&e instanceof Element))throw new Error("mountAuth: container must be a DOM Element");const{baseURL:n,onSuccessRedirect:o,allowRedirectOrigins:r,branding:a={},theme:i,endpoints:l,providers:d,texts:c={}}=t;if(!n)throw new Error("mountAuth: baseURL is required");const u=new URLSearchParams(window.location.search),m=u.get("redirect")||u.get("next")||u.get("returnTo"),p=String(o||m||"/");function g(){!function(e){if(!r||0===r.length)return!0;try{const s=new URL(e,window.location.origin);return r.includes(s.origin)}catch{return!1}}(p)?window.location.href="/":window.location.href=p.startsWith("http")?p:new URL(p,window.location.origin).href}const w=s({baseURL:n,endpoints:l}),b=a.title||"Sign In",f=a.subtitle||"Sign in to your account",h=a.logoUrl||"",y={emailOrUsername:c.emailOrUsername||"Email or Username",password:c.password||"Password",signIn:c.signIn||"Sign In",forgotPassword:c.forgotPassword||"Forgot password?",resetYourPassword:c.resetYourPassword||"Reset Your Password",emailAddress:c.emailAddress||"Email Address",resetMethod:c.resetMethod||"Reset Method",emailCode:c.emailCode||"Email me a code",emailLink:c.emailLink||"Email me a magic link",sendReset:c.sendReset||"Send Reset",back:c.back||"Back",enterResetCode:c.enterResetCode||"Enter Reset Code",weSentCodeTo:c.weSentCodeTo||"We sent a code to",resetCode:c.resetCode||"Reset Code",newPassword:c.newPassword||"New Password",confirmPassword:c.confirmPassword||"Confirm Password",resetPassword:c.resetPassword||"Reset Password",setYourNewPassword:c.setYourNewPassword||"Set Your New Password",setPassword:c.setPassword||"Set Password",invalidCredentials:c.invalidCredentials||"Invalid credentials.",successRedirecting:c.successRedirecting||"Success! Redirecting...",pleaseFillAllFields:c.pleaseFillAllFields||"Please fill in all fields.",passwordsDoNotMatch:c.passwordsDoNotMatch||"Passwords do not match."},v=`\n <div class="auth-container">\n <div class="auth-card">\n <div class="auth-header">\n ${h?`<img src="${h}" alt="${b}" style="max-height:60px;margin-bottom:10px" />`:""}\n <h1 class="auth-title">${b}</h1>\n <p class="auth-subtitle">${f}</p>\n </div>\n\n <div id="status-message" class="alert" role="status" style="display:none;"></div>\n\n \x3c!-- Sign In View --\x3e\n <div id="view-signin" class="auth-view">\n <form id="form-signin" novalidate>\n <div class="mb-3">\n <label for="signin-username" class="form-label">${y.emailOrUsername}</label>\n <input type="text" class="form-control" id="signin-username" placeholder="${y.emailOrUsername}" autocomplete="username" required />\n </div>\n <div class="mb-3">\n <label for="signin-password" class="form-label">${y.password}</label>\n <input type="password" class="form-control" id="signin-password" placeholder="${y.password}" autocomplete="current-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100 mb-3" id="btn-signin">\n <span class="btn-text">${y.signIn}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n <div class="text-center">\n <a href="#" id="link-forgot" class="text-decoration-none">${y.forgotPassword}</a>\n </div>\n\n ${d&&(d.google||d.passkey)?`\n <div class="position-relative my-3">\n <hr class="text-muted" />\n <span class="position-absolute top-50 start-50 translate-middle bg-white px-3 text-muted small">OR</span>\n </div>\n <div class="d-grid gap-2">\n ${d.google?'<button type="button" class="btn btn-outline-primary" id="btn-google"><i class="bi bi-google me-2"></i>Continue with Google</button>':""}\n ${d.passkey?'<button type="button" class="btn btn-outline-secondary" id="btn-passkey"><i class="bi bi-fingerprint me-2"></i>Sign in with Passkey</button>':""}\n </div>\n `:""}\n </form>\n </div>\n\n \x3c!-- Forgot Password View --\x3e\n <div id="view-forgot" class="auth-view" style="display:none;">\n <button type="button" class="btn btn-link p-0 mb-3" id="btn-back-signin">\n <span aria-hidden="true">←</span> ${y.back}\n </button>\n <h2 class="h5 mb-3">${y.resetYourPassword}</h2>\n <form id="form-forgot" novalidate>\n <div class="mb-3">\n <label for="forgot-email" class="form-label">${y.emailAddress}</label>\n <input type="email" class="form-control" id="forgot-email" placeholder="${y.emailAddress}" autocomplete="email" required />\n </div>\n <div class="mb-3">\n <label class="form-label">${y.resetMethod}</label>\n <div class="form-check">\n <input class="form-check-input" type="radio" name="reset-method" id="method-code" value="code" checked />\n <label class="form-check-label" for="method-code">${y.emailCode}</label>\n </div>\n <div class="form-check">\n <input class="form-check-input" type="radio" name="reset-method" id="method-link" value="link" />\n <label class="form-check-label" for="method-link">${y.emailLink}</label>\n </div>\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-forgot">\n <span class="btn-text">${y.sendReset}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n\n \x3c!-- Reset with Code View --\x3e\n <div id="view-reset-code" class="auth-view" style="display:none;">\n <button type="button" class="btn btn-link p-0 mb-3" id="btn-back-forgot">\n <span aria-hidden="true">←</span> ${y.back}\n </button>\n <h2 class="h5 mb-3">${y.enterResetCode}</h2>\n <p class="text-muted small mb-3">${y.weSentCodeTo} <strong id="reset-email-display"></strong></p>\n <form id="form-reset-code" novalidate>\n <div class="mb-3">\n <label for="reset-code" class="form-label">${y.resetCode}</label>\n <input type="text" class="form-control" id="reset-code" placeholder="${y.resetCode}" required />\n </div>\n <div class="mb-3">\n <label for="reset-password" class="form-label">${y.newPassword}</label>\n <input type="password" class="form-control" id="reset-password" placeholder="${y.newPassword}" autocomplete="new-password" required />\n </div>\n <div class="mb-3">\n <label for="reset-password-confirm" class="form-label">${y.confirmPassword}</label>\n <input type="password" class="form-control" id="reset-password-confirm" placeholder="${y.confirmPassword}" autocomplete="new-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-reset-code">\n <span class="btn-text">${y.resetPassword}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n\n \x3c!-- Set Password via Magic Link View --\x3e\n <div id="view-set-password" class="auth-view" style="display:none;">\n <h2 class="h5 mb-3">${y.setYourNewPassword}</h2>\n <form id="form-set-password" novalidate>\n <div class="mb-3">\n <label for="set-password" class="form-label">${y.newPassword}</label>\n <input type="password" class="form-control" id="set-password" placeholder="${y.newPassword}" autocomplete="new-password" required />\n </div>\n <div class="mb-3">\n <label for="set-password-confirm" class="form-label">${y.confirmPassword}</label>\n <input type="password" class="form-control" id="set-password-confirm" placeholder="${y.confirmPassword}" autocomplete="new-password" required />\n </div>\n <button type="submit" class="btn btn-primary w-100" id="btn-set-password">\n <span class="btn-text">${y.setPassword}</span>\n <span class="btn-spinner spinner-border spinner-border-sm" style="display:none;"></span>\n </button>\n </form>\n </div>\n </div>\n </div>\n `;e.innerHTML=v,i&&e.classList.add(String(i));const k={views:{signin:e.querySelector("#view-signin"),forgot:e.querySelector("#view-forgot"),resetCode:e.querySelector("#view-reset-code"),setPassword:e.querySelector("#view-set-password")},forms:{signin:e.querySelector("#form-signin"),forgot:e.querySelector("#form-forgot"),resetCode:e.querySelector("#form-reset-code"),setPassword:e.querySelector("#form-set-password")},buttons:{signin:e.querySelector("#btn-signin"),forgot:e.querySelector("#btn-forgot"),resetCode:e.querySelector("#btn-reset-code"),setPassword:e.querySelector("#btn-set-password"),backSignin:e.querySelector("#btn-back-signin"),backForgot:e.querySelector("#btn-back-forgot"),google:e.querySelector("#btn-google"),passkey:e.querySelector("#btn-passkey")},inputs:{signinUsername:e.querySelector("#signin-username"),signinPassword:e.querySelector("#signin-password"),forgotEmail:e.querySelector("#forgot-email"),resetCode:e.querySelector("#reset-code"),resetPassword:e.querySelector("#reset-password"),resetPasswordConfirm:e.querySelector("#reset-password-confirm"),setPassword:e.querySelector("#set-password"),setPasswordConfirm:e.querySelector("#set-password-confirm")},radios:{resetMethodCode:e.querySelector("#method-code"),resetMethodLink:e.querySelector("#method-link")},labels:{resetEmailDisplay:e.querySelector("#reset-email-display")},links:{forgot:e.querySelector("#link-forgot")},message:e.querySelector("#status-message")};function S(e){Object.entries(k.views).forEach(([s,t])=>{t&&(t.style.display=s===e?"block":"none")}),setTimeout(()=>{const s=k.views[e],t=s?.querySelector("h1, h2, .auth-title, .h5");if(t)t.setAttribute("tabindex","-1"),t.focus?.();else{const e=s?.querySelector("input, button");e?.focus?.()}},60)}function P(e,s="info"){const t=k.message;t&&(t.textContent=e,t.className=`alert alert-${s}`,t.style.display="block",t.setAttribute("role","danger"===s?"alert":"status"))}function C(){const e=k.message;e&&(e.style.display="none")}function E(e,s){if(!e)return;const t=e.querySelector(".btn-text"),n=e.querySelector(".btn-spinner");e.disabled=!!s,t&&(t.style.display=s?"none":"inline"),n&&(n.style.display=s?"inline-block":"none")}async function I(e){e?.preventDefault?.(),C();const s=k.inputs.signinUsername?.value?.trim(),t=k.inputs.signinPassword?.value;if(s&&t){E(k.buttons.signin,!0);try{await w.login(s,t),P(`${y.successRedirecting}`,"success"),setTimeout(g,350)}catch(n){P(w.getErrorMessage(n)||y.invalidCredentials,"danger"),E(k.buttons.signin,!1)}}else P("Please enter both username and password.","danger")}async function R(e){e?.preventDefault?.(),C();const s=k.inputs.forgotEmail?.value?.trim(),t=k.radios.resetMethodCode?.checked?"code":k.radios.resetMethodLink?.checked?"link":"code";if(s){E(k.buttons.forgot,!0);try{await w.forgot({email:s,method:t}),"code"===t?(sessionStorage.setItem("reset_email",s),sessionStorage.setItem("reset_method",t),k.labels.resetEmailDisplay&&(k.labels.resetEmailDisplay.textContent=s),S("resetCode"),P("Reset code sent! Check your email.","success")):P("Magic link sent! Check your email and click the link.","success")}catch(n){P(w.getErrorMessage(n)||"Something went wrong. Please try again.","danger")}finally{E(k.buttons.forgot,!1)}}else P("Please enter your email address.","danger")}async function q(e){e?.preventDefault?.(),C();const s=k.inputs.resetCode?.value?.trim(),t=k.inputs.resetPassword?.value,n=k.inputs.resetPasswordConfirm?.value,o=sessionStorage.getItem("reset_email");if(!o)return P("Session expired. Please restart the password reset process.","danger"),void S("forgot");if(s&&t)if(t===n){E(k.buttons.resetCode,!0);try{await w.resetWithCode({email:o,code:s,newPassword:t}),sessionStorage.removeItem("reset_email"),sessionStorage.removeItem("reset_method"),P(y.successRedirecting,"success"),setTimeout(g,350)}catch(r){P(w.getErrorMessage(r)||"Invalid code or code expired.","danger"),E(k.buttons.resetCode,!1)}}else P(y.passwordsDoNotMatch,"danger");else P(y.pleaseFillAllFields,"danger")}async function $(e){e?.preventDefault?.(),C();const s=k.inputs.setPassword?.value,t=k.inputs.setPasswordConfirm?.value,n=sessionStorage.getItem("login_token");if(!n)return P("Invalid or expired link. Please request a new one.","danger"),void S("forgot");if(s)if(s===t){E(k.buttons.setPassword,!0);try{await w.resetWithToken({token:n,newPassword:s}),sessionStorage.removeItem("login_token"),P(y.successRedirecting,"success"),setTimeout(g,350)}catch(o){P(w.getErrorMessage(o)||"Invalid or expired link.","danger"),E(k.buttons.setPassword,!1)}}else P(y.passwordsDoNotMatch,"danger");else P("Please enter a new password.","danger")}function x(e){e?.preventDefault?.(),C(),S("forgot")}function L(){C(),S("signin")}function _(){C(),S("forgot")}return k.forms.signin?.addEventListener("submit",I),k.forms.forgot?.addEventListener("submit",R),k.forms.resetCode?.addEventListener("submit",q),k.forms.setPassword?.addEventListener("submit",$),k.links.forgot?.addEventListener("click",x),k.buttons.backSignin?.addEventListener("click",L),k.buttons.backForgot?.addEventListener("click",_),d?.google&&k.buttons.google&&k.buttons.google.addEventListener("click",s=>{s?.preventDefault?.(),d.google.onClick?.({container:e,auth:w,redirect:g,showMessage:P})}),d?.passkey&&k.buttons.passkey&&k.buttons.passkey.addEventListener("click",s=>{s?.preventDefault?.(),d.passkey.onClick?.({container:e,auth:w,redirect:g,showMessage:P})}),function(){const e=new URLSearchParams(window.location.search),s=e.get("login_token");if(s){sessionStorage.setItem("login_token",s),e.delete("login_token");const t=e.toString()?`${window.location.pathname}?${e.toString()}`:window.location.pathname;return window.history.replaceState({},"",t),S("setPassword"),void P("Please set your new password.","info")}const t=sessionStorage.getItem("reset_email");if(t)return k.labels.resetEmailDisplay&&(k.labels.resetEmailDisplay.textContent=t),void S("resetCode");S("signin")}(),{destroy(){k.forms.signin?.removeEventListener("submit",I),k.forms.forgot?.removeEventListener("submit",R),k.forms.resetCode?.removeEventListener("submit",q),k.forms.setPassword?.removeEventListener("submit",$),k.links.forgot?.removeEventListener("click",x),k.buttons.backSignin?.removeEventListener("click",L),k.buttons.backForgot?.removeEventListener("click",_),d?.google&&k.buttons.google&&k.buttons.google.replaceWith(k.buttons.google.cloneNode(!0)),d?.passkey&&k.buttons.passkey&&k.buttons.passkey.replaceWith(k.buttons.passkey.cloneNode(!0)),e.innerHTML=""}}}const n={mountAuth:t,createAuthClient:s},o=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,createAuthClient:s,default:n,mountAuth:t},Symbol.toStringTag,{value:"Module"}));exports.BUILD_TIME=e.BUILD_TIME,exports.VERSION=e.VERSION,exports.VERSION_INFO=e.VERSION_INFO,exports.VERSION_MAJOR=e.VERSION_MAJOR,exports.VERSION_MINOR=e.VERSION_MINOR,exports.VERSION_REVISION=e.VERSION_REVISION,exports.createAuthClient=s,exports.default=o,exports.mountAuth=t;
|
|
2
2
|
//# sourceMappingURL=auth.cjs.js.map
|
package/dist/auth.es.js
CHANGED
package/dist/charts.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunks/MetricsMiniChartWidget-DNNWwpp0.js"),e=require("./chunks/Rest-BpDyhFfG.js"),s=require("./chunks/Dialog-B2JUzeMM.js"),i=require("./chunks/version-Dv-LRsJ8.js");class CircularProgress extends e.View{constructor(t={}){super({className:`circular-progress ${t.className||""}`,...t}),this.SIZE_PRESETS={xs:40,sm:60,md:80,lg:120,xl:180},this.STROKE_PRESETS={xs:4,sm:6,md:8,lg:12,xl:16},this.value=void 0!==t.value?t.value:0,this.min=void 0!==t.min?t.min:0,this.max=void 0!==t.max?t.max:100,this.sizePreset="string"==typeof t.size&&this.SIZE_PRESETS[t.size]?t.size:null,this.size=this.resolveSize(void 0!==t.size?t.size:"md"),this.strokeWidth="auto"===t.strokeWidth||void 0===t.strokeWidth?this.getAutoStrokeWidth(t.size):t.strokeWidth,this.theme=t.theme||"basic",this.variant=t.variant||"default",this.color=t.color,this.trackColor=t.trackColor,this.textColor=t.textColor,this.gradientColors=t.gradientColors||null,this.applyTheme(),this.applyVariant(),this.rotation=void 0!==t.rotation?t.rotation:-90,this.gap=t.gap||0,this.showValue=!1!==t.showValue,this.valueFormat=t.valueFormat||"percentage",this.valueFormatter=t.valueFormatter||null,this.label=t.label||null,this.labelHtml=t.labelHtml||null,this.icon=t.icon||null,this.animate=!1!==t.animate,this.animationDuration=t.animationDuration||600,this.animationEasing=t.animationEasing||"ease-out",this.rounded=!1!==t.rounded,this.shadow=t.shadow||!1,this.clickable=t.clickable||!1,this.tooltip=t.tooltip||null,this.tooltipPlacement=t.tooltipPlacement||"top",this.segments=t.segments||null,this.segmentGap=t.segmentGap||2,this.dataFormatter=e.dataFormatter,this.svg=null,this.centerElement=null,this.popover=null,this.gradientId=`gradient-${Math.random().toString(36).substr(2,9)}`}resolveSize(t){return"string"==typeof t&&this.SIZE_PRESETS[t]?this.SIZE_PRESETS[t]:"number"==typeof t?t:this.SIZE_PRESETS.md}getAutoStrokeWidth(t){if("string"==typeof t&&this.STROKE_PRESETS[t])return this.STROKE_PRESETS[t];const e=this.resolveSize(t);return e<=40?4:e<=60?6:e<=80?8:e<=120?12:16}applyTheme(){const t={basic:{trackColor:"#e9ecef",textColor:null,backgroundColor:null},shadowed:{trackColor:"#d1d5db",textColor:null,backgroundColor:null,shadow:!0},dark:{trackColor:"#374151",textColor:"#e5e7eb",backgroundColor:"#1f2937"},light:{trackColor:"#f3f4f6",textColor:"#111827",backgroundColor:"#ffffff"}},e=t[this.theme]||t.basic;this.trackColor||(this.trackColor=e.trackColor),!this.textColor&&e.textColor&&(this.textColor=e.textColor),e.shadow&&!1===this.shadow&&(this.shadow=e.shadow)}applyVariant(){const t={success:{color:"#198754",trackColor:"rgba(25, 135, 84, 0.1)"},danger:{color:"#dc3545",trackColor:"rgba(220, 53, 69, 0.1)"},warning:{color:"#ffc107",trackColor:"rgba(255, 193, 7, 0.1)"},info:{color:"#0dcaf0",trackColor:"rgba(13, 202, 240, 0.1)"},default:{color:"#0d6efd"}};if(t[this.variant]){const e=t[this.variant];this.color||(this.color=e.color),e.trackColor&&this.trackColor===this.applyTheme.trackColor&&(this.trackColor=e.trackColor)}this.color||(this.color="#0d6efd")}getTemplate(){const t=this.sizePreset?`circular-progress-${this.sizePreset}`:"",e="default"!==this.variant?`circular-progress-${this.variant}`:"",s="basic"!==this.theme?`circular-progress-theme-${this.theme}`:"",i=this.clickable?"circular-progress-clickable":"",r=this.shadow?"circular-progress-shadow":"",o=this.textColor?`color: ${this.textColor};`:"";return`\n <div class="circular-progress-container ${t} ${e} ${s} ${i} ${r}"\n style="width: ${this.size}px; height: ${this.size}px;">\n <svg class="circular-progress-svg" \n width="${this.size}" \n height="${this.size}"\n viewBox="0 0 ${this.size} ${this.size}">\n </svg>\n <div class="circular-progress-center" style="${o}">\n <div class="circular-progress-content"></div>\n </div>\n </div>\n `}async onAfterRender(){this.svg=this.element.querySelector(".circular-progress-svg"),this.centerElement=this.element.querySelector(".circular-progress-content"),this.containerElement=this.element.querySelector(".circular-progress-container"),this.renderProgress(),this.renderCenterContent(),this.clickable&&this.setupClickHandler(),this.tooltip&&this.clickable&&this.setupTooltip()}renderProgress(){if(!this.svg)return;this.svg.innerHTML="";const t=this.size/2,e=(this.size-this.strokeWidth)/2,s=2*Math.PI*e;this.gradientColors&&this.gradientColors.length>1&&this.createGradient(),this.segments&&Array.isArray(this.segments)&&this.segments.length>0?this.renderSegments(t,e,s):this.renderSingleProgress(t,e,s)}renderSingleProgress(t,e,s){const i=(this.gap>0?360-this.gap:360)/360*s,r=this.createCircle(t,e,{stroke:this.trackColor,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:this.gap>0?`${i} ${s}`:"none",transform:`rotate(${this.rotation} ${t} ${t})`});this.svg.appendChild(r);const o=i-this.getPercentage()/100*i,a=this.gradientColors?`url(#${this.gradientId})`:this.color,n=this.createCircle(t,e,{stroke:a,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:`${i} ${s}`,strokeDashoffset:this.animate?i:o,transform:`rotate(${this.rotation} ${t} ${t})`,class:"circular-progress-bar"});this.svg.appendChild(n),this.animate&&this.animateProgress(n,o)}renderSegments(t,e,s){const i=(this.gap>0?360-this.gap:360)/360*s,r=this.createCircle(t,e,{stroke:this.trackColor,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:this.gap>0?`${i} ${s}`:"none",transform:`rotate(${this.rotation} ${t} ${t})`});this.svg.appendChild(r),this.segments.reduce((t,e)=>t+(e.value||0),0)>this.max&&console.warn("CircularProgress: Segment total exceeds max value. Clamping to max.");let o=0;this.segments.forEach((r,a)=>{const n=(r.value||0)/(this.max-this.min)*100/100*i,h=this.segmentGap/360*s;if(n>0){const l=this.createCircle(t,e,{stroke:r.color||this.color,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:`${n} ${s}`,strokeDashoffset:this.animate?i:-o,transform:`rotate(${this.rotation} ${t} ${t})`,class:`circular-progress-segment circular-progress-segment-${a}`,"data-segment-index":a});this.svg.appendChild(l),this.animate&&this.animateProgress(l,-o,100*a),o+=n+h}})}createCircle(t,e,s={}){const i=document.createElementNS("http://www.w3.org/2000/svg","circle");return i.setAttribute("cx",t),i.setAttribute("cy",t),i.setAttribute("r",e),Object.entries(s).forEach(([t,e])=>{"strokeWidth"===t?i.setAttribute("stroke-width",e):"strokeLinecap"===t?i.setAttribute("stroke-linecap",e):"strokeDasharray"===t?i.setAttribute("stroke-dasharray",e):"strokeDashoffset"===t?i.setAttribute("stroke-dashoffset",e):i.setAttribute(t,e)}),i}createGradient(){const t=document.createElementNS("http://www.w3.org/2000/svg","defs"),e=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");e.setAttribute("id",this.gradientId),e.setAttribute("x1","0%"),e.setAttribute("y1","0%"),e.setAttribute("x2","100%"),e.setAttribute("y2","100%"),this.gradientColors.forEach((t,s)=>{const i=document.createElementNS("http://www.w3.org/2000/svg","stop"),r=s/(this.gradientColors.length-1)*100;i.setAttribute("offset",`${r}%`),i.setAttribute("stop-color",t),e.appendChild(i)}),t.appendChild(e),this.svg.appendChild(t)}animateProgress(t,e,s=0){setTimeout(()=>{t.style.transition=`stroke-dashoffset ${this.animationDuration}ms ${this.animationEasing}`,t.style.strokeDashoffset=e},s)}renderCenterContent(){if(this.centerElement)if(this.labelHtml)this.centerElement.innerHTML=this.labelHtml;else if(this.icon)this.centerElement.innerHTML=`<i class="${this.icon}"></i>`;else if(this.showValue){let t=`<div class="circular-progress-value">${this.getFormattedValue()}</div>`;this.label&&(t+=`<div class="circular-progress-label">${this.label}</div>`),this.centerElement.innerHTML=t}}getFormattedValue(){const t=this.value,e=this.min,s=this.max;if(this.valueFormatter&&"function"==typeof this.valueFormatter)return this.valueFormatter(t,e,s);switch(this.valueFormat){case"percentage":return`${Math.round(this.getPercentage())}%`;case"fraction":return`${t}/${s}`;case"value":return t.toString();default:if(this.dataFormatter)try{return this.dataFormatter.pipe(t,this.valueFormat)}catch(i){return console.warn("CircularProgress: DataFormatter error, falling back to percentage",i),`${Math.round(this.getPercentage())}%`}return`${Math.round(this.getPercentage())}%`}}getPercentage(){const t=this.max-this.min;return 0===t?0:(this.value-this.min)/t*100}setupClickHandler(){this.containerElement&&(this.containerElement.style.cursor="pointer",this.containerElement.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const e=this.getPercentage();this.emit("progress:clicked",{value:this.value,percentage:e,min:this.min,max:this.max}),this.tooltip&&this.togglePopover()}))}setupTooltip(){}togglePopover(){if(this.containerElement&&void 0!==window.bootstrap){if(!this.popover){const t=this.getTooltipContent(),e="object"==typeof this.tooltip&&this.tooltip.title?this.tooltip.title:void 0,s={content:t,html:!0,placement:this.tooltipPlacement,trigger:"manual",container:"body"};e&&(s.title=e),this.popover=new window.bootstrap.Popover(this.containerElement,s)}window.bootstrap.Popover.getInstance(this.containerElement)&&this.containerElement.getAttribute("aria-describedby")?this.popover.hide():(this.popover.setContent({".popover-body":this.getTooltipContent()}),this.popover.show())}else console.warn("CircularProgress: Bootstrap is required for tooltip support")}getTooltipContent(){return"function"==typeof this.tooltip?this.tooltip(this.value,{min:this.min,max:this.max,percentage:this.getPercentage()}):"object"==typeof this.tooltip?this.tooltip.html||this.tooltip.content||"":this.tooltip||""}setValue(t,e=!0){if(this.value,this.value=Math.max(this.min,Math.min(this.max,t)),this.renderCenterContent(),this.svg&&!this.segments){const t=this.svg.querySelector(".circular-progress-bar");if(t){const s=this.size/2-this.strokeWidth/2,i=2*Math.PI*s,r=(this.gap>0?360-this.gap:360)/360*i,o=r-this.getPercentage()/100*r;e?(t.style.transition=`stroke-dashoffset ${this.animationDuration}ms ${this.animationEasing}`,t.style.strokeDashoffset=o):(t.style.transition="none",t.style.strokeDashoffset=o)}}else{const t=this.animate;this.animate=e,this.renderProgress(),this.animate=t}}setRange(t,e){this.min=t,this.max=e,this.renderProgress(),this.renderCenterContent()}increment(t=1){this.setValue(this.value+t)}decrement(t=1){this.setValue(this.value-t)}setColor(t){if(this.color=t,this.gradientColors=null,this.svg&&!this.segments){const e=this.svg.querySelector(".circular-progress-bar");e&&e.setAttribute("stroke",t)}else this.renderProgress()}setGradient(t){Array.isArray(t)&&t.length>1&&(this.gradientColors=t,this.gradientId=`gradient-${Math.random().toString(36).substr(2,9)}`,this.renderProgress())}setSize(t){this.containerElement&&this.sizePreset&&this.containerElement.classList.remove(`circular-progress-${this.sizePreset}`),this.sizePreset="string"==typeof t&&this.SIZE_PRESETS[t]?t:null,this.size=this.resolveSize(t),this.strokeWidth=this.getAutoStrokeWidth(t),this.containerElement&&(this.containerElement.style.width=`${this.size}px`,this.containerElement.style.height=`${this.size}px`,this.sizePreset&&this.containerElement.classList.add(`circular-progress-${this.sizePreset}`)),this.svg&&(this.svg.setAttribute("width",this.size),this.svg.setAttribute("height",this.size),this.svg.setAttribute("viewBox",`0 0 ${this.size} ${this.size}`)),this.renderProgress()}animateTo(t,e=1e3){const s=this.value,i=t-s,r=performance.now(),o=a=>{const n=a-r,h=Math.min(n/e,1),l=1-Math.pow(1-h,3),c=s+i*l;this.setValue(c,!1),h<1?requestAnimationFrame(o):this.setValue(t,!1)};requestAnimationFrame(o)}pulse(){this.containerElement&&(this.containerElement.style.animation="none",setTimeout(()=>{this.containerElement.style.animation="circular-progress-pulse 0.5s ease-out"},10),setTimeout(()=>{this.containerElement.style.animation=""},500))}complete(){this.variant="success",this.applyVariant(),this.setValue(this.max),this.pulse()}reset(){this.setValue(this.min)}hide(){this.element&&(this.element.style.display="none")}show(){this.element&&(this.element.style.display="")}getValue(){return this.value}getPercentageValue(){return this.getPercentage()}async onBeforeDestroy(){this.popover&&(this.popover.dispose(),this.popover=null),await super.onBeforeDestroy()}}exports.BaseChart=t.BaseChart,exports.MetricsChart=t.MetricsChart,exports.MetricsMiniChart=t.MetricsMiniChart,exports.MetricsMiniChartWidget=t.MetricsMiniChartWidget,exports.MiniChart=t.MiniChart,exports.PieChart=t.PieChart,exports.SeriesChart=t.SeriesChart,exports.WebApp=s.WebApp,exports.BUILD_TIME=i.BUILD_TIME,exports.VERSION=i.VERSION,exports.VERSION_INFO=i.VERSION_INFO,exports.VERSION_MAJOR=i.VERSION_MAJOR,exports.VERSION_MINOR=i.VERSION_MINOR,exports.VERSION_REVISION=i.VERSION_REVISION,exports.CircularProgress=CircularProgress;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./chunks/MetricsMiniChartWidget-DpdCMZZq.js"),e=require("./chunks/Rest-BpDyhFfG.js"),s=require("./chunks/Dialog-Ba8-_bwZ.js"),i=require("./chunks/version-DQJsIARK.js");class CircularProgress extends e.View{constructor(t={}){super({className:`circular-progress ${t.className||""}`,...t}),this.SIZE_PRESETS={xs:40,sm:60,md:80,lg:120,xl:180},this.STROKE_PRESETS={xs:4,sm:6,md:8,lg:12,xl:16},this.value=void 0!==t.value?t.value:0,this.min=void 0!==t.min?t.min:0,this.max=void 0!==t.max?t.max:100,this.sizePreset="string"==typeof t.size&&this.SIZE_PRESETS[t.size]?t.size:null,this.size=this.resolveSize(void 0!==t.size?t.size:"md"),this.strokeWidth="auto"===t.strokeWidth||void 0===t.strokeWidth?this.getAutoStrokeWidth(t.size):t.strokeWidth,this.theme=t.theme||"basic",this.variant=t.variant||"default",this.color=t.color,this.trackColor=t.trackColor,this.textColor=t.textColor,this.gradientColors=t.gradientColors||null,this.applyTheme(),this.applyVariant(),this.rotation=void 0!==t.rotation?t.rotation:-90,this.gap=t.gap||0,this.showValue=!1!==t.showValue,this.valueFormat=t.valueFormat||"percentage",this.valueFormatter=t.valueFormatter||null,this.label=t.label||null,this.labelHtml=t.labelHtml||null,this.icon=t.icon||null,this.animate=!1!==t.animate,this.animationDuration=t.animationDuration||600,this.animationEasing=t.animationEasing||"ease-out",this.rounded=!1!==t.rounded,this.shadow=t.shadow||!1,this.clickable=t.clickable||!1,this.tooltip=t.tooltip||null,this.tooltipPlacement=t.tooltipPlacement||"top",this.segments=t.segments||null,this.segmentGap=t.segmentGap||2,this.dataFormatter=e.dataFormatter,this.svg=null,this.centerElement=null,this.popover=null,this.gradientId=`gradient-${Math.random().toString(36).substr(2,9)}`}resolveSize(t){return"string"==typeof t&&this.SIZE_PRESETS[t]?this.SIZE_PRESETS[t]:"number"==typeof t?t:this.SIZE_PRESETS.md}getAutoStrokeWidth(t){if("string"==typeof t&&this.STROKE_PRESETS[t])return this.STROKE_PRESETS[t];const e=this.resolveSize(t);return e<=40?4:e<=60?6:e<=80?8:e<=120?12:16}applyTheme(){const t={basic:{trackColor:"#e9ecef",textColor:null,backgroundColor:null},shadowed:{trackColor:"#d1d5db",textColor:null,backgroundColor:null,shadow:!0},dark:{trackColor:"#374151",textColor:"#e5e7eb",backgroundColor:"#1f2937"},light:{trackColor:"#f3f4f6",textColor:"#111827",backgroundColor:"#ffffff"}},e=t[this.theme]||t.basic;this.trackColor||(this.trackColor=e.trackColor),!this.textColor&&e.textColor&&(this.textColor=e.textColor),e.shadow&&!1===this.shadow&&(this.shadow=e.shadow)}applyVariant(){const t={success:{color:"#198754",trackColor:"rgba(25, 135, 84, 0.1)"},danger:{color:"#dc3545",trackColor:"rgba(220, 53, 69, 0.1)"},warning:{color:"#ffc107",trackColor:"rgba(255, 193, 7, 0.1)"},info:{color:"#0dcaf0",trackColor:"rgba(13, 202, 240, 0.1)"},default:{color:"#0d6efd"}};if(t[this.variant]){const e=t[this.variant];this.color||(this.color=e.color),e.trackColor&&this.trackColor===this.applyTheme.trackColor&&(this.trackColor=e.trackColor)}this.color||(this.color="#0d6efd")}getTemplate(){const t=this.sizePreset?`circular-progress-${this.sizePreset}`:"",e="default"!==this.variant?`circular-progress-${this.variant}`:"",s="basic"!==this.theme?`circular-progress-theme-${this.theme}`:"",i=this.clickable?"circular-progress-clickable":"",r=this.shadow?"circular-progress-shadow":"",o=this.textColor?`color: ${this.textColor};`:"";return`\n <div class="circular-progress-container ${t} ${e} ${s} ${i} ${r}"\n style="width: ${this.size}px; height: ${this.size}px;">\n <svg class="circular-progress-svg" \n width="${this.size}" \n height="${this.size}"\n viewBox="0 0 ${this.size} ${this.size}">\n </svg>\n <div class="circular-progress-center" style="${o}">\n <div class="circular-progress-content"></div>\n </div>\n </div>\n `}async onAfterRender(){this.svg=this.element.querySelector(".circular-progress-svg"),this.centerElement=this.element.querySelector(".circular-progress-content"),this.containerElement=this.element.querySelector(".circular-progress-container"),this.renderProgress(),this.renderCenterContent(),this.clickable&&this.setupClickHandler(),this.tooltip&&this.clickable&&this.setupTooltip()}renderProgress(){if(!this.svg)return;this.svg.innerHTML="";const t=this.size/2,e=(this.size-this.strokeWidth)/2,s=2*Math.PI*e;this.gradientColors&&this.gradientColors.length>1&&this.createGradient(),this.segments&&Array.isArray(this.segments)&&this.segments.length>0?this.renderSegments(t,e,s):this.renderSingleProgress(t,e,s)}renderSingleProgress(t,e,s){const i=(this.gap>0?360-this.gap:360)/360*s,r=this.createCircle(t,e,{stroke:this.trackColor,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:this.gap>0?`${i} ${s}`:"none",transform:`rotate(${this.rotation} ${t} ${t})`});this.svg.appendChild(r);const o=i-this.getPercentage()/100*i,a=this.gradientColors?`url(#${this.gradientId})`:this.color,n=this.createCircle(t,e,{stroke:a,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:`${i} ${s}`,strokeDashoffset:this.animate?i:o,transform:`rotate(${this.rotation} ${t} ${t})`,class:"circular-progress-bar"});this.svg.appendChild(n),this.animate&&this.animateProgress(n,o)}renderSegments(t,e,s){const i=(this.gap>0?360-this.gap:360)/360*s,r=this.createCircle(t,e,{stroke:this.trackColor,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:this.gap>0?`${i} ${s}`:"none",transform:`rotate(${this.rotation} ${t} ${t})`});this.svg.appendChild(r),this.segments.reduce((t,e)=>t+(e.value||0),0)>this.max&&console.warn("CircularProgress: Segment total exceeds max value. Clamping to max.");let o=0;this.segments.forEach((r,a)=>{const n=(r.value||0)/(this.max-this.min)*100/100*i,h=this.segmentGap/360*s;if(n>0){const l=this.createCircle(t,e,{stroke:r.color||this.color,strokeWidth:this.strokeWidth,fill:"none",strokeLinecap:this.rounded?"round":"butt",strokeDasharray:`${n} ${s}`,strokeDashoffset:this.animate?i:-o,transform:`rotate(${this.rotation} ${t} ${t})`,class:`circular-progress-segment circular-progress-segment-${a}`,"data-segment-index":a});this.svg.appendChild(l),this.animate&&this.animateProgress(l,-o,100*a),o+=n+h}})}createCircle(t,e,s={}){const i=document.createElementNS("http://www.w3.org/2000/svg","circle");return i.setAttribute("cx",t),i.setAttribute("cy",t),i.setAttribute("r",e),Object.entries(s).forEach(([t,e])=>{"strokeWidth"===t?i.setAttribute("stroke-width",e):"strokeLinecap"===t?i.setAttribute("stroke-linecap",e):"strokeDasharray"===t?i.setAttribute("stroke-dasharray",e):"strokeDashoffset"===t?i.setAttribute("stroke-dashoffset",e):i.setAttribute(t,e)}),i}createGradient(){const t=document.createElementNS("http://www.w3.org/2000/svg","defs"),e=document.createElementNS("http://www.w3.org/2000/svg","linearGradient");e.setAttribute("id",this.gradientId),e.setAttribute("x1","0%"),e.setAttribute("y1","0%"),e.setAttribute("x2","100%"),e.setAttribute("y2","100%"),this.gradientColors.forEach((t,s)=>{const i=document.createElementNS("http://www.w3.org/2000/svg","stop"),r=s/(this.gradientColors.length-1)*100;i.setAttribute("offset",`${r}%`),i.setAttribute("stop-color",t),e.appendChild(i)}),t.appendChild(e),this.svg.appendChild(t)}animateProgress(t,e,s=0){setTimeout(()=>{t.style.transition=`stroke-dashoffset ${this.animationDuration}ms ${this.animationEasing}`,t.style.strokeDashoffset=e},s)}renderCenterContent(){if(this.centerElement)if(this.labelHtml)this.centerElement.innerHTML=this.labelHtml;else if(this.icon)this.centerElement.innerHTML=`<i class="${this.icon}"></i>`;else if(this.showValue){let t=`<div class="circular-progress-value">${this.getFormattedValue()}</div>`;this.label&&(t+=`<div class="circular-progress-label">${this.label}</div>`),this.centerElement.innerHTML=t}}getFormattedValue(){const t=this.value,e=this.min,s=this.max;if(this.valueFormatter&&"function"==typeof this.valueFormatter)return this.valueFormatter(t,e,s);switch(this.valueFormat){case"percentage":return`${Math.round(this.getPercentage())}%`;case"fraction":return`${t}/${s}`;case"value":return t.toString();default:if(this.dataFormatter)try{return this.dataFormatter.pipe(t,this.valueFormat)}catch(i){return console.warn("CircularProgress: DataFormatter error, falling back to percentage",i),`${Math.round(this.getPercentage())}%`}return`${Math.round(this.getPercentage())}%`}}getPercentage(){const t=this.max-this.min;return 0===t?0:(this.value-this.min)/t*100}setupClickHandler(){this.containerElement&&(this.containerElement.style.cursor="pointer",this.containerElement.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const e=this.getPercentage();this.emit("progress:clicked",{value:this.value,percentage:e,min:this.min,max:this.max}),this.tooltip&&this.togglePopover()}))}setupTooltip(){}togglePopover(){if(this.containerElement&&void 0!==window.bootstrap){if(!this.popover){const t=this.getTooltipContent(),e="object"==typeof this.tooltip&&this.tooltip.title?this.tooltip.title:void 0,s={content:t,html:!0,placement:this.tooltipPlacement,trigger:"manual",container:"body"};e&&(s.title=e),this.popover=new window.bootstrap.Popover(this.containerElement,s)}window.bootstrap.Popover.getInstance(this.containerElement)&&this.containerElement.getAttribute("aria-describedby")?this.popover.hide():(this.popover.setContent({".popover-body":this.getTooltipContent()}),this.popover.show())}else console.warn("CircularProgress: Bootstrap is required for tooltip support")}getTooltipContent(){return"function"==typeof this.tooltip?this.tooltip(this.value,{min:this.min,max:this.max,percentage:this.getPercentage()}):"object"==typeof this.tooltip?this.tooltip.html||this.tooltip.content||"":this.tooltip||""}setValue(t,e=!0){if(this.value,this.value=Math.max(this.min,Math.min(this.max,t)),this.renderCenterContent(),this.svg&&!this.segments){const t=this.svg.querySelector(".circular-progress-bar");if(t){const s=this.size/2-this.strokeWidth/2,i=2*Math.PI*s,r=(this.gap>0?360-this.gap:360)/360*i,o=r-this.getPercentage()/100*r;e?(t.style.transition=`stroke-dashoffset ${this.animationDuration}ms ${this.animationEasing}`,t.style.strokeDashoffset=o):(t.style.transition="none",t.style.strokeDashoffset=o)}}else{const t=this.animate;this.animate=e,this.renderProgress(),this.animate=t}}setRange(t,e){this.min=t,this.max=e,this.renderProgress(),this.renderCenterContent()}increment(t=1){this.setValue(this.value+t)}decrement(t=1){this.setValue(this.value-t)}setColor(t){if(this.color=t,this.gradientColors=null,this.svg&&!this.segments){const e=this.svg.querySelector(".circular-progress-bar");e&&e.setAttribute("stroke",t)}else this.renderProgress()}setGradient(t){Array.isArray(t)&&t.length>1&&(this.gradientColors=t,this.gradientId=`gradient-${Math.random().toString(36).substr(2,9)}`,this.renderProgress())}setSize(t){this.containerElement&&this.sizePreset&&this.containerElement.classList.remove(`circular-progress-${this.sizePreset}`),this.sizePreset="string"==typeof t&&this.SIZE_PRESETS[t]?t:null,this.size=this.resolveSize(t),this.strokeWidth=this.getAutoStrokeWidth(t),this.containerElement&&(this.containerElement.style.width=`${this.size}px`,this.containerElement.style.height=`${this.size}px`,this.sizePreset&&this.containerElement.classList.add(`circular-progress-${this.sizePreset}`)),this.svg&&(this.svg.setAttribute("width",this.size),this.svg.setAttribute("height",this.size),this.svg.setAttribute("viewBox",`0 0 ${this.size} ${this.size}`)),this.renderProgress()}animateTo(t,e=1e3){const s=this.value,i=t-s,r=performance.now(),o=a=>{const n=a-r,h=Math.min(n/e,1),l=1-Math.pow(1-h,3),c=s+i*l;this.setValue(c,!1),h<1?requestAnimationFrame(o):this.setValue(t,!1)};requestAnimationFrame(o)}pulse(){this.containerElement&&(this.containerElement.style.animation="none",setTimeout(()=>{this.containerElement.style.animation="circular-progress-pulse 0.5s ease-out"},10),setTimeout(()=>{this.containerElement.style.animation=""},500))}complete(){this.variant="success",this.applyVariant(),this.setValue(this.max),this.pulse()}reset(){this.setValue(this.min)}hide(){this.element&&(this.element.style.display="none")}show(){this.element&&(this.element.style.display="")}getValue(){return this.value}getPercentageValue(){return this.getPercentage()}async onBeforeDestroy(){this.popover&&(this.popover.dispose(),this.popover=null),await super.onBeforeDestroy()}}exports.BaseChart=t.BaseChart,exports.MetricsChart=t.MetricsChart,exports.MetricsMiniChart=t.MetricsMiniChart,exports.MetricsMiniChartWidget=t.MetricsMiniChartWidget,exports.MiniChart=t.MiniChart,exports.PieChart=t.PieChart,exports.SeriesChart=t.SeriesChart,exports.WebApp=s.WebApp,exports.BUILD_TIME=i.BUILD_TIME,exports.VERSION=i.VERSION,exports.VERSION_INFO=i.VERSION_INFO,exports.VERSION_MAJOR=i.VERSION_MAJOR,exports.VERSION_MINOR=i.VERSION_MINOR,exports.VERSION_REVISION=i.VERSION_REVISION,exports.CircularProgress=CircularProgress;
|
|
2
2
|
//# sourceMappingURL=charts.cjs.js.map
|
package/dist/charts.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B, M, b, c, a, P, S } from "./chunks/MetricsMiniChartWidget-
|
|
1
|
+
import { B, M, b, c, a, P, S } from "./chunks/MetricsMiniChartWidget-jCLMh6Bm.js";
|
|
2
2
|
import { V as View, d as dataFormatter } from "./chunks/Rest-DpbPbmra.js";
|
|
3
|
-
import { W } from "./chunks/Dialog-
|
|
4
|
-
import { B as B2, a as a2, V, b as b2, c as c2, d } from "./chunks/version-
|
|
3
|
+
import { W } from "./chunks/Dialog-DhUxk9f6.js";
|
|
4
|
+
import { B as B2, a as a2, V, b as b2, c as c2, d } from "./chunks/version-DMeIxex5.js";
|
|
5
5
|
class CircularProgress extends View {
|
|
6
6
|
constructor(options = {}) {
|
|
7
7
|
super({
|