@sentio/ui-dashboard 0.2.4 → 0.2.7
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.css +65 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +96 -19
- package/dist/index.d.ts +96 -19
- package/dist/index.js +1083 -149
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1048 -119
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -34,10 +34,12 @@ __export(index_exports, {
|
|
|
34
34
|
AreaIcon: () => AreaIcon_default,
|
|
35
35
|
ArgumentInput: () => ArgumentInput,
|
|
36
36
|
ArgumentType: () => ArgumentType,
|
|
37
|
+
BarGaugeChart: () => BarGaugeChart,
|
|
37
38
|
BarGaugeControls: () => BarGaugeControls,
|
|
38
39
|
BarGuageIcon: () => BarGuageIcon_default,
|
|
39
40
|
BarIcon: () => BarIcon_default,
|
|
40
41
|
ChartLegend: () => ChartLegend,
|
|
42
|
+
ChartTooltip: () => ChartTooltip,
|
|
41
43
|
ChartTypeButtonGroup: () => ChartTypeButtonGroup,
|
|
42
44
|
EventsFunctionCategories: () => EventsFunctionCategories,
|
|
43
45
|
EventsFunctionMap: () => EventsFunctionMap,
|
|
@@ -50,12 +52,15 @@ __export(index_exports, {
|
|
|
50
52
|
LabelsInput: () => LabelsInput,
|
|
51
53
|
LineControls: () => LineControls,
|
|
52
54
|
LineIcon: () => LineIcon_default,
|
|
55
|
+
PieChart: () => PieChart2,
|
|
53
56
|
PieChartControls: () => PieChartControls,
|
|
54
57
|
PieIcon: () => PieIcon_default,
|
|
58
|
+
QueryValueChart: () => QueryValueChart,
|
|
55
59
|
QueryValueIcon: () => QueryValueIcon_default,
|
|
56
60
|
ReactEChartsBase: () => ReactEChartsBase,
|
|
57
61
|
RefreshButton: () => RefreshButton,
|
|
58
62
|
RefreshContext: () => RefreshContext,
|
|
63
|
+
ScatterChartTooltip: () => ScatterChartTooltip,
|
|
59
64
|
ScatterIcon: () => ScatterIcon_default,
|
|
60
65
|
SystemLabels: () => SystemLabels,
|
|
61
66
|
TableIcon: () => TableIcon_default,
|
|
@@ -3042,10 +3047,934 @@ var ChartTypeButtonGroup = ({
|
|
|
3042
3047
|
) });
|
|
3043
3048
|
};
|
|
3044
3049
|
|
|
3045
|
-
// src/charts/
|
|
3046
|
-
var
|
|
3050
|
+
// src/charts/ChartTooltip.tsx
|
|
3051
|
+
var import_react15 = require("react");
|
|
3052
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
3053
|
+
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
3054
|
+
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
3055
|
+
var import_lodash3 = require("lodash");
|
|
3056
|
+
var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
|
|
3057
|
+
var import_lu3 = require("react-icons/lu");
|
|
3047
3058
|
var import_ui_core9 = require("@sentio/ui-core");
|
|
3059
|
+
|
|
3060
|
+
// src/charts/duration.ts
|
|
3061
|
+
var longUnits = {
|
|
3062
|
+
s: "seconds",
|
|
3063
|
+
m: "minutes",
|
|
3064
|
+
h: "hours",
|
|
3065
|
+
d: "days",
|
|
3066
|
+
w: "weeks",
|
|
3067
|
+
M: "months",
|
|
3068
|
+
y: "years"
|
|
3069
|
+
};
|
|
3070
|
+
function durationToLongString(d) {
|
|
3071
|
+
const u = longUnits[d.unit ?? ""] ?? "";
|
|
3072
|
+
return Number(d.value) === 1 ? u.replace(/s$/, "") : u;
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
// src/charts/ChartTooltip.tsx
|
|
3048
3076
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3077
|
+
import_dayjs.default.extend(import_utc.default);
|
|
3078
|
+
import_dayjs.default.extend(import_timezone.default);
|
|
3079
|
+
function isValidValue(value, includeZero) {
|
|
3080
|
+
if (includeZero) {
|
|
3081
|
+
return Number.isFinite(value);
|
|
3082
|
+
} else {
|
|
3083
|
+
return Number.isFinite(value) && value !== 0;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
function ChartTooltip({
|
|
3087
|
+
data,
|
|
3088
|
+
numberFormatter,
|
|
3089
|
+
compareTimeDuration,
|
|
3090
|
+
highlightSeriesId,
|
|
3091
|
+
title,
|
|
3092
|
+
showTotal,
|
|
3093
|
+
onViewLogs,
|
|
3094
|
+
viewLogDisabled,
|
|
3095
|
+
onViewUsers,
|
|
3096
|
+
viewUsersDisabled,
|
|
3097
|
+
isFixed
|
|
3098
|
+
}) {
|
|
3099
|
+
const {
|
|
3100
|
+
series,
|
|
3101
|
+
hasCompare,
|
|
3102
|
+
hasCurrent,
|
|
3103
|
+
currentTime,
|
|
3104
|
+
compareTime,
|
|
3105
|
+
markers,
|
|
3106
|
+
compareMarkers,
|
|
3107
|
+
total,
|
|
3108
|
+
compareTotal
|
|
3109
|
+
} = (0, import_react15.useMemo)(() => {
|
|
3110
|
+
const params = (0, import_lodash3.sortBy)(data, (p) => -p.value[1]);
|
|
3111
|
+
const hasCompare2 = (0, import_lodash3.some)(
|
|
3112
|
+
params,
|
|
3113
|
+
(param) => param.seriesId.endsWith("_compare")
|
|
3114
|
+
);
|
|
3115
|
+
const seriesData = {};
|
|
3116
|
+
const markers2 = {};
|
|
3117
|
+
const compareMarkers2 = {};
|
|
3118
|
+
let currentTime2;
|
|
3119
|
+
let compareTime2;
|
|
3120
|
+
let total2 = new import_bigdecimal.default(0);
|
|
3121
|
+
let compareTotal2 = new import_bigdecimal.default(0);
|
|
3122
|
+
for (const p of params) {
|
|
3123
|
+
const { marker, seriesName, value, seriesId } = p;
|
|
3124
|
+
if (seriesId.endsWith("_compare")) {
|
|
3125
|
+
const id = seriesId.replace("_compare", "");
|
|
3126
|
+
compareMarkers2[id] = marker;
|
|
3127
|
+
if (compareTime2 === void 0) {
|
|
3128
|
+
compareTime2 = (0, import_dayjs.default)(value[0]);
|
|
3129
|
+
}
|
|
3130
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3131
|
+
seriesData[id] = {
|
|
3132
|
+
seriesId: id,
|
|
3133
|
+
...seriesData[id],
|
|
3134
|
+
compareValue: value[1],
|
|
3135
|
+
compareTime: value[0],
|
|
3136
|
+
seriesName
|
|
3137
|
+
};
|
|
3138
|
+
compareTotal2 = compareTotal2.plus(value[1]);
|
|
3139
|
+
}
|
|
3140
|
+
} else {
|
|
3141
|
+
markers2[seriesId] = marker;
|
|
3142
|
+
if (currentTime2 === void 0) {
|
|
3143
|
+
currentTime2 = (0, import_dayjs.default)(value[0]);
|
|
3144
|
+
}
|
|
3145
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3146
|
+
seriesData[seriesId] = {
|
|
3147
|
+
seriesId,
|
|
3148
|
+
...seriesData[seriesId],
|
|
3149
|
+
time: value[0],
|
|
3150
|
+
value: value[1],
|
|
3151
|
+
seriesName
|
|
3152
|
+
};
|
|
3153
|
+
total2 = total2.plus(value[1]);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
const series2 = (0, import_lodash3.sortBy)(Object.values(seriesData), (s) => -s.value);
|
|
3158
|
+
const hasCurrent2 = series2[0]?.value !== void 0;
|
|
3159
|
+
if (compareTimeDuration && compareTime2 && !currentTime2) {
|
|
3160
|
+
currentTime2 = compareTime2.add(
|
|
3161
|
+
Number(compareTimeDuration.value),
|
|
3162
|
+
compareTimeDuration.unit
|
|
3163
|
+
);
|
|
3164
|
+
}
|
|
3165
|
+
return {
|
|
3166
|
+
series: series2,
|
|
3167
|
+
hasCompare: hasCompare2,
|
|
3168
|
+
currentTime: currentTime2,
|
|
3169
|
+
compareTime: compareTime2,
|
|
3170
|
+
hasCurrent: hasCurrent2,
|
|
3171
|
+
markers: markers2,
|
|
3172
|
+
compareMarkers: compareMarkers2,
|
|
3173
|
+
total: total2,
|
|
3174
|
+
compareTotal: compareTotal2
|
|
3175
|
+
};
|
|
3176
|
+
}, [data]);
|
|
3177
|
+
const renderRow = (p, idx) => {
|
|
3178
|
+
const { seriesName, compareValue, value, seriesId } = p;
|
|
3179
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3180
|
+
const marker = markers[seriesId];
|
|
3181
|
+
const diff = hasCompare && hasCurrent && compareValue != null && value != null ? new import_bigdecimal.default(value).minus(compareValue).div(compareValue).toNumber() : void 0;
|
|
3182
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, idx);
|
|
3183
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, idx);
|
|
3184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
|
|
3185
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3186
|
+
"div",
|
|
3187
|
+
{
|
|
3188
|
+
className: (0, import_ui_core9.classNames)(
|
|
3189
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3190
|
+
"group",
|
|
3191
|
+
highlighted ? "highlighted" : ""
|
|
3192
|
+
),
|
|
3193
|
+
style: { minWidth: "4rem" },
|
|
3194
|
+
children: [
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3196
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate", children: seriesName }),
|
|
3197
|
+
showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3198
|
+
"button",
|
|
3199
|
+
{
|
|
3200
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3201
|
+
onClick: (e) => {
|
|
3202
|
+
e.preventDefault();
|
|
3203
|
+
e.stopPropagation();
|
|
3204
|
+
onViewLogs(seriesId, idx);
|
|
3205
|
+
},
|
|
3206
|
+
title: "View logs",
|
|
3207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuList, { className: "h-4 w-4" })
|
|
3208
|
+
}
|
|
3209
|
+
),
|
|
3210
|
+
showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3211
|
+
"button",
|
|
3212
|
+
{
|
|
3213
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3214
|
+
onClick: (e) => {
|
|
3215
|
+
e.preventDefault();
|
|
3216
|
+
e.stopPropagation();
|
|
3217
|
+
onViewUsers(seriesId, idx);
|
|
3218
|
+
},
|
|
3219
|
+
title: "View users",
|
|
3220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuCircleUserRound, { className: "h-4 w-4" })
|
|
3221
|
+
}
|
|
3222
|
+
),
|
|
3223
|
+
isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3224
|
+
import_ui_core9.CopyButton,
|
|
3225
|
+
{
|
|
3226
|
+
size: 16,
|
|
3227
|
+
text: seriesName,
|
|
3228
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3229
|
+
}
|
|
3230
|
+
)
|
|
3231
|
+
]
|
|
3232
|
+
},
|
|
3233
|
+
idx
|
|
3234
|
+
),
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3236
|
+
"div",
|
|
3237
|
+
{
|
|
3238
|
+
className: (0, import_ui_core9.classNames)(
|
|
3239
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3240
|
+
highlighted ? "highlighted" : ""
|
|
3241
|
+
),
|
|
3242
|
+
children: [
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(value, seriesId) : "-" }),
|
|
3244
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3245
|
+
"span",
|
|
3246
|
+
{
|
|
3247
|
+
className: (0, import_ui_core9.classNames)(
|
|
3248
|
+
"ml-1 text-xs",
|
|
3249
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3250
|
+
),
|
|
3251
|
+
children: [
|
|
3252
|
+
diff > 0 ? "+" : "",
|
|
3253
|
+
(diff * 100).toFixed(2),
|
|
3254
|
+
"%"
|
|
3255
|
+
]
|
|
3256
|
+
}
|
|
3257
|
+
)
|
|
3258
|
+
]
|
|
3259
|
+
},
|
|
3260
|
+
`${idx}-value`
|
|
3261
|
+
)
|
|
3262
|
+
] }, idx);
|
|
3263
|
+
};
|
|
3264
|
+
const renderCompareRow = (p, idx) => {
|
|
3265
|
+
const { seriesName, compareValue, seriesId } = p;
|
|
3266
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3267
|
+
const compareMarker = compareMarkers[seriesId];
|
|
3268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3270
|
+
"div",
|
|
3271
|
+
{
|
|
3272
|
+
className: (0, import_ui_core9.classNames)(
|
|
3273
|
+
"sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate",
|
|
3274
|
+
highlighted ? "highlighted" : ""
|
|
3275
|
+
),
|
|
3276
|
+
style: { minWidth: "4rem" },
|
|
3277
|
+
children: [
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3279
|
+
"span",
|
|
3280
|
+
{
|
|
3281
|
+
dangerouslySetInnerHTML: { __html: compareMarker || "" }
|
|
3282
|
+
}
|
|
3283
|
+
),
|
|
3284
|
+
seriesName
|
|
3285
|
+
]
|
|
3286
|
+
},
|
|
3287
|
+
idx
|
|
3288
|
+
),
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3290
|
+
"div",
|
|
3291
|
+
{
|
|
3292
|
+
className: (0, import_ui_core9.classNames)(
|
|
3293
|
+
"sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold",
|
|
3294
|
+
highlighted ? "highlighted" : ""
|
|
3295
|
+
),
|
|
3296
|
+
children: (0, import_lodash3.isNumber)(compareValue) ? numberFormatter(compareValue, seriesId) : "-"
|
|
3297
|
+
},
|
|
3298
|
+
`${idx}-value`
|
|
3299
|
+
)
|
|
3300
|
+
] }, idx);
|
|
3301
|
+
};
|
|
3302
|
+
const renderTotalRow = () => {
|
|
3303
|
+
if (!showTotal || series.length < 2) return null;
|
|
3304
|
+
const diff = hasCompare && hasCurrent && total && compareTotal ? total.minus(compareTotal).div(compareTotal).toNumber() : void 0;
|
|
3305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item series-name text-text-foreground truncate font-semibold", children: "Total" }),
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold", children: [
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(total.toNumber()) : "-" }),
|
|
3309
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3310
|
+
"span",
|
|
3311
|
+
{
|
|
3312
|
+
className: (0, import_ui_core9.classNames)(
|
|
3313
|
+
"ml-1 text-xs",
|
|
3314
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3315
|
+
),
|
|
3316
|
+
children: [
|
|
3317
|
+
diff > 0 ? "+" : "",
|
|
3318
|
+
(diff * 100).toFixed(2),
|
|
3319
|
+
"%"
|
|
3320
|
+
]
|
|
3321
|
+
}
|
|
3322
|
+
)
|
|
3323
|
+
] })
|
|
3324
|
+
] });
|
|
3325
|
+
};
|
|
3326
|
+
const renderCompareTotalRow = () => {
|
|
3327
|
+
if (!showTotal || series.length < 2 || !hasCompare) return null;
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate font-semibold", children: "Total" }),
|
|
3330
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: (0, import_lodash3.isNumber)(compareTotal) ? numberFormatter(compareTotal.toNumber()) : "-" })
|
|
3331
|
+
] });
|
|
3332
|
+
};
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3334
|
+
"div",
|
|
3335
|
+
{
|
|
3336
|
+
className: (0, import_ui_core9.classNames)("grid w-full px-2"),
|
|
3337
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3338
|
+
children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3340
|
+
"div",
|
|
3341
|
+
{
|
|
3342
|
+
className: (0, import_ui_core9.classNames)(
|
|
3343
|
+
"pl-2",
|
|
3344
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3345
|
+
),
|
|
3346
|
+
children: title ?? currentTime?.format("YYYY-MM-DD HH:mm:ss")
|
|
3347
|
+
}
|
|
3348
|
+
),
|
|
3349
|
+
!series || series.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3350
|
+
series.map((s, idx) => renderRow(s, idx)),
|
|
3351
|
+
renderTotalRow(),
|
|
3352
|
+
hasCompare && compareTimeDuration && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3354
|
+
"div",
|
|
3355
|
+
{
|
|
3356
|
+
className: (0, import_ui_core9.classNames)(
|
|
3357
|
+
"mt-2 pl-2",
|
|
3358
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3359
|
+
),
|
|
3360
|
+
children: [
|
|
3361
|
+
compareTime?.format("YYYY-MM-DD HH:mm:ss"),
|
|
3362
|
+
" (previous",
|
|
3363
|
+
" ",
|
|
3364
|
+
durationToLongString(compareTimeDuration),
|
|
3365
|
+
")"
|
|
3366
|
+
]
|
|
3367
|
+
}
|
|
3368
|
+
),
|
|
3369
|
+
series.map((s, idx) => renderCompareRow(s, idx)),
|
|
3370
|
+
renderCompareTotalRow()
|
|
3371
|
+
] })
|
|
3372
|
+
] })
|
|
3373
|
+
]
|
|
3374
|
+
}
|
|
3375
|
+
);
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
// src/charts/ScatterChartTooltip.tsx
|
|
3379
|
+
var import_react16 = require("react");
|
|
3380
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
3381
|
+
var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
3382
|
+
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
3383
|
+
var import_lodash4 = require("lodash");
|
|
3384
|
+
var import_lu4 = require("react-icons/lu");
|
|
3385
|
+
var import_ui_core10 = require("@sentio/ui-core");
|
|
3386
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3387
|
+
import_dayjs2.default.extend(import_utc2.default);
|
|
3388
|
+
import_dayjs2.default.extend(import_timezone2.default);
|
|
3389
|
+
function ScatterChartTooltip({
|
|
3390
|
+
data,
|
|
3391
|
+
numberFormatter,
|
|
3392
|
+
highlightSeriesId,
|
|
3393
|
+
title,
|
|
3394
|
+
onViewLogs,
|
|
3395
|
+
viewLogDisabled,
|
|
3396
|
+
onViewUsers,
|
|
3397
|
+
viewUsersDisabled,
|
|
3398
|
+
isFixed,
|
|
3399
|
+
sizeTitle = "Size"
|
|
3400
|
+
}) {
|
|
3401
|
+
const { point, seriesName, seriesId, marker } = (0, import_react16.useMemo)(() => {
|
|
3402
|
+
const param = Array.isArray(data) ? data[0] : data;
|
|
3403
|
+
return {
|
|
3404
|
+
point: param,
|
|
3405
|
+
seriesName: param?.seriesName || "",
|
|
3406
|
+
seriesId: param?.seriesId || "",
|
|
3407
|
+
marker: param?.marker || ""
|
|
3408
|
+
};
|
|
3409
|
+
}, [data]);
|
|
3410
|
+
if (!point || !point.value) {
|
|
3411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) });
|
|
3412
|
+
}
|
|
3413
|
+
const { value } = point;
|
|
3414
|
+
const [xValue, yValue, sizeValue] = value;
|
|
3415
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3416
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, 0);
|
|
3417
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, 0);
|
|
3418
|
+
const formatValue = (val) => {
|
|
3419
|
+
if (val instanceof Date) {
|
|
3420
|
+
return (0, import_dayjs2.default)(val).format("YYYY-MM-DD HH:mm:ss");
|
|
3421
|
+
} else if ((0, import_lodash4.isNumber)(val)) {
|
|
3422
|
+
return numberFormatter(val);
|
|
3423
|
+
} else {
|
|
3424
|
+
return String(val);
|
|
3425
|
+
}
|
|
3426
|
+
};
|
|
3427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3428
|
+
"div",
|
|
3429
|
+
{
|
|
3430
|
+
className: (0, import_ui_core10.classNames)("grid w-full px-2"),
|
|
3431
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3432
|
+
children: [
|
|
3433
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3434
|
+
"div",
|
|
3435
|
+
{
|
|
3436
|
+
className: (0, import_ui_core10.classNames)(
|
|
3437
|
+
"mb-2 pl-2",
|
|
3438
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3439
|
+
),
|
|
3440
|
+
children: title ?? (0, import_dayjs2.default)(xValue).format("YYYY-MM-DD HH:mm:ss")
|
|
3441
|
+
}
|
|
3442
|
+
),
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3444
|
+
"div",
|
|
3445
|
+
{
|
|
3446
|
+
className: (0, import_ui_core10.classNames)(
|
|
3447
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3448
|
+
"group",
|
|
3449
|
+
highlighted ? "highlighted" : ""
|
|
3450
|
+
),
|
|
3451
|
+
style: { minWidth: "4rem" },
|
|
3452
|
+
children: [
|
|
3453
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3454
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: seriesName }),
|
|
3455
|
+
showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3456
|
+
"button",
|
|
3457
|
+
{
|
|
3458
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3459
|
+
onClick: (e) => {
|
|
3460
|
+
e.preventDefault();
|
|
3461
|
+
e.stopPropagation();
|
|
3462
|
+
onViewLogs(seriesId, 0);
|
|
3463
|
+
},
|
|
3464
|
+
title: "View logs",
|
|
3465
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuList, { className: "h-4 w-4" })
|
|
3466
|
+
}
|
|
3467
|
+
),
|
|
3468
|
+
showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3469
|
+
"button",
|
|
3470
|
+
{
|
|
3471
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3472
|
+
onClick: (e) => {
|
|
3473
|
+
e.preventDefault();
|
|
3474
|
+
e.stopPropagation();
|
|
3475
|
+
onViewUsers(seriesId, 0);
|
|
3476
|
+
},
|
|
3477
|
+
title: "View users",
|
|
3478
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuCircleUserRound, { className: "h-4 w-4" })
|
|
3479
|
+
}
|
|
3480
|
+
),
|
|
3481
|
+
isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3482
|
+
import_ui_core10.CopyButton,
|
|
3483
|
+
{
|
|
3484
|
+
size: 16,
|
|
3485
|
+
text: seriesName,
|
|
3486
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3487
|
+
}
|
|
3488
|
+
)
|
|
3489
|
+
]
|
|
3490
|
+
}
|
|
3491
|
+
),
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3493
|
+
"div",
|
|
3494
|
+
{
|
|
3495
|
+
className: (0, import_ui_core10.classNames)(
|
|
3496
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3497
|
+
highlighted ? "highlighted" : ""
|
|
3498
|
+
),
|
|
3499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatValue(yValue) })
|
|
3500
|
+
}
|
|
3501
|
+
),
|
|
3502
|
+
sizeValue !== void 0 && sizeValue !== null && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react16.Fragment, { children: [
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border-border-color col-span-2 my-2 w-full border-t" }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3505
|
+
"div",
|
|
3506
|
+
{
|
|
3507
|
+
className: "sentio-tooltip-item series-name text-text-foreground-secondary truncate",
|
|
3508
|
+
style: { minWidth: "4rem" },
|
|
3509
|
+
children: sizeTitle
|
|
3510
|
+
}
|
|
3511
|
+
),
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: formatValue(sizeValue) })
|
|
3513
|
+
] })
|
|
3514
|
+
]
|
|
3515
|
+
}
|
|
3516
|
+
);
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
// src/charts/PieChart.tsx
|
|
3520
|
+
var import_react17 = require("react");
|
|
3521
|
+
var import_react_resize_detector3 = require("react-resize-detector");
|
|
3522
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3523
|
+
var theresholdWidth = 480;
|
|
3524
|
+
var TOOLTIP_MIN_VIEWPORT_LEFT = 8;
|
|
3525
|
+
var TOOLTIP_MIN_VIEWPORT_RIGHT = 8;
|
|
3526
|
+
var PieChart2 = (0, import_react17.forwardRef)(
|
|
3527
|
+
(props, ref) => {
|
|
3528
|
+
const {
|
|
3529
|
+
series,
|
|
3530
|
+
valueFormatter,
|
|
3531
|
+
config,
|
|
3532
|
+
title,
|
|
3533
|
+
minHeight,
|
|
3534
|
+
loading,
|
|
3535
|
+
style,
|
|
3536
|
+
onInitChart
|
|
3537
|
+
} = props;
|
|
3538
|
+
const [options, setOptions] = (0, import_react17.useState)({});
|
|
3539
|
+
const isDarkMode = useDarkMode();
|
|
3540
|
+
const isMobile2 = isMobile();
|
|
3541
|
+
const { width, ref: resizeRef } = (0, import_react_resize_detector3.useResizeDetector)({
|
|
3542
|
+
refreshMode: "debounce",
|
|
3543
|
+
refreshRate: 500,
|
|
3544
|
+
handleHeight: false
|
|
3545
|
+
});
|
|
3546
|
+
const tooltipPosition = (point, _params, _dom, _rect, size) => {
|
|
3547
|
+
const chartRect = resizeRef.current?.getBoundingClientRect();
|
|
3548
|
+
const chartLeft = chartRect?.left ?? 0;
|
|
3549
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : size.viewSize[0];
|
|
3550
|
+
const [w, h] = size.contentSize;
|
|
3551
|
+
const minXInChart = TOOLTIP_MIN_VIEWPORT_LEFT - chartLeft;
|
|
3552
|
+
const maxXInChart = winW - TOOLTIP_MIN_VIEWPORT_RIGHT - chartLeft - w;
|
|
3553
|
+
let x = point[0] + 12;
|
|
3554
|
+
if (x > maxXInChart) {
|
|
3555
|
+
x = point[0] - w - 12;
|
|
3556
|
+
}
|
|
3557
|
+
if (x < minXInChart) x = minXInChart;
|
|
3558
|
+
if (x > maxXInChart) x = maxXInChart;
|
|
3559
|
+
const y = Math.max(0, point[1] - h / 2);
|
|
3560
|
+
return [x, y];
|
|
3561
|
+
};
|
|
3562
|
+
(0, import_react17.useEffect)(() => {
|
|
3563
|
+
const isHLegend = width && width < theresholdWidth;
|
|
3564
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : 1024;
|
|
3565
|
+
const tooltipMaxWidth = Math.max(160, Math.min(280, winW - 48));
|
|
3566
|
+
const tooltipExtraCss = isMobile2 ? `max-width: ${tooltipMaxWidth}px; white-space: normal; word-break: break-word; overflow-wrap: anywhere;` : "";
|
|
3567
|
+
const d = [];
|
|
3568
|
+
series.forEach((s) => {
|
|
3569
|
+
if (s.data.length > 0 && s.data[0] && s.data[0][1] != null) {
|
|
3570
|
+
const rawValue = s.data[0][1];
|
|
3571
|
+
if (config?.pieConfig?.absValue) {
|
|
3572
|
+
d.push({ name: s.name, value: Math.abs(rawValue) });
|
|
3573
|
+
} else if (rawValue > 0) {
|
|
3574
|
+
d.push({ name: s.name, value: rawValue });
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3578
|
+
const total = d.reduce((acc, cur) => acc + cur.value, 0);
|
|
3579
|
+
d.sort((a, b) => {
|
|
3580
|
+
const percentA = a.value / total * 100;
|
|
3581
|
+
const percentB = b.value / total * 100;
|
|
3582
|
+
return percentB - percentA;
|
|
3583
|
+
});
|
|
3584
|
+
const pieSeries = [
|
|
3585
|
+
{
|
|
3586
|
+
type: "pie",
|
|
3587
|
+
radius: [config?.pieConfig?.pieType == "Donut" ? "40%" : 0, "70%"],
|
|
3588
|
+
center: isHLegend ? ["50%", "50%"] : ["35%", "50%"],
|
|
3589
|
+
label: { show: false },
|
|
3590
|
+
labelLine: { length: 10, length2: 10, maxSurfaceAngle: 50 },
|
|
3591
|
+
data: d
|
|
3592
|
+
}
|
|
3593
|
+
];
|
|
3594
|
+
const options2 = {
|
|
3595
|
+
title: { text: title, left: 8 },
|
|
3596
|
+
legend: isHLegend ? {
|
|
3597
|
+
type: "scroll",
|
|
3598
|
+
orient: "horizontal",
|
|
3599
|
+
bottom: 12,
|
|
3600
|
+
left: "center",
|
|
3601
|
+
animation: true,
|
|
3602
|
+
animationDurationUpdate: 300,
|
|
3603
|
+
pageIconSize: [10, 8],
|
|
3604
|
+
pageButtonItemGap: 2,
|
|
3605
|
+
pageButtonGap: 4,
|
|
3606
|
+
textStyle: {
|
|
3607
|
+
width: width ? width * 0.4 : 100,
|
|
3608
|
+
overflow: "truncate"
|
|
3609
|
+
},
|
|
3610
|
+
tooltip: {
|
|
3611
|
+
show: true,
|
|
3612
|
+
appendToBody: true,
|
|
3613
|
+
extraCssText: tooltipExtraCss,
|
|
3614
|
+
position: tooltipPosition,
|
|
3615
|
+
formatter: function(params) {
|
|
3616
|
+
const name = params.name;
|
|
3617
|
+
const item = d.find((i) => i.name === name);
|
|
3618
|
+
let ret = name;
|
|
3619
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3620
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3621
|
+
}
|
|
3622
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3623
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3624
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3625
|
+
${percent}%`;
|
|
3626
|
+
}
|
|
3627
|
+
return ret;
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
} : {
|
|
3631
|
+
type: "scroll",
|
|
3632
|
+
orient: "vertical",
|
|
3633
|
+
right: 16,
|
|
3634
|
+
top: title ? 48 : 8,
|
|
3635
|
+
width: "35%",
|
|
3636
|
+
animation: true,
|
|
3637
|
+
animationDurationUpdate: 300,
|
|
3638
|
+
tooltip: {
|
|
3639
|
+
show: true,
|
|
3640
|
+
appendToBody: true,
|
|
3641
|
+
extraCssText: tooltipExtraCss,
|
|
3642
|
+
position: tooltipPosition,
|
|
3643
|
+
formatter: function(params) {
|
|
3644
|
+
const name = params.name;
|
|
3645
|
+
const item = d.find((i) => i.name === name);
|
|
3646
|
+
let ret = name;
|
|
3647
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3648
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3649
|
+
}
|
|
3650
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3651
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3652
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3653
|
+
${percent}%`;
|
|
3654
|
+
}
|
|
3655
|
+
return ret;
|
|
3656
|
+
}
|
|
3657
|
+
},
|
|
3658
|
+
icon: "roundRect",
|
|
3659
|
+
itemWidth: 12,
|
|
3660
|
+
itemHeight: 12,
|
|
3661
|
+
itemGap: 6,
|
|
3662
|
+
show: true,
|
|
3663
|
+
pageIconSize: [8, 10],
|
|
3664
|
+
pageButtonGap: 4,
|
|
3665
|
+
pageButtonItemGap: 2,
|
|
3666
|
+
pageIconColor: isDarkMode ? "#909399" : "#4E5969",
|
|
3667
|
+
pageIconInactiveColor: isDarkMode ? "#606266" : "#C9CDD4",
|
|
3668
|
+
textStyle: {
|
|
3669
|
+
width: width ? width * 0.3 : "auto",
|
|
3670
|
+
overflow: "truncate",
|
|
3671
|
+
lineHeight: 16,
|
|
3672
|
+
fontSize: 12,
|
|
3673
|
+
rich: { value: { padding: [4, 0, 0, 0] } }
|
|
3674
|
+
},
|
|
3675
|
+
formatter: (name) => {
|
|
3676
|
+
const item = d.find((i) => i.name === name);
|
|
3677
|
+
let ret = name;
|
|
3678
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3679
|
+
ret += "\n" + valueFormatter(item.value);
|
|
3680
|
+
}
|
|
3681
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3682
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3683
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3684
|
+
${percent}%`;
|
|
3685
|
+
}
|
|
3686
|
+
return ret;
|
|
3687
|
+
}
|
|
3688
|
+
},
|
|
3689
|
+
tooltip: {
|
|
3690
|
+
trigger: "item",
|
|
3691
|
+
appendToBody: true,
|
|
3692
|
+
extraCssText: tooltipExtraCss,
|
|
3693
|
+
position: tooltipPosition,
|
|
3694
|
+
formatter: ({ name, data, percent }) => {
|
|
3695
|
+
let ret = `${name}`;
|
|
3696
|
+
if (config?.pieConfig?.showValue) {
|
|
3697
|
+
ret += "<br/>" + valueFormatter(data.value);
|
|
3698
|
+
}
|
|
3699
|
+
if (config?.pieConfig?.showPercent) {
|
|
3700
|
+
ret += config.pieConfig.showValue ? ` (${percent}%)` : `
|
|
3701
|
+
${percent}%`;
|
|
3702
|
+
}
|
|
3703
|
+
return ret;
|
|
3704
|
+
}
|
|
3705
|
+
},
|
|
3706
|
+
toolbox: { show: false },
|
|
3707
|
+
animation: false,
|
|
3708
|
+
series: pieSeries
|
|
3709
|
+
};
|
|
3710
|
+
setOptions(options2);
|
|
3711
|
+
}, [series, config, valueFormatter, isDarkMode, isMobile2, width, title]);
|
|
3712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full w-full", ref: resizeRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3713
|
+
ReactEChartsBase,
|
|
3714
|
+
{
|
|
3715
|
+
ref,
|
|
3716
|
+
loading,
|
|
3717
|
+
option: options,
|
|
3718
|
+
minHeight,
|
|
3719
|
+
style,
|
|
3720
|
+
noLegend: true,
|
|
3721
|
+
onInitChart
|
|
3722
|
+
}
|
|
3723
|
+
) });
|
|
3724
|
+
}
|
|
3725
|
+
);
|
|
3726
|
+
PieChart2.displayName = "PieChart";
|
|
3727
|
+
|
|
3728
|
+
// src/charts/BarGaugeChart.tsx
|
|
3729
|
+
var import_react18 = require("react");
|
|
3730
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3731
|
+
var compareOption = { numeric: true };
|
|
3732
|
+
var BarGaugeChart = (0, import_react18.forwardRef)(
|
|
3733
|
+
(props, ref) => {
|
|
3734
|
+
const {
|
|
3735
|
+
series: input,
|
|
3736
|
+
legend,
|
|
3737
|
+
valueFormatter,
|
|
3738
|
+
config,
|
|
3739
|
+
title,
|
|
3740
|
+
minHeight,
|
|
3741
|
+
loading,
|
|
3742
|
+
style,
|
|
3743
|
+
onInitChart
|
|
3744
|
+
} = props;
|
|
3745
|
+
const [series, setSeries] = (0, import_react18.useState)([]);
|
|
3746
|
+
const [xAxis, setXAxis] = (0, import_react18.useState)();
|
|
3747
|
+
const [yAxis, setYAxis] = (0, import_react18.useState)();
|
|
3748
|
+
const isVertical = config?.barGauge?.direction === "VERTICAL";
|
|
3749
|
+
(0, import_react18.useEffect)(() => {
|
|
3750
|
+
const tmpData = input.map((s) => {
|
|
3751
|
+
const d = s.data && s.data[0];
|
|
3752
|
+
return { name: s.name, value: d && d[1] };
|
|
3753
|
+
});
|
|
3754
|
+
const sort = config?.barGauge?.sort;
|
|
3755
|
+
switch (sort?.sortBy) {
|
|
3756
|
+
case "ByName":
|
|
3757
|
+
tmpData.sort(
|
|
3758
|
+
(a, b) => sort.orderDesc ? b.name.localeCompare(a.name, void 0, compareOption) : a.name.localeCompare(b.name, void 0, compareOption)
|
|
3759
|
+
);
|
|
3760
|
+
break;
|
|
3761
|
+
case "ByValue":
|
|
3762
|
+
tmpData.sort(
|
|
3763
|
+
(a, b) => sort.orderDesc ? b.value - a.value : a.value - b.value
|
|
3764
|
+
);
|
|
3765
|
+
break;
|
|
3766
|
+
}
|
|
3767
|
+
const series2 = [
|
|
3768
|
+
{
|
|
3769
|
+
type: "bar",
|
|
3770
|
+
data: tmpData.map((d) => d.value),
|
|
3771
|
+
label: {
|
|
3772
|
+
show: config?.valueConfig ? config.valueConfig.showValueLabel : false,
|
|
3773
|
+
position: config?.barGauge?.direction == "VERTICAL" ? "top" : "right",
|
|
3774
|
+
formatter: ({ value }) => valueFormatter(value)
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
];
|
|
3778
|
+
const seriesAxis = {
|
|
3779
|
+
type: "category",
|
|
3780
|
+
data: tmpData.map((s) => s.name),
|
|
3781
|
+
axisLabel: config?.barGauge?.direction == "VERTICAL" ? { interval: 0, rotate: 30 } : {}
|
|
3782
|
+
};
|
|
3783
|
+
if (config?.xAxis?.name) {
|
|
3784
|
+
seriesAxis.name = config?.xAxis?.name;
|
|
3785
|
+
seriesAxis.nameLocation = "middle";
|
|
3786
|
+
seriesAxis.nameGap = isVertical ? 45 : 60;
|
|
3787
|
+
}
|
|
3788
|
+
const valueAxis = {
|
|
3789
|
+
type: "value",
|
|
3790
|
+
axisLabel: (
|
|
3791
|
+
// show dates on value-axis label is weird
|
|
3792
|
+
config?.valueConfig?.valueFormatter == "DateFormatter" ? void 0 : { formatter: (v) => valueFormatter(v) }
|
|
3793
|
+
)
|
|
3794
|
+
};
|
|
3795
|
+
let xAxis2, yAxis2;
|
|
3796
|
+
switch (config?.barGauge?.direction) {
|
|
3797
|
+
case "VERTICAL":
|
|
3798
|
+
xAxis2 = seriesAxis;
|
|
3799
|
+
yAxis2 = valueAxis;
|
|
3800
|
+
break;
|
|
3801
|
+
case "HORIZONTAL":
|
|
3802
|
+
default:
|
|
3803
|
+
xAxis2 = valueAxis;
|
|
3804
|
+
yAxis2 = seriesAxis;
|
|
3805
|
+
}
|
|
3806
|
+
setSeries(series2);
|
|
3807
|
+
setXAxis(xAxis2);
|
|
3808
|
+
setYAxis(yAxis2);
|
|
3809
|
+
}, [
|
|
3810
|
+
input,
|
|
3811
|
+
config?.barGauge?.calculation,
|
|
3812
|
+
config?.barGauge?.sort,
|
|
3813
|
+
config?.valueConfig?.showValueLabel,
|
|
3814
|
+
config?.xAxis?.name,
|
|
3815
|
+
isVertical,
|
|
3816
|
+
valueFormatter
|
|
3817
|
+
]);
|
|
3818
|
+
const dataZoom = (0, import_react18.useMemo)(() => {
|
|
3819
|
+
if (config?.barGauge?.direction == "HORIZONTAL") {
|
|
3820
|
+
return [
|
|
3821
|
+
{
|
|
3822
|
+
show: series[0]?.data.length > 15,
|
|
3823
|
+
type: "slider",
|
|
3824
|
+
yAxisIndex: 0,
|
|
3825
|
+
zoomLock: true,
|
|
3826
|
+
width: 8,
|
|
3827
|
+
right: 10,
|
|
3828
|
+
top: 5,
|
|
3829
|
+
bottom: 30,
|
|
3830
|
+
minValueSpan: 5,
|
|
3831
|
+
maxValueSpan: 15,
|
|
3832
|
+
orient: "vertical",
|
|
3833
|
+
handleSize: 0,
|
|
3834
|
+
showDetail: false,
|
|
3835
|
+
brushSelect: false,
|
|
3836
|
+
showDataShadow: false
|
|
3837
|
+
},
|
|
3838
|
+
{
|
|
3839
|
+
type: "inside",
|
|
3840
|
+
id: "insideY",
|
|
3841
|
+
yAxisIndex: 0,
|
|
3842
|
+
zoomOnMouseWheel: false,
|
|
3843
|
+
moveOnMouseMove: true,
|
|
3844
|
+
moveOnMouseWheel: true
|
|
3845
|
+
}
|
|
3846
|
+
];
|
|
3847
|
+
} else {
|
|
3848
|
+
return [
|
|
3849
|
+
{
|
|
3850
|
+
show: series[0]?.data.length > 25,
|
|
3851
|
+
type: "slider",
|
|
3852
|
+
xAxisIndex: 0,
|
|
3853
|
+
zoomLock: true,
|
|
3854
|
+
height: 8,
|
|
3855
|
+
bottom: 5,
|
|
3856
|
+
maxValueSpan: 25,
|
|
3857
|
+
minValueSpan: 10,
|
|
3858
|
+
handleSize: "0",
|
|
3859
|
+
showDetail: false,
|
|
3860
|
+
orient: "horizontal",
|
|
3861
|
+
brushSelect: false,
|
|
3862
|
+
showDataShadow: false
|
|
3863
|
+
},
|
|
3864
|
+
{
|
|
3865
|
+
type: "inside",
|
|
3866
|
+
id: "insideX",
|
|
3867
|
+
xAxisIndex: 0,
|
|
3868
|
+
zoomOnMouseWheel: false,
|
|
3869
|
+
moveOnMouseMove: true,
|
|
3870
|
+
moveOnMouseWheel: true
|
|
3871
|
+
}
|
|
3872
|
+
];
|
|
3873
|
+
}
|
|
3874
|
+
}, [config, series]);
|
|
3875
|
+
const options = {
|
|
3876
|
+
title: { text: title },
|
|
3877
|
+
grid: {
|
|
3878
|
+
top: title ? 48 : 16,
|
|
3879
|
+
right: 40,
|
|
3880
|
+
bottom: isVertical && config?.xAxis?.name ? 40 : 16,
|
|
3881
|
+
left: !isVertical && config?.xAxis?.name ? 40 : 16,
|
|
3882
|
+
containLabel: true
|
|
3883
|
+
},
|
|
3884
|
+
xAxis,
|
|
3885
|
+
legend: { data: legend, top: -1e4, left: -1e4 },
|
|
3886
|
+
toolbox: { show: false },
|
|
3887
|
+
yAxis,
|
|
3888
|
+
dataZoom,
|
|
3889
|
+
animation: false,
|
|
3890
|
+
series,
|
|
3891
|
+
tooltip: {
|
|
3892
|
+
trigger: "axis",
|
|
3893
|
+
confine: true,
|
|
3894
|
+
extraCssText: "max-width: 50%; max-height: 50vh; overflow-y: auto;"
|
|
3895
|
+
}
|
|
3896
|
+
};
|
|
3897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3898
|
+
ReactEChartsBase,
|
|
3899
|
+
{
|
|
3900
|
+
ref,
|
|
3901
|
+
loading,
|
|
3902
|
+
option: options,
|
|
3903
|
+
minHeight,
|
|
3904
|
+
style,
|
|
3905
|
+
noLegend: true,
|
|
3906
|
+
onInitChart
|
|
3907
|
+
}
|
|
3908
|
+
) });
|
|
3909
|
+
}
|
|
3910
|
+
);
|
|
3911
|
+
BarGaugeChart.displayName = "BarGaugeChart";
|
|
3912
|
+
|
|
3913
|
+
// src/charts/QueryValueChart.tsx
|
|
3914
|
+
var import_react19 = require("react");
|
|
3915
|
+
var import_react_resize_detector4 = require("react-resize-detector");
|
|
3916
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3917
|
+
var QueryValueChart = (0, import_react19.forwardRef)(
|
|
3918
|
+
(props, ref) => {
|
|
3919
|
+
const {
|
|
3920
|
+
series,
|
|
3921
|
+
valueText,
|
|
3922
|
+
textColor,
|
|
3923
|
+
backgroundColor,
|
|
3924
|
+
minHeight,
|
|
3925
|
+
loading,
|
|
3926
|
+
style,
|
|
3927
|
+
onInitChart
|
|
3928
|
+
} = props;
|
|
3929
|
+
const { width, height, ref: ref2 } = (0, import_react_resize_detector4.useResizeDetector)();
|
|
3930
|
+
const fontSize = (0, import_react19.useMemo)(() => {
|
|
3931
|
+
return Math.min(
|
|
3932
|
+
(width || 0) / String(valueText).length,
|
|
3933
|
+
(height || 0) / 1.5
|
|
3934
|
+
);
|
|
3935
|
+
}, [width, height, valueText]);
|
|
3936
|
+
const options = {
|
|
3937
|
+
backgroundColor,
|
|
3938
|
+
grid: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
3939
|
+
toolbox: { show: false },
|
|
3940
|
+
animation: false,
|
|
3941
|
+
series,
|
|
3942
|
+
xAxis: { type: "time", show: false },
|
|
3943
|
+
yAxis: { type: "value", show: false },
|
|
3944
|
+
legend: { show: false },
|
|
3945
|
+
graphic: {
|
|
3946
|
+
type: "text",
|
|
3947
|
+
z: 100,
|
|
3948
|
+
left: "center",
|
|
3949
|
+
top: "middle",
|
|
3950
|
+
style: {
|
|
3951
|
+
text: valueText,
|
|
3952
|
+
fontSize,
|
|
3953
|
+
stroke: textColor,
|
|
3954
|
+
fill: textColor
|
|
3955
|
+
}
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-full w-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-full w-full", ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3959
|
+
ReactEChartsBase,
|
|
3960
|
+
{
|
|
3961
|
+
ref,
|
|
3962
|
+
loading,
|
|
3963
|
+
option: options,
|
|
3964
|
+
minHeight,
|
|
3965
|
+
style,
|
|
3966
|
+
noLegend: true,
|
|
3967
|
+
onInitChart
|
|
3968
|
+
}
|
|
3969
|
+
) }) });
|
|
3970
|
+
}
|
|
3971
|
+
);
|
|
3972
|
+
QueryValueChart.displayName = "QueryValueChart";
|
|
3973
|
+
|
|
3974
|
+
// src/charts/options/LineControls.tsx
|
|
3975
|
+
var import_immer4 = require("immer");
|
|
3976
|
+
var import_ui_core11 = require("@sentio/ui-core");
|
|
3977
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3049
3978
|
var lineStyles = [
|
|
3050
3979
|
{ label: "Solid", value: "Solid" },
|
|
3051
3980
|
{ label: "Dotted", value: "Dotted" }
|
|
@@ -3065,14 +3994,14 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3065
3994
|
})
|
|
3066
3995
|
);
|
|
3067
3996
|
};
|
|
3068
|
-
return /* @__PURE__ */ (0,
|
|
3069
|
-
|
|
3997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3998
|
+
import_ui_core11.DisclosurePanel,
|
|
3070
3999
|
{
|
|
3071
4000
|
title: "Line style",
|
|
3072
4001
|
containerClassName: "w-full bg-default-bg",
|
|
3073
|
-
children: /* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3075
|
-
|
|
4002
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
4003
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4004
|
+
import_ui_core11.NewButtonGroup,
|
|
3076
4005
|
{
|
|
3077
4006
|
buttons: lineStyles,
|
|
3078
4007
|
value: config?.style || "Solid",
|
|
@@ -3080,8 +4009,8 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3080
4009
|
small: true
|
|
3081
4010
|
}
|
|
3082
4011
|
),
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3084
|
-
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4013
|
+
import_ui_core11.Checkbox,
|
|
3085
4014
|
{
|
|
3086
4015
|
label: "Smooth Curves",
|
|
3087
4016
|
checked: config?.smooth,
|
|
@@ -3094,16 +4023,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3094
4023
|
};
|
|
3095
4024
|
|
|
3096
4025
|
// src/charts/options/LabelControls.tsx
|
|
3097
|
-
var
|
|
4026
|
+
var import_react20 = require("react");
|
|
3098
4027
|
var import_immer5 = require("immer");
|
|
3099
|
-
var
|
|
3100
|
-
var
|
|
4028
|
+
var import_ui_core12 = require("@sentio/ui-core");
|
|
4029
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3101
4030
|
var initialConfig = {
|
|
3102
4031
|
columns: [],
|
|
3103
4032
|
alias: ""
|
|
3104
4033
|
};
|
|
3105
4034
|
var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
3106
|
-
(0,
|
|
4035
|
+
(0, import_react20.useEffect)(() => {
|
|
3107
4036
|
if (config?.columns && config.columns.length > 0 && !config.alias) {
|
|
3108
4037
|
const aliasParts = [];
|
|
3109
4038
|
config.columns.forEach((colConfig) => {
|
|
@@ -3133,31 +4062,31 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3133
4062
|
})
|
|
3134
4063
|
);
|
|
3135
4064
|
};
|
|
3136
|
-
const _defaultOpen = (0,
|
|
4065
|
+
const _defaultOpen = (0, import_react20.useMemo)(() => {
|
|
3137
4066
|
if (defaultOpen) {
|
|
3138
4067
|
return true;
|
|
3139
4068
|
}
|
|
3140
4069
|
return config?.alias !== "" || config?.columns && config.columns.length > 0;
|
|
3141
4070
|
}, [config, defaultOpen]);
|
|
3142
|
-
return /* @__PURE__ */ (0,
|
|
3143
|
-
|
|
4071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4072
|
+
import_ui_core12.DisclosurePanel,
|
|
3144
4073
|
{
|
|
3145
4074
|
title: "Label Controls",
|
|
3146
4075
|
defaultOpen: _defaultOpen,
|
|
3147
4076
|
containerClassName: "w-full bg-default-bg",
|
|
3148
|
-
children: /* @__PURE__ */ (0,
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
4077
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
4079
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "sm:text-icontent border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-2 font-medium", children: [
|
|
3151
4080
|
"Label Alias",
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3153
|
-
|
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4082
|
+
import_ui_core12.HelpIcon,
|
|
3154
4083
|
{
|
|
3155
|
-
text: /* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
4084
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
|
|
4085
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { children: "Series name override or template." }),
|
|
4086
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
3158
4087
|
"Ex.",
|
|
3159
4088
|
" ",
|
|
3160
|
-
/* @__PURE__ */ (0,
|
|
4089
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
|
|
3161
4090
|
" ",
|
|
3162
4091
|
"will be replaced with the value of the contract label."
|
|
3163
4092
|
] })
|
|
@@ -3165,7 +4094,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3165
4094
|
}
|
|
3166
4095
|
)
|
|
3167
4096
|
] }),
|
|
3168
|
-
/* @__PURE__ */ (0,
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3169
4098
|
"input",
|
|
3170
4099
|
{
|
|
3171
4100
|
type: "text",
|
|
@@ -3176,8 +4105,8 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3176
4105
|
}
|
|
3177
4106
|
)
|
|
3178
4107
|
] }),
|
|
3179
|
-
/* @__PURE__ */ (0,
|
|
3180
|
-
|
|
4108
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4109
|
+
import_ui_core12.Button,
|
|
3181
4110
|
{
|
|
3182
4111
|
type: "button",
|
|
3183
4112
|
role: "link",
|
|
@@ -3194,9 +4123,9 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3194
4123
|
|
|
3195
4124
|
// src/charts/options/PieChartControls.tsx
|
|
3196
4125
|
var import_immer6 = require("immer");
|
|
3197
|
-
var
|
|
3198
|
-
var
|
|
3199
|
-
var
|
|
4126
|
+
var import_lodash5 = require("lodash");
|
|
4127
|
+
var import_ui_core13 = require("@sentio/ui-core");
|
|
4128
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3200
4129
|
var defaultConfig = {
|
|
3201
4130
|
pieType: "Pie",
|
|
3202
4131
|
calculation: "LAST",
|
|
@@ -3217,7 +4146,7 @@ var PieTypeItems = [
|
|
|
3217
4146
|
{ label: "Donut", value: "Donut" }
|
|
3218
4147
|
];
|
|
3219
4148
|
function PieChartControls({ config, defaultOpen, onChange }) {
|
|
3220
|
-
config = (0,
|
|
4149
|
+
config = (0, import_lodash5.defaults)(config, defaultConfig);
|
|
3221
4150
|
function onCalculationChange(cal) {
|
|
3222
4151
|
config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
3223
4152
|
}
|
|
@@ -3231,15 +4160,15 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3231
4160
|
})
|
|
3232
4161
|
);
|
|
3233
4162
|
}
|
|
3234
|
-
return /* @__PURE__ */ (0,
|
|
3235
|
-
|
|
4163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4164
|
+
import_ui_core13.DisclosurePanel,
|
|
3236
4165
|
{
|
|
3237
4166
|
title: "Pie Chart Options",
|
|
3238
4167
|
defaultOpen,
|
|
3239
4168
|
containerClassName: "w-full bg-default-bg",
|
|
3240
|
-
children: /* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
|
|
4169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
4170
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4171
|
+
import_ui_core13.NewButtonGroup,
|
|
3243
4172
|
{
|
|
3244
4173
|
small: true,
|
|
3245
4174
|
buttons: PieTypeItems,
|
|
@@ -3247,22 +4176,22 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3247
4176
|
onChange: onPieTypeChange
|
|
3248
4177
|
}
|
|
3249
4178
|
) }),
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4180
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3253
4182
|
"select",
|
|
3254
4183
|
{
|
|
3255
4184
|
value: config.calculation,
|
|
3256
4185
|
className: "sm:text-ilabel text-text-foreground border-main hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
3257
4186
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3258
4187
|
children: CalculationItems.map((d) => {
|
|
3259
|
-
return /* @__PURE__ */ (0,
|
|
4188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3260
4189
|
})
|
|
3261
4190
|
}
|
|
3262
4191
|
)
|
|
3263
4192
|
] }),
|
|
3264
|
-
/* @__PURE__ */ (0,
|
|
3265
|
-
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4194
|
+
import_ui_core13.Checkbox,
|
|
3266
4195
|
{
|
|
3267
4196
|
checked: config?.showValue,
|
|
3268
4197
|
onChange: (v) => toggle("showValue", v),
|
|
@@ -3270,8 +4199,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3270
4199
|
labelClassName: "whitespace-nowrap"
|
|
3271
4200
|
}
|
|
3272
4201
|
),
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3274
|
-
|
|
4202
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4203
|
+
import_ui_core13.Checkbox,
|
|
3275
4204
|
{
|
|
3276
4205
|
checked: config?.showPercent,
|
|
3277
4206
|
onChange: (v) => toggle("showPercent", v),
|
|
@@ -3279,8 +4208,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3279
4208
|
labelClassName: "whitespace-nowrap"
|
|
3280
4209
|
}
|
|
3281
4210
|
),
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3283
|
-
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4212
|
+
import_ui_core13.Checkbox,
|
|
3284
4213
|
{
|
|
3285
4214
|
checked: config?.absValue,
|
|
3286
4215
|
onChange: (v) => toggle("absValue", v),
|
|
@@ -3295,9 +4224,9 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3295
4224
|
|
|
3296
4225
|
// src/charts/options/BarGaugeControls.tsx
|
|
3297
4226
|
var import_immer7 = require("immer");
|
|
3298
|
-
var
|
|
3299
|
-
var
|
|
3300
|
-
var
|
|
4227
|
+
var import_lodash6 = require("lodash");
|
|
4228
|
+
var import_ui_core14 = require("@sentio/ui-core");
|
|
4229
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3301
4230
|
var defaultConfig2 = {
|
|
3302
4231
|
direction: "HORIZONTAL",
|
|
3303
4232
|
calculation: "LAST",
|
|
@@ -3327,7 +4256,7 @@ var orderItems = [
|
|
|
3327
4256
|
{ label: "Descendant", value: "true" }
|
|
3328
4257
|
];
|
|
3329
4258
|
function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
3330
|
-
config = (0,
|
|
4259
|
+
config = (0, import_lodash6.defaults)(config, defaultConfig2);
|
|
3331
4260
|
function onCalculationChange(cal) {
|
|
3332
4261
|
config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
3333
4262
|
}
|
|
@@ -3342,70 +4271,70 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3342
4271
|
})
|
|
3343
4272
|
);
|
|
3344
4273
|
}
|
|
3345
|
-
function onSortByChange(
|
|
4274
|
+
function onSortByChange(sortBy3) {
|
|
3346
4275
|
config && onChange(
|
|
3347
4276
|
(0, import_immer7.produce)(config, (draft) => {
|
|
3348
4277
|
draft.sort = draft.sort || {};
|
|
3349
|
-
draft.sort.sortBy =
|
|
4278
|
+
draft.sort.sortBy = sortBy3;
|
|
3350
4279
|
})
|
|
3351
4280
|
);
|
|
3352
4281
|
}
|
|
3353
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
-
|
|
4282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4283
|
+
import_ui_core14.DisclosurePanel,
|
|
3355
4284
|
{
|
|
3356
4285
|
title: "Bar Gauge Options",
|
|
3357
4286
|
defaultOpen,
|
|
3358
4287
|
containerClassName: "w-full bg-default-bg",
|
|
3359
|
-
children: /* @__PURE__ */ (0,
|
|
3360
|
-
/* @__PURE__ */ (0,
|
|
3361
|
-
/* @__PURE__ */ (0,
|
|
3362
|
-
/* @__PURE__ */ (0,
|
|
4288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
4289
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Direction" }),
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3363
4292
|
"select",
|
|
3364
4293
|
{
|
|
3365
4294
|
value: config.direction,
|
|
3366
4295
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
3367
4296
|
onChange: (e) => onDirectionChange(e.target.value),
|
|
3368
4297
|
children: directionItems.map((d) => {
|
|
3369
|
-
return /* @__PURE__ */ (0,
|
|
4298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3370
4299
|
})
|
|
3371
4300
|
}
|
|
3372
4301
|
)
|
|
3373
4302
|
] }),
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
3375
|
-
/* @__PURE__ */ (0,
|
|
3376
|
-
/* @__PURE__ */ (0,
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center rounded-l-md border border-r-0 bg-gray-50 px-3 ", children: "Calculation" }),
|
|
4305
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3377
4306
|
"select",
|
|
3378
4307
|
{
|
|
3379
4308
|
value: config.calculation,
|
|
3380
4309
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border pl-4 pr-7",
|
|
3381
4310
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3382
4311
|
children: CalculationItems2.map((d) => {
|
|
3383
|
-
return /* @__PURE__ */ (0,
|
|
4312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3384
4313
|
})
|
|
3385
4314
|
}
|
|
3386
4315
|
)
|
|
3387
4316
|
] }),
|
|
3388
|
-
/* @__PURE__ */ (0,
|
|
3389
|
-
/* @__PURE__ */ (0,
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4318
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sm:text-ilabel border-main inline-flex items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-50 px-3", children: "Sort by" }),
|
|
4319
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3391
4320
|
"select",
|
|
3392
4321
|
{
|
|
3393
4322
|
value: config?.sort?.sortBy,
|
|
3394
4323
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center border pl-4 pr-7",
|
|
3395
4324
|
onChange: (e) => onSortByChange(e.target.value),
|
|
3396
4325
|
children: sortByItems.map((d) => {
|
|
3397
|
-
return /* @__PURE__ */ (0,
|
|
4326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3398
4327
|
})
|
|
3399
4328
|
}
|
|
3400
4329
|
),
|
|
3401
|
-
/* @__PURE__ */ (0,
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3402
4331
|
"select",
|
|
3403
4332
|
{
|
|
3404
4333
|
value: config?.sort?.orderDesc + "",
|
|
3405
4334
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 focus:ring-3 focus:ring-primary-600/30 focus:border-primary-600 inline-flex items-center rounded-r-md border border-l-0 pl-4 pr-7",
|
|
3406
4335
|
onChange: (e) => onOrderChange(e.target.value === "true"),
|
|
3407
4336
|
children: orderItems.map((d) => {
|
|
3408
|
-
return /* @__PURE__ */ (0,
|
|
4337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value + "", children: d.label }, d.label);
|
|
3409
4338
|
})
|
|
3410
4339
|
}
|
|
3411
4340
|
)
|
|
@@ -3417,13 +4346,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3417
4346
|
|
|
3418
4347
|
// src/charts/options/ValueOptions.tsx
|
|
3419
4348
|
var import_immer9 = require("immer");
|
|
3420
|
-
var
|
|
4349
|
+
var import_ui_core16 = require("@sentio/ui-core");
|
|
3421
4350
|
|
|
3422
4351
|
// src/charts/options/ValueStringMapping.tsx
|
|
3423
|
-
var
|
|
3424
|
-
var
|
|
4352
|
+
var import_lu5 = require("react-icons/lu");
|
|
4353
|
+
var import_ui_core15 = require("@sentio/ui-core");
|
|
3425
4354
|
var import_immer8 = require("immer");
|
|
3426
|
-
var
|
|
4355
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3427
4356
|
var operators = {
|
|
3428
4357
|
">": "greater than",
|
|
3429
4358
|
">=": "greater or equal",
|
|
@@ -3433,17 +4362,17 @@ var operators = {
|
|
|
3433
4362
|
"<=": "less or equal"
|
|
3434
4363
|
};
|
|
3435
4364
|
var renderTreeLine = (index, isLast) => {
|
|
3436
|
-
return /* @__PURE__ */ (0,
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
4365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex h-full w-full items-center", children: [
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3438
4367
|
"div",
|
|
3439
4368
|
{
|
|
3440
|
-
className: (0,
|
|
4369
|
+
className: (0, import_ui_core15.classNames)(
|
|
3441
4370
|
"w-px bg-gray-300",
|
|
3442
4371
|
isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
|
|
3443
4372
|
)
|
|
3444
4373
|
}
|
|
3445
4374
|
),
|
|
3446
|
-
/* @__PURE__ */ (0,
|
|
4375
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "h-px w-3 bg-gray-300" })
|
|
3447
4376
|
] }) });
|
|
3448
4377
|
};
|
|
3449
4378
|
function ValueStringMapping({ rules, onChange }) {
|
|
@@ -3474,31 +4403,31 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3474
4403
|
})
|
|
3475
4404
|
);
|
|
3476
4405
|
}
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
4406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
|
|
3478
4407
|
(rules || []).map((rule, index) => {
|
|
3479
4408
|
const isLast = index === (rules || []).length - 1;
|
|
3480
|
-
return /* @__PURE__ */ (0,
|
|
4409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3481
4410
|
"div",
|
|
3482
4411
|
{
|
|
3483
4412
|
className: "text-text-foreground flex h-10 items-center py-1",
|
|
3484
4413
|
children: [
|
|
3485
4414
|
renderTreeLine(index, isLast),
|
|
3486
|
-
/* @__PURE__ */ (0,
|
|
3487
|
-
/* @__PURE__ */ (0,
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3488
4417
|
"select",
|
|
3489
4418
|
{
|
|
3490
4419
|
value: rule.comparison,
|
|
3491
4420
|
onChange: (e) => changeRule(index, "comparison", e.target.value),
|
|
3492
4421
|
className: "rounded-r-0 sm:text-ilabel border-main text-text-foreground focus:border-primary-600 focus:ring-3 focus:ring-primary-600/30 inline-flex h-full items-center rounded-l-md border border-r-0 bg-gray-50 py-1 pl-4 pr-7",
|
|
3493
4422
|
children: Object.entries(operators).map(([op, display]) => {
|
|
3494
|
-
return /* @__PURE__ */ (0,
|
|
4423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("option", { value: op, children: [
|
|
3495
4424
|
"is ",
|
|
3496
4425
|
display
|
|
3497
4426
|
] }, op);
|
|
3498
4427
|
})
|
|
3499
4428
|
}
|
|
3500
4429
|
),
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3502
4431
|
"input",
|
|
3503
4432
|
{
|
|
3504
4433
|
type: "text",
|
|
@@ -3512,8 +4441,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3512
4441
|
}
|
|
3513
4442
|
}
|
|
3514
4443
|
),
|
|
3515
|
-
/* @__PURE__ */ (0,
|
|
3516
|
-
/* @__PURE__ */ (0,
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
|
|
4445
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3517
4446
|
"input",
|
|
3518
4447
|
{
|
|
3519
4448
|
type: "text",
|
|
@@ -3527,15 +4456,15 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3527
4456
|
}
|
|
3528
4457
|
}
|
|
3529
4458
|
),
|
|
3530
|
-
/* @__PURE__ */ (0,
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3531
4460
|
"button",
|
|
3532
4461
|
{
|
|
3533
4462
|
type: "button",
|
|
3534
4463
|
className: "mx-2",
|
|
3535
4464
|
"aria-label": "remove",
|
|
3536
4465
|
onClick: () => removeRule(index),
|
|
3537
|
-
children: /* @__PURE__ */ (0,
|
|
3538
|
-
|
|
4466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4467
|
+
import_lu5.LuTrash2,
|
|
3539
4468
|
{
|
|
3540
4469
|
className: "icon text-text-foreground-disabled",
|
|
3541
4470
|
"aria-hidden": "true"
|
|
@@ -3548,8 +4477,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3548
4477
|
index
|
|
3549
4478
|
);
|
|
3550
4479
|
}),
|
|
3551
|
-
/* @__PURE__ */ (0,
|
|
3552
|
-
|
|
4480
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4481
|
+
import_ui_core15.Button,
|
|
3553
4482
|
{
|
|
3554
4483
|
type: "button",
|
|
3555
4484
|
role: "secondary",
|
|
@@ -3557,7 +4486,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3557
4486
|
"aria-label": "remove",
|
|
3558
4487
|
onClick: addRule,
|
|
3559
4488
|
children: [
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
4489
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lu5.LuPlus, { className: (0, import_ui_core15.classNames)("h-4 w-4"), "aria-hidden": "true" }),
|
|
3561
4490
|
"Add Formatting Rule"
|
|
3562
4491
|
]
|
|
3563
4492
|
}
|
|
@@ -3566,7 +4495,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3566
4495
|
}
|
|
3567
4496
|
|
|
3568
4497
|
// src/charts/options/ValueOptions.tsx
|
|
3569
|
-
var
|
|
4498
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3570
4499
|
var ValueFormatters = [
|
|
3571
4500
|
{ label: "Number", value: "NumberFormatter" },
|
|
3572
4501
|
{ label: "Date", value: "DateFormatter" },
|
|
@@ -3595,10 +4524,10 @@ var CurrencySymbols = [
|
|
|
3595
4524
|
var AddonLabel = ({
|
|
3596
4525
|
className,
|
|
3597
4526
|
children
|
|
3598
|
-
}) => /* @__PURE__ */ (0,
|
|
4527
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3599
4528
|
"span",
|
|
3600
4529
|
{
|
|
3601
|
-
className: (0,
|
|
4530
|
+
className: (0, import_ui_core16.classNames)(
|
|
3602
4531
|
"sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
|
|
3603
4532
|
className
|
|
3604
4533
|
),
|
|
@@ -3671,9 +4600,9 @@ var ValueOptions = ({
|
|
|
3671
4600
|
function numberAddons(style) {
|
|
3672
4601
|
switch (style) {
|
|
3673
4602
|
case "None":
|
|
3674
|
-
return /* @__PURE__ */ (0,
|
|
3675
|
-
/* @__PURE__ */ (0,
|
|
3676
|
-
/* @__PURE__ */ (0,
|
|
4603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
|
|
4605
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3677
4606
|
"input",
|
|
3678
4607
|
{
|
|
3679
4608
|
disabled: true,
|
|
@@ -3684,9 +4613,9 @@ var ValueOptions = ({
|
|
|
3684
4613
|
] });
|
|
3685
4614
|
case "Percent":
|
|
3686
4615
|
case "Standard":
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3688
|
-
/* @__PURE__ */ (0,
|
|
3689
|
-
/* @__PURE__ */ (0,
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3690
4619
|
"input",
|
|
3691
4620
|
{
|
|
3692
4621
|
type: "number",
|
|
@@ -3700,10 +4629,10 @@ var ValueOptions = ({
|
|
|
3700
4629
|
)
|
|
3701
4630
|
] });
|
|
3702
4631
|
case "Currency":
|
|
3703
|
-
return /* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3705
|
-
/* @__PURE__ */ (0,
|
|
3706
|
-
|
|
4632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4633
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
|
|
4634
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4635
|
+
import_ui_core16.ComboInput,
|
|
3707
4636
|
{
|
|
3708
4637
|
onChange: onChangeSymbol,
|
|
3709
4638
|
options: CurrencySymbols.map((s) => s.value),
|
|
@@ -3715,8 +4644,8 @@ var ValueOptions = ({
|
|
|
3715
4644
|
value: config?.currencySymbol
|
|
3716
4645
|
}
|
|
3717
4646
|
) }),
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border", children: "Precision" }),
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3720
4649
|
"input",
|
|
3721
4650
|
{
|
|
3722
4651
|
type: "number",
|
|
@@ -3731,9 +4660,9 @@ var ValueOptions = ({
|
|
|
3731
4660
|
)
|
|
3732
4661
|
] });
|
|
3733
4662
|
default:
|
|
3734
|
-
return /* @__PURE__ */ (0,
|
|
3735
|
-
/* @__PURE__ */ (0,
|
|
3736
|
-
/* @__PURE__ */ (0,
|
|
4663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4664
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3737
4666
|
"input",
|
|
3738
4667
|
{
|
|
3739
4668
|
type: "number",
|
|
@@ -3748,62 +4677,62 @@ var ValueOptions = ({
|
|
|
3748
4677
|
] });
|
|
3749
4678
|
}
|
|
3750
4679
|
}
|
|
3751
|
-
return /* @__PURE__ */ (0,
|
|
3752
|
-
/* @__PURE__ */ (0,
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
4680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4681
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex", children: [
|
|
4682
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
|
|
4683
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3755
4684
|
"select",
|
|
3756
4685
|
{
|
|
3757
4686
|
value: config.valueFormatter,
|
|
3758
|
-
className: (0,
|
|
4687
|
+
className: (0, import_ui_core16.classNames)(
|
|
3759
4688
|
"sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1.5 pl-4 pr-7 focus:ring-0",
|
|
3760
4689
|
config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
|
|
3761
4690
|
),
|
|
3762
4691
|
onChange: (e) => onChangeFormatter(e.target.value),
|
|
3763
4692
|
children: formatters.map((d) => {
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
4693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3765
4694
|
})
|
|
3766
4695
|
}
|
|
3767
4696
|
),
|
|
3768
|
-
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0,
|
|
3769
|
-
/* @__PURE__ */ (0,
|
|
3770
|
-
/* @__PURE__ */ (0,
|
|
4697
|
+
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3771
4700
|
"select",
|
|
3772
4701
|
{
|
|
3773
4702
|
value: config.style,
|
|
3774
4703
|
className: "sm:text-ilabel border-main text-text-foreground hover:border-primary-600 inline-flex items-center border py-1 pl-4 pr-7 focus:ring-0",
|
|
3775
4704
|
onChange: (e) => onStyleChange(e.target.value),
|
|
3776
4705
|
children: [
|
|
3777
|
-
/* @__PURE__ */ (0,
|
|
3778
|
-
/* @__PURE__ */ (0,
|
|
3779
|
-
/* @__PURE__ */ (0,
|
|
3780
|
-
/* @__PURE__ */ (0,
|
|
3781
|
-
/* @__PURE__ */ (0,
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
4706
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "None", children: "None" }),
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "Compact", children: "Compact" }),
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "Standard", children: "Standard" }),
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "Scientific", children: "Scientific" }),
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "Percent", children: "Percent" }),
|
|
4711
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "Currency", children: "Currency" })
|
|
3783
4712
|
]
|
|
3784
4713
|
}
|
|
3785
4714
|
),
|
|
3786
4715
|
config.style && numberAddons(config.style)
|
|
3787
4716
|
] }),
|
|
3788
|
-
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
4717
|
+
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4718
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonLabel, { className: "border border-l-0", children: "Date format" }),
|
|
4719
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3791
4720
|
"select",
|
|
3792
4721
|
{
|
|
3793
4722
|
value: config.dateFormat,
|
|
3794
4723
|
className: "sm:text-ilabel border-main text-text-foreground inline-flex items-center rounded-r-md border border-l-0 py-1 pl-4 pr-7",
|
|
3795
4724
|
onChange: (e) => onChangeDateFormat(e.target.value),
|
|
3796
4725
|
children: dateFormats.map((d) => {
|
|
3797
|
-
return /* @__PURE__ */ (0,
|
|
4726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3798
4727
|
})
|
|
3799
4728
|
}
|
|
3800
4729
|
)
|
|
3801
4730
|
] })
|
|
3802
4731
|
] }) }),
|
|
3803
|
-
(showPrefix || showSuffix) && /* @__PURE__ */ (0,
|
|
3804
|
-
showPrefix && /* @__PURE__ */ (0,
|
|
3805
|
-
/* @__PURE__ */ (0,
|
|
3806
|
-
/* @__PURE__ */ (0,
|
|
4732
|
+
(showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
|
|
4733
|
+
showPrefix && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3807
4736
|
"input",
|
|
3808
4737
|
{
|
|
3809
4738
|
type: "text",
|
|
@@ -3814,9 +4743,9 @@ var ValueOptions = ({
|
|
|
3814
4743
|
}
|
|
3815
4744
|
)
|
|
3816
4745
|
] }),
|
|
3817
|
-
showSuffix && /* @__PURE__ */ (0,
|
|
3818
|
-
/* @__PURE__ */ (0,
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
4746
|
+
showSuffix && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "border-main hover:border-primary-600 focus-within:border-primary-600 focus-within:ring-3 focus-within:ring-primary-500/30 text-icontent inline-flex items-center rounded-md border", children: [
|
|
4747
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
|
|
4748
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3820
4749
|
"input",
|
|
3821
4750
|
{
|
|
3822
4751
|
type: "text",
|
|
@@ -3828,7 +4757,7 @@ var ValueOptions = ({
|
|
|
3828
4757
|
)
|
|
3829
4758
|
] })
|
|
3830
4759
|
] }) }),
|
|
3831
|
-
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0,
|
|
4760
|
+
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3832
4761
|
ValueStringMapping,
|
|
3833
4762
|
{
|
|
3834
4763
|
rules: config.mappingRules || [],
|
|
@@ -3839,10 +4768,10 @@ var ValueOptions = ({
|
|
|
3839
4768
|
};
|
|
3840
4769
|
|
|
3841
4770
|
// src/charts/options/ValueControls.tsx
|
|
3842
|
-
var
|
|
3843
|
-
var
|
|
4771
|
+
var import_lodash7 = require("lodash");
|
|
4772
|
+
var import_ui_core17 = require("@sentio/ui-core");
|
|
3844
4773
|
var import_immer10 = require("immer");
|
|
3845
|
-
var
|
|
4774
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3846
4775
|
var defaultConfig4 = {
|
|
3847
4776
|
valueFormatter: "NumberFormatter",
|
|
3848
4777
|
showValueLabel: false,
|
|
@@ -3860,7 +4789,7 @@ var ValueControls = ({
|
|
|
3860
4789
|
showPrefix,
|
|
3861
4790
|
showSuffix
|
|
3862
4791
|
}) => {
|
|
3863
|
-
config = (0,
|
|
4792
|
+
config = (0, import_lodash7.defaults)(config || {}, defaultConfig4);
|
|
3864
4793
|
function toggleShowValueLabel(checked) {
|
|
3865
4794
|
config && onChange(
|
|
3866
4795
|
(0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
|
|
@@ -3869,14 +4798,14 @@ var ValueControls = ({
|
|
|
3869
4798
|
function toggleTooltipTotal(checked) {
|
|
3870
4799
|
config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
|
|
3871
4800
|
}
|
|
3872
|
-
return /* @__PURE__ */ (0,
|
|
3873
|
-
|
|
4801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
4802
|
+
import_ui_core17.DisclosurePanel,
|
|
3874
4803
|
{
|
|
3875
4804
|
title: "Value Options",
|
|
3876
4805
|
defaultOpen,
|
|
3877
4806
|
containerClassName: "w-full bg-default-bg",
|
|
3878
4807
|
children: [
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3880
4809
|
ValueOptions,
|
|
3881
4810
|
{
|
|
3882
4811
|
onChange,
|
|
@@ -3886,17 +4815,17 @@ var ValueControls = ({
|
|
|
3886
4815
|
showSuffix
|
|
3887
4816
|
}
|
|
3888
4817
|
),
|
|
3889
|
-
/* @__PURE__ */ (0,
|
|
3890
|
-
/* @__PURE__ */ (0,
|
|
3891
|
-
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4820
|
+
import_ui_core17.Checkbox,
|
|
3892
4821
|
{
|
|
3893
4822
|
checked: config?.showValueLabel,
|
|
3894
4823
|
onChange: toggleShowValueLabel,
|
|
3895
4824
|
label: "Show value label"
|
|
3896
4825
|
}
|
|
3897
4826
|
),
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4828
|
+
import_ui_core17.Checkbox,
|
|
3900
4829
|
{
|
|
3901
4830
|
checked: config?.tooltipTotal,
|
|
3902
4831
|
onChange: toggleTooltipTotal,
|
|
@@ -3914,10 +4843,12 @@ var ValueControls = ({
|
|
|
3914
4843
|
AreaIcon,
|
|
3915
4844
|
ArgumentInput,
|
|
3916
4845
|
ArgumentType,
|
|
4846
|
+
BarGaugeChart,
|
|
3917
4847
|
BarGaugeControls,
|
|
3918
4848
|
BarGuageIcon,
|
|
3919
4849
|
BarIcon,
|
|
3920
4850
|
ChartLegend,
|
|
4851
|
+
ChartTooltip,
|
|
3921
4852
|
ChartTypeButtonGroup,
|
|
3922
4853
|
EventsFunctionCategories,
|
|
3923
4854
|
EventsFunctionMap,
|
|
@@ -3930,12 +4861,15 @@ var ValueControls = ({
|
|
|
3930
4861
|
LabelsInput,
|
|
3931
4862
|
LineControls,
|
|
3932
4863
|
LineIcon,
|
|
4864
|
+
PieChart,
|
|
3933
4865
|
PieChartControls,
|
|
3934
4866
|
PieIcon,
|
|
4867
|
+
QueryValueChart,
|
|
3935
4868
|
QueryValueIcon,
|
|
3936
4869
|
ReactEChartsBase,
|
|
3937
4870
|
RefreshButton,
|
|
3938
4871
|
RefreshContext,
|
|
4872
|
+
ScatterChartTooltip,
|
|
3939
4873
|
ScatterIcon,
|
|
3940
4874
|
SystemLabels,
|
|
3941
4875
|
TableIcon,
|