@ztwoint/z-ui 0.1.114 → 0.1.116
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/components/assets/icons/eraser.d.ts +7 -0
- package/dist/components/assets/icons/eraser.js +61 -0
- package/dist/components/assets/icons/index.d.ts +1 -0
- package/dist/components/chart/chart.d.ts +4 -0
- package/dist/components/chart/chart.js +25 -0
- package/dist/components/chart/index.d.ts +2 -0
- package/dist/components/chart-card/builders/bar-chart-builder.d.ts +3 -0
- package/dist/components/chart-card/builders/bar-chart-builder.js +43 -0
- package/dist/components/chart-card/builders/chart-builder-factory.d.ts +5 -0
- package/dist/components/chart-card/builders/chart-builder-factory.js +23 -0
- package/dist/components/chart-card/builders/line-chart-builder.d.ts +3 -0
- package/dist/components/chart-card/builders/line-chart-builder.js +53 -0
- package/dist/components/chart-card/builders/pie-chart-builder.d.ts +3 -0
- package/dist/components/chart-card/builders/pie-chart-builder.js +71 -0
- package/dist/components/chart-card/chart-card-states.d.ts +10 -0
- package/dist/components/chart-card/chart-card-states.js +93 -0
- package/dist/components/chart-card/chart-card.config.types.d.ts +99 -0
- package/dist/components/chart-card/chart-card.d.ts +2 -0
- package/dist/components/chart-card/chart-card.js +72 -0
- package/dist/components/chart-card/chart-card.types.d.ts +12 -0
- package/dist/components/chart-card/config/colors.d.ts +29 -0
- package/dist/components/chart-card/config/colors.js +49 -0
- package/dist/components/chart-card/config/defaults.d.ts +164 -0
- package/dist/components/chart-card/config/defaults.js +156 -0
- package/dist/components/chart-card/index.d.ts +10 -0
- package/dist/components/chart-card/validators/config-validator.d.ts +7 -0
- package/dist/components/chart-card/validators/config-validator.js +40 -0
- package/dist/components/table/components/cell/avatar-cell.js +5 -2
- package/dist/components/table/table-provider.js +3 -0
- package/dist/components/table-card/table-card.js +11 -8
- package/dist/css/styles/tailwind.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +170 -145
- package/dist/types/components/assets/icons/eraser.d.ts +7 -0
- package/dist/types/components/assets/icons/index.d.ts +1 -0
- package/dist/types/components/chart/chart.d.ts +4 -0
- package/dist/types/components/chart/index.d.ts +2 -0
- package/dist/types/components/chart-card/builders/bar-chart-builder.d.ts +3 -0
- package/dist/types/components/chart-card/builders/chart-builder-factory.d.ts +5 -0
- package/dist/types/components/chart-card/builders/line-chart-builder.d.ts +3 -0
- package/dist/types/components/chart-card/builders/pie-chart-builder.d.ts +3 -0
- package/dist/types/components/chart-card/chart-card-states.d.ts +10 -0
- package/dist/types/components/chart-card/chart-card.config.types.d.ts +99 -0
- package/dist/types/components/chart-card/chart-card.d.ts +2 -0
- package/dist/types/components/chart-card/chart-card.types.d.ts +12 -0
- package/dist/types/components/chart-card/config/colors.d.ts +29 -0
- package/dist/types/components/chart-card/config/defaults.d.ts +164 -0
- package/dist/types/components/chart-card/index.d.ts +10 -0
- package/dist/types/components/chart-card/validators/config-validator.d.ts +7 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +3 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const d = {
|
|
2
|
+
default: ["#2563eb", "#7c3aed", "#d97706", "#16a34a", "#dc2626", "#0284c7"],
|
|
3
|
+
brand: ["#2563eb", "#3b82f6", "#1d4ed8", "#60a5fa"],
|
|
4
|
+
success: ["#16a34a", "#22c55e", "#15803d", "#4ade80"],
|
|
5
|
+
warning: ["#d97706", "#f59e0b", "#b45309", "#fbbf24"],
|
|
6
|
+
danger: ["#dc2626", "#ef4444", "#b91c1c", "#f87171"],
|
|
7
|
+
purple: ["#7c3aed", "#8b5cf6", "#6d28d9", "#a78bfa"],
|
|
8
|
+
neutral: ["#5d5d5d", "#6d6d6d", "#4f4f4f", "#888888"]
|
|
9
|
+
}, t = {
|
|
10
|
+
basic: d.default,
|
|
11
|
+
smooth: ["#1d4ed8", "#38bdf8", "#22d3ee", "#6366f1"]
|
|
12
|
+
}, b = {
|
|
13
|
+
basic: d.default,
|
|
14
|
+
stacked: ["#0284c7", "#38bdf8", "#60a5fa", "#93c5fd"]
|
|
15
|
+
}, E = {
|
|
16
|
+
basic: d.default,
|
|
17
|
+
donut: ["#2563eb", "#7c3aed", "#d97706", "#16a34a", "#dc2626", "#0284c7", "#8b5cf6", "#f59e0b"]
|
|
18
|
+
}, n = {
|
|
19
|
+
line: t,
|
|
20
|
+
bar: b,
|
|
21
|
+
pie: E
|
|
22
|
+
}, r = {
|
|
23
|
+
text: {
|
|
24
|
+
primary: "#000000",
|
|
25
|
+
secondary: "#5d5d5d",
|
|
26
|
+
muted: "#888888"
|
|
27
|
+
},
|
|
28
|
+
border: {
|
|
29
|
+
light: "#e7e7e7",
|
|
30
|
+
default: "#d1d1d1",
|
|
31
|
+
medium: "#b0b0b0"
|
|
32
|
+
},
|
|
33
|
+
background: {
|
|
34
|
+
default: "#ffffff",
|
|
35
|
+
light: "#fafafa",
|
|
36
|
+
medium: "#f6f6f6"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function u(a, f) {
|
|
40
|
+
var e;
|
|
41
|
+
const c = ((e = n[a]) == null ? void 0 : e[f]) ?? d.default;
|
|
42
|
+
return Array.from(c);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
n as CHART_THEME_PALETTES,
|
|
46
|
+
d as COLOR_PALETTES,
|
|
47
|
+
r as UI_COLORS,
|
|
48
|
+
u as getThemePalette
|
|
49
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ChartOptions } from '../chart-card.config.types';
|
|
2
|
+
export declare const DEFAULT_CHART_HEIGHT = 400;
|
|
3
|
+
export declare const DEFAULT_CHART_WIDTH = "100%";
|
|
4
|
+
export declare const DEFAULT_FONT_FAMILY = "Inter Variable, sans-serif";
|
|
5
|
+
export declare const COMMON_TEXT_STYLE: {
|
|
6
|
+
fontFamily: string;
|
|
7
|
+
color: "#000000";
|
|
8
|
+
};
|
|
9
|
+
export declare function buildTitleConfig(title: string, options?: ChartOptions['title']): {
|
|
10
|
+
text: string;
|
|
11
|
+
textStyle: {
|
|
12
|
+
fontFamily: string;
|
|
13
|
+
fontSize: number;
|
|
14
|
+
fontWeight: number;
|
|
15
|
+
color: string;
|
|
16
|
+
};
|
|
17
|
+
left: "center" | "left" | "right";
|
|
18
|
+
top: number;
|
|
19
|
+
padding: number[];
|
|
20
|
+
} | undefined;
|
|
21
|
+
export declare function buildTooltipConfig(options?: ChartOptions['tooltip']): {
|
|
22
|
+
trigger: "axis" | "item";
|
|
23
|
+
backgroundColor: "#ffffff";
|
|
24
|
+
borderColor: "#d1d1d1";
|
|
25
|
+
borderWidth: number;
|
|
26
|
+
textStyle: {
|
|
27
|
+
fontFamily: string;
|
|
28
|
+
color: "#000000";
|
|
29
|
+
};
|
|
30
|
+
} | undefined;
|
|
31
|
+
export declare function buildLegendConfig(data: string[], hasTitle?: boolean, options?: ChartOptions['legend']): {
|
|
32
|
+
data: string[];
|
|
33
|
+
top: string | number;
|
|
34
|
+
bottom: string | number | undefined;
|
|
35
|
+
left: string | number;
|
|
36
|
+
right: string | number | undefined;
|
|
37
|
+
orient: "horizontal" | "vertical";
|
|
38
|
+
itemGap: number;
|
|
39
|
+
padding: number[];
|
|
40
|
+
textStyle: {
|
|
41
|
+
fontSize: number;
|
|
42
|
+
fontFamily: string;
|
|
43
|
+
color: "#000000";
|
|
44
|
+
};
|
|
45
|
+
itemWidth: number;
|
|
46
|
+
itemHeight: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
export declare function buildAxisLabelConfig(rotate?: number): {
|
|
49
|
+
rotate?: number | undefined;
|
|
50
|
+
color: "#5d5d5d";
|
|
51
|
+
fontFamily: string;
|
|
52
|
+
fontSize: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function buildAxisLineConfig(show?: boolean): {
|
|
55
|
+
show: boolean;
|
|
56
|
+
lineStyle: {
|
|
57
|
+
color: "#d1d1d1";
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare function buildSplitLineConfig(show?: boolean): {
|
|
61
|
+
show: boolean;
|
|
62
|
+
lineStyle: {
|
|
63
|
+
color: "#e7e7e7";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export declare function buildGridConfig(hasTitle: boolean, hasLegend?: boolean, legendPosition?: 'top' | 'bottom' | 'left' | 'right', customGrid?: ChartOptions['grid']): {
|
|
67
|
+
left: string | number;
|
|
68
|
+
right: string | number;
|
|
69
|
+
bottom: string | number;
|
|
70
|
+
top: string | number;
|
|
71
|
+
containLabel: boolean;
|
|
72
|
+
};
|
|
73
|
+
export declare function buildXAxisConfig(data: string[], boundaryGap?: boolean, options?: ChartOptions['xAxis']): {
|
|
74
|
+
show: boolean;
|
|
75
|
+
type?: undefined;
|
|
76
|
+
data?: undefined;
|
|
77
|
+
boundaryGap?: undefined;
|
|
78
|
+
name?: undefined;
|
|
79
|
+
nameLocation?: undefined;
|
|
80
|
+
nameGap?: undefined;
|
|
81
|
+
nameTextStyle?: undefined;
|
|
82
|
+
axisLine?: undefined;
|
|
83
|
+
axisLabel?: undefined;
|
|
84
|
+
splitLine?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
type: "category";
|
|
87
|
+
data: string[];
|
|
88
|
+
boundaryGap: boolean;
|
|
89
|
+
name: string | undefined;
|
|
90
|
+
nameLocation: "end" | "middle" | "start";
|
|
91
|
+
nameGap: number | undefined;
|
|
92
|
+
nameTextStyle: {
|
|
93
|
+
fontSize: number;
|
|
94
|
+
fontWeight: number;
|
|
95
|
+
fontFamily: string;
|
|
96
|
+
color: "#000000";
|
|
97
|
+
} | undefined;
|
|
98
|
+
axisLine: {
|
|
99
|
+
show: boolean;
|
|
100
|
+
lineStyle: {
|
|
101
|
+
color: "#d1d1d1";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
axisLabel: {
|
|
105
|
+
rotate?: number | undefined;
|
|
106
|
+
color: "#5d5d5d";
|
|
107
|
+
fontFamily: string;
|
|
108
|
+
fontSize: number;
|
|
109
|
+
};
|
|
110
|
+
splitLine: {
|
|
111
|
+
show: boolean;
|
|
112
|
+
lineStyle: {
|
|
113
|
+
color: "#e7e7e7";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
show?: undefined;
|
|
117
|
+
};
|
|
118
|
+
export declare function buildYAxisConfig(options?: ChartOptions['yAxis']): {
|
|
119
|
+
show: boolean;
|
|
120
|
+
type?: undefined;
|
|
121
|
+
name?: undefined;
|
|
122
|
+
nameLocation?: undefined;
|
|
123
|
+
nameGap?: undefined;
|
|
124
|
+
nameRotate?: undefined;
|
|
125
|
+
nameTextStyle?: undefined;
|
|
126
|
+
min?: undefined;
|
|
127
|
+
max?: undefined;
|
|
128
|
+
axisLine?: undefined;
|
|
129
|
+
axisLabel?: undefined;
|
|
130
|
+
splitLine?: undefined;
|
|
131
|
+
} | {
|
|
132
|
+
type: "value";
|
|
133
|
+
name: string | undefined;
|
|
134
|
+
nameLocation: "end" | "middle" | "start";
|
|
135
|
+
nameGap: number | undefined;
|
|
136
|
+
nameRotate: number;
|
|
137
|
+
nameTextStyle: {
|
|
138
|
+
fontSize: number;
|
|
139
|
+
fontWeight: number;
|
|
140
|
+
fontFamily: string;
|
|
141
|
+
color: "#000000";
|
|
142
|
+
} | undefined;
|
|
143
|
+
min: number | undefined;
|
|
144
|
+
max: number | undefined;
|
|
145
|
+
axisLine: {
|
|
146
|
+
show: boolean;
|
|
147
|
+
lineStyle: {
|
|
148
|
+
color: "#d1d1d1";
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
axisLabel: {
|
|
152
|
+
rotate?: number | undefined;
|
|
153
|
+
color: "#5d5d5d";
|
|
154
|
+
fontFamily: string;
|
|
155
|
+
fontSize: number;
|
|
156
|
+
};
|
|
157
|
+
splitLine: {
|
|
158
|
+
show: boolean;
|
|
159
|
+
lineStyle: {
|
|
160
|
+
color: "#e7e7e7";
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
show?: undefined;
|
|
164
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { UI_COLORS as m } from "./colors.js";
|
|
2
|
+
const g = "Inter Variable, sans-serif", c = {
|
|
3
|
+
fontFamily: g,
|
|
4
|
+
color: m.text.primary
|
|
5
|
+
};
|
|
6
|
+
function y(e, l) {
|
|
7
|
+
if ((l == null ? void 0 : l.show) === !1)
|
|
8
|
+
return;
|
|
9
|
+
const r = (l == null ? void 0 : l.position) ?? "left", a = (l == null ? void 0 : l.fontSize) ?? 16, f = (l == null ? void 0 : l.color) ?? m.text.primary;
|
|
10
|
+
return {
|
|
11
|
+
text: e,
|
|
12
|
+
textStyle: {
|
|
13
|
+
fontFamily: g,
|
|
14
|
+
fontSize: a,
|
|
15
|
+
fontWeight: 500,
|
|
16
|
+
color: f
|
|
17
|
+
},
|
|
18
|
+
left: r,
|
|
19
|
+
top: 12,
|
|
20
|
+
padding: [0, 0, 8, 0]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function C(e) {
|
|
24
|
+
return (e == null ? void 0 : e.show) === !1 ? void 0 : {
|
|
25
|
+
trigger: (e == null ? void 0 : e.trigger) ?? "axis",
|
|
26
|
+
backgroundColor: m.background.default,
|
|
27
|
+
borderColor: m.border.default,
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
textStyle: {
|
|
30
|
+
...c
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function v(e, l = !1, r) {
|
|
35
|
+
if ((r == null ? void 0 : r.show) === !1)
|
|
36
|
+
return;
|
|
37
|
+
const a = (r == null ? void 0 : r.position) ?? "top", f = (r == null ? void 0 : r.orient) ?? "horizontal";
|
|
38
|
+
let u = l ? 48 : 16, t, d = "center", b;
|
|
39
|
+
return a === "bottom" ? (u = "auto", t = 10) : a === "left" ? (u = "middle", d = 10) : a === "right" && (u = "middle", d = "auto", b = 10), {
|
|
40
|
+
data: e,
|
|
41
|
+
top: u,
|
|
42
|
+
bottom: t,
|
|
43
|
+
left: d,
|
|
44
|
+
right: b,
|
|
45
|
+
orient: f,
|
|
46
|
+
itemGap: 20,
|
|
47
|
+
padding: [8, 0, 12, 0],
|
|
48
|
+
textStyle: {
|
|
49
|
+
...c,
|
|
50
|
+
fontSize: 12
|
|
51
|
+
},
|
|
52
|
+
itemWidth: 25,
|
|
53
|
+
itemHeight: 14
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function x(e) {
|
|
57
|
+
return {
|
|
58
|
+
color: m.text.secondary,
|
|
59
|
+
fontFamily: g,
|
|
60
|
+
fontSize: 11,
|
|
61
|
+
...e && { rotate: e }
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function S(e = !0) {
|
|
65
|
+
return {
|
|
66
|
+
show: e,
|
|
67
|
+
lineStyle: {
|
|
68
|
+
color: m.border.default
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function h(e = !0) {
|
|
73
|
+
return {
|
|
74
|
+
show: e,
|
|
75
|
+
lineStyle: {
|
|
76
|
+
color: m.border.light
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function T(e, l = !1, r = "top", a) {
|
|
81
|
+
if (a)
|
|
82
|
+
return {
|
|
83
|
+
left: a.left ?? "3%",
|
|
84
|
+
right: a.right ?? "4%",
|
|
85
|
+
bottom: a.bottom ?? "3%",
|
|
86
|
+
top: a.top ?? 20,
|
|
87
|
+
containLabel: !0
|
|
88
|
+
};
|
|
89
|
+
let f = 20;
|
|
90
|
+
e && (f += 48), l && r === "top" && (f += 40);
|
|
91
|
+
let u = "3%";
|
|
92
|
+
l && r === "bottom" && (u = 60);
|
|
93
|
+
let t = "3%";
|
|
94
|
+
l && r === "left" && (t = 100);
|
|
95
|
+
let d = "4%";
|
|
96
|
+
return l && r === "right" && (d = 100), {
|
|
97
|
+
left: t,
|
|
98
|
+
right: d,
|
|
99
|
+
bottom: u,
|
|
100
|
+
top: f,
|
|
101
|
+
containLabel: !0
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function w(e, l = !0, r) {
|
|
105
|
+
return (r == null ? void 0 : r.show) === !1 ? { show: !1 } : {
|
|
106
|
+
type: "category",
|
|
107
|
+
data: e,
|
|
108
|
+
boundaryGap: l,
|
|
109
|
+
name: r == null ? void 0 : r.name,
|
|
110
|
+
nameLocation: (r == null ? void 0 : r.nameLocation) ?? "middle",
|
|
111
|
+
nameGap: r != null && r.name ? 30 : void 0,
|
|
112
|
+
nameTextStyle: r != null && r.name ? {
|
|
113
|
+
...c,
|
|
114
|
+
fontSize: 12,
|
|
115
|
+
fontWeight: 500
|
|
116
|
+
} : void 0,
|
|
117
|
+
axisLine: S(),
|
|
118
|
+
axisLabel: x(r == null ? void 0 : r.labelRotate),
|
|
119
|
+
splitLine: h((r == null ? void 0 : r.gridLines) ?? !1)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function z(e) {
|
|
123
|
+
if ((e == null ? void 0 : e.show) === !1)
|
|
124
|
+
return { show: !1 };
|
|
125
|
+
const l = (e == null ? void 0 : e.min) === "auto" || e == null ? void 0 : e.min, r = (e == null ? void 0 : e.max) === "auto" || e == null ? void 0 : e.max;
|
|
126
|
+
return {
|
|
127
|
+
type: "value",
|
|
128
|
+
name: e == null ? void 0 : e.name,
|
|
129
|
+
nameLocation: (e == null ? void 0 : e.nameLocation) ?? "middle",
|
|
130
|
+
nameGap: e != null && e.name ? 50 : void 0,
|
|
131
|
+
nameRotate: 90,
|
|
132
|
+
nameTextStyle: e != null && e.name ? {
|
|
133
|
+
...c,
|
|
134
|
+
fontSize: 12,
|
|
135
|
+
fontWeight: 500
|
|
136
|
+
} : void 0,
|
|
137
|
+
min: l,
|
|
138
|
+
max: r,
|
|
139
|
+
axisLine: S(!1),
|
|
140
|
+
axisLabel: x(),
|
|
141
|
+
splitLine: h((e == null ? void 0 : e.gridLines) ?? !0)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
c as COMMON_TEXT_STYLE,
|
|
146
|
+
g as DEFAULT_FONT_FAMILY,
|
|
147
|
+
x as buildAxisLabelConfig,
|
|
148
|
+
S as buildAxisLineConfig,
|
|
149
|
+
T as buildGridConfig,
|
|
150
|
+
v as buildLegendConfig,
|
|
151
|
+
h as buildSplitLineConfig,
|
|
152
|
+
y as buildTitleConfig,
|
|
153
|
+
C as buildTooltipConfig,
|
|
154
|
+
w as buildXAxisConfig,
|
|
155
|
+
z as buildYAxisConfig
|
|
156
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { ChartCard } from './chart-card';
|
|
2
|
+
export type { ChartCardProps } from './chart-card.types';
|
|
3
|
+
export { LoadingState, EmptyState, ErrorState } from './chart-card-states';
|
|
4
|
+
export type { ChartType, ChartTheme, LineChartTheme, BarChartTheme, ChartConfig, BarChartConfig, LineChartConfig, ChartSeries, ChartData, ChartOptions, SeriesStyleConfig, } from './chart-card.config.types';
|
|
5
|
+
export { UI_COLORS, COLOR_PALETTES, getThemePalette } from './config/colors';
|
|
6
|
+
export { validateChartConfig, validateChartData } from './validators/config-validator';
|
|
7
|
+
export type { ValidationResult } from './validators/config-validator';
|
|
8
|
+
export { buildBarChartOptions } from './builders/bar-chart-builder';
|
|
9
|
+
export { buildLineChartOptions } from './builders/line-chart-builder';
|
|
10
|
+
export { buildChartOptions, isChartTypeSupported, registeredChartTypes, } from './builders/chart-builder-factory';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChartConfig, ChartData } from '../chart-card.config.types';
|
|
2
|
+
export interface ValidationResult {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
error?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function validateChartConfig(config: ChartConfig): ValidationResult;
|
|
7
|
+
export declare function validateChartData(data: ChartData): ValidationResult;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const i = /* @__PURE__ */ new Set([
|
|
2
|
+
"basic",
|
|
3
|
+
"smooth"
|
|
4
|
+
]), s = /* @__PURE__ */ new Set([
|
|
5
|
+
"basic",
|
|
6
|
+
"stacked"
|
|
7
|
+
]);
|
|
8
|
+
function n(e) {
|
|
9
|
+
var r;
|
|
10
|
+
return e != null && e.type ? (r = e.name) != null && r.trim() ? (e.type === "line" ? i.has(e.theme) : s.has(e.theme)) ? { valid: !0 } : {
|
|
11
|
+
valid: !1,
|
|
12
|
+
error: `Theme "${e.theme}" is not supported for ${e.type} charts`
|
|
13
|
+
} : { valid: !1, error: "Chart name is required" } : { valid: !1, error: "Chart type is required" };
|
|
14
|
+
}
|
|
15
|
+
function u(e) {
|
|
16
|
+
if (!e)
|
|
17
|
+
return { valid: !1, error: "Chart data is required" };
|
|
18
|
+
if (!Array.isArray(e.labels) || e.labels.length === 0)
|
|
19
|
+
return { valid: !1, error: "At least one label is required" };
|
|
20
|
+
if (!Array.isArray(e.series) || e.series.length === 0)
|
|
21
|
+
return { valid: !1, error: "At least one data series is required" };
|
|
22
|
+
const a = e.labels.length;
|
|
23
|
+
for (const r of e.series) {
|
|
24
|
+
const t = l(r, a);
|
|
25
|
+
if (!t.valid)
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
return { valid: !0 };
|
|
29
|
+
}
|
|
30
|
+
function l(e, a) {
|
|
31
|
+
var r;
|
|
32
|
+
return (r = e.name) != null && r.trim() ? Array.isArray(e.values) ? e.values.length !== a ? {
|
|
33
|
+
valid: !1,
|
|
34
|
+
error: `Series "${e.name}" contains ${e.values.length} points, expected ${a}`
|
|
35
|
+
} : { valid: !0 } : { valid: !1, error: `Series "${e.name}" is missing values` } : { valid: !1, error: "Each series requires a name" };
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
n as validateChartConfig,
|
|
39
|
+
u as validateChartData
|
|
40
|
+
};
|
|
@@ -44,7 +44,10 @@ import "../../../segmented-control/item.js";
|
|
|
44
44
|
import "@radix-ui/react-popover";
|
|
45
45
|
import "../../../dynamic-table/z2-table.js";
|
|
46
46
|
import "../../../dynamic-table/z2-table-context.js";
|
|
47
|
-
|
|
47
|
+
import "../../../chart/chart.js";
|
|
48
|
+
import "../../../chart-card/config/defaults.js";
|
|
49
|
+
import "../../../chart-card/config/colors.js";
|
|
50
|
+
const pt = ({
|
|
48
51
|
avatar: m,
|
|
49
52
|
value: a,
|
|
50
53
|
rightIcon: o,
|
|
@@ -82,5 +85,5 @@ const mt = ({
|
|
|
82
85
|
}
|
|
83
86
|
);
|
|
84
87
|
export {
|
|
85
|
-
|
|
88
|
+
pt as AvatarCell
|
|
86
89
|
};
|
|
@@ -49,6 +49,9 @@ import "../segmented-control/item.js";
|
|
|
49
49
|
import "@radix-ui/react-popover";
|
|
50
50
|
import "../dynamic-table/z2-table.js";
|
|
51
51
|
import "../dynamic-table/z2-table-context.js";
|
|
52
|
+
import "../chart/chart.js";
|
|
53
|
+
import "../chart-card/config/defaults.js";
|
|
54
|
+
import "../chart-card/config/colors.js";
|
|
52
55
|
import { TableHeaderWrapper as T } from "./components/table-header-wrapper.js";
|
|
53
56
|
import { TableHeaderContent as b } from "./components/table-header-content.js";
|
|
54
57
|
import { TableFooter as s } from "./components/table-footer.js";
|
|
@@ -44,8 +44,11 @@ import "../segmented-control/item.js";
|
|
|
44
44
|
import "@radix-ui/react-popover";
|
|
45
45
|
import "../dynamic-table/z2-table.js";
|
|
46
46
|
import "../dynamic-table/z2-table-context.js";
|
|
47
|
+
import "../chart/chart.js";
|
|
48
|
+
import "../chart-card/config/defaults.js";
|
|
49
|
+
import "../chart-card/config/colors.js";
|
|
47
50
|
import "../table/table.context.js";
|
|
48
|
-
const
|
|
51
|
+
const _e = ({
|
|
49
52
|
dataSource: w,
|
|
50
53
|
schema: B,
|
|
51
54
|
loading: b,
|
|
@@ -58,7 +61,7 @@ const He = ({
|
|
|
58
61
|
search: m,
|
|
59
62
|
filter: t,
|
|
60
63
|
headerLeftContent: h,
|
|
61
|
-
headerActions:
|
|
64
|
+
headerActions: p,
|
|
62
65
|
body: l = {
|
|
63
66
|
cell: { hasBorder: !0 },
|
|
64
67
|
className: "",
|
|
@@ -69,20 +72,20 @@ const He = ({
|
|
|
69
72
|
pagination: o,
|
|
70
73
|
paginationInfo: i,
|
|
71
74
|
paginationQuickJumper: a,
|
|
72
|
-
error:
|
|
75
|
+
error: u = !1,
|
|
73
76
|
dataSourceError: _ = !1
|
|
74
77
|
}) => {
|
|
75
78
|
var F;
|
|
76
|
-
if (
|
|
79
|
+
if (u)
|
|
77
80
|
return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
|
|
78
81
|
/* @__PURE__ */ e(S, { className: "mt-1.5" }),
|
|
79
82
|
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
|
|
80
83
|
/* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
|
|
81
84
|
/* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
|
|
82
|
-
typeof
|
|
85
|
+
typeof u == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: u })
|
|
83
86
|
] })
|
|
84
87
|
] }) });
|
|
85
|
-
const C = a && a.totalPage && a.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!i || C, v = m || t || h ||
|
|
88
|
+
const C = a && a.totalPage && a.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!i || C, v = m || t || h || p, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
|
|
86
89
|
return /* @__PURE__ */ s("div", { className: d("flex flex-col overflow-hidden relative", H), children: [
|
|
87
90
|
/* @__PURE__ */ s(r, { dataSource: w, schema: B, emptyMessage: k, children: [
|
|
88
91
|
g && v && /* @__PURE__ */ s(
|
|
@@ -127,7 +130,7 @@ const He = ({
|
|
|
127
130
|
}
|
|
128
131
|
)
|
|
129
132
|
] }),
|
|
130
|
-
|
|
133
|
+
p && /* @__PURE__ */ e(r.HeaderContent, { children: p })
|
|
131
134
|
]
|
|
132
135
|
}
|
|
133
136
|
),
|
|
@@ -201,5 +204,5 @@ const He = ({
|
|
|
201
204
|
] });
|
|
202
205
|
};
|
|
203
206
|
export {
|
|
204
|
-
|
|
207
|
+
_e as default
|
|
205
208
|
};
|