@burdenoff/microfe-bigconsole 2026.1124.4 → 2026.1124.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/builder/inspector/AppearanceSection.js +12 -6
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.d.ts +2 -1
- package/dist/bigconsole/components/builder/inspector/DataBindingSection.js +34 -34
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +489 -474
- package/dist/bigconsole/components/widgets/chart/ChartConfig.d.ts +1 -0
- package/dist/bigconsole/components/widgets/chart/ChartConfig.js +111 -107
- package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.d.ts +8 -0
- package/dist/bigconsole/components/widgets/chart/ChartFieldMappings.js +85 -0
- package/dist/bigconsole/components/widgets/chart/chartMappingFields.d.ts +9 -0
- package/dist/bigconsole/components/widgets/chart/chartMappingFields.js +30 -0
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.d.ts +2 -0
- package/dist/bigconsole/components/widgets/chart/charts/funnelData.js +11 -13
- package/dist/bigconsole/utils/widgetBinding.js +57 -44
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export interface ChartConfigProps {
|
|
|
10
10
|
* Chart Type picker is not offered and the settings follow that type (BOFF-10138).
|
|
11
11
|
*/
|
|
12
12
|
fixedChartType?: ConfigType['chartType'];
|
|
13
|
+
showFieldMappings?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const ChartConfig: FC<ChartConfigProps>;
|
|
15
16
|
export default ChartConfig;
|
|
@@ -5,71 +5,71 @@ import { ThemedSelect as o } from "@burdenoff/fe-libs/ui";
|
|
|
5
5
|
import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
6
6
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
// src/bigconsole/components/widgets/chart/ChartConfig.tsx
|
|
8
|
-
var d = r(function({ config: r, onChange: d, fixedChartType: f }) {
|
|
9
|
-
let { t:
|
|
8
|
+
var d = r(function({ config: r, onChange: d, fixedChartType: f, showFieldMappings: p = !0 }) {
|
|
9
|
+
let { t: m } = s(), h = a(() => f ? {
|
|
10
10
|
...r,
|
|
11
11
|
chartType: f
|
|
12
|
-
} : r, [r, f]),
|
|
12
|
+
} : r, [r, f]), g = a(() => [
|
|
13
13
|
{
|
|
14
14
|
value: "line",
|
|
15
|
-
label:
|
|
15
|
+
label: m("bigconsole.widget.config.chart.type.line", "Line Chart")
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
value: "bar",
|
|
19
|
-
label:
|
|
19
|
+
label: m("bigconsole.widget.config.chart.type.bar", "Bar Chart")
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
value: "area",
|
|
23
|
-
label:
|
|
23
|
+
label: m("bigconsole.widget.config.chart.type.area", "Area Chart")
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
value: "pie",
|
|
27
|
-
label:
|
|
27
|
+
label: m("bigconsole.widget.config.chart.type.pie", "Pie Chart")
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
value: "funnel",
|
|
31
|
-
label:
|
|
31
|
+
label: m("bigconsole.widget.config.chart.type.funnel", "Funnel Chart")
|
|
32
32
|
}
|
|
33
|
-
], [
|
|
33
|
+
], [m]), _ = a(() => [
|
|
34
34
|
{
|
|
35
35
|
value: "monotone",
|
|
36
|
-
label:
|
|
36
|
+
label: m("bigconsole.widget.config.chart.curve.smooth", "Smooth")
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
value: "linear",
|
|
40
|
-
label:
|
|
40
|
+
label: m("bigconsole.widget.config.chart.curve.linear", "Linear")
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
value: "step",
|
|
44
|
-
label:
|
|
44
|
+
label: m("bigconsole.widget.config.chart.curve.step", "Step")
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
value: "natural",
|
|
48
|
-
label:
|
|
48
|
+
label: m("bigconsole.widget.config.chart.curve.natural", "Natural")
|
|
49
49
|
}
|
|
50
|
-
], [
|
|
50
|
+
], [m]), v = a(() => [
|
|
51
51
|
{
|
|
52
52
|
value: "top",
|
|
53
|
-
label:
|
|
53
|
+
label: m("bigconsole.widget.config.chart.legendPosition.top", "Top")
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
value: "bottom",
|
|
57
|
-
label:
|
|
57
|
+
label: m("bigconsole.widget.config.chart.legendPosition.bottom", "Bottom")
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
value: "left",
|
|
61
|
-
label:
|
|
61
|
+
label: m("bigconsole.widget.config.chart.legendPosition.left", "Left")
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
value: "right",
|
|
65
|
-
label:
|
|
65
|
+
label: m("bigconsole.widget.config.chart.legendPosition.right", "Right")
|
|
66
66
|
}
|
|
67
|
-
], [
|
|
67
|
+
], [m]), y = i((e, t) => {
|
|
68
68
|
d({
|
|
69
|
-
...
|
|
69
|
+
...h,
|
|
70
70
|
[e]: t
|
|
71
71
|
});
|
|
72
|
-
}, [
|
|
72
|
+
}, [h, d]), b = h.chartType === "pie" || h.chartType === "funnel", x = a(() => t(h.referenceLines), [h.referenceLines]);
|
|
73
73
|
return /* @__PURE__ */ u("div", {
|
|
74
74
|
className: "min-w-0 space-y-form-gap",
|
|
75
75
|
children: [
|
|
@@ -77,162 +77,166 @@ var d = r(function({ config: r, onChange: d, fixedChartType: f }) {
|
|
|
77
77
|
hidden: f !== void 0,
|
|
78
78
|
children: [/* @__PURE__ */ l("label", {
|
|
79
79
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
80
|
-
children:
|
|
80
|
+
children: m("bigconsole.widget.config.chart.chartTypeLabel", "Chart Type")
|
|
81
81
|
}), /* @__PURE__ */ l(o, {
|
|
82
|
-
"aria-label":
|
|
83
|
-
value:
|
|
84
|
-
onChange: (e) =>
|
|
82
|
+
"aria-label": m("bigconsole.widget.config.chart.chartTypeLabel", "Chart Type"),
|
|
83
|
+
value: h.chartType || "line",
|
|
84
|
+
onChange: (e) => y("chartType", e.target.value),
|
|
85
85
|
className: "\n w-full px-3 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\n ",
|
|
86
|
-
children:
|
|
86
|
+
children: g.map((e) => /* @__PURE__ */ l("option", {
|
|
87
87
|
value: e.value,
|
|
88
88
|
children: e.label
|
|
89
89
|
}, e.value))
|
|
90
90
|
})]
|
|
91
91
|
}),
|
|
92
|
-
!
|
|
93
|
-
/* @__PURE__ */ u("div", {
|
|
94
|
-
|
|
95
|
-
children:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
!b && /* @__PURE__ */ u(c, { children: [
|
|
93
|
+
/* @__PURE__ */ u("div", {
|
|
94
|
+
hidden: !p,
|
|
95
|
+
children: [/* @__PURE__ */ l("label", {
|
|
96
|
+
className: "block text-sm font-medium text-text-primary mb-1",
|
|
97
|
+
children: m("bigconsole.widget.config.chart.xAxisFieldLabel", "X-Axis Field")
|
|
98
|
+
}), /* @__PURE__ */ l("input", {
|
|
99
|
+
type: "text",
|
|
100
|
+
value: h.xAxisField || "",
|
|
101
|
+
onChange: (e) => y("xAxisField", e.target.value),
|
|
102
|
+
placeholder: m("bigconsole.widget.config.chart.xAxisFieldPlaceholder", "e.g., date, category"),
|
|
103
|
+
className: "\n w-full px-3 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\n "
|
|
104
|
+
})]
|
|
105
|
+
}),
|
|
103
106
|
/* @__PURE__ */ u("div", {
|
|
104
107
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
105
108
|
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
106
109
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
107
|
-
children:
|
|
110
|
+
children: m("bigconsole.widget.config.chart.xAxisLabelLabel", "X-Axis Label")
|
|
108
111
|
}), /* @__PURE__ */ l("input", {
|
|
109
112
|
type: "text",
|
|
110
|
-
value:
|
|
111
|
-
onChange: (e) =>
|
|
112
|
-
placeholder:
|
|
113
|
+
value: h.xAxisLabel || "",
|
|
114
|
+
onChange: (e) => y("xAxisLabel", e.target.value),
|
|
115
|
+
placeholder: m("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
113
116
|
className: "\n w-full px-3 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\n "
|
|
114
117
|
})] }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
115
118
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
116
|
-
children:
|
|
119
|
+
children: m("bigconsole.widget.config.chart.yAxisLabelLabel", "Y-Axis Label")
|
|
117
120
|
}), /* @__PURE__ */ l("input", {
|
|
118
121
|
type: "text",
|
|
119
|
-
value:
|
|
120
|
-
onChange: (e) =>
|
|
121
|
-
placeholder:
|
|
122
|
+
value: h.yAxisLabel || "",
|
|
123
|
+
onChange: (e) => y("yAxisLabel", e.target.value),
|
|
124
|
+
placeholder: m("bigconsole.widget.config.chart.optionalPlaceholder", "Optional"),
|
|
122
125
|
className: "\n w-full px-3 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\n "
|
|
123
126
|
})] })]
|
|
124
127
|
}),
|
|
125
|
-
!
|
|
128
|
+
!b && /* @__PURE__ */ u("div", {
|
|
126
129
|
className: "grid grid-cols-2 gap-3",
|
|
127
130
|
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
128
131
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
129
|
-
children:
|
|
132
|
+
children: m("bigconsole.widget.config.chart.yMinLabel", "Y-Axis Min")
|
|
130
133
|
}), /* @__PURE__ */ l("input", {
|
|
131
134
|
type: "number",
|
|
132
|
-
value:
|
|
133
|
-
onChange: (e) =>
|
|
134
|
-
placeholder:
|
|
135
|
+
value: h.yMin ?? "",
|
|
136
|
+
onChange: (e) => y("yMin", e.target.value === "" ? void 0 : Number(e.target.value)),
|
|
137
|
+
placeholder: m("bigconsole.widget.config.chart.autoPlaceholder", "Auto"),
|
|
135
138
|
className: "\n w-full px-3 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\n "
|
|
136
139
|
})] }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
137
140
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
138
|
-
children:
|
|
141
|
+
children: m("bigconsole.widget.config.chart.yMaxLabel", "Y-Axis Max")
|
|
139
142
|
}), /* @__PURE__ */ l("input", {
|
|
140
143
|
type: "number",
|
|
141
|
-
value:
|
|
142
|
-
onChange: (e) =>
|
|
143
|
-
placeholder:
|
|
144
|
+
value: h.yMax ?? "",
|
|
145
|
+
onChange: (e) => y("yMax", e.target.value === "" ? void 0 : Number(e.target.value)),
|
|
146
|
+
placeholder: m("bigconsole.widget.config.chart.autoPlaceholder", "Auto"),
|
|
144
147
|
className: "\n w-full px-3 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\n "
|
|
145
148
|
})] })]
|
|
146
149
|
}),
|
|
147
|
-
(
|
|
150
|
+
(h.chartType === "line" || h.chartType === "area") && /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
148
151
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
149
|
-
children:
|
|
152
|
+
children: m("bigconsole.widget.config.chart.curveTypeLabel", "Curve Type")
|
|
150
153
|
}), /* @__PURE__ */ l(o, {
|
|
151
|
-
"aria-label":
|
|
152
|
-
value:
|
|
153
|
-
onChange: (e) =>
|
|
154
|
+
"aria-label": m("bigconsole.widget.config.chart.curveTypeLabel", "Curve Type"),
|
|
155
|
+
value: h.curveType || "monotone",
|
|
156
|
+
onChange: (e) => y("curveType", e.target.value),
|
|
154
157
|
className: "\n w-full px-3 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\n ",
|
|
155
|
-
children:
|
|
158
|
+
children: _.map((e) => /* @__PURE__ */ l("option", {
|
|
156
159
|
value: e.value,
|
|
157
160
|
children: e.label
|
|
158
161
|
}, e.value))
|
|
159
162
|
})] })
|
|
160
163
|
] }),
|
|
161
|
-
|
|
162
|
-
|
|
164
|
+
b && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ u("div", {
|
|
165
|
+
hidden: !p,
|
|
166
|
+
className: p ? "grid grid-cols-1 gap-3 sm:grid-cols-2" : void 0,
|
|
163
167
|
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
164
168
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
165
|
-
children:
|
|
169
|
+
children: m("bigconsole.widget.config.chart.valueFieldLabel", "Value Field")
|
|
166
170
|
}), /* @__PURE__ */ l("input", {
|
|
167
171
|
type: "text",
|
|
168
|
-
value:
|
|
169
|
-
onChange: (e) =>
|
|
170
|
-
placeholder:
|
|
172
|
+
value: h.valueField || "",
|
|
173
|
+
onChange: (e) => y("valueField", e.target.value),
|
|
174
|
+
placeholder: m("bigconsole.widget.config.chart.valueFieldPlaceholder", "e.g., value"),
|
|
171
175
|
className: "\n w-full px-3 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\n "
|
|
172
176
|
})] }), /* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
173
177
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
174
|
-
children:
|
|
178
|
+
children: m("bigconsole.widget.config.chart.labelFieldLabel", "Label Field")
|
|
175
179
|
}), /* @__PURE__ */ l("input", {
|
|
176
180
|
type: "text",
|
|
177
|
-
value:
|
|
178
|
-
onChange: (e) =>
|
|
179
|
-
placeholder:
|
|
181
|
+
value: h.labelField || "",
|
|
182
|
+
onChange: (e) => y("labelField", e.target.value),
|
|
183
|
+
placeholder: m("bigconsole.widget.config.chart.labelFieldPlaceholder", "e.g., name"),
|
|
180
184
|
className: "\n w-full px-3 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\n "
|
|
181
185
|
})] })]
|
|
182
|
-
}),
|
|
186
|
+
}), h.chartType === "pie" && /* @__PURE__ */ u("label", {
|
|
183
187
|
className: "flex items-center gap-3",
|
|
184
188
|
children: [/* @__PURE__ */ l("input", {
|
|
185
189
|
type: "checkbox",
|
|
186
|
-
checked:
|
|
187
|
-
onChange: (e) =>
|
|
190
|
+
checked: h.showAsDonut === !0,
|
|
191
|
+
onChange: (e) => y("showAsDonut", e.target.checked),
|
|
188
192
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
189
193
|
}), /* @__PURE__ */ l("span", {
|
|
190
194
|
className: "text-sm text-text-primary",
|
|
191
|
-
children:
|
|
195
|
+
children: m("bigconsole.widget.config.chart.showAsDonut", "Show as Donut")
|
|
192
196
|
})]
|
|
193
197
|
})] }),
|
|
194
198
|
/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l("label", {
|
|
195
199
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
196
|
-
children:
|
|
200
|
+
children: m("bigconsole.widget.config.chart.legendPositionLabel", "Legend Position")
|
|
197
201
|
}), /* @__PURE__ */ l(o, {
|
|
198
|
-
"aria-label":
|
|
199
|
-
value:
|
|
200
|
-
onChange: (e) =>
|
|
202
|
+
"aria-label": m("bigconsole.widget.config.chart.legendPositionLabel", "Legend Position"),
|
|
203
|
+
value: h.legendPosition || "bottom",
|
|
204
|
+
onChange: (e) => y("legendPosition", e.target.value),
|
|
201
205
|
className: "\n w-full px-3 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\n ",
|
|
202
|
-
children:
|
|
206
|
+
children: v.map((e) => /* @__PURE__ */ l("option", {
|
|
203
207
|
value: e.value,
|
|
204
208
|
children: e.label
|
|
205
209
|
}, e.value))
|
|
206
210
|
})] }),
|
|
207
|
-
!
|
|
211
|
+
!b && /* @__PURE__ */ u("div", { children: [
|
|
208
212
|
/* @__PURE__ */ l("label", {
|
|
209
213
|
className: "block text-sm font-medium text-text-primary mb-1",
|
|
210
|
-
children:
|
|
214
|
+
children: m("bigconsole.widget.config.chart.fieldsToDisplayLabel", "Fields to Display")
|
|
211
215
|
}),
|
|
212
216
|
/* @__PURE__ */ l("p", {
|
|
213
217
|
className: "text-xs text-text-secondary mb-2",
|
|
214
|
-
children:
|
|
218
|
+
children: m("bigconsole.widget.config.chart.fieldsToDisplayHelp", "Select which numeric fields to show as chart series. Leave empty to show all.")
|
|
215
219
|
}),
|
|
216
220
|
/* @__PURE__ */ l("input", {
|
|
217
221
|
type: "text",
|
|
218
|
-
value:
|
|
222
|
+
value: h.selectedFields?.join(", ") || "",
|
|
219
223
|
onChange: (e) => {
|
|
220
224
|
let t = e.target.value.trim(), n = t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [];
|
|
221
|
-
|
|
225
|
+
y("selectedFields", n.length > 0 ? n : void 0);
|
|
222
226
|
},
|
|
223
|
-
placeholder:
|
|
227
|
+
placeholder: m("bigconsole.widget.config.chart.fieldsToDisplayPlaceholder", "e.g., revenue, orders, users (comma-separated)"),
|
|
224
228
|
className: "\n w-full px-3 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\n "
|
|
225
229
|
}),
|
|
226
230
|
/* @__PURE__ */ l("p", {
|
|
227
231
|
className: "text-xs text-text-muted mt-1",
|
|
228
|
-
children:
|
|
232
|
+
children: m("bigconsole.widget.config.chart.fieldsToDisplayHint", "Enter field names separated by commas")
|
|
229
233
|
})
|
|
230
234
|
] }),
|
|
231
|
-
!
|
|
235
|
+
!b && /* @__PURE__ */ l("div", {
|
|
232
236
|
className: "border-t border-[var(--color-border-subtle)] pt-form-gap",
|
|
233
237
|
children: /* @__PURE__ */ l(e, {
|
|
234
|
-
lines:
|
|
235
|
-
onChange: (e) =>
|
|
238
|
+
lines: x,
|
|
239
|
+
onChange: (e) => y("referenceLines", n(e))
|
|
236
240
|
})
|
|
237
241
|
}),
|
|
238
242
|
/* @__PURE__ */ u("div", {
|
|
@@ -248,61 +252,61 @@ var d = r(function({ config: r, onChange: d, fixedChartType: f }) {
|
|
|
248
252
|
className: "flex items-center gap-3",
|
|
249
253
|
children: [/* @__PURE__ */ l("input", {
|
|
250
254
|
type: "checkbox",
|
|
251
|
-
checked:
|
|
252
|
-
onChange: (e) =>
|
|
255
|
+
checked: h.showGrid !== !1,
|
|
256
|
+
onChange: (e) => y("showGrid", e.target.checked),
|
|
253
257
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
254
258
|
}), /* @__PURE__ */ l("span", {
|
|
255
259
|
className: "text-sm text-text-primary",
|
|
256
|
-
children:
|
|
260
|
+
children: m("bigconsole.widget.config.chart.showGrid", "Show Grid")
|
|
257
261
|
})]
|
|
258
262
|
}),
|
|
259
263
|
/* @__PURE__ */ u("label", {
|
|
260
264
|
className: "flex items-center gap-3",
|
|
261
265
|
children: [/* @__PURE__ */ l("input", {
|
|
262
266
|
type: "checkbox",
|
|
263
|
-
checked:
|
|
264
|
-
onChange: (e) =>
|
|
267
|
+
checked: h.showLegend !== !1,
|
|
268
|
+
onChange: (e) => y("showLegend", e.target.checked),
|
|
265
269
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
266
270
|
}), /* @__PURE__ */ l("span", {
|
|
267
271
|
className: "text-sm text-text-primary",
|
|
268
|
-
children:
|
|
272
|
+
children: m("bigconsole.widget.config.chart.showLegend", "Show Legend")
|
|
269
273
|
})]
|
|
270
274
|
}),
|
|
271
|
-
!
|
|
275
|
+
!b && /* @__PURE__ */ u(c, { children: [
|
|
272
276
|
/* @__PURE__ */ u("label", {
|
|
273
277
|
className: "flex items-center gap-3",
|
|
274
278
|
children: [/* @__PURE__ */ l("input", {
|
|
275
279
|
type: "checkbox",
|
|
276
|
-
checked:
|
|
277
|
-
onChange: (e) =>
|
|
280
|
+
checked: h.showDataPoints === !0,
|
|
281
|
+
onChange: (e) => y("showDataPoints", e.target.checked),
|
|
278
282
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
279
283
|
}), /* @__PURE__ */ l("span", {
|
|
280
284
|
className: "text-sm text-text-primary",
|
|
281
|
-
children:
|
|
285
|
+
children: m("bigconsole.widget.config.chart.showDataPoints", "Show Data Points")
|
|
282
286
|
})]
|
|
283
287
|
}),
|
|
284
|
-
(
|
|
288
|
+
(h.chartType === "line" || h.chartType === "area" || h.chartType === "bar") && /* @__PURE__ */ u("label", {
|
|
285
289
|
className: "flex items-center gap-3",
|
|
286
290
|
children: [/* @__PURE__ */ l("input", {
|
|
287
291
|
type: "checkbox",
|
|
288
|
-
checked:
|
|
289
|
-
onChange: (e) =>
|
|
292
|
+
checked: h.startAtZero === !0,
|
|
293
|
+
onChange: (e) => y("startAtZero", e.target.checked),
|
|
290
294
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
291
295
|
}), /* @__PURE__ */ l("span", {
|
|
292
296
|
className: "text-sm text-text-primary",
|
|
293
|
-
children:
|
|
297
|
+
children: m("bigconsole.widget.config.chart.startAtZero", "Y-axis: start at zero")
|
|
294
298
|
})]
|
|
295
299
|
}),
|
|
296
|
-
(
|
|
300
|
+
(h.chartType === "bar" || h.chartType === "area") && /* @__PURE__ */ u("label", {
|
|
297
301
|
className: "flex items-center gap-3",
|
|
298
302
|
children: [/* @__PURE__ */ l("input", {
|
|
299
303
|
type: "checkbox",
|
|
300
|
-
checked:
|
|
301
|
-
onChange: (e) =>
|
|
304
|
+
checked: h.stacked === !0,
|
|
305
|
+
onChange: (e) => y("stacked", e.target.checked),
|
|
302
306
|
className: "\n w-4 h-4\n text-action-primary-bg\n bg-bg-surface\n border-border-default\n rounded\n focus:ring-action-primary-bg\n "
|
|
303
307
|
}), /* @__PURE__ */ l("span", {
|
|
304
308
|
className: "text-sm text-text-primary",
|
|
305
|
-
children:
|
|
309
|
+
children: m("bigconsole.widget.config.chart.stacked", "Stacked")
|
|
306
310
|
})]
|
|
307
311
|
})
|
|
308
312
|
] })
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartMappingKey } from './chartMappingFields';
|
|
2
|
+
export interface ChartFieldMappingsProps {
|
|
3
|
+
config: Record<string, unknown>;
|
|
4
|
+
preview: unknown;
|
|
5
|
+
funnel: boolean;
|
|
6
|
+
onChange: (key: ChartMappingKey, value: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ChartFieldMappings({ config, preview, funnel, onChange }: ChartFieldMappingsProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Section as e } from "../../common/Section.js";
|
|
2
|
+
import "../../common/index.js";
|
|
3
|
+
import { chartMappingFields as t } from "./chartMappingFields.js";
|
|
4
|
+
import { useId as n, useMemo as r, useState as i } from "react";
|
|
5
|
+
import { Input as a, Label as o, ThemedSelect as s } from "@burdenoff/fe-libs/ui";
|
|
6
|
+
import { useI18n as c } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
// src/bigconsole/components/widgets/chart/ChartFieldMappings.tsx
|
|
9
|
+
function d({ label: e, value: t, options: r, onChange: d }) {
|
|
10
|
+
let { t: f } = c(), p = n(), [m, h] = i(!1), g = {
|
|
11
|
+
number: f("bigconsole.widget.config.chart.fieldType.number", "Number"),
|
|
12
|
+
text: f("bigconsole.widget.config.chart.fieldType.text", "Text"),
|
|
13
|
+
date: f("bigconsole.widget.config.chart.fieldType.date", "Date"),
|
|
14
|
+
boolean: f("bigconsole.widget.config.chart.fieldType.boolean", "Boolean"),
|
|
15
|
+
mixed: f("bigconsole.widget.config.chart.fieldType.mixed", "Mixed values")
|
|
16
|
+
}, _ = m || t !== "" && !r.some(({ name: e }) => e === t), v = r.length === 0 || _;
|
|
17
|
+
return /* @__PURE__ */ u("div", {
|
|
18
|
+
className: "min-w-0 space-y-2",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ l(o, {
|
|
21
|
+
htmlFor: p,
|
|
22
|
+
children: e
|
|
23
|
+
}),
|
|
24
|
+
r.length > 0 && /* @__PURE__ */ u(s, {
|
|
25
|
+
id: p,
|
|
26
|
+
className: "min-h-11 w-full min-w-0 rounded-input border border-border-default bg-bg-surface px-3 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
|
|
27
|
+
value: _ ? "custom" : t ? `field:${t}` : "",
|
|
28
|
+
onChange: (e) => {
|
|
29
|
+
let t = e.target.value;
|
|
30
|
+
h(t === "custom"), t !== "custom" && d(t.slice(6));
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ l("option", {
|
|
34
|
+
value: "",
|
|
35
|
+
children: f("bigconsole.widget.config.chart.fieldDefault", "Automatic")
|
|
36
|
+
}),
|
|
37
|
+
r.map(({ name: e, kind: t }) => /* @__PURE__ */ l("option", {
|
|
38
|
+
value: `field:${e}`,
|
|
39
|
+
children: f("bigconsole.widget.config.chart.typedFieldOption", "{{name}} ({{kind}})", {
|
|
40
|
+
name: e,
|
|
41
|
+
kind: g[t]
|
|
42
|
+
})
|
|
43
|
+
}, e)),
|
|
44
|
+
/* @__PURE__ */ l("option", {
|
|
45
|
+
value: "custom",
|
|
46
|
+
children: f("bigconsole.widget.config.chart.customField", "Custom field…")
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
}),
|
|
50
|
+
v && /* @__PURE__ */ l(a, {
|
|
51
|
+
className: "min-h-11",
|
|
52
|
+
id: r.length === 0 ? p : void 0,
|
|
53
|
+
"aria-label": r.length > 0 ? f("bigconsole.widget.config.chart.customFieldLabel", "Custom {{label}}", { label: e }) : void 0,
|
|
54
|
+
value: t,
|
|
55
|
+
onChange: (e) => d(e.target.value)
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function f({ config: n, preview: i, funnel: a, onChange: o }) {
|
|
61
|
+
let { t: s } = c(), u = typeof n.chartType == "string" ? n.chartType.toLowerCase() : "line", f = a || u === "funnel" ? "funnel" : u === "pie" ? "pie" : "axis", p = r(() => t(i, n, f), [
|
|
62
|
+
i,
|
|
63
|
+
n,
|
|
64
|
+
f
|
|
65
|
+
]), m = f === "axis" ? ["xAxisField"] : ["labelField", "valueField"], h = {
|
|
66
|
+
labelField: s("bigconsole.widget.config.chart.labelFieldLabel", "Label Field"),
|
|
67
|
+
valueField: s("bigconsole.widget.config.chart.valueFieldLabel", "Value Field"),
|
|
68
|
+
xAxisField: s("bigconsole.widget.config.chart.xAxisFieldLabel", "X-Axis Field")
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ l(e, {
|
|
71
|
+
title: s("bigconsole.widget.chart.fieldMappings", "Chart fields"),
|
|
72
|
+
headingLevel: 3,
|
|
73
|
+
"data-testid": "widget-inspector-chart-fields",
|
|
74
|
+
children: /* @__PURE__ */ l("div", {
|
|
75
|
+
className: "grid grid-cols-1 gap-form-gap sm:grid-cols-2",
|
|
76
|
+
children: m.map((e) => /* @__PURE__ */ l(d, {
|
|
77
|
+
label: h[e],
|
|
78
|
+
value: typeof n[e] == "string" ? n[e] : "",
|
|
79
|
+
options: p[e],
|
|
80
|
+
onChange: (t) => o(e, t)
|
|
81
|
+
}, e))
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export { f as ChartFieldMappings };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type FieldKind = 'number' | 'text' | 'date' | 'boolean' | 'mixed';
|
|
2
|
+
export type ChartMappingKey = 'xAxisField' | 'labelField' | 'valueField';
|
|
3
|
+
export interface ChartMappingField {
|
|
4
|
+
name: string;
|
|
5
|
+
kind: FieldKind;
|
|
6
|
+
}
|
|
7
|
+
/** Discover keys from the same row shape the chart renders, retaining sparse fields. */
|
|
8
|
+
export declare function chartMappingFields(preview: unknown, config: Record<string, unknown>, chart: 'axis' | 'funnel' | 'pie'): Record<ChartMappingKey, ChartMappingField[]>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveWidgetDataPath as e } from "../../../utils/widgetDisplayData.js";
|
|
2
|
+
import { classifyChartData as t } from "./chartRows.js";
|
|
3
|
+
import { isFunnelCount as n, isFunnelStageLabel as r } from "./charts/funnelData.js";
|
|
4
|
+
// src/bigconsole/components/widgets/chart/chartMappingFields.ts
|
|
5
|
+
var i = 100, a = 100, o = /^\d{4}-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12]\d|3[01])(?:T\d{2}:\d{2}.*)?)?$/;
|
|
6
|
+
function s(e) {
|
|
7
|
+
if (typeof e == "number" && Number.isFinite(e)) return "number";
|
|
8
|
+
if (typeof e == "boolean") return "boolean";
|
|
9
|
+
if (typeof e == "string" && e.trim() !== "") return o.test(e) && Number.isFinite(Date.parse(e)) ? "date" : Number.isFinite(Number(e)) ? "number" : "text";
|
|
10
|
+
}
|
|
11
|
+
function c(o, c, l) {
|
|
12
|
+
let u = {
|
|
13
|
+
xAxisField: [],
|
|
14
|
+
labelField: [],
|
|
15
|
+
valueField: []
|
|
16
|
+
}, d = t(e(o, c));
|
|
17
|
+
if (d.kind !== "rows") return u;
|
|
18
|
+
let f = /* @__PURE__ */ new Map();
|
|
19
|
+
for (let e of d.rows.slice(0, i)) for (let [t, n] of Object.entries(e)) {
|
|
20
|
+
if (t.trim() === "") continue;
|
|
21
|
+
let e = f.get(t), r = s(n);
|
|
22
|
+
r && e && e !== r && f.set(t, "mixed"), r && !e && f.size < a && f.set(t, r);
|
|
23
|
+
}
|
|
24
|
+
let p = Array.from(f, ([e, t]) => ({
|
|
25
|
+
name: e,
|
|
26
|
+
kind: t
|
|
27
|
+
}));
|
|
28
|
+
return l === "axis" ? u.xAxisField = p : l === "funnel" ? (u.labelField = p.filter(({ name: e }) => d.rows.every((t) => r(t[e]))), u.valueField = p.filter(({ name: e }) => d.rows.every((t) => n(t[e])))) : (u.labelField = p, u.valueField = p.filter(({ name: e, kind: t }) => t === "number" && d.rows.every((t) => t[e] == null || typeof t[e] == "number" && Number.isFinite(t[e])))), u;
|
|
29
|
+
}
|
|
30
|
+
export { c as chartMappingFields };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ChartData } from './types';
|
|
2
|
+
export declare const isFunnelCount: (value: unknown) => boolean;
|
|
3
|
+
export declare const isFunnelStageLabel: (value: unknown) => boolean;
|
|
2
4
|
/** Keep the caller's stage order; conversions compare adjacent stages. */
|
|
3
5
|
export declare function funnelStages(data: ChartData[], valueField: string, labelField: string): {
|
|
4
6
|
row: ChartData;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
// src/bigconsole/components/widgets/chart/charts/funnelData.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}) ? null : e.map((r, i) => {
|
|
7
|
-
let a = r[t], o = e[Math.max(0, i - 1)][t];
|
|
2
|
+
var e = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, t = (e) => (typeof e == "string" || typeof e == "number") && String(e).trim() !== "";
|
|
3
|
+
function n(n, r, i) {
|
|
4
|
+
return !Array.isArray(n) || n.some((n) => !e(n?.[r]) || !t(n?.[i])) ? null : n.map((e, t) => {
|
|
5
|
+
let a = e[r], o = n[Math.max(0, t - 1)][r];
|
|
8
6
|
return {
|
|
9
|
-
row:
|
|
7
|
+
row: e,
|
|
10
8
|
value: a,
|
|
11
|
-
label: String(
|
|
9
|
+
label: String(e[i]),
|
|
12
10
|
conversion: o > 0 ? a / o : void 0
|
|
13
11
|
};
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
|
-
var
|
|
14
|
+
var r = /rate|percent|pct|ratio|conversion/i;
|
|
17
15
|
function i(e, t, n) {
|
|
18
16
|
return !!t && e.length > 0 && e.every((e) => n(e?.[t]));
|
|
19
17
|
}
|
|
20
|
-
function a(
|
|
21
|
-
let o =
|
|
18
|
+
function a(n, a = {}) {
|
|
19
|
+
let o = n.length > 0 ? Object.keys(n[0] ?? {}) : [], s = [a.valueField, "value"].find((t) => i(n, t, e)) ?? o.find((t) => !r.test(t) && i(n, t, e)) ?? a.valueField ?? "value";
|
|
22
20
|
return {
|
|
23
21
|
valueField: s,
|
|
24
|
-
labelField: [a.labelField, "name"].find((
|
|
22
|
+
labelField: [a.labelField, "name"].find((e) => i(n, e, t)) ?? o.find((e) => e !== s && i(n, e, (e) => typeof e == "string" && e.trim() !== "")) ?? a.labelField ?? "name"
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
|
-
export { a as funnelFields,
|
|
25
|
+
export { a as funnelFields, n as funnelStages, e as isFunnelCount, t as isFunnelStageLabel };
|