dp-widgets-framework 1.3.5 → 1.3.6
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 +43 -5
- package/dist/index.js +43 -5
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -15136,9 +15136,10 @@ function BarChart({ orientation, title, data, options, className, units, content
|
|
|
15136
15136
|
|
|
15137
15137
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15138
15138
|
function SeriesChart({ orientation, title, data, options, className, units, content }) {
|
|
15139
|
+
var _a, _b;
|
|
15139
15140
|
const formatValue = (value) => {
|
|
15140
15141
|
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15141
|
-
if (
|
|
15142
|
+
if (!isNaN(numValue)) {
|
|
15142
15143
|
return numValue.toLocaleString();
|
|
15143
15144
|
}
|
|
15144
15145
|
return value;
|
|
@@ -15163,6 +15164,14 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15163
15164
|
});
|
|
15164
15165
|
},
|
|
15165
15166
|
};
|
|
15167
|
+
const getAxisLabel = (symbol) => {
|
|
15168
|
+
const labelMap = {
|
|
15169
|
+
"%": "Percentage",
|
|
15170
|
+
"$": "Cost",
|
|
15171
|
+
"#": "Count",
|
|
15172
|
+
};
|
|
15173
|
+
return labelMap[symbol] || symbol; // fallback if not found
|
|
15174
|
+
};
|
|
15166
15175
|
const defaultOptions = {
|
|
15167
15176
|
responsive: true,
|
|
15168
15177
|
maintainAspectRatio: false,
|
|
@@ -15177,7 +15186,13 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15177
15186
|
},
|
|
15178
15187
|
plugins: {
|
|
15179
15188
|
legend: {
|
|
15180
|
-
display:
|
|
15189
|
+
display: (ctx) => {
|
|
15190
|
+
const chart = ctx.chart;
|
|
15191
|
+
const datasets = chart.data.datasets;
|
|
15192
|
+
if (datasets.length > 1)
|
|
15193
|
+
return true;
|
|
15194
|
+
return false;
|
|
15195
|
+
},
|
|
15181
15196
|
labels: {
|
|
15182
15197
|
boxWidth: 12,
|
|
15183
15198
|
boxHeight: 12,
|
|
@@ -15210,13 +15225,17 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15210
15225
|
ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 },
|
|
15211
15226
|
},
|
|
15212
15227
|
y: {
|
|
15228
|
+
title: {
|
|
15229
|
+
display: true,
|
|
15230
|
+
text: (data === null || data === void 0 ? void 0 : data.datasets) && ((_a = data === null || data === void 0 ? void 0 : data.datasets) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (_b = data === null || data === void 0 ? void 0 : data.datasets) === null || _b === void 0 ? void 0 : _b[0].label : getAxisLabel(units !== null && units !== void 0 ? units : ""),
|
|
15231
|
+
},
|
|
15213
15232
|
beginAtZero: true,
|
|
15214
15233
|
ticks: {
|
|
15215
15234
|
callback: function (value) {
|
|
15216
15235
|
if (units === '$') {
|
|
15217
15236
|
return `${units}${formatValue(value)}`;
|
|
15218
15237
|
}
|
|
15219
|
-
return units ? `${formatValue(value)} ${units}` : value;
|
|
15238
|
+
return units ? `${formatValue(value)} ${(units === null || units === void 0 ? void 0 : units.length) < 3 ? units : ""}` : value;
|
|
15220
15239
|
}
|
|
15221
15240
|
}
|
|
15222
15241
|
},
|
|
@@ -15227,13 +15246,22 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15227
15246
|
|
|
15228
15247
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15229
15248
|
function SeriesLineChart({ orientation, title, data, options, className, units, content }) {
|
|
15249
|
+
var _a, _b;
|
|
15230
15250
|
const formatValue = (value) => {
|
|
15231
15251
|
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15232
|
-
if (
|
|
15252
|
+
if (!isNaN(numValue)) {
|
|
15233
15253
|
return numValue.toLocaleString();
|
|
15234
15254
|
}
|
|
15235
15255
|
return value;
|
|
15236
15256
|
};
|
|
15257
|
+
const getAxisLabel = (symbol) => {
|
|
15258
|
+
const labelMap = {
|
|
15259
|
+
"%": "Percentage",
|
|
15260
|
+
"$": "Cost",
|
|
15261
|
+
"#": "Count",
|
|
15262
|
+
};
|
|
15263
|
+
return labelMap[symbol] || symbol; // fallback if not found
|
|
15264
|
+
};
|
|
15237
15265
|
const defaultOptions = {
|
|
15238
15266
|
responsive: true,
|
|
15239
15267
|
maintainAspectRatio: false,
|
|
@@ -15247,7 +15275,13 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
|
|
|
15247
15275
|
},
|
|
15248
15276
|
plugins: {
|
|
15249
15277
|
legend: {
|
|
15250
|
-
display:
|
|
15278
|
+
display: (ctx) => {
|
|
15279
|
+
const chart = ctx.chart;
|
|
15280
|
+
const datasets = chart.data.datasets;
|
|
15281
|
+
if (datasets.length > 1)
|
|
15282
|
+
return true;
|
|
15283
|
+
return false;
|
|
15284
|
+
},
|
|
15251
15285
|
labels: {
|
|
15252
15286
|
boxWidth: 12,
|
|
15253
15287
|
boxHeight: 12,
|
|
@@ -15290,6 +15324,10 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
|
|
|
15290
15324
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15291
15325
|
},
|
|
15292
15326
|
y: {
|
|
15327
|
+
title: {
|
|
15328
|
+
display: true,
|
|
15329
|
+
text: (data === null || data === void 0 ? void 0 : data.datasets) && ((_a = data === null || data === void 0 ? void 0 : data.datasets) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (_b = data === null || data === void 0 ? void 0 : data.datasets) === null || _b === void 0 ? void 0 : _b[0].label : getAxisLabel(units !== null && units !== void 0 ? units : ""),
|
|
15330
|
+
},
|
|
15293
15331
|
beginAtZero: true,
|
|
15294
15332
|
ticks: {
|
|
15295
15333
|
callback: function (value) {
|
package/dist/index.js
CHANGED
|
@@ -15163,9 +15163,10 @@ function BarChart({ orientation, title, data, options, className, units, content
|
|
|
15163
15163
|
|
|
15164
15164
|
Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15165
15165
|
function SeriesChart({ orientation, title, data, options, className, units, content }) {
|
|
15166
|
+
var _a, _b;
|
|
15166
15167
|
const formatValue = (value) => {
|
|
15167
15168
|
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15168
|
-
if (
|
|
15169
|
+
if (!isNaN(numValue)) {
|
|
15169
15170
|
return numValue.toLocaleString();
|
|
15170
15171
|
}
|
|
15171
15172
|
return value;
|
|
@@ -15190,6 +15191,14 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15190
15191
|
});
|
|
15191
15192
|
},
|
|
15192
15193
|
};
|
|
15194
|
+
const getAxisLabel = (symbol) => {
|
|
15195
|
+
const labelMap = {
|
|
15196
|
+
"%": "Percentage",
|
|
15197
|
+
"$": "Cost",
|
|
15198
|
+
"#": "Count",
|
|
15199
|
+
};
|
|
15200
|
+
return labelMap[symbol] || symbol; // fallback if not found
|
|
15201
|
+
};
|
|
15193
15202
|
const defaultOptions = {
|
|
15194
15203
|
responsive: true,
|
|
15195
15204
|
maintainAspectRatio: false,
|
|
@@ -15204,7 +15213,13 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15204
15213
|
},
|
|
15205
15214
|
plugins: {
|
|
15206
15215
|
legend: {
|
|
15207
|
-
display:
|
|
15216
|
+
display: (ctx) => {
|
|
15217
|
+
const chart = ctx.chart;
|
|
15218
|
+
const datasets = chart.data.datasets;
|
|
15219
|
+
if (datasets.length > 1)
|
|
15220
|
+
return true;
|
|
15221
|
+
return false;
|
|
15222
|
+
},
|
|
15208
15223
|
labels: {
|
|
15209
15224
|
boxWidth: 12,
|
|
15210
15225
|
boxHeight: 12,
|
|
@@ -15237,13 +15252,17 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15237
15252
|
ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 },
|
|
15238
15253
|
},
|
|
15239
15254
|
y: {
|
|
15255
|
+
title: {
|
|
15256
|
+
display: true,
|
|
15257
|
+
text: (data === null || data === void 0 ? void 0 : data.datasets) && ((_a = data === null || data === void 0 ? void 0 : data.datasets) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (_b = data === null || data === void 0 ? void 0 : data.datasets) === null || _b === void 0 ? void 0 : _b[0].label : getAxisLabel(units !== null && units !== void 0 ? units : ""),
|
|
15258
|
+
},
|
|
15240
15259
|
beginAtZero: true,
|
|
15241
15260
|
ticks: {
|
|
15242
15261
|
callback: function (value) {
|
|
15243
15262
|
if (units === '$') {
|
|
15244
15263
|
return `${units}${formatValue(value)}`;
|
|
15245
15264
|
}
|
|
15246
|
-
return units ? `${formatValue(value)} ${units}` : value;
|
|
15265
|
+
return units ? `${formatValue(value)} ${(units === null || units === void 0 ? void 0 : units.length) < 3 ? units : ""}` : value;
|
|
15247
15266
|
}
|
|
15248
15267
|
}
|
|
15249
15268
|
},
|
|
@@ -15254,13 +15273,22 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
|
|
|
15254
15273
|
|
|
15255
15274
|
Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
|
|
15256
15275
|
function SeriesLineChart({ orientation, title, data, options, className, units, content }) {
|
|
15276
|
+
var _a, _b;
|
|
15257
15277
|
const formatValue = (value) => {
|
|
15258
15278
|
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
15259
|
-
if (
|
|
15279
|
+
if (!isNaN(numValue)) {
|
|
15260
15280
|
return numValue.toLocaleString();
|
|
15261
15281
|
}
|
|
15262
15282
|
return value;
|
|
15263
15283
|
};
|
|
15284
|
+
const getAxisLabel = (symbol) => {
|
|
15285
|
+
const labelMap = {
|
|
15286
|
+
"%": "Percentage",
|
|
15287
|
+
"$": "Cost",
|
|
15288
|
+
"#": "Count",
|
|
15289
|
+
};
|
|
15290
|
+
return labelMap[symbol] || symbol; // fallback if not found
|
|
15291
|
+
};
|
|
15264
15292
|
const defaultOptions = {
|
|
15265
15293
|
responsive: true,
|
|
15266
15294
|
maintainAspectRatio: false,
|
|
@@ -15274,7 +15302,13 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
|
|
|
15274
15302
|
},
|
|
15275
15303
|
plugins: {
|
|
15276
15304
|
legend: {
|
|
15277
|
-
display:
|
|
15305
|
+
display: (ctx) => {
|
|
15306
|
+
const chart = ctx.chart;
|
|
15307
|
+
const datasets = chart.data.datasets;
|
|
15308
|
+
if (datasets.length > 1)
|
|
15309
|
+
return true;
|
|
15310
|
+
return false;
|
|
15311
|
+
},
|
|
15278
15312
|
labels: {
|
|
15279
15313
|
boxWidth: 12,
|
|
15280
15314
|
boxHeight: 12,
|
|
@@ -15317,6 +15351,10 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
|
|
|
15317
15351
|
ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 },
|
|
15318
15352
|
},
|
|
15319
15353
|
y: {
|
|
15354
|
+
title: {
|
|
15355
|
+
display: true,
|
|
15356
|
+
text: (data === null || data === void 0 ? void 0 : data.datasets) && ((_a = data === null || data === void 0 ? void 0 : data.datasets) === null || _a === void 0 ? void 0 : _a.length) === 1 ? (_b = data === null || data === void 0 ? void 0 : data.datasets) === null || _b === void 0 ? void 0 : _b[0].label : getAxisLabel(units !== null && units !== void 0 ? units : ""),
|
|
15357
|
+
},
|
|
15320
15358
|
beginAtZero: true,
|
|
15321
15359
|
ticks: {
|
|
15322
15360
|
callback: function (value) {
|