@sentio/ui-dashboard 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +65 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +68 -19
- package/dist/index.d.ts +68 -19
- package/dist/index.js +833 -149
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +800 -119
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
BarGuageIcon: () => BarGuageIcon_default,
|
|
39
39
|
BarIcon: () => BarIcon_default,
|
|
40
40
|
ChartLegend: () => ChartLegend,
|
|
41
|
+
ChartTooltip: () => ChartTooltip,
|
|
41
42
|
ChartTypeButtonGroup: () => ChartTypeButtonGroup,
|
|
42
43
|
EventsFunctionCategories: () => EventsFunctionCategories,
|
|
43
44
|
EventsFunctionMap: () => EventsFunctionMap,
|
|
@@ -50,12 +51,14 @@ __export(index_exports, {
|
|
|
50
51
|
LabelsInput: () => LabelsInput,
|
|
51
52
|
LineControls: () => LineControls,
|
|
52
53
|
LineIcon: () => LineIcon_default,
|
|
54
|
+
PieChart: () => PieChart2,
|
|
53
55
|
PieChartControls: () => PieChartControls,
|
|
54
56
|
PieIcon: () => PieIcon_default,
|
|
55
57
|
QueryValueIcon: () => QueryValueIcon_default,
|
|
56
58
|
ReactEChartsBase: () => ReactEChartsBase,
|
|
57
59
|
RefreshButton: () => RefreshButton,
|
|
58
60
|
RefreshContext: () => RefreshContext,
|
|
61
|
+
ScatterChartTooltip: () => ScatterChartTooltip,
|
|
59
62
|
ScatterIcon: () => ScatterIcon_default,
|
|
60
63
|
SystemLabels: () => SystemLabels,
|
|
61
64
|
TableIcon: () => TableIcon_default,
|
|
@@ -3042,10 +3045,688 @@ var ChartTypeButtonGroup = ({
|
|
|
3042
3045
|
) });
|
|
3043
3046
|
};
|
|
3044
3047
|
|
|
3045
|
-
// src/charts/
|
|
3046
|
-
var
|
|
3048
|
+
// src/charts/ChartTooltip.tsx
|
|
3049
|
+
var import_react15 = require("react");
|
|
3050
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
3051
|
+
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
3052
|
+
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
3053
|
+
var import_lodash3 = require("lodash");
|
|
3054
|
+
var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
|
|
3055
|
+
var import_lu3 = require("react-icons/lu");
|
|
3047
3056
|
var import_ui_core9 = require("@sentio/ui-core");
|
|
3057
|
+
|
|
3058
|
+
// src/charts/duration.ts
|
|
3059
|
+
var longUnits = {
|
|
3060
|
+
s: "seconds",
|
|
3061
|
+
m: "minutes",
|
|
3062
|
+
h: "hours",
|
|
3063
|
+
d: "days",
|
|
3064
|
+
w: "weeks",
|
|
3065
|
+
M: "months",
|
|
3066
|
+
y: "years"
|
|
3067
|
+
};
|
|
3068
|
+
function durationToLongString(d) {
|
|
3069
|
+
const u = longUnits[d.unit ?? ""] ?? "";
|
|
3070
|
+
return Number(d.value) === 1 ? u.replace(/s$/, "") : u;
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
// src/charts/ChartTooltip.tsx
|
|
3048
3074
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3075
|
+
import_dayjs.default.extend(import_utc.default);
|
|
3076
|
+
import_dayjs.default.extend(import_timezone.default);
|
|
3077
|
+
function isValidValue(value, includeZero) {
|
|
3078
|
+
if (includeZero) {
|
|
3079
|
+
return Number.isFinite(value);
|
|
3080
|
+
} else {
|
|
3081
|
+
return Number.isFinite(value) && value !== 0;
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
function ChartTooltip({
|
|
3085
|
+
data,
|
|
3086
|
+
numberFormatter,
|
|
3087
|
+
compareTimeDuration,
|
|
3088
|
+
highlightSeriesId,
|
|
3089
|
+
title,
|
|
3090
|
+
showTotal,
|
|
3091
|
+
onViewLogs,
|
|
3092
|
+
viewLogDisabled,
|
|
3093
|
+
onViewUsers,
|
|
3094
|
+
viewUsersDisabled,
|
|
3095
|
+
isFixed
|
|
3096
|
+
}) {
|
|
3097
|
+
const {
|
|
3098
|
+
series,
|
|
3099
|
+
hasCompare,
|
|
3100
|
+
hasCurrent,
|
|
3101
|
+
currentTime,
|
|
3102
|
+
compareTime,
|
|
3103
|
+
markers,
|
|
3104
|
+
compareMarkers,
|
|
3105
|
+
total,
|
|
3106
|
+
compareTotal
|
|
3107
|
+
} = (0, import_react15.useMemo)(() => {
|
|
3108
|
+
const params = (0, import_lodash3.sortBy)(data, (p) => -p.value[1]);
|
|
3109
|
+
const hasCompare2 = (0, import_lodash3.some)(
|
|
3110
|
+
params,
|
|
3111
|
+
(param) => param.seriesId.endsWith("_compare")
|
|
3112
|
+
);
|
|
3113
|
+
const seriesData = {};
|
|
3114
|
+
const markers2 = {};
|
|
3115
|
+
const compareMarkers2 = {};
|
|
3116
|
+
let currentTime2;
|
|
3117
|
+
let compareTime2;
|
|
3118
|
+
let total2 = new import_bigdecimal.default(0);
|
|
3119
|
+
let compareTotal2 = new import_bigdecimal.default(0);
|
|
3120
|
+
for (const p of params) {
|
|
3121
|
+
const { marker, seriesName, value, seriesId } = p;
|
|
3122
|
+
if (seriesId.endsWith("_compare")) {
|
|
3123
|
+
const id = seriesId.replace("_compare", "");
|
|
3124
|
+
compareMarkers2[id] = marker;
|
|
3125
|
+
if (compareTime2 === void 0) {
|
|
3126
|
+
compareTime2 = (0, import_dayjs.default)(value[0]);
|
|
3127
|
+
}
|
|
3128
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3129
|
+
seriesData[id] = {
|
|
3130
|
+
seriesId: id,
|
|
3131
|
+
...seriesData[id],
|
|
3132
|
+
compareValue: value[1],
|
|
3133
|
+
compareTime: value[0],
|
|
3134
|
+
seriesName
|
|
3135
|
+
};
|
|
3136
|
+
compareTotal2 = compareTotal2.plus(value[1]);
|
|
3137
|
+
}
|
|
3138
|
+
} else {
|
|
3139
|
+
markers2[seriesId] = marker;
|
|
3140
|
+
if (currentTime2 === void 0) {
|
|
3141
|
+
currentTime2 = (0, import_dayjs.default)(value[0]);
|
|
3142
|
+
}
|
|
3143
|
+
if (isValidValue(value[1], hasCompare2)) {
|
|
3144
|
+
seriesData[seriesId] = {
|
|
3145
|
+
seriesId,
|
|
3146
|
+
...seriesData[seriesId],
|
|
3147
|
+
time: value[0],
|
|
3148
|
+
value: value[1],
|
|
3149
|
+
seriesName
|
|
3150
|
+
};
|
|
3151
|
+
total2 = total2.plus(value[1]);
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
const series2 = (0, import_lodash3.sortBy)(Object.values(seriesData), (s) => -s.value);
|
|
3156
|
+
const hasCurrent2 = series2[0]?.value !== void 0;
|
|
3157
|
+
if (compareTimeDuration && compareTime2 && !currentTime2) {
|
|
3158
|
+
currentTime2 = compareTime2.add(
|
|
3159
|
+
Number(compareTimeDuration.value),
|
|
3160
|
+
compareTimeDuration.unit
|
|
3161
|
+
);
|
|
3162
|
+
}
|
|
3163
|
+
return {
|
|
3164
|
+
series: series2,
|
|
3165
|
+
hasCompare: hasCompare2,
|
|
3166
|
+
currentTime: currentTime2,
|
|
3167
|
+
compareTime: compareTime2,
|
|
3168
|
+
hasCurrent: hasCurrent2,
|
|
3169
|
+
markers: markers2,
|
|
3170
|
+
compareMarkers: compareMarkers2,
|
|
3171
|
+
total: total2,
|
|
3172
|
+
compareTotal: compareTotal2
|
|
3173
|
+
};
|
|
3174
|
+
}, [data]);
|
|
3175
|
+
const renderRow = (p, idx) => {
|
|
3176
|
+
const { seriesName, compareValue, value, seriesId } = p;
|
|
3177
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3178
|
+
const marker = markers[seriesId];
|
|
3179
|
+
const diff = hasCompare && hasCurrent && compareValue != null && value != null ? new import_bigdecimal.default(value).minus(compareValue).div(compareValue).toNumber() : void 0;
|
|
3180
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, idx);
|
|
3181
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, idx);
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
|
|
3183
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3184
|
+
"div",
|
|
3185
|
+
{
|
|
3186
|
+
className: (0, import_ui_core9.classNames)(
|
|
3187
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3188
|
+
"group",
|
|
3189
|
+
highlighted ? "highlighted" : ""
|
|
3190
|
+
),
|
|
3191
|
+
style: { minWidth: "4rem" },
|
|
3192
|
+
children: [
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3194
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "truncate", children: seriesName }),
|
|
3195
|
+
showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3196
|
+
"button",
|
|
3197
|
+
{
|
|
3198
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3199
|
+
onClick: (e) => {
|
|
3200
|
+
e.preventDefault();
|
|
3201
|
+
e.stopPropagation();
|
|
3202
|
+
onViewLogs(seriesId, idx);
|
|
3203
|
+
},
|
|
3204
|
+
title: "View logs",
|
|
3205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuList, { className: "h-4 w-4" })
|
|
3206
|
+
}
|
|
3207
|
+
),
|
|
3208
|
+
showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3209
|
+
"button",
|
|
3210
|
+
{
|
|
3211
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3212
|
+
onClick: (e) => {
|
|
3213
|
+
e.preventDefault();
|
|
3214
|
+
e.stopPropagation();
|
|
3215
|
+
onViewUsers(seriesId, idx);
|
|
3216
|
+
},
|
|
3217
|
+
title: "View users",
|
|
3218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lu3.LuCircleUserRound, { className: "h-4 w-4" })
|
|
3219
|
+
}
|
|
3220
|
+
),
|
|
3221
|
+
isFixed && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3222
|
+
import_ui_core9.CopyButton,
|
|
3223
|
+
{
|
|
3224
|
+
size: 16,
|
|
3225
|
+
text: seriesName,
|
|
3226
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3227
|
+
}
|
|
3228
|
+
)
|
|
3229
|
+
]
|
|
3230
|
+
},
|
|
3231
|
+
idx
|
|
3232
|
+
),
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3234
|
+
"div",
|
|
3235
|
+
{
|
|
3236
|
+
className: (0, import_ui_core9.classNames)(
|
|
3237
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3238
|
+
highlighted ? "highlighted" : ""
|
|
3239
|
+
),
|
|
3240
|
+
children: [
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(value, seriesId) : "-" }),
|
|
3242
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3243
|
+
"span",
|
|
3244
|
+
{
|
|
3245
|
+
className: (0, import_ui_core9.classNames)(
|
|
3246
|
+
"ml-1 text-xs",
|
|
3247
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3248
|
+
),
|
|
3249
|
+
children: [
|
|
3250
|
+
diff > 0 ? "+" : "",
|
|
3251
|
+
(diff * 100).toFixed(2),
|
|
3252
|
+
"%"
|
|
3253
|
+
]
|
|
3254
|
+
}
|
|
3255
|
+
)
|
|
3256
|
+
]
|
|
3257
|
+
},
|
|
3258
|
+
`${idx}-value`
|
|
3259
|
+
)
|
|
3260
|
+
] }, idx);
|
|
3261
|
+
};
|
|
3262
|
+
const renderCompareRow = (p, idx) => {
|
|
3263
|
+
const { seriesName, compareValue, seriesId } = p;
|
|
3264
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3265
|
+
const compareMarker = compareMarkers[seriesId];
|
|
3266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react15.Fragment, { children: [
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3268
|
+
"div",
|
|
3269
|
+
{
|
|
3270
|
+
className: (0, import_ui_core9.classNames)(
|
|
3271
|
+
"sentio-tooltip-item sentio-tooltip-compare-item series-name text-text-foreground-secondary truncate",
|
|
3272
|
+
highlighted ? "highlighted" : ""
|
|
3273
|
+
),
|
|
3274
|
+
style: { minWidth: "4rem" },
|
|
3275
|
+
children: [
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3277
|
+
"span",
|
|
3278
|
+
{
|
|
3279
|
+
dangerouslySetInnerHTML: { __html: compareMarker || "" }
|
|
3280
|
+
}
|
|
3281
|
+
),
|
|
3282
|
+
seriesName
|
|
3283
|
+
]
|
|
3284
|
+
},
|
|
3285
|
+
idx
|
|
3286
|
+
),
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3288
|
+
"div",
|
|
3289
|
+
{
|
|
3290
|
+
className: (0, import_ui_core9.classNames)(
|
|
3291
|
+
"sentio-tooltip-item min-w-16 text-text-foreground-secondary truncate pl-1 text-right font-semibold",
|
|
3292
|
+
highlighted ? "highlighted" : ""
|
|
3293
|
+
),
|
|
3294
|
+
children: (0, import_lodash3.isNumber)(compareValue) ? numberFormatter(compareValue, seriesId) : "-"
|
|
3295
|
+
},
|
|
3296
|
+
`${idx}-value`
|
|
3297
|
+
)
|
|
3298
|
+
] }, idx);
|
|
3299
|
+
};
|
|
3300
|
+
const renderTotalRow = () => {
|
|
3301
|
+
if (!showTotal || series.length < 2) return null;
|
|
3302
|
+
const diff = hasCompare && hasCurrent && total && compareTotal ? total.minus(compareTotal).div(compareTotal).toNumber() : void 0;
|
|
3303
|
+
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: [
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "sentio-tooltip-item series-name text-text-foreground truncate font-semibold", children: "Total" }),
|
|
3305
|
+
/* @__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: [
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: hasCurrent ? numberFormatter(total.toNumber()) : "-" }),
|
|
3307
|
+
diff !== void 0 && Number.isFinite(diff) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3308
|
+
"span",
|
|
3309
|
+
{
|
|
3310
|
+
className: (0, import_ui_core9.classNames)(
|
|
3311
|
+
"ml-1 text-xs",
|
|
3312
|
+
diff > 0 ? "text-green-500" : "text-red"
|
|
3313
|
+
),
|
|
3314
|
+
children: [
|
|
3315
|
+
diff > 0 ? "+" : "",
|
|
3316
|
+
(diff * 100).toFixed(2),
|
|
3317
|
+
"%"
|
|
3318
|
+
]
|
|
3319
|
+
}
|
|
3320
|
+
)
|
|
3321
|
+
] })
|
|
3322
|
+
] });
|
|
3323
|
+
};
|
|
3324
|
+
const renderCompareTotalRow = () => {
|
|
3325
|
+
if (!showTotal || series.length < 2 || !hasCompare) return null;
|
|
3326
|
+
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: [
|
|
3327
|
+
/* @__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" }),
|
|
3328
|
+
/* @__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()) : "-" })
|
|
3329
|
+
] });
|
|
3330
|
+
};
|
|
3331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3332
|
+
"div",
|
|
3333
|
+
{
|
|
3334
|
+
className: (0, import_ui_core9.classNames)("grid w-full px-2"),
|
|
3335
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3336
|
+
children: [
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3338
|
+
"div",
|
|
3339
|
+
{
|
|
3340
|
+
className: (0, import_ui_core9.classNames)(
|
|
3341
|
+
"pl-2",
|
|
3342
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3343
|
+
),
|
|
3344
|
+
children: title ?? currentTime?.format("YYYY-MM-DD HH:mm:ss")
|
|
3345
|
+
}
|
|
3346
|
+
),
|
|
3347
|
+
!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: [
|
|
3348
|
+
series.map((s, idx) => renderRow(s, idx)),
|
|
3349
|
+
renderTotalRow(),
|
|
3350
|
+
hasCompare && compareTimeDuration && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3352
|
+
"div",
|
|
3353
|
+
{
|
|
3354
|
+
className: (0, import_ui_core9.classNames)(
|
|
3355
|
+
"mt-2 pl-2",
|
|
3356
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3357
|
+
),
|
|
3358
|
+
children: [
|
|
3359
|
+
compareTime?.format("YYYY-MM-DD HH:mm:ss"),
|
|
3360
|
+
" (previous",
|
|
3361
|
+
" ",
|
|
3362
|
+
durationToLongString(compareTimeDuration),
|
|
3363
|
+
")"
|
|
3364
|
+
]
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
series.map((s, idx) => renderCompareRow(s, idx)),
|
|
3368
|
+
renderCompareTotalRow()
|
|
3369
|
+
] })
|
|
3370
|
+
] })
|
|
3371
|
+
]
|
|
3372
|
+
}
|
|
3373
|
+
);
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
// src/charts/ScatterChartTooltip.tsx
|
|
3377
|
+
var import_react16 = require("react");
|
|
3378
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
3379
|
+
var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
3380
|
+
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
3381
|
+
var import_lodash4 = require("lodash");
|
|
3382
|
+
var import_lu4 = require("react-icons/lu");
|
|
3383
|
+
var import_ui_core10 = require("@sentio/ui-core");
|
|
3384
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3385
|
+
import_dayjs2.default.extend(import_utc2.default);
|
|
3386
|
+
import_dayjs2.default.extend(import_timezone2.default);
|
|
3387
|
+
function ScatterChartTooltip({
|
|
3388
|
+
data,
|
|
3389
|
+
numberFormatter,
|
|
3390
|
+
highlightSeriesId,
|
|
3391
|
+
title,
|
|
3392
|
+
onViewLogs,
|
|
3393
|
+
viewLogDisabled,
|
|
3394
|
+
onViewUsers,
|
|
3395
|
+
viewUsersDisabled,
|
|
3396
|
+
isFixed,
|
|
3397
|
+
sizeTitle = "Size"
|
|
3398
|
+
}) {
|
|
3399
|
+
const { point, seriesName, seriesId, marker } = (0, import_react16.useMemo)(() => {
|
|
3400
|
+
const param = Array.isArray(data) ? data[0] : data;
|
|
3401
|
+
return {
|
|
3402
|
+
point: param,
|
|
3403
|
+
seriesName: param?.seriesName || "",
|
|
3404
|
+
seriesId: param?.seriesId || "",
|
|
3405
|
+
marker: param?.marker || ""
|
|
3406
|
+
};
|
|
3407
|
+
}, [data]);
|
|
3408
|
+
if (!point || !point.value) {
|
|
3409
|
+
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" }) });
|
|
3410
|
+
}
|
|
3411
|
+
const { value } = point;
|
|
3412
|
+
const [xValue, yValue, sizeValue] = value;
|
|
3413
|
+
const highlighted = seriesId === highlightSeriesId;
|
|
3414
|
+
const showViewLogs = onViewLogs && !viewLogDisabled?.(seriesId, 0);
|
|
3415
|
+
const showViewUsers = onViewUsers && !viewUsersDisabled?.(seriesId, 0);
|
|
3416
|
+
const formatValue = (val) => {
|
|
3417
|
+
if (val instanceof Date) {
|
|
3418
|
+
return (0, import_dayjs2.default)(val).format("YYYY-MM-DD HH:mm:ss");
|
|
3419
|
+
} else if ((0, import_lodash4.isNumber)(val)) {
|
|
3420
|
+
return numberFormatter(val);
|
|
3421
|
+
} else {
|
|
3422
|
+
return String(val);
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3426
|
+
"div",
|
|
3427
|
+
{
|
|
3428
|
+
className: (0, import_ui_core10.classNames)("grid w-full px-2"),
|
|
3429
|
+
style: { gridTemplateColumns: "1fr auto" },
|
|
3430
|
+
children: [
|
|
3431
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3432
|
+
"div",
|
|
3433
|
+
{
|
|
3434
|
+
className: (0, import_ui_core10.classNames)(
|
|
3435
|
+
"mb-2 pl-2",
|
|
3436
|
+
"text-text-foreground-secondary col-span-2 text-left"
|
|
3437
|
+
),
|
|
3438
|
+
children: title ?? (0, import_dayjs2.default)(xValue).format("YYYY-MM-DD HH:mm:ss")
|
|
3439
|
+
}
|
|
3440
|
+
),
|
|
3441
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3442
|
+
"div",
|
|
3443
|
+
{
|
|
3444
|
+
className: (0, import_ui_core10.classNames)(
|
|
3445
|
+
"sentio-tooltip-item series-name text-text-foreground inline-flex items-center overflow-hidden",
|
|
3446
|
+
"group",
|
|
3447
|
+
highlighted ? "highlighted" : ""
|
|
3448
|
+
),
|
|
3449
|
+
style: { minWidth: "4rem" },
|
|
3450
|
+
children: [
|
|
3451
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { dangerouslySetInnerHTML: { __html: marker || "" } }),
|
|
3452
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: seriesName }),
|
|
3453
|
+
showViewLogs && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3454
|
+
"button",
|
|
3455
|
+
{
|
|
3456
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3457
|
+
onClick: (e) => {
|
|
3458
|
+
e.preventDefault();
|
|
3459
|
+
e.stopPropagation();
|
|
3460
|
+
onViewLogs(seriesId, 0);
|
|
3461
|
+
},
|
|
3462
|
+
title: "View logs",
|
|
3463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuList, { className: "h-4 w-4" })
|
|
3464
|
+
}
|
|
3465
|
+
),
|
|
3466
|
+
showViewUsers && isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3467
|
+
"button",
|
|
3468
|
+
{
|
|
3469
|
+
className: "text-text-foreground/60 hover:text-text-foreground invisible ml-1 text-xs underline group-hover:visible",
|
|
3470
|
+
onClick: (e) => {
|
|
3471
|
+
e.preventDefault();
|
|
3472
|
+
e.stopPropagation();
|
|
3473
|
+
onViewUsers(seriesId, 0);
|
|
3474
|
+
},
|
|
3475
|
+
title: "View users",
|
|
3476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lu4.LuCircleUserRound, { className: "h-4 w-4" })
|
|
3477
|
+
}
|
|
3478
|
+
),
|
|
3479
|
+
isFixed && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3480
|
+
import_ui_core10.CopyButton,
|
|
3481
|
+
{
|
|
3482
|
+
size: 16,
|
|
3483
|
+
text: seriesName,
|
|
3484
|
+
className: "invisible ml-1 group-hover:visible"
|
|
3485
|
+
}
|
|
3486
|
+
)
|
|
3487
|
+
]
|
|
3488
|
+
}
|
|
3489
|
+
),
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3491
|
+
"div",
|
|
3492
|
+
{
|
|
3493
|
+
className: (0, import_ui_core10.classNames)(
|
|
3494
|
+
"sentio-tooltip-item min-w-16 flex items-center truncate pl-1 text-right font-semibold",
|
|
3495
|
+
highlighted ? "highlighted" : ""
|
|
3496
|
+
),
|
|
3497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatValue(yValue) })
|
|
3498
|
+
}
|
|
3499
|
+
),
|
|
3500
|
+
sizeValue !== void 0 && sizeValue !== null && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react16.Fragment, { children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "border-border-color col-span-2 my-2 w-full border-t" }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3503
|
+
"div",
|
|
3504
|
+
{
|
|
3505
|
+
className: "sentio-tooltip-item series-name text-text-foreground-secondary truncate",
|
|
3506
|
+
style: { minWidth: "4rem" },
|
|
3507
|
+
children: sizeTitle
|
|
3508
|
+
}
|
|
3509
|
+
),
|
|
3510
|
+
/* @__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) })
|
|
3511
|
+
] })
|
|
3512
|
+
]
|
|
3513
|
+
}
|
|
3514
|
+
);
|
|
3515
|
+
}
|
|
3516
|
+
|
|
3517
|
+
// src/charts/PieChart.tsx
|
|
3518
|
+
var import_react17 = require("react");
|
|
3519
|
+
var import_react_resize_detector3 = require("react-resize-detector");
|
|
3520
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3521
|
+
var theresholdWidth = 480;
|
|
3522
|
+
var TOOLTIP_MIN_VIEWPORT_LEFT = 8;
|
|
3523
|
+
var TOOLTIP_MIN_VIEWPORT_RIGHT = 8;
|
|
3524
|
+
var PieChart2 = (0, import_react17.forwardRef)(
|
|
3525
|
+
(props, ref) => {
|
|
3526
|
+
const {
|
|
3527
|
+
series,
|
|
3528
|
+
valueFormatter,
|
|
3529
|
+
config,
|
|
3530
|
+
title,
|
|
3531
|
+
minHeight,
|
|
3532
|
+
loading,
|
|
3533
|
+
style,
|
|
3534
|
+
onInitChart
|
|
3535
|
+
} = props;
|
|
3536
|
+
const [options, setOptions] = (0, import_react17.useState)({});
|
|
3537
|
+
const isDarkMode = useDarkMode();
|
|
3538
|
+
const isMobile2 = isMobile();
|
|
3539
|
+
const { width, ref: resizeRef } = (0, import_react_resize_detector3.useResizeDetector)({
|
|
3540
|
+
refreshMode: "debounce",
|
|
3541
|
+
refreshRate: 500,
|
|
3542
|
+
handleHeight: false
|
|
3543
|
+
});
|
|
3544
|
+
const tooltipPosition = (point, _params, _dom, _rect, size) => {
|
|
3545
|
+
const chartRect = resizeRef.current?.getBoundingClientRect();
|
|
3546
|
+
const chartLeft = chartRect?.left ?? 0;
|
|
3547
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : size.viewSize[0];
|
|
3548
|
+
const [w, h] = size.contentSize;
|
|
3549
|
+
const minXInChart = TOOLTIP_MIN_VIEWPORT_LEFT - chartLeft;
|
|
3550
|
+
const maxXInChart = winW - TOOLTIP_MIN_VIEWPORT_RIGHT - chartLeft - w;
|
|
3551
|
+
let x = point[0] + 12;
|
|
3552
|
+
if (x > maxXInChart) {
|
|
3553
|
+
x = point[0] - w - 12;
|
|
3554
|
+
}
|
|
3555
|
+
if (x < minXInChart) x = minXInChart;
|
|
3556
|
+
if (x > maxXInChart) x = maxXInChart;
|
|
3557
|
+
const y = Math.max(0, point[1] - h / 2);
|
|
3558
|
+
return [x, y];
|
|
3559
|
+
};
|
|
3560
|
+
(0, import_react17.useEffect)(() => {
|
|
3561
|
+
const isHLegend = width && width < theresholdWidth;
|
|
3562
|
+
const winW = typeof window !== "undefined" ? window.innerWidth : 1024;
|
|
3563
|
+
const tooltipMaxWidth = Math.max(160, Math.min(280, winW - 48));
|
|
3564
|
+
const tooltipExtraCss = isMobile2 ? `max-width: ${tooltipMaxWidth}px; white-space: normal; word-break: break-word; overflow-wrap: anywhere;` : "";
|
|
3565
|
+
const d = [];
|
|
3566
|
+
series.forEach((s) => {
|
|
3567
|
+
if (s.data.length > 0 && s.data[0] && s.data[0][1] != null) {
|
|
3568
|
+
const rawValue = s.data[0][1];
|
|
3569
|
+
if (config?.pieConfig?.absValue) {
|
|
3570
|
+
d.push({ name: s.name, value: Math.abs(rawValue) });
|
|
3571
|
+
} else if (rawValue > 0) {
|
|
3572
|
+
d.push({ name: s.name, value: rawValue });
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
});
|
|
3576
|
+
const total = d.reduce((acc, cur) => acc + cur.value, 0);
|
|
3577
|
+
d.sort((a, b) => {
|
|
3578
|
+
const percentA = a.value / total * 100;
|
|
3579
|
+
const percentB = b.value / total * 100;
|
|
3580
|
+
return percentB - percentA;
|
|
3581
|
+
});
|
|
3582
|
+
const pieSeries = [
|
|
3583
|
+
{
|
|
3584
|
+
type: "pie",
|
|
3585
|
+
radius: [config?.pieConfig?.pieType == "Donut" ? "40%" : 0, "70%"],
|
|
3586
|
+
center: isHLegend ? ["50%", "50%"] : ["35%", "50%"],
|
|
3587
|
+
label: { show: false },
|
|
3588
|
+
labelLine: { length: 10, length2: 10, maxSurfaceAngle: 50 },
|
|
3589
|
+
data: d
|
|
3590
|
+
}
|
|
3591
|
+
];
|
|
3592
|
+
const options2 = {
|
|
3593
|
+
title: { text: title, left: 8 },
|
|
3594
|
+
legend: isHLegend ? {
|
|
3595
|
+
type: "scroll",
|
|
3596
|
+
orient: "horizontal",
|
|
3597
|
+
bottom: 12,
|
|
3598
|
+
left: "center",
|
|
3599
|
+
animation: true,
|
|
3600
|
+
animationDurationUpdate: 300,
|
|
3601
|
+
pageIconSize: [10, 8],
|
|
3602
|
+
pageButtonItemGap: 2,
|
|
3603
|
+
pageButtonGap: 4,
|
|
3604
|
+
textStyle: {
|
|
3605
|
+
width: width ? width * 0.4 : 100,
|
|
3606
|
+
overflow: "truncate"
|
|
3607
|
+
},
|
|
3608
|
+
tooltip: {
|
|
3609
|
+
show: true,
|
|
3610
|
+
appendToBody: true,
|
|
3611
|
+
extraCssText: tooltipExtraCss,
|
|
3612
|
+
position: tooltipPosition,
|
|
3613
|
+
formatter: function(params) {
|
|
3614
|
+
const name = params.name;
|
|
3615
|
+
const item = d.find((i) => i.name === name);
|
|
3616
|
+
let ret = name;
|
|
3617
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3618
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3619
|
+
}
|
|
3620
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3621
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3622
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3623
|
+
${percent}%`;
|
|
3624
|
+
}
|
|
3625
|
+
return ret;
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
} : {
|
|
3629
|
+
type: "scroll",
|
|
3630
|
+
orient: "vertical",
|
|
3631
|
+
right: 16,
|
|
3632
|
+
top: title ? 48 : 8,
|
|
3633
|
+
width: "35%",
|
|
3634
|
+
animation: true,
|
|
3635
|
+
animationDurationUpdate: 300,
|
|
3636
|
+
tooltip: {
|
|
3637
|
+
show: true,
|
|
3638
|
+
appendToBody: true,
|
|
3639
|
+
extraCssText: tooltipExtraCss,
|
|
3640
|
+
position: tooltipPosition,
|
|
3641
|
+
formatter: function(params) {
|
|
3642
|
+
const name = params.name;
|
|
3643
|
+
const item = d.find((i) => i.name === name);
|
|
3644
|
+
let ret = name;
|
|
3645
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3646
|
+
ret += "<br/>" + valueFormatter(item.value);
|
|
3647
|
+
}
|
|
3648
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3649
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3650
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3651
|
+
${percent}%`;
|
|
3652
|
+
}
|
|
3653
|
+
return ret;
|
|
3654
|
+
}
|
|
3655
|
+
},
|
|
3656
|
+
icon: "roundRect",
|
|
3657
|
+
itemWidth: 12,
|
|
3658
|
+
itemHeight: 12,
|
|
3659
|
+
itemGap: 6,
|
|
3660
|
+
show: true,
|
|
3661
|
+
pageIconSize: [8, 10],
|
|
3662
|
+
pageButtonGap: 4,
|
|
3663
|
+
pageButtonItemGap: 2,
|
|
3664
|
+
pageIconColor: isDarkMode ? "#909399" : "#4E5969",
|
|
3665
|
+
pageIconInactiveColor: isDarkMode ? "#606266" : "#C9CDD4",
|
|
3666
|
+
textStyle: {
|
|
3667
|
+
width: width ? width * 0.3 : "auto",
|
|
3668
|
+
overflow: "truncate",
|
|
3669
|
+
lineHeight: 16,
|
|
3670
|
+
fontSize: 12,
|
|
3671
|
+
rich: { value: { padding: [4, 0, 0, 0] } }
|
|
3672
|
+
},
|
|
3673
|
+
formatter: (name) => {
|
|
3674
|
+
const item = d.find((i) => i.name === name);
|
|
3675
|
+
let ret = name;
|
|
3676
|
+
if (config?.pieConfig?.showValue && item) {
|
|
3677
|
+
ret += "\n" + valueFormatter(item.value);
|
|
3678
|
+
}
|
|
3679
|
+
if (config?.pieConfig?.showPercent && item) {
|
|
3680
|
+
const percent = (item.value / d.reduce((acc, cur) => acc + cur.value, 0) * 100).toFixed(2);
|
|
3681
|
+
ret += config.pieConfig.showValue ? ` \u2022 ${percent}%` : `
|
|
3682
|
+
${percent}%`;
|
|
3683
|
+
}
|
|
3684
|
+
return ret;
|
|
3685
|
+
}
|
|
3686
|
+
},
|
|
3687
|
+
tooltip: {
|
|
3688
|
+
trigger: "item",
|
|
3689
|
+
appendToBody: true,
|
|
3690
|
+
extraCssText: tooltipExtraCss,
|
|
3691
|
+
position: tooltipPosition,
|
|
3692
|
+
formatter: ({ name, data, percent }) => {
|
|
3693
|
+
let ret = `${name}`;
|
|
3694
|
+
if (config?.pieConfig?.showValue) {
|
|
3695
|
+
ret += "<br/>" + valueFormatter(data.value);
|
|
3696
|
+
}
|
|
3697
|
+
if (config?.pieConfig?.showPercent) {
|
|
3698
|
+
ret += config.pieConfig.showValue ? ` (${percent}%)` : `
|
|
3699
|
+
${percent}%`;
|
|
3700
|
+
}
|
|
3701
|
+
return ret;
|
|
3702
|
+
}
|
|
3703
|
+
},
|
|
3704
|
+
toolbox: { show: false },
|
|
3705
|
+
animation: false,
|
|
3706
|
+
series: pieSeries
|
|
3707
|
+
};
|
|
3708
|
+
setOptions(options2);
|
|
3709
|
+
}, [series, config, valueFormatter, isDarkMode, isMobile2, width, title]);
|
|
3710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full w-full", ref: resizeRef, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3711
|
+
ReactEChartsBase,
|
|
3712
|
+
{
|
|
3713
|
+
ref,
|
|
3714
|
+
loading,
|
|
3715
|
+
option: options,
|
|
3716
|
+
minHeight,
|
|
3717
|
+
style,
|
|
3718
|
+
noLegend: true,
|
|
3719
|
+
onInitChart
|
|
3720
|
+
}
|
|
3721
|
+
) });
|
|
3722
|
+
}
|
|
3723
|
+
);
|
|
3724
|
+
PieChart2.displayName = "PieChart";
|
|
3725
|
+
|
|
3726
|
+
// src/charts/options/LineControls.tsx
|
|
3727
|
+
var import_immer4 = require("immer");
|
|
3728
|
+
var import_ui_core11 = require("@sentio/ui-core");
|
|
3729
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3049
3730
|
var lineStyles = [
|
|
3050
3731
|
{ label: "Solid", value: "Solid" },
|
|
3051
3732
|
{ label: "Dotted", value: "Dotted" }
|
|
@@ -3065,14 +3746,14 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3065
3746
|
})
|
|
3066
3747
|
);
|
|
3067
3748
|
};
|
|
3068
|
-
return /* @__PURE__ */ (0,
|
|
3069
|
-
|
|
3749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3750
|
+
import_ui_core11.DisclosurePanel,
|
|
3070
3751
|
{
|
|
3071
3752
|
title: "Line style",
|
|
3072
3753
|
containerClassName: "w-full bg-default-bg",
|
|
3073
|
-
children: /* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3075
|
-
|
|
3754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3756
|
+
import_ui_core11.NewButtonGroup,
|
|
3076
3757
|
{
|
|
3077
3758
|
buttons: lineStyles,
|
|
3078
3759
|
value: config?.style || "Solid",
|
|
@@ -3080,8 +3761,8 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3080
3761
|
small: true
|
|
3081
3762
|
}
|
|
3082
3763
|
),
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3084
|
-
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3765
|
+
import_ui_core11.Checkbox,
|
|
3085
3766
|
{
|
|
3086
3767
|
label: "Smooth Curves",
|
|
3087
3768
|
checked: config?.smooth,
|
|
@@ -3094,16 +3775,16 @@ var LineControls = ({ config, defaultOpen, onChange }) => {
|
|
|
3094
3775
|
};
|
|
3095
3776
|
|
|
3096
3777
|
// src/charts/options/LabelControls.tsx
|
|
3097
|
-
var
|
|
3778
|
+
var import_react18 = require("react");
|
|
3098
3779
|
var import_immer5 = require("immer");
|
|
3099
|
-
var
|
|
3100
|
-
var
|
|
3780
|
+
var import_ui_core12 = require("@sentio/ui-core");
|
|
3781
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3101
3782
|
var initialConfig = {
|
|
3102
3783
|
columns: [],
|
|
3103
3784
|
alias: ""
|
|
3104
3785
|
};
|
|
3105
3786
|
var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
3106
|
-
(0,
|
|
3787
|
+
(0, import_react18.useEffect)(() => {
|
|
3107
3788
|
if (config?.columns && config.columns.length > 0 && !config.alias) {
|
|
3108
3789
|
const aliasParts = [];
|
|
3109
3790
|
config.columns.forEach((colConfig) => {
|
|
@@ -3133,31 +3814,31 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3133
3814
|
})
|
|
3134
3815
|
);
|
|
3135
3816
|
};
|
|
3136
|
-
const _defaultOpen = (0,
|
|
3817
|
+
const _defaultOpen = (0, import_react18.useMemo)(() => {
|
|
3137
3818
|
if (defaultOpen) {
|
|
3138
3819
|
return true;
|
|
3139
3820
|
}
|
|
3140
3821
|
return config?.alias !== "" || config?.columns && config.columns.length > 0;
|
|
3141
3822
|
}, [config, defaultOpen]);
|
|
3142
|
-
return /* @__PURE__ */ (0,
|
|
3143
|
-
|
|
3823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3824
|
+
import_ui_core12.DisclosurePanel,
|
|
3144
3825
|
{
|
|
3145
3826
|
title: "Label Controls",
|
|
3146
3827
|
defaultOpen: _defaultOpen,
|
|
3147
3828
|
containerClassName: "w-full bg-default-bg",
|
|
3148
|
-
children: /* @__PURE__ */ (0,
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3830
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "inline-flex h-8", children: [
|
|
3831
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.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
3832
|
"Label Alias",
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3153
|
-
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3834
|
+
import_ui_core12.HelpIcon,
|
|
3154
3835
|
{
|
|
3155
|
-
text: /* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
3836
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-icontent text-text-foreground", children: [
|
|
3837
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: "Series name override or template." }),
|
|
3838
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
|
|
3158
3839
|
"Ex.",
|
|
3159
3840
|
" ",
|
|
3160
|
-
/* @__PURE__ */ (0,
|
|
3841
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-primary mx-1 font-semibold italic", children: "{{contract}}" }),
|
|
3161
3842
|
" ",
|
|
3162
3843
|
"will be replaced with the value of the contract label."
|
|
3163
3844
|
] })
|
|
@@ -3165,7 +3846,7 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3165
3846
|
}
|
|
3166
3847
|
)
|
|
3167
3848
|
] }),
|
|
3168
|
-
/* @__PURE__ */ (0,
|
|
3849
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3169
3850
|
"input",
|
|
3170
3851
|
{
|
|
3171
3852
|
type: "text",
|
|
@@ -3176,8 +3857,8 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3176
3857
|
}
|
|
3177
3858
|
)
|
|
3178
3859
|
] }),
|
|
3179
|
-
/* @__PURE__ */ (0,
|
|
3180
|
-
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3861
|
+
import_ui_core12.Button,
|
|
3181
3862
|
{
|
|
3182
3863
|
type: "button",
|
|
3183
3864
|
role: "link",
|
|
@@ -3194,9 +3875,9 @@ var LabelControls = ({ config, setConfig, defaultOpen }) => {
|
|
|
3194
3875
|
|
|
3195
3876
|
// src/charts/options/PieChartControls.tsx
|
|
3196
3877
|
var import_immer6 = require("immer");
|
|
3197
|
-
var
|
|
3198
|
-
var
|
|
3199
|
-
var
|
|
3878
|
+
var import_lodash5 = require("lodash");
|
|
3879
|
+
var import_ui_core13 = require("@sentio/ui-core");
|
|
3880
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3200
3881
|
var defaultConfig = {
|
|
3201
3882
|
pieType: "Pie",
|
|
3202
3883
|
calculation: "LAST",
|
|
@@ -3217,7 +3898,7 @@ var PieTypeItems = [
|
|
|
3217
3898
|
{ label: "Donut", value: "Donut" }
|
|
3218
3899
|
];
|
|
3219
3900
|
function PieChartControls({ config, defaultOpen, onChange }) {
|
|
3220
|
-
config = (0,
|
|
3901
|
+
config = (0, import_lodash5.defaults)(config, defaultConfig);
|
|
3221
3902
|
function onCalculationChange(cal) {
|
|
3222
3903
|
config && onChange((0, import_immer6.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
3223
3904
|
}
|
|
@@ -3231,15 +3912,15 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3231
3912
|
})
|
|
3232
3913
|
);
|
|
3233
3914
|
}
|
|
3234
|
-
return /* @__PURE__ */ (0,
|
|
3235
|
-
|
|
3915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3916
|
+
import_ui_core13.DisclosurePanel,
|
|
3236
3917
|
{
|
|
3237
3918
|
title: "Pie Chart Options",
|
|
3238
3919
|
defaultOpen,
|
|
3239
3920
|
containerClassName: "w-full bg-default-bg",
|
|
3240
|
-
children: /* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
|
|
3921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
3922
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "shadow-xs flex rounded-md", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3923
|
+
import_ui_core13.NewButtonGroup,
|
|
3243
3924
|
{
|
|
3244
3925
|
small: true,
|
|
3245
3926
|
buttons: PieTypeItems,
|
|
@@ -3247,22 +3928,22 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3247
3928
|
onChange: onPieTypeChange
|
|
3248
3929
|
}
|
|
3249
3930
|
) }),
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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" }),
|
|
3933
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3253
3934
|
"select",
|
|
3254
3935
|
{
|
|
3255
3936
|
value: config.calculation,
|
|
3256
3937
|
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
3938
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3258
3939
|
children: CalculationItems.map((d) => {
|
|
3259
|
-
return /* @__PURE__ */ (0,
|
|
3940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3260
3941
|
})
|
|
3261
3942
|
}
|
|
3262
3943
|
)
|
|
3263
3944
|
] }),
|
|
3264
|
-
/* @__PURE__ */ (0,
|
|
3265
|
-
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3946
|
+
import_ui_core13.Checkbox,
|
|
3266
3947
|
{
|
|
3267
3948
|
checked: config?.showValue,
|
|
3268
3949
|
onChange: (v) => toggle("showValue", v),
|
|
@@ -3270,8 +3951,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3270
3951
|
labelClassName: "whitespace-nowrap"
|
|
3271
3952
|
}
|
|
3272
3953
|
),
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3274
|
-
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3955
|
+
import_ui_core13.Checkbox,
|
|
3275
3956
|
{
|
|
3276
3957
|
checked: config?.showPercent,
|
|
3277
3958
|
onChange: (v) => toggle("showPercent", v),
|
|
@@ -3279,8 +3960,8 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3279
3960
|
labelClassName: "whitespace-nowrap"
|
|
3280
3961
|
}
|
|
3281
3962
|
),
|
|
3282
|
-
/* @__PURE__ */ (0,
|
|
3283
|
-
|
|
3963
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3964
|
+
import_ui_core13.Checkbox,
|
|
3284
3965
|
{
|
|
3285
3966
|
checked: config?.absValue,
|
|
3286
3967
|
onChange: (v) => toggle("absValue", v),
|
|
@@ -3295,9 +3976,9 @@ function PieChartControls({ config, defaultOpen, onChange }) {
|
|
|
3295
3976
|
|
|
3296
3977
|
// src/charts/options/BarGaugeControls.tsx
|
|
3297
3978
|
var import_immer7 = require("immer");
|
|
3298
|
-
var
|
|
3299
|
-
var
|
|
3300
|
-
var
|
|
3979
|
+
var import_lodash6 = require("lodash");
|
|
3980
|
+
var import_ui_core14 = require("@sentio/ui-core");
|
|
3981
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3301
3982
|
var defaultConfig2 = {
|
|
3302
3983
|
direction: "HORIZONTAL",
|
|
3303
3984
|
calculation: "LAST",
|
|
@@ -3327,7 +4008,7 @@ var orderItems = [
|
|
|
3327
4008
|
{ label: "Descendant", value: "true" }
|
|
3328
4009
|
];
|
|
3329
4010
|
function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
3330
|
-
config = (0,
|
|
4011
|
+
config = (0, import_lodash6.defaults)(config, defaultConfig2);
|
|
3331
4012
|
function onCalculationChange(cal) {
|
|
3332
4013
|
config && onChange((0, import_immer7.produce)(config, (draft) => void (draft.calculation = cal)));
|
|
3333
4014
|
}
|
|
@@ -3342,70 +4023,70 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3342
4023
|
})
|
|
3343
4024
|
);
|
|
3344
4025
|
}
|
|
3345
|
-
function onSortByChange(
|
|
4026
|
+
function onSortByChange(sortBy3) {
|
|
3346
4027
|
config && onChange(
|
|
3347
4028
|
(0, import_immer7.produce)(config, (draft) => {
|
|
3348
4029
|
draft.sort = draft.sort || {};
|
|
3349
|
-
draft.sort.sortBy =
|
|
4030
|
+
draft.sort.sortBy = sortBy3;
|
|
3350
4031
|
})
|
|
3351
4032
|
);
|
|
3352
4033
|
}
|
|
3353
|
-
return /* @__PURE__ */ (0,
|
|
3354
|
-
|
|
4034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4035
|
+
import_ui_core14.DisclosurePanel,
|
|
3355
4036
|
{
|
|
3356
4037
|
title: "Bar Gauge Options",
|
|
3357
4038
|
defaultOpen,
|
|
3358
4039
|
containerClassName: "w-full bg-default-bg",
|
|
3359
|
-
children: /* @__PURE__ */ (0,
|
|
3360
|
-
/* @__PURE__ */ (0,
|
|
3361
|
-
/* @__PURE__ */ (0,
|
|
3362
|
-
/* @__PURE__ */ (0,
|
|
4040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
4041
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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" }),
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3363
4044
|
"select",
|
|
3364
4045
|
{
|
|
3365
4046
|
value: config.direction,
|
|
3366
4047
|
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
4048
|
onChange: (e) => onDirectionChange(e.target.value),
|
|
3368
4049
|
children: directionItems.map((d) => {
|
|
3369
|
-
return /* @__PURE__ */ (0,
|
|
4050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3370
4051
|
})
|
|
3371
4052
|
}
|
|
3372
4053
|
)
|
|
3373
4054
|
] }),
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
3375
|
-
/* @__PURE__ */ (0,
|
|
3376
|
-
/* @__PURE__ */ (0,
|
|
4055
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4056
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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" }),
|
|
4057
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3377
4058
|
"select",
|
|
3378
4059
|
{
|
|
3379
4060
|
value: config.calculation,
|
|
3380
4061
|
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
4062
|
onChange: (e) => onCalculationChange(e.target.value),
|
|
3382
4063
|
children: CalculationItems2.map((d) => {
|
|
3383
|
-
return /* @__PURE__ */ (0,
|
|
4064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3384
4065
|
})
|
|
3385
4066
|
}
|
|
3386
4067
|
)
|
|
3387
4068
|
] }),
|
|
3388
|
-
/* @__PURE__ */ (0,
|
|
3389
|
-
/* @__PURE__ */ (0,
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "shadow-xs flex rounded-md", children: [
|
|
4070
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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" }),
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3391
4072
|
"select",
|
|
3392
4073
|
{
|
|
3393
4074
|
value: config?.sort?.sortBy,
|
|
3394
4075
|
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
4076
|
onChange: (e) => onSortByChange(e.target.value),
|
|
3396
4077
|
children: sortByItems.map((d) => {
|
|
3397
|
-
return /* @__PURE__ */ (0,
|
|
4078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3398
4079
|
})
|
|
3399
4080
|
}
|
|
3400
4081
|
),
|
|
3401
|
-
/* @__PURE__ */ (0,
|
|
4082
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3402
4083
|
"select",
|
|
3403
4084
|
{
|
|
3404
4085
|
value: config?.sort?.orderDesc + "",
|
|
3405
4086
|
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
4087
|
onChange: (e) => onOrderChange(e.target.value === "true"),
|
|
3407
4088
|
children: orderItems.map((d) => {
|
|
3408
|
-
return /* @__PURE__ */ (0,
|
|
4089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: d.value + "", children: d.label }, d.label);
|
|
3409
4090
|
})
|
|
3410
4091
|
}
|
|
3411
4092
|
)
|
|
@@ -3417,13 +4098,13 @@ function BarGaugeControls({ config, defaultOpen, onChange }) {
|
|
|
3417
4098
|
|
|
3418
4099
|
// src/charts/options/ValueOptions.tsx
|
|
3419
4100
|
var import_immer9 = require("immer");
|
|
3420
|
-
var
|
|
4101
|
+
var import_ui_core16 = require("@sentio/ui-core");
|
|
3421
4102
|
|
|
3422
4103
|
// src/charts/options/ValueStringMapping.tsx
|
|
3423
|
-
var
|
|
3424
|
-
var
|
|
4104
|
+
var import_lu5 = require("react-icons/lu");
|
|
4105
|
+
var import_ui_core15 = require("@sentio/ui-core");
|
|
3425
4106
|
var import_immer8 = require("immer");
|
|
3426
|
-
var
|
|
4107
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3427
4108
|
var operators = {
|
|
3428
4109
|
">": "greater than",
|
|
3429
4110
|
">=": "greater or equal",
|
|
@@ -3433,17 +4114,17 @@ var operators = {
|
|
|
3433
4114
|
"<=": "less or equal"
|
|
3434
4115
|
};
|
|
3435
4116
|
var renderTreeLine = (index, isLast) => {
|
|
3436
|
-
return /* @__PURE__ */ (0,
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
4117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mr-2 flex h-12 w-3 flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex h-full w-full items-center", children: [
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3438
4119
|
"div",
|
|
3439
4120
|
{
|
|
3440
|
-
className: (0,
|
|
4121
|
+
className: (0, import_ui_core15.classNames)(
|
|
3441
4122
|
"w-px bg-gray-300",
|
|
3442
4123
|
isLast ? "h-1/2 self-start" : index === 0 ? "h-full self-end" : "h-full"
|
|
3443
4124
|
)
|
|
3444
4125
|
}
|
|
3445
4126
|
),
|
|
3446
|
-
/* @__PURE__ */ (0,
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-px w-3 bg-gray-300" })
|
|
3447
4128
|
] }) });
|
|
3448
4129
|
};
|
|
3449
4130
|
function ValueStringMapping({ rules, onChange }) {
|
|
@@ -3474,31 +4155,31 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3474
4155
|
})
|
|
3475
4156
|
);
|
|
3476
4157
|
}
|
|
3477
|
-
return /* @__PURE__ */ (0,
|
|
4158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full flex-col rounded-md py-2", children: [
|
|
3478
4159
|
(rules || []).map((rule, index) => {
|
|
3479
4160
|
const isLast = index === (rules || []).length - 1;
|
|
3480
|
-
return /* @__PURE__ */ (0,
|
|
4161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3481
4162
|
"div",
|
|
3482
4163
|
{
|
|
3483
4164
|
className: "text-text-foreground flex h-10 items-center py-1",
|
|
3484
4165
|
children: [
|
|
3485
4166
|
renderTreeLine(index, isLast),
|
|
3486
|
-
/* @__PURE__ */ (0,
|
|
3487
|
-
/* @__PURE__ */ (0,
|
|
4167
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center pr-3 font-medium", children: "If value is" }),
|
|
4168
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3488
4169
|
"select",
|
|
3489
4170
|
{
|
|
3490
4171
|
value: rule.comparison,
|
|
3491
4172
|
onChange: (e) => changeRule(index, "comparison", e.target.value),
|
|
3492
4173
|
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
4174
|
children: Object.entries(operators).map(([op, display]) => {
|
|
3494
|
-
return /* @__PURE__ */ (0,
|
|
4175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: op, children: [
|
|
3495
4176
|
"is ",
|
|
3496
4177
|
display
|
|
3497
4178
|
] }, op);
|
|
3498
4179
|
})
|
|
3499
4180
|
}
|
|
3500
4181
|
),
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
4182
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3502
4183
|
"input",
|
|
3503
4184
|
{
|
|
3504
4185
|
type: "text",
|
|
@@ -3512,8 +4193,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3512
4193
|
}
|
|
3513
4194
|
}
|
|
3514
4195
|
),
|
|
3515
|
-
/* @__PURE__ */ (0,
|
|
3516
|
-
/* @__PURE__ */ (0,
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "sm:text-ilabel inline-flex h-full items-center rounded-none px-3 font-medium", children: ", then show" }),
|
|
4197
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3517
4198
|
"input",
|
|
3518
4199
|
{
|
|
3519
4200
|
type: "text",
|
|
@@ -3527,15 +4208,15 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3527
4208
|
}
|
|
3528
4209
|
}
|
|
3529
4210
|
),
|
|
3530
|
-
/* @__PURE__ */ (0,
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3531
4212
|
"button",
|
|
3532
4213
|
{
|
|
3533
4214
|
type: "button",
|
|
3534
4215
|
className: "mx-2",
|
|
3535
4216
|
"aria-label": "remove",
|
|
3536
4217
|
onClick: () => removeRule(index),
|
|
3537
|
-
children: /* @__PURE__ */ (0,
|
|
3538
|
-
|
|
4218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4219
|
+
import_lu5.LuTrash2,
|
|
3539
4220
|
{
|
|
3540
4221
|
className: "icon text-text-foreground-disabled",
|
|
3541
4222
|
"aria-hidden": "true"
|
|
@@ -3548,8 +4229,8 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3548
4229
|
index
|
|
3549
4230
|
);
|
|
3550
4231
|
}),
|
|
3551
|
-
/* @__PURE__ */ (0,
|
|
3552
|
-
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4233
|
+
import_ui_core15.Button,
|
|
3553
4234
|
{
|
|
3554
4235
|
type: "button",
|
|
3555
4236
|
role: "secondary",
|
|
@@ -3557,7 +4238,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3557
4238
|
"aria-label": "remove",
|
|
3558
4239
|
onClick: addRule,
|
|
3559
4240
|
children: [
|
|
3560
|
-
/* @__PURE__ */ (0,
|
|
4241
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lu5.LuPlus, { className: (0, import_ui_core15.classNames)("h-4 w-4"), "aria-hidden": "true" }),
|
|
3561
4242
|
"Add Formatting Rule"
|
|
3562
4243
|
]
|
|
3563
4244
|
}
|
|
@@ -3566,7 +4247,7 @@ function ValueStringMapping({ rules, onChange }) {
|
|
|
3566
4247
|
}
|
|
3567
4248
|
|
|
3568
4249
|
// src/charts/options/ValueOptions.tsx
|
|
3569
|
-
var
|
|
4250
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3570
4251
|
var ValueFormatters = [
|
|
3571
4252
|
{ label: "Number", value: "NumberFormatter" },
|
|
3572
4253
|
{ label: "Date", value: "DateFormatter" },
|
|
@@ -3595,10 +4276,10 @@ var CurrencySymbols = [
|
|
|
3595
4276
|
var AddonLabel = ({
|
|
3596
4277
|
className,
|
|
3597
4278
|
children
|
|
3598
|
-
}) => /* @__PURE__ */ (0,
|
|
4279
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3599
4280
|
"span",
|
|
3600
4281
|
{
|
|
3601
|
-
className: (0,
|
|
4282
|
+
className: (0, import_ui_core16.classNames)(
|
|
3602
4283
|
"sm:text-ilabel border-main inline-flex items-center whitespace-nowrap bg-gray-50 px-3",
|
|
3603
4284
|
className
|
|
3604
4285
|
),
|
|
@@ -3671,9 +4352,9 @@ var ValueOptions = ({
|
|
|
3671
4352
|
function numberAddons(style) {
|
|
3672
4353
|
switch (style) {
|
|
3673
4354
|
case "None":
|
|
3674
|
-
return /* @__PURE__ */ (0,
|
|
3675
|
-
/* @__PURE__ */ (0,
|
|
3676
|
-
/* @__PURE__ */ (0,
|
|
4355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4356
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0", children: "Fraction Digits" }),
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3677
4358
|
"input",
|
|
3678
4359
|
{
|
|
3679
4360
|
disabled: true,
|
|
@@ -3684,9 +4365,9 @@ var ValueOptions = ({
|
|
|
3684
4365
|
] });
|
|
3685
4366
|
case "Percent":
|
|
3686
4367
|
case "Standard":
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3688
|
-
/* @__PURE__ */ (0,
|
|
3689
|
-
/* @__PURE__ */ (0,
|
|
4368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4369
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-x-0", children: "Fraction Digits" }),
|
|
4370
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3690
4371
|
"input",
|
|
3691
4372
|
{
|
|
3692
4373
|
type: "number",
|
|
@@ -3700,10 +4381,10 @@ var ValueOptions = ({
|
|
|
3700
4381
|
)
|
|
3701
4382
|
] });
|
|
3702
4383
|
case "Currency":
|
|
3703
|
-
return /* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3705
|
-
/* @__PURE__ */ (0,
|
|
3706
|
-
|
|
4384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-r-0", children: "Symbol" }),
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-28 ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4387
|
+
import_ui_core16.ComboInput,
|
|
3707
4388
|
{
|
|
3708
4389
|
onChange: onChangeSymbol,
|
|
3709
4390
|
options: CurrencySymbols.map((s) => s.value),
|
|
@@ -3715,8 +4396,8 @@ var ValueOptions = ({
|
|
|
3715
4396
|
value: config?.currencySymbol
|
|
3716
4397
|
}
|
|
3717
4398
|
) }),
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border", children: "Precision" }),
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3720
4401
|
"input",
|
|
3721
4402
|
{
|
|
3722
4403
|
type: "number",
|
|
@@ -3731,9 +4412,9 @@ var ValueOptions = ({
|
|
|
3731
4412
|
)
|
|
3732
4413
|
] });
|
|
3733
4414
|
default:
|
|
3734
|
-
return /* @__PURE__ */ (0,
|
|
3735
|
-
/* @__PURE__ */ (0,
|
|
3736
|
-
/* @__PURE__ */ (0,
|
|
4415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-x-0", children: "Max significant digits" }),
|
|
4417
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3737
4418
|
"input",
|
|
3738
4419
|
{
|
|
3739
4420
|
type: "number",
|
|
@@ -3748,62 +4429,62 @@ var ValueOptions = ({
|
|
|
3748
4429
|
] });
|
|
3749
4430
|
}
|
|
3750
4431
|
}
|
|
3751
|
-
return /* @__PURE__ */ (0,
|
|
3752
|
-
/* @__PURE__ */ (0,
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
4432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4433
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex", children: [
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "rounded-l-md border border-r-0", children: "Value formatter" }),
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3755
4436
|
"select",
|
|
3756
4437
|
{
|
|
3757
4438
|
value: config.valueFormatter,
|
|
3758
|
-
className: (0,
|
|
4439
|
+
className: (0, import_ui_core16.classNames)(
|
|
3759
4440
|
"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
4441
|
config.valueFormatter == "StringFormatter" ? "rounded-r-md" : ""
|
|
3761
4442
|
),
|
|
3762
4443
|
onChange: (e) => onChangeFormatter(e.target.value),
|
|
3763
4444
|
children: formatters.map((d) => {
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
4445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3765
4446
|
})
|
|
3766
4447
|
}
|
|
3767
4448
|
),
|
|
3768
|
-
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0,
|
|
3769
|
-
/* @__PURE__ */ (0,
|
|
3770
|
-
/* @__PURE__ */ (0,
|
|
4449
|
+
config.valueFormatter == "NumberFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0 border-r-0", children: "Style" }),
|
|
4451
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3771
4452
|
"select",
|
|
3772
4453
|
{
|
|
3773
4454
|
value: config.style,
|
|
3774
4455
|
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
4456
|
onChange: (e) => onStyleChange(e.target.value),
|
|
3776
4457
|
children: [
|
|
3777
|
-
/* @__PURE__ */ (0,
|
|
3778
|
-
/* @__PURE__ */ (0,
|
|
3779
|
-
/* @__PURE__ */ (0,
|
|
3780
|
-
/* @__PURE__ */ (0,
|
|
3781
|
-
/* @__PURE__ */ (0,
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
4458
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "None", children: "None" }),
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Compact", children: "Compact" }),
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Standard", children: "Standard" }),
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Scientific", children: "Scientific" }),
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Percent", children: "Percent" }),
|
|
4463
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: "Currency", children: "Currency" })
|
|
3783
4464
|
]
|
|
3784
4465
|
}
|
|
3785
4466
|
),
|
|
3786
4467
|
config.style && numberAddons(config.style)
|
|
3787
4468
|
] }),
|
|
3788
|
-
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
4469
|
+
config.valueFormatter == "DateFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AddonLabel, { className: "border border-l-0", children: "Date format" }),
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3791
4472
|
"select",
|
|
3792
4473
|
{
|
|
3793
4474
|
value: config.dateFormat,
|
|
3794
4475
|
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
4476
|
onChange: (e) => onChangeDateFormat(e.target.value),
|
|
3796
4477
|
children: dateFormats.map((d) => {
|
|
3797
|
-
return /* @__PURE__ */ (0,
|
|
4478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("option", { value: d.value, children: d.label }, d.value);
|
|
3798
4479
|
})
|
|
3799
4480
|
}
|
|
3800
4481
|
)
|
|
3801
4482
|
] })
|
|
3802
4483
|
] }) }),
|
|
3803
|
-
(showPrefix || showSuffix) && /* @__PURE__ */ (0,
|
|
3804
|
-
showPrefix && /* @__PURE__ */ (0,
|
|
3805
|
-
/* @__PURE__ */ (0,
|
|
3806
|
-
/* @__PURE__ */ (0,
|
|
4484
|
+
(showPrefix || showSuffix) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mt-2 flex items-center gap-4", children: [
|
|
4485
|
+
showPrefix && /* @__PURE__ */ (0, import_jsx_runtime28.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: [
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Prefix" }),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3807
4488
|
"input",
|
|
3808
4489
|
{
|
|
3809
4490
|
type: "text",
|
|
@@ -3814,9 +4495,9 @@ var ValueOptions = ({
|
|
|
3814
4495
|
}
|
|
3815
4496
|
)
|
|
3816
4497
|
] }),
|
|
3817
|
-
showSuffix && /* @__PURE__ */ (0,
|
|
3818
|
-
/* @__PURE__ */ (0,
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
4498
|
+
showSuffix && /* @__PURE__ */ (0, import_jsx_runtime28.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: [
|
|
4499
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7.5 leading-7.5 border-r px-3", children: "Suffix" }),
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3820
4501
|
"input",
|
|
3821
4502
|
{
|
|
3822
4503
|
type: "text",
|
|
@@ -3828,7 +4509,7 @@ var ValueOptions = ({
|
|
|
3828
4509
|
)
|
|
3829
4510
|
] })
|
|
3830
4511
|
] }) }),
|
|
3831
|
-
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0,
|
|
4512
|
+
config.valueFormatter == "StringFormatter" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3832
4513
|
ValueStringMapping,
|
|
3833
4514
|
{
|
|
3834
4515
|
rules: config.mappingRules || [],
|
|
@@ -3839,10 +4520,10 @@ var ValueOptions = ({
|
|
|
3839
4520
|
};
|
|
3840
4521
|
|
|
3841
4522
|
// src/charts/options/ValueControls.tsx
|
|
3842
|
-
var
|
|
3843
|
-
var
|
|
4523
|
+
var import_lodash7 = require("lodash");
|
|
4524
|
+
var import_ui_core17 = require("@sentio/ui-core");
|
|
3844
4525
|
var import_immer10 = require("immer");
|
|
3845
|
-
var
|
|
4526
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3846
4527
|
var defaultConfig4 = {
|
|
3847
4528
|
valueFormatter: "NumberFormatter",
|
|
3848
4529
|
showValueLabel: false,
|
|
@@ -3860,7 +4541,7 @@ var ValueControls = ({
|
|
|
3860
4541
|
showPrefix,
|
|
3861
4542
|
showSuffix
|
|
3862
4543
|
}) => {
|
|
3863
|
-
config = (0,
|
|
4544
|
+
config = (0, import_lodash7.defaults)(config || {}, defaultConfig4);
|
|
3864
4545
|
function toggleShowValueLabel(checked) {
|
|
3865
4546
|
config && onChange(
|
|
3866
4547
|
(0, import_immer10.produce)(config, (draft) => void (draft.showValueLabel = checked))
|
|
@@ -3869,14 +4550,14 @@ var ValueControls = ({
|
|
|
3869
4550
|
function toggleTooltipTotal(checked) {
|
|
3870
4551
|
config && onChange((0, import_immer10.produce)(config, (draft) => void (draft.tooltipTotal = checked)));
|
|
3871
4552
|
}
|
|
3872
|
-
return /* @__PURE__ */ (0,
|
|
3873
|
-
|
|
4553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4554
|
+
import_ui_core17.DisclosurePanel,
|
|
3874
4555
|
{
|
|
3875
4556
|
title: "Value Options",
|
|
3876
4557
|
defaultOpen,
|
|
3877
4558
|
containerClassName: "w-full bg-default-bg",
|
|
3878
4559
|
children: [
|
|
3879
|
-
/* @__PURE__ */ (0,
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3880
4561
|
ValueOptions,
|
|
3881
4562
|
{
|
|
3882
4563
|
onChange,
|
|
@@ -3886,17 +4567,17 @@ var ValueControls = ({
|
|
|
3886
4567
|
showSuffix
|
|
3887
4568
|
}
|
|
3888
4569
|
),
|
|
3889
|
-
/* @__PURE__ */ (0,
|
|
3890
|
-
/* @__PURE__ */ (0,
|
|
3891
|
-
|
|
4570
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
4571
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4572
|
+
import_ui_core17.Checkbox,
|
|
3892
4573
|
{
|
|
3893
4574
|
checked: config?.showValueLabel,
|
|
3894
4575
|
onChange: toggleShowValueLabel,
|
|
3895
4576
|
label: "Show value label"
|
|
3896
4577
|
}
|
|
3897
4578
|
),
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
|
|
4579
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4580
|
+
import_ui_core17.Checkbox,
|
|
3900
4581
|
{
|
|
3901
4582
|
checked: config?.tooltipTotal,
|
|
3902
4583
|
onChange: toggleTooltipTotal,
|
|
@@ -3918,6 +4599,7 @@ var ValueControls = ({
|
|
|
3918
4599
|
BarGuageIcon,
|
|
3919
4600
|
BarIcon,
|
|
3920
4601
|
ChartLegend,
|
|
4602
|
+
ChartTooltip,
|
|
3921
4603
|
ChartTypeButtonGroup,
|
|
3922
4604
|
EventsFunctionCategories,
|
|
3923
4605
|
EventsFunctionMap,
|
|
@@ -3930,12 +4612,14 @@ var ValueControls = ({
|
|
|
3930
4612
|
LabelsInput,
|
|
3931
4613
|
LineControls,
|
|
3932
4614
|
LineIcon,
|
|
4615
|
+
PieChart,
|
|
3933
4616
|
PieChartControls,
|
|
3934
4617
|
PieIcon,
|
|
3935
4618
|
QueryValueIcon,
|
|
3936
4619
|
ReactEChartsBase,
|
|
3937
4620
|
RefreshButton,
|
|
3938
4621
|
RefreshContext,
|
|
4622
|
+
ScatterChartTooltip,
|
|
3939
4623
|
ScatterIcon,
|
|
3940
4624
|
SystemLabels,
|
|
3941
4625
|
TableIcon,
|