dp-widgets-framework 1.0.9 → 1.1.1
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/index.esm.js +144 -36
- package/dist/index.js +144 -36
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -15049,7 +15049,14 @@ const Bar = /* #__PURE__ */ createTypedChart('bar', BarController);
|
|
|
15049
15049
|
const Pie = /* #__PURE__ */ createTypedChart('pie', PieController);
|
|
15050
15050
|
|
|
15051
15051
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15052
|
-
function BarChart({ orientation, title, data, options, className }) {
|
|
15052
|
+
function BarChart({ orientation, title, data, options, className, units }) {
|
|
15053
|
+
const formatValue = (value) => {
|
|
15054
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15055
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15056
|
+
return numValue.toLocaleString();
|
|
15057
|
+
}
|
|
15058
|
+
return value;
|
|
15059
|
+
};
|
|
15053
15060
|
const defaultOptions = {
|
|
15054
15061
|
responsive: true,
|
|
15055
15062
|
maintainAspectRatio: false,
|
|
@@ -15080,6 +15087,14 @@ function BarChart({ orientation, title, data, options, className }) {
|
|
|
15080
15087
|
},
|
|
15081
15088
|
color: "#0F172A"
|
|
15082
15089
|
},
|
|
15090
|
+
tooltip: {
|
|
15091
|
+
callbacks: {
|
|
15092
|
+
label: function (context) {
|
|
15093
|
+
const value = context.parsed.y || context.parsed.x;
|
|
15094
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15095
|
+
}
|
|
15096
|
+
}
|
|
15097
|
+
},
|
|
15083
15098
|
},
|
|
15084
15099
|
scales: {
|
|
15085
15100
|
x: {
|
|
@@ -15092,14 +15107,28 @@ function BarChart({ orientation, title, data, options, className }) {
|
|
|
15092
15107
|
}
|
|
15093
15108
|
},
|
|
15094
15109
|
},
|
|
15095
|
-
y: {
|
|
15110
|
+
y: {
|
|
15111
|
+
beginAtZero: true,
|
|
15112
|
+
ticks: {
|
|
15113
|
+
callback: function (value) {
|
|
15114
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15115
|
+
}
|
|
15116
|
+
}
|
|
15117
|
+
},
|
|
15096
15118
|
},
|
|
15097
15119
|
};
|
|
15098
15120
|
return (jsxRuntimeExports.jsx(Bar, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
15099
15121
|
}
|
|
15100
15122
|
|
|
15101
15123
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15102
|
-
function SeriesChart({ orientation, title, data, options, className }) {
|
|
15124
|
+
function SeriesChart({ orientation, title, data, options, className, units }) {
|
|
15125
|
+
const formatValue = (value) => {
|
|
15126
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15127
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15128
|
+
return numValue.toLocaleString();
|
|
15129
|
+
}
|
|
15130
|
+
return value;
|
|
15131
|
+
};
|
|
15103
15132
|
const defaultOptions = {
|
|
15104
15133
|
responsive: true,
|
|
15105
15134
|
maintainAspectRatio: false,
|
|
@@ -15130,19 +15159,41 @@ function SeriesChart({ orientation, title, data, options, className }) {
|
|
|
15130
15159
|
},
|
|
15131
15160
|
color: "#0F172A"
|
|
15132
15161
|
},
|
|
15162
|
+
tooltip: {
|
|
15163
|
+
callbacks: {
|
|
15164
|
+
label: function (context) {
|
|
15165
|
+
const value = context.parsed.y || context.parsed.x;
|
|
15166
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15167
|
+
}
|
|
15168
|
+
}
|
|
15169
|
+
},
|
|
15133
15170
|
},
|
|
15134
15171
|
scales: {
|
|
15135
15172
|
x: {
|
|
15136
|
-
ticks: { autoSkip:
|
|
15173
|
+
ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 },
|
|
15174
|
+
},
|
|
15175
|
+
y: {
|
|
15176
|
+
beginAtZero: true,
|
|
15177
|
+
ticks: {
|
|
15178
|
+
callback: function (value) {
|
|
15179
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15137
15182
|
},
|
|
15138
|
-
y: { beginAtZero: true },
|
|
15139
15183
|
},
|
|
15140
15184
|
};
|
|
15141
15185
|
return (jsxRuntimeExports.jsx(Bar, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
15142
15186
|
}
|
|
15143
15187
|
|
|
15144
15188
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15145
|
-
function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
15189
|
+
function SeriesLineChart({ orientation, title, data, options, className, units }) {
|
|
15190
|
+
const formatValue = (value) => {
|
|
15191
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15192
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15193
|
+
return numValue.toLocaleString();
|
|
15194
|
+
}
|
|
15195
|
+
return value;
|
|
15196
|
+
};
|
|
15146
15197
|
const defaultOptions = {
|
|
15147
15198
|
responsive: true,
|
|
15148
15199
|
maintainAspectRatio: false,
|
|
@@ -15172,12 +15223,27 @@ function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
|
15172
15223
|
},
|
|
15173
15224
|
color: "#0F172A"
|
|
15174
15225
|
},
|
|
15226
|
+
tooltip: {
|
|
15227
|
+
callbacks: {
|
|
15228
|
+
label: function (context) {
|
|
15229
|
+
const value = context.parsed.y;
|
|
15230
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15231
|
+
}
|
|
15232
|
+
}
|
|
15233
|
+
},
|
|
15175
15234
|
},
|
|
15176
15235
|
scales: {
|
|
15177
15236
|
x: {
|
|
15178
15237
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15179
15238
|
},
|
|
15180
|
-
y: {
|
|
15239
|
+
y: {
|
|
15240
|
+
beginAtZero: true,
|
|
15241
|
+
ticks: {
|
|
15242
|
+
callback: function (value) {
|
|
15243
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15244
|
+
}
|
|
15245
|
+
}
|
|
15246
|
+
},
|
|
15181
15247
|
},
|
|
15182
15248
|
elements: {
|
|
15183
15249
|
line: {
|
|
@@ -15193,7 +15259,14 @@ function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
|
15193
15259
|
|
|
15194
15260
|
Chart$1.register(ArcElement, plugin_tooltip, plugin_legend);
|
|
15195
15261
|
const PieChart = (props) => {
|
|
15196
|
-
const { data, title, options } = props;
|
|
15262
|
+
const { data, title, options, units } = props;
|
|
15263
|
+
const formatValue = (value) => {
|
|
15264
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15265
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15266
|
+
return numValue.toLocaleString();
|
|
15267
|
+
}
|
|
15268
|
+
return value;
|
|
15269
|
+
};
|
|
15197
15270
|
const defaultOptions = {
|
|
15198
15271
|
responsive: true,
|
|
15199
15272
|
maintainAspectRatio: false,
|
|
@@ -15214,6 +15287,14 @@ const PieChart = (props) => {
|
|
|
15214
15287
|
},
|
|
15215
15288
|
color: "#0F172A",
|
|
15216
15289
|
},
|
|
15290
|
+
tooltip: {
|
|
15291
|
+
callbacks: {
|
|
15292
|
+
label: function (context) {
|
|
15293
|
+
const value = context.parsed;
|
|
15294
|
+
return units ? `${context.label}: ${formatValue(value)} ${units}` : `${context.label}: ${value}`;
|
|
15295
|
+
}
|
|
15296
|
+
}
|
|
15297
|
+
},
|
|
15217
15298
|
},
|
|
15218
15299
|
layout: {
|
|
15219
15300
|
padding: {
|
|
@@ -15228,7 +15309,14 @@ const PieChart = (props) => {
|
|
|
15228
15309
|
};
|
|
15229
15310
|
|
|
15230
15311
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15231
|
-
function LineChart({ title, data, options, className }) {
|
|
15312
|
+
function LineChart({ title, data, options, className, units }) {
|
|
15313
|
+
const formatValue = (value) => {
|
|
15314
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15315
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15316
|
+
return numValue.toLocaleString();
|
|
15317
|
+
}
|
|
15318
|
+
return value;
|
|
15319
|
+
};
|
|
15232
15320
|
const defaultOptions = {
|
|
15233
15321
|
responsive: true,
|
|
15234
15322
|
maintainAspectRatio: false,
|
|
@@ -15258,12 +15346,27 @@ function LineChart({ title, data, options, className }) {
|
|
|
15258
15346
|
},
|
|
15259
15347
|
color: "#0F172A"
|
|
15260
15348
|
},
|
|
15349
|
+
tooltip: {
|
|
15350
|
+
callbacks: {
|
|
15351
|
+
label: function (context) {
|
|
15352
|
+
const value = context.parsed.y;
|
|
15353
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15354
|
+
}
|
|
15355
|
+
}
|
|
15356
|
+
},
|
|
15261
15357
|
},
|
|
15262
15358
|
scales: {
|
|
15263
15359
|
x: {
|
|
15264
15360
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15265
15361
|
},
|
|
15266
|
-
y: {
|
|
15362
|
+
y: {
|
|
15363
|
+
beginAtZero: true,
|
|
15364
|
+
ticks: {
|
|
15365
|
+
callback: function (value) {
|
|
15366
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15367
|
+
}
|
|
15368
|
+
}
|
|
15369
|
+
},
|
|
15267
15370
|
},
|
|
15268
15371
|
};
|
|
15269
15372
|
return (jsxRuntimeExports.jsx(Line, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
@@ -36116,11 +36219,12 @@ const getStyleValues = (styles = {}) => {
|
|
|
36116
36219
|
};
|
|
36117
36220
|
};
|
|
36118
36221
|
function BarChartComponent({ orientation, barChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36119
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36120
36223
|
const hasCalledRef = useRef(false);
|
|
36121
36224
|
const labels = ((_b = (_a = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36122
36225
|
const values = ((_g = (_f = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36123
36226
|
const chartTitle = ((_l = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36227
|
+
const units = ((_p = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _q === void 0 ? void 0 : _q.bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36124
36228
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36125
36229
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36126
36230
|
const handleRefresh = async () => {
|
|
@@ -36164,14 +36268,15 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36164
36268
|
},
|
|
36165
36269
|
],
|
|
36166
36270
|
};
|
|
36167
|
-
return (jsxRuntimeExports.jsx(BarChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36271
|
+
return (jsxRuntimeExports.jsx(BarChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36168
36272
|
}
|
|
36169
36273
|
function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36170
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36274
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36171
36275
|
const hasCalledRef = useRef(false);
|
|
36172
36276
|
const labels = ((_b = (_a = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36173
36277
|
const series = ((_g = (_f = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36174
36278
|
const chartTitle = ((_l = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36279
|
+
const units = ((_p = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _q === void 0 ? void 0 : _q.series_bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36175
36280
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36176
36281
|
const handleRefresh = async () => {
|
|
36177
36282
|
if (query) {
|
|
@@ -36214,14 +36319,15 @@ function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, app
|
|
|
36214
36319
|
backgroundColor: seriesItem.color || finalColors[index % finalColors.length],
|
|
36215
36320
|
})),
|
|
36216
36321
|
};
|
|
36217
|
-
return (jsxRuntimeExports.jsx(SeriesChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36322
|
+
return (jsxRuntimeExports.jsx(SeriesChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36218
36323
|
}
|
|
36219
36324
|
function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36220
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36221
36326
|
const hasCalledRef = useRef(false);
|
|
36222
36327
|
const labels = ((_b = (_a = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36223
36328
|
const series = ((_g = (_f = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36224
36329
|
const chartTitle = ((_l = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36330
|
+
const units = ((_p = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _q === void 0 ? void 0 : _q.series_bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36225
36331
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36226
36332
|
const handleRefresh = async () => {
|
|
36227
36333
|
if (query) {
|
|
@@ -36271,15 +36377,16 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36271
36377
|
tension: 0.1,
|
|
36272
36378
|
})),
|
|
36273
36379
|
};
|
|
36274
|
-
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36380
|
+
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36275
36381
|
}
|
|
36276
36382
|
function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36277
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
36383
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
36278
36384
|
const hasCalledRef = useRef(false);
|
|
36279
36385
|
const labels = ((_b = (_a = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _c === void 0 ? void 0 : _c.pie_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36280
36386
|
const values = ((_g = (_f = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _h === void 0 ? void 0 : _h.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36281
36387
|
((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.percentages) || ((_q = (_p = (_o = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _o === void 0 ? void 0 : _o.pie_chart_data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.percentages) || [];
|
|
36282
36388
|
const chartTitle = ((_r = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _r === void 0 ? void 0 : _r.title) || ((_t = (_s = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _s === void 0 ? void 0 : _s.pie_chart_data) === null || _t === void 0 ? void 0 : _t.title) || "";
|
|
36389
|
+
const units = ((_u = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _u === void 0 ? void 0 : _u.units) || ((_w = (_v = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _v === void 0 ? void 0 : _v.pie_chart_data) === null || _w === void 0 ? void 0 : _w.units) || "";
|
|
36283
36390
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36284
36391
|
const handleRefresh = async () => {
|
|
36285
36392
|
if (query) {
|
|
@@ -36325,14 +36432,15 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36325
36432
|
},
|
|
36326
36433
|
],
|
|
36327
36434
|
};
|
|
36328
|
-
return (jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData }));
|
|
36435
|
+
return (jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units: units }));
|
|
36329
36436
|
}
|
|
36330
36437
|
function LineChartComponent({ lineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36331
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36438
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36332
36439
|
const hasCalledRef = useRef(false);
|
|
36333
36440
|
const labels = ((_b = (_a = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36334
36441
|
const values = ((_g = (_f = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36335
36442
|
const chartTitle = ((_l = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36443
|
+
const units = ((_p = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _q === void 0 ? void 0 : _q.bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36336
36444
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36337
36445
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36338
36446
|
const handleRefresh = async () => {
|
|
@@ -36381,7 +36489,7 @@ function LineChartComponent({ lineChartState, styles, appendMessage, query, isFi
|
|
|
36381
36489
|
},
|
|
36382
36490
|
],
|
|
36383
36491
|
};
|
|
36384
|
-
return (jsxRuntimeExports.jsx(LineChart, { title: chartTitle, data: transformedData }));
|
|
36492
|
+
return (jsxRuntimeExports.jsx(LineChart, { title: chartTitle, data: transformedData, units: units }));
|
|
36385
36493
|
}
|
|
36386
36494
|
function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36387
36495
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
@@ -36687,34 +36795,34 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
36687
36795
|
const [query, setQuery] = useState('');
|
|
36688
36796
|
const [showConfigStep, setShowConfigStep] = useState(false);
|
|
36689
36797
|
const widgetOptions = [
|
|
36690
|
-
{
|
|
36691
|
-
|
|
36692
|
-
|
|
36693
|
-
|
|
36694
|
-
|
|
36695
|
-
|
|
36696
|
-
},
|
|
36798
|
+
// {
|
|
36799
|
+
// type: 'bar-chart',
|
|
36800
|
+
// title: 'Bar Chart Widget',
|
|
36801
|
+
// icon: BarChart,
|
|
36802
|
+
// description: 'Create interactive bar charts with custom queries',
|
|
36803
|
+
// configRequired: true
|
|
36804
|
+
// },
|
|
36697
36805
|
{
|
|
36698
36806
|
type: 'series-bar-chart',
|
|
36699
|
-
title: '
|
|
36807
|
+
title: 'Bar Chart Widget',
|
|
36700
36808
|
icon: BarChart$1,
|
|
36701
36809
|
description: 'Create interactive series bar charts with custom queries',
|
|
36702
36810
|
configRequired: true
|
|
36703
36811
|
},
|
|
36704
36812
|
{
|
|
36705
36813
|
type: 'series-line-chart',
|
|
36706
|
-
title: 'Series Line Chart Widget',
|
|
36707
|
-
icon: LineChart$1,
|
|
36708
|
-
description: 'Create interactive series line charts with custom queries',
|
|
36709
|
-
configRequired: true
|
|
36710
|
-
},
|
|
36711
|
-
{
|
|
36712
|
-
type: 'line-chart',
|
|
36713
36814
|
title: 'Line Chart Widget',
|
|
36714
36815
|
icon: LineChart$1,
|
|
36715
|
-
description: 'Create interactive line charts with custom queries',
|
|
36816
|
+
description: 'Create interactive series line charts with custom queries',
|
|
36716
36817
|
configRequired: true
|
|
36717
36818
|
},
|
|
36819
|
+
// {
|
|
36820
|
+
// type: 'line-chart',
|
|
36821
|
+
// title: 'Line Chart Widget',
|
|
36822
|
+
// icon: LineChart,
|
|
36823
|
+
// description: 'Create interactive line charts with custom queries',
|
|
36824
|
+
// configRequired: true
|
|
36825
|
+
// },
|
|
36718
36826
|
{
|
|
36719
36827
|
type: 'pie-chart',
|
|
36720
36828
|
title: 'Pie Chart Widget',
|
package/dist/index.js
CHANGED
|
@@ -15076,7 +15076,14 @@ const Bar = /* #__PURE__ */ createTypedChart('bar', BarController);
|
|
|
15076
15076
|
const Pie = /* #__PURE__ */ createTypedChart('pie', PieController);
|
|
15077
15077
|
|
|
15078
15078
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15079
|
-
function BarChart({ orientation, title, data, options, className }) {
|
|
15079
|
+
function BarChart({ orientation, title, data, options, className, units }) {
|
|
15080
|
+
const formatValue = (value) => {
|
|
15081
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15082
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15083
|
+
return numValue.toLocaleString();
|
|
15084
|
+
}
|
|
15085
|
+
return value;
|
|
15086
|
+
};
|
|
15080
15087
|
const defaultOptions = {
|
|
15081
15088
|
responsive: true,
|
|
15082
15089
|
maintainAspectRatio: false,
|
|
@@ -15107,6 +15114,14 @@ function BarChart({ orientation, title, data, options, className }) {
|
|
|
15107
15114
|
},
|
|
15108
15115
|
color: "#0F172A"
|
|
15109
15116
|
},
|
|
15117
|
+
tooltip: {
|
|
15118
|
+
callbacks: {
|
|
15119
|
+
label: function (context) {
|
|
15120
|
+
const value = context.parsed.y || context.parsed.x;
|
|
15121
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15122
|
+
}
|
|
15123
|
+
}
|
|
15124
|
+
},
|
|
15110
15125
|
},
|
|
15111
15126
|
scales: {
|
|
15112
15127
|
x: {
|
|
@@ -15119,14 +15134,28 @@ function BarChart({ orientation, title, data, options, className }) {
|
|
|
15119
15134
|
}
|
|
15120
15135
|
},
|
|
15121
15136
|
},
|
|
15122
|
-
y: {
|
|
15137
|
+
y: {
|
|
15138
|
+
beginAtZero: true,
|
|
15139
|
+
ticks: {
|
|
15140
|
+
callback: function (value) {
|
|
15141
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
15144
|
+
},
|
|
15123
15145
|
},
|
|
15124
15146
|
};
|
|
15125
15147
|
return (jsxRuntimeExports.jsx(Bar, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
15126
15148
|
}
|
|
15127
15149
|
|
|
15128
15150
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15129
|
-
function SeriesChart({ orientation, title, data, options, className }) {
|
|
15151
|
+
function SeriesChart({ orientation, title, data, options, className, units }) {
|
|
15152
|
+
const formatValue = (value) => {
|
|
15153
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15154
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15155
|
+
return numValue.toLocaleString();
|
|
15156
|
+
}
|
|
15157
|
+
return value;
|
|
15158
|
+
};
|
|
15130
15159
|
const defaultOptions = {
|
|
15131
15160
|
responsive: true,
|
|
15132
15161
|
maintainAspectRatio: false,
|
|
@@ -15157,19 +15186,41 @@ function SeriesChart({ orientation, title, data, options, className }) {
|
|
|
15157
15186
|
},
|
|
15158
15187
|
color: "#0F172A"
|
|
15159
15188
|
},
|
|
15189
|
+
tooltip: {
|
|
15190
|
+
callbacks: {
|
|
15191
|
+
label: function (context) {
|
|
15192
|
+
const value = context.parsed.y || context.parsed.x;
|
|
15193
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15194
|
+
}
|
|
15195
|
+
}
|
|
15196
|
+
},
|
|
15160
15197
|
},
|
|
15161
15198
|
scales: {
|
|
15162
15199
|
x: {
|
|
15163
|
-
ticks: { autoSkip:
|
|
15200
|
+
ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 },
|
|
15201
|
+
},
|
|
15202
|
+
y: {
|
|
15203
|
+
beginAtZero: true,
|
|
15204
|
+
ticks: {
|
|
15205
|
+
callback: function (value) {
|
|
15206
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15207
|
+
}
|
|
15208
|
+
}
|
|
15164
15209
|
},
|
|
15165
|
-
y: { beginAtZero: true },
|
|
15166
15210
|
},
|
|
15167
15211
|
};
|
|
15168
15212
|
return (jsxRuntimeExports.jsx(Bar, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
15169
15213
|
}
|
|
15170
15214
|
|
|
15171
15215
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15172
|
-
function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
15216
|
+
function SeriesLineChart({ orientation, title, data, options, className, units }) {
|
|
15217
|
+
const formatValue = (value) => {
|
|
15218
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15219
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15220
|
+
return numValue.toLocaleString();
|
|
15221
|
+
}
|
|
15222
|
+
return value;
|
|
15223
|
+
};
|
|
15173
15224
|
const defaultOptions = {
|
|
15174
15225
|
responsive: true,
|
|
15175
15226
|
maintainAspectRatio: false,
|
|
@@ -15199,12 +15250,27 @@ function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
|
15199
15250
|
},
|
|
15200
15251
|
color: "#0F172A"
|
|
15201
15252
|
},
|
|
15253
|
+
tooltip: {
|
|
15254
|
+
callbacks: {
|
|
15255
|
+
label: function (context) {
|
|
15256
|
+
const value = context.parsed.y;
|
|
15257
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15258
|
+
}
|
|
15259
|
+
}
|
|
15260
|
+
},
|
|
15202
15261
|
},
|
|
15203
15262
|
scales: {
|
|
15204
15263
|
x: {
|
|
15205
15264
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15206
15265
|
},
|
|
15207
|
-
y: {
|
|
15266
|
+
y: {
|
|
15267
|
+
beginAtZero: true,
|
|
15268
|
+
ticks: {
|
|
15269
|
+
callback: function (value) {
|
|
15270
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15271
|
+
}
|
|
15272
|
+
}
|
|
15273
|
+
},
|
|
15208
15274
|
},
|
|
15209
15275
|
elements: {
|
|
15210
15276
|
line: {
|
|
@@ -15220,7 +15286,14 @@ function SeriesLineChart({ orientation, title, data, options, className }) {
|
|
|
15220
15286
|
|
|
15221
15287
|
Chart$1.register(ArcElement, plugin_tooltip, plugin_legend);
|
|
15222
15288
|
const PieChart = (props) => {
|
|
15223
|
-
const { data, title, options } = props;
|
|
15289
|
+
const { data, title, options, units } = props;
|
|
15290
|
+
const formatValue = (value) => {
|
|
15291
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15292
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15293
|
+
return numValue.toLocaleString();
|
|
15294
|
+
}
|
|
15295
|
+
return value;
|
|
15296
|
+
};
|
|
15224
15297
|
const defaultOptions = {
|
|
15225
15298
|
responsive: true,
|
|
15226
15299
|
maintainAspectRatio: false,
|
|
@@ -15241,6 +15314,14 @@ const PieChart = (props) => {
|
|
|
15241
15314
|
},
|
|
15242
15315
|
color: "#0F172A",
|
|
15243
15316
|
},
|
|
15317
|
+
tooltip: {
|
|
15318
|
+
callbacks: {
|
|
15319
|
+
label: function (context) {
|
|
15320
|
+
const value = context.parsed;
|
|
15321
|
+
return units ? `${context.label}: ${formatValue(value)} ${units}` : `${context.label}: ${value}`;
|
|
15322
|
+
}
|
|
15323
|
+
}
|
|
15324
|
+
},
|
|
15244
15325
|
},
|
|
15245
15326
|
layout: {
|
|
15246
15327
|
padding: {
|
|
@@ -15255,7 +15336,14 @@ const PieChart = (props) => {
|
|
|
15255
15336
|
};
|
|
15256
15337
|
|
|
15257
15338
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15258
|
-
function LineChart({ title, data, options, className }) {
|
|
15339
|
+
function LineChart({ title, data, options, className, units }) {
|
|
15340
|
+
const formatValue = (value) => {
|
|
15341
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15342
|
+
if (units === '$' && !isNaN(numValue)) {
|
|
15343
|
+
return numValue.toLocaleString();
|
|
15344
|
+
}
|
|
15345
|
+
return value;
|
|
15346
|
+
};
|
|
15259
15347
|
const defaultOptions = {
|
|
15260
15348
|
responsive: true,
|
|
15261
15349
|
maintainAspectRatio: false,
|
|
@@ -15285,12 +15373,27 @@ function LineChart({ title, data, options, className }) {
|
|
|
15285
15373
|
},
|
|
15286
15374
|
color: "#0F172A"
|
|
15287
15375
|
},
|
|
15376
|
+
tooltip: {
|
|
15377
|
+
callbacks: {
|
|
15378
|
+
label: function (context) {
|
|
15379
|
+
const value = context.parsed.y;
|
|
15380
|
+
return units ? `${context.dataset.label}: ${formatValue(value)} ${units}` : `${context.dataset.label}: ${value}`;
|
|
15381
|
+
}
|
|
15382
|
+
}
|
|
15383
|
+
},
|
|
15288
15384
|
},
|
|
15289
15385
|
scales: {
|
|
15290
15386
|
x: {
|
|
15291
15387
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15292
15388
|
},
|
|
15293
|
-
y: {
|
|
15389
|
+
y: {
|
|
15390
|
+
beginAtZero: true,
|
|
15391
|
+
ticks: {
|
|
15392
|
+
callback: function (value) {
|
|
15393
|
+
return units ? `${formatValue(value)} ${units}` : value;
|
|
15394
|
+
}
|
|
15395
|
+
}
|
|
15396
|
+
},
|
|
15294
15397
|
},
|
|
15295
15398
|
};
|
|
15296
15399
|
return (jsxRuntimeExports.jsx(Line, { data: data, options: options !== null && options !== void 0 ? options : defaultOptions }));
|
|
@@ -36143,11 +36246,12 @@ const getStyleValues = (styles = {}) => {
|
|
|
36143
36246
|
};
|
|
36144
36247
|
};
|
|
36145
36248
|
function BarChartComponent({ orientation, barChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36146
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36249
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36147
36250
|
const hasCalledRef = React.useRef(false);
|
|
36148
36251
|
const labels = ((_b = (_a = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36149
36252
|
const values = ((_g = (_f = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36150
36253
|
const chartTitle = ((_l = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36254
|
+
const units = ((_p = barChartState === null || barChartState === void 0 ? void 0 : barChartState.bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = barChartState === null || barChartState === void 0 ? void 0 : barChartState.state) === null || _q === void 0 ? void 0 : _q.bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36151
36255
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36152
36256
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36153
36257
|
const handleRefresh = async () => {
|
|
@@ -36191,14 +36295,15 @@ function BarChartComponent({ orientation, barChartState, styles, appendMessage,
|
|
|
36191
36295
|
},
|
|
36192
36296
|
],
|
|
36193
36297
|
};
|
|
36194
|
-
return (jsxRuntimeExports.jsx(BarChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36298
|
+
return (jsxRuntimeExports.jsx(BarChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36195
36299
|
}
|
|
36196
36300
|
function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36197
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36301
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36198
36302
|
const hasCalledRef = React.useRef(false);
|
|
36199
36303
|
const labels = ((_b = (_a = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36200
36304
|
const series = ((_g = (_f = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36201
36305
|
const chartTitle = ((_l = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36306
|
+
const units = ((_p = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.series_bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = seriesBarChartState === null || seriesBarChartState === void 0 ? void 0 : seriesBarChartState.state) === null || _q === void 0 ? void 0 : _q.series_bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36202
36307
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36203
36308
|
const handleRefresh = async () => {
|
|
36204
36309
|
if (query) {
|
|
@@ -36241,14 +36346,15 @@ function SeriesBarChartComponent({ orientation, seriesBarChartState, styles, app
|
|
|
36241
36346
|
backgroundColor: seriesItem.color || finalColors[index % finalColors.length],
|
|
36242
36347
|
})),
|
|
36243
36348
|
};
|
|
36244
|
-
return (jsxRuntimeExports.jsx(SeriesChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36349
|
+
return (jsxRuntimeExports.jsx(SeriesChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36245
36350
|
}
|
|
36246
36351
|
function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36247
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36352
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36248
36353
|
const hasCalledRef = React.useRef(false);
|
|
36249
36354
|
const labels = ((_b = (_a = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _c === void 0 ? void 0 : _c.series_bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36250
36355
|
const series = ((_g = (_f = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.series) || ((_k = (_j = (_h = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _h === void 0 ? void 0 : _h.series_bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.series) || [];
|
|
36251
36356
|
const chartTitle = ((_l = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _m === void 0 ? void 0 : _m.series_bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36357
|
+
const units = ((_p = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.series_bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = seriesLineChartState === null || seriesLineChartState === void 0 ? void 0 : seriesLineChartState.state) === null || _q === void 0 ? void 0 : _q.series_bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36252
36358
|
const isEmpty = labels.length === 0 || series.length === 0;
|
|
36253
36359
|
const handleRefresh = async () => {
|
|
36254
36360
|
if (query) {
|
|
@@ -36298,15 +36404,16 @@ function SeriesLineChartComponent({ orientation, seriesLineChartState, styles, a
|
|
|
36298
36404
|
tension: 0.1,
|
|
36299
36405
|
})),
|
|
36300
36406
|
};
|
|
36301
|
-
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData }));
|
|
36407
|
+
return (jsxRuntimeExports.jsx(SeriesLineChart, { orientation: orientation, title: chartTitle, data: transformedData, units: units }));
|
|
36302
36408
|
}
|
|
36303
36409
|
function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36304
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
36410
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
36305
36411
|
const hasCalledRef = React.useRef(false);
|
|
36306
36412
|
const labels = ((_b = (_a = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _c === void 0 ? void 0 : _c.pie_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36307
36413
|
const values = ((_g = (_f = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _h === void 0 ? void 0 : _h.pie_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36308
36414
|
((_m = (_l = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.percentages) || ((_q = (_p = (_o = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _o === void 0 ? void 0 : _o.pie_chart_data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.percentages) || [];
|
|
36309
36415
|
const chartTitle = ((_r = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _r === void 0 ? void 0 : _r.title) || ((_t = (_s = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _s === void 0 ? void 0 : _s.pie_chart_data) === null || _t === void 0 ? void 0 : _t.title) || "";
|
|
36416
|
+
const units = ((_u = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.pie_chart_data) === null || _u === void 0 ? void 0 : _u.units) || ((_w = (_v = pieChartState === null || pieChartState === void 0 ? void 0 : pieChartState.state) === null || _v === void 0 ? void 0 : _v.pie_chart_data) === null || _w === void 0 ? void 0 : _w.units) || "";
|
|
36310
36417
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36311
36418
|
const handleRefresh = async () => {
|
|
36312
36419
|
if (query) {
|
|
@@ -36352,14 +36459,15 @@ function PieChartComponent({ pieChartState, styles, appendMessage, query, isFirs
|
|
|
36352
36459
|
},
|
|
36353
36460
|
],
|
|
36354
36461
|
};
|
|
36355
|
-
return (jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData }));
|
|
36462
|
+
return (jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units: units }));
|
|
36356
36463
|
}
|
|
36357
36464
|
function LineChartComponent({ lineChartState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36358
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
36465
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
36359
36466
|
const hasCalledRef = React.useRef(false);
|
|
36360
36467
|
const labels = ((_b = (_a = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.labels) || ((_e = (_d = (_c = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _c === void 0 ? void 0 : _c.bar_chart_data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.labels) || [];
|
|
36361
36468
|
const values = ((_g = (_f = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.values) || ((_k = (_j = (_h = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _h === void 0 ? void 0 : _h.bar_chart_data) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.values) || [];
|
|
36362
36469
|
const chartTitle = ((_l = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _l === void 0 ? void 0 : _l.title) || ((_o = (_m = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _m === void 0 ? void 0 : _m.bar_chart_data) === null || _o === void 0 ? void 0 : _o.title) || "";
|
|
36470
|
+
const units = ((_p = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.bar_chart_data) === null || _p === void 0 ? void 0 : _p.units) || ((_r = (_q = lineChartState === null || lineChartState === void 0 ? void 0 : lineChartState.state) === null || _q === void 0 ? void 0 : _q.bar_chart_data) === null || _r === void 0 ? void 0 : _r.units) || "";
|
|
36363
36471
|
values.length > 0 ? Math.max(...values) : 0;
|
|
36364
36472
|
const isEmpty = labels.length === 0 || values.length === 0;
|
|
36365
36473
|
const handleRefresh = async () => {
|
|
@@ -36408,7 +36516,7 @@ function LineChartComponent({ lineChartState, styles, appendMessage, query, isFi
|
|
|
36408
36516
|
},
|
|
36409
36517
|
],
|
|
36410
36518
|
};
|
|
36411
|
-
return (jsxRuntimeExports.jsx(LineChart, { title: chartTitle, data: transformedData }));
|
|
36519
|
+
return (jsxRuntimeExports.jsx(LineChart, { title: chartTitle, data: transformedData, units: units }));
|
|
36412
36520
|
}
|
|
36413
36521
|
function DataGridComponent({ dataGridState, styles, appendMessage, query, isFirstLoad, widgetBackendUrl, widgetId, startLoadingTimeout, clearLoadingTimeout }) {
|
|
36414
36522
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
@@ -36714,34 +36822,34 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
36714
36822
|
const [query, setQuery] = React.useState('');
|
|
36715
36823
|
const [showConfigStep, setShowConfigStep] = React.useState(false);
|
|
36716
36824
|
const widgetOptions = [
|
|
36717
|
-
{
|
|
36718
|
-
|
|
36719
|
-
|
|
36720
|
-
|
|
36721
|
-
|
|
36722
|
-
|
|
36723
|
-
},
|
|
36825
|
+
// {
|
|
36826
|
+
// type: 'bar-chart',
|
|
36827
|
+
// title: 'Bar Chart Widget',
|
|
36828
|
+
// icon: BarChart,
|
|
36829
|
+
// description: 'Create interactive bar charts with custom queries',
|
|
36830
|
+
// configRequired: true
|
|
36831
|
+
// },
|
|
36724
36832
|
{
|
|
36725
36833
|
type: 'series-bar-chart',
|
|
36726
|
-
title: '
|
|
36834
|
+
title: 'Bar Chart Widget',
|
|
36727
36835
|
icon: lucideReact.BarChart,
|
|
36728
36836
|
description: 'Create interactive series bar charts with custom queries',
|
|
36729
36837
|
configRequired: true
|
|
36730
36838
|
},
|
|
36731
36839
|
{
|
|
36732
36840
|
type: 'series-line-chart',
|
|
36733
|
-
title: 'Series Line Chart Widget',
|
|
36734
|
-
icon: lucideReact.LineChart,
|
|
36735
|
-
description: 'Create interactive series line charts with custom queries',
|
|
36736
|
-
configRequired: true
|
|
36737
|
-
},
|
|
36738
|
-
{
|
|
36739
|
-
type: 'line-chart',
|
|
36740
36841
|
title: 'Line Chart Widget',
|
|
36741
36842
|
icon: lucideReact.LineChart,
|
|
36742
|
-
description: 'Create interactive line charts with custom queries',
|
|
36843
|
+
description: 'Create interactive series line charts with custom queries',
|
|
36743
36844
|
configRequired: true
|
|
36744
36845
|
},
|
|
36846
|
+
// {
|
|
36847
|
+
// type: 'line-chart',
|
|
36848
|
+
// title: 'Line Chart Widget',
|
|
36849
|
+
// icon: LineChart,
|
|
36850
|
+
// description: 'Create interactive line charts with custom queries',
|
|
36851
|
+
// configRequired: true
|
|
36852
|
+
// },
|
|
36745
36853
|
{
|
|
36746
36854
|
type: 'pie-chart',
|
|
36747
36855
|
title: 'Pie Chart Widget',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dp-widgets-framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "https://github.com/aretec-inc/di-widgets-framework.git"
|
|
21
21
|
},
|
|
22
|
-
"author": "
|
|
22
|
+
"author": "Syed Fakher Uddin",
|
|
23
23
|
"files": [
|
|
24
24
|
"dist/*.esm.js",
|
|
25
25
|
"dist/*.js",
|