@burdenoff/microfe-bigconsole 2026.613.3 → 2026.613.5
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/bigconsole/components/widgets/WidgetRegistry.js +55 -1
- package/dist/bigconsole/components/widgets/WidgetRegistry.js.map +1 -1
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +123 -91
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/chart/charts/AreaChart.js +40 -35
- package/dist/bigconsole/components/widgets/chart/charts/AreaChart.js.map +1 -1
- package/dist/bigconsole/components/widgets/chart/charts/BarChart.js +30 -25
- package/dist/bigconsole/components/widgets/chart/charts/BarChart.js.map +1 -1
- package/dist/bigconsole/components/widgets/chart/charts/ComboChart.js +139 -0
- package/dist/bigconsole/components/widgets/chart/charts/ComboChart.js.map +1 -0
- package/dist/bigconsole/components/widgets/chart/charts/LineChart.js +35 -30
- package/dist/bigconsole/components/widgets/chart/charts/LineChart.js.map +1 -1
- package/dist/bigconsole/components/widgets/chart/charts/ScatterChart.js +128 -0
- package/dist/bigconsole/components/widgets/chart/charts/ScatterChart.js.map +1 -0
- package/dist/bigconsole/components/widgets/chart/charts/WaterfallChart.js +111 -0
- package/dist/bigconsole/components/widgets/chart/charts/WaterfallChart.js.map +1 -0
- package/dist/bigconsole/components/widgets/chart/charts/index.js +4 -0
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.js +49 -0
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.js.map +1 -0
- package/dist/bigconsole/components/widgets/kpi-comparison/KPIComparisonWidget.js +72 -68
- package/dist/bigconsole/components/widgets/kpi-comparison/KPIComparisonWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/map-widget/MapWidget.js +113 -44
- package/dist/bigconsole/components/widgets/map-widget/MapWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js +87 -86
- package/dist/bigconsole/components/widgets/metric-card/MetricCardWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/table/TableCell.js +75 -26
- package/dist/bigconsole/components/widgets/table/TableCell.js.map +1 -1
- package/dist/bigconsole/components/widgets/table/TableHeader.js +25 -18
- package/dist/bigconsole/components/widgets/table/TableHeader.js.map +1 -1
- package/dist/bigconsole/components/widgets/table/TableWidget.js +260 -105
- package/dist/bigconsole/components/widgets/table/TableWidget.js.map +1 -1
- package/dist/bigconsole/components/widgets/utils/conditionalFormat.js +91 -0
- package/dist/bigconsole/components/widgets/utils/conditionalFormat.js.map +1 -0
- package/dist/bigconsole/hooks/index.js +1 -0
- package/dist/bigconsole/hooks/useDashboardImageExport.js +1 -0
- package/dist/bigconsole/utils/widgetTypeMapping.js +1 -0
- package/dist/bigconsole/utils/widgetTypeMapping.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.js","names":[],"sources":["../../../../../src/bigconsole/components/widgets/table/TableHeader.tsx"],"sourcesContent":["/**\n * TableHeader Component\n *\n * Sortable table header with column definitions.\n */\n\nimport { type FC, memo, useCallback } from 'react';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ColumnDefinition {\n /** Unique key for the column */\n key: string;\n /** Display header text */\n header: string;\n /** Whether column is sortable */\n sortable?: boolean;\n /** Column width (CSS value) */\n width?: string;\n /** Text alignment */\n align?: 'left' | 'center' | 'right';\n}\n\nexport type SortDirection = 'asc' | 'desc' | null;\n\nexport interface SortState {\n column: string | null;\n direction: SortDirection;\n}\n\nexport interface TableHeaderProps {\n /** Column definitions */\n columns: ColumnDefinition[];\n /** Current sort state */\n sortState: SortState;\n /** Callback when sort changes */\n onSort: (column: string) => void;\n /** Whether header is sticky */\n sticky?: boolean;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport const TableHeader: FC<TableHeaderProps> = memo(function TableHeader({\n columns,\n sortState,\n onSort,\n sticky = true,\n}) {\n const handleSort = useCallback(\n (column: ColumnDefinition) => {\n if (column.sortable !== false) {\n onSort(column.key);\n }\n },\n [onSort]\n );\n\n const getSortIcon = (column: ColumnDefinition) => {\n if (column.sortable === false) return null;\n\n const isActive = sortState.column === column.key;\n const direction = isActive ? sortState.direction : null;\n\n return (\n <span className=\"inline-flex ml-1\">\n {direction === 'asc' && (\n <svg className=\"w-4 h-4 text-action-primary-bg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 15l7-7 7 7\" />\n </svg>\n )}\n {direction === 'desc' && (\n <svg className=\"w-4 h-4 text-action-primary-bg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n )}\n {!direction && (\n <svg\n className=\"w-4 h-4 text-text-secondary opacity-0 group-hover:opacity-100\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4\"\n />\n </svg>\n )}\n </span>\n );\n };\n\n return (\n <thead\n className={`\n bg-bg-muted\n ${sticky ? 'sticky top-0 z-10' : ''}\n `}\n >\n <tr>\n {columns.map((column) => (\n
|
|
1
|
+
{"version":3,"file":"TableHeader.js","names":[],"sources":["../../../../../src/bigconsole/components/widgets/table/TableHeader.tsx"],"sourcesContent":["/**\n * TableHeader Component\n *\n * Sortable table header with column definitions.\n */\n\nimport { type FC, memo, useCallback } from 'react';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ColumnDefinition {\n /** Unique key for the column */\n key: string;\n /** Display header text */\n header: string;\n /** Whether column is sortable */\n sortable?: boolean;\n /** Column width (CSS value) */\n width?: string;\n /** Text alignment */\n align?: 'left' | 'center' | 'right';\n}\n\nexport type SortDirection = 'asc' | 'desc' | null;\n\nexport interface SortState {\n column: string | null;\n direction: SortDirection;\n}\n\nexport interface TableHeaderProps {\n /** Column definitions */\n columns: ColumnDefinition[];\n /** Current sort state */\n sortState: SortState;\n /** Callback when sort changes */\n onSort: (column: string) => void;\n /** Whether header is sticky */\n sticky?: boolean;\n /** column key → sticky-left px offset for frozen leading columns */\n frozenLefts?: Record<string, number>;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport const TableHeader: FC<TableHeaderProps> = memo(function TableHeader({\n columns,\n sortState,\n onSort,\n sticky = true,\n frozenLefts,\n}) {\n const handleSort = useCallback(\n (column: ColumnDefinition) => {\n if (column.sortable !== false) {\n onSort(column.key);\n }\n },\n [onSort]\n );\n\n const getSortIcon = (column: ColumnDefinition) => {\n if (column.sortable === false) return null;\n\n const isActive = sortState.column === column.key;\n const direction = isActive ? sortState.direction : null;\n\n return (\n <span className=\"inline-flex ml-1\">\n {direction === 'asc' && (\n <svg className=\"w-4 h-4 text-action-primary-bg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M5 15l7-7 7 7\" />\n </svg>\n )}\n {direction === 'desc' && (\n <svg className=\"w-4 h-4 text-action-primary-bg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n )}\n {!direction && (\n <svg\n className=\"w-4 h-4 text-text-secondary opacity-0 group-hover:opacity-100\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4\"\n />\n </svg>\n )}\n </span>\n );\n };\n\n return (\n <thead\n className={`\n bg-bg-muted\n ${sticky ? 'sticky top-0 z-10' : ''}\n `}\n >\n <tr>\n {columns.map((column) => {\n const frozen = frozenLefts?.[column.key];\n return (\n <th\n key={column.key}\n className={`\n px-4 py-3\n text-xs font-semibold uppercase tracking-wider\n text-text-secondary\n border-b border-border-default\n ${column.sortable !== false ? 'cursor-pointer select-none group hover:bg-bg-surface' : ''}\n ${column.align === 'center' ? 'text-center' : ''}\n ${column.align === 'right' ? 'text-right' : 'text-left'}\n ${frozen != null ? 'sticky z-20 bg-bg-muted' : ''}\n `}\n style={frozen != null ? { width: column.width, left: frozen } : { width: column.width }}\n onClick={() => handleSort(column)}\n role={column.sortable !== false ? 'button' : undefined}\n tabIndex={column.sortable !== false ? 0 : undefined}\n onKeyDown={(e) => {\n if (column.sortable !== false && (e.key === 'Enter' || e.key === ' ')) {\n e.preventDefault();\n handleSort(column);\n }\n }}\n aria-sort={\n sortState.column === column.key\n ? sortState.direction === 'asc'\n ? 'ascending'\n : 'descending'\n : undefined\n }\n >\n <div className=\"inline-flex items-center\">\n {column.header}\n {getSortIcon(column)}\n </div>\n </th>\n );\n })}\n </tr>\n </thead>\n );\n});\n\nexport default TableHeader;\n"],"mappings":";;;AAiDA,IAAa,IAAoC,EAAK,SAAqB,EACzE,YACA,cACA,WACA,YAAS,IACT,kBACC;CACD,IAAM,IAAa,GAChB,MAA6B;AAC5B,EAAI,EAAO,aAAa,MACtB,EAAO,EAAO,IAAI;IAGtB,CAAC,EAAO,CACT,EAEK,KAAe,MAA6B;AAChD,MAAI,EAAO,aAAa,GAAO,QAAO;EAGtC,IAAM,IADW,EAAU,WAAW,EAAO,MAChB,EAAU,YAAY;AAEnD,SACE,kBAAC,QAAD;GAAM,WAAU;aAAhB;IACG,MAAc,SACb,kBAAC,OAAD;KAAK,WAAU;KAAiC,MAAK;KAAO,QAAO;KAAe,SAAQ;eACxF,kBAAC,QAAD;MAAM,eAAc;MAAQ,gBAAe;MAAQ,aAAa;MAAG,GAAE;MAAkB,CAAA;KACnF,CAAA;IAEP,MAAc,UACb,kBAAC,OAAD;KAAK,WAAU;KAAiC,MAAK;KAAO,QAAO;KAAe,SAAQ;eACxF,kBAAC,QAAD;MAAM,eAAc;MAAQ,gBAAe;MAAQ,aAAa;MAAG,GAAE;MAAmB,CAAA;KACpF,CAAA;IAEP,CAAC,KACA,kBAAC,OAAD;KACE,WAAU;KACV,MAAK;KACL,QAAO;KACP,SAAQ;eAER,kBAAC,QAAD;MACE,eAAc;MACd,gBAAe;MACf,aAAa;MACb,GAAE;MACF,CAAA;KACE,CAAA;IAEH;;;AAIX,QACE,kBAAC,SAAD;EACE,WAAW;;UAEP,IAAS,sBAAsB,GAAG;;YAGtC,kBAAC,MAAD,EAAA,UACG,EAAQ,KAAK,MAAW;GACvB,IAAM,IAAS,IAAc,EAAO;AACpC,UACE,kBAAC,MAAD;IAEE,WAAW;;;;;gBAKT,EAAO,aAAa,KAAiE,KAAzD,uDAA4D;gBACxF,EAAO,UAAU,WAAW,gBAAgB,GAAG;gBAC/C,EAAO,UAAU,UAAU,eAAe,YAAY;gBACtD,KAAU,OAAmC,KAA5B,0BAA+B;;IAElD,OAAO,KAAU,OAA+C,EAAE,OAAO,EAAO,OAAO,GAA/D;KAAE,OAAO,EAAO;KAAO,MAAM;KAAQ;IAC7D,eAAe,EAAW,EAAO;IACjC,MAAM,EAAO,aAAa,KAAmB,KAAA,IAAX;IAClC,UAAU,EAAO,aAAa,KAAY,KAAA,IAAJ;IACtC,YAAY,MAAM;AAChB,KAAI,EAAO,aAAa,OAAU,EAAE,QAAQ,WAAW,EAAE,QAAQ,SAC/D,EAAE,gBAAgB,EAClB,EAAW,EAAO;;IAGtB,aACE,EAAU,WAAW,EAAO,MACxB,EAAU,cAAc,QACtB,cACA,eACF,KAAA;cAGN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACG,EAAO,QACP,EAAY,EAAO,CAChB;;IACH,EAjCE,EAAO,IAiCT;IAEP,EACC,CAAA;EACC,CAAA;EAEV"}
|
|
@@ -3,10 +3,10 @@ import "../../../contexts/index.js";
|
|
|
3
3
|
import n from "./TableHeader.js";
|
|
4
4
|
import r from "./TableCell.js";
|
|
5
5
|
import i from "./TablePagination.js";
|
|
6
|
-
import { memo as a, useCallback as o,
|
|
7
|
-
import { jsx as
|
|
6
|
+
import { memo as a, useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
8
|
//#region src/bigconsole/components/widgets/table/TableWidget.tsx
|
|
9
|
-
function
|
|
9
|
+
function ee(e, t) {
|
|
10
10
|
return !t.column || !t.direction ? e : [...e].sort((e, n) => {
|
|
11
11
|
let r = e[t.column], i = n[t.column];
|
|
12
12
|
if (r == null && i == null) return 0;
|
|
@@ -16,7 +16,7 @@ function d(e, t) {
|
|
|
16
16
|
return a = typeof r == "number" && typeof i == "number" ? r - i : String(r).localeCompare(String(i)), t.direction === "asc" ? a : -a;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function p(e, t, n) {
|
|
20
20
|
if (!t.trim()) return e;
|
|
21
21
|
let r = t.toLowerCase();
|
|
22
22
|
return e.filter((e) => n.some((t) => {
|
|
@@ -24,10 +24,21 @@ function f(e, t, n) {
|
|
|
24
24
|
return n != null && String(n).toLowerCase().includes(r);
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
function m(e, t, n) {
|
|
28
|
+
switch (t) {
|
|
29
|
+
case "currency": return new Intl.NumberFormat("en-US", {
|
|
30
|
+
style: "currency",
|
|
31
|
+
currency: n || "USD"
|
|
32
|
+
}).format(e);
|
|
33
|
+
case "percentage": return `${(e * 100).toFixed(1)}%`;
|
|
34
|
+
case "number": return new Intl.NumberFormat("en-US").format(e);
|
|
35
|
+
default: return Number.isInteger(e) ? String(e) : e.toFixed(2);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
var h = a(function({ widget: a, data: h = [], onRowClick: g, onDrilldown: _ }) {
|
|
39
|
+
let v = a.config, y = c(() => {
|
|
40
|
+
if (Array.isArray(h)) return h;
|
|
41
|
+
if (h && typeof h == "object") {
|
|
31
42
|
for (let e of [
|
|
32
43
|
"data",
|
|
33
44
|
"items",
|
|
@@ -38,20 +49,20 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
38
49
|
"sales",
|
|
39
50
|
"entries",
|
|
40
51
|
"values"
|
|
41
|
-
]) if (Array.isArray(
|
|
42
|
-
let e = Object.values(
|
|
52
|
+
]) if (Array.isArray(h[e])) return h[e];
|
|
53
|
+
let e = Object.values(h);
|
|
43
54
|
for (let t of e) if (Array.isArray(t)) return t;
|
|
44
|
-
return [
|
|
55
|
+
return [h];
|
|
45
56
|
}
|
|
46
57
|
return [];
|
|
47
|
-
}, [
|
|
48
|
-
column:
|
|
49
|
-
direction:
|
|
50
|
-
}), [
|
|
58
|
+
}, [h]), { handleDataClick: b, enabled: x } = t(a.id, v?.crossFilterMappings), { clearAllCrossFilters: S, hasCrossFilters: C } = e(), [w, T] = u({
|
|
59
|
+
column: v?.defaultSortColumn || null,
|
|
60
|
+
direction: v?.defaultSortDirection || null
|
|
61
|
+
}), [E, D] = u(""), [O, k] = u({
|
|
51
62
|
page: 0,
|
|
52
|
-
pageSize:
|
|
63
|
+
pageSize: v?.pageSize || 10,
|
|
53
64
|
totalItems: 0
|
|
54
|
-
}),
|
|
65
|
+
}), A = c(() => v?.columns?.length ? v.columns.map((e) => {
|
|
55
66
|
if (typeof e == "string") return {
|
|
56
67
|
key: e,
|
|
57
68
|
header: e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "),
|
|
@@ -65,41 +76,131 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
65
76
|
width: e.width == null ? void 0 : String(e.width),
|
|
66
77
|
align: e.align
|
|
67
78
|
};
|
|
68
|
-
}) :
|
|
79
|
+
}) : y.length > 0 ? Object.keys(y[0]).map((e) => ({
|
|
69
80
|
key: e,
|
|
70
81
|
header: e.charAt(0).toUpperCase() + e.slice(1).replace(/_/g, " "),
|
|
71
82
|
sortable: !0
|
|
72
|
-
})) : [], [
|
|
83
|
+
})) : [], [v?.columns, y]), j = c(() => {
|
|
73
84
|
let e = {};
|
|
74
|
-
return
|
|
85
|
+
return v?.columns?.forEach((t) => {
|
|
75
86
|
t.format && (t.key || t.field) && (e[t.key || t.field || ""] = { type: t.format });
|
|
76
87
|
}), e;
|
|
77
|
-
}, [
|
|
78
|
-
let e =
|
|
79
|
-
return
|
|
88
|
+
}, [v?.columns]), M = c(() => {
|
|
89
|
+
let e = {};
|
|
90
|
+
return v?.columns?.forEach((t) => {
|
|
91
|
+
let n = t.key || t.field;
|
|
92
|
+
n && t.cellChart && (e[n] = t.cellChart);
|
|
93
|
+
}), e;
|
|
94
|
+
}, [v?.columns]), N = v?.conditionalRules, P = c(() => {
|
|
95
|
+
let e = {};
|
|
96
|
+
return v?.columns?.forEach((t) => {
|
|
97
|
+
let n = t.key || t.field;
|
|
98
|
+
n && t.conditionalRules?.length && (e[n] = t.conditionalRules);
|
|
99
|
+
}), e;
|
|
100
|
+
}, [v?.columns]), F = c(() => {
|
|
101
|
+
let e = {};
|
|
102
|
+
return v?.columns?.forEach((t) => {
|
|
103
|
+
let n = t.key || t.field;
|
|
104
|
+
n && t.total && t.total !== "none" && (e[n] = t.total);
|
|
105
|
+
}), e;
|
|
106
|
+
}, [v?.columns]), I = v?.showTotals === !0 || Object.keys(F).length > 0, L = c(() => {
|
|
107
|
+
let e = y;
|
|
108
|
+
return v?.showSearch !== !1 && (e = p(e, E, A)), e = ee(e, w), e;
|
|
80
109
|
}, [
|
|
81
|
-
|
|
110
|
+
y,
|
|
111
|
+
E,
|
|
82
112
|
w,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
113
|
+
A,
|
|
114
|
+
v?.showSearch
|
|
115
|
+
]), R = c(() => {
|
|
116
|
+
let e = {};
|
|
117
|
+
for (let t of A) {
|
|
118
|
+
let n = 0;
|
|
119
|
+
for (let e of L) {
|
|
120
|
+
let r = e[t.key];
|
|
121
|
+
typeof r == "number" && Number.isFinite(r) && (n = Math.max(n, Math.abs(r)));
|
|
122
|
+
}
|
|
123
|
+
e[t.key] = n;
|
|
124
|
+
}
|
|
125
|
+
return e;
|
|
126
|
+
}, [A, L]), z = c(() => {
|
|
127
|
+
if (!I) return {};
|
|
128
|
+
let e = {};
|
|
129
|
+
for (let t of A) {
|
|
130
|
+
let n = F[t.key];
|
|
131
|
+
if (!n) {
|
|
132
|
+
e[t.key] = null;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
let r = L.map((e) => e[t.key]).filter((e) => typeof e == "number" && Number.isFinite(e));
|
|
136
|
+
n === "count" ? e[t.key] = L.length : r.length === 0 ? e[t.key] = null : n === "sum" ? e[t.key] = r.reduce((e, t) => e + t, 0) : n === "avg" ? e[t.key] = r.reduce((e, t) => e + t, 0) / r.length : n === "min" ? e[t.key] = Math.min(...r) : n === "max" ? e[t.key] = Math.max(...r) : e[t.key] = null;
|
|
137
|
+
}
|
|
138
|
+
return e;
|
|
139
|
+
}, [
|
|
140
|
+
I,
|
|
141
|
+
A,
|
|
142
|
+
F,
|
|
143
|
+
L
|
|
86
144
|
]);
|
|
87
|
-
|
|
88
|
-
|
|
145
|
+
c(() => {
|
|
146
|
+
k((e) => ({
|
|
89
147
|
...e,
|
|
90
|
-
totalItems:
|
|
148
|
+
totalItems: L.length
|
|
91
149
|
}));
|
|
92
|
-
}, [
|
|
93
|
-
let
|
|
94
|
-
if (
|
|
95
|
-
let e =
|
|
96
|
-
return
|
|
150
|
+
}, [L.length]);
|
|
151
|
+
let B = c(() => {
|
|
152
|
+
if (v?.showPagination === !1) return L;
|
|
153
|
+
let e = O.page * O.pageSize;
|
|
154
|
+
return L.slice(e, e + O.pageSize);
|
|
97
155
|
}, [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
]),
|
|
102
|
-
|
|
156
|
+
L,
|
|
157
|
+
O,
|
|
158
|
+
v?.showPagination
|
|
159
|
+
]), V = v?.virtualized === !0, H = v?.rowHeight && v.rowHeight > 0 ? v.rowHeight : 44, U = l(null), [W, G] = u(0), [K, q] = u(0);
|
|
160
|
+
s(() => {
|
|
161
|
+
if (!V) return;
|
|
162
|
+
let e = U.current;
|
|
163
|
+
if (!e) return;
|
|
164
|
+
q(e.clientHeight);
|
|
165
|
+
let t = typeof ResizeObserver < "u" ? new ResizeObserver(() => q(e.clientHeight)) : void 0;
|
|
166
|
+
return t?.observe(e), () => t?.disconnect();
|
|
167
|
+
}, [V]);
|
|
168
|
+
let J = c(() => {
|
|
169
|
+
if (!V) return null;
|
|
170
|
+
let e = L.length, t = K > 0 ? Math.ceil(K / H) : 20, n = Math.max(0, Math.floor(W / H) - 6), r = Math.min(e, n + t + 12);
|
|
171
|
+
return {
|
|
172
|
+
rows: L.slice(n, r),
|
|
173
|
+
topSpacer: n * H,
|
|
174
|
+
bottomSpacer: Math.max(0, (e - r) * H),
|
|
175
|
+
startIndex: n
|
|
176
|
+
};
|
|
177
|
+
}, [
|
|
178
|
+
V,
|
|
179
|
+
L,
|
|
180
|
+
K,
|
|
181
|
+
W,
|
|
182
|
+
H
|
|
183
|
+
]), Y = V && J ? J.rows : B, X = V && J ? J.startIndex : 0, Z = v?.frozenColumns && v.frozenColumns > 0 ? v.frozenColumns : 0, { displayColumns: Q, frozenLefts: $ } = c(() => {
|
|
184
|
+
if (Z <= 0) return {
|
|
185
|
+
displayColumns: A,
|
|
186
|
+
frozenLefts: {}
|
|
187
|
+
};
|
|
188
|
+
let e = {}, t = 0;
|
|
189
|
+
return {
|
|
190
|
+
displayColumns: A.map((n, r) => {
|
|
191
|
+
if (r < Z) {
|
|
192
|
+
let r = n.width && parseInt(n.width, 10) || 160;
|
|
193
|
+
return e[n.key] = t, t += r, {
|
|
194
|
+
...n,
|
|
195
|
+
width: `${r}px`
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
return n;
|
|
199
|
+
}),
|
|
200
|
+
frozenLefts: e
|
|
201
|
+
};
|
|
202
|
+
}, [A, Z]), te = o((e) => {
|
|
203
|
+
T((t) => {
|
|
103
204
|
if (t.column !== e) return {
|
|
104
205
|
column: e,
|
|
105
206
|
direction: "asc"
|
|
@@ -110,35 +211,35 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
110
211
|
direction: n
|
|
111
212
|
};
|
|
112
213
|
});
|
|
113
|
-
}, []),
|
|
114
|
-
|
|
214
|
+
}, []), ne = o((e) => {
|
|
215
|
+
k((t) => ({
|
|
115
216
|
...t,
|
|
116
217
|
page: e
|
|
117
218
|
}));
|
|
118
|
-
}, []),
|
|
119
|
-
|
|
219
|
+
}, []), re = o((e) => {
|
|
220
|
+
k((t) => ({
|
|
120
221
|
...t,
|
|
121
222
|
pageSize: e,
|
|
122
223
|
page: 0
|
|
123
224
|
}));
|
|
124
|
-
}, []),
|
|
125
|
-
let n =
|
|
126
|
-
if (
|
|
127
|
-
let t =
|
|
128
|
-
|
|
225
|
+
}, []), ie = o((e, t) => {
|
|
226
|
+
let n = v?.crossFilterMappings?.length || v?.enableCrossFilter;
|
|
227
|
+
if (x && n) {
|
|
228
|
+
let t = A[0]?.key;
|
|
229
|
+
b(e, t ? String(e[t]) : void 0);
|
|
129
230
|
}
|
|
130
|
-
|
|
231
|
+
_ ? _(e) : g && a.drilldowns?.length && g(e, t);
|
|
131
232
|
}, [
|
|
132
|
-
|
|
133
|
-
|
|
233
|
+
g,
|
|
234
|
+
_,
|
|
134
235
|
a.drilldowns,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
]),
|
|
141
|
-
let e = [
|
|
236
|
+
x,
|
|
237
|
+
b,
|
|
238
|
+
A,
|
|
239
|
+
v?.crossFilterMappings,
|
|
240
|
+
v?.enableCrossFilter
|
|
241
|
+
]), ae = o(() => {
|
|
242
|
+
let e = [A.map((e) => e.header).join(","), ...L.map((e) => A.map((t) => {
|
|
142
243
|
let n = e[t.key];
|
|
143
244
|
if (n == null) return "";
|
|
144
245
|
let r = String(n);
|
|
@@ -146,27 +247,27 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
146
247
|
}).join(","))].join("\n"), t = new Blob([e], { type: "text/csv" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
147
248
|
r.href = n, r.download = `${a.title || "table"}-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`, r.click(), URL.revokeObjectURL(n);
|
|
148
249
|
}, [
|
|
149
|
-
O,
|
|
150
250
|
A,
|
|
251
|
+
L,
|
|
151
252
|
a.title
|
|
152
|
-
]),
|
|
153
|
-
return /* @__PURE__ */
|
|
253
|
+
]), oe = v?.crossFilterMappings?.length || v?.enableCrossFilter, se = !!(_ || g && a.drilldowns?.length || oe);
|
|
254
|
+
return /* @__PURE__ */ f("div", {
|
|
154
255
|
className: "flex flex-col h-full",
|
|
155
256
|
children: [
|
|
156
|
-
|
|
257
|
+
C && /* @__PURE__ */ d("div", {
|
|
157
258
|
className: "flex items-center gap-2 px-3 py-2 border-b border-border-default",
|
|
158
|
-
children: /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ f("button", {
|
|
159
260
|
type: "button",
|
|
160
261
|
onClick: (e) => {
|
|
161
|
-
e.stopPropagation(),
|
|
262
|
+
e.stopPropagation(), S();
|
|
162
263
|
},
|
|
163
264
|
className: "\n inline-flex items-center gap-1.5\n px-2.5 py-1 rounded-md\n text-xs font-medium\n bg-action-primary-bg/10 text-action-primary-text\n hover:bg-action-primary-bg/20\n transition-colors\n ",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ d("svg", {
|
|
165
266
|
className: "w-3.5 h-3.5",
|
|
166
267
|
fill: "none",
|
|
167
268
|
stroke: "currentColor",
|
|
168
269
|
viewBox: "0 0 24 24",
|
|
169
|
-
children: /* @__PURE__ */
|
|
270
|
+
children: /* @__PURE__ */ d("path", {
|
|
170
271
|
strokeLinecap: "round",
|
|
171
272
|
strokeLinejoin: "round",
|
|
172
273
|
strokeWidth: 2,
|
|
@@ -175,38 +276,38 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
175
276
|
}), "Clear Filter"]
|
|
176
277
|
})
|
|
177
278
|
}),
|
|
178
|
-
(
|
|
279
|
+
(v?.showSearch !== !1 || v?.showExport !== !1) && /* @__PURE__ */ f("div", {
|
|
179
280
|
className: "flex items-center justify-between p-3 border-b border-border-default",
|
|
180
|
-
children: [
|
|
281
|
+
children: [v?.showSearch !== !1 && /* @__PURE__ */ f("div", {
|
|
181
282
|
className: "relative flex items-center",
|
|
182
|
-
children: [/* @__PURE__ */
|
|
283
|
+
children: [/* @__PURE__ */ d("svg", {
|
|
183
284
|
className: "absolute left-3 w-4 h-4 text-text-secondary pointer-events-none",
|
|
184
285
|
fill: "none",
|
|
185
286
|
stroke: "currentColor",
|
|
186
287
|
viewBox: "0 0 24 24",
|
|
187
|
-
children: /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ d("path", {
|
|
188
289
|
strokeLinecap: "round",
|
|
189
290
|
strokeLinejoin: "round",
|
|
190
291
|
strokeWidth: 2,
|
|
191
292
|
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
192
293
|
})
|
|
193
|
-
}), /* @__PURE__ */
|
|
294
|
+
}), /* @__PURE__ */ d("input", {
|
|
194
295
|
type: "text",
|
|
195
296
|
placeholder: "Search products...",
|
|
196
|
-
value:
|
|
197
|
-
onChange: (e) =>
|
|
297
|
+
value: E,
|
|
298
|
+
onChange: (e) => D(e.target.value),
|
|
198
299
|
className: "\n pl-10 pr-4 py-2\n text-sm text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n focus:outline-none focus:ring-2 focus:ring-action-primary-bg focus:border-action-primary-bg\n w-48 sm:w-64\n placeholder:text-text-tertiary\n "
|
|
199
300
|
})]
|
|
200
|
-
}),
|
|
301
|
+
}), v?.showExport !== !1 && /* @__PURE__ */ f("button", {
|
|
201
302
|
type: "button",
|
|
202
|
-
onClick:
|
|
303
|
+
onClick: ae,
|
|
203
304
|
className: "\n inline-flex items-center gap-2\n px-3 py-2\n text-sm font-medium\n text-text-primary\n bg-bg-surface\n border border-border-default\n rounded-md\n hover:bg-bg-muted\n transition-colors\n ",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
305
|
+
children: [/* @__PURE__ */ d("svg", {
|
|
205
306
|
className: "w-4 h-4",
|
|
206
307
|
fill: "none",
|
|
207
308
|
stroke: "currentColor",
|
|
208
309
|
viewBox: "0 0 24 24",
|
|
209
|
-
children: /* @__PURE__ */
|
|
310
|
+
children: /* @__PURE__ */ d("path", {
|
|
210
311
|
strokeLinecap: "round",
|
|
211
312
|
strokeLinejoin: "round",
|
|
212
313
|
strokeWidth: 2,
|
|
@@ -215,44 +316,98 @@ var p = a(function({ widget: a, data: p = [], onRowClick: m, onDrilldown: h }) {
|
|
|
215
316
|
}), "Export CSV"]
|
|
216
317
|
})]
|
|
217
318
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ f("div", {
|
|
320
|
+
ref: U,
|
|
219
321
|
className: "flex-1 overflow-auto",
|
|
220
|
-
|
|
322
|
+
onScroll: V ? (e) => G(e.target.scrollTop) : void 0,
|
|
323
|
+
children: [/* @__PURE__ */ f("table", {
|
|
221
324
|
className: "w-full",
|
|
222
|
-
children: [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ d(n, {
|
|
327
|
+
columns: Q,
|
|
328
|
+
sortState: w,
|
|
329
|
+
onSort: te,
|
|
330
|
+
frozenLefts: Z > 0 ? $ : void 0
|
|
331
|
+
}),
|
|
332
|
+
/* @__PURE__ */ f("tbody", { children: [
|
|
333
|
+
V && J && J.topSpacer > 0 && /* @__PURE__ */ d("tr", {
|
|
334
|
+
"aria-hidden": "true",
|
|
335
|
+
style: { height: J.topSpacer },
|
|
336
|
+
children: /* @__PURE__ */ d("td", {
|
|
337
|
+
colSpan: Q.length,
|
|
338
|
+
style: {
|
|
339
|
+
padding: 0,
|
|
340
|
+
border: "none"
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
}),
|
|
344
|
+
Y.map((e, t) => {
|
|
345
|
+
let n = X + t;
|
|
346
|
+
return /* @__PURE__ */ d("tr", {
|
|
347
|
+
className: `
|
|
348
|
+
${se ? "cursor-pointer hover:bg-bg-muted/50" : ""}
|
|
349
|
+
${n % 2 == 0 ? "bg-bg-surface" : "bg-bg-muted/30"}
|
|
350
|
+
`,
|
|
351
|
+
style: V ? { height: H } : void 0,
|
|
352
|
+
onClick: () => ie(e, n),
|
|
353
|
+
children: Q.map((t) => /* @__PURE__ */ d(r, {
|
|
354
|
+
value: e[t.key],
|
|
355
|
+
column: t,
|
|
356
|
+
format: j[t.key],
|
|
357
|
+
rowData: e,
|
|
358
|
+
conditionalRules: P[t.key] ?? N,
|
|
359
|
+
dataBarMax: R[t.key],
|
|
360
|
+
stickyLeft: $[t.key],
|
|
361
|
+
cellChart: M[t.key]
|
|
362
|
+
}, t.key))
|
|
363
|
+
}, n);
|
|
364
|
+
}),
|
|
365
|
+
V && J && J.bottomSpacer > 0 && /* @__PURE__ */ d("tr", {
|
|
366
|
+
"aria-hidden": "true",
|
|
367
|
+
style: { height: J.bottomSpacer },
|
|
368
|
+
children: /* @__PURE__ */ d("td", {
|
|
369
|
+
colSpan: Q.length,
|
|
370
|
+
style: {
|
|
371
|
+
padding: 0,
|
|
372
|
+
border: "none"
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
})
|
|
376
|
+
] }),
|
|
377
|
+
I && L.length > 0 && /* @__PURE__ */ d("tfoot", { children: /* @__PURE__ */ d("tr", {
|
|
378
|
+
className: "bg-bg-muted/50 font-semibold border-t-2 border-border-default",
|
|
379
|
+
children: Q.map((e, t) => {
|
|
380
|
+
let n = z[e.key], r = j[e.key], i = $[e.key];
|
|
381
|
+
return /* @__PURE__ */ d("td", {
|
|
382
|
+
className: `
|
|
383
|
+
px-4 py-3 text-sm text-text-primary
|
|
384
|
+
${e.align === "center" ? "text-center" : ""}
|
|
385
|
+
${e.align === "right" ? "text-right" : "text-left"}
|
|
386
|
+
${i == null ? "" : "sticky z-10 bg-bg-muted"}
|
|
387
|
+
`,
|
|
388
|
+
style: i == null ? void 0 : { left: i },
|
|
389
|
+
children: n == null ? t === 0 ? "Total" : "" : m(n, r?.type, r?.currency)
|
|
390
|
+
}, e.key);
|
|
391
|
+
})
|
|
392
|
+
}) })
|
|
393
|
+
]
|
|
394
|
+
}), L.length === 0 && /* @__PURE__ */ d("div", {
|
|
240
395
|
className: "flex items-center justify-center py-12 text-text-secondary",
|
|
241
|
-
children:
|
|
396
|
+
children: E ? "No matching records found" : "No data available"
|
|
242
397
|
})]
|
|
243
398
|
}),
|
|
244
|
-
|
|
399
|
+
!V && v?.showPagination !== !1 && L.length > 0 && /* @__PURE__ */ d(i, {
|
|
245
400
|
pagination: {
|
|
246
|
-
...
|
|
247
|
-
totalItems:
|
|
401
|
+
...O,
|
|
402
|
+
totalItems: L.length
|
|
248
403
|
},
|
|
249
|
-
onPageChange:
|
|
250
|
-
onPageSizeChange:
|
|
404
|
+
onPageChange: ne,
|
|
405
|
+
onPageSizeChange: re
|
|
251
406
|
})
|
|
252
407
|
]
|
|
253
408
|
});
|
|
254
409
|
});
|
|
255
410
|
//#endregion
|
|
256
|
-
export {
|
|
411
|
+
export { h as default };
|
|
257
412
|
|
|
258
413
|
//# sourceMappingURL=TableWidget.js.map
|