react-semaphor 0.1.177 → 0.1.179
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/chunks/{dashboard-controls-00cjSeD7.js → dashboard-controls-CeT5saB7.js} +8 -8
- package/dist/chunks/{dashboard-controls-C9IWIFfW.js → dashboard-controls-O2Vl2SaH.js} +204 -203
- package/dist/chunks/{dashboard-json--ke9XK9p.js → dashboard-json--jGkpREU.js} +1 -1
- package/dist/chunks/{dashboard-json-BDjl-3ej.js → dashboard-json-d1qZ8OYo.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BBsC9feJ.js → edit-dashboard-visual-BsP87bZV.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-BroCdmtP.js → edit-dashboard-visual-ViDNkE8Q.js} +1 -1
- package/dist/chunks/{editor-action-buttons-JE9t84-4.js → editor-action-buttons-DseT424l.js} +1 -1
- package/dist/chunks/{editor-action-buttons-CHoiNw7F.js → editor-action-buttons-F4_UU-Mk.js} +2 -2
- package/dist/chunks/index-8Crk3ROJ.js +1 -0
- package/dist/chunks/index-B4EhQdS9.js +1857 -0
- package/dist/chunks/{index-CdfFCbJb.js → index-CFWw2cJ5.js} +228 -228
- package/dist/chunks/{index-DZjcALSv.js → index-v6ayK5K2.js} +19466 -21309
- package/dist/chunks/{resource-management-panel-DE8DnPSl.js → resource-management-panel-CApVr9Vd.js} +3 -3
- package/dist/chunks/{resource-management-panel-C96ElLa5.js → resource-management-panel-Cn1aOr6L.js} +1 -1
- package/dist/chunks/{schedule-dashboard-BFa0Uljc.js → schedule-dashboard-B4KUKLfW.js} +3 -3
- package/dist/chunks/{schedule-dashboard-CzU0ziLB.js → schedule-dashboard-vvFw8B1E.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Rd1BhDG4.js → use-role-aware-display-preferences-Bxp6i8c7.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-Dovp_VmV.js → use-role-aware-display-preferences-C-N0-Iik.js} +1 -1
- package/dist/chunks/{use-visual-utils-Cnju2tnE.js → use-visual-utils-D19qzwzI.js} +1 -1
- package/dist/chunks/{use-visual-utils-BkRr5LoD.js → use-visual-utils-D9lMGeVv.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/format-utils/index.cjs +5 -0
- package/dist/format-utils/index.js +451 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/format-utils.d.ts +375 -0
- package/package.json +14 -1
package/dist/chunks/{resource-management-panel-DE8DnPSl.js → resource-management-panel-CApVr9Vd.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
-
import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-
|
|
2
|
+
import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-v6ayK5K2.js";
|
|
3
3
|
import Lt, { useRef as At, useEffect as ie, useState as x } from "react";
|
|
4
|
-
import { a as Ke } from "./use-visual-utils-
|
|
5
|
-
import { u as Tt } from "./use-role-aware-display-preferences-
|
|
4
|
+
import { a as Ke } from "./use-visual-utils-D9lMGeVv.js";
|
|
5
|
+
import { u as Tt } from "./use-role-aware-display-preferences-C-N0-Iik.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
package/dist/chunks/{resource-management-panel-C96ElLa5.js → resource-management-panel-Cn1aOr6L.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CFWw2cJ5.js"),c=require("react"),de=require("./use-visual-utils-D19qzwzI.js"),pe=require("./use-role-aware-display-preferences-Bxp6i8c7.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
|
|
2
|
-
import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-
|
|
3
|
-
import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-
|
|
2
|
+
import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-v6ayK5K2.js";
|
|
3
|
+
import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-F4_UU-Mk.js";
|
|
4
4
|
import we, { useState as D, useContext as Ie, useEffect as ke } from "react";
|
|
5
|
-
import { a as W } from "./use-visual-utils-
|
|
5
|
+
import { a as W } from "./use-visual-utils-D9lMGeVv.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),e=require("./index-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),e=require("./index-CFWw2cJ5.js"),C=require("./editor-action-buttons-DseT424l.js"),x=require("react"),y=require("./use-visual-utils-D19qzwzI.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-CFWw2cJ5.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-
|
|
1
|
+
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-v6ayK5K2.js";
|
|
2
2
|
import { useMemo as i } from "react";
|
|
3
3
|
function S() {
|
|
4
4
|
const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./index-
|
|
1
|
+
"use strict";const s=require("./index-CFWw2cJ5.js"),g=require("react");function H(e){const a=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),c=e.toUpperCase().indexOf("ORDER BY");let d=e.length;if(c!==-1&&(d=c),r!==-1&&r<d&&(d=r),a!==-1){const i=e.substring(0,a),o=e.substring(a);return`${i} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const i=e.substring(0,t),o=e.substring(t);return`${i} {{ filters | where }} ${o}`}else{const i=e.substring(0,d),o=e.substring(d);return console.log("beforeClause",i),console.log("afterClause",o),o?`${i} {{ filters | where }} ${o}`:`${i.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,t]=g.useState(null),[r,c]=g.useState(null),d=s.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),c(null);return}if(!d)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),c(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),c(l),t(null)}})()},[e,d]),a}function Q(e,a){if(e.length===0)return"";if(a){const t=e.find(r=>r.id===a);if(t){const r=t.tabTitle;if(r=="All__Header")return e[0].id;if(r&&r.endsWith("__Header")){const d=r.split("__")[0],i=e.find(o=>o.tabTitle===d);return i?i.id:e[0].id}return a}}return e[0].id}async function j(e,a,t,r){if(!a||!t)throw new Error("Missing auth token or visual ID");const c=["resource-by-id","visual",t],d=r.getQueryData(c);if(d)return console.log("Using cached visual data for:",t),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",t);const i=s.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(c,l),s.ue.dismiss(i),{data:l,fromCache:!1}}catch(o){throw s.ue.dismiss(i),o}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function z(e,a){var d,i;const t=(e==null?void 0:e.frameObject)??((d=e==null?void 0:e.visual)==null?void 0:d.frameObject);if(!t)return!1;const r=T(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const c=(i=r.cards)==null?void 0:i.find(o=>o.id===r.activeCardId);return c?(s.setupEditorWithCard({...a,frame:r,card:c,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function G(){var C;const{setCardSql:e}=s.useEditorActions(),a=s.useEditorStore(n=>n.frame),t=s.useEditorStore(n=>n.card),r=s.useEditorStore(n=>n.isDevMode),c=B(((C=t.customCardPreferences)==null?void 0:C.url)||""),d=s.useEditorStore(n=>n.selectedSchemaName),i=s.useEditorStore(n=>n.selectedDatamodelId),o=s.useEditorStore(n=>n.selectedDatabaseName),l=s.useEditorStore(n=>n.selectedTableName),h=s.useEditorStore(n=>n.selectedConnectionId),m=s.useEditorStore(n=>n.isShowingVisual),S=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let n=S;S&&!S.includes("{{")&&(n=H(S),e(n));const w=(I=c==null?void 0:c.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:i,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?n:void 0,python:r?t.python:void 0,config:r?void 0:t.config,customCfg:m?t.customCfg:null,preferences:t.preferences,...w&&{customCardPreferences:{...t.customCardPreferences,settings:w}}},E=a.cards.map(p=>p.id===t.id?v:p);return{...a,cards:E,activeCardId:Q(E,a.activeCardId)}},[t,a,r,m,d,i,o,l,h,e,c,S])}}function Y(){const{authToken:e,tokenProps:a}=s.useSemaphorContext(),t=s.useQueryClient(),r=s.useSelectedVisual(),{selectVisual:c}=s.useManagementActions(),{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I}=s.useEditorActions(),{setIsDashboardEditing:p,setIsVisualEditing:$,setSelectedFrameId:D,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=s.useDashboardActions(),y=s.useDashboardStore(u=>u.selectedSheetId),O=s.useDashboardStore(u=>u.selectedFrameId),x=s.useDashboardStore(u=>u.dashboard),W=s.useDashboardStore(u=>u.filterValues),F=s.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),k=g.useCallback(async u=>{try{c(u),A();const{data:b,fromCache:f}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!z(b,{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I,setIsDashboardEditing:p,setIsVisualEditing:$,dashboard:x,selectedSheetId:y,selectedFrameId:O,filterValues:W}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,d,i,p,$,o,l,h,m,S,V,C,n,w,v,E,I,A,x,y,O,W]),_=g.useCallback(async u=>{var b;try{if(c(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:M}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),L=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const U=T(L);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...s.cloneFrameWithNewIds(U),visualId:u.id};return N(y,P,"end"),p(!0),D(P.id),R(!1),{success:!0,fromCache:M}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,y,N,p,D,R]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:k,handleAddLibraryVisual:_,getUpdatedFrame:G().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=Y;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { az as G, aA as Y, p as J, q as K, aB as X, m as z, o as Z, u as v, aC as q, aD as ee, t as V, aE as te, n as f } from "./index-
|
|
1
|
+
import { az as G, aA as Y, p as J, q as K, aB as X, m as z, o as Z, u as v, aC as q, aD as ee, t as V, aE as te, n as f } from "./index-v6ayK5K2.js";
|
|
2
2
|
import { useState as T, useEffect as re, useCallback as A } from "react";
|
|
3
3
|
function se(e) {
|
|
4
4
|
const o = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), n = e.toUpperCase().indexOf("ORDER BY");
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CFWw2cJ5.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../chunks/index-8Crk3ROJ.js"),W=[{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e7,suffix:"Cr"},{value:1e6,suffix:"M"},{value:1e5,suffix:"L"},{value:1e3,suffix:"K"}];function T(r){const e=Math.abs(r);for(const{value:t,suffix:u}of W)if(e>=t)return{divisor:t,suffix:u};return{divisor:1,suffix:""}}function O(r){try{return new Intl.NumberFormat(r),!0}catch{return!1}}function f(r){return r&&O(r)?r:"en-US"}function w(r,e){if(r==null||isNaN(r))return"";const t=f(e==null?void 0:e.locale);let u=r;if(e!=null&&e.multiplyBy&&(u*=e.multiplyBy),e!=null&&e.useSuffix){const{divisor:c,suffix:l}=T(u);u=u/c;const i=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(u);return`${(e==null?void 0:e.prefix)??""}${i}${l}${(e==null?void 0:e.suffix)??""}`}const a=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(u);if(e!=null&&e.negativeInParentheses&&u<0){const c=a.replace("-","");return`${(e==null?void 0:e.prefix)??""}(${c})${(e==null?void 0:e.suffix)??""}`}return`${(e==null?void 0:e.prefix)??""}${a}${(e==null?void 0:e.suffix)??""}`}function g(r,e){if(r==null||isNaN(r))return"";const t=f(e==null?void 0:e.locale),u=(e==null?void 0:e.currency)||"USD";if(e!=null&&e.useSuffix){const{divisor:a,suffix:c}=T(r),l=r/a;return`${new Intl.NumberFormat(t,{style:"currency",currency:u,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(l)}${c}`}return new Intl.NumberFormat(t,{style:"currency",currency:u,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r)}function N(r,e){if(r==null||isNaN(r))return"";const t=f(e==null?void 0:e.locale),u=e!=null&&e.alreadyPercent?r/100:r;return new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(u)}function V(r,e){if(r==null||isNaN(r))return"";const t=f(e==null?void 0:e.locale);return new Intl.NumberFormat(t,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r)}function D(r,e,t="en-US"){if(r==null||isNaN(r))return"";const u=f((e==null?void 0:e.locale)||t),a=(e==null?void 0:e.style)||"decimal";return a==="percent"?new Intl.NumberFormat(u,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r/100):a==="currency"?new Intl.NumberFormat(u,{style:"currency",currency:(e==null?void 0:e.currency)||"USD",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r):new Intl.NumberFormat(u,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r)}function z(r,e,t){const u={locale:t==null?void 0:t.locale,currency:t==null?void 0:t.currency,minimumFractionDigits:t==null?void 0:t.decimalPlaces,maximumFractionDigits:t==null?void 0:t.decimalPlaces,useSuffix:t==null?void 0:t.useSuffix,prefix:t==null?void 0:t.prefix,suffix:t==null?void 0:t.suffix,negativeInParentheses:t==null?void 0:t.negativeInParentheses,multiplyBy:t==null?void 0:t.multiplyBy};switch(e){case"currency":return g(r,u);case"percent":return N(r,u);case"scientific":return V(r,u);default:return w(r,u)}}function F(r,e){return r&&r!=="auto"?r:e}function k(r,e=new Date){try{const t={timeZone:r,timeZoneName:"short"},a=new Intl.DateTimeFormat("en-US",t).formatToParts(e).find(c=>c.type==="timeZoneName");return(a==null?void 0:a.value)||r}catch{return r}}function q(r){try{const e={timeZone:r,timeZoneName:"long"},u=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(a=>a.type==="timeZoneName");return(u==null?void 0:u.value)||r}catch{return r}}function b(r,e="auto"){if(!r)return new Date(NaN);const t=r.endsWith("Z"),u=/[+-]\d{2}:?\d{2}$/.test(r),a=/\([A-Z]{3,4}\)$/.test(r);if(e==="auto")return t||u||a?new Date(r):new Date(r+"Z");if(e==="local"){if(t||u){const c=r.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(c)}return new Date(r)}else return e==="UTC"?t?new Date(r):u?new Date(r):new Date(r+"Z"):t||u||a?new Date(r):new Date(r+"Z")}function C(r,e,t){if(r==null)return"";try{const u=typeof r=="string"?b(r,e==null?void 0:e.sourceTimezone):r;if(isNaN(u.getTime()))return String(r);if(e!=null&&e.useRelativeTime)return I(u);const a=e!=null&&e.useCustomFormat&&(e!=null&&e.customFormat)?e.customFormat:(e==null?void 0:e.format)||"MM/dd/yyyy",c=F(e==null?void 0:e.timezone,t||"UTC");return S.formatInTimeZone(u,c,a)}catch{return String(r)}}function I(r){if(r==null)return"";try{const e=typeof r=="string"?S.parseISO(r):r;return isNaN(e.getTime())?String(r):S.formatDistanceToNow(e,{addSuffix:!0})}catch{return String(r)}}function $(r,e,t){return C(r,e,t)}function R(r,e,t){if(r==null)return"";if(!t.useFormattedValues||!e)return String(r);switch(e.type){case"number":return typeof r=="number"?D(r,e.numberFormat,t.locale):String(r);case"date":return $(r,e.dateFormat,t.timezone);case"progress":return typeof r=="number"?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function L(r,e){return e.visibleColumns.map(t=>{const u=r[t],a=e.columnSettings[t];return R(u,a,{useFormattedValues:e.useFormattedValues,timezone:e.timezone,locale:e.locale})})}function s(r,e=","){if(r==null)return"";const t=String(r);return t.includes(e)||t.includes('"')||t.includes(`
|
|
2
|
+
`)||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t}function d(r,e=","){return r.map(t=>s(t,e)).join(e)}function P(r,e={}){const{delimiter:t=",",lineEnding:u=`
|
|
3
|
+
`}=e;return r.map(a=>d(a,t)).join(u)}function v(r,e={}){if(r.length===0)return"";const{delimiter:t=",",lineEnding:u=`
|
|
4
|
+
`,includeHeaders:a=!0,columns:c}=e,l=c||Object.keys(r[0]),i=[];a&&i.push(l);for(const m of r){const y=l.map(h=>{const n=m[h];return n==null?"":String(n)});i.push(y)}return P(i,{delimiter:t,lineEnding:u})}function A(r,e){const t=[];e.includeHeaders&&t.push(d(e.visibleColumns,e.delimiter));for(const u of r){const a=L(u,e);t.push(a.map(c=>s(c,e.delimiter)).join(e.delimiter))}return t}function K(r,e,t=`
|
|
5
|
+
`){return A(r,e).join(t)}function X(r,e,t){return r==null?"":t.useFormattedValues?typeof r=="number"&&(e==null?void 0:e.type)==="number"?D(r,e.numberFormat,t.locale):typeof r=="number"?r.toLocaleString(t.locale):String(r):String(r)}function B(r,e,t){var a,c;const u=[];if(r.isSubtotal&&!r.isGrandTotal){const l=e.groupByColumns.findIndex(i=>i.alias===r.subtotalLevel);e.groupByColumns.forEach((i,m)=>{var y,h,n,x;if(m===l){const M=(h=(y=e.rowAggregates)==null?void 0:y.find(G=>G.groupLevel===r.subtotalLevel))==null?void 0:h.label,U=(x=(n=r.subtotalContext)==null?void 0:n.groupByValues)==null?void 0:x[i.alias];u.push(M??`Subtotal (${U??"Total"})`)}else m<l?u.push(String(r[i.alias]??"")):u.push("")})}else if(r.isGrandTotal){const l=(c=(a=e.rowAggregates)==null?void 0:a.find(i=>i.groupLevel==="ALL"))==null?void 0:c.label;u.push(l||"Grand Total"),e.groupByColumns.slice(1).forEach(()=>u.push(""))}else e.groupByColumns.forEach(l=>{u.push(String(r[l.alias]??""))});return e.pivotSchema.filter(l=>l.isMetricColumn).forEach(l=>{const i=r[l.alias],m=t.columnSettings[l.alias];u.push(X(i,m,t))}),u}function E(r){const e=r.groupByColumns.map(u=>u.label||u.name),t=r.pivotSchema.filter(u=>u.isMetricColumn).map(u=>u.displayLabel||u.metricLabel||u.metricName||u.alias);return[...e,...t]}function _(r,e,t){const u=[];if(t.includeHeaders){const a=E(e);u.push(d(a,t.delimiter))}for(const a of r){const c=B(a,e,t);u.push(c.map(l=>s(l,t.delimiter)).join(t.delimiter))}return u}function Z(r,e,t){for(const u of r){if(u.level<t){e[u.level].push(u.name);for(let a=1;a<u.colspan;a++)e[u.level].push("")}u.children?Z(u.children,e,t):u.columnKey&&e[t].push(u.name)}}function H(r){const e=r.pivotByColumns.length,t=r.groupByColumns.length,u=Array.from({length:e+1},()=>[]);for(let a=0;a<e;a++)u[a].push(...Array(t).fill(""));if(u[e].push(...r.groupByColumns.map(a=>a.label||a.name)),Z(r.columnHeadersTree,u,e),r.showRowTotals){for(let a=0;a<e;a++)u[a].push("");u[e].push("Total")}return u}function J(r,e,t){if(r==null)return"";if(!t.useFormattedValues)return String(r);const u=t.columnSettings[e];return typeof r=="number"&&(u==null?void 0:u.type)==="number"?D(r,u.numberFormat,t.locale):typeof r=="number"?r.toLocaleString(t.locale):String(r)}function j(r,e,t){const u=[];r.fieldValues.forEach((c,l)=>{r.isSubtotal&&l===0?u.push(`${c} Total`):r.isSubtotal?u.push(""):u.push(String(c??""))});let a=0;return e.columnHeaders.forEach(c=>{var m;const l=(m=r.cells[c])==null?void 0:m.value,i=J(l,c,t);u.push(i),e.showRowTotals&&typeof l=="number"&&(a+=l)}),e.showRowTotals&&u.push(a.toLocaleString(t.locale)),u}function Q(r,e,t){const u=[];if(t.includeHeaders){const a=H(e);for(const c of a)u.push(d(c,t.delimiter))}for(const a of r){const c=j(a,e,t);u.push(c.map(l=>s(l,t.delimiter)).join(t.delimiter))}return u}exports.arrayToCSV=P;exports.arrayToCSVRow=d;exports.escapeCSVValue=s;exports.formatAggregateRow=B;exports.formatAggregateTableForCSV=_;exports.formatCellValue=R;exports.formatCurrency=g;exports.formatDate=C;exports.formatDateWithColumnSettings=$;exports.formatNumber=w;exports.formatNumberCustom=z;exports.formatNumberWithColumnSettings=D;exports.formatPercent=N;exports.formatPivotDataRow=j;exports.formatPivotTableForCSV=Q;exports.formatRelativeTime=I;exports.formatRowForExport=L;exports.formatScientific=V;exports.formatTableForCSV=A;exports.generateAggregateHeaders=E;exports.generatePivotHeaders=H;exports.generateTableCSV=K;exports.getTimezoneAbbreviation=k;exports.getTimezoneName=q;exports.objectsToCSV=v;exports.parseWithSourceTimezone=b;exports.resolveTimezone=F;
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { f as F, p as g, a as I } from "../chunks/index-B4EhQdS9.js";
|
|
2
|
+
const $ = [
|
|
3
|
+
{ value: 1e12, suffix: "T" },
|
|
4
|
+
{ value: 1e9, suffix: "B" },
|
|
5
|
+
{ value: 1e7, suffix: "Cr" },
|
|
6
|
+
// Crore (Indian)
|
|
7
|
+
{ value: 1e6, suffix: "M" },
|
|
8
|
+
{ value: 1e5, suffix: "L" },
|
|
9
|
+
// Lakh (Indian)
|
|
10
|
+
{ value: 1e3, suffix: "K" }
|
|
11
|
+
];
|
|
12
|
+
function S(r) {
|
|
13
|
+
const e = Math.abs(r);
|
|
14
|
+
for (const { value: u, suffix: t } of $)
|
|
15
|
+
if (e >= u)
|
|
16
|
+
return { divisor: u, suffix: t };
|
|
17
|
+
return { divisor: 1, suffix: "" };
|
|
18
|
+
}
|
|
19
|
+
function L(r) {
|
|
20
|
+
try {
|
|
21
|
+
return new Intl.NumberFormat(r), !0;
|
|
22
|
+
} catch {
|
|
23
|
+
return !1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function f(r) {
|
|
27
|
+
return r && L(r) ? r : "en-US";
|
|
28
|
+
}
|
|
29
|
+
function B(r, e) {
|
|
30
|
+
if (r == null || isNaN(r))
|
|
31
|
+
return "";
|
|
32
|
+
const u = f(e == null ? void 0 : e.locale);
|
|
33
|
+
let t = r;
|
|
34
|
+
if (e != null && e.multiplyBy && (t *= e.multiplyBy), e != null && e.useSuffix) {
|
|
35
|
+
const { divisor: a, suffix: l } = S(t);
|
|
36
|
+
t = t / a;
|
|
37
|
+
const i = new Intl.NumberFormat(u, {
|
|
38
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
39
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
|
|
40
|
+
useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
|
|
41
|
+
}).format(t);
|
|
42
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${i}${l}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
43
|
+
}
|
|
44
|
+
const c = new Intl.NumberFormat(u, {
|
|
45
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
46
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
|
|
47
|
+
useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
|
|
48
|
+
}).format(t);
|
|
49
|
+
if (e != null && e.negativeInParentheses && t < 0) {
|
|
50
|
+
const a = c.replace("-", "");
|
|
51
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}(${a})${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
52
|
+
}
|
|
53
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${c}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
54
|
+
}
|
|
55
|
+
function Z(r, e) {
|
|
56
|
+
if (r == null || isNaN(r))
|
|
57
|
+
return "";
|
|
58
|
+
const u = f(e == null ? void 0 : e.locale), t = (e == null ? void 0 : e.currency) || "USD";
|
|
59
|
+
if (e != null && e.useSuffix) {
|
|
60
|
+
const { divisor: c, suffix: a } = S(r), l = r / c;
|
|
61
|
+
return `${new Intl.NumberFormat(u, {
|
|
62
|
+
style: "currency",
|
|
63
|
+
currency: t,
|
|
64
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
65
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
66
|
+
}).format(l)}${a}`;
|
|
67
|
+
}
|
|
68
|
+
return new Intl.NumberFormat(u, {
|
|
69
|
+
style: "currency",
|
|
70
|
+
currency: t,
|
|
71
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
72
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
73
|
+
}).format(r);
|
|
74
|
+
}
|
|
75
|
+
function E(r, e) {
|
|
76
|
+
if (r == null || isNaN(r))
|
|
77
|
+
return "";
|
|
78
|
+
const u = f(e == null ? void 0 : e.locale), t = e != null && e.alreadyPercent ? r / 100 : r;
|
|
79
|
+
return new Intl.NumberFormat(u, {
|
|
80
|
+
style: "percent",
|
|
81
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
82
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
83
|
+
}).format(t);
|
|
84
|
+
}
|
|
85
|
+
function R(r, e) {
|
|
86
|
+
if (r == null || isNaN(r))
|
|
87
|
+
return "";
|
|
88
|
+
const u = f(e == null ? void 0 : e.locale);
|
|
89
|
+
return new Intl.NumberFormat(u, {
|
|
90
|
+
notation: "scientific",
|
|
91
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
92
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
93
|
+
}).format(r);
|
|
94
|
+
}
|
|
95
|
+
function D(r, e, u = "en-US") {
|
|
96
|
+
if (r == null || isNaN(r))
|
|
97
|
+
return "";
|
|
98
|
+
const t = f((e == null ? void 0 : e.locale) || u), c = (e == null ? void 0 : e.style) || "decimal";
|
|
99
|
+
return c === "percent" ? new Intl.NumberFormat(t, {
|
|
100
|
+
style: "percent",
|
|
101
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
102
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
103
|
+
}).format(r / 100) : c === "currency" ? new Intl.NumberFormat(t, {
|
|
104
|
+
style: "currency",
|
|
105
|
+
currency: (e == null ? void 0 : e.currency) || "USD",
|
|
106
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
107
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
108
|
+
}).format(r) : new Intl.NumberFormat(t, {
|
|
109
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
110
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
111
|
+
}).format(r);
|
|
112
|
+
}
|
|
113
|
+
function q(r, e, u) {
|
|
114
|
+
const t = {
|
|
115
|
+
locale: u == null ? void 0 : u.locale,
|
|
116
|
+
currency: u == null ? void 0 : u.currency,
|
|
117
|
+
minimumFractionDigits: u == null ? void 0 : u.decimalPlaces,
|
|
118
|
+
maximumFractionDigits: u == null ? void 0 : u.decimalPlaces,
|
|
119
|
+
useSuffix: u == null ? void 0 : u.useSuffix,
|
|
120
|
+
prefix: u == null ? void 0 : u.prefix,
|
|
121
|
+
suffix: u == null ? void 0 : u.suffix,
|
|
122
|
+
negativeInParentheses: u == null ? void 0 : u.negativeInParentheses,
|
|
123
|
+
multiplyBy: u == null ? void 0 : u.multiplyBy
|
|
124
|
+
};
|
|
125
|
+
switch (e) {
|
|
126
|
+
case "currency":
|
|
127
|
+
return Z(r, t);
|
|
128
|
+
case "percent":
|
|
129
|
+
return E(r, t);
|
|
130
|
+
case "scientific":
|
|
131
|
+
return R(r, t);
|
|
132
|
+
default:
|
|
133
|
+
return B(r, t);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function b(r, e) {
|
|
137
|
+
return r && r !== "auto" ? r : e;
|
|
138
|
+
}
|
|
139
|
+
function J(r, e = /* @__PURE__ */ new Date()) {
|
|
140
|
+
try {
|
|
141
|
+
const u = {
|
|
142
|
+
timeZone: r,
|
|
143
|
+
timeZoneName: "short"
|
|
144
|
+
}, c = new Intl.DateTimeFormat("en-US", u).formatToParts(e).find((a) => a.type === "timeZoneName");
|
|
145
|
+
return (c == null ? void 0 : c.value) || r;
|
|
146
|
+
} catch {
|
|
147
|
+
return r;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function Q(r) {
|
|
151
|
+
try {
|
|
152
|
+
const e = {
|
|
153
|
+
timeZone: r,
|
|
154
|
+
timeZoneName: "long"
|
|
155
|
+
}, t = new Intl.DateTimeFormat("en-US", e).formatToParts(
|
|
156
|
+
/* @__PURE__ */ new Date()
|
|
157
|
+
).find((c) => c.type === "timeZoneName");
|
|
158
|
+
return (t == null ? void 0 : t.value) || r;
|
|
159
|
+
} catch {
|
|
160
|
+
return r;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function A(r, e = "auto") {
|
|
164
|
+
if (!r)
|
|
165
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
166
|
+
const u = r.endsWith("Z"), t = /[+-]\d{2}:?\d{2}$/.test(r), c = /\([A-Z]{3,4}\)$/.test(r);
|
|
167
|
+
if (e === "auto")
|
|
168
|
+
return u || t || c ? new Date(r) : /* @__PURE__ */ new Date(r + "Z");
|
|
169
|
+
if (e === "local") {
|
|
170
|
+
if (u || t) {
|
|
171
|
+
const a = r.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
|
|
172
|
+
return new Date(a);
|
|
173
|
+
}
|
|
174
|
+
return new Date(r);
|
|
175
|
+
} else return e === "UTC" ? u ? new Date(r) : t ? new Date(r) : /* @__PURE__ */ new Date(r + "Z") : u || t || c ? new Date(r) : /* @__PURE__ */ new Date(r + "Z");
|
|
176
|
+
}
|
|
177
|
+
function P(r, e, u) {
|
|
178
|
+
if (r == null)
|
|
179
|
+
return "";
|
|
180
|
+
try {
|
|
181
|
+
const t = typeof r == "string" ? A(r, e == null ? void 0 : e.sourceTimezone) : r;
|
|
182
|
+
if (isNaN(t.getTime()))
|
|
183
|
+
return String(r);
|
|
184
|
+
if (e != null && e.useRelativeTime)
|
|
185
|
+
return H(t);
|
|
186
|
+
const c = e != null && e.useCustomFormat && (e != null && e.customFormat) ? e.customFormat : (e == null ? void 0 : e.format) || "MM/dd/yyyy", a = b(e == null ? void 0 : e.timezone, u || "UTC");
|
|
187
|
+
return F(t, a, c);
|
|
188
|
+
} catch {
|
|
189
|
+
return String(r);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function H(r) {
|
|
193
|
+
if (r == null)
|
|
194
|
+
return "";
|
|
195
|
+
try {
|
|
196
|
+
const e = typeof r == "string" ? g(r) : r;
|
|
197
|
+
return isNaN(e.getTime()) ? String(r) : I(e, { addSuffix: !0 });
|
|
198
|
+
} catch {
|
|
199
|
+
return String(r);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function U(r, e, u) {
|
|
203
|
+
return P(r, e, u);
|
|
204
|
+
}
|
|
205
|
+
function M(r, e, u) {
|
|
206
|
+
if (r == null)
|
|
207
|
+
return "";
|
|
208
|
+
if (!u.useFormattedValues || !e)
|
|
209
|
+
return String(r);
|
|
210
|
+
switch (e.type) {
|
|
211
|
+
case "number":
|
|
212
|
+
return typeof r == "number" ? D(
|
|
213
|
+
r,
|
|
214
|
+
e.numberFormat,
|
|
215
|
+
u.locale
|
|
216
|
+
) : String(r);
|
|
217
|
+
case "date":
|
|
218
|
+
return U(
|
|
219
|
+
r,
|
|
220
|
+
e.dateFormat,
|
|
221
|
+
u.timezone
|
|
222
|
+
);
|
|
223
|
+
case "progress":
|
|
224
|
+
return typeof r == "number" ? `${r}%` : String(r);
|
|
225
|
+
case "badge":
|
|
226
|
+
case "link":
|
|
227
|
+
case "text":
|
|
228
|
+
case "none":
|
|
229
|
+
default:
|
|
230
|
+
return String(r);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function j(r, e) {
|
|
234
|
+
return e.visibleColumns.map((u) => {
|
|
235
|
+
const t = r[u], c = e.columnSettings[u];
|
|
236
|
+
return M(t, c, {
|
|
237
|
+
useFormattedValues: e.useFormattedValues,
|
|
238
|
+
timezone: e.timezone,
|
|
239
|
+
locale: e.locale
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function y(r, e = ",") {
|
|
244
|
+
if (r == null)
|
|
245
|
+
return "";
|
|
246
|
+
const u = String(r);
|
|
247
|
+
return u.includes(e) || u.includes('"') || u.includes(`
|
|
248
|
+
`) || u.includes("\r") ? `"${u.replace(/"/g, '""')}"` : u;
|
|
249
|
+
}
|
|
250
|
+
function h(r, e = ",") {
|
|
251
|
+
return r.map((u) => y(u, e)).join(e);
|
|
252
|
+
}
|
|
253
|
+
function C(r, e = {}) {
|
|
254
|
+
const { delimiter: u = ",", lineEnding: t = `
|
|
255
|
+
` } = e;
|
|
256
|
+
return r.map((c) => h(c, u)).join(t);
|
|
257
|
+
}
|
|
258
|
+
function Y(r, e = {}) {
|
|
259
|
+
if (r.length === 0)
|
|
260
|
+
return "";
|
|
261
|
+
const {
|
|
262
|
+
delimiter: u = ",",
|
|
263
|
+
lineEnding: t = `
|
|
264
|
+
`,
|
|
265
|
+
includeHeaders: c = !0,
|
|
266
|
+
columns: a
|
|
267
|
+
} = e, l = a || Object.keys(r[0]), i = [];
|
|
268
|
+
c && i.push(l);
|
|
269
|
+
for (const m of r) {
|
|
270
|
+
const s = l.map((d) => {
|
|
271
|
+
const n = m[d];
|
|
272
|
+
return n == null ? "" : String(n);
|
|
273
|
+
});
|
|
274
|
+
i.push(s);
|
|
275
|
+
}
|
|
276
|
+
return C(i, { delimiter: u, lineEnding: t });
|
|
277
|
+
}
|
|
278
|
+
function G(r, e) {
|
|
279
|
+
const u = [];
|
|
280
|
+
e.includeHeaders && u.push(h(e.visibleColumns, e.delimiter));
|
|
281
|
+
for (const t of r) {
|
|
282
|
+
const c = j(t, e);
|
|
283
|
+
u.push(
|
|
284
|
+
c.map((a) => y(a, e.delimiter)).join(e.delimiter)
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
return u;
|
|
288
|
+
}
|
|
289
|
+
function v(r, e, u = `
|
|
290
|
+
`) {
|
|
291
|
+
return G(r, e).join(u);
|
|
292
|
+
}
|
|
293
|
+
function O(r, e, u) {
|
|
294
|
+
return r == null ? "" : u.useFormattedValues ? typeof r == "number" && (e == null ? void 0 : e.type) === "number" ? D(
|
|
295
|
+
r,
|
|
296
|
+
e.numberFormat,
|
|
297
|
+
u.locale
|
|
298
|
+
) : typeof r == "number" ? r.toLocaleString(u.locale) : String(r) : String(r);
|
|
299
|
+
}
|
|
300
|
+
function W(r, e, u) {
|
|
301
|
+
var c, a;
|
|
302
|
+
const t = [];
|
|
303
|
+
if (r.isSubtotal && !r.isGrandTotal) {
|
|
304
|
+
const l = e.groupByColumns.findIndex(
|
|
305
|
+
(i) => i.alias === r.subtotalLevel
|
|
306
|
+
);
|
|
307
|
+
e.groupByColumns.forEach((i, m) => {
|
|
308
|
+
var s, d, n, x;
|
|
309
|
+
if (m === l) {
|
|
310
|
+
const N = (d = (s = e.rowAggregates) == null ? void 0 : s.find(
|
|
311
|
+
(V) => V.groupLevel === r.subtotalLevel
|
|
312
|
+
)) == null ? void 0 : d.label, T = (x = (n = r.subtotalContext) == null ? void 0 : n.groupByValues) == null ? void 0 : x[i.alias];
|
|
313
|
+
t.push(N ?? `Subtotal (${T ?? "Total"})`);
|
|
314
|
+
} else m < l ? t.push(String(r[i.alias] ?? "")) : t.push("");
|
|
315
|
+
});
|
|
316
|
+
} else if (r.isGrandTotal) {
|
|
317
|
+
const l = (a = (c = e.rowAggregates) == null ? void 0 : c.find(
|
|
318
|
+
(i) => i.groupLevel === "ALL"
|
|
319
|
+
)) == null ? void 0 : a.label;
|
|
320
|
+
t.push(l || "Grand Total"), e.groupByColumns.slice(1).forEach(() => t.push(""));
|
|
321
|
+
} else
|
|
322
|
+
e.groupByColumns.forEach((l) => {
|
|
323
|
+
t.push(String(r[l.alias] ?? ""));
|
|
324
|
+
});
|
|
325
|
+
return e.pivotSchema.filter((l) => l.isMetricColumn).forEach((l) => {
|
|
326
|
+
const i = r[l.alias], m = u.columnSettings[l.alias];
|
|
327
|
+
t.push(O(i, m, u));
|
|
328
|
+
}), t;
|
|
329
|
+
}
|
|
330
|
+
function k(r) {
|
|
331
|
+
const e = r.groupByColumns.map(
|
|
332
|
+
(t) => t.label || t.name
|
|
333
|
+
), u = r.pivotSchema.filter((t) => t.isMetricColumn).map((t) => t.displayLabel || t.metricLabel || t.metricName || t.alias);
|
|
334
|
+
return [...e, ...u];
|
|
335
|
+
}
|
|
336
|
+
function p(r, e, u) {
|
|
337
|
+
const t = [];
|
|
338
|
+
if (u.includeHeaders) {
|
|
339
|
+
const c = k(e);
|
|
340
|
+
t.push(h(c, u.delimiter));
|
|
341
|
+
}
|
|
342
|
+
for (const c of r) {
|
|
343
|
+
const a = W(
|
|
344
|
+
c,
|
|
345
|
+
e,
|
|
346
|
+
u
|
|
347
|
+
);
|
|
348
|
+
t.push(
|
|
349
|
+
a.map((l) => y(l, u.delimiter)).join(u.delimiter)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return t;
|
|
353
|
+
}
|
|
354
|
+
function w(r, e, u) {
|
|
355
|
+
for (const t of r) {
|
|
356
|
+
if (t.level < u) {
|
|
357
|
+
e[t.level].push(t.name);
|
|
358
|
+
for (let c = 1; c < t.colspan; c++)
|
|
359
|
+
e[t.level].push("");
|
|
360
|
+
}
|
|
361
|
+
t.children ? w(t.children, e, u) : t.columnKey && e[u].push(t.name);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function z(r) {
|
|
365
|
+
const e = r.pivotByColumns.length, u = r.groupByColumns.length, t = Array.from(
|
|
366
|
+
{ length: e + 1 },
|
|
367
|
+
() => []
|
|
368
|
+
);
|
|
369
|
+
for (let c = 0; c < e; c++)
|
|
370
|
+
t[c].push(...Array(u).fill(""));
|
|
371
|
+
if (t[e].push(
|
|
372
|
+
...r.groupByColumns.map((c) => c.label || c.name)
|
|
373
|
+
), w(r.columnHeadersTree, t, e), r.showRowTotals) {
|
|
374
|
+
for (let c = 0; c < e; c++)
|
|
375
|
+
t[c].push("");
|
|
376
|
+
t[e].push("Total");
|
|
377
|
+
}
|
|
378
|
+
return t;
|
|
379
|
+
}
|
|
380
|
+
function K(r, e, u) {
|
|
381
|
+
if (r == null)
|
|
382
|
+
return "";
|
|
383
|
+
if (!u.useFormattedValues)
|
|
384
|
+
return String(r);
|
|
385
|
+
const t = u.columnSettings[e];
|
|
386
|
+
return typeof r == "number" && (t == null ? void 0 : t.type) === "number" ? D(
|
|
387
|
+
r,
|
|
388
|
+
t.numberFormat,
|
|
389
|
+
u.locale
|
|
390
|
+
) : typeof r == "number" ? r.toLocaleString(u.locale) : String(r);
|
|
391
|
+
}
|
|
392
|
+
function X(r, e, u) {
|
|
393
|
+
const t = [];
|
|
394
|
+
r.fieldValues.forEach((a, l) => {
|
|
395
|
+
r.isSubtotal && l === 0 ? t.push(`${a} Total`) : r.isSubtotal ? t.push("") : t.push(String(a ?? ""));
|
|
396
|
+
});
|
|
397
|
+
let c = 0;
|
|
398
|
+
return e.columnHeaders.forEach((a) => {
|
|
399
|
+
var m;
|
|
400
|
+
const l = (m = r.cells[a]) == null ? void 0 : m.value, i = K(l, a, u);
|
|
401
|
+
t.push(i), e.showRowTotals && typeof l == "number" && (c += l);
|
|
402
|
+
}), e.showRowTotals && t.push(c.toLocaleString(u.locale)), t;
|
|
403
|
+
}
|
|
404
|
+
function o(r, e, u) {
|
|
405
|
+
const t = [];
|
|
406
|
+
if (u.includeHeaders) {
|
|
407
|
+
const c = z(e);
|
|
408
|
+
for (const a of c)
|
|
409
|
+
t.push(h(a, u.delimiter));
|
|
410
|
+
}
|
|
411
|
+
for (const c of r) {
|
|
412
|
+
const a = X(
|
|
413
|
+
c,
|
|
414
|
+
e,
|
|
415
|
+
u
|
|
416
|
+
);
|
|
417
|
+
t.push(
|
|
418
|
+
a.map((l) => y(l, u.delimiter)).join(u.delimiter)
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
return t;
|
|
422
|
+
}
|
|
423
|
+
export {
|
|
424
|
+
C as arrayToCSV,
|
|
425
|
+
h as arrayToCSVRow,
|
|
426
|
+
y as escapeCSVValue,
|
|
427
|
+
W as formatAggregateRow,
|
|
428
|
+
p as formatAggregateTableForCSV,
|
|
429
|
+
M as formatCellValue,
|
|
430
|
+
Z as formatCurrency,
|
|
431
|
+
P as formatDate,
|
|
432
|
+
U as formatDateWithColumnSettings,
|
|
433
|
+
B as formatNumber,
|
|
434
|
+
q as formatNumberCustom,
|
|
435
|
+
D as formatNumberWithColumnSettings,
|
|
436
|
+
E as formatPercent,
|
|
437
|
+
X as formatPivotDataRow,
|
|
438
|
+
o as formatPivotTableForCSV,
|
|
439
|
+
H as formatRelativeTime,
|
|
440
|
+
j as formatRowForExport,
|
|
441
|
+
R as formatScientific,
|
|
442
|
+
G as formatTableForCSV,
|
|
443
|
+
k as generateAggregateHeaders,
|
|
444
|
+
z as generatePivotHeaders,
|
|
445
|
+
v as generateTableCSV,
|
|
446
|
+
J as getTimezoneAbbreviation,
|
|
447
|
+
Q as getTimezoneName,
|
|
448
|
+
Y as objectsToCSV,
|
|
449
|
+
A as parseWithSourceTimezone,
|
|
450
|
+
b as resolveTimezone
|
|
451
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CFWw2cJ5.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-Cn1aOr6L.js"),h=require("./chunks/schedule-dashboard-vvFw8B1E.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-
|
|
2
|
-
import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-
|
|
1
|
+
import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-v6ayK5K2.js";
|
|
2
|
+
import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-v6ayK5K2.js";
|
|
3
3
|
import { EMPTY_SELECTION as oe } from "./types/index.js";
|
|
4
4
|
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
import * as p from "react";
|
|
6
6
|
import { useMemo as K, useEffect as Y } from "react";
|
|
7
|
-
import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-
|
|
8
|
-
import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-
|
|
7
|
+
import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-CApVr9Vd.js";
|
|
8
|
+
import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-B4KUKLfW.js";
|
|
9
9
|
import "react-dom";
|
|
10
10
|
/**
|
|
11
11
|
* @license lucide-react v0.453.0 - ISC
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CFWw2cJ5.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/surfboard/index.js
CHANGED