@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.mjs
CHANGED
|
@@ -2989,6 +2989,930 @@ var ChartTypeButtonGroup = ({
|
|
|
2989
2989
|
) });
|
|
2990
2990
|
};
|
|
2991
2991
|
|
|
2992
|
+
// src/charts/ChartTooltip.tsx
|
|
2993
|
+
import { Fragment as Fragment5, useMemo as useMemo5 } from "react";
|
|
2994
|
+
import dayjs from "dayjs";
|
|
2995
|
+
import utc from "dayjs/plugin/utc";
|
|
2996
|
+
import timezone from "dayjs/plugin/timezone";
|
|
2997
|
+
import { isNumber, some, sortBy as sortBy2 } from "lodash";
|
|
2998
|
+
import BigDecimal from "@sentio/bigdecimal";
|
|
2999
|
+
import { LuCircleUserRound, LuList } from "react-icons/lu";
|
|
3000
|
+
import { CopyButton, classNames as classNames5 } from "@sentio/ui-core";
|
|
3001
|
+
|
|
3002
|
+
// src/charts/duration.ts
|
|
3003
|
+
var longUnits = {
|
|
3004
|
+
s: "seconds",
|
|
3005
|
+
m: "minutes",
|
|
3006
|
+
h: "hours",
|
|
3007
|
+
d: "days",
|
|
3008
|
+
w: "weeks",
|
|
3009
|
+
M: "months",
|
|
3010
|
+
y: "years"
|
|
3011
|
+
};
|
|
3012
|
+
function durationToLongString(d) {
|
|
3013
|
+
const u = longUnits[d.unit ?? ""] ?? "";
|
|
3014
|
+
return Number(d.value) === 1 ? u.replace(/s$/, "") : u;
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
// src/charts/ChartTooltip.tsx
|
|
3018
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3019
|
+
dayjs.extend(utc);
|
|
3020
|
+
dayjs.extend(timezone);
|
|
3021
|
+
function isValidValue(value, includeZero) {
|
|
3022
|
+
if (includeZero) {
|
|
3023
|
+
return Number.isFinite(value);
|
|
3024
|
+
} else {
|
|
3025
|
+
return Number.isFinite(value) && value !== 0;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function ChartTooltip({
|
|
3029
|
+
data,
|
|
3030
|
+
numberFormatter,
|
|
3031
|
+
compareTimeDuration,
|
|
3032
|
+
highlightSeriesId,
|
|
3033
|
+
title,
|
|
3034
|
+
showTotal,
|
|
3035
|
+
onViewLogs,
|
|
3036
|
+
viewLogDisabled,
|
|
3037
|
+
onViewUsers,
|
|
3038
|
+
viewUsersDisabled,
|
|
3039
|
+
isFixed
|
|
3040
|
+
}) {
|
|
3041
|
+
const {
|
|
3042
|
+
series,
|
|
3043
|
+
hasCompare,
|
|
3044
|
+
hasCurrent,
|
|
3045
|
+
currentTime,
|
|
3046
|
+
compareTime,
|
|
3047
|
+
markers,
|
|
3048
|
+
compareMarkers,
|
|
3049
|
+
total,
|
|
3050
|
+
compareTotal
|
|
3051
|
+
} = useMemo5(() => {
|
|
3052
|
+
const params = sortBy2(data, (p) => -p.value[1]);
|
|
3053
|
+
const hasCompare2 = some(
|
|
3054
|
+
params,
|
|
3055
|
+
(param) => param.seriesId.endsWith("_compare")
|
|
3056
|
+
);
|
|
3057
|
+
const seriesData = {};
|
|
3058
|
+
const markers2 = {};
|
|
3059
|
+
const compareMarkers2 = {};
|
|
3060
|
+
let currentTime2;
|
|
3061
|
+
let compareTime2;
|
|
3062
|
+
let total2 = new BigDecimal(0);
|
|
3063
|
+
let compareTotal2 = new BigDecimal(0);
|
|
3064
|
+
for (const p of params) {
|
|
3065
|
+
const { marker, seriesName, value, seriesId } = p;
|
|
3066
|
+
if (seriesId.endsWith("_compare")) {
|
|
3067
|
+
const id = seriesId.replace("_compare", "");
|
|
3068
|
+
compareMarkers2[id] = marker;
|
|
3069
|
+
if (compareTime2 === void 0) {
|
|
3070
|
+
compareTime2 = dayjs(value[0]);
|
|
3071
|
+
}
|
|
3072
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3073
|
+
seriesData[id] = {
|
|
3074
|
+
seriesId: id,
|
|
3075
|
+
...seriesData[id],
|
|
3076
|
+
compareValue: value[1],
|
|
3077
|
+
compareTime: value[0],
|
|
3078
|
+
seriesName
|
|
3079
|
+
};
|
|
3080
|
+
compareTotal2 = compareTotal2.plus(value[1]);
|
|
3081
|
+
}
|
|
3082
|
+
} else {
|
|
3083
|
+
markers2[seriesId] = marker;
|
|
3084
|
+
if (currentTime2 === void 0) {
|
|
3085
|
+
currentTime2 = dayjs(value[0]);
|
|
3086
|
+
}
|
|
3087
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3088
|
+
seriesData[seriesId] = {
|
|
3089
|
+
seriesId,
|
|
3090
|
+
...seriesData[seriesId],
|
|
3091
|
+
time: value[0],
|
|
3092
|
+
value: value[1],
|
|
3093
|
+
seriesName
|
|
3094
|
+
};
|
|
3095
|
+
total2 = total2.plus(value[1]);
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
const series2 = sortBy2(Object.values(seriesData), (s) => -s.value);
|
|
3100
|
+
const hasCurrent2 = series2[0]?.value !== void 0;
|
|
3101
|
+
if (compareTimeDuration && compareTime2 && !currentTime2) {
|
|
3102
|
+
currentTime2 = compareTime2.add(
|
|
3103
|
+
Number(compareTimeDuration.value),
|
|
3104
|
+
compareTimeDuration.unit
|
|
3105
|
+
);
|
|
3106
|
+
}
|
|
3107
|
+
return {
|
|
3108
|
+
series: series2,
|
|
3109
|
+
hasCompare: hasCompare2,
|
|
3110
|
+
currentTime: currentTime2,
|
|
3111
|
+
compareTime: compareTime2,
|
|
3112
|
+
hasCurrent: hasCurrent2,
|
|
3113
|
+
markers: markers2,
|
|
3114
|
+
compareMarkers: compareMarkers2,
|
|
3115
|
+
total: total2,
|
|
3116
|
+
compareTotal: compareTotal2
|
|
3117
|
+
};
|
|
3118
|
+
}, [data]);
|
|
3119
|
+
const renderRow = (p, idx) => {
|
|
3120
|
+
const { seriesName, compareValue, value, seriesId } = p;
|
|
3121
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3122
|
+
const marker = markers[seriesId];
|
|
3123
|
+
const diff = hasCompare && hasCurrent && compareValue != null && value != null ? new BigDecimal(value).minus(compareValue).div(compareValue).toNumber() : void 0;
|
|
3124
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, idx);
|
|
3125
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, idx);
|
|
3126
|
+
return /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
3127
|
+
/* @__PURE__ */ jsxs14(
|
|
3128
|
+
"div",
|
|
3129
|
+
{
|
|
3130
|
+
className: classNames5(
|
|
3131
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3132
|
+
"group",
|
|
3133
|
+
highlighted ? "highlighted" : ""
|
|
3134
|
+
),
|
|
3135
|
+
style: { minWidth: "4rem" },
|
|
3136
|
+
children: [
|
|
3137
|
+
/* @__PURE__ */ jsx20("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3138
|
+
/* @__PURE__ */ jsx20("span", { className: "truncate", children: seriesName }),
|
|
3139
|
+
showViewLogs && isFixed && /* @__PURE__ */ jsx20(
|
|
3140
|
+
"button",
|
|
3141
|
+
{
|
|
3142
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3143
|
+
onClick: (e) => {
|
|
3144
|
+
e.preventDefault();
|
|
3145
|
+
e.stopPropagation();
|
|
3146
|
+
onViewLogs(seriesId, idx);
|
|
3147
|
+
},
|
|
3148
|
+
title: "View logs",
|
|
3149
|
+
children: /* @__PURE__ */ jsx20(LuList, { className: "h-4 w-4" })
|
|
3150
|
+
}
|
|
3151
|
+
),
|
|
3152
|
+
showViewUsers && isFixed && /* @__PURE__ */ jsx20(
|
|
3153
|
+
"button",
|
|
3154
|
+
{
|
|
3155
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3156
|
+
onClick: (e) => {
|
|
3157
|
+
e.preventDefault();
|
|
3158
|
+
e.stopPropagation();
|
|
3159
|
+
onViewUsers(seriesId, idx);
|
|
3160
|
+
},
|
|
3161
|
+
title: "View users",
|
|
3162
|
+
children: /* @__PURE__ */ jsx20(LuCircleUserRound, { className: "h-4 w-4" })
|
|
3163
|
+
}
|
|
3164
|
+
),
|
|
3165
|
+
isFixed && /* @__PURE__ */ jsx20(
|
|
3166
|
+
CopyButton,
|
|
3167
|
+
{
|
|
3168
|
+
size: 16,
|
|
3169
|
+
text: seriesName,
|
|
3170
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3171
|
+
}
|
|
3172
|
+
)
|
|
3173
|
+
]
|
|
3174
|
+
},
|
|
3175
|
+
idx
|
|
3176
|
+
),
|
|
3177
|
+
/* @__PURE__ */ jsxs14(
|
|
3178
|
+
"div",
|
|
3179
|
+
{
|
|
3180
|
+
className: classNames5(
|
|
3181
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3182
|
+
highlighted ? "highlighted" : ""
|
|
3183
|
+
),
|
|
3184
|
+
children: [
|
|
3185
|
+
/* @__PURE__ */ jsx20("span", { children: hasCurrent ? numberFormatter(value, seriesId) : "-" }),
|
|
3186
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ jsxs14(
|
|
3187
|
+
"span",
|
|
3188
|
+
{
|
|
3189
|
+
className: classNames5(
|
|
3190
|
+
"ml-1 text-xs",
|
|
3191
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3192
|
+
),
|
|
3193
|
+
children: [
|
|
3194
|
+
diff > 0 ? "+" : "",
|
|
3195
|
+
(diff * 100).toFixed(2),
|
|
3196
|
+
"%"
|
|
3197
|
+
]
|
|
3198
|
+
}
|
|
3199
|
+
)
|
|
3200
|
+
]
|
|
3201
|
+
},
|
|
3202
|
+
`${idx}-value`
|
|
3203
|
+
)
|
|
3204
|
+
] }, idx);
|
|
3205
|
+
};
|
|
3206
|
+
const renderCompareRow = (p, idx) => {
|
|
3207
|
+
const { seriesName, compareValue, seriesId } = p;
|
|
3208
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3209
|
+
const compareMarker = compareMarkers[seriesId];
|
|
3210
|
+
return /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
3211
|
+
/* @__PURE__ */ jsxs14(
|
|
3212
|
+
"div",
|
|
3213
|
+
{
|
|
3214
|
+
className: classNames5(
|
|
3215
|
+
"sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate",
|
|
3216
|
+
highlighted ? "highlighted" : ""
|
|
3217
|
+
),
|
|
3218
|
+
style: { minWidth: "4rem" },
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ jsx20(
|
|
3221
|
+
"span",
|
|
3222
|
+
{
|
|
3223
|
+
dangerouslySetInnerHTML: { __html: compareMarker || "" }
|
|
3224
|
+
}
|
|
3225
|
+
),
|
|
3226
|
+
seriesName
|
|
3227
|
+
]
|
|
3228
|
+
},
|
|
3229
|
+
idx
|
|
3230
|
+
),
|
|
3231
|
+
/* @__PURE__ */ jsx20(
|
|
3232
|
+
"div",
|
|
3233
|
+
{
|
|
3234
|
+
className: classNames5(
|
|
3235
|
+
"sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold",
|
|
3236
|
+
highlighted ? "highlighted" : ""
|
|
3237
|
+
),
|
|
3238
|
+
children: isNumber(compareValue) ? numberFormatter(compareValue, seriesId) : "-"
|
|
3239
|
+
},
|
|
3240
|
+
`${idx}-value`
|
|
3241
|
+
)
|
|
3242
|
+
] }, idx);
|
|
3243
|
+
};
|
|
3244
|
+
const renderTotalRow = () => {
|
|
3245
|
+
if (!showTotal || series.length < 2) return null;
|
|
3246
|
+
const diff = hasCompare && hasCurrent && total && compareTotal ? total.minus(compareTotal).div(compareTotal).toNumber() : void 0;
|
|
3247
|
+
return /* @__PURE__ */ jsxs14("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
|
|
3248
|
+
/* @__PURE__ */ jsx20("div", { className: "sentio-tooltip-item series-name text-text-foreground truncate font-semibold", children: "Total" }),
|
|
3249
|
+
/* @__PURE__ */ jsxs14("div", { className: "sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold", children: [
|
|
3250
|
+
/* @__PURE__ */ jsx20("span", { children: hasCurrent ? numberFormatter(total.toNumber()) : "-" }),
|
|
3251
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ jsxs14(
|
|
3252
|
+
"span",
|
|
3253
|
+
{
|
|
3254
|
+
className: classNames5(
|
|
3255
|
+
"ml-1 text-xs",
|
|
3256
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3257
|
+
),
|
|
3258
|
+
children: [
|
|
3259
|
+
diff > 0 ? "+" : "",
|
|
3260
|
+
(diff * 100).toFixed(2),
|
|
3261
|
+
"%"
|
|
3262
|
+
]
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
] })
|
|
3266
|
+
] });
|
|
3267
|
+
};
|
|
3268
|
+
const renderCompareTotalRow = () => {
|
|
3269
|
+
if (!showTotal || series.length < 2 || !hasCompare) return null;
|
|
3270
|
+
return /* @__PURE__ */ jsxs14("div", { className: "border-border-color col-span-2 mt-1 flex items-center justify-between border-t pt-1", children: [
|
|
3271
|
+
/* @__PURE__ */ jsx20("div", { className: "sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate font-semibold", children: "Total" }),
|
|
3272
|
+
/* @__PURE__ */ jsx20("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: isNumber(compareTotal) ? numberFormatter(compareTotal.toNumber()) : "-" })
|
|
3273
|
+
] });
|
|
3274
|
+
};
|
|
3275
|
+
return /* @__PURE__ */ jsxs14(
|
|
3276
|
+
"div",
|
|
3277
|
+
{
|
|
3278
|
+
className: classNames5("grid w-full px-2"),
|
|
3279
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3280
|
+
children: [
|
|
3281
|
+
/* @__PURE__ */ jsx20(
|
|
3282
|
+
"div",
|
|
3283
|
+
{
|
|
3284
|
+
className: classNames5(
|
|
3285
|
+
"pl-2",
|
|
3286
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3287
|
+
),
|
|
3288
|
+
children: title ?? currentTime?.format("YYYY-MM-DD HH:mm:ss")
|
|
3289
|
+
}
|
|
3290
|
+
),
|
|
3291
|
+
!series || series.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) : /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3292
|
+
series.map((s, idx) => renderRow(s, idx)),
|
|
3293
|
+
renderTotalRow(),
|
|
3294
|
+
hasCompare && compareTimeDuration && /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3295
|
+
/* @__PURE__ */ jsxs14(
|
|
3296
|
+
"div",
|
|
3297
|
+
{
|
|
3298
|
+
className: classNames5(
|
|
3299
|
+
"mt-2 pl-2",
|
|
3300
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3301
|
+
),
|
|
3302
|
+
children: [
|
|
3303
|
+
compareTime?.format("YYYY-MM-DD HH:mm:ss"),
|
|
3304
|
+
" (previous",
|
|
3305
|
+
" ",
|
|
3306
|
+
durationToLongString(compareTimeDuration),
|
|
3307
|
+
")"
|
|
3308
|
+
]
|
|
3309
|
+
}
|
|
3310
|
+
),
|
|
3311
|
+
series.map((s, idx) => renderCompareRow(s, idx)),
|
|
3312
|
+
renderCompareTotalRow()
|
|
3313
|
+
] })
|
|
3314
|
+
] })
|
|
3315
|
+
]
|
|
3316
|
+
}
|
|
3317
|
+
);
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
// src/charts/ScatterChartTooltip.tsx
|
|
3321
|
+
import { Fragment as Fragment7, useMemo as useMemo6 } from "react";
|
|
3322
|
+
import dayjs2 from "dayjs";
|
|
3323
|
+
import utc2 from "dayjs/plugin/utc";
|
|
3324
|
+
import timezone2 from "dayjs/plugin/timezone";
|
|
3325
|
+
import { isNumber as isNumber2 } from "lodash";
|
|
3326
|
+
import { LuCircleUserRound as LuCircleUserRound2, LuList as LuList2 } from "react-icons/lu";
|
|
3327
|
+
import { CopyButton as CopyButton2, classNames as classNames6 } from "@sentio/ui-core";
|
|
3328
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3329
|
+
dayjs2.extend(utc2);
|
|
3330
|
+
dayjs2.extend(timezone2);
|
|
3331
|
+
function ScatterChartTooltip({
|
|
3332
|
+
data,
|
|
3333
|
+
numberFormatter,
|
|
3334
|
+
highlightSeriesId,
|
|
3335
|
+
title,
|
|
3336
|
+
onViewLogs,
|
|
3337
|
+
viewLogDisabled,
|
|
3338
|
+
onViewUsers,
|
|
3339
|
+
viewUsersDisabled,
|
|
3340
|
+
isFixed,
|
|
3341
|
+
sizeTitle = "Size"
|
|
3342
|
+
}) {
|
|
3343
|
+
const { point, seriesName, seriesId, marker } = useMemo6(() => {
|
|
3344
|
+
const param = Array.isArray(data) ? data[0] : data;
|
|
3345
|
+
return {
|
|
3346
|
+
point: param,
|
|
3347
|
+
seriesName: param?.seriesName || "",
|
|
3348
|
+
seriesId: param?.seriesId || "",
|
|
3349
|
+
marker: param?.marker || ""
|
|
3350
|
+
};
|
|
3351
|
+
}, [data]);
|
|
3352
|
+
if (!point || !point.value) {
|
|
3353
|
+
return /* @__PURE__ */ jsx21("div", { className: "w-full px-2", children: /* @__PURE__ */ jsx21("div", { className: "text-text-foreground-secondary pl-2 text-sm", children: "No data available" }) });
|
|
3354
|
+
}
|
|
3355
|
+
const { value } = point;
|
|
3356
|
+
const [xValue, yValue, sizeValue] = value;
|
|
3357
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3358
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, 0);
|
|
3359
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, 0);
|
|
3360
|
+
const formatValue = (val) => {
|
|
3361
|
+
if (val instanceof Date) {
|
|
3362
|
+
return dayjs2(val).format("YYYY-MM-DD HH:mm:ss");
|
|
3363
|
+
} else if (isNumber2(val)) {
|
|
3364
|
+
return numberFormatter(val);
|
|
3365
|
+
} else {
|
|
3366
|
+
return String(val);
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3369
|
+
return /* @__PURE__ */ jsxs15(
|
|
3370
|
+
"div",
|
|
3371
|
+
{
|
|
3372
|
+
className: classNames6("grid w-full px-2"),
|
|
3373
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3374
|
+
children: [
|
|
3375
|
+
/* @__PURE__ */ jsx21(
|
|
3376
|
+
"div",
|
|
3377
|
+
{
|
|
3378
|
+
className: classNames6(
|
|
3379
|
+
"mb-2 pl-2",
|
|
3380
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3381
|
+
),
|
|
3382
|
+
children: title ?? dayjs2(xValue).format("YYYY-MM-DD HH:mm:ss")
|
|
3383
|
+
}
|
|
3384
|
+
),
|
|
3385
|
+
/* @__PURE__ */ jsxs15(
|
|
3386
|
+
"div",
|
|
3387
|
+
{
|
|
3388
|
+
className: classNames6(
|
|
3389
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3390
|
+
"group",
|
|
3391
|
+
highlighted ? "highlighted" : ""
|
|
3392
|
+
),
|
|
3393
|
+
style: { minWidth: "4rem" },
|
|
3394
|
+
children: [
|
|
3395
|
+
/* @__PURE__ */ jsx21("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3396
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate", children: seriesName }),
|
|
3397
|
+
showViewLogs && isFixed && /* @__PURE__ */ jsx21(
|
|
3398
|
+
"button",
|
|
3399
|
+
{
|
|
3400
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3401
|
+
onClick: (e) => {
|
|
3402
|
+
e.preventDefault();
|
|
3403
|
+
e.stopPropagation();
|
|
3404
|
+
onViewLogs(seriesId, 0);
|
|
3405
|
+
},
|
|
3406
|
+
title: "View logs",
|
|
3407
|
+
children: /* @__PURE__ */ jsx21(LuList2, { className: "h-4 w-4" })
|
|
3408
|
+
}
|
|
3409
|
+
),
|
|
3410
|
+
showViewUsers && isFixed && /* @__PURE__ */ jsx21(
|
|
3411
|
+
"button",
|
|
3412
|
+
{
|
|
3413
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3414
|
+
onClick: (e) => {
|
|
3415
|
+
e.preventDefault();
|
|
3416
|
+
e.stopPropagation();
|
|
3417
|
+
onViewUsers(seriesId, 0);
|
|
3418
|
+
},
|
|
3419
|
+
title: "View users",
|
|
3420
|
+
children: /* @__PURE__ */ jsx21(LuCircleUserRound2, { className: "h-4 w-4" })
|
|
3421
|
+
}
|
|
3422
|
+
),
|
|
3423
|
+
isFixed && /* @__PURE__ */ jsx21(
|
|
3424
|
+
CopyButton2,
|
|
3425
|
+
{
|
|
3426
|
+
size: 16,
|
|
3427
|
+
text: seriesName,
|
|
3428
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3429
|
+
}
|
|
3430
|
+
)
|
|
3431
|
+
]
|
|
3432
|
+
}
|
|
3433
|
+
),
|
|
3434
|
+
/* @__PURE__ */ jsx21(
|
|
3435
|
+
"div",
|
|
3436
|
+
{
|
|
3437
|
+
className: classNames6(
|
|
3438
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3439
|
+
highlighted ? "highlighted" : ""
|
|
3440
|
+
),
|
|
3441
|
+
children: /* @__PURE__ */ jsx21("span", { children: formatValue(yValue) })
|
|
3442
|
+
}
|
|
3443
|
+
),
|
|
3444
|
+
sizeValue !== void 0 && sizeValue !== null && /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
3445
|
+
/* @__PURE__ */ jsx21("div", { className: "border-border-color col-span-2 my-2 w-full border-t" }),
|
|
3446
|
+
/* @__PURE__ */ jsx21(
|
|
3447
|
+
"div",
|
|
3448
|
+
{
|
|
3449
|
+
className: "sentio-tooltip-item series-name text-text-foreground-secondary truncate",
|
|
3450
|
+
style: { minWidth: "4rem" },
|
|
3451
|
+
children: sizeTitle
|
|
3452
|
+
}
|
|
3453
|
+
),
|
|
3454
|
+
/* @__PURE__ */ jsx21("div", { className: "sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold", children: formatValue(sizeValue) })
|
|
3455
|
+
] })
|
|
3456
|
+
]
|
|
3457
|
+
}
|
|
3458
|
+
);
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
// src/charts/PieChart.tsx
|
|
3462
|
+
import { forwardRef as forwardRef2, useEffect as useEffect6, useState as useState8 } from "react";
|
|
3463
|
+
import { useResizeDetector as useResizeDetector3 } from "react-resize-detector";
|
|
3464
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3465
|
+
var theresholdWidth = 480;
|
|
3466
|
+
var TOOLTIP_MIN_VIEWPORT_LEFT = 8;
|
|
3467
|
+
var TOOLTIP_MIN_VIEWPORT_RIGHT = 8;
|
|
3468
|
+
var PieChart2 = forwardRef2(
|
|
3469
|
+
(props, ref) => {
|
|
3470
|
+
const {
|
|
3471
|
+
series,
|
|
3472
|
+
valueFormatter,
|
|
3473
|
+
config,
|
|
3474
|
+
title,
|
|
3475
|
+
minHeight,
|
|
3476
|
+
loading,
|
|
3477
|
+
style,
|
|
3478
|
+
onInitChart
|
|
3479
|
+
} = props;
|
|
3480
|
+
const [options, setOptions] = useState8({});
|
|
3481
|
+
const isDarkMode = useDarkMode();
|
|
3482
|
+
const isMobile2 = isMobile();
|
|
3483
|
+
const { width, ref: resizeRef } = useResizeDetector3({
|
|
3484
|
+
refreshMode: "debounce",
|
|
3485
|
+
refreshRate: 500,
|
|
3486
|
+
handleHeight: false
|
|
3487
|
+
});
|
|
3488
|
+
const tooltipPosition = (point, _params, _dom, _rect, size) => {
|
|
3489
|
+
const chartRect = resizeRef.current?.getBoundingClientRect();
|
|
3490
|
+
const chartLeft = chartRect?.left ?? 0;
|
|
3491
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : size.viewSize[0];
|
|
3492
|
+
const [w, h] = size.contentSize;
|
|
3493
|
+
const minXInChart = TOOLTIP_MIN_VIEWPORT_LEFT - chartLeft;
|
|
3494
|
+
const maxXInChart = winW - TOOLTIP_MIN_VIEWPORT_RIGHT - chartLeft - w;
|
|
3495
|
+
let x = point[0] + 12;
|
|
3496
|
+
if (x > maxXInChart) {
|
|
3497
|
+
x = point[0] - w - 12;
|
|
3498
|
+
}
|
|
3499
|
+
if (x < minXInChart) x = minXInChart;
|
|
3500
|
+
if (x > maxXInChart) x = maxXInChart;
|
|
3501
|
+
const y = Math.max(0, point[1] - h / 2);
|
|
3502
|
+
return [x, y];
|
|
3503
|
+
};
|
|
3504
|
+
useEffect6(() => {
|
|
3505
|
+
const isHLegend = width && width < theresholdWidth;
|
|
3506
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : 1024;
|
|
3507
|
+
const tooltipMaxWidth = Math.max(160, Math.min(280, winW - 48));
|
|
3508
|
+
const tooltipExtraCss = isMobile2 ? `max-width: ${tooltipMaxWidth}px; white-space: normal; word-break: break-word; overflow-wrap: anywhere;` : "";
|
|
3509
|
+
const d = [];
|
|
3510
|
+
series.forEach((s) => {
|
|
3511
|
+
if (s.data.length > 0 && s.data[0] && s.data[0][1] != null) {
|
|
3512
|
+
const rawValue = s.data[0][1];
|
|
3513
|
+
if (config?.pieConfig?.absValue) {
|
|
3514
|
+
d.push({ name: s.name, value: Math.abs(rawValue) });
|
|
3515
|
+
} else if (rawValue > 0) {
|
|
3516
|
+
d.push({ name: s.name, value: rawValue });
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
});
|
|
3520
|
+
const total = d.reduce((acc, cur) => acc + cur.value, 0);
|
|
3521
|
+
d.sort((a, b) => {
|
|
3522
|
+
const percentA = a.value / total * 100;
|
|
3523
|
+
const percentB = b.value / total * 100;
|
|
3524
|
+
return percentB - percentA;
|
|
3525
|
+
});
|
|
3526
|
+
const pieSeries = [
|
|
3527
|
+
{
|
|
3528
|
+
type: "pie",
|
|
3529
|
+
radius: [config?.pieConfig?.pieType == "Donut" ? "40%" : 0, "70%"],
|
|
3530
|
+
center: isHLegend ? ["50%", "50%"] : ["35%", "50%"],
|
|
3531
|
+
label: { show: false },
|
|
3532
|
+
labelLine: { length: 10, length2: 10, maxSurfaceAngle: 50 },
|
|
3533
|
+
data: d
|
|
3534
|
+
}
|
|
3535
|
+
];
|
|
3536
|
+
const options2 = {
|
|
3537
|
+
title: { text: title, left: 8 },
|
|
3538
|
+
legend: isHLegend ? {
|
|
3539
|
+
type: "scroll",
|
|
3540
|
+
orient: "horizontal",
|
|
3541
|
+
bottom: 12,
|
|
3542
|
+
left: "center",
|
|
3543
|
+
animation: true,
|
|
3544
|
+
animationDurationUpdate: 300,
|
|
3545
|
+
pageIconSize: [10, 8],
|
|
3546
|
+
pageButtonItemGap: 2,
|
|
3547
|
+
pageButtonGap: 4,
|
|
3548
|
+
textStyle: {
|
|
3549
|
+
width: width ? width * 0.4 : 100,
|
|
3550
|
+
overflow: "truncate"
|
|
3551
|
+
},
|
|
3552
|
+
tooltip: {
|
|
3553
|
+
show: true,
|
|
3554
|
+
appendToBody: true,
|
|
3555
|
+
extraCssText: tooltipExtraCss,
|
|
3556
|
+
position: tooltipPosition,
|
|
3557
|
+
formatter: function(params) {
|
|
3558
|
+
const name = params.name;
|
|
3559
|
+
const item = d.find((i) => i.name === name);
|
|
3560
|
+
let ret = name;
|
|
3561
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3562
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3563
|
+
}
|
|
3564
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3565
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3566
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3567
|
+
${percent}%`;
|
|
3568
|
+
}
|
|
3569
|
+
return ret;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
} : {
|
|
3573
|
+
type: "scroll",
|
|
3574
|
+
orient: "vertical",
|
|
3575
|
+
right: 16,
|
|
3576
|
+
top: title ? 48 : 8,
|
|
3577
|
+
width: "35%",
|
|
3578
|
+
animation: true,
|
|
3579
|
+
animationDurationUpdate: 300,
|
|
3580
|
+
tooltip: {
|
|
3581
|
+
show: true,
|
|
3582
|
+
appendToBody: true,
|
|
3583
|
+
extraCssText: tooltipExtraCss,
|
|
3584
|
+
position: tooltipPosition,
|
|
3585
|
+
formatter: function(params) {
|
|
3586
|
+
const name = params.name;
|
|
3587
|
+
const item = d.find((i) => i.name === name);
|
|
3588
|
+
let ret = name;
|
|
3589
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3590
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3591
|
+
}
|
|
3592
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3593
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3594
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3595
|
+
${percent}%`;
|
|
3596
|
+
}
|
|
3597
|
+
return ret;
|
|
3598
|
+
}
|
|
3599
|
+
},
|
|
3600
|
+
icon: "roundRect",
|
|
3601
|
+
itemWidth: 12,
|
|
3602
|
+
itemHeight: 12,
|
|
3603
|
+
itemGap: 6,
|
|
3604
|
+
show: true,
|
|
3605
|
+
pageIconSize: [8, 10],
|
|
3606
|
+
pageButtonGap: 4,
|
|
3607
|
+
pageButtonItemGap: 2,
|
|
3608
|
+
pageIconColor: isDarkMode ? "#909399" : "#4E5969",
|
|
3609
|
+
pageIconInactiveColor: isDarkMode ? "#606266" : "#C9CDD4",
|
|
3610
|
+
textStyle: {
|
|
3611
|
+
width: width ? width * 0.3 : "auto",
|
|
3612
|
+
overflow: "truncate",
|
|
3613
|
+
lineHeight: 16,
|
|
3614
|
+
fontSize: 12,
|
|
3615
|
+
rich: { value: { padding: [4, 0, 0, 0] } }
|
|
3616
|
+
},
|
|
3617
|
+
formatter: (name) => {
|
|
3618
|
+
const item = d.find((i) => i.name === name);
|
|
3619
|
+
let ret = name;
|
|
3620
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3621
|
+
ret += "\n" + valueFormatter(item.value);
|
|
3622
|
+
}
|
|
3623
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3624
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3625
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3626
|
+
${percent}%`;
|
|
3627
|
+
}
|
|
3628
|
+
return ret;
|
|
3629
|
+
}
|
|
3630
|
+
},
|
|
3631
|
+
tooltip: {
|
|
3632
|
+
trigger: "item",
|
|
3633
|
+
appendToBody: true,
|
|
3634
|
+
extraCssText: tooltipExtraCss,
|
|
3635
|
+
position: tooltipPosition,
|
|
3636
|
+
formatter: ({ name, data, percent }) => {
|
|
3637
|
+
let ret = `${name}`;
|
|
3638
|
+
if (config?.pieConfig?.showValue) {
|
|
3639
|
+
ret += "<br/>" + valueFormatter(data.value);
|
|
3640
|
+
}
|
|
3641
|
+
if (config?.pieConfig?.showPercent) {
|
|
3642
|
+
ret += config.pieConfig.showValue ? ` (${percent}%)` : `
|
|
3643
|
+
${percent}%`;
|
|
3644
|
+
}
|
|
3645
|
+
return ret;
|
|
3646
|
+
}
|
|
3647
|
+
},
|
|
3648
|
+
toolbox: { show: false },
|
|
3649
|
+
animation: false,
|
|
3650
|
+
series: pieSeries
|
|
3651
|
+
};
|
|
3652
|
+
setOptions(options2);
|
|
3653
|
+
}, [series, config, valueFormatter, isDarkMode, isMobile2, width, title]);
|
|
3654
|
+
return /* @__PURE__ */ jsx22("div", { className: "h-full w-full", ref: resizeRef, children: /* @__PURE__ */ jsx22(
|
|
3655
|
+
ReactEChartsBase,
|
|
3656
|
+
{
|
|
3657
|
+
ref,
|
|
3658
|
+
loading,
|
|
3659
|
+
option: options,
|
|
3660
|
+
minHeight,
|
|
3661
|
+
style,
|
|
3662
|
+
noLegend: true,
|
|
3663
|
+
onInitChart
|
|
3664
|
+
}
|
|
3665
|
+
) });
|
|
3666
|
+
}
|
|
3667
|
+
);
|
|
3668
|
+
PieChart2.displayName = "PieChart";
|
|
3669
|
+
|
|
3670
|
+
// src/charts/BarGaugeChart.tsx
|
|
3671
|
+
import { forwardRef as forwardRef3, useEffect as useEffect7, useMemo as useMemo7, useState as useState9 } from "react";
|
|
3672
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3673
|
+
var compareOption = { numeric: true };
|
|
3674
|
+
var BarGaugeChart = forwardRef3(
|
|
3675
|
+
(props, ref) => {
|
|
3676
|
+
const {
|
|
3677
|
+
series: input,
|
|
3678
|
+
legend,
|
|
3679
|
+
valueFormatter,
|
|
3680
|
+
config,
|
|
3681
|
+
title,
|
|
3682
|
+
minHeight,
|
|
3683
|
+
loading,
|
|
3684
|
+
style,
|
|
3685
|
+
onInitChart
|
|
3686
|
+
} = props;
|
|
3687
|
+
const [series, setSeries] = useState9([]);
|
|
3688
|
+
const [xAxis, setXAxis] = useState9();
|
|
3689
|
+
const [yAxis, setYAxis] = useState9();
|
|
3690
|
+
const isVertical = config?.barGauge?.direction === "VERTICAL";
|
|
3691
|
+
useEffect7(() => {
|
|
3692
|
+
const tmpData = input.map((s) => {
|
|
3693
|
+
const d = s.data && s.data[0];
|
|
3694
|
+
return { name: s.name, value: d && d[1] };
|
|
3695
|
+
});
|
|
3696
|
+
const sort = config?.barGauge?.sort;
|
|
3697
|
+
switch (sort?.sortBy) {
|
|
3698
|
+
case "ByName":
|
|
3699
|
+
tmpData.sort(
|
|
3700
|
+
(a, b) => sort.orderDesc ? b.name.localeCompare(a.name, void 0, compareOption) : a.name.localeCompare(b.name, void 0, compareOption)
|
|
3701
|
+
);
|
|
3702
|
+
break;
|
|
3703
|
+
case "ByValue":
|
|
3704
|
+
tmpData.sort(
|
|
3705
|
+
(a, b) => sort.orderDesc ? b.value - a.value : a.value - b.value
|
|
3706
|
+
);
|
|
3707
|
+
break;
|
|
3708
|
+
}
|
|
3709
|
+
const series2 = [
|
|
3710
|
+
{
|
|
3711
|
+
type: "bar",
|
|
3712
|
+
data: tmpData.map((d) => d.value),
|
|
3713
|
+
label: {
|
|
3714
|
+
show: config?.valueConfig ? config.valueConfig.showValueLabel : false,
|
|
3715
|
+
position: config?.barGauge?.direction == "VERTICAL" ? "top" : "right",
|
|
3716
|
+
formatter: ({ value }) => valueFormatter(value)
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
];
|
|
3720
|
+
const seriesAxis = {
|
|
3721
|
+
type: "category",
|
|
3722
|
+
data: tmpData.map((s) => s.name),
|
|
3723
|
+
axisLabel: config?.barGauge?.direction == "VERTICAL" ? { interval: 0, rotate: 30 } : {}
|
|
3724
|
+
};
|
|
3725
|
+
if (config?.xAxis?.name) {
|
|
3726
|
+
seriesAxis.name = config?.xAxis?.name;
|
|
3727
|
+
seriesAxis.nameLocation = "middle";
|
|
3728
|
+
seriesAxis.nameGap = isVertical ? 45 : 60;
|
|
3729
|
+
}
|
|
3730
|
+
const valueAxis = {
|
|
3731
|
+
type: "value",
|
|
3732
|
+
axisLabel: (
|
|
3733
|
+
// show dates on value-axis label is weird
|
|
3734
|
+
config?.valueConfig?.valueFormatter == "DateFormatter" ? void 0 : { formatter: (v) => valueFormatter(v) }
|
|
3735
|
+
)
|
|
3736
|
+
};
|
|
3737
|
+
let xAxis2, yAxis2;
|
|
3738
|
+
switch (config?.barGauge?.direction) {
|
|
3739
|
+
case "VERTICAL":
|
|
3740
|
+
xAxis2 = seriesAxis;
|
|
3741
|
+
yAxis2 = valueAxis;
|
|
3742
|
+
break;
|
|
3743
|
+
case "HORIZONTAL":
|
|
3744
|
+
default:
|
|
3745
|
+
xAxis2 = valueAxis;
|
|
3746
|
+
yAxis2 = seriesAxis;
|
|
3747
|
+
}
|
|
3748
|
+
setSeries(series2);
|
|
3749
|
+
setXAxis(xAxis2);
|
|
3750
|
+
setYAxis(yAxis2);
|
|
3751
|
+
}, [
|
|
3752
|
+
input,
|
|
3753
|
+
config?.barGauge?.calculation,
|
|
3754
|
+
config?.barGauge?.sort,
|
|
3755
|
+
config?.valueConfig?.showValueLabel,
|
|
3756
|
+
config?.xAxis?.name,
|
|
3757
|
+
isVertical,
|
|
3758
|
+
valueFormatter
|
|
3759
|
+
]);
|
|
3760
|
+
const dataZoom = useMemo7(() => {
|
|
3761
|
+
if (config?.barGauge?.direction == "HORIZONTAL") {
|
|
3762
|
+
return [
|
|
3763
|
+
{
|
|
3764
|
+
show: series[0]?.data.length > 15,
|
|
3765
|
+
type: "slider",
|
|
3766
|
+
yAxisIndex: 0,
|
|
3767
|
+
zoomLock: true,
|
|
3768
|
+
width: 8,
|
|
3769
|
+
right: 10,
|
|
3770
|
+
top: 5,
|
|
3771
|
+
bottom: 30,
|
|
3772
|
+
minValueSpan: 5,
|
|
3773
|
+
maxValueSpan: 15,
|
|
3774
|
+
orient: "vertical",
|
|
3775
|
+
handleSize: 0,
|
|
3776
|
+
showDetail: false,
|
|
3777
|
+
brushSelect: false,
|
|
3778
|
+
showDataShadow: false
|
|
3779
|
+
},
|
|
3780
|
+
{
|
|
3781
|
+
type: "inside",
|
|
3782
|
+
id: "insideY",
|
|
3783
|
+
yAxisIndex: 0,
|
|
3784
|
+
zoomOnMouseWheel: false,
|
|
3785
|
+
moveOnMouseMove: true,
|
|
3786
|
+
moveOnMouseWheel: true
|
|
3787
|
+
}
|
|
3788
|
+
];
|
|
3789
|
+
} else {
|
|
3790
|
+
return [
|
|
3791
|
+
{
|
|
3792
|
+
show: series[0]?.data.length > 25,
|
|
3793
|
+
type: "slider",
|
|
3794
|
+
xAxisIndex: 0,
|
|
3795
|
+
zoomLock: true,
|
|
3796
|
+
height: 8,
|
|
3797
|
+
bottom: 5,
|
|
3798
|
+
maxValueSpan: 25,
|
|
3799
|
+
minValueSpan: 10,
|
|
3800
|
+
handleSize: "0",
|
|
3801
|
+
showDetail: false,
|
|
3802
|
+
orient: "horizontal",
|
|
3803
|
+
brushSelect: false,
|
|
3804
|
+
showDataShadow: false
|
|
3805
|
+
},
|
|
3806
|
+
{
|
|
3807
|
+
type: "inside",
|
|
3808
|
+
id: "insideX",
|
|
3809
|
+
xAxisIndex: 0,
|
|
3810
|
+
zoomOnMouseWheel: false,
|
|
3811
|
+
moveOnMouseMove: true,
|
|
3812
|
+
moveOnMouseWheel: true
|
|
3813
|
+
}
|
|
3814
|
+
];
|
|
3815
|
+
}
|
|
3816
|
+
}, [config, series]);
|
|
3817
|
+
const options = {
|
|
3818
|
+
title: { text: title },
|
|
3819
|
+
grid: {
|
|
3820
|
+
top: title ? 48 : 16,
|
|
3821
|
+
right: 40,
|
|
3822
|
+
bottom: isVertical && config?.xAxis?.name ? 40 : 16,
|
|
3823
|
+
left: !isVertical && config?.xAxis?.name ? 40 : 16,
|
|
3824
|
+
containLabel: true
|
|
3825
|
+
},
|
|
3826
|
+
xAxis,
|
|
3827
|
+
legend: { data: legend, top: -1e4, left: -1e4 },
|
|
3828
|
+
toolbox: { show: false },
|
|
3829
|
+
yAxis,
|
|
3830
|
+
dataZoom,
|
|
3831
|
+
animation: false,
|
|
3832
|
+
series,
|
|
3833
|
+
tooltip: {
|
|
3834
|
+
trigger: "axis",
|
|
3835
|
+
confine: true,
|
|
3836
|
+
extraCssText: "max-width: 50%; max-height: 50vh; overflow-y: auto;"
|
|
3837
|
+
}
|
|
3838
|
+
};
|
|
3839
|
+
return /* @__PURE__ */ jsx23("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx23(
|
|
3840
|
+
ReactEChartsBase,
|
|
3841
|
+
{
|
|
3842
|
+
ref,
|
|
3843
|
+
loading,
|
|
3844
|
+
option: options,
|
|
3845
|
+
minHeight,
|
|
3846
|
+
style,
|
|
3847
|
+
noLegend: true,
|
|
3848
|
+
onInitChart
|
|
3849
|
+
}
|
|
3850
|
+
) });
|
|
3851
|
+
}
|
|
3852
|
+
);
|
|
3853
|
+
BarGaugeChart.displayName = "BarGaugeChart";
|
|
3854
|
+
|
|
3855
|
+
// src/charts/QueryValueChart.tsx
|
|
3856
|
+
import { forwardRef as forwardRef4, useMemo as useMemo8 } from "react";
|
|
3857
|
+
import { useResizeDetector as useResizeDetector4 } from "react-resize-detector";
|
|
3858
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
3859
|
+
var QueryValueChart = forwardRef4(
|
|
3860
|
+
(props, ref) => {
|
|
3861
|
+
const {
|
|
3862
|
+
series,
|
|
3863
|
+
valueText,
|
|
3864
|
+
textColor,
|
|
3865
|
+
backgroundColor,
|
|
3866
|
+
minHeight,
|
|
3867
|
+
loading,
|
|
3868
|
+
style,
|
|
3869
|
+
onInitChart
|
|
3870
|
+
} = props;
|
|
3871
|
+
const { width, height, ref: ref2 } = useResizeDetector4();
|
|
3872
|
+
const fontSize = useMemo8(() => {
|
|
3873
|
+
return Math.min(
|
|
3874
|
+
(width || 0) / String(valueText).length,
|
|
3875
|
+
(height || 0) / 1.5
|
|
3876
|
+
);
|
|
3877
|
+
}, [width, height, valueText]);
|
|
3878
|
+
const options = {
|
|
3879
|
+
backgroundColor,
|
|
3880
|
+
grid: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
3881
|
+
toolbox: { show: false },
|
|
3882
|
+
animation: false,
|
|
3883
|
+
series,
|
|
3884
|
+
xAxis: { type: "time", show: false },
|
|
3885
|
+
yAxis: { type: "value", show: false },
|
|
3886
|
+
legend: { show: false },
|
|
3887
|
+
graphic: {
|
|
3888
|
+
type: "text",
|
|
3889
|
+
z: 100,
|
|
3890
|
+
left: "center",
|
|
3891
|
+
top: "middle",
|
|
3892
|
+
style: {
|
|
3893
|
+
text: valueText,
|
|
3894
|
+
fontSize,
|
|
3895
|
+
stroke: textColor,
|
|
3896
|
+
fill: textColor
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
return /* @__PURE__ */ jsx24("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx24("div", { className: "h-full w-full", ref: ref2, children: /* @__PURE__ */ jsx24(
|
|
3901
|
+
ReactEChartsBase,
|
|
3902
|
+
{
|
|
3903
|
+
ref,
|
|
3904
|
+
loading,
|
|
3905
|
+
option: options,
|
|
3906
|
+
minHeight,
|
|
3907
|
+
style,
|
|
3908
|
+
noLegend: true,
|
|
3909
|
+
onInitChart
|
|
3910
|
+
}
|
|
3911
|
+
) }) });
|
|
3912
|
+
}
|
|
3913
|
+
);
|
|
3914
|
+
QueryValueChart.displayName = "QueryValueChart";
|
|
3915
|
+
|
|
2992
3916
|
// src/charts/options/LineControls.tsx
|
|
2993
3917
|
import { produce as produce4 } from "immer";
|
|
2994
3918
|
import {
|
|
@@ -2996,7 +3920,7 @@ import {
|
|
|
2996
3920
|
NewButtonGroup as ButtonGroup2,
|
|
2997
3921
|
Checkbox
|
|
2998
3922
|
} from "@sentio/ui-core";
|
|
2999
|
-
import { jsx as
|
|
3923
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3000
3924
|
var lineStyles = [
|
|
3001
3925
|
{ label: "Solid", value: "Solid" },
|
|
3002
3926
|
{ label: "Dotted", value: "Dotted" }
|
|
@@ -3016,13 +3940,13 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3016
3940
|
})
|
|
3017
3941
|
);
|
|
3018
3942
|
};
|
|
3019
|
-
return /* @__PURE__ */
|
|
3943
|
+
return /* @__PURE__ */ jsx25(
|
|
3020
3944
|
DisclosurePanel,
|
|
3021
3945
|
{
|
|
3022
3946
|
title: "Line style",
|
|
3023
3947
|
containerClassName: "w-full bg-default-bg",
|
|
3024
|
-
children: /* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3948
|
+
children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-4", children: [
|
|
3949
|
+
/* @__PURE__ */ jsx25(
|
|
3026
3950
|
ButtonGroup2,
|
|
3027
3951
|
{
|
|
3028
3952
|
buttons: lineStyles,
|
|
@@ -3031,7 +3955,7 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3031
3955
|
small: true
|
|
3032
3956
|
}
|
|
3033
3957
|
),
|
|
3034
|
-
/* @__PURE__ */
|
|
3958
|
+
/* @__PURE__ */ jsx25(
|
|
3035
3959
|
Checkbox,
|
|
3036
3960
|
{
|
|
3037
3961
|
label: "Smooth Curves",
|
|
@@ -3045,16 +3969,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3045
3969
|
};
|
|
3046
3970
|
|
|
3047
3971
|
// src/charts/options/LabelControls.tsx
|
|
3048
|
-
import { useEffect as
|
|
3972
|
+
import { useEffect as useEffect8, useMemo as useMemo9 } from "react";
|
|
3049
3973
|
import { produce as produce5 } from "immer";
|
|
3050
3974
|
import { Button as NewButton2, DisclosurePanel as DisclosurePanel2, HelpIcon as HelpIcon2 } from "@sentio/ui-core";
|
|
3051
|
-
import { jsx as
|
|
3975
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3052
3976
|
var initialConfig = {
|
|
3053
3977
|
columns: [],
|
|
3054
3978
|
alias: ""
|
|
3055
3979
|
};
|
|
3056
3980
|
var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
3057
|
-
|
|
3981
|
+
useEffect8(() => {
|
|
3058
3982
|
if (config?.columns && config.columns.length > 0 && !config.alias) {
|
|
3059
3983
|
const aliasParts = [];
|
|
3060
3984
|
config.columns.forEach((colConfig) => {
|
|
@@ -3084,31 +4008,31 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3084
4008
|
})
|
|
3085
4009
|
);
|
|
3086
4010
|
};
|
|
3087
|
-
const _defaultOpen =
|
|
4011
|
+
const _defaultOpen = useMemo9(() => {
|
|
3088
4012
|
if (defaultOpen) {
|
|
3089
4013
|
return true;
|
|
3090
4014
|
}
|
|
3091
4015
|
return config?.alias !== "" || config?.columns && config.columns.length > 0;
|
|
3092
4016
|
}, [config, defaultOpen]);
|
|
3093
|
-
return /* @__PURE__ */
|
|
4017
|
+
return /* @__PURE__ */ jsx26(
|
|
3094
4018
|
DisclosurePanel2,
|
|
3095
4019
|
{
|
|
3096
4020
|
title: "Label Controls",
|
|
3097
4021
|
defaultOpen: _defaultOpen,
|
|
3098
4022
|
containerClassName: "w-full bg-default-bg",
|
|
3099
|
-
children: /* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3101
|
-
/* @__PURE__ */
|
|
4023
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
4024
|
+
/* @__PURE__ */ jsxs17("div", { className: "inline-flex h-8", children: [
|
|
4025
|
+
/* @__PURE__ */ jsxs17("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: [
|
|
3102
4026
|
"Label Alias",
|
|
3103
|
-
/* @__PURE__ */
|
|
4027
|
+
/* @__PURE__ */ jsx26(
|
|
3104
4028
|
HelpIcon2,
|
|
3105
4029
|
{
|
|
3106
|
-
text: /* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
4030
|
+
text: /* @__PURE__ */ jsxs17("div", { className: "text-icontent text-text-foreground", children: [
|
|
4031
|
+
/* @__PURE__ */ jsx26("div", { children: "Series name override or template." }),
|
|
4032
|
+
/* @__PURE__ */ jsxs17("div", { children: [
|
|
3109
4033
|
"Ex.",
|
|
3110
4034
|
" ",
|
|
3111
|
-
/* @__PURE__ */
|
|
4035
|
+
/* @__PURE__ */ jsx26("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
|
|
3112
4036
|
" ",
|
|
3113
4037
|
"will be replaced with the value of the contract label."
|
|
3114
4038
|
] })
|
|
@@ -3116,7 +4040,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3116
4040
|
}
|
|
3117
4041
|
)
|
|
3118
4042
|
] }),
|
|
3119
|
-
/* @__PURE__ */
|
|
4043
|
+
/* @__PURE__ */ jsx26(
|
|
3120
4044
|
"input",
|
|
3121
4045
|
{
|
|
3122
4046
|
type: "text",
|
|
@@ -3127,7 +4051,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3127
4051
|
}
|
|
3128
4052
|
)
|
|
3129
4053
|
] }),
|
|
3130
|
-
/* @__PURE__ */
|
|
4054
|
+
/* @__PURE__ */ jsx26(
|
|
3131
4055
|
NewButton2,
|
|
3132
4056
|
{
|
|
3133
4057
|
type: "button",
|
|
@@ -3151,7 +4075,7 @@ import {
|
|
|
3151
4075
|
DisclosurePanel as DisclosurePanel3,
|
|
3152
4076
|
NewButtonGroup as ButtonGroup3
|
|
3153
4077
|
} from "@sentio/ui-core";
|
|
3154
|
-
import { jsx as
|
|
4078
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3155
4079
|
var defaultConfig = {
|
|
3156
4080
|
pieType: "Pie",
|
|
3157
4081
|
calculation: "LAST",
|
|
@@ -3186,14 +4110,14 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3186
4110
|
})
|
|
3187
4111
|
);
|
|
3188
4112
|
}
|
|
3189
|
-
return /* @__PURE__ */
|
|
4113
|
+
return /* @__PURE__ */ jsx27(
|
|
3190
4114
|
DisclosurePanel3,
|
|
3191
4115
|
{
|
|
3192
4116
|
title: "Pie Chart Options",
|
|
3193
4117
|
defaultOpen,
|
|
3194
4118
|
containerClassName: "w-full bg-default-bg",
|
|
3195
|
-
children: /* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
4119
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-4", children: [
|
|
4120
|
+
/* @__PURE__ */ jsx27("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ jsx27(
|
|
3197
4121
|
ButtonGroup3,
|
|
3198
4122
|
{
|
|
3199
4123
|
small: true,
|
|
@@ -3202,21 +4126,21 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3202
4126
|
onChange: onPieTypeChange
|
|
3203
4127
|
}
|
|
3204
4128
|
) }),
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsxs18("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4130
|
+
/* @__PURE__ */ jsx27("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" }),
|
|
4131
|
+
/* @__PURE__ */ jsx27(
|
|
3208
4132
|
"select",
|
|
3209
4133
|
{
|
|
3210
4134
|
value: config.calculation,
|
|
3211
4135
|
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",
|
|
3212
4136
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3213
4137
|
children: CalculationItems.map((d) => {
|
|
3214
|
-
return /* @__PURE__ */
|
|
4138
|
+
return /* @__PURE__ */ jsx27("option", { value: d.value, children: d.label }, d.value);
|
|
3215
4139
|
})
|
|
3216
4140
|
}
|
|
3217
4141
|
)
|
|
3218
4142
|
] }),
|
|
3219
|
-
/* @__PURE__ */
|
|
4143
|
+
/* @__PURE__ */ jsx27(
|
|
3220
4144
|
Checkbox2,
|
|
3221
4145
|
{
|
|
3222
4146
|
checked: config?.showValue,
|
|
@@ -3225,7 +4149,7 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3225
4149
|
labelClassName: "whitespace-nowrap"
|
|
3226
4150
|
}
|
|
3227
4151
|
),
|
|
3228
|
-
/* @__PURE__ */
|
|
4152
|
+
/* @__PURE__ */ jsx27(
|
|
3229
4153
|
Checkbox2,
|
|
3230
4154
|
{
|
|
3231
4155
|
checked: config?.showPercent,
|
|
@@ -3234,7 +4158,7 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3234
4158
|
labelClassName: "whitespace-nowrap"
|
|
3235
4159
|
}
|
|
3236
4160
|
),
|
|
3237
|
-
/* @__PURE__ */
|
|
4161
|
+
/* @__PURE__ */ jsx27(
|
|
3238
4162
|
Checkbox2,
|
|
3239
4163
|
{
|
|
3240
4164
|
checked: config?.absValue,
|
|
@@ -3252,7 +4176,7 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3252
4176
|
import { produce as produce7 } from "immer";
|
|
3253
4177
|
import { defaults as defaults2 } from "lodash";
|
|
3254
4178
|
import { DisclosurePanel as DisclosurePanel4 } from "@sentio/ui-core";
|
|
3255
|
-
import { jsx as
|
|
4179
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3256
4180
|
var defaultConfig2 = {
|
|
3257
4181
|
direction: "HORIZONTAL",
|
|
3258
4182
|
calculation: "LAST",
|
|
@@ -3297,70 +4221,70 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3297
4221
|
})
|
|
3298
4222
|
);
|
|
3299
4223
|
}
|
|
3300
|
-
function onSortByChange(
|
|
4224
|
+
function onSortByChange(sortBy3) {
|
|
3301
4225
|
config && onChange(
|
|
3302
4226
|
produce7(config, (draft) => {
|
|
3303
4227
|
draft.sort = draft.sort || {};
|
|
3304
|
-
draft.sort.sortBy =
|
|
4228
|
+
draft.sort.sortBy = sortBy3;
|
|
3305
4229
|
})
|
|
3306
4230
|
);
|
|
3307
4231
|
}
|
|
3308
|
-
return /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsx28(
|
|
3309
4233
|
DisclosurePanel4,
|
|
3310
4234
|
{
|
|
3311
4235
|
title: "Bar Gauge Options",
|
|
3312
4236
|
defaultOpen,
|
|
3313
4237
|
containerClassName: "w-full bg-default-bg",
|
|
3314
|
-
children: /* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3316
|
-
/* @__PURE__ */
|
|
3317
|
-
/* @__PURE__ */
|
|
4238
|
+
children: /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-4", children: [
|
|
4239
|
+
/* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4240
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
4241
|
+
/* @__PURE__ */ jsx28(
|
|
3318
4242
|
"select",
|
|
3319
4243
|
{
|
|
3320
4244
|
value: config.direction,
|
|
3321
4245
|
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",
|
|
3322
4246
|
onChange: (e) => onDirectionChange(e.target.value),
|
|
3323
4247
|
children: directionItems.map((d) => {
|
|
3324
|
-
return /* @__PURE__ */
|
|
4248
|
+
return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
|
|
3325
4249
|
})
|
|
3326
4250
|
}
|
|
3327
4251
|
)
|
|
3328
4252
|
] }),
|
|
3329
|
-
/* @__PURE__ */
|
|
3330
|
-
/* @__PURE__ */
|
|
3331
|
-
/* @__PURE__ */
|
|
4253
|
+
/* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4254
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
4255
|
+
/* @__PURE__ */ jsx28(
|
|
3332
4256
|
"select",
|
|
3333
4257
|
{
|
|
3334
4258
|
value: config.calculation,
|
|
3335
4259
|
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",
|
|
3336
4260
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3337
4261
|
children: CalculationItems2.map((d) => {
|
|
3338
|
-
return /* @__PURE__ */
|
|
4262
|
+
return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
|
|
3339
4263
|
})
|
|
3340
4264
|
}
|
|
3341
4265
|
)
|
|
3342
4266
|
] }),
|
|
3343
|
-
/* @__PURE__ */
|
|
3344
|
-
/* @__PURE__ */
|
|
3345
|
-
/* @__PURE__ */
|
|
4267
|
+
/* @__PURE__ */ jsxs19("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4268
|
+
/* @__PURE__ */ jsx28("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" }),
|
|
4269
|
+
/* @__PURE__ */ jsx28(
|
|
3346
4270
|
"select",
|
|
3347
4271
|
{
|
|
3348
4272
|
value: config?.sort?.sortBy,
|
|
3349
4273
|
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",
|
|
3350
4274
|
onChange: (e) => onSortByChange(e.target.value),
|
|
3351
4275
|
children: sortByItems.map((d) => {
|
|
3352
|
-
return /* @__PURE__ */
|
|
4276
|
+
return /* @__PURE__ */ jsx28("option", { value: d.value, children: d.label }, d.value);
|
|
3353
4277
|
})
|
|
3354
4278
|
}
|
|
3355
4279
|
),
|
|
3356
|
-
/* @__PURE__ */
|
|
4280
|
+
/* @__PURE__ */ jsx28(
|
|
3357
4281
|
"select",
|
|
3358
4282
|
{
|
|
3359
4283
|
value: config?.sort?.orderDesc + "",
|
|
3360
4284
|
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",
|
|
3361
4285
|
onChange: (e) => onOrderChange(e.target.value === "true"),
|
|
3362
4286
|
children: orderItems.map((d) => {
|
|
3363
|
-
return /* @__PURE__ */
|
|
4287
|
+
return /* @__PURE__ */ jsx28("option", { value: d.value + "", children: d.label }, d.label);
|
|
3364
4288
|
})
|
|
3365
4289
|
}
|
|
3366
4290
|
)
|
|
@@ -3372,13 +4296,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3372
4296
|
|
|
3373
4297
|
// src/charts/options/ValueOptions.tsx
|
|
3374
4298
|
import { produce as produce9 } from "immer";
|
|
3375
|
-
import { ComboInput, classNames as
|
|
4299
|
+
import { ComboInput, classNames as classNames8 } from "@sentio/ui-core";
|
|
3376
4300
|
|
|
3377
4301
|
// src/charts/options/ValueStringMapping.tsx
|
|
3378
4302
|
import { LuPlus, LuTrash2 } from "react-icons/lu";
|
|
3379
|
-
import { Button, classNames as
|
|
4303
|
+
import { Button, classNames as classNames7 } from "@sentio/ui-core";
|
|
3380
4304
|
import { produce as produce8 } from "immer";
|
|
3381
|
-
import { jsx as
|
|
4305
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3382
4306
|
var operators = {
|
|
3383
4307
|
">": "greater than",
|
|
3384
4308
|
">=": "greater or equal",
|
|
@@ -3388,17 +4312,17 @@ var operators = {
|
|
|
3388
4312
|
"<=": "less or equal"
|
|
3389
4313
|
};
|
|
3390
4314
|
var renderTreeLine = (index, isLast) => {
|
|
3391
|
-
return /* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
4315
|
+
return /* @__PURE__ */ jsx29("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ jsxs20("div", { className: "flex h-full w-full items-center", children: [
|
|
4316
|
+
/* @__PURE__ */ jsx29(
|
|
3393
4317
|
"div",
|
|
3394
4318
|
{
|
|
3395
|
-
className:
|
|
4319
|
+
className: classNames7(
|
|
3396
4320
|
"w-px bg-gray-300",
|
|
3397
4321
|
isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
|
|
3398
4322
|
)
|
|
3399
4323
|
}
|
|
3400
4324
|
),
|
|
3401
|
-
/* @__PURE__ */
|
|
4325
|
+
/* @__PURE__ */ jsx29("div", { className: "h-px w-3 bg-gray-300" })
|
|
3402
4326
|
] }) });
|
|
3403
4327
|
};
|
|
3404
4328
|
function ValueStringMapping({ rules, onChange }) {
|
|
@@ -3429,31 +4353,31 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3429
4353
|
})
|
|
3430
4354
|
);
|
|
3431
4355
|
}
|
|
3432
|
-
return /* @__PURE__ */
|
|
4356
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex w-full flex-col rounded-md py-2", children: [
|
|
3433
4357
|
(rules || []).map((rule, index) => {
|
|
3434
4358
|
const isLast = index === (rules || []).length - 1;
|
|
3435
|
-
return /* @__PURE__ */
|
|
4359
|
+
return /* @__PURE__ */ jsxs20(
|
|
3436
4360
|
"div",
|
|
3437
4361
|
{
|
|
3438
4362
|
className: "text-text-foreground flex h-10 items-center py-1",
|
|
3439
4363
|
children: [
|
|
3440
4364
|
renderTreeLine(index, isLast),
|
|
3441
|
-
/* @__PURE__ */
|
|
3442
|
-
/* @__PURE__ */
|
|
4365
|
+
/* @__PURE__ */ jsx29("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
|
|
4366
|
+
/* @__PURE__ */ jsx29(
|
|
3443
4367
|
"select",
|
|
3444
4368
|
{
|
|
3445
4369
|
value: rule.comparison,
|
|
3446
4370
|
onChange: (e) => changeRule(index, "comparison", e.target.value),
|
|
3447
4371
|
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",
|
|
3448
4372
|
children: Object.entries(operators).map(([op, display]) => {
|
|
3449
|
-
return /* @__PURE__ */
|
|
4373
|
+
return /* @__PURE__ */ jsxs20("option", { value: op, children: [
|
|
3450
4374
|
"is ",
|
|
3451
4375
|
display
|
|
3452
4376
|
] }, op);
|
|
3453
4377
|
})
|
|
3454
4378
|
}
|
|
3455
4379
|
),
|
|
3456
|
-
/* @__PURE__ */
|
|
4380
|
+
/* @__PURE__ */ jsx29(
|
|
3457
4381
|
"input",
|
|
3458
4382
|
{
|
|
3459
4383
|
type: "text",
|
|
@@ -3467,8 +4391,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3467
4391
|
}
|
|
3468
4392
|
}
|
|
3469
4393
|
),
|
|
3470
|
-
/* @__PURE__ */
|
|
3471
|
-
/* @__PURE__ */
|
|
4394
|
+
/* @__PURE__ */ jsx29("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
|
|
4395
|
+
/* @__PURE__ */ jsx29(
|
|
3472
4396
|
"input",
|
|
3473
4397
|
{
|
|
3474
4398
|
type: "text",
|
|
@@ -3482,14 +4406,14 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3482
4406
|
}
|
|
3483
4407
|
}
|
|
3484
4408
|
),
|
|
3485
|
-
/* @__PURE__ */
|
|
4409
|
+
/* @__PURE__ */ jsx29(
|
|
3486
4410
|
"button",
|
|
3487
4411
|
{
|
|
3488
4412
|
type: "button",
|
|
3489
4413
|
className: "mx-2",
|
|
3490
4414
|
"aria-label": "remove",
|
|
3491
4415
|
onClick: () => removeRule(index),
|
|
3492
|
-
children: /* @__PURE__ */
|
|
4416
|
+
children: /* @__PURE__ */ jsx29(
|
|
3493
4417
|
LuTrash2,
|
|
3494
4418
|
{
|
|
3495
4419
|
className: "icon text-text-foreground-disabled",
|
|
@@ -3503,7 +4427,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3503
4427
|
index
|
|
3504
4428
|
);
|
|
3505
4429
|
}),
|
|
3506
|
-
/* @__PURE__ */
|
|
4430
|
+
/* @__PURE__ */ jsxs20(
|
|
3507
4431
|
Button,
|
|
3508
4432
|
{
|
|
3509
4433
|
type: "button",
|
|
@@ -3512,7 +4436,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3512
4436
|
"aria-label": "remove",
|
|
3513
4437
|
onClick: addRule,
|
|
3514
4438
|
children: [
|
|
3515
|
-
/* @__PURE__ */
|
|
4439
|
+
/* @__PURE__ */ jsx29(LuPlus, { className: classNames7("h-4 w-4"), "aria-hidden": "true" }),
|
|
3516
4440
|
"Add Formatting Rule"
|
|
3517
4441
|
]
|
|
3518
4442
|
}
|
|
@@ -3521,7 +4445,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3521
4445
|
}
|
|
3522
4446
|
|
|
3523
4447
|
// src/charts/options/ValueOptions.tsx
|
|
3524
|
-
import { Fragment as
|
|
4448
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3525
4449
|
var ValueFormatters = [
|
|
3526
4450
|
{ label: "Number", value: "NumberFormatter" },
|
|
3527
4451
|
{ label: "Date", value: "DateFormatter" },
|
|
@@ -3550,10 +4474,10 @@ var CurrencySymbols = [
|
|
|
3550
4474
|
var AddonLabel = ({
|
|
3551
4475
|
className,
|
|
3552
4476
|
children
|
|
3553
|
-
}) => /* @__PURE__ */
|
|
4477
|
+
}) => /* @__PURE__ */ jsx30(
|
|
3554
4478
|
"span",
|
|
3555
4479
|
{
|
|
3556
|
-
className:
|
|
4480
|
+
className: classNames8(
|
|
3557
4481
|
"sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
|
|
3558
4482
|
className
|
|
3559
4483
|
),
|
|
@@ -3626,9 +4550,9 @@ var ValueOptions = ({
|
|
|
3626
4550
|
function numberAddons(style) {
|
|
3627
4551
|
switch (style) {
|
|
3628
4552
|
case "None":
|
|
3629
|
-
return /* @__PURE__ */
|
|
3630
|
-
/* @__PURE__ */
|
|
3631
|
-
/* @__PURE__ */
|
|
4553
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4554
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
|
|
4555
|
+
/* @__PURE__ */ jsx30(
|
|
3632
4556
|
"input",
|
|
3633
4557
|
{
|
|
3634
4558
|
disabled: true,
|
|
@@ -3639,9 +4563,9 @@ var ValueOptions = ({
|
|
|
3639
4563
|
] });
|
|
3640
4564
|
case "Percent":
|
|
3641
4565
|
case "Standard":
|
|
3642
|
-
return /* @__PURE__ */
|
|
3643
|
-
/* @__PURE__ */
|
|
3644
|
-
/* @__PURE__ */
|
|
4566
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4567
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
|
|
4568
|
+
/* @__PURE__ */ jsx30(
|
|
3645
4569
|
"input",
|
|
3646
4570
|
{
|
|
3647
4571
|
type: "number",
|
|
@@ -3655,9 +4579,9 @@ var ValueOptions = ({
|
|
|
3655
4579
|
)
|
|
3656
4580
|
] });
|
|
3657
4581
|
case "Currency":
|
|
3658
|
-
return /* @__PURE__ */
|
|
3659
|
-
/* @__PURE__ */
|
|
3660
|
-
/* @__PURE__ */
|
|
4582
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4583
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
|
|
4584
|
+
/* @__PURE__ */ jsx30("div", { className: "w-28 ", children: /* @__PURE__ */ jsx30(
|
|
3661
4585
|
ComboInput,
|
|
3662
4586
|
{
|
|
3663
4587
|
onChange: onChangeSymbol,
|
|
@@ -3670,8 +4594,8 @@ var ValueOptions = ({
|
|
|
3670
4594
|
value: config?.currencySymbol
|
|
3671
4595
|
}
|
|
3672
4596
|
) }),
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border", children: "Precision" }),
|
|
4598
|
+
/* @__PURE__ */ jsx30(
|
|
3675
4599
|
"input",
|
|
3676
4600
|
{
|
|
3677
4601
|
type: "number",
|
|
@@ -3686,9 +4610,9 @@ var ValueOptions = ({
|
|
|
3686
4610
|
)
|
|
3687
4611
|
] });
|
|
3688
4612
|
default:
|
|
3689
|
-
return /* @__PURE__ */
|
|
3690
|
-
/* @__PURE__ */
|
|
3691
|
-
/* @__PURE__ */
|
|
4613
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4614
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
|
|
4615
|
+
/* @__PURE__ */ jsx30(
|
|
3692
4616
|
"input",
|
|
3693
4617
|
{
|
|
3694
4618
|
type: "number",
|
|
@@ -3703,62 +4627,62 @@ var ValueOptions = ({
|
|
|
3703
4627
|
] });
|
|
3704
4628
|
}
|
|
3705
4629
|
}
|
|
3706
|
-
return /* @__PURE__ */
|
|
3707
|
-
/* @__PURE__ */
|
|
3708
|
-
/* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
4630
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4631
|
+
/* @__PURE__ */ jsx30("div", { children: /* @__PURE__ */ jsxs21("div", { className: "flex", children: [
|
|
4632
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
|
|
4633
|
+
/* @__PURE__ */ jsx30(
|
|
3710
4634
|
"select",
|
|
3711
4635
|
{
|
|
3712
4636
|
value: config.valueFormatter,
|
|
3713
|
-
className:
|
|
4637
|
+
className: classNames8(
|
|
3714
4638
|
"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",
|
|
3715
4639
|
config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
|
|
3716
4640
|
),
|
|
3717
4641
|
onChange: (e) => onChangeFormatter(e.target.value),
|
|
3718
4642
|
children: formatters.map((d) => {
|
|
3719
|
-
return /* @__PURE__ */
|
|
4643
|
+
return /* @__PURE__ */ jsx30("option", { value: d.value, children: d.label }, d.value);
|
|
3720
4644
|
})
|
|
3721
4645
|
}
|
|
3722
4646
|
),
|
|
3723
|
-
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3725
|
-
/* @__PURE__ */
|
|
4647
|
+
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4648
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
|
|
4649
|
+
/* @__PURE__ */ jsxs21(
|
|
3726
4650
|
"select",
|
|
3727
4651
|
{
|
|
3728
4652
|
value: config.style,
|
|
3729
4653
|
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",
|
|
3730
4654
|
onChange: (e) => onStyleChange(e.target.value),
|
|
3731
4655
|
children: [
|
|
3732
|
-
/* @__PURE__ */
|
|
3733
|
-
/* @__PURE__ */
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
/* @__PURE__ */
|
|
3736
|
-
/* @__PURE__ */
|
|
3737
|
-
/* @__PURE__ */
|
|
4656
|
+
/* @__PURE__ */ jsx30("option", { value: "None", children: "None" }),
|
|
4657
|
+
/* @__PURE__ */ jsx30("option", { value: "Compact", children: "Compact" }),
|
|
4658
|
+
/* @__PURE__ */ jsx30("option", { value: "Standard", children: "Standard" }),
|
|
4659
|
+
/* @__PURE__ */ jsx30("option", { value: "Scientific", children: "Scientific" }),
|
|
4660
|
+
/* @__PURE__ */ jsx30("option", { value: "Percent", children: "Percent" }),
|
|
4661
|
+
/* @__PURE__ */ jsx30("option", { value: "Currency", children: "Currency" })
|
|
3738
4662
|
]
|
|
3739
4663
|
}
|
|
3740
4664
|
),
|
|
3741
4665
|
config.style && numberAddons(config.style)
|
|
3742
4666
|
] }),
|
|
3743
|
-
config.valueFormatter == "DateFormatter" && /* @__PURE__ */
|
|
3744
|
-
/* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
4667
|
+
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4668
|
+
/* @__PURE__ */ jsx30(AddonLabel, { className: "border border-l-0", children: "Date format" }),
|
|
4669
|
+
/* @__PURE__ */ jsx30(
|
|
3746
4670
|
"select",
|
|
3747
4671
|
{
|
|
3748
4672
|
value: config.dateFormat,
|
|
3749
4673
|
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",
|
|
3750
4674
|
onChange: (e) => onChangeDateFormat(e.target.value),
|
|
3751
4675
|
children: dateFormats.map((d) => {
|
|
3752
|
-
return /* @__PURE__ */
|
|
4676
|
+
return /* @__PURE__ */ jsx30("option", { value: d.value, children: d.label }, d.value);
|
|
3753
4677
|
})
|
|
3754
4678
|
}
|
|
3755
4679
|
)
|
|
3756
4680
|
] })
|
|
3757
4681
|
] }) }),
|
|
3758
|
-
(showPrefix || showSuffix) && /* @__PURE__ */
|
|
3759
|
-
showPrefix && /* @__PURE__ */
|
|
3760
|
-
/* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
4682
|
+
(showPrefix || showSuffix) && /* @__PURE__ */ jsx30("div", { children: /* @__PURE__ */ jsxs21("div", { className: "mt-2 flex items-center gap-4", children: [
|
|
4683
|
+
showPrefix && /* @__PURE__ */ jsxs21("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: [
|
|
4684
|
+
/* @__PURE__ */ jsx30("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
|
|
4685
|
+
/* @__PURE__ */ jsx30(
|
|
3762
4686
|
"input",
|
|
3763
4687
|
{
|
|
3764
4688
|
type: "text",
|
|
@@ -3769,9 +4693,9 @@ var ValueOptions = ({
|
|
|
3769
4693
|
}
|
|
3770
4694
|
)
|
|
3771
4695
|
] }),
|
|
3772
|
-
showSuffix && /* @__PURE__ */
|
|
3773
|
-
/* @__PURE__ */
|
|
3774
|
-
/* @__PURE__ */
|
|
4696
|
+
showSuffix && /* @__PURE__ */ jsxs21("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: [
|
|
4697
|
+
/* @__PURE__ */ jsx30("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
|
|
4698
|
+
/* @__PURE__ */ jsx30(
|
|
3775
4699
|
"input",
|
|
3776
4700
|
{
|
|
3777
4701
|
type: "text",
|
|
@@ -3783,7 +4707,7 @@ var ValueOptions = ({
|
|
|
3783
4707
|
)
|
|
3784
4708
|
] })
|
|
3785
4709
|
] }) }),
|
|
3786
|
-
config.valueFormatter == "StringFormatter" && /* @__PURE__ */
|
|
4710
|
+
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ jsx30(
|
|
3787
4711
|
ValueStringMapping,
|
|
3788
4712
|
{
|
|
3789
4713
|
rules: config.mappingRules || [],
|
|
@@ -3797,7 +4721,7 @@ var ValueOptions = ({
|
|
|
3797
4721
|
import { defaults as defaults3 } from "lodash";
|
|
3798
4722
|
import { Checkbox as Checkbox3, DisclosurePanel as DisclosurePanel5 } from "@sentio/ui-core";
|
|
3799
4723
|
import { produce as produce10 } from "immer";
|
|
3800
|
-
import { jsx as
|
|
4724
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3801
4725
|
var defaultConfig4 = {
|
|
3802
4726
|
valueFormatter: "NumberFormatter",
|
|
3803
4727
|
showValueLabel: false,
|
|
@@ -3824,14 +4748,14 @@ var ValueControls = ({
|
|
|
3824
4748
|
function toggleTooltipTotal(checked) {
|
|
3825
4749
|
config && onChange(produce10(config, (draft) => void (draft.tooltipTotal = checked)));
|
|
3826
4750
|
}
|
|
3827
|
-
return /* @__PURE__ */
|
|
4751
|
+
return /* @__PURE__ */ jsxs22(
|
|
3828
4752
|
DisclosurePanel5,
|
|
3829
4753
|
{
|
|
3830
4754
|
title: "Value Options",
|
|
3831
4755
|
defaultOpen,
|
|
3832
4756
|
containerClassName: "w-full bg-default-bg",
|
|
3833
4757
|
children: [
|
|
3834
|
-
/* @__PURE__ */
|
|
4758
|
+
/* @__PURE__ */ jsx31(
|
|
3835
4759
|
ValueOptions,
|
|
3836
4760
|
{
|
|
3837
4761
|
onChange,
|
|
@@ -3841,8 +4765,8 @@ var ValueControls = ({
|
|
|
3841
4765
|
showSuffix
|
|
3842
4766
|
}
|
|
3843
4767
|
),
|
|
3844
|
-
/* @__PURE__ */
|
|
3845
|
-
/* @__PURE__ */
|
|
4768
|
+
/* @__PURE__ */ jsxs22("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
4769
|
+
/* @__PURE__ */ jsx31(
|
|
3846
4770
|
Checkbox3,
|
|
3847
4771
|
{
|
|
3848
4772
|
checked: config?.showValueLabel,
|
|
@@ -3850,7 +4774,7 @@ var ValueControls = ({
|
|
|
3850
4774
|
label: "Show value label"
|
|
3851
4775
|
}
|
|
3852
4776
|
),
|
|
3853
|
-
/* @__PURE__ */
|
|
4777
|
+
/* @__PURE__ */ jsx31(
|
|
3854
4778
|
Checkbox3,
|
|
3855
4779
|
{
|
|
3856
4780
|
checked: config?.tooltipTotal,
|
|
@@ -3868,10 +4792,12 @@ export {
|
|
|
3868
4792
|
AreaIcon_default as AreaIcon,
|
|
3869
4793
|
ArgumentInput,
|
|
3870
4794
|
ArgumentType,
|
|
4795
|
+
BarGaugeChart,
|
|
3871
4796
|
BarGaugeControls,
|
|
3872
4797
|
BarGuageIcon_default as BarGuageIcon,
|
|
3873
4798
|
BarIcon_default as BarIcon,
|
|
3874
4799
|
ChartLegend,
|
|
4800
|
+
ChartTooltip,
|
|
3875
4801
|
ChartTypeButtonGroup,
|
|
3876
4802
|
EventsFunctionCategories,
|
|
3877
4803
|
EventsFunctionMap,
|
|
@@ -3884,12 +4810,15 @@ export {
|
|
|
3884
4810
|
LabelsInput,
|
|
3885
4811
|
LineControls,
|
|
3886
4812
|
LineIcon_default as LineIcon,
|
|
4813
|
+
PieChart2 as PieChart,
|
|
3887
4814
|
PieChartControls,
|
|
3888
4815
|
PieIcon_default as PieIcon,
|
|
4816
|
+
QueryValueChart,
|
|
3889
4817
|
QueryValueIcon_default as QueryValueIcon,
|
|
3890
4818
|
ReactEChartsBase,
|
|
3891
4819
|
RefreshButton,
|
|
3892
4820
|
RefreshContext,
|
|
4821
|
+
ScatterChartTooltip,
|
|
3893
4822
|
ScatterIcon_default as ScatterIcon,
|
|
3894
4823
|
SystemLabels,
|
|
3895
4824
|
TableIcon_default as TableIcon,
|